Show configured GeoIP paths in About->Folders

svn path=/trunk/; revision=26587
This commit is contained in:
Stig Bjørlykke 2008-10-27 20:35:52 +00:00
parent b01d3d77dc
commit 2ec94c8f7c
4 changed files with 61 additions and 1 deletions

View File

@ -220,6 +220,33 @@ geoip_db_lookup_ipv4(guint dbnum, guint32 addr) {
return "Invalid database";
}
gchar *
geoip_get_paths(void) {
GString* path_str = NULL;
gchar *path_ret;
char path_separator;
guint i;
path_str = g_string_new("");
#ifdef _WIN32
path_separator = ';';
#else
path_separator = ':';
#endif
for (i = 0; i < num_geoip_db_paths; i++) {
if (geoip_db_paths[i].path) {
g_string_append_printf(path_str, "%s%c", geoip_db_paths[i].path, path_separator);
}
}
g_string_truncate(path_str, path_str->len-1);
path_ret = path_str->str;
g_string_free(path_str, FALSE);
return path_ret;
}
#else /* HAVE_GEOIP */
void
geoip_init(void) {}
@ -239,6 +266,11 @@ geoip_db_lookup_ipv4(guint dbnum _U_, guint32 addr _U_) {
return "";
}
gchar *
geoip_get_paths(void) {
return "";
}
#endif /* HAVE_GEOIP */
/*

View File

@ -56,4 +56,11 @@ const gchar *geoip_db_name(guint dbnum);
*/
const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr);
/**
* Get all configured paths
*
* @return String with all paths separated by a path separator
*/
extern gchar *geoip_get_paths(void);
#endif /* __GEOIP_H__ */

View File

@ -429,6 +429,7 @@ fvalue_to_string_repr
g_resolv_flags DATA
GatekeeperRejectReason_vals DATA
gcamel_StatSRT DATA
geoip_get_paths
get_addr_name
get_asn1_ctx
get_basename

View File

@ -35,6 +35,9 @@
#ifdef HAVE_LIBSMI
#include <epan/oids.h>
#endif
#ifdef HAVE_GEOIP
#include <epan/geoip.h>
#endif
#include "../globals.h"
#include "../log.h"
@ -362,7 +365,7 @@ about_folders_page_new(void)
char *path;
const gchar *titles[] = { "Name", "Folder", "Typical Files"};
GtkWidget *scrolledwindow;
#ifdef HAVE_LIBSMI
#if defined (HAVE_LIBSMI) || defined (HAVE_GEOIP)
gint i;
gchar **resultArray;
#endif
@ -425,6 +428,23 @@ about_folders_page_new(void)
"dissector plugins");
#endif
#ifdef HAVE_GEOIP
/* GeoIP */
path = geoip_get_paths();
#ifdef _WIN32
resultArray = g_strsplit(path, ";", 10);
#else
resultArray = g_strsplit(path, ":", 10);
#endif
for(i = 0; resultArray[i]; i++)
about_folders_row(table, "GeoIP path", g_strstrip(resultArray[i]),
"GeoIP database search path");
g_strfreev(resultArray);
g_free((void *) path);
#endif
#ifdef HAVE_LIBSMI
/* SMI MIBs/PIBs */
path = oid_get_default_mib_path();