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).
  Fossies Dox: GeoIP-1.6.12.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

GeoIP.c File Reference
#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>
Include dependency graph for GeoIP.c:

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)
 

Functions

static const char * get_db_description (int dbtype)
 
geoipv6_t _GeoIP_lookupaddress_v6 (const char *host)
 
static int _GeoIP_inet_pton (int af, const char *src, void *dst)
 
static const char * _GeoIP_inet_ntop (int af, const void *src, char *dst, socklen_t cnt)
 
int __GEOIP_V6_IS_NULL (geoipv6_t v6)
 
void __GEOIP_PREPARE_TEREDO (geoipv6_t *v6)
 
void GeoIP_setup_custom_directory (char *dir)
 
char * _GeoIP_full_path_to (const char *file_name)
 
void _GeoIP_setup_dbfilename (void)
 
static int _file_exists (const char *file_name)
 
char * _GeoIP_iso_8859_1__utf8 (const char *iso)
 
int GeoIP_is_private_ipnum_v4 (unsigned long ipnum)
 
int GeoIP_is_private_v4 (const char *addr)
 
int GeoIP_db_avail (int type)
 
static int _database_has_content (int database_type)
 
static ssize_t get_index_size (GeoIP *gi, struct stat *buf)
 
static void _setup_segments (GeoIP *gi)
 
static void _check_mtime (GeoIP *gi)
 
unsigned int _GeoIP_seek_record_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
geoipv6_t _GeoIP_addr_to_num_v6 (const char *addr)
 
unsigned int _GeoIP_seek_record_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
unsigned long GeoIP_addr_to_num (const char *addr)
 
GeoIPGeoIP_open_type (int type, int flags)
 
GeoIPGeoIP_new (int flags)
 
GeoIPGeoIP_open (const char *filename, int flags)
 
void GeoIP_delete (GeoIP *gi)
 
const char * GeoIP_country_code_by_name_v6_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
const char * GeoIP_country_code_by_name_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
const char * GeoIP_country_code3_by_name_v6_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
const char * GeoIP_country_code3_by_name_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
const char * GeoIP_country_name_by_name_v6_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
const char * GeoIP_country_name_by_name_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
unsigned long _GeoIP_lookupaddress (const char *host)
 
int GeoIP_id_by_name_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
int GeoIP_id_by_name_v6_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
const char * GeoIP_country_code_by_addr_v6_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
const char * GeoIP_country_code_by_addr_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
const char * GeoIP_country_code3_by_addr_v6_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
const char * GeoIP_country_code3_by_addr_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
const char * GeoIP_country_name_by_addr_v6_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
const char * GeoIP_country_name_by_addr_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
const char * GeoIP_country_name_by_ipnum_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
const char * GeoIP_country_name_by_ipnum_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
const char * GeoIP_country_code_by_ipnum_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
const char * GeoIP_country_code_by_ipnum_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
const char * GeoIP_country_code3_by_ipnum_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
const char * GeoIP_country_code3_by_ipnum_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
int GeoIP_country_id_by_addr_v6_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
int GeoIP_country_id_by_addr_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
int GeoIP_country_id_by_name_v6_gl (GeoIP *gi, const char *host, GeoIPLookup *gl)
 
int GeoIP_country_id_by_name_gl (GeoIP *gi, const char *host, GeoIPLookup *gl)
 
int GeoIP_id_by_addr_v6_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
int GeoIP_id_by_addr_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
int GeoIP_id_by_ipnum_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
int GeoIP_id_by_ipnum_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
char * GeoIP_database_info (GeoIP *gi)
 
void GeoIP_assign_region_by_inetaddr_gl (GeoIP *gi, unsigned long inetaddr, GeoIPRegion *region, GeoIPLookup *gl)
 
void GeoIP_assign_region_by_inetaddr_v6_gl (GeoIP *gi, geoipv6_t inetaddr, GeoIPRegion *region, GeoIPLookup *gl)
 
static GeoIPRegion_get_region_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
static GeoIPRegion_get_region_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
GeoIPRegionGeoIP_region_by_addr_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
GeoIPRegionGeoIP_region_by_addr_v6_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
GeoIPRegionGeoIP_region_by_name_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
GeoIPRegionGeoIP_region_by_name_v6_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
GeoIPRegionGeoIP_region_by_ipnum_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
GeoIPRegionGeoIP_region_by_ipnum_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
void GeoIPRegion_delete (GeoIPRegion *gir)
 
static char * _get_name_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
static char * _get_name_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
char * GeoIP_num_to_addr (unsigned long ipnum)
 
char ** GeoIP_range_by_ip_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
void GeoIP_range_by_ip_delete (char **ptr)
 
char * GeoIP_name_by_ipnum_gl (GeoIP *gi, unsigned long ipnum, GeoIPLookup *gl)
 
char * GeoIP_name_by_ipnum_v6_gl (GeoIP *gi, geoipv6_t ipnum, GeoIPLookup *gl)
 
char * GeoIP_name_by_addr_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
char * GeoIP_name_by_addr_v6_gl (GeoIP *gi, const char *addr, GeoIPLookup *gl)
 
char * GeoIP_name_by_name_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
char * GeoIP_name_by_name_v6_gl (GeoIP *gi, const char *name, GeoIPLookup *gl)
 
unsigned char GeoIP_database_edition (GeoIP *gi)
 
int GeoIP_enable_teredo (GeoIP *gi, int true_false)
 
int GeoIP_teredo (GeoIP *gi)
 
int GeoIP_charset (GeoIP *gi)
 
int GeoIP_set_charset (GeoIP *gi, int charset)
 
const char * GeoIP_code_by_id (int id)
 
const char * GeoIP_code3_by_id (int id)
 
const char * GeoIP_country_name_by_id (GeoIP *gi, int id)
 
const char * GeoIP_name_by_id (int id)
 
const char * GeoIP_continent_by_id (int id)
 
int GeoIP_id_by_code (const char *country)
 
unsigned GeoIP_num_countries (void)
 
const char * GeoIP_lib_version (void)
 
int GeoIP_cleanup (void)
 

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
 

Macro Definition Documentation

◆ _UNUSED

#define _UNUSED

Definition at line 69 of file GeoIP.c.

◆ ADDR_STR_LEN

#define ADDR_STR_LEN   (8 * 4 + 7 + 1)

Definition at line 1357 of file GeoIP.c.

◆ CANADA_OFFSET

#define CANADA_OFFSET   677

Definition at line 84 of file GeoIP.c.

◆ COUNTRY_BEGIN

#define COUNTRY_BEGIN   16776960

Definition at line 76 of file GeoIP.c.

◆ DATABASE_INFO_MAX_SIZE

#define DATABASE_INFO_MAX_SIZE   100

Definition at line 81 of file GeoIP.c.

◆ DEBUG_MSGF

#define DEBUG_MSGF (   flags,
  fmt,
  ... 
)
Value:
{ \
if (((flags)&GEOIP_SILENCE) == 0) { \
fprintf(stderr, fmt, ##__VA_ARGS__); \
} \
}

Definition at line 88 of file GeoIP.c.

◆ FIPS_RANGE

#define FIPS_RANGE   360

Definition at line 86 of file GeoIP.c.

◆ INADDR_NONE

#define INADDR_NONE   -1

Definition at line 73 of file GeoIP.c.

◆ LARGE_COUNTRY_BEGIN

#define LARGE_COUNTRY_BEGIN   16515072

Definition at line 77 of file GeoIP.c.

◆ MAX_ORG_RECORD_LENGTH

#define MAX_ORG_RECORD_LENGTH   300

Definition at line 82 of file GeoIP.c.

◆ pread

#define pread (   fd,
  buf,
  count,
  offset 
)    (lseek(fd, offset, SEEK_SET) == offset ? read(fd, buf, count) : -1)

Definition at line 96 of file GeoIP.c.

◆ STATE_BEGIN_REV0

#define STATE_BEGIN_REV0   16700000

Definition at line 78 of file GeoIP.c.

◆ STATE_BEGIN_REV1

#define STATE_BEGIN_REV1   16000000

Definition at line 79 of file GeoIP.c.

◆ STRUCTURE_INFO_MAX_SIZE

#define STRUCTURE_INFO_MAX_SIZE   20

Definition at line 80 of file GeoIP.c.

◆ US_OFFSET

#define US_OFFSET   1

Definition at line 83 of file GeoIP.c.

◆ WORLD_OFFSET

#define WORLD_OFFSET   1353

Definition at line 85 of file GeoIP.c.

Function Documentation

◆ __GEOIP_PREPARE_TEREDO()

void __GEOIP_PREPARE_TEREDO ( geoipv6_t v6)

Definition at line 784 of file GeoIP.c.

Referenced by _GeoIP_seek_record_v6_gl().

◆ __GEOIP_V6_IS_NULL()

int __GEOIP_V6_IS_NULL ( geoipv6_t  v6)

◆ _check_mtime()

◆ _database_has_content()

◆ _file_exists()

static int _file_exists ( const char *  file_name)
static

Definition at line 975 of file GeoIP.c.

Referenced by GeoIP_db_avail().

◆ _GeoIP_addr_to_num_v6()

geoipv6_t _GeoIP_addr_to_num_v6 ( const char *  addr)

◆ _GeoIP_full_path_to()

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().

◆ _GeoIP_inet_ntop()

static const char* _GeoIP_inet_ntop ( int  af,
const void *  src,
char *  dst,
socklen_t  cnt 
)
static

Definition at line 769 of file GeoIP.c.

Referenced by _GeoIP_seek_record_v6_gl().

◆ _GeoIP_inet_pton()

static int _GeoIP_inet_pton ( int  af,
const char *  src,
void *  dst 
)
static

Definition at line 765 of file GeoIP.c.

Referenced by _GeoIP_addr_to_num_v6().

◆ _GeoIP_iso_8859_1__utf8()

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().

◆ _GeoIP_lookupaddress()

unsigned long _GeoIP_lookupaddress ( const char *  host)

◆ _GeoIP_lookupaddress_v6()

geoipv6_t _GeoIP_lookupaddress_v6 ( const char *  host)

◆ _GeoIP_seek_record_gl()

◆ _GeoIP_seek_record_v6_gl()

◆ _GeoIP_setup_dbfilename()

◆ _get_name_gl()

◆ _get_name_v6_gl()

◆ _get_region_gl()

static GeoIPRegion* _get_region_gl ( GeoIP gi,
unsigned long  ipnum,
GeoIPLookup gl 
)
static

◆ _get_region_v6_gl()

static GeoIPRegion* _get_region_v6_gl ( GeoIP gi,
geoipv6_t  ipnum,
GeoIPLookup gl 
)
static

◆ _setup_segments()

◆ GeoIP_addr_to_num()

unsigned long GeoIP_addr_to_num ( const char *  addr)

◆ GeoIP_assign_region_by_inetaddr_gl()

◆ GeoIP_assign_region_by_inetaddr_v6_gl()

◆ GeoIP_charset()

int GeoIP_charset ( GeoIP gi)

Definition at line 2677 of file GeoIP.c.

References GeoIPTag::charset.

◆ GeoIP_cleanup()

int GeoIP_cleanup ( void  )

Definition at line 2748 of file GeoIP.c.

References GeoIPDBFileName, and NUM_DB_TYPES.

◆ GeoIP_code3_by_id()

◆ GeoIP_code_by_id()

◆ GeoIP_continent_by_id()

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.

◆ GeoIP_country_code3_by_addr_gl()

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().

◆ GeoIP_country_code3_by_addr_v6_gl()

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().

◆ GeoIP_country_code3_by_ipnum_gl()

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().

◆ GeoIP_country_code3_by_ipnum_v6_gl()

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().

◆ GeoIP_country_code3_by_name_gl()

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().

◆ GeoIP_country_code3_by_name_v6_gl()

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().

◆ GeoIP_country_code_by_addr_gl()

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().

◆ GeoIP_country_code_by_addr_v6_gl()

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().

◆ GeoIP_country_code_by_ipnum_gl()

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().

◆ GeoIP_country_code_by_ipnum_v6_gl()

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().

◆ GeoIP_country_code_by_name_gl()

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().

◆ GeoIP_country_code_by_name_v6_gl()

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().

◆ GeoIP_country_id_by_addr_gl()

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().

◆ GeoIP_country_id_by_addr_v6_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().

◆ GeoIP_country_id_by_name_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().

◆ GeoIP_country_id_by_name_v6_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().

◆ GeoIP_country_name_by_addr_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().

◆ GeoIP_country_name_by_addr_v6_gl()

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().

◆ GeoIP_country_name_by_id()

◆ GeoIP_country_name_by_ipnum_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().

◆ GeoIP_country_name_by_ipnum_v6_gl()

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().

◆ GeoIP_country_name_by_name_gl()

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().

◆ GeoIP_country_name_by_name_v6_gl()

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().

◆ GeoIP_database_edition()

unsigned char GeoIP_database_edition ( GeoIP gi)

Definition at line 2660 of file GeoIP.c.

References GeoIPTag::databaseType.

Referenced by main().

◆ GeoIP_database_info()

char* GeoIP_database_info ( GeoIP gi)

◆ GeoIP_db_avail()

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().

◆ GeoIP_delete()

◆ GeoIP_enable_teredo()

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.

◆ GeoIP_id_by_addr_gl()

◆ GeoIP_id_by_addr_v6_gl()

◆ GeoIP_id_by_code()

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.

◆ GeoIP_id_by_ipnum_gl()

◆ GeoIP_id_by_ipnum_v6_gl()

◆ GeoIP_id_by_name_gl()

◆ GeoIP_id_by_name_v6_gl()

◆ GeoIP_is_private_ipnum_v4()

int GeoIP_is_private_ipnum_v4 ( unsigned long  ipnum)

Definition at line 1011 of file GeoIP.c.

Referenced by GeoIP_is_private_v4().

◆ 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().

◆ GeoIP_lib_version()

const char* GeoIP_lib_version ( void  )

Definition at line 2746 of file GeoIP.c.

◆ GeoIP_name_by_addr_gl()

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().

◆ GeoIP_name_by_addr_v6_gl()

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().

◆ GeoIP_name_by_id()

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.

◆ GeoIP_name_by_ipnum_gl()

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().

◆ GeoIP_name_by_ipnum_v6_gl()

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().

◆ GeoIP_name_by_name_gl()

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().

◆ GeoIP_name_by_name_v6_gl()

char* GeoIP_name_by_name_v6_gl ( GeoIP gi,
const char *  name,
GeoIPLookup gl 
)

◆ GeoIP_new()

GeoIP* GeoIP_new ( int  flags)

◆ GeoIP_num_countries()

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().

◆ GeoIP_num_to_addr()

char* GeoIP_num_to_addr ( unsigned long  ipnum)

Definition at line 2526 of file GeoIP.c.

Referenced by GeoIP_range_by_ip_gl().

◆ GeoIP_open()

◆ GeoIP_open_type()

GeoIP* GeoIP_open_type ( int  type,
int  flags 
)

◆ GeoIP_range_by_ip_delete()

void GeoIP_range_by_ip_delete ( char **  ptr)

Definition at line 2599 of file GeoIP.c.

Referenced by _say_range_by_ip().

◆ GeoIP_range_by_ip_gl()

char** GeoIP_range_by_ip_gl ( GeoIP gi,
const char *  addr,
GeoIPLookup gl 
)

◆ GeoIP_region_by_addr_gl()

GeoIPRegion* GeoIP_region_by_addr_gl ( GeoIP gi,
const char *  addr,
GeoIPLookup gl 
)

◆ GeoIP_region_by_addr_v6_gl()

GeoIPRegion* GeoIP_region_by_addr_v6_gl ( GeoIP gi,
const char *  addr,
GeoIPLookup gl 
)

◆ GeoIP_region_by_ipnum_gl()

GeoIPRegion* GeoIP_region_by_ipnum_gl ( GeoIP gi,
unsigned long  ipnum,
GeoIPLookup gl 
)

◆ GeoIP_region_by_ipnum_v6_gl()

GeoIPRegion* GeoIP_region_by_ipnum_v6_gl ( GeoIP gi,
geoipv6_t  ipnum,
GeoIPLookup gl 
)

◆ GeoIP_region_by_name_gl()

GeoIPRegion* GeoIP_region_by_name_gl ( GeoIP gi,
const char *  name,
GeoIPLookup gl 
)

◆ GeoIP_region_by_name_v6_gl()

GeoIPRegion* GeoIP_region_by_name_v6_gl ( GeoIP gi,
const char *  name,
GeoIPLookup gl 
)

◆ GeoIP_set_charset()

int GeoIP_set_charset ( GeoIP gi,
int  charset 
)

Definition at line 2679 of file GeoIP.c.

References GeoIPTag::charset.

◆ GeoIP_setup_custom_directory()

void GeoIP_setup_custom_directory ( char *  dir)

Definition at line 850 of file GeoIP.c.

References GeoIP_custom_directory.

Referenced by main().

◆ GeoIP_teredo()

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().

◆ GeoIPRegion_delete()

void GeoIPRegion_delete ( GeoIPRegion gir)

Definition at line 2404 of file GeoIP.c.

Referenced by geoiplookup().

◆ get_db_description()

◆ get_index_size()

static ssize_t get_index_size ( GeoIP gi,
struct stat *  buf 
)
static

Variable Documentation

◆ GeoIP_country_code

const char GeoIP_country_code[256][3]
Initial value:
= {
"--", "AP", "EU", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "CW", "AO",
"AQ", "AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF",
"BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW",
"BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM",
"CN", "CO", "CR", "CU", "CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM",
"DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK",
"FM", "FO", "FR", "SX", "GA", "GB", "GD", "GE", "GF", "GH", "GI", "GL",
"GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM",
"HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", "IO", "IQ", "IR", "IS",
"IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR",
"KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU",
"LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML", "MM", "MN", "MO",
"MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA",
"NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM",
"PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT",
"PW", "PY", "QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD", "SE",
"SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV",
"SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TM", "TN", "TO",
"TL", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ",
"VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "RS",
"ZA", "ZM", "ME", "ZW", "A1", "A2", "O1", "AX", "GG", "IM", "JE", "BL",
"MF", "BQ", "SS", "O1"}

Definition at line 100 of file GeoIP.c.

Referenced by _extract_record(), GeoIP_code_by_id(), GeoIP_id_by_code(), and geoiplookup().

◆ GeoIP_country_code3

const char GeoIP_country_code3[256][4]
Initial value:
= {
"--", "AP", "EU", "AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", "CUW",
"AGO", "ATA", "ARG", "ASM", "AUT", "AUS", "ABW", "AZE", "BIH", "BRB", "BGD",
"BEL", "BFA", "BGR", "BHR", "BDI", "BEN", "BMU", "BRN", "BOL", "BRA", "BHS",
"BTN", "BVT", "BWA", "BLR", "BLZ", "CAN", "CCK", "COD", "CAF", "COG", "CHE",
"CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI", "CUB", "CPV", "CXR", "CYP",
"CZE", "DEU", "DJI", "DNK", "DMA", "DOM", "DZA", "ECU", "EST", "EGY", "ESH",
"ERI", "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", "FRA", "SXM", "GAB",
"GBR", "GRD", "GEO", "GUF", "GHA", "GIB", "GRL", "GMB", "GIN", "GLP", "GNQ",
"GRC", "SGS", "GTM", "GUM", "GNB", "GUY", "HKG", "HMD", "HND", "HRV", "HTI",
"HUN", "IDN", "IRL", "ISR", "IND", "IOT", "IRQ", "IRN", "ISL", "ITA", "JAM",
"JOR", "JPN", "KEN", "KGZ", "KHM", "KIR", "COM", "KNA", "PRK", "KOR", "KWT",
"CYM", "KAZ", "LAO", "LBN", "LCA", "LIE", "LKA", "LBR", "LSO", "LTU", "LUX",
"LVA", "LBY", "MAR", "MCO", "MDA", "MDG", "MHL", "MKD", "MLI", "MMR", "MNG",
"MAC", "MNP", "MTQ", "MRT", "MSR", "MLT", "MUS", "MDV", "MWI", "MEX", "MYS",
"MOZ", "NAM", "NCL", "NER", "NFK", "NGA", "NIC", "NLD", "NOR", "NPL", "NRU",
"NIU", "NZL", "OMN", "PAN", "PER", "PYF", "PNG", "PHL", "PAK", "POL", "SPM",
"PCN", "PRI", "PSE", "PRT", "PLW", "PRY", "QAT", "REU", "ROU", "RUS", "RWA",
"SAU", "SLB", "SYC", "SDN", "SWE", "SGP", "SHN", "SVN", "SJM", "SVK", "SLE",
"SMR", "SEN", "SOM", "SUR", "STP", "SLV", "SYR", "SWZ", "TCA", "TCD", "ATF",
"TGO", "THA", "TJK", "TKL", "TKM", "TUN", "TON", "TLS", "TUR", "TTO", "TUV",
"TWN", "TZA", "UKR", "UGA", "UMI", "USA", "URY", "UZB", "VAT", "VCT", "VEN",
"VGB", "VIR", "VNM", "VUT", "WLF", "WSM", "YEM", "MYT", "SRB", "ZAF", "ZMB",
"MNE", "ZWE", "A1", "A2", "O1", "ALA", "GGY", "IMN", "JEY", "BLM", "MAF",
"BES", "SSD", "O1"}

Definition at line 127 of file GeoIP.c.

Referenced by _extract_record(), and GeoIP_code3_by_id().

◆ GeoIP_country_continent

const char GeoIP_country_continent[256][3]
Initial value:
= {
"--", "AS", "EU", "EU", "AS", "AS", "NA", "NA", "EU", "AS", "NA", "AF",
"AN", "SA", "OC", "EU", "OC", "NA", "AS", "EU", "NA", "AS", "EU", "AF",
"EU", "AS", "AF", "AF", "NA", "AS", "SA", "SA", "NA", "AS", "AN", "AF",
"EU", "NA", "NA", "AS", "AF", "AF", "AF", "EU", "AF", "OC", "SA", "AF",
"AS", "SA", "NA", "NA", "AF", "AS", "AS", "EU", "EU", "AF", "EU", "NA",
"NA", "AF", "SA", "EU", "AF", "AF", "AF", "EU", "AF", "EU", "OC", "SA",
"OC", "EU", "EU", "NA", "AF", "EU", "NA", "AS", "SA", "AF", "EU", "NA",
"AF", "AF", "NA", "AF", "EU", "AN", "NA", "OC", "AF", "SA", "AS", "AN",
"NA", "EU", "NA", "EU", "AS", "EU", "AS", "AS", "AS", "AS", "AS", "EU",
"EU", "NA", "AS", "AS", "AF", "AS", "AS", "OC", "AF", "NA", "AS", "AS",
"AS", "NA", "AS", "AS", "AS", "NA", "EU", "AS", "AF", "AF", "EU", "EU",
"EU", "AF", "AF", "EU", "EU", "AF", "OC", "EU", "AF", "AS", "AS", "AS",
"OC", "NA", "AF", "NA", "EU", "AF", "AS", "AF", "NA", "AS", "AF", "AF",
"OC", "AF", "OC", "AF", "NA", "EU", "EU", "AS", "OC", "OC", "OC", "AS",
"NA", "SA", "OC", "OC", "AS", "AS", "EU", "NA", "OC", "NA", "AS", "EU",
"OC", "SA", "AS", "AF", "EU", "EU", "AF", "AS", "OC", "AF", "AF", "EU",
"AS", "AF", "EU", "EU", "EU", "AF", "EU", "AF", "AF", "SA", "AF", "NA",
"AS", "AF", "NA", "AF", "AN", "AF", "AS", "AS", "OC", "AS", "AF", "OC",
"AS", "EU", "NA", "OC", "AS", "AF", "EU", "AF", "OC", "NA", "SA", "AS",
"EU", "NA", "SA", "NA", "NA", "AS", "OC", "OC", "OC", "AS", "AF", "EU",
"AF", "AF", "EU", "AF", "--", "--", "--", "EU", "EU", "EU", "EU", "NA",
"NA", "NA", "AF", "--"}

Definition at line 675 of file GeoIP.c.

Referenced by _extract_record(), and GeoIP_continent_by_id().

◆ GeoIP_country_name

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().

◆ GeoIP_custom_directory

char* GeoIP_custom_directory = NULL

Definition at line 848 of file GeoIP.c.

Referenced by _GeoIP_full_path_to(), and GeoIP_setup_custom_directory().

◆ GeoIP_utf8_country_name

const char* GeoIP_utf8_country_name[256]

Definition at line 153 of file GeoIP.c.

Referenced by GeoIP_country_name_by_id().

◆ GeoIPDBDescription

const char* GeoIPDBDescription[(38+1)]

◆ GeoIPDBFileName

char** GeoIPDBFileName = NULL

◆ IPV6_NULL

geoipv6_t IPV6_NULL
static

Definition at line 24 of file GeoIP.c.

Referenced by _GeoIP_addr_to_num_v6(), and _GeoIP_lookupaddress_v6().

◆ num_GeoIP_countries

const unsigned num_GeoIP_countries
static
GeoIP_country_code
const char GeoIP_country_code[256][3]
Definition: GeoIP.c:100
GEOIP_SILENCE
Definition: GeoIP.h:99