GeoIP
1.6.12
About: GeoIP is a C library that enables the user to find the country that any IP address or hostname originates from (contains an initial free GeoIP Country database).
![]() ![]() |
#include "GeoIP.h"
#include "GeoIP_internal.h"
#include <netdb.h>
#include <sys/mman.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
Go to the source code of this file.
Macros | |
#define | _UNUSED |
#define | INADDR_NONE -1 |
#define | COUNTRY_BEGIN 16776960 |
#define | LARGE_COUNTRY_BEGIN 16515072 |
#define | STATE_BEGIN_REV0 16700000 |
#define | STATE_BEGIN_REV1 16000000 |
#define | STRUCTURE_INFO_MAX_SIZE 20 |
#define | DATABASE_INFO_MAX_SIZE 100 |
#define | MAX_ORG_RECORD_LENGTH 300 |
#define | US_OFFSET 1 |
#define | CANADA_OFFSET 677 |
#define | WORLD_OFFSET 1353 |
#define | FIPS_RANGE 360 |
#define | DEBUG_MSGF(flags, fmt, ...) |
#define | pread(fd, buf, count, offset) (lseek(fd, offset, SEEK_SET) == offset ? read(fd, buf, count) : -1) |
#define | ADDR_STR_LEN (8 * 4 + 7 + 1) |
Variables | |
static geoipv6_t | IPV6_NULL |
const char | GeoIP_country_code [256][3] |
static const unsigned | num_GeoIP_countries |
const char | GeoIP_country_code3 [256][4] |
const char * | GeoIP_utf8_country_name [256] |
const char * | GeoIP_country_name [256] |
const char | GeoIP_country_continent [256][3] |
const char * | GeoIPDBDescription [(38+1)] |
char * | GeoIP_custom_directory = NULL |
char ** | GeoIPDBFileName = NULL |
#define DEBUG_MSGF | ( | flags, | |
fmt, | |||
... | |||
) |
#define pread | ( | fd, | |
buf, | |||
count, | |||
offset | |||
) | (lseek(fd, offset, SEEK_SET) == offset ? read(fd, buf, count) : -1) |
void __GEOIP_PREPARE_TEREDO | ( | geoipv6_t * | v6 | ) |
Definition at line 784 of file GeoIP.c.
Referenced by _GeoIP_seek_record_v6_gl().
int __GEOIP_V6_IS_NULL | ( | geoipv6_t | v6 | ) |
Definition at line 774 of file GeoIP.c.
Referenced by GeoIP_id_by_name_v6_gl(), GeoIP_name_by_name_v6_gl(), GeoIP_region_by_name_v6_gl(), and geoiplookup().
|
static |
Definition at line 1203 of file GeoIP.c.
References _setup_segments(), GeoIPTag::cache, GeoIPTag::databaseSegments, DEBUG_MSGF, GeoIPTag::file_path, GeoIPTag::flags, GEOIP_CHECK_CACHE, GEOIP_INDEX_CACHE, GEOIP_MEMORY_CACHE, GEOIP_MMAP_CACHE, GeoIPTag::GeoIPDatabase, get_index_size(), GeoIPTag::index_cache, GeoIPTag::last_mtime_check, GeoIPTag::mtime, pread, and GeoIPTag::size.
Referenced by _GeoIP_seek_record_gl(), _GeoIP_seek_record_v6_gl(), and GeoIP_database_info().
|
static |
Definition at line 1039 of file GeoIP.c.
References GEOIP_COUNTRY_EDITION, GEOIP_COUNTRY_EDITION_V6, GEOIP_LARGE_COUNTRY_EDITION, GEOIP_LARGE_COUNTRY_EDITION_V6, GEOIP_NETSPEED_EDITION, GEOIP_PROXY_EDITION, GEOIP_REGION_EDITION_REV0, and GEOIP_REGION_EDITION_REV1.
Referenced by get_index_size().
|
static |
Definition at line 975 of file GeoIP.c.
Referenced by GeoIP_db_avail().
geoipv6_t _GeoIP_addr_to_num_v6 | ( | const char * | addr | ) |
Definition at line 1451 of file GeoIP.c.
References _GeoIP_inet_pton(), and IPV6_NULL.
Referenced by GeoIP_id_by_addr_v6_gl(), GeoIP_name_by_addr_v6_gl(), GeoIP_record_by_addr_v6(), GeoIP_record_id_by_addr_v6(), and GeoIP_region_by_addr_v6_gl().
char* _GeoIP_full_path_to | ( | const char * | file_name | ) |
Definition at line 852 of file GeoIP.c.
References GeoIP_custom_directory.
Referenced by _GeoIP_setup_dbfilename().
|
static |
Definition at line 769 of file GeoIP.c.
Referenced by _GeoIP_seek_record_v6_gl().
|
static |
Definition at line 765 of file GeoIP.c.
Referenced by _GeoIP_addr_to_num_v6().
char* _GeoIP_iso_8859_1__utf8 | ( | const char * | iso | ) |
Definition at line 980 of file GeoIP.c.
Referenced by _extract_record(), _get_name_gl(), and _get_name_v6_gl().
unsigned long _GeoIP_lookupaddress | ( | const char * | host | ) |
Definition at line 1803 of file GeoIP.c.
References INADDR_NONE.
Referenced by GeoIP_id_by_name_gl(), GeoIP_name_by_name_gl(), GeoIP_record_by_name(), GeoIP_region_by_name_gl(), and geoiplookup().
geoipv6_t _GeoIP_lookupaddress_v6 | ( | const char * | host | ) |
Definition at line 1856 of file GeoIP.c.
References IPV6_NULL.
Referenced by GeoIP_id_by_name_v6_gl(), GeoIP_name_by_name_v6_gl(), GeoIP_record_by_name_v6(), GeoIP_region_by_name_v6_gl(), and geoiplookup().
unsigned int _GeoIP_seek_record_gl | ( | GeoIP * | gi, |
unsigned long | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1460 of file GeoIP.c.
References _check_mtime(), GeoIPTag::cache, GeoIPTag::databaseSegments, DEBUG_MSGF, GeoIPTag::flags, GeoIPTag::GeoIPDatabase, GeoIPTag::index_cache, MAX_RECORD_LENGTH, GeoIPTag::netmask, GeoIPLookup::netmask, pread, GeoIPTag::record_length, and GeoIPTag::size.
Referenced by _GeoIP_seek_record(), _get_name_gl(), _get_record_gl(), GeoIP_assign_region_by_inetaddr_gl(), GeoIP_id_by_addr_gl(), GeoIP_id_by_ipnum_gl(), GeoIP_id_by_name_gl(), and GeoIP_range_by_ip_gl().
unsigned int _GeoIP_seek_record_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1359 of file GeoIP.c.
References __GEOIP_PREPARE_TEREDO(), _check_mtime(), _GeoIP_inet_ntop(), ADDR_STR_LEN, GeoIPTag::cache, GeoIPTag::databaseSegments, DEBUG_MSGF, GeoIPTag::flags, GEOIP_CHKBIT_V6, GeoIP_teredo(), GeoIPTag::GeoIPDatabase, GeoIPTag::index_cache, MAX_RECORD_LENGTH, GeoIPTag::netmask, GeoIPLookup::netmask, pread, GeoIPTag::record_length, and GeoIPTag::size.
Referenced by _GeoIP_seek_record_v6(), _get_name_v6_gl(), _get_record_v6_gl(), GeoIP_assign_region_by_inetaddr_v6_gl(), GeoIP_id_by_addr_v6_gl(), GeoIP_id_by_ipnum_v6_gl(), and GeoIP_id_by_name_v6_gl().
void _GeoIP_setup_dbfilename | ( | void | ) |
Definition at line 899 of file GeoIP.c.
References _GeoIP_full_path_to(), GEOIP_ACCURACYRADIUS_EDITION, GEOIP_ACCURACYRADIUS_EDITION_V6, GEOIP_ASNUM_EDITION, GEOIP_ASNUM_EDITION_V6, GEOIP_CITY_EDITION_REV0, GEOIP_CITY_EDITION_REV0_V6, GEOIP_CITY_EDITION_REV1, GEOIP_CITY_EDITION_REV1_V6, GEOIP_CITYCONF_EDITION, GEOIP_COUNTRY_EDITION, GEOIP_COUNTRY_EDITION_V6, GEOIP_COUNTRYCONF_EDITION, GEOIP_DOMAIN_EDITION, GEOIP_DOMAIN_EDITION_V6, GEOIP_ISP_EDITION, GEOIP_ISP_EDITION_V6, GEOIP_LARGE_COUNTRY_EDITION, GEOIP_LARGE_COUNTRY_EDITION_V6, GEOIP_LOCATIONA_EDITION, GEOIP_LOCATIONA_EDITION_V6, GEOIP_NETSPEED_EDITION, GEOIP_NETSPEED_EDITION_REV1, GEOIP_NETSPEED_EDITION_REV1_V6, GEOIP_ORG_EDITION, GEOIP_ORG_EDITION_V6, GEOIP_POSTALCONF_EDITION, GEOIP_PROXY_EDITION, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, GEOIP_REGIONCONF_EDITION, GEOIP_REGISTRAR_EDITION, GEOIP_REGISTRAR_EDITION_V6, GEOIP_USERTYPE_EDITION, GEOIP_USERTYPE_EDITION_V6, GeoIPDBFileName, and NUM_DB_TYPES.
Referenced by GeoIP_db_avail(), GeoIP_new(), GeoIP_open_type(), and main().
|
static |
Definition at line 2407 of file GeoIP.c.
References _GeoIP_iso_8859_1__utf8(), _GeoIP_seek_record_gl(), GeoIPTag::cache, GeoIPTag::charset, GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_ACCURACYRADIUS_EDITION, GEOIP_ASNUM_EDITION, GEOIP_CHARSET_UTF8, GEOIP_CITYCONF_EDITION, GEOIP_COUNTRYCONF_EDITION, GEOIP_DOMAIN_EDITION, GEOIP_ISP_EDITION, GEOIP_LOCATIONA_EDITION, GEOIP_NETSPEED_EDITION_REV1, GEOIP_ORG_EDITION, GEOIP_POSTALCONF_EDITION, GEOIP_REGIONCONF_EDITION, GEOIP_REGISTRAR_EDITION, GEOIP_USERTYPE_EDITION, GeoIPTag::GeoIPDatabase, get_db_description(), MAX_ORG_RECORD_LENGTH, pread, and GeoIPTag::record_length.
Referenced by GeoIP_name_by_addr_gl(), GeoIP_name_by_ipnum_gl(), and GeoIP_name_by_name_gl().
|
static |
Definition at line 2468 of file GeoIP.c.
References _GeoIP_iso_8859_1__utf8(), _GeoIP_seek_record_v6_gl(), GeoIPTag::cache, GeoIPTag::charset, GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_ACCURACYRADIUS_EDITION_V6, GEOIP_ASNUM_EDITION_V6, GEOIP_CHARSET_UTF8, GEOIP_DOMAIN_EDITION_V6, GEOIP_ISP_EDITION_V6, GEOIP_LOCATIONA_EDITION_V6, GEOIP_NETSPEED_EDITION_REV1_V6, GEOIP_ORG_EDITION, GEOIP_ORG_EDITION_V6, GEOIP_REGISTRAR_EDITION_V6, GEOIP_USERTYPE_EDITION_V6, GeoIPTag::GeoIPDatabase, get_db_description(), MAX_ORG_RECORD_LENGTH, pread, and GeoIPTag::record_length.
Referenced by GeoIP_name_by_addr_v6_gl(), GeoIP_name_by_ipnum_v6_gl(), and GeoIP_name_by_name_v6_gl().
|
static |
Definition at line 2285 of file GeoIP.c.
References GeoIP_assign_region_by_inetaddr_gl().
Referenced by GeoIP_region_by_addr_gl(), GeoIP_region_by_ipnum_gl(), and GeoIP_region_by_name_gl().
|
static |
Definition at line 2296 of file GeoIP.c.
References GeoIP_assign_region_by_inetaddr_v6_gl().
Referenced by GeoIP_region_by_addr_v6_gl(), GeoIP_region_by_ipnum_v6_gl(), and GeoIP_region_by_name_v6_gl().
|
static |
Definition at line 1077 of file GeoIP.c.
References COUNTRY_BEGIN, GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_ACCURACYRADIUS_EDITION, GEOIP_ACCURACYRADIUS_EDITION_V6, GEOIP_ASNUM_EDITION, GEOIP_ASNUM_EDITION_V6, GEOIP_CITY_EDITION_REV0, GEOIP_CITY_EDITION_REV0_V6, GEOIP_CITY_EDITION_REV1, GEOIP_CITY_EDITION_REV1_V6, GEOIP_CITYCONF_EDITION, GEOIP_COUNTRY_EDITION, GEOIP_COUNTRY_EDITION_V6, GEOIP_COUNTRYCONF_EDITION, GEOIP_DOMAIN_EDITION, GEOIP_DOMAIN_EDITION_V6, GEOIP_ISP_EDITION, GEOIP_ISP_EDITION_V6, GEOIP_LARGE_COUNTRY_EDITION, GEOIP_LARGE_COUNTRY_EDITION_V6, GEOIP_LOCATIONA_EDITION, GEOIP_NETSPEED_EDITION, GEOIP_NETSPEED_EDITION_REV1, GEOIP_NETSPEED_EDITION_REV1_V6, GEOIP_ORG_EDITION, GEOIP_ORG_EDITION_V6, GEOIP_POSTALCONF_EDITION, GEOIP_PROXY_EDITION, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, GEOIP_REGIONCONF_EDITION, GEOIP_REGISTRAR_EDITION, GEOIP_REGISTRAR_EDITION_V6, GEOIP_USERTYPE_EDITION, GEOIP_USERTYPE_EDITION_V6, GeoIPTag::GeoIPDatabase, LARGE_COUNTRY_BEGIN, LARGE_SEGMENT_RECORD_LENGTH, ORG_RECORD_LENGTH, pread, GeoIPTag::record_length, SEGMENT_RECORD_LENGTH, GeoIPTag::size, STANDARD_RECORD_LENGTH, STATE_BEGIN_REV0, STATE_BEGIN_REV1, and STRUCTURE_INFO_MAX_SIZE.
Referenced by _check_mtime(), and GeoIP_open().
unsigned long GeoIP_addr_to_num | ( | const char * | addr | ) |
Definition at line 1545 of file GeoIP.c.
Referenced by GeoIP_id_by_addr_gl(), GeoIP_is_private_v4(), GeoIP_name_by_addr_gl(), GeoIP_range_by_ip_gl(), GeoIP_record_by_addr(), GeoIP_record_id_by_addr(), and GeoIP_region_by_addr_gl().
void GeoIP_assign_region_by_inetaddr_gl | ( | GeoIP * | gi, |
unsigned long | inetaddr, | ||
GeoIPRegion * | region, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2171 of file GeoIP.c.
References _GeoIP_seek_record_gl(), CANADA_OFFSET, GeoIPRegionTag::country_code, GeoIPTag::databaseType, FIPS_RANGE, GeoIP_code_by_id(), GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, GeoIPRegionTag::region, STATE_BEGIN_REV0, STATE_BEGIN_REV1, US_OFFSET, and WORLD_OFFSET.
Referenced by _get_region_gl(), and GeoIP_assign_region_by_inetaddr().
void GeoIP_assign_region_by_inetaddr_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | inetaddr, | ||
GeoIPRegion * | region, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2227 of file GeoIP.c.
References _GeoIP_seek_record_v6_gl(), CANADA_OFFSET, GeoIPRegionTag::country_code, GeoIPTag::databaseType, FIPS_RANGE, GeoIP_code_by_id(), GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, GeoIPRegionTag::region, STATE_BEGIN_REV0, STATE_BEGIN_REV1, US_OFFSET, and WORLD_OFFSET.
Referenced by _get_region_v6_gl(), and GeoIP_assign_region_by_inetaddr_v6().
int GeoIP_charset | ( | GeoIP * | gi | ) |
Definition at line 2677 of file GeoIP.c.
References GeoIPTag::charset.
int GeoIP_cleanup | ( | void | ) |
Definition at line 2748 of file GeoIP.c.
References GeoIPDBFileName, and NUM_DB_TYPES.
const char* GeoIP_code3_by_id | ( | int | id | ) |
return three letter country code
Definition at line 2695 of file GeoIP.c.
References GeoIP_country_code3, and num_GeoIP_countries.
Referenced by GeoIP_country_code3_by_addr_gl(), GeoIP_country_code3_by_addr_v6_gl(), GeoIP_country_code3_by_ipnum_gl(), GeoIP_country_code3_by_ipnum_v6_gl(), GeoIP_country_code3_by_name_gl(), and GeoIP_country_code3_by_name_v6_gl().
const char* GeoIP_code_by_id | ( | int | id | ) |
return two letter country code
Definition at line 2686 of file GeoIP.c.
References GeoIP_country_code, and num_GeoIP_countries.
Referenced by GeoIP_assign_region_by_inetaddr_gl(), GeoIP_assign_region_by_inetaddr_v6_gl(), GeoIP_country_code_by_addr_gl(), GeoIP_country_code_by_addr_v6_gl(), GeoIP_country_code_by_ipnum_gl(), GeoIP_country_code_by_ipnum_v6_gl(), GeoIP_country_code_by_name_gl(), and GeoIP_country_code_by_name_v6_gl().
const char* GeoIP_continent_by_id | ( | int | id | ) |
return continent of country
Definition at line 2723 of file GeoIP.c.
References GeoIP_country_continent, and num_GeoIP_countries.
const char* GeoIP_country_code3_by_addr_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1946 of file GeoIP.c.
References GeoIP_code3_by_id(), and GeoIP_id_by_addr_gl().
Referenced by GeoIP_country_code3_by_addr().
const char* GeoIP_country_code3_by_addr_v6_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1937 of file GeoIP.c.
References GeoIP_code3_by_id(), and GeoIP_id_by_addr_v6_gl().
Referenced by GeoIP_country_code3_by_addr_v6().
const char* GeoIP_country_code3_by_ipnum_gl | ( | GeoIP * | gi, |
unsigned long | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1996 of file GeoIP.c.
References GeoIP_code3_by_id(), and GeoIP_id_by_ipnum_gl().
Referenced by GeoIP_country_code3_by_ipnum().
const char* GeoIP_country_code3_by_ipnum_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2004 of file GeoIP.c.
References GeoIP_code3_by_id(), and GeoIP_id_by_ipnum_v6_gl().
Referenced by GeoIP_country_code3_by_ipnum_v6().
const char* GeoIP_country_code3_by_name_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1783 of file GeoIP.c.
References GeoIP_code3_by_id(), and GeoIP_id_by_name_gl().
Referenced by GeoIP_country_code3_by_name().
const char* GeoIP_country_code3_by_name_v6_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1774 of file GeoIP.c.
References GeoIP_code3_by_id(), and GeoIP_id_by_name_v6_gl().
Referenced by GeoIP_country_code3_by_name_v6().
const char* GeoIP_country_code_by_addr_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1932 of file GeoIP.c.
References GeoIP_code_by_id(), and GeoIP_id_by_addr_gl().
Referenced by GeoIP_country_code_by_addr().
const char* GeoIP_country_code_by_addr_v6_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1925 of file GeoIP.c.
References GeoIP_code_by_id(), and GeoIP_id_by_addr_v6_gl().
Referenced by GeoIP_country_code_by_addr_v6().
const char* GeoIP_country_code_by_ipnum_gl | ( | GeoIP * | gi, |
unsigned long | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1981 of file GeoIP.c.
References GeoIP_code_by_id(), and GeoIP_id_by_ipnum_gl().
Referenced by GeoIP_country_code_by_ipnum().
const char* GeoIP_country_code_by_ipnum_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1990 of file GeoIP.c.
References GeoIP_code_by_id(), and GeoIP_id_by_ipnum_v6_gl().
Referenced by GeoIP_country_code_by_ipnum_v6().
const char* GeoIP_country_code_by_name_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1768 of file GeoIP.c.
References GeoIP_code_by_id(), and GeoIP_id_by_name_gl().
Referenced by GeoIP_country_code_by_name().
const char* GeoIP_country_code_by_name_v6_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1761 of file GeoIP.c.
References GeoIP_code_by_id(), and GeoIP_id_by_name_v6_gl().
Referenced by GeoIP_country_code_by_name_v6().
int GeoIP_country_id_by_addr_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2018 of file GeoIP.c.
References GeoIP_id_by_addr_gl().
int GeoIP_country_id_by_addr_v6_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2012 of file GeoIP.c.
References GeoIP_id_by_addr_v6_gl().
int GeoIP_country_id_by_name_gl | ( | GeoIP * | gi, |
const char * | host, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2028 of file GeoIP.c.
References GeoIP_id_by_name_gl().
int GeoIP_country_id_by_name_v6_gl | ( | GeoIP * | gi, |
const char * | host, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2022 of file GeoIP.c.
References GeoIP_id_by_name_v6_gl().
const char* GeoIP_country_name_by_addr_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1960 of file GeoIP.c.
References GeoIP_country_name_by_id(), and GeoIP_id_by_addr_gl().
Referenced by GeoIP_country_name_by_addr().
const char* GeoIP_country_name_by_addr_v6_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1953 of file GeoIP.c.
References GeoIP_country_name_by_id(), and GeoIP_id_by_addr_v6_gl().
Referenced by GeoIP_country_name_by_addr_v6().
const char* GeoIP_country_name_by_id | ( | GeoIP * | gi, |
int | id | ||
) |
return full name of country in utf8 or iso-8859-1
Definition at line 2704 of file GeoIP.c.
References GeoIPTag::charset, GEOIP_CHARSET_UTF8, GeoIP_country_name, GeoIP_utf8_country_name, and num_GeoIP_countries.
Referenced by _extract_record(), GeoIP_country_name_by_addr_gl(), GeoIP_country_name_by_addr_v6_gl(), GeoIP_country_name_by_ipnum_gl(), GeoIP_country_name_by_ipnum_v6_gl(), GeoIP_country_name_by_name_gl(), and GeoIP_country_name_by_name_v6_gl().
const char* GeoIP_country_name_by_ipnum_gl | ( | GeoIP * | gi, |
unsigned long | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1966 of file GeoIP.c.
References GeoIP_country_name_by_id(), and GeoIP_id_by_ipnum_gl().
Referenced by GeoIP_country_name_by_ipnum().
const char* GeoIP_country_name_by_ipnum_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1975 of file GeoIP.c.
References GeoIP_country_name_by_id(), and GeoIP_id_by_ipnum_v6_gl().
Referenced by GeoIP_country_name_by_ipnum_v6().
const char* GeoIP_country_name_by_name_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1797 of file GeoIP.c.
References GeoIP_country_name_by_id(), and GeoIP_id_by_name_gl().
Referenced by GeoIP_country_name_by_name().
const char* GeoIP_country_name_by_name_v6_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1790 of file GeoIP.c.
References GeoIP_country_name_by_id(), and GeoIP_id_by_name_v6_gl().
Referenced by GeoIP_country_name_by_name_v6().
unsigned char GeoIP_database_edition | ( | GeoIP * | gi | ) |
char* GeoIP_database_info | ( | GeoIP * | gi | ) |
Definition at line 2101 of file GeoIP.c.
References _check_mtime(), DATABASE_INFO_MAX_SIZE, GeoIPTag::GeoIPDatabase, pread, GeoIPTag::size, and STRUCTURE_INFO_MAX_SIZE.
Referenced by main().
int GeoIP_db_avail | ( | int | type | ) |
Definition at line 1026 of file GeoIP.c.
References _file_exists(), _GeoIP_setup_dbfilename(), GeoIPDBFileName, and NUM_DB_TYPES.
Referenced by main().
void GeoIP_delete | ( | GeoIP * | gi | ) |
Definition at line 1735 of file GeoIP.c.
References GeoIPTag::cache, GeoIPTag::databaseSegments, GeoIPTag::file_path, GeoIPTag::flags, GEOIP_MMAP_CACHE, GeoIPTag::GeoIPDatabase, GeoIPTag::index_cache, and GeoIPTag::size.
Referenced by GeoIP_open(), GeoIP_open_type(), and main().
int GeoIP_enable_teredo | ( | GeoIP * | gi, |
int | true_false | ||
) |
Definition at line 2662 of file GeoIP.c.
References GeoIPTag::ext_flags, and GEOIP_TEREDO_BIT.
int GeoIP_id_by_addr_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2050 of file GeoIP.c.
References _GeoIP_seek_record_gl(), GeoIPTag::databaseSegments, GeoIPTag::databaseType, GeoIP_addr_to_num(), GEOIP_COUNTRY_EDITION, GEOIP_LARGE_COUNTRY_EDITION, GEOIP_NETSPEED_EDITION, GEOIP_PROXY_EDITION, and get_db_description().
Referenced by GeoIP_country_code3_by_addr_gl(), GeoIP_country_code_by_addr_gl(), GeoIP_country_id_by_addr(), GeoIP_country_id_by_addr_gl(), GeoIP_country_name_by_addr_gl(), and GeoIP_id_by_addr().
int GeoIP_id_by_addr_v6_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2032 of file GeoIP.c.
References _GeoIP_addr_to_num_v6(), _GeoIP_seek_record_v6_gl(), GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_COUNTRY_EDITION_V6, GEOIP_LARGE_COUNTRY_EDITION_V6, and get_db_description().
Referenced by GeoIP_country_code3_by_addr_v6_gl(), GeoIP_country_code_by_addr_v6_gl(), GeoIP_country_id_by_addr_v6(), GeoIP_country_id_by_addr_v6_gl(), GeoIP_country_name_by_addr_v6_gl(), and GeoIP_id_by_addr_v6().
int GeoIP_id_by_code | ( | const char * | country | ) |
return id by country code
Definition at line 2732 of file GeoIP.c.
References GeoIP_country_code, and num_GeoIP_countries.
int GeoIP_id_by_ipnum_gl | ( | GeoIP * | gi, |
unsigned long | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2083 of file GeoIP.c.
References _GeoIP_seek_record_gl(), GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_COUNTRY_EDITION, GEOIP_LARGE_COUNTRY_EDITION, GEOIP_NETSPEED_EDITION, GEOIP_PROXY_EDITION, and get_db_description().
Referenced by GeoIP_country_code3_by_ipnum_gl(), GeoIP_country_code_by_ipnum_gl(), GeoIP_country_name_by_ipnum_gl(), and GeoIP_id_by_ipnum().
int GeoIP_id_by_ipnum_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2070 of file GeoIP.c.
References _GeoIP_seek_record_v6_gl(), GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_COUNTRY_EDITION_V6, GEOIP_LARGE_COUNTRY_EDITION_V6, and get_db_description().
Referenced by GeoIP_country_code3_by_ipnum_v6_gl(), GeoIP_country_code_by_ipnum_v6_gl(), GeoIP_country_name_by_ipnum_v6_gl(), and GeoIP_id_by_ipnum_v6().
int GeoIP_id_by_name_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1880 of file GeoIP.c.
References _GeoIP_lookupaddress(), _GeoIP_seek_record_gl(), GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_COUNTRY_EDITION, GEOIP_LARGE_COUNTRY_EDITION, GEOIP_NETSPEED_EDITION, GEOIP_PROXY_EDITION, and get_db_description().
Referenced by GeoIP_country_code3_by_name_gl(), GeoIP_country_code_by_name_gl(), GeoIP_country_id_by_name(), GeoIP_country_id_by_name_gl(), GeoIP_country_name_by_name_gl(), and GeoIP_id_by_name().
int GeoIP_id_by_name_v6_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 1902 of file GeoIP.c.
References __GEOIP_V6_IS_NULL(), _GeoIP_lookupaddress_v6(), _GeoIP_seek_record_v6_gl(), GeoIPTag::databaseSegments, GeoIPTag::databaseType, GEOIP_COUNTRY_EDITION_V6, GEOIP_LARGE_COUNTRY_EDITION_V6, and get_db_description().
Referenced by GeoIP_country_code3_by_name_v6_gl(), GeoIP_country_code_by_name_v6_gl(), GeoIP_country_id_by_name_v6(), GeoIP_country_id_by_name_v6_gl(), GeoIP_country_name_by_name_v6_gl(), and GeoIP_id_by_name_v6().
int GeoIP_is_private_ipnum_v4 | ( | unsigned long | ipnum | ) |
Definition at line 1011 of file GeoIP.c.
Referenced by GeoIP_is_private_v4().
int GeoIP_is_private_v4 | ( | const char * | addr | ) |
Definition at line 1021 of file GeoIP.c.
References GeoIP_addr_to_num(), and GeoIP_is_private_ipnum_v4().
char* GeoIP_name_by_addr_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2619 of file GeoIP.c.
References _get_name_gl(), and GeoIP_addr_to_num().
Referenced by GeoIP_name_by_addr(), and GeoIP_org_by_addr().
char* GeoIP_name_by_addr_v6_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2628 of file GeoIP.c.
References _GeoIP_addr_to_num_v6(), and _get_name_v6_gl().
Referenced by GeoIP_name_by_addr_v6(), and GeoIP_org_by_addr_v6().
const char* GeoIP_name_by_id | ( | int | id | ) |
return full name of country in iso-8859-1
Definition at line 2714 of file GeoIP.c.
References GeoIP_country_name, and num_GeoIP_countries.
char* GeoIP_name_by_ipnum_gl | ( | GeoIP * | gi, |
unsigned long | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2611 of file GeoIP.c.
References _get_name_gl().
Referenced by GeoIP_name_by_ipnum(), and GeoIP_org_by_ipnum().
char* GeoIP_name_by_ipnum_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2615 of file GeoIP.c.
References _get_name_v6_gl().
Referenced by GeoIP_name_by_ipnum_v6(), and GeoIP_org_by_ipnum_v6().
char* GeoIP_name_by_name_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2637 of file GeoIP.c.
References _GeoIP_lookupaddress(), and _get_name_gl().
Referenced by GeoIP_name_by_name(), and GeoIP_org_by_name().
char* GeoIP_name_by_name_v6_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2648 of file GeoIP.c.
References __GEOIP_V6_IS_NULL(), _GeoIP_lookupaddress_v6(), and _get_name_v6_gl().
Referenced by GeoIP_name_by_name_v6(), and GeoIP_org_by_name_v6().
GeoIP* GeoIP_new | ( | int | flags | ) |
Definition at line 1614 of file GeoIP.c.
References _GeoIP_setup_dbfilename(), GEOIP_COUNTRY_EDITION, GeoIP_open(), and GeoIPDBFileName.
unsigned GeoIP_num_countries | ( | void | ) |
return return number of known countries
Definition at line 2744 of file GeoIP.c.
References num_GeoIP_countries.
Referenced by geoiplookup().
char* GeoIP_num_to_addr | ( | unsigned long | ipnum | ) |
Definition at line 2526 of file GeoIP.c.
Referenced by GeoIP_range_by_ip_gl().
GeoIP* GeoIP_open | ( | const char * | filename, |
int | flags | ||
) |
Definition at line 1621 of file GeoIP.c.
References _setup_segments(), GeoIPTag::cache, GeoIPTag::charset, GeoIPTag::databaseSegments, DEBUG_MSGF, GeoIPTag::ext_flags, GeoIPTag::file_path, GeoIPTag::flags, GEOIP_CHARSET_ISO_8859_1, GEOIP_CHECK_CACHE, GeoIP_delete(), GEOIP_INDEX_CACHE, GEOIP_MEMORY_CACHE, GEOIP_MMAP_CACHE, GEOIP_TEREDO_BIT, GeoIPTag::GeoIPDatabase, get_index_size(), GeoIPTag::index_cache, GeoIPTag::last_mtime_check, GeoIPTag::mtime, pread, and GeoIPTag::size.
Referenced by GeoIP_new(), GeoIP_open_type(), and main().
GeoIP* GeoIP_open_type | ( | int | type, |
int | flags | ||
) |
Definition at line 1579 of file GeoIP.c.
References _GeoIP_setup_dbfilename(), GeoIPTag::databaseType, GEOIP_ASNUM_EDITION, GeoIP_delete(), GeoIP_open(), GEOIP_ORG_EDITION, GeoIPDBFileName, and NUM_DB_TYPES.
Referenced by main().
void GeoIP_range_by_ip_delete | ( | char ** | ptr | ) |
Definition at line 2599 of file GeoIP.c.
Referenced by _say_range_by_ip().
char** GeoIP_range_by_ip_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2553 of file GeoIP.c.
References _GeoIP_seek_record_gl(), GeoIP_addr_to_num(), GeoIP_num_to_addr(), GeoIPTag::netmask, and GeoIPLookup::netmask.
Referenced by GeoIP_range_by_ip().
GeoIPRegion* GeoIP_region_by_addr_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2307 of file GeoIP.c.
References _get_region_gl(), GeoIPTag::databaseType, GeoIP_addr_to_num(), GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, and get_db_description().
Referenced by GeoIP_region_by_addr().
GeoIPRegion* GeoIP_region_by_addr_v6_gl | ( | GeoIP * | gi, |
const char * | addr, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2324 of file GeoIP.c.
References _GeoIP_addr_to_num_v6(), _get_region_v6_gl(), GeoIPTag::databaseType, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, and get_db_description().
Referenced by GeoIP_region_by_addr_v6().
GeoIPRegion* GeoIP_region_by_ipnum_gl | ( | GeoIP * | gi, |
unsigned long | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2381 of file GeoIP.c.
References _get_region_gl(), GeoIPTag::databaseType, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, and get_db_description().
Referenced by GeoIP_region_by_ipnum().
GeoIPRegion* GeoIP_region_by_ipnum_v6_gl | ( | GeoIP * | gi, |
geoipv6_t | ipnum, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2393 of file GeoIP.c.
References _get_region_v6_gl(), GeoIPTag::databaseType, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, and get_db_description().
Referenced by GeoIP_region_by_ipnum_v6().
GeoIPRegion* GeoIP_region_by_name_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2341 of file GeoIP.c.
References _GeoIP_lookupaddress(), _get_region_gl(), GeoIPTag::databaseType, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, and get_db_description().
Referenced by GeoIP_region_by_name().
GeoIPRegion* GeoIP_region_by_name_v6_gl | ( | GeoIP * | gi, |
const char * | name, | ||
GeoIPLookup * | gl | ||
) |
Definition at line 2360 of file GeoIP.c.
References __GEOIP_V6_IS_NULL(), _GeoIP_lookupaddress_v6(), _get_region_v6_gl(), GeoIPTag::databaseType, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, and get_db_description().
Referenced by GeoIP_region_by_name_v6().
int GeoIP_set_charset | ( | GeoIP * | gi, |
int | charset | ||
) |
Definition at line 2679 of file GeoIP.c.
References GeoIPTag::charset.
void GeoIP_setup_custom_directory | ( | char * | dir | ) |
int GeoIP_teredo | ( | GeoIP * | gi | ) |
Definition at line 2672 of file GeoIP.c.
References GeoIPTag::ext_flags, and GEOIP_TEREDO_BIT.
Referenced by _GeoIP_seek_record_v6_gl().
void GeoIPRegion_delete | ( | GeoIPRegion * | gir | ) |
Definition at line 2404 of file GeoIP.c.
Referenced by geoiplookup().
|
static |
Definition at line 699 of file GeoIP.c.
References GeoIPDBDescription, and NUM_DB_TYPES.
Referenced by _get_name_gl(), _get_name_v6_gl(), GeoIP_id_by_addr_gl(), GeoIP_id_by_addr_v6_gl(), GeoIP_id_by_ipnum_gl(), GeoIP_id_by_ipnum_v6_gl(), GeoIP_id_by_name_gl(), GeoIP_id_by_name_v6_gl(), GeoIP_region_by_addr_gl(), GeoIP_region_by_addr_v6_gl(), GeoIP_region_by_ipnum_gl(), GeoIP_region_by_ipnum_v6_gl(), GeoIP_region_by_name_gl(), and GeoIP_region_by_name_v6_gl().
Definition at line 1052 of file GeoIP.c.
References _database_has_content(), GeoIPTag::databaseSegments, GeoIPTag::databaseType, and GeoIPTag::record_length.
Referenced by _check_mtime(), and GeoIP_open().
const char GeoIP_country_code[256][3] |
Definition at line 100 of file GeoIP.c.
Referenced by _extract_record(), GeoIP_code_by_id(), GeoIP_id_by_code(), and geoiplookup().
const char GeoIP_country_code3[256][4] |
Definition at line 127 of file GeoIP.c.
Referenced by _extract_record(), and GeoIP_code3_by_id().
const char GeoIP_country_continent[256][3] |
Definition at line 675 of file GeoIP.c.
Referenced by _extract_record(), and GeoIP_continent_by_id().
const char* GeoIP_country_name[256] |
Definition at line 413 of file GeoIP.c.
Referenced by GeoIP_country_name_by_id(), GeoIP_name_by_id(), and geoiplookup().
char* GeoIP_custom_directory = NULL |
Definition at line 848 of file GeoIP.c.
Referenced by _GeoIP_full_path_to(), and GeoIP_setup_custom_directory().
const char* GeoIP_utf8_country_name[256] |
Definition at line 153 of file GeoIP.c.
Referenced by GeoIP_country_name_by_id().
const char* GeoIPDBDescription[(38+1)] |
Definition at line 807 of file GeoIP.c.
Referenced by _get_record_gl(), _get_record_v6_gl(), GeoIP_record_id_by_addr(), GeoIP_record_id_by_addr_v6(), geoiplookup(), get_db_description(), and main().
char** GeoIPDBFileName = NULL |
Definition at line 897 of file GeoIP.c.
Referenced by _GeoIP_setup_dbfilename(), GeoIP_cleanup(), GeoIP_db_avail(), GeoIP_new(), and GeoIP_open_type().
|
static |
Definition at line 24 of file GeoIP.c.
Referenced by _GeoIP_addr_to_num_v6(), and _GeoIP_lookupaddress_v6().
|
static |
Definition at line 124 of file GeoIP.c.
Referenced by GeoIP_code3_by_id(), GeoIP_code_by_id(), GeoIP_continent_by_id(), GeoIP_country_name_by_id(), GeoIP_id_by_code(), GeoIP_name_by_id(), and GeoIP_num_countries().