Main Page | Class List | File List | Class Members | File Members

GeoIP.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>

Include dependency graph for GeoIP.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GeoIPTag
struct  GeoIPRegionTag

Defines

#define SEGMENT_RECORD_LENGTH   3
#define STANDARD_RECORD_LENGTH   3
#define ORG_RECORD_LENGTH   4
#define MAX_RECORD_LENGTH   4
#define NUM_DB_TYPES   16
#define GEOIP_API

Typedefs

typedef GeoIPTag GeoIP
typedef GeoIPRegionTag GeoIPRegion

Enumerations

enum  GeoIPOptions { GEOIP_STANDARD = 0, GEOIP_MEMORY_CACHE = 1, GEOIP_CHECK_CACHE = 2, GEOIP_INDEX_CACHE = 4 }
enum  GeoIPDBTypes {
  GEOIP_COUNTRY_EDITION = 1, GEOIP_REGION_EDITION_REV0 = 7, GEOIP_CITY_EDITION_REV0 = 6, GEOIP_ORG_EDITION = 5,
  GEOIP_ISP_EDITION = 4, GEOIP_CITY_EDITION_REV1 = 2, GEOIP_REGION_EDITION_REV1 = 3, GEOIP_PROXY_EDITION = 8,
  GEOIP_ASNUM_EDITION = 9, GEOIP_NETSPEED_EDITION = 10
}
enum  GeoIPProxyTypes { GEOIP_ANON_PROXY = 1, GEOIP_HTTP_X_FORWARDED_FOR_PROXY = 2, GEOIP_HTTP_CLIENT_IP_PROXY = 3 }
enum  GeoIPNetspeedValues { GEOIP_UNKNOWN_SPEED = 0, GEOIP_DIALUP_SPEED = 1, GEOIP_CABLEDSL_SPEED = 2, GEOIP_CORPORATE_SPEED = 3 }

Functions

GEOIP_API GeoIPGeoIP_open_type (int type, int flags)
GEOIP_API GeoIPGeoIP_new (int flags)
GEOIP_API GeoIPGeoIP_open (const char *filename, int flags)
GEOIP_API int GeoIP_db_avail (int type)
GEOIP_API void GeoIP_delete (GeoIP *gi)
GEOIP_API const char * GeoIP_country_code_by_addr (GeoIP *gi, const char *addr)
GEOIP_API const char * GeoIP_country_code_by_name (GeoIP *gi, const char *host)
GEOIP_API const char * GeoIP_country_code3_by_addr (GeoIP *gi, const char *addr)
GEOIP_API const char * GeoIP_country_code3_by_name (GeoIP *gi, const char *host)
GEOIP_API const char * GeoIP_country_name_by_addr (GeoIP *gi, const char *addr)
GEOIP_API const char * GeoIP_country_name_by_name (GeoIP *gi, const char *host)
GEOIP_API const char * GeoIP_country_code_by_ipnum (GeoIP *gi, unsigned long ipnum)
GEOIP_API int GeoIP_country_id_by_addr (GeoIP *gi, const char *addr)
GEOIP_API int GeoIP_country_id_by_name (GeoIP *gi, const char *host)
GEOIP_API char * GeoIP_org_by_addr (GeoIP *gi, const char *addr)
GEOIP_API char * GeoIP_org_by_name (GeoIP *gi, const char *host)
GEOIP_API int GeoIP_id_by_addr (GeoIP *gi, const char *addr)
GEOIP_API int GeoIP_id_by_name (GeoIP *gi, const char *host)
GEOIP_API int GeoIP_id_by_ipnum (GeoIP *gi, unsigned long ipnum)
GEOIP_API GeoIPRegionGeoIP_region_by_addr (GeoIP *gi, const char *addr)
GEOIP_API GeoIPRegionGeoIP_region_by_name (GeoIP *gi, const char *host)
GEOIP_API void GeoIPRegion_delete (GeoIPRegion *gir)
GEOIP_API void GeoIP_assign_region_by_inetaddr (GeoIP *gi, unsigned long inetaddr, GeoIPRegion *gir)
GEOIP_API char * GeoIP_name_by_addr (GeoIP *gi, const char *addr)
GEOIP_API char * GeoIP_name_by_name (GeoIP *gi, const char *host)
GEOIP_API char * GeoIP_database_info (GeoIP *gi)
GEOIP_API unsigned char GeoIP_database_edition (GeoIP *gi)
GEOIP_API unsigned int _seek_record (GeoIP *gi, unsigned long ipnum)
GEOIP_API unsigned long _addr_to_num (const char *addr)

Variables

char ** GeoIPDBFileName
const char * GeoIPDBDescription [NUM_DB_TYPES]
const char * GeoIPCountryDBFileName
const char * GeoIPRegionDBFileName
const char * GeoIPCityDBFileName
const char * GeoIPOrgDBFileName
const char * GeoIPISPDBFileName
const char GeoIP_country_code [247][3]
const char GeoIP_country_code3 [247][4]
const char * GeoIP_country_name [247]
const char GeoIP_country_continent [247][3]


Define Documentation

#define GEOIP_API
 

Definition at line 107 of file GeoIP.h.

#define MAX_RECORD_LENGTH   4
 

Definition at line 37 of file GeoIP.h.

Referenced by _seek_record().

#define NUM_DB_TYPES   16
 

Definition at line 38 of file GeoIP.h.

Referenced by _setup_dbfilename(), GeoIP_db_avail(), and GeoIP_open_type().

#define ORG_RECORD_LENGTH   4
 

Definition at line 36 of file GeoIP.h.

Referenced by _setup_segments().

#define SEGMENT_RECORD_LENGTH   3
 

Definition at line 34 of file GeoIP.h.

Referenced by _setup_segments().

#define STANDARD_RECORD_LENGTH   3
 

Definition at line 35 of file GeoIP.h.

Referenced by _setup_segments().


Typedef Documentation

typedef struct GeoIPTag GeoIP
 

typedef struct GeoIPRegionTag GeoIPRegion
 


Enumeration Type Documentation

enum GeoIPDBTypes
 

Enumerator:
GEOIP_COUNTRY_EDITION 
GEOIP_REGION_EDITION_REV0 
GEOIP_CITY_EDITION_REV0 
GEOIP_ORG_EDITION 
GEOIP_ISP_EDITION 
GEOIP_CITY_EDITION_REV1 
GEOIP_REGION_EDITION_REV1 
GEOIP_PROXY_EDITION 
GEOIP_ASNUM_EDITION 
GEOIP_NETSPEED_EDITION 

Definition at line 65 of file GeoIP.h.

enum GeoIPNetspeedValues
 

Enumerator:
GEOIP_UNKNOWN_SPEED 
GEOIP_DIALUP_SPEED 
GEOIP_CABLEDSL_SPEED 
GEOIP_CORPORATE_SPEED 

Definition at line 84 of file GeoIP.h.

enum GeoIPOptions
 

Enumerator:
GEOIP_STANDARD 
GEOIP_MEMORY_CACHE 
GEOIP_CHECK_CACHE 
GEOIP_INDEX_CACHE 

Definition at line 58 of file GeoIP.h.

enum GeoIPProxyTypes
 

Enumerator:
GEOIP_ANON_PROXY 
GEOIP_HTTP_X_FORWARDED_FOR_PROXY 
GEOIP_HTTP_CLIENT_IP_PROXY 

Definition at line 78 of file GeoIP.h.


Function Documentation

GEOIP_API unsigned long _addr_to_num const char *  addr  ) 
 

Definition at line 315 of file GeoIP.cpp.

Referenced by GeoIP_id_by_addr(), GeoIP_name_by_addr(), and GeoIP_region_by_addr().

GEOIP_API unsigned int _seek_record GeoIP gi,
unsigned long  ipnum
 

Definition at line 243 of file GeoIP.cpp.

References _check_mtime(), and MAX_RECORD_LENGTH.

Referenced by _get_name(), GeoIP_assign_region_by_inetaddr(), GeoIP_id_by_addr(), GeoIP_id_by_ipnum(), and GeoIP_id_by_name().

GEOIP_API void GeoIP_assign_region_by_inetaddr GeoIP gi,
unsigned long  inetaddr,
GeoIPRegion gir
 

Definition at line 646 of file GeoIP.cpp.

References _seek_record(), CANADA_OFFSET, FIPS_RANGE, GeoIP_country_code, GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, STATE_BEGIN_REV0, STATE_BEGIN_REV1, US_OFFSET, and WORLD_OFFSET.

Referenced by _get_region().

GEOIP_API const char* GeoIP_country_code3_by_addr GeoIP gi,
const char *  addr
 

Definition at line 536 of file GeoIP.cpp.

References GeoIP_country_code3, and GeoIP_id_by_addr().

Referenced by GeoIPWrapper::getCountryCode3ByAddr().

GEOIP_API const char* GeoIP_country_code3_by_name GeoIP gi,
const char *  host
 

Definition at line 456 of file GeoIP.cpp.

References GeoIP_country_code3, and GeoIP_id_by_name().

Referenced by GeoIPWrapper::getCountryCode3ByName().

GEOIP_API const char* GeoIP_country_code_by_addr GeoIP gi,
const char *  addr
 

Definition at line 530 of file GeoIP.cpp.

References GeoIP_country_code, and GeoIP_id_by_addr().

Referenced by GeoIPWrapper::getCountryCodeByAddr().

GEOIP_API const char* GeoIP_country_code_by_ipnum GeoIP gi,
unsigned long  ipnum
 

Definition at line 550 of file GeoIP.cpp.

References GeoIP_country_code, and GeoIP_id_by_ipnum().

GEOIP_API const char* GeoIP_country_code_by_name GeoIP gi,
const char *  host
 

Definition at line 450 of file GeoIP.cpp.

References GeoIP_country_code, and GeoIP_id_by_name().

Referenced by GeoIPWrapper::getCountryCodeByName().

GEOIP_API int GeoIP_country_id_by_addr GeoIP gi,
const char *  addr
 

Definition at line 556 of file GeoIP.cpp.

References GeoIP_id_by_addr().

GEOIP_API int GeoIP_country_id_by_name GeoIP gi,
const char *  host
 

Definition at line 560 of file GeoIP.cpp.

References GeoIP_id_by_name().

GEOIP_API const char* GeoIP_country_name_by_addr GeoIP gi,
const char *  addr
 

Definition at line 543 of file GeoIP.cpp.

References GeoIP_country_name, and GeoIP_id_by_addr().

Referenced by GeoIPWrapper::getCountryNameByAddr().

GEOIP_API const char* GeoIP_country_name_by_name GeoIP gi,
const char *  host
 

Definition at line 462 of file GeoIP.cpp.

References GeoIP_country_name, and GeoIP_id_by_name().

Referenced by GeoIPWrapper::getCountryNameByName().

GEOIP_API unsigned char GeoIP_database_edition GeoIP gi  ) 
 

Definition at line 794 of file GeoIP.cpp.

GEOIP_API char* GeoIP_database_info GeoIP gi  ) 
 

Definition at line 600 of file GeoIP.cpp.

References _check_mtime(), DATABASE_INFO_MAX_SIZE, and STRUCTURE_INFO_MAX_SIZE.

GEOIP_API int GeoIP_db_avail int  type  ) 
 

Definition at line 144 of file GeoIP.cpp.

References _file_exists(), GeoIPDBFileName, and NUM_DB_TYPES.

GEOIP_API void GeoIP_delete GeoIP gi  ) 
 

Definition at line 436 of file GeoIP.cpp.

Referenced by GeoIPWrapper::~GeoIPWrapper().

GEOIP_API int GeoIP_id_by_addr GeoIP gi,
const char *  addr
 

Definition at line 564 of file GeoIP.cpp.

References _addr_to_num(), _seek_record(), COUNTRY_BEGIN, GEOIP_COUNTRY_EDITION, GEOIP_NETSPEED_EDITION, GEOIP_PROXY_EDITION, and GeoIPDBDescription.

Referenced by GeoIP_country_code3_by_addr(), GeoIP_country_code_by_addr(), GeoIP_country_id_by_addr(), GeoIP_country_name_by_addr(), and GeoIPWrapper::getIdByAddr().

GEOIP_API int GeoIP_id_by_ipnum GeoIP gi,
unsigned long  ipnum
 

Definition at line 583 of file GeoIP.cpp.

References _seek_record(), COUNTRY_BEGIN, GEOIP_COUNTRY_EDITION, GEOIP_NETSPEED_EDITION, GEOIP_PROXY_EDITION, and GeoIPDBDescription.

Referenced by GeoIP_country_code_by_ipnum().

GEOIP_API int GeoIP_id_by_name GeoIP gi,
const char *  host
 

Definition at line 513 of file GeoIP.cpp.

References _seek_record(), COUNTRY_BEGIN, GEOIP_COUNTRY_EDITION, GEOIP_NETSPEED_EDITION, GEOIP_PROXY_EDITION, GeoIPDBDescription, and lookupaddress().

Referenced by GeoIP_country_code3_by_name(), GeoIP_country_code_by_name(), GeoIP_country_id_by_name(), GeoIP_country_name_by_name(), and GeoIPWrapper::getIdByName().

GEOIP_API char* GeoIP_name_by_addr GeoIP gi,
const char *  addr
 

Definition at line 767 of file GeoIP.cpp.

References _addr_to_num(), and _get_name().

Referenced by GeoIP_org_by_addr().

GEOIP_API char* GeoIP_name_by_name GeoIP gi,
const char *  host
 

Definition at line 776 of file GeoIP.cpp.

References _get_name(), and lookupaddress().

Referenced by GeoIP_org_by_name().

GEOIP_API GeoIP* GeoIP_new int  flags  ) 
 

Definition at line 367 of file GeoIP.cpp.

References _setup_dbfilename(), GEOIP_COUNTRY_EDITION, GeoIP_open(), and GeoIPDBFileName.

Referenced by GeoIPWrapper::GeoIPWrapper().

GEOIP_API GeoIP* GeoIP_open const char *  filename,
int  flags
 

Definition at line 374 of file GeoIP.cpp.

References _setup_segments(), GEOIP_INDEX_CACHE, and GEOIP_MEMORY_CACHE.

Referenced by GeoIP_new(), GeoIP_open_type(), and GeoIPWrapper::GeoIPWrapper().

GEOIP_API GeoIP* GeoIP_open_type int  type,
int  flags
 

Definition at line 350 of file GeoIP.cpp.

References _setup_dbfilename(), GeoIP_open(), GeoIPDBFileName, and NUM_DB_TYPES.

GEOIP_API char* GeoIP_org_by_addr GeoIP gi,
const char *  addr
 

Definition at line 786 of file GeoIP.cpp.

References GeoIP_name_by_addr().

GEOIP_API char* GeoIP_org_by_name GeoIP gi,
const char *  host
 

Definition at line 790 of file GeoIP.cpp.

References GeoIP_name_by_name().

GEOIP_API GeoIPRegion* GeoIP_region_by_addr GeoIP gi,
const char *  addr
 

Definition at line 701 of file GeoIP.cpp.

References _addr_to_num(), _get_region(), GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, and GeoIPDBDescription.

GEOIP_API GeoIPRegion* GeoIP_region_by_name GeoIP gi,
const char *  host
 

Definition at line 715 of file GeoIP.cpp.

References _get_region(), GEOIP_REGION_EDITION_REV0, GEOIP_REGION_EDITION_REV1, GeoIPDBDescription, and lookupaddress().

GEOIP_API void GeoIPRegion_delete GeoIPRegion gir  ) 
 

Definition at line 730 of file GeoIP.cpp.


Variable Documentation

const char GeoIP_country_code[247][3]
 

Definition at line 80 of file GeoIP.cpp.

Referenced by GeoIP_assign_region_by_inetaddr(), GeoIP_country_code_by_addr(), GeoIP_country_code_by_ipnum(), GeoIP_country_code_by_name(), and GeoIPWrapper::idToCountryCode().

const char GeoIP_country_code3[247][4]
 

Definition at line 82 of file GeoIP.cpp.

Referenced by GeoIP_country_code3_by_addr(), GeoIP_country_code3_by_name(), and GeoIPWrapper::idToCountryCode3().

const char GeoIP_country_continent[247][3]
 

Definition at line 88 of file GeoIP.cpp.

const char* GeoIP_country_name[247]
 

Definition at line 84 of file GeoIP.cpp.

Referenced by GeoIP_country_name_by_addr(), GeoIP_country_name_by_name(), and GeoIPWrapper::idToCountryName().

const char* GeoIPCityDBFileName
 

const char* GeoIPCountryDBFileName
 

const char* GeoIPDBDescription[NUM_DB_TYPES]
 

Definition at line 90 of file GeoIP.cpp.

Referenced by _get_name(), GeoIP_id_by_addr(), GeoIP_id_by_ipnum(), GeoIP_id_by_name(), GeoIP_region_by_addr(), and GeoIP_region_by_name().

char** GeoIPDBFileName
 

Definition at line 119 of file GeoIP.cpp.

Referenced by _setup_dbfilename(), GeoIP_db_avail(), GeoIP_new(), and GeoIP_open_type().

const char* GeoIPISPDBFileName
 

const char* GeoIPOrgDBFileName
 

const char* GeoIPRegionDBFileName
 


Generated on Tue Jun 28 01:09:09 2005 for CountryFilter by  doxygen 1.4.3-20050623