aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am14
-rw-r--r--configure.in8
-rw-r--r--ethertype.c4
-rw-r--r--packet-atm.c14
-rw-r--r--packet-ipx.c9
-rw-r--r--packet-snmp.c62
-rw-r--r--packet-udp.c4
-rw-r--r--proto.c8
8 files changed, 55 insertions, 68 deletions
diff --git a/Makefile.am b/Makefile.am
index 7210b9145f..f343e4f181 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.124 1999/12/04 21:37:56 guy Exp $
+# $Id: Makefile.am,v 1.125 1999/12/05 02:32:39 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@@ -125,6 +125,8 @@ DISSECTOR_SOURCES = \
packet-smb.c \
packet-sna.c \
packet-sna.h \
+ packet-snmp.c \
+ packet-snmp.h \
packet-sscop.c \
packet-stat.c \
packet-stat.h \
@@ -205,8 +207,6 @@ EXTRA_ethereal_SOURCES = \
dfilter-grammar.c \
dfilter-grammar.h \
dfilter-scanner.c \
- packet-snmp.c \
- packet-snmp.h \
snprintf.c \
snprintf.h \
snprintf-imp.h \
@@ -218,10 +218,10 @@ EXTRA_ethereal_SOURCES = \
inet_pton.c \
inet_ntop.c
-ethereal_DEPENDENCIES = @SNMP_O@ @SNPRINTF_O@ @STRERROR_O@ \
+ethereal_DEPENDENCIES = @SNPRINTF_O@ @STRERROR_O@ \
@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@\
wiretap/libwiretap.a gtk/libui.a
-ethereal_LDADD = @SNMP_O@ @SNPRINTF_O@ @STRERROR_O@ \
+ethereal_LDADD = @SNPRINTF_O@ @STRERROR_O@ \
@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@\
wiretap/libwiretap.a gtk/libui.a \
@SNMP_A@
@@ -251,9 +251,9 @@ wiretap/libwiretap.a gtk/libui.a \
# The first argument is the directory in which the source files live.
# All subsequent arguments are the files to scan.
#
-register.c: packet.c $(DISSECTOR_SOURCES) @SNMP_C@
+register.c: packet.c $(DISSECTOR_SOURCES)
@echo Making register.c
- @$(srcdir)/make-reg-dotc $(srcdir) packet.c $(DISSECTOR_SOURCES) @SNMP_C@
+ @$(srcdir)/make-reg-dotc $(srcdir) packet.c $(DISSECTOR_SOURCES)
ps.c: print.ps rdps
./rdps $(srcdir)/print.ps ps.c
diff --git a/configure.in b/configure.in
index 3a8b13efcf..62f1cfafb7 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.62 1999/12/03 07:02:48 guy Exp $
+# $Id: configure.in,v 1.63 1999/12/05 02:32:40 guy Exp $
dnl
dnl Process this file with autoconf 2.13 or later to produce a
dnl configure script; 2.12 doesn't generate a "configure" script that
@@ -148,8 +148,6 @@ AC_ARG_ENABLE(snmp,
[ --enable-snmp use SNMP library, if available. [default=yes]],,enable_snmp=yes)
SNMP_A=''
-SNMP_C=''
-SNMP_O=''
AC_MSG_CHECKING(whether to use SNMP library if available)
if test "x$enable_snmp" = "xno" ; then
AC_MSG_RESULT(no)
@@ -160,13 +158,9 @@ else
AC_CHECK_LIB(snmp, asn_parse_header,
[
SNMP_A=-lsnmp
- SNMP_C=packet-snmp.c
- SNMP_O=packet-snmp.o
], )
fi
AC_SUBST(SNMP_A)
-AC_SUBST(SNMP_C)
-AC_SUBST(SNMP_O)
dnl Checks for typedefs, structures, and compiler characteristics.
# AC_C_CONST
diff --git a/ethertype.c b/ethertype.c
index 21b774daeb..f1e2b2d917 100644
--- a/ethertype.c
+++ b/ethertype.c
@@ -2,7 +2,7 @@
* Routines for calling the right protocol for the ethertype.
* This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
*
- * $Id: ethertype.c,v 1.19 1999/11/30 23:56:35 gram Exp $
+ * $Id: ethertype.c,v 1.20 1999/12/05 02:32:41 guy Exp $
*
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
@@ -121,11 +121,9 @@ ethertype(guint16 etype, int offset,
case ETHERTYPE_VLAN:
dissect_vlan(pd, offset, fd, tree);
break;
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
case ETHERTYPE_SNMP:
dissect_snmp(pd, offset, fd, tree);
break;
-#endif
default:
dissect_data(pd, offset, fd, tree);
if (check_col(fd, COL_PROTOCOL)) { col_add_fstr(fd, COL_PROTOCOL, "0x%04x", etype); }
diff --git a/packet-atm.c b/packet-atm.c
index b69ccbf2ee..7d4a6f48e6 100644
--- a/packet-atm.c
+++ b/packet-atm.c
@@ -1,7 +1,7 @@
/* packet-atm.c
* Routines for ATM packet disassembly
*
- * $Id: packet-atm.c,v 1.9 1999/11/27 06:17:23 guy Exp $
+ * $Id: packet-atm.c,v 1.10 1999/12/05 02:32:41 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -36,26 +36,20 @@
#include "packet.h"
#include "resolv.h"
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
#include "packet-snmp.h"
-#endif
static int proto_atm = -1;
static int hf_atm_vpi = -1;
static int hf_atm_vci = -1;
static int proto_atm_lane = -1;
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
static int proto_ilmi = -1;
-#endif
static gint ett_atm = -1;
static gint ett_atm_lane = -1;
static gint ett_atm_lane_lc_lan_dest = -1;
static gint ett_atm_lane_lc_lan_dest_rd = -1;
static gint ett_atm_lane_lc_flags = -1;
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
static gint ett_ilmi = -1;
-#endif
/*
* See
@@ -663,11 +657,9 @@ dissect_atm(const u_char *pd, frame_data *fd, proto_tree *tree)
dissect_lane(pd, offset, fd, tree);
break;
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
case ATT_HL_ILMI:
dissect_snmp_pdu(pd, offset, fd, tree, "ILMI", proto_ilmi, ett_ilmi);
break;
-#endif
default:
if (tree) {
@@ -701,9 +693,7 @@ proto_register_atm(void)
};
static gint *ett[] = {
&ett_atm,
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
&ett_ilmi,
-#endif
&ett_atm_lane,
&ett_atm_lane_lc_lan_dest,
&ett_atm_lane_lc_lan_dest_rd,
@@ -711,9 +701,7 @@ proto_register_atm(void)
};
proto_atm = proto_register_protocol("ATM", "atm");
proto_register_field_array(proto_atm, hf, array_length(hf));
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
proto_ilmi = proto_register_protocol("ILMI", "ilmi");
-#endif
proto_atm_lane = proto_register_protocol("ATM LANE", "lane");
proto_register_subtree_array(ett, array_length(ett));
}
diff --git a/packet-ipx.c b/packet-ipx.c
index 28d1439945..9c48e6282a 100644
--- a/packet-ipx.c
+++ b/packet-ipx.c
@@ -2,7 +2,7 @@
* Routines for NetWare's IPX
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-ipx.c,v 1.41 1999/12/03 22:04:24 nneul Exp $
+ * $Id: packet-ipx.c,v 1.42 1999/12/05 02:32:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -39,9 +39,7 @@
#include "packet-ncp.h"
#include "resolv.h"
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
#include "packet-snmp.h"
-#endif
/* The information in this module (IPX, SPX, NCP) comes from:
NetWare LAN Analysis, Second Edition
@@ -170,13 +168,8 @@ static struct port_info ports[] = {
"Attachmate Gateway" },
{ IPX_SOCKET_IPX_MESSAGE, NULL,
"IPX Message" },
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
{ IPX_SOCKET_SNMP_AGENT, dissect_snmp, "SNMP Agent" },
{ IPX_SOCKET_SNMP_SINK, dissect_snmp, "SNMP Sink" },
-#else
- { IPX_SOCKET_SNMP_AGENT, NULL, "SNMP Agent" },
- { IPX_SOCKET_SNMP_SINK, NULL, "SNMP Sink" },
-#endif
{ IPX_SOCKET_UDP_TUNNEL, NULL, "UDP Tunnel" },
{ IPX_SOCKET_TCP_TUNNEL, NULL, "TCP Tunnel" },
diff --git a/packet-snmp.c b/packet-snmp.c
index 845fe3ea3d..82f22f4ee2 100644
--- a/packet-snmp.c
+++ b/packet-snmp.c
@@ -2,7 +2,7 @@
* Routines for SNMP (simple network management protocol)
* D.Jorand (c) 1998
*
- * $Id: packet-snmp.c,v 1.14 1999/11/18 07:29:53 guy Exp $
+ * $Id: packet-snmp.c,v 1.15 1999/12/05 02:32:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -28,15 +28,12 @@
# include "config.h"
#endif
-
#if defined(HAVE_UCD_SNMP_SNMP_H)
# define WITH_SNMP_UCD 1
#elif defined(HAVE_SNMP_SNMP_H)
# define WITH_SNMP_CMU 1
#endif
-#if defined(WITH_SNMP_CMU) || defined(WITH_SNMP_UCD)
-
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@@ -54,12 +51,14 @@
#include "packet-snmp.h"
-#define in_addr_t u_int
-
static int proto_snmp = -1;
static gint ett_snmp = -1;
+#if defined(WITH_SNMP_CMU) || defined(WITH_SNMP_UCD)
+
+#define in_addr_t u_int
+
#ifdef WITH_SNMP_UCD
/* should be defined only if supported in ucd-snmp */
#define OPAQUE_SPECIAL_TYPES 1
@@ -73,13 +72,12 @@ typedef long SNMP_INT;
typedef unsigned long SNMP_UINT;
#define OID_FORMAT_STRING "%ld"
#define OID_FORMAT_STRING1 ".%ld"
-
#endif
+
#ifdef WITH_SNMP_CMU
#include <snmp/snmp.h>
#include <snmp/snmp_impl.h>
-
#ifndef MAX_NAME_LEN
#define MAX_NAME_LEN SNMP_MAX_LEN
#endif
@@ -114,7 +112,6 @@ typedef unsigned long SNMP_UINT;
#define SNMP_MSG_REPORT SNMP_PDU_REPORT
#endif
-
#ifndef SNMP_VERSION_2c
#define SNMP_VERSION_2c 1
#endif
@@ -212,13 +209,12 @@ typedef unsigned long SNMP_UINT;
#define SNMP_ENDOFMIBVIEW SMI_ENDOFMIBVIEW
#endif
-
typedef int SNMP_INT;
typedef unsigned int SNMP_UINT;
#define OID_FORMAT_STRING "%d"
#define OID_FORMAT_STRING1 ".%d"
-#endif
+#endif /* WITH_SNMP_CMU */
static const value_string versions[] = {
{ SNMP_VERSION_1, "VERSION 1" },
@@ -286,12 +282,6 @@ dissect_snmp_error(const u_char *pd, int offset, frame_data *fd,
}
void
-dissect_snmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
-{
- dissect_snmp_pdu(pd, offset, fd, tree, "SNMP", proto_snmp, ett_snmp);
-}
-
-void
dissect_snmp_pdu(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, char *proto_name, int proto, gint ett)
{
@@ -372,7 +362,7 @@ dissect_snmp_pdu(const u_char *pd, int offset, frame_data *fd,
"Couldn't parse authentication");
return;
}
-#endif
+#endif /* WITH_SNMP_UCD */
#ifdef WITH_SNMP_CMU
/* initialize length variables */
/* length=fd->pkt_len-offset; */
@@ -404,7 +394,7 @@ dissect_snmp_pdu(const u_char *pd, int offset, frame_data *fd,
return;
}
community[community_length] = '\0';
-#endif
+#endif /* WITH_SNMP_CMU */
header_length-=length;
/* printf("Community is %s, version is %d (header length is %d)\n", community, version, header_length); */
@@ -869,8 +859,36 @@ dissect_snmp_pdu(const u_char *pd, int offset, frame_data *fd,
}
}
+#else /* WITH_SNMP: CMU or UCD */
+
+/* Stub dissector, for use when there's no SNMP library. */
+void
+dissect_snmp_pdu(const u_char *pd, int offset, frame_data *fd,
+ proto_tree *tree, char *proto_name, int proto, gint ett)
+{
+ proto_item *item;
+ proto_tree *snmp_tree;
+
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, proto_name);
+ if (check_col(fd, COL_INFO))
+ col_add_str(fd, COL_INFO, "SNMP request or reply");
+ if (tree) {
+ item = proto_tree_add_item(tree, proto, offset, END_OF_FRAME,
+ NULL);
+ snmp_tree = proto_item_add_subtree(item, ett);
+ dissect_data(pd, offset, fd, snmp_tree);
+ }
+}
+
#endif /* WITH_SNMP: CMU or UCD */
+void
+dissect_snmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
+{
+ dissect_snmp_pdu(pd, offset, fd, tree, "SNMP", proto_snmp, ett_snmp);
+}
+
/*
* Allow the stuff that builds "register.c" to scan "packet-snmp.c" even
* if we're not enabling SNMP decoding (for "canned" source distributions
@@ -886,13 +904,17 @@ proto_register_snmp(void)
{ &variable,
{ "Name", "snmp.abbreviation", TYPE, VALS_POINTER }},
};*/
+#endif /* WITH_SNMP: CMU or UCD */
static gint *ett[] = {
&ett_snmp,
};
+#if defined(WITH_SNMP_CMU) || defined(WITH_SNMP_UCD)
init_mib();
+#endif /* WITH_SNMP: CMU or UCD */
proto_snmp = proto_register_protocol("Simple Network Management Protocol", "snmp");
+#if defined(WITH_SNMP_CMU) || defined(WITH_SNMP_UCD)
/* proto_register_field_array(proto_snmp, hf, array_length(hf));*/
- proto_register_subtree_array(ett, array_length(ett));
#endif /* WITH_SNMP: CMU or UCD */
+ proto_register_subtree_array(ett, array_length(ett));
}
diff --git a/packet-udp.c b/packet-udp.c
index f5e9151cee..76b9fd967d 100644
--- a/packet-udp.c
+++ b/packet-udp.c
@@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
- * $Id: packet-udp.c,v 1.39 1999/12/03 21:50:30 nneul Exp $
+ * $Id: packet-udp.c,v 1.40 1999/12/05 02:32:39 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -262,10 +262,8 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
(uh_dport >= UDP_PORT_RX_LOW && uh_dport <= UDP_PORT_RX_HIGH) ||
PORT_IS(UDP_PORT_RX_AFS_BACKUPS))
dissect_rx(pd, offset, fd, tree); /* transarc AFS's RX protocol */
-#if defined(HAVE_UCD_SNMP_SNMP_H) || defined(HAVE_SNMP_SNMP_H)
else if (PORT_IS(UDP_PORT_SNMP))
dissect_snmp(pd, offset, fd, tree);
-#endif
else if (PORT_IS(UDP_PORT_VINES)) {
/* FIXME: AFAIK, src and dst port must be the same */
dissect_vines_frp(pd, offset, fd, tree);
diff --git a/proto.c b/proto.c
index 6aedb1bada..cf152f7bd9 100644
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.50 1999/11/21 16:32:15 gram Exp $
+ * $Id: proto.c,v 1.51 1999/12/05 02:33:52 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -69,12 +69,6 @@
#define cVALS(x) (const value_string*)(x)
-#if defined(HAVE_UCD_SNMP_SNMP_H)
-# define WITH_SNMP_UCD 1
-#elif defined(HAVE_SNMP_SNMP_H)
-# define WITH_SNMP_CMU 1
-#endif
-
static gboolean
proto_tree_free_node(GNode *node, gpointer data);