diff options
-rw-r--r-- | epan/geoip.c | 32 | ||||
-rw-r--r-- | epan/geoip.h | 7 | ||||
-rw-r--r-- | epan/libwireshark.def | 1 | ||||
-rw-r--r-- | gtk/about_dlg.c | 22 |
4 files changed, 61 insertions, 1 deletions
diff --git a/epan/geoip.c b/epan/geoip.c index 5eea3b4c99..179095e0a1 100644 --- a/epan/geoip.c +++ b/epan/geoip.c @@ -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 */ /* diff --git a/epan/geoip.h b/epan/geoip.h index b8e4b29490..71e24cb542 100644 --- a/epan/geoip.h +++ b/epan/geoip.h @@ -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__ */ diff --git a/epan/libwireshark.def b/epan/libwireshark.def index 1b722d252e..62bcac64f0 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -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 diff --git a/gtk/about_dlg.c b/gtk/about_dlg.c index 858f69e37a..25c7651308 100644 --- a/gtk/about_dlg.c +++ b/gtk/about_dlg.c @@ -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(); |