aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2002-10-09 03:07:34 +0000
committerGerald Combs <gerald@wireshark.org>2002-10-09 03:07:34 +0000
commitec8fd2703a5109dd62d4397396c2ca7abe852c0f (patch)
treec71da8d3733729de068c4ca9f50de01456a2fe57
parent6743236a10df320d04d8297ac7d3dd6a530b56af (diff)
Link to libsnmp under Win32.
In gtk/main.c and tethereal.c set MIBDIRS to <get_program_path()>\snmp\mibs so that we can drop the MIB files there, instead of the default c:\usr\... path. Add NET_SNMP_DIR to config.nmake and modify Makefile.nmake to adjust CFLAGs, ethereal_LIBS and tethereal_LIBS accordingly. Define HAVE_UCD_SNMP in config.h.win32. I tested this by creating c:\program files\ethereal\snmp\mibs and dropping in the MIB files that come with Net-SNMP. Ethereal resolved system.sysDescr.0 to "iso.3.6.1.2.1.1.1.0" under Windows. Under Linux it resolved to "SNMPv2-MIB::sysDescr.0". Ethereal.nsi still needs to be updated. A compiled version of the Net-SNMP library can be found at http://www.ethereal.com/distribution/win32/development/ svn path=/trunk/; revision=6385
-rw-r--r--Makefile.nmake12
-rw-r--r--config.h.win324
-rw-r--r--config.nmake3
-rw-r--r--gtk/main.c24
-rw-r--r--tethereal.c24
5 files changed, 54 insertions, 13 deletions
diff --git a/Makefile.nmake b/Makefile.nmake
index d32d9a7799..9fbdd7c5d0 100644
--- a/Makefile.nmake
+++ b/Makefile.nmake
@@ -1,7 +1,7 @@
## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
-# $Id: Makefile.nmake,v 1.240 2002/09/23 17:14:54 jmayer Exp $
+# $Id: Makefile.nmake,v 1.241 2002/10/09 03:07:26 gerald Exp $
include config.nmake
include <win32.mak>
@@ -15,7 +15,9 @@ LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
CFLAGS=-DHAVE_CONFIG_H $(LOCAL_CFLAGS) /I$(GLIB_DIR) /I$(GLIB_DIR)\gmodule \
/I$(GTK_DIR) /I. /Iwiretap /I$(GTK_DIR)\gdk /I$(GTK_DIR)\gdk\win32 \
- /I$(ZLIB_DIR) /I$(PCAP_DIR)/include -D_U_=""
+ /I$(ZLIB_DIR) /I$(PCAP_DIR)\include \
+ /I$(NET_SNMP_DIR)\include /I$(NET_SNMP_DIR)\win32 \
+ -D_U_=""
CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
@@ -375,7 +377,8 @@ ethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
$(GTK_DIR)\gtk\gtk-$(GTK_VERSION).lib \
$(GTK_DIR)\gdk\gdk-$(GTK_VERSION).lib \
$(GLIB_DIR)\glib-$(GLIB_VERSION).lib \
- $(GLIB_DIR)\gmodule\gmodule-$(GLIB_VERSION).lib
+ $(GLIB_DIR)\gmodule\gmodule-$(GLIB_VERSION).lib \
+ $(NET_SNMP_DIR)\win32\lib\libsnmp.lib
# $(PCAP_DIR)\lib\wpcap.lib
tethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
@@ -383,7 +386,8 @@ tethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
wsock32.lib user32.lib \
$(GLIB_DIR)\glib-$(GLIB_VERSION).lib \
- $(GLIB_DIR)\gmodule\gmodule-$(GLIB_VERSION).lib
+ $(GLIB_DIR)\gmodule\gmodule-$(GLIB_VERSION).lib \
+ $(NET_SNMP_DIR)\win32\lib\libsnmp.lib
editcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \
diff --git a/config.h.win32 b/config.h.win32
index 530ec19993..e248456425 100644
--- a/config.h.win32
+++ b/config.h.win32
@@ -1,4 +1,4 @@
-/* $Id: config.h.win32,v 1.36 2002/09/10 08:23:10 guy Exp $ */
+/* $Id: config.h.win32,v 1.37 2002/10/09 03:07:26 gerald Exp $ */
/* config.h.win32 Generated manually. :-) */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
@@ -43,7 +43,7 @@
#define HAVE_LIBPCAP 1
-/* #undef HAVE_UCD_SNMP */
+#define HAVE_UCD_SNMP 1
/* Define if you have the gethostbyname2 function. */
/* #undef HAVE_GETHOSTBYNAME2 */
diff --git a/config.nmake b/config.nmake
index 5331fa7b2d..3b9c509a89 100644
--- a/config.nmake
+++ b/config.nmake
@@ -1,4 +1,4 @@
-# $Id: config.nmake,v 1.30 2002/09/26 19:06:40 gerald Exp $
+# $Id: config.nmake,v 1.31 2002/10/09 03:07:27 gerald Exp $
VERSION=0.9.7
RC_VERSION=0.9.7
@@ -11,6 +11,7 @@ GLIB_DIR=C:\ethereal-win32-libs\glib
GTK_DIR=C:\ethereal-win32-libs\gtk+
ZLIB_DIR=C:\ethereal-win32-libs\zlib-1.1.3
PCAP_DIR=C:\ethereal-win32-libs\WPdpack
+NET_SNMP_DIR=C:\ethereal-win32-libs\net-snmp-5.0.6
COMMON_FILES_GNU=c:\program files\common files\gnu
diff --git a/gtk/main.c b/gtk/main.c
index 763058f306..aa9fffe505 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.265 2002/09/27 11:07:10 sahlberg Exp $
+ * $Id: main.c,v 1.266 2002/10/09 03:07:34 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1207,7 +1207,12 @@ main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsaData;
-#endif
+
+# ifdef HAVE_UCD_SNMP
+ char *mib_path;
+# define MIB_PATH_APPEND "\\snmp\\mibs"
+# endif /* HAVE_UCD_SNMP */
+#endif /* WIN32 */
char *gpf_path, *cf_path, *df_path;
char *pf_path;
@@ -1755,7 +1760,20 @@ main(int argc, char *argv[])
/* Start windows sockets */
WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
-#endif
+
+# ifdef HAVE_UCD_SNMP
+ /* Set MIBDIRS so that the SNMP library can find its mibs. */
+ /* XXX - Should we set MIBS or MIBFILES as well? */
+
+ mib_path = g_malloc (strlen(get_datafile_dir()) + strlen(MIB_PATH_APPEND) + 20);
+ sprintf (mib_path, "MIBDIRS=%s\\%s", get_datafile_dir(), MIB_PATH_APPEND);
+ /* Amazingly enough, Windows does not provide setenv(). */
+ if (getenv("MIBDIRS") == NULL)
+ _putenv(mib_path);
+ g_free(mib_path);
+
+# endif /* HAVE_UCD_SNMP */
+#endif /* WIN32 */
/* Notify all registered modules that have had any of their preferences
changed either from one of the preferences file or from the command
diff --git a/tethereal.c b/tethereal.c
index a7060bf94a..eb49f373b5 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.159 2002/09/27 11:06:59 sahlberg Exp $
+ * $Id: tethereal.c,v 1.160 2002/10/09 03:07:27 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -311,7 +311,12 @@ main(int argc, char *argv[])
#ifdef WIN32
WSADATA wsaData;
-#endif
+
+# ifdef HAVE_UCD_SNMP
+ char *mib_path;
+# define MIB_PATH_APPEND "\\snmp\\mibs"
+# endif /* HAVE_UCD_SNMP */
+#endif /* WIN32 */
char *gpf_path;
char *pf_path;
@@ -772,7 +777,20 @@ main(int argc, char *argv[])
#ifdef WIN32
/* Start windows sockets */
WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
-#endif
+
+# ifdef HAVE_UCD_SNMP
+ /* Set MIBDIRS so that the SNMP library can find its mibs. */
+ /* XXX - Should we set MIBS or MIBFILES as well? */
+
+ mib_path = g_malloc (strlen(get_datafile_dir()) + strlen(MIB_PATH_APPEND) + 20);
+ sprintf (mib_path, "MIBDIRS=%s\\%s", get_datafile_dir(), MIB_PATH_APPEND);
+ /* Amazingly enough, Windows does not provide setenv(). */
+ if (getenv("MIBDIRS") == NULL)
+ _putenv(mib_path);
+ g_free(mib_path);
+
+# endif /* HAVE_UCD_SNMP */
+#endif /* WIN32 */
/* Notify all registered modules that have had any of their preferences
changed either from one of the preferences file or from the command