2008-12-19 23:49:03 +00:00
|
|
|
/* geoip_db.h
|
2008-10-27 04:50:57 +00:00
|
|
|
* GeoIP database support
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright 2008, Gerald Combs <gerald@wireshark.org>
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-10-27 04:50:57 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-19 23:49:03 +00:00
|
|
|
#ifndef __GEOIP_DB_H__
|
|
|
|
#define __GEOIP_DB_H__
|
2008-10-27 04:50:57 +00:00
|
|
|
|
2013-11-17 14:03:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2011-10-05 22:27:51 +00:00
|
|
|
#include <epan/ipv6-utils.h>
|
2012-07-06 04:48:36 +00:00
|
|
|
#include <epan/prefs.h>
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
2009-02-04 01:02:59 +00:00
|
|
|
|
|
|
|
/* Fake databases to make lat/lon values available */
|
|
|
|
/* XXX - find a better way to interface */
|
2011-10-05 22:27:51 +00:00
|
|
|
#define WS_LAT_FAKE_EDITION (NUM_DB_TYPES+1)
|
|
|
|
#define WS_LON_FAKE_EDITION (NUM_DB_TYPES+2)
|
2009-02-04 01:02:59 +00:00
|
|
|
|
|
|
|
|
2008-10-27 04:50:57 +00:00
|
|
|
/**
|
|
|
|
* Init function called from epan.h
|
|
|
|
*/
|
2012-07-06 04:48:36 +00:00
|
|
|
extern void geoip_db_pref_init(module_t *nameres);
|
2008-10-27 04:50:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of databases we have loaded
|
|
|
|
*
|
|
|
|
* @return The number GeoIP databases successfully loaded
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC guint geoip_db_num_dbs(void);
|
2008-10-27 04:50:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch the name of a database
|
|
|
|
*
|
|
|
|
* @param dbnum Database index
|
2008-12-19 23:49:03 +00:00
|
|
|
* @return The database name or "Invalid database"
|
2008-10-27 04:50:57 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *geoip_db_name(guint dbnum);
|
2008-10-27 04:50:57 +00:00
|
|
|
|
2008-12-19 23:49:03 +00:00
|
|
|
/**
|
|
|
|
* Fetch the database type. Types are enumerated in GeoIPDBTypes in GeoIP.h.
|
|
|
|
*
|
|
|
|
* @param dbnum Database index
|
|
|
|
* @return The database type or -1
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC int geoip_db_type(guint dbnum);
|
2008-12-19 23:49:03 +00:00
|
|
|
|
2008-10-27 04:50:57 +00:00
|
|
|
/**
|
|
|
|
* Look up an IPv4 address in a database
|
|
|
|
*
|
|
|
|
* @param dbnum Database index
|
|
|
|
* @param addr IPv4 address to look up
|
2008-12-19 23:49:03 +00:00
|
|
|
* @param not_found The string to return if the lookup fails. May be NULL.
|
|
|
|
* @return The database entry if found, else not_found
|
2008-10-27 04:50:57 +00:00
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr, const char *not_found);
|
2008-10-27 04:50:57 +00:00
|
|
|
|
2011-10-05 22:27:51 +00:00
|
|
|
/**
|
|
|
|
* Look up an IPv6 address in a database
|
|
|
|
*
|
|
|
|
* @param dbnum Database index
|
|
|
|
* @param addr IPv6 address to look up
|
|
|
|
* @param not_found The string to return if the lookup fails. May be NULL.
|
|
|
|
* @return The database entry if found, else not_found
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const char *geoip_db_lookup_ipv6(guint dbnum, struct e_in6_addr addr, const char *not_found);
|
2011-10-05 22:27:51 +00:00
|
|
|
|
2008-10-27 20:35:52 +00:00
|
|
|
/**
|
|
|
|
* Get all configured paths
|
|
|
|
*
|
|
|
|
* @return String with all paths separated by a path separator
|
|
|
|
*/
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gchar *geoip_db_get_paths(void);
|
2008-10-27 20:35:52 +00:00
|
|
|
|
2013-11-17 14:03:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2008-12-19 23:49:03 +00:00
|
|
|
#endif /* __GEOIP_DB_H__ */
|
2013-11-17 14:03:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|