aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
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 /tethereal.c
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
Diffstat (limited to 'tethereal.c')
-rw-r--r--tethereal.c24
1 files changed, 21 insertions, 3 deletions
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