]>
Commit | Line | Data |
---|---|---|
69793602 CP |
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ |
2 | /* GeoIPCity.h | |
3 | * | |
4 | * Copyright (C) 2006 MaxMind LLC | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2.1 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
21 | #ifndef GEOIPCITY_H | |
22 | #define GEOIPCITY_H | |
23 | ||
24 | #include "GeoIP.h" | |
25 | ||
26 | #ifdef __cplusplus | |
27 | extern "C" { | |
28 | #endif | |
29 | ||
30 | typedef struct GeoIPRecordTag { | |
31 | char *country_code; | |
32 | char *country_code3; | |
33 | char *country_name; | |
34 | char *region; | |
35 | char *city; | |
36 | char *postal_code; | |
37 | float latitude; | |
38 | float longitude; | |
39 | union { | |
40 | int metro_code; /* metro_code is a alias for dma_code */ | |
41 | int dma_code; | |
42 | }; | |
43 | int area_code; | |
44 | int charset; | |
45 | char *continent_code; | |
46 | } GeoIPRecord; | |
47 | ||
48 | GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); | |
49 | GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); | |
50 | GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); | |
51 | ||
52 | GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); | |
53 | GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); | |
54 | GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); | |
55 | ||
56 | int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); | |
57 | int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); | |
58 | ||
59 | int GeoIP_init_record_iter (GeoIP* gi); | |
60 | /* returns 0 on success, 1 on failure */ | |
61 | int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); | |
62 | ||
63 | void GeoIPRecord_delete (GeoIPRecord *gir); | |
64 | ||
65 | /* NULL on failure otherwise a malloced string in utf8 */ | |
66 | char * _iso_8859_1__utf8(const char *); | |
67 | ||
68 | #ifdef __cplusplus | |
69 | } | |
70 | #endif | |
71 | ||
72 | #endif /* GEOIPCITY_H */ |