HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / geoip_db.h
blob0408124fdddc5c4a89ec17f6af46dad346de9e3e
1 /* geoip_db.h
2 * GeoIP database support
4 * $Id$
6 * Copyright 2008, Gerald Combs <gerald@wireshark.org>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #ifndef __GEOIP_DB_H__
28 #define __GEOIP_DB_H__
30 #include <epan/ipv6-utils.h>
31 #include <epan/prefs.h>
32 #include "ws_symbol_export.h"
34 /* Fake databases to make lat/lon values available */
35 /* XXX - find a better way to interface */
36 #define WS_LAT_FAKE_EDITION (NUM_DB_TYPES+1)
37 #define WS_LON_FAKE_EDITION (NUM_DB_TYPES+2)
40 /**
41 * Init function called from epan.h
43 extern void geoip_db_pref_init(module_t *nameres);
45 /**
46 * Number of databases we have loaded
48 * @return The number GeoIP databases successfully loaded
50 WS_DLL_PUBLIC guint geoip_db_num_dbs(void);
52 /**
53 * Fetch the name of a database
55 * @param dbnum Database index
56 * @return The database name or "Invalid database"
58 WS_DLL_PUBLIC const gchar *geoip_db_name(guint dbnum);
60 /**
61 * Fetch the database type. Types are enumerated in GeoIPDBTypes in GeoIP.h.
63 * @param dbnum Database index
64 * @return The database type or -1
66 WS_DLL_PUBLIC int geoip_db_type(guint dbnum);
68 /**
69 * Look up an IPv4 address in a database
71 * @param dbnum Database index
72 * @param addr IPv4 address to look up
73 * @param not_found The string to return if the lookup fails. May be NULL.
74 * @return The database entry if found, else not_found
76 WS_DLL_PUBLIC const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr, const char *not_found);
78 /**
79 * Look up an IPv6 address in a database
81 * @param dbnum Database index
82 * @param addr IPv6 address to look up
83 * @param not_found The string to return if the lookup fails. May be NULL.
84 * @return The database entry if found, else not_found
86 WS_DLL_PUBLIC const char *geoip_db_lookup_ipv6(guint dbnum, struct e_in6_addr addr, const char *not_found);
88 /**
89 * Get all configured paths
91 * @return String with all paths separated by a path separator
93 WS_DLL_PUBLIC gchar *geoip_db_get_paths(void);
95 #endif /* __GEOIP_DB_H__ */