Rename crypt-xxx to xxx
[obnox/wireshark/wip.git] / epan / geoip_db.h
1 /* geoip_db.h
2  * GeoIP database support
3  *
4  * $Id$
5  *
6  * Copyright 2008, Gerald Combs <gerald@wireshark.org>
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifndef __GEOIP_DB_H__
28 #define __GEOIP_DB_H__
29
30 #include <epan/ipv6-utils.h>
31
32 /* Fake databases to make lat/lon values available */
33 /* XXX - find a better way to interface */
34 #define WS_LAT_FAKE_EDITION (NUM_DB_TYPES+1)
35 #define WS_LON_FAKE_EDITION (NUM_DB_TYPES+2)
36
37
38 /**
39  * Init function called from epan.h
40  */
41 extern void geoip_db_init(void);
42
43 /**
44  * Number of databases we have loaded
45  *
46  * @return The number GeoIP databases successfully loaded
47  */
48 extern guint geoip_db_num_dbs(void);
49
50 /**
51  * Fetch the name of a database
52  *
53  * @param dbnum Database index
54  * @return The database name or "Invalid database"
55  */
56 extern const gchar *geoip_db_name(guint dbnum);
57
58 /**
59  * Fetch the database type. Types are enumerated in GeoIPDBTypes in GeoIP.h.
60  *
61  * @param dbnum Database index
62  * @return The database type or -1
63  */
64 extern int geoip_db_type(guint dbnum);
65
66 /**
67  * Look up an IPv4 address in a database
68  *
69  * @param dbnum Database index
70  * @param addr IPv4 address to look up
71  * @param not_found The string to return if the lookup fails. May be NULL.
72  * @return The database entry if found, else not_found
73  */
74 extern const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr, char *not_found);
75
76 /**
77  * Look up an IPv6 address in a database
78  *
79  * @param dbnum Database index
80  * @param addr IPv6 address to look up
81  * @param not_found The string to return if the lookup fails. May be NULL.
82  * @return The database entry if found, else not_found
83  */
84 extern const char *geoip_db_lookup_ipv6(guint dbnum, struct e_in6_addr addr, char *not_found);
85
86 /**
87  * Get all configured paths
88  *
89  * @return String with all paths separated by a path separator
90  */
91 extern gchar *geoip_db_get_paths(void);
92
93 #endif /* __GEOIP_DB_H__ */