template class xf::data_analytics::text::GeoIP

#include "geoip.hpp"

Overview

GeoIP Query geographic location ID based on IP.

Parameters:

uint512 512-bit wide unsigned integer data type
uint64 64-bit wide unsigned integer data type
uint32 32-bit wide unsigned integer data type
uint16 16-bit wide unsigned integer data type
Len1 The number of IPs placed in a 512-bit wide data
Len2 The number of networks placed in a 512-bit wide data
TH1 Query the query depth of the IP range
TH2 Query the depth of the query where the IP is located
template <
    typename uint512,
    typename uint64,
    typename uint32,
    typename uint16,
    int Len1 = 32,
    int Len2 = 24,
    int TH1 = 1,
    int TH2 = 1
    >
class GeoIP

Methods

GeoIP

GeoIP ()

GeoIP constructor.

init

init overload (1)

void init (
    uint32 len,
    uint64* netHigh16
    )

brief init Initialize parameters

Parameters:

len The length of netHigh16, default value is 65536
netHigh16 The netHigh16 store the position of the lower 21 bits of the network in the DDR

init overload (2)

void init (
    uint32 len,
    uint64* netHigh16,
    uint32 ipPosIn
    )

brief init Initialize parameters

Parameters:

len The length of netHigh16, default value is 65536
netHigh16 The netHigh16 store the position of the lower 21 bits of the network in the DDR

run

run overload (1)

void run (
    uint32 len,
    uint32* ipIn,
    uint512* netLow21,
    uint512* net2Low21,
    uint32* idOut
    )

run GeoIP ‘s core execution module

Parameters:

len The length of IP
ipIn The input of 32bit IP
netLow21 The low 21bit of the network
net2Low21 In order to achieve faster throughput, the content is the same as netLow21
idOut Return the id result of the query, 0xFFFFFFFF means the query failed

run overload (2)

void run (
    uint32 len,
    uint64* msg,
    uint16* msgLen,
    uint32* fieldOffset,
    uint512* netLow21,
    uint512* net2Low21,
    uint32* idOut
    )

extract IP from full message then run GeoIP ‘s core execution module to find the ID.

Parameters:

len The length of IP
msg the input message
msgLen the input length of each message.
fieldOffset the input offset for each sub-stirng
netLow21 The low 21bit of the network
net2Low21 In order to achieve faster throughput, the content is the same as netLow21
idOut Return the id result of the query, 0xFFFFFFFF means the query failed