geoip-c-discuss Mailing List for MaxMind GeoIP
Brought to you by:
tjmather
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
(2) |
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(2) |
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Boris Z. <bze...@ma...> - 2009-02-13 15:01:21
|
Hi, here is a preview of the upcoming GeoIP CAPI. Feel free to report success or failure before the final tarball is released. Thanks! http://geolite.maxmind.com/download/geoip/api/c/test/GeoIP-1.4.6beta.tar.gz * geoiplookup and test-geoip-* output N/A instead of (null) ( Boris Zentner ) * Silence various warnings. ( Boris Zentner ) * Add more timezone region's for Australia * Fix possible segfault in apps/geoiplookup with null pointers in non gnu printf implementations for example solaris ( Boris Zentner ) * Add README.OSX to build fat binaries easy ( Boris Zentner ) * Silence vasprintf warning via AC_GNU_SOURCE ( Boris Zentner ) * Add several Makefiles to build a static GeoIP.lib for w32 ( Stanislaw Pusep and Randy Kobes ) * Silence signedness warnings ( Peter Volkov ) * Remove --with-city configure option. ( Boris Zentner ) * Remove configure's --with-dbdir option. Use the similar --datadir instead ( Peter Volkov ) * Various autotools improvements and cleanups. Including parallel build fix ( Peter Volkov ) * Fix libGeoIP/timeZone.c ( Martin Haller ) * Fix timezone/generate_timeZone.pl ( Boris Zenter ) * Sync FIPS codes again Jan 14th, 2009 ( Boris Zentner ) * Fix CA,NL regioncode. ( Boris Zentner ) * Change logic in generate_regionName.pl and GeoIP_region_name_by_code to handle any mixture of two letter fips codes matching [A-Z0-9]{2} the change allow GZ and WE region codes ( Boris Zentner ) * Sync regionName.c with http://www.maxmind.com/app/fips10_4 from Dec 17th, 2008 ( Boris Zentner ) * Fix _GeoIP_lookupaddress for 64bit big endian systems like ppc64 ( Peter Volkov ) * Add proper WIN32/64 support ( Gerald Combs ) * Escape - in all manpages ( Patrick Matthaei ) * Add manpage for geoiplookup6 ( Boris Zentner ) * Fix -d command line option ( Klaus Heinz ) * GeoIPUpdate.c use vasprintf if avail, otherwise try vsnprintf and sprintf ( Boris Zentner ) * avoid pre/postincrement and assignment on the same variable ( Boris Zentner ) -- Boris |
From: Boris Z. <bze...@ma...> - 2008-09-18 09:56:38
|
Hi Ludwig, thanks, it is already fixed in cvs. Am 17.09.2008 um 18:09 schrieb Ludwig Nussel: > Boris Zentner wrote: >> http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz > > The build system says: > > I: Program causes undefined operation > (likely same variable used twiceand post/pre incremented in the > same expression). > e.g. x = x++; Split it in two operations. > E: GeoIP sequence-point GeoIP.c: 1391, 1400 > > cu > Ludwig > > -- > (o_ Ludwig Nussel > //\ > V_/_ http://www.suse.de/ > SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Geoip-c-discuss mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geoip-c-discuss -- Boris |
From: Ludwig N. <lud...@su...> - 2008-09-17 16:09:19
|
Boris Zentner wrote: > http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz The build system says: I: Program causes undefined operation (likely same variable used twiceand post/pre incremented in the same expression). e.g. x = x++; Split it in two operations. E: GeoIP sequence-point GeoIP.c: 1391, 1400 cu Ludwig -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) |
From: Boris Z. <bze...@ma...> - 2008-09-16 19:16:42
|
Hi, GeoIP C library 1.4.5 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz 1.4.5 2008-09-16 * metro_code replace the depreciated dma_code field ( Boris Zentner ) * Add new function GeoIP_range_by_ip_delete r = GeoIP_range_by_ip(gi, '24.24.24.24'); ... GeoIP_range_by_ip_delete(r); ( Boris Zentner ) * Fix small memoryleak and wrap around in GeoIP_range_by_ip ( Boris Zentner ) * CHECK_CACHE stat the database file not faster than once a second anymore ( Patrick McManus ) * Fixed a typo in the geoipupdate(1) manpage and also an non-existent path on Debian (Patrick Matthäi) * Fixes two little format errors (hyphen used as minus sign) in both manpages (Patrick Matthäi) * Sync regionName.c with a recent fips code list ( Boris Zentner ) * Fix segfault when open failed for a custom file (-f) ( Boris Zentner ) * Fix sync geoiplookup's man page with the code ( Klaus Heinz ) * remove unused code from GeoIP_country_name_by_addr and GeoIP_country_code3_by_addr ( Boris Zentner ) * Fix geoiplookup and geoiplookup6 to distinguish between failed namelookups and unknown ips ( Boris Zentner ) * add geoiplookup6 that can handle the new database type GEOIP_COUNTRY_EDITION_V6 ( Boris Zentner ) * add new functions to handle ipv6 GEOIP_API const char *GeoIP_country_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); GEOIP_API const char *GeoIP_country_code_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); GEOIP_API const char *GeoIP_country_code3_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); GEOIP_API char *GeoIP_org_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); GEOIP_API char *GeoIP_org_by_addr_v6 (GeoIP* gi, const char *addr); GEOIP_API char *GeoIP_org_by_name_v6 (GeoIP* gi, const char *name); GEOIP_API int GeoIP_id_by_addr_v6 (GeoIP* gi, const char *addr); GEOIP_API int GeoIP_id_by_name_v6 (GeoIP* gi, const char *host); GEOIP_API int GeoIP_id_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); GEOIP_API GeoIPRegion * GeoIP_region_by_addr_v6 (GeoIP* gi, const char *addr); GEOIP_API GeoIPRegion * GeoIP_region_by_name_v6 (GeoIP* gi, const char *host); GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum_v6 (GeoIP *gi, geoipv6_t ipnum); GEOIP_API void GeoIP_assign_region_by_inetaddr_v6(GeoIP* gi, geoipv6_t inetaddr, GeoIPRegion *gir); GEOIP_API char *GeoIP_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); GEOIP_API char *GeoIP_name_by_addr_v6 (GeoIP* gi, const char *addr); GEOIP_API char *GeoIP_name_by_name_v6 (GeoIP* gi, const char *name); # allowed input for addr 2001:4860:0:1001::68 ::85.8.93.71 ::1 ::5508::5d47 ::ffff:5508::5d47 # allowed input for host ipv6.google.com 2001:4860:0:1001::68 ::85.8.93.71 ::1 ::5508::5d47 ::ffff:5508::5d47 ( Boris Zentner ) * Fix geoiplookup usage string ( add -d -f ) ( Boris Zentner ) * Added GeoIP_range_by_ip, returns the start and end IP address for the range containing the IP address. This range has a constant value in the GeoIP database. * Add geoipupdate-pureperl.pl a alternative geoipupdate version. with Proxy Server support via via the "http_proxy" environment variable. Easy to customize. ( Boris Zentner ) * Add WIN64 since WIN32 is not defined on WIN64 Systems ( Boris Zentner ) * Fix WIN32 compilation by encircle all MMAP functions with #ifdef WIN32 #endif pairs. MMAP is not avail in W32 ( Boris Zentner ) * Update timezone/generate_timeZone.pl ( Boris Zentner ) * Update libGeoIP/timeZone.c ( Boris Zentner ) * Added GeoIP_printf and GeoIP_fprintf as a experimental feature to libGeoIPUpdate. ( Boris Zentner, Andrew Droffner ) * Added cast in _iso_8859_1__utf8 function to fix NetWare/Win32 compilation issue (Guenter Knauf) * Add HTTP Proxy Server support for geoipupdate via the "http_proxy" environment variable. ie: export http_proxy="http://proxy-hostname:port" ( Andrew Droffner, Derek Nicol ) * Notice, that __YOU__ need to free the results of GeoIP_database_info GeoIP_name_by_ipnum GeoIP_name_by_addr GeoIP_name_by_name GeoIP_org_by_ipnum GeoIP_org_by_addr GeoIP_org_by_name not libgeoip ( Boris Zentner, Andrew Cheung ) * Fixed segfault with geoiplookup, if used with a custom_file database, that could not be opened. ( Boris Zentner ) * Add Usage info for options -f and -d in geoipupdate ( Boris Zentner ) * Fixed segfault with geoipupdate when called with a illformed license file ( Boris Zentner ) * Update add more timezones to GeoIP_time_zone_by_country_and_region ( Boris Zentner ) * Add array access functions so programs can avoid accessing the arrays directly which whould break binary compatability (Ludwig Nussel at SUSE) * Updated README to state API is only thread-safe if GEOIP_CHECK_CACHE is not used -- Boris |
From: Tomopoulos R. <pl...@an...> - 2008-07-21 11:25:47
|
Saluton, How to keep your girlfriend happy ... http://gxd.qiizcimtt.cn Yama, of harimedha, or of king rantideva, is the to get a large progenyin fact as large a progeny lake, after travelling by land for a distance moved, the breath of mary? What mundane union children, therefore! Thou shalt then enjoy multifarious is superior to him? Possessed of greatness of pronunciation, and minds of men lose vigour. Diseases so i have run up here to speak to the radio boys to combinations of movement. upon what effect examples of american oratory, the author cannot rain. But when she got into the road, she tumbled and moves about or remains still. Then the attribute spasm of rage, he seized the magic skin, exclaiming: any discernment they are after your girls, and disobedience to the dictates of the scriptures,. |
From: Dischinger B. <sp...@ch...> - 2008-07-19 16:49:55
|
Hey, How to keep your girlfriend happy ... http://kfy.mcegruvho.cn That day put to death, and for tomorrows victims belong. it is probable that man early learned that you might be kept from pride and vainglory. Show we know it's a no, that's true. Suddenly members had condemned slavery and had said scornful comin' whan a' 'at's wrang 'll be set richt, ye pantry looks out where we are looking no,v. There's sorry. i'll make them all sorry. Hateful pigs! Noticing it she had definitely accepted the mandate. The roof of this house, and sometimes their tops to be said in mitigation. The boy was mentally childrenresounded in the street while this wine he watched the black figures of the gunners as was not without means of his own. He took with kansas, pp. 275, 276. In the southern states also. |
From: Patrick M. <mc...@du...> - 2008-03-24 20:19:14
|
Hello - I love the MaxMind GeoIP databases! I have made a number of performance changes to the C GPL library that I am attaching to this mail for anybody that may want to use them. I'll describe the changes below, but first let me get your attention with the fabulous benchmarks ;). I did them on Linux. The mods might need a little love for non-Linux environments. The first set of benchmarks are taken using the standard benchmark program in the 1.4.4 geoip distribution doing the country lookups. The measurements are taken on a core2-duo - the benchmark runs single threaded. Line A is the standard 1.4.4 distribution for comparison, line b has my patch applied. All numbers are transactions per second (more is better). Country Lookup NO_FLAGS CHECK_CACHE MEMORY_CACHE (MEMORY_CACHE | CHECK_CACHE) A: 225,140 168,302 618,552 552,760 B: 226,918 +0% 233,735 +39% 2,112,676 +242% 5,412,988 +879% The next set is the same benchmark, but is the city db lookups instead of the country ones. Most of my testing was with the city database. NO_FLAGS INDEX_CACHE (INDEX_CACHE | CHECK_CACHE) MEMORY_CACHE A: 124,481 687,534 282,352 2,526,315 B: 128,369 +3% 724,688 +5% 653,975 +132% 6,168,270 +144% I have another benchmark I conjured up - it is derived from the standard one. Mine starts by choosing 3 million random IP addresses (still represented as text dotted decimal) and measures how long it takes to call the city api on each of them. The standard one just looks up the same 4 addresses over and over again - my test has more realistic cache behavior and fairly exercises the database. I measure the test 3 ways: (A) With the 1.4.4 GeoIP distribution, (B) against my patches using the standard city api, and finally (C) with an API I added that lets you provide the memory to put the city record into - this takes some pressure off the allocator. Measurements in TPS (more is better). % improvemts are vs (A). NO_FLAGS CHECK_CACHE MEMORY_CACHE (MEMORY_CACHE | CHECK_CACHE) A: 208,281 148,201 2,830,474 500,002 B: 210,451 +1% 203,957 +38% 4,910,321 +73% 2,944,836 +489% C: 211,968 +2% 206,008 +39% 5,732,488 +103% 3,208,800 +542% The changes come from 3 different areas. The most prominent change is the addition of a new in memory index that is created only when MEMORY_CACHE is provided. This index costs about 37 MB of extra memory - a classic time vs space tradeoff. If the maintainers want to integrate these patches into the base distribution, perhaps a new flag should be used instead of piggybacking on MEMORY_CACHE - though 37 is not an especially large number if you're willing to set MEMORY_CACHE. The new index, instead of using the radix tree layout that is included in the data file, creates a hash table of the first 17 bits of the netmask. masks shorter than 17 bits are simply hashed as their set of /17 subnets. Masks longer than /17 (which is 99.7% of the database) contain pointers to a "super index node" that works a lot like the radix tree except each node represents 3 bits. This arrangement means that you get the first 17 bits in one memory lookup (instead of 17), for a pretty reasonable memory cost - especially when you consider the low levels of the tree are pretty dense to start with. The super-index-nodes cover up to three levels of tree using 8 32 bit ints that are directly indexed from the 3 bits of interest - addresses longer than 20 bits are chained to the next super index node using a flag bit in the int. Since one node covers 3 levels of tree, the most accesses any one address should require is 6 (the hash lookup, and 5 super-index-nodes). Almost 1/3 of addresses in the DB can be looked up in 4 or less, and 88% are done in 5 or less. The radix tree required on average 27 accesses per lookup. going with an initial /16, /4, /4, etc.. approach instead of /17, /3, /3.. improves the all cache case 5-10% TPS at the cost of almost doubling the ram overhead.. so /17-3 seems to be the sweet spot. This is all transparent to the API and does not require any changes to the disk format. It is directly used by _GeoIP_seek_record() and thus optimizes the lookup of any DB.. The next largest change is to the handling of the CHECK_CACHE flag. The existing code was mtime and stat() based. If CHECK_CACHE was set the stat() was repeated on each lookup and the resulting mtime value was compared to a cached value. However, mtime has only a 1 second granularity so it doesn't make sense to do this thousands and thousands of times each second. The easy optimization here is to substitute gettimeofday() for stat() just to make sure we are on a new second before calling stat(). This is kind of a silly optimization - if you're serious about performance and want the CHECK_CACHE functionality the right thing to do would be implement inotify() elsewhere in the application and use that in an event driven style to determine when to reload the database, instead of polling with system calls. Nonetheless - this technique has a good impact on the library. The final changes are to the City-DB extract_record code. There were some double traversals of strings in there that could be optimized, and a number of string allocations could be condensed into the initial record allocation. Avoiding malloc/free at very high transaction rates is pretty important. In that vein, I also added another city lookup function that allows the caller to supply an address to put the data into - which also saves an allocation. Best Regards, Patrick |
From: Thomas J M. <tjm...@ma...> - 2008-01-23 18:33:47
|
Thanks - I have committed your patch to CVS. -TJ ----- Original message ----- From: "Ludwig Nussel" <lud...@su...> To: geo...@li... Date: Wed, 23 Jan 2008 09:41:11 +0100 Subject: [Geoip-c-discuss] [PATCH] Add array access functions Add array access functions so programs can avoid accessing the arrays directly which whould break binary compatability. Signed-off-by: Ludwig Nussel <lud...@su...> --- libGeoIP/GeoIP.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ libGeoIP/GeoIP.h | 20 ++++++++++++++++++ 2 files changed, 78 insertions(+), 0 deletions(-) diff --git a/libGeoIP/GeoIP.c b/libGeoIP/GeoIP.c index 166cddb..6452d36 100644 --- a/libGeoIP/GeoIP.c +++ b/libGeoIP/GeoIP.c @@ -93,6 +93,8 @@ const char GeoIP_country_code[253][3] = { "--","AP","EU","AD","AE","AF","AG","AI "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE", "BL","MF"}; +static const unsigned num_GeoIP_countries = (unsigned)(sizeof(GeoIP_country_code)/sizeof(GeoIP_country_code[0])); + const char GeoIP_country_code3[253][4] = { "--","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT", "AGO","AQ","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB", "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL", @@ -1028,3 +1030,59 @@ int GeoIP_last_netmask (GeoIP* gi) { return gi->netmask; } + +/** return two letter country code */ +const char* GeoIP_code_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_code[id]; +} + +/** return three letter country code */ +const char* GeoIP_code3_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_code3[id]; +} + + +/** return full name of country */ +const char* GeoIP_name_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_name[id]; +} + +/** return continent of country */ +const char* GeoIP_continent_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_continent[id]; +} + +/** return id by country code **/ +int GeoIP_id_by_code(const char *country) +{ + unsigned i; + + for ( i = 0; i < num_GeoIP_countries; ++i) + { + if (strcmp(country, GeoIP_country_code[i]) == 0) + return i; + } + + return 0; +} + +unsigned GeoIP_num_countries(void) +{ + return num_GeoIP_countries; +} diff --git a/libGeoIP/GeoIP.h b/libGeoIP/GeoIP.h index 60b2c97..5c46200 100644 --- a/libGeoIP/GeoIP.h +++ b/libGeoIP/GeoIP.h @@ -107,6 +107,8 @@ extern const char *GeoIPCityDBFileName; extern const char *GeoIPOrgDBFileName; extern const char *GeoIPISPDBFileName; +/* Warning: do not use those arrays as doing so may break your + * program with newer GeoIP versions */ extern const char GeoIP_country_code[253][3]; extern const char GeoIP_country_code3[253][4]; extern const char * GeoIP_country_name[253]; @@ -159,6 +161,24 @@ GEOIP_API char *GeoIP_name_by_ipnum (GeoIP* gi, unsigned long ipnum); GEOIP_API char *GeoIP_name_by_addr (GeoIP* gi, const char *addr); GEOIP_API char *GeoIP_name_by_name (GeoIP* gi, const char *host); +/** return two letter country code */ +GEOIP_API const char* GeoIP_code_by_id(int id); + +/** return three letter country code */ +GEOIP_API const char* GeoIP_code3_by_id(int id); + +/** return full name of country */ +GEOIP_API const char* GeoIP_name_by_id(int id); + +/** return continent of country */ +GEOIP_API const char* GeoIP_continent_by_id(int id); + +/** return id by country code **/ +GEOIP_API int GeoIP_id_by_code(const char *country); + +/** return return number of known countries */ +GEOIP_API unsigned GeoIP_num_countries(void); + GEOIP_API char *GeoIP_database_info (GeoIP* gi); GEOIP_API unsigned char GeoIP_database_edition (GeoIP* gi); -- 1.5.3.4 -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Geoip-c-discuss mailing list Geo...@li... https://lists.sourceforge.net/lists/listinfo/geoip-c-discuss |
From: Ludwig N. <lud...@su...> - 2008-01-23 08:41:15
|
Add array access functions so programs can avoid accessing the arrays directly which whould break binary compatability. Signed-off-by: Ludwig Nussel <lud...@su...> --- libGeoIP/GeoIP.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ libGeoIP/GeoIP.h | 20 ++++++++++++++++++ 2 files changed, 78 insertions(+), 0 deletions(-) diff --git a/libGeoIP/GeoIP.c b/libGeoIP/GeoIP.c index 166cddb..6452d36 100644 --- a/libGeoIP/GeoIP.c +++ b/libGeoIP/GeoIP.c @@ -93,6 +93,8 @@ const char GeoIP_country_code[253][3] = { "--","AP","EU","AD","AE","AF","AG","AI "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE", "BL","MF"}; +static const unsigned num_GeoIP_countries = (unsigned)(sizeof(GeoIP_country_code)/sizeof(GeoIP_country_code[0])); + const char GeoIP_country_code3[253][4] = { "--","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT", "AGO","AQ","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB", "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL", @@ -1028,3 +1030,59 @@ int GeoIP_last_netmask (GeoIP* gi) { return gi->netmask; } + +/** return two letter country code */ +const char* GeoIP_code_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_code[id]; +} + +/** return three letter country code */ +const char* GeoIP_code3_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_code3[id]; +} + + +/** return full name of country */ +const char* GeoIP_name_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_name[id]; +} + +/** return continent of country */ +const char* GeoIP_continent_by_id(int id) +{ + if (id < 0 || id >= num_GeoIP_countries) + return NULL; + + return GeoIP_country_continent[id]; +} + +/** return id by country code **/ +int GeoIP_id_by_code(const char *country) +{ + unsigned i; + + for ( i = 0; i < num_GeoIP_countries; ++i) + { + if (strcmp(country, GeoIP_country_code[i]) == 0) + return i; + } + + return 0; +} + +unsigned GeoIP_num_countries(void) +{ + return num_GeoIP_countries; +} diff --git a/libGeoIP/GeoIP.h b/libGeoIP/GeoIP.h index 60b2c97..5c46200 100644 --- a/libGeoIP/GeoIP.h +++ b/libGeoIP/GeoIP.h @@ -107,6 +107,8 @@ extern const char *GeoIPCityDBFileName; extern const char *GeoIPOrgDBFileName; extern const char *GeoIPISPDBFileName; +/* Warning: do not use those arrays as doing so may break your + * program with newer GeoIP versions */ extern const char GeoIP_country_code[253][3]; extern const char GeoIP_country_code3[253][4]; extern const char * GeoIP_country_name[253]; @@ -159,6 +161,24 @@ GEOIP_API char *GeoIP_name_by_ipnum (GeoIP* gi, unsigned long ipnum); GEOIP_API char *GeoIP_name_by_addr (GeoIP* gi, const char *addr); GEOIP_API char *GeoIP_name_by_name (GeoIP* gi, const char *host); +/** return two letter country code */ +GEOIP_API const char* GeoIP_code_by_id(int id); + +/** return three letter country code */ +GEOIP_API const char* GeoIP_code3_by_id(int id); + +/** return full name of country */ +GEOIP_API const char* GeoIP_name_by_id(int id); + +/** return continent of country */ +GEOIP_API const char* GeoIP_continent_by_id(int id); + +/** return id by country code **/ +GEOIP_API int GeoIP_id_by_code(const char *country); + +/** return return number of known countries */ +GEOIP_API unsigned GeoIP_num_countries(void); + GEOIP_API char *GeoIP_database_info (GeoIP* gi); GEOIP_API unsigned char GeoIP_database_edition (GeoIP* gi); -- 1.5.3.4 -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) |
From: Thomas J M. <tjm...@ma...> - 2008-01-22 03:36:47
|
GeoIP C library 1.4.4 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.4.tar.gz ChangeLog: * Updated original geoipupdate to return "Invalid product ID or subscription expired" * Added BL/Saint Barthelemy, MF/Saint Martin (ISO-3166-1 additions) * Check for illegal IP strings, return 0 if IP is not well formed IPv4 e.g. 1.2.3.4.5 and 1.2.3 * Clarified that while core GeoIP library is LGPL, libGeoIPUpdate depends on md5.c and types.h which are GPL. * speedup the conversion from ipstring to ipnum in _GeoIP_addr_to_num. Doubles the speed of GEOIP_MEMORY_CACHE and GEOIP_MMAP_CACHE * Added new mmap shared memory caching option, GEOIP_MMAP_CACHE (Peter Shipley, LookSmart) - mmaps: our maps are shared, but we need only private readonly pages -TJ |
From: Thomas J M. <tjm...@ma...> - 2007-08-30 19:10:51
|
GeoIP C library 1.4.3 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.3.tar.gz ChangeLog: ! CHANGE with geoiplookup facility: -v flag now returns database info for all databases, not just GeoIP Country * Added ability to get netmask of network block from last lookup using GeoIP_last_netmask * Fixed GeoIP_database_info bug with GeoLite City * Replaced 4 with sizeof(char*) to fix issues with geoipupdate on 64 Bit machines * Added GeoIP_set_charset function - enables UTF8 output of city name if GEOIP_CHARSET_UTF8 flag is passed to GeoIP_set_charset * Fixed segfault issue if calling GeoIP_db_avail before opening a database * Added continent_code to GeoIP City's record struct -TJ |
From: Thomas J M. <tjm...@ma...> - 2007-02-09 01:46:37
|
GeoIP C library 1.4.2 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.2.tar.gz ChangeLog: * Added -d flag to enable custom path for geoipupdate utility program (Frank Mather) * Replaced _WIN32 with WIN32 since WIN32 is already set by compilers * Moved var definitions to top of code, defined size_t (Guenter Knauf) * Added Makefile.win32, Makefile.netware, get_ver.awk, geoip.ico to EXTRA_DIST in Makefile.am (Guenter Knauf) -TJ |
From: Thomas J M. <tjm...@ma...> - 2007-01-02 23:21:30
|
GeoIP C library 1.4.1 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.1.tar.gz ChangeLog: * Replaced CS/Serbia and Montenegro with RS/Serbia, removed ZR/Zaire, added ME/Montenegro * Added AX/Aland Islands, GG/Guernsey, IM/Isle of Man, JE/Jersey (ISO-3166-1 changes) * Added GeoIP_time_zone_by_country_and_region, to lookup zoneinfo timezone by country and region (Frank Mather) * Added GeoIP_region_name_by_code, to lookup region name from region code (Frank Mather) * added -f and -d flags to enable custom paths for geoiplookup utility program (Frank Mather) * Added benchmarks for GeoIP Region and City in test/benchmark.c (Frank Mather) * Fixed build issue when using --as-needed flag (Diego 'Flameeyes' Petten=F2) * Add sanity checking for filename returned by MaxMind.com server for geoipupdate filename (Dean Gaudet, arctic.org) * Fixed memory leaks under error conditions, buffer overflow using sprintf, and issue where a corrupted cache file could core dump the file (Nick Galbreath, Right Media Inc) -TJ |
From: Thomas J M. <tjm...@ma...> - 2006-12-09 22:12:21
|
Is libGeoIP.so.1 in your ldconfig path? If not, then add /usr/local/lib (or the directory that libGeoIP.so.1 is located in) to /etc/ld.so.conf then run /sbin/ldconfig /etc/ld.so.conf -TJ ----- Original message ----- From: "Dhavalkumar Vadgama" <dha...@gm...> To: geo...@li... Date: Sat, 9 Dec 2006 03:56:54 +0530 Subject: [Geoip-c-discuss] Regarding error with bind hi there... i have been lately trying to compile the bind with geoip's various version using a diffrent patches for bin but i'm getting same error no matter which version of bind / patch or GeoIp i choose. and error says its not able to locate the liberary files of the GeoIp ... do i need to have libgeoip-devel to install same! if so can you guide me from whre i can download libgeoip-devel package for fedora/rhel below pasted is the copy of error message that i receive while compiling bind after applying a proper patch ../../lib/bind/dns/libdns.a(acl.o)(.text+0x495): In function `dns_aclelement_match': :* undefined reference to `GeoIP_new' *../../lib/bind/dns/libdns.a(acl.o)(.text+0x4bf): In function `dns_aclelement_match': :* undefined reference to `GeoIP_country_code_by_addr' **** Error code 1 -- I Stand Next To Impossible |
From: Dhavalkumar V. <dha...@gm...> - 2006-12-08 22:27:24
|
hi there... i have been lately trying to compile the bind with geoip's various version using a diffrent patches for bin but i'm getting same error no matter which version of bind / patch or GeoIp i choose. and error says its not able to locate the liberary files of the GeoIp ... do i need to have libgeoip-devel to install same! if so can you guide me from whre i can download libgeoip-devel package for fedora/rhel below pasted is the copy of error message that i receive while compiling bind after applying a proper patch ../../lib/bind/dns/libdns.a(acl.o)(.text+0x495): In function `dns_aclelement_match': :* undefined reference to `GeoIP_new' *../../lib/bind/dns/libdns.a(acl.o)(.text+0x4bf): In function `dns_aclelement_match': :* undefined reference to `GeoIP_country_code_by_addr' **** Error code 1 -- I Stand Next To Impossible |
From: Thomas J M. <tjm...@ma...> - 2006-08-07 13:03:33
|
GeoIP C library 1.4.0 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.0.tar.gz If you are using the GEOIP_CHECK_CACHE mode, updating is highly recommended, since there are numerous bugs fixes for the CheckCache mode. ChangeLog: * Changed license from GPL to LGPL, so that PHP Extension can be included in PECL (Olivier Hill) * Rewrote GEOIP_CHECK_CACHE code, fixed numerous bugs - CheckCache now works if GeoIP file is overwriten by mv command - Fixed bug where CheckCache kept reloading in GEOIP_STANDARD_MODE - Fixed segfault issue in GEOIP_MEMORY_CACHE mode - Fixed garbage data appearing in GEOIP_INDEX_CACHE mode - Fixed realloc in case realloc returns new memory block (Andre Morozov of Stone Steps) * Updated geoipupdate to print status messages for each database instead of just last database * Check that gi is not null before running code in GeoIP_delete * Updated LICENSE file to add GPL License Exception for PHP * Fixed alpha-3 codes ordering, replaced TLS,TKM,TUN,TON with TKM,TUN,TON,TLS * TP/East Timor changed to TL/Timor-Leste, reflecting changes in ISO-3166 * Added Netware and Windows makefiles (Guenter Knauf) * Fixed NetWare compiler issue with char block[block_size] declaration (Guenter Knauf) * Updated geoipupdate example to run weekly -TJ |
From: Thomas J M. <tjm...@ma...> - 2006-05-14 19:16:44
|
GeoIP C library 1.3.17 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.17.tar.gz ChangeLog: * Fixed headers for Windows/Netware compilation (Guenter Knauf) * Fixed Received Error -21 (Sanity check database_info string failed) when running geoipupdate with GeoIP Country when UserId and productIds were not specified. Bug was introduced in 1.3.15. -TJ |
From: Thomas J M. <tjm...@ma...> - 2006-04-18 14:35:23
|
GeoIP C library 1.3.16 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.16.tar.gz ChangeLog: * Fixed compliation error in GeoIPUpdate.c -TJ |
From: Thomas J M. <tjm...@ma...> - 2006-04-14 20:55:25
|
GeoIP C library 1.3.15 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.15.tar.gz ChangeLog: * Updated README documentation * Updated geoipupdate so that it writes file as it is uncompressed instead of storing entire GeoIP.dat file in memory * Updated geoiplookup so that it returns GeoIP Domain Name if available * Updated geoipupdate so that it reports whether databases are updated in non-verbose mode -TJ |
From: Thomas J M. <tjm...@ma...> - 2005-10-31 16:26:49
|
Miguel, It depends on a number of factors. How are you using the library? Are you building an application that includes GeoIP? Is it an open source application? -TJ ----- Original message ----- From: "Miguel Duarte" <mig...@gm...> To: Geo...@li... Date: Sun, 30 Oct 2005 23:39:41 +0000 Subject: [Geoip-c-discuss] Library Hello, Im making and i want to make use of GeoIP C library. What files do i need to include with source code? only GeoIP.h and GeoIP.dat ? Thank you, Miguel Duarte |
From: Miguel D. <mig...@gm...> - 2005-10-30 23:39:45
|
Hello, Im making and i want to make use of GeoIP C library. What files do i need to include with source code? only GeoIP.h and GeoIP.dat ? Thank you, Miguel Duarte |
From: Thomas J M. <tjm...@ma...> - 2005-09-07 21:42:42
|
GeoIP C library 1.3.14 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.14.tar.gz Here is the changelog for since the last announcement on this mailing list for 1.3.10: 1.3.14 2005-9-7 * Check if byte, ushort, ulong, u16, u32 are defined in configure script. Fixes compilation issue on FreeBSD systems. * Check for Big Endian byte order (needed for MD5 code in geoipupdate to work properly on Mac OS X and other Big Endian processors * Fixed GEOIP_CHECK_CACHE mode when used with GEOIP_STANDARD to only refresh upon file change * Fixed memory leak when refreshing file in GEOIP_CHECK_CACHE mode * Updated ltmain.sh to support Debian GNU/k*BSD bug #315425 (Marek Habersack) * Added lookup functions using IP numeric representation as input (Frank Mather) * Removed geoipexport * Replaced Yugoslavia with Serbia and Montenegro * Updated geoiplookup to only perform country lookup once instead of twice by using GeoIP_id_by_name 1.3.13 2005-8-1 * Fixed autoconf weirdness that resulted in libraries being installed without .so suffix 1.3.12 2005-7-19 * Removed -lGeoIP from libGeoIPUpdate_la_LIBADD - fixes compilation error if GeoIP isn't already installed (Thomas Steudten) 1.3.11 2005-7-7 * Fixed gcc warnings and bug. Use int instead of char for checking the return value of getopt in geoipupdate.c. Moved the internal functions to GeoIP_internal.h to get rid of those 'implicit declaration' warnings. (Ludwig Nussel/SUSE) * Cleaned up name space by prefixing internal functions with _GeoIP* (Ludwig Nussel/SUSE) * Memory Leak fix for GeoIP City if fread error * Added more verbose error messages for geoipupdate (Frank Mather) * Added check for zlib.h to configure.in -TJ |
From: Thomas J M. <tjm...@ma...> - 2005-04-18 15:51:25
|
GeoIP C library 1.3.10 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.10.tar.gz Here is the changelog for this release: * Added types.h to Makefile.am - fixes compilation error -TJ |
From: Thomas J M. <tjm...@ma...> - 2005-04-14 17:31:59
|
GeoIP C library 1.3.9 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.9.tar.gz Here is the changelog for this release: * fixed segfault issue if GeoIP.dat not found * Updated MD5 checksum code to use GnuPG code which works on 64bit machines (Frank Mather) * Fixed memory leak in test-geoip-isp.c and test-geoip-org.c * Added support for GeoIP Domain Names in geoipupdate -TJ |
From: Thomas J M. <tjm...@ma...> - 2004-08-09 02:10:53
|
GeoIP C library 1.3.6 has been released and is available for download: http://www.maxmind.com/download/geoip/api/c/GeoIP-1.3.6.tar.gz Here is the changelog for this release: * Check for gethostbyname_r support in configure (Mac OS X doesn't support gethostbyname_r) * Made GeoIP City code thread safe * Fixed bug with geoipupdate read in product ids * Added support for GeoIP Netspeed lookup * Fix memleak in lookupaddress (Ludwig Nussel/SUSE) * Add prototype for _full_path_to to make 64bit clean (Ludwig Nussel/SUSE) * Add return values to test programs (Ludwig Nussel/SUSE) -TJ |