Module egeoip_acl

Data Types

acldb()

acldb() = {binary(), binary(), tuple()}

ip()

ip() = ip24() | ip32() | invalid_ip

ip24()

ip24() = list() | binary() | {int(), int(), int()}

ip32()

ip32() = list() | binary() | {int(), int(), int(), int()}

Function Index

lookup/2Searches for 24-bit or 32-bit IP in the database generated from ACL file.
parse_file/1Parses an ACL file and converts it to an IP -> Zone index.
parse_ip24/1
parse_ips/1
parse_line/2

Function Details

lookup/2

lookup(IP::ip(), Database::acldb()) -> binary() | notfound | invalid_ip

Searches for 24-bit or 32-bit IP in the database generated from ACL file. Returns a binary name of the zone or 'notfound' if there's no zone associated with the IP.

parse_file/1

parse_file(Filename::string() | atom()) -> acldb()

Parses an ACL file and converts it to an IP -> Zone index.

IPs DATABASE FORMAT

{IPsBlob, IPsIndex, Zones}

1. IPsBlob consists of buckets, each bucket is associated with some 16-bit IP (M.N.*.*) and contains IP ranges associated with a zone hash:

StartIP_1:8, EndIP_1:8, Zone_1:16, StartIP_2:8, EndIP_2:8, Zone_2:16, ...

Thus, every IP range uses 4 bytes: 2 bytes for start and end of the range and 2 bytes for zone hash.

2. IPsIndex has 65536 parts associated with all possible 16-bit IPs (from 0.0.*.* to 255.255.*.*). Every part has 4 bytes:

BucketStart:16, BucketSize:16

BucketStart represents the offset of the bucket from PIsBlob associated with the target 16-bit IP, and BucketSize represents its size, in bytes.

3. Zones is a simple tuple of zones, associating zone number from IPsBlob's buckets with zone name.

parse_ip24/1

parse_ip24(IP) -> any()

parse_ips/1

parse_ips(IPsBin) -> any()

parse_line/2

parse_line(T, Zones) -> any()


Generated by EDoc, Nov 26 2014, 02:42:58.