Add GeoIP to the Windows build. Fix a remaining geoip_ -> geoip_db_
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 23 Dec 2008 18:56:31 +0000 (18:56 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 23 Dec 2008 18:56:31 +0000 (18:56 +0000)
conversion.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27098 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.nmake
config.h.win32
config.nmake
epan/Makefile.nmake
epan/dissectors/Makefile.nmake
epan/dissectors/packet-ip.c
epan/geoip_db.c
epan/geoip_db.h
epan/libwireshark.def
gtk/hostlist_table.c
tools/win32-setup.sh

index 0d0dfef07f947821e816bce51ab6b7fc4a36f95d..53850e625adac02c1eecd8253de00db323133fa4 100644 (file)
@@ -21,7 +21,7 @@ CFLAGS=-WX -DHAVE_CONFIG_H $(LOCAL_CFLAGS) $(GLIB_CFLAGS) /I. /Iwiretap \
        $(ZLIB_CFLAGS) /I$(PCAP_DIR)\include \
        $(AIRPCAP_CFLAGS) \
        $(C_ARES_CFLAGS) $(ADNS_CFLAGS) $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) \
-       $(LUA_CFLAGS) $(SMI_CFLAGS) \
+       $(LUA_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS) \
        -D_U_="" -D_NEED_VAR_IMPORT_
 
 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
@@ -348,6 +348,7 @@ config.h    : config.h.win32 config.nmake
            -e "s/@HAVE_LIBPORTAUDIO@/$(PORTAUDIO_CONFIG)/" \
            -e "s/@PORTAUDIO_API_1@/$(PORTAUDIO_API_CONFIG)/" \
            -e "s/@HAVE_SMI@/$(SMI_CONFIG)/" \
+           -e "s/@HAVE_GEOIP@/$(GEOIP_CONFIG)/" \
            -e "s/@INET6@/$(INET6_CONFIG)/" \
            < config.h.win32 > $@
 
@@ -786,6 +787,10 @@ process_libs:
        @$(SH) tools\win32-setup.sh "$(WIN32_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
                . libsmi-0.4.8.zip
 !ENDIF
+!IFDEF GEOIP_DIR
+       @$(SH) tools\win32-setup.sh "$(WIN32_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
+               . GeoIP-1.4.5ws.zip
+!ENDIF
 
 !IFDEF GTK_DIR
 !IF "$(GTK_INST_VERSION)" == "2.14"
@@ -891,6 +896,7 @@ clean_setup:
     rm -r -f $(WIRESHARK_LIBS)/zlib123
     rm -r -f $(WIRESHARK_LIBS)/zlib123-dll
     rm -r -f $(WIRESHARK_LIBS)/upx301w
+    rm -r -f $(WIRESHARK_LIBS)/GeoIP-1.4.5ws
 
 ################################################################################
 # Prepare the debug trees for running Wireshark/Tshark from there.
index 5af37fbbdff28901b8c4cd350c8aaa29f25546a3..02c7c2d2957a34881ace0505dbb8b0ebd54c4ad5 100644 (file)
 /* Define to have SMI */
 @HAVE_SMI@
 
+/* Define to have GeoIP */
+@HAVE_GEOIP@
+
 
 #ifndef WIN32
 #define WIN32                  1
index b4684c2471e75cf93c4885e2fb4e1644182f2656..d64a7faa2521be40157206cdf0fc4ea49f8c4384 100644 (file)
@@ -325,6 +325,13 @@ AIRPCAP_DIR=$(WIRESHARK_LIBS)\AirPcap_Devpack_1_0_0_594\AirPcap_Devpack
 #
 SMI_DIR=$(WIRESHARK_LIBS)\libsmi-0.4.8
 
+#
+# Optional: GeoIP, IP address database lookups
+#
+# Used to map IP addresses to MaxMind GeoIP database entries
+#
+GEOIP_DIR=$(WIRESHARK_LIBS)\GeoIP-1.4.5ws
+
 
 ##### Tools #####
 
@@ -875,6 +882,16 @@ SMI_CFLAGS=
 SMI_CONFIG=
 !ENDIF
 
+!IFDEF GEOIP_DIR
+GEOIP_CONFIG=^#define HAVE_GEOIP 1
+GEOIP_CFLAGS=/I$(GEOIP_DIR)\libGeoIP
+GEOIP_LIBS=$(GEOIP_DIR)\libGeoIP\GeoIP.lib
+!ELSE
+GeoIP_LIBS=
+GeoIP_CFLAGS=
+GeoIP_CONFIG=
+!ENDIF
+
 !IFDEF ENABLE_LIBWIRESHARK
 LIBWIRESHARK_CONFIG=^#define HAVE_LIBWIRESHARKDLL 1
 # Link plugins with the import library of libwireshark.dll
index 6e4c3782b1f8e91e09b5a94a0d7e193643a72e02..d3b1451008db5b27a46aeb23fc0b8f2e124c16dc 100644 (file)
@@ -14,7 +14,7 @@ LINK= link
 CFLAGS=-WX -DHAVE_CONFIG_H /I. /I.. /I../wiretap $(GLIB_CFLAGS) \
        $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) $(PCRE_CFLAGS) \
        $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
-       $(SMI_CFLAGS) -D_U_="" $(LOCAL_CFLAGS)
+       $(SMI_CFLAGS) $(GEOIP_CFLAGS) -D_U_="" $(LOCAL_CFLAGS)
 
 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
 
@@ -38,6 +38,7 @@ libwireshark_LIBS = \
        $(GNUTLS_LIBS) \
        $(LUA_LIBS) \
        $(SMI_LIBS) \
+       $(GEOIP_LIBS) \
        ..\wsutil\libwsutil.lib \
        ..\wiretap\wiretap-$(WTAP_VERSION).lib \
 !IFDEF ICONV_DIR
index 3ee8a9f94751c77a9b451430822aa40997503f0d..60f30f9ad607cb0924c87bc2ccc384beff20ae7a 100644 (file)
@@ -14,7 +14,7 @@ include Makefile.common
 CFLAGS=-WX -DHAVE_CONFIG_H /I. /I.. /I../.. $(GLIB_CFLAGS) \
        $(ZLIB_CFLAGS) \
        $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \
-       $(KFW_CFLAGS) $(AIRPCAP_CFLAGS) \
+       $(KFW_CFLAGS) $(AIRPCAP_CFLAGS) $(GEOIP_CFLAGS) \
        /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
 
 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL 
index bd799f7efb7652d2d2500f8c97ee4ce5ad43da06..cf1434e6b64c6c689d9366f9e20afbcbbcba507c 100644 (file)
@@ -1292,7 +1292,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        proto_tree_add_uint_format(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen,
        "Header length: %u bytes", hlen);
   }
-  
+
   iph->ip_tos = tvb_get_guint8(tvb, offset + 1);
   if (check_col(pinfo->cinfo, COL_DSCP_VALUE)) {
        col_add_fstr(pinfo->cinfo, COL_DSCP_VALUE, "%u", IPDSFIELD_DSCP(iph->ip_tos));
@@ -1501,7 +1501,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
 
 #ifdef HAVE_GEOIP
   if (tree && ip_use_geoip) {
-    for (dbnum = 0; dbnum < geoip_num_dbs(); dbnum++) {
+    for (dbnum = 0; dbnum < geoip_db_num_dbs(); dbnum++) {
       geoip_src_str = geoip_db_lookup_ipv4(dbnum, src32, NULL);
       geoip_dst_str = geoip_db_lookup_ipv4(dbnum, dst32, NULL);
 
@@ -1548,7 +1548,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
         item  = proto_tree_add_string_format_value(ip_tree, geoip_hf, tvb,
           offset + IPH_SRC, 4, geoip_src_str, "%s", geoip_src_str);
         PROTO_ITEM_SET_GENERATED(item);
-        PROTO_ITEM_SET_HIDDEN(item);        
+        PROTO_ITEM_SET_HIDDEN(item);
       }
 
       if (geoip_dst_str) {
@@ -1558,7 +1558,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
         item  = proto_tree_add_string_format_value(ip_tree, geoip_hf, tvb,
           offset + IPH_DST, 4, geoip_dst_str, "%s", geoip_dst_str);
         PROTO_ITEM_SET_GENERATED(item);
-        PROTO_ITEM_SET_HIDDEN(item);        
+        PROTO_ITEM_SET_HIDDEN(item);
       }
     }
   }
index 539d7fcb6efab4470a6a6eb12ea3004410bd6399..db4169afe6bd02a368b0e96d004004e50b57788a 100644 (file)
@@ -162,7 +162,7 @@ geoip_db_init(void) {
 }
 
 guint
-geoip_num_dbs(void) {
+geoip_db_num_dbs(void) {
        return geoip_dat_arr->len;
 }
 
@@ -263,7 +263,7 @@ void
 geoip_db_init(void) {}
 
 guint
-geoip_num_dbs(void) {
+geoip_db_num_dbs(void) {
        return 0;
 }
 
index 1885964c48ee086e16b73b583635ec554179b58c..a9e0cc472979d73f08ff66fc46db797f6c176bf9 100644 (file)
@@ -37,7 +37,7 @@ extern void geoip_db_init(void);
  *
  * @return The number GeoIP databases successfully loaded
  */
-extern guint geoip_num_dbs(void);
+extern guint geoip_db_num_dbs(void);
 
 /**
  * Fetch the name of a database
@@ -45,7 +45,7 @@ extern guint geoip_num_dbs(void);
  * @param dbnum Database index
  * @return The database name or "Invalid database"
  */
-const gchar *geoip_db_name(guint dbnum);
+extern const gchar *geoip_db_name(guint dbnum);
 
 /**
  * Fetch the database type. Types are enumerated in GeoIPDBTypes in GeoIP.h.
@@ -53,7 +53,7 @@ const gchar *geoip_db_name(guint dbnum);
  * @param dbnum Database index
  * @return The database type or -1
  */
-int geoip_db_type(guint dbnum);
+extern int geoip_db_type(guint dbnum);
 
 /**
  * Look up an IPv4 address in a database
@@ -63,7 +63,7 @@ int geoip_db_type(guint dbnum);
  * @param not_found The string to return if the lookup fails. May be NULL.
  * @return The database entry if found, else not_found
  */
-const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr, char *not_found);
+extern const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr, char *not_found);
 
 /**
  * Get all configured paths
index 0bd099918f72a3d8f6d5667b23e77bc82b19ced9..700383c6a044eb1dab8ac95c6cfb98ab4954d53f 100644 (file)
@@ -431,6 +431,10 @@ g_resolv_flags                  DATA
 GatekeeperRejectReason_vals     DATA
 gcamel_StatSRT                  DATA
 geoip_db_get_paths
+geoip_db_name
+geoip_db_num_dbs
+geoip_db_lookup_ipv4
+geoip_db_get_paths
 get_addr_name
 get_asn1_ctx
 get_basename
index c28321e1bec3e86cd6e10c7fa72a498437db20c1..a88ba21b386dff9829efa12f68b648a31959757c 100644 (file)
@@ -604,7 +604,7 @@ init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hi
 
 #ifdef HAVE_GEOIP
     for (i = 0; i < NUM_GEOIP_COLS; i++) {
-        if (i < geoip_num_dbs()) {
+        if (i < geoip_db_num_dbs()) {
             hosttable->default_titles[NUM_BUILTIN_COLS + i]  = geoip_db_name(i);
         } else {
             hosttable->default_titles[NUM_BUILTIN_COLS + i]  = "";
@@ -1108,7 +1108,7 @@ add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, g
 #ifdef HAVE_GEOIP
         /* Filled in from the GeoIP config, if any */
         for (i = 0; i < NUM_GEOIP_COLS; i++) {
-            if (i < geoip_num_dbs() && talker->address.type == AT_IPv4) {
+            if (i < geoip_db_num_dbs() && talker->address.type == AT_IPv4) {
                 const guchar *name = geoip_db_lookup_ipv4(i, pntohl(talker->address.data), "-");
                 g_snprintf(geoip[i], COL_STR_LEN, "%s", format_text (name, strlen(name)));
                 entries[NUM_BUILTIN_COLS + i] = geoip[i];
index acf6e4e0e97cf83f87ac6713c7ca6c660d6770fd..6cf7399e3a36c206b753f0c7d70229992160dd84 100755 (executable)
@@ -7,7 +7,7 @@
 # in order to provide backward compatibility with older trees (e.g. a
 # previous release or an older SVN checkout).
 # Save previous tag.
-DOWNLOAD_TAG="2008-12-15"
+DOWNLOAD_TAG="2008-12-23"
 DOWNLOAD_PREFIX="http://anonsvn.wireshark.org/wireshark-win32-libs/tags/$DOWNLOAD_TAG/packages/"
 TAG_FILE="current_tag.txt"