/* packet-udp.c
* Routines for UDP packet disassembly
*
- * $Id: packet-udp.c,v 1.40 1999/12/05 02:32:39 guy Exp $
+ * $Id: packet-udp.c,v 1.49 2000/02/09 19:09:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#include <stdlib.h>
#include <glib.h>
-#include "packet.h"
+#include "globals.h"
#include "resolv.h"
+#include "plugins.h"
+
static int proto_udp = -1;
static int hf_udp_srcport = -1;
static int hf_udp_dstport = -1;
/* UDP Ports -> should go in packet-udp.h */
+#define UDP_PORT_TIME 37
#define UDP_PORT_TACACS 49
#define UDP_PORT_DNS 53
#define UDP_PORT_BOOTPS 67
#define UDP_PORT_NBNS 137
#define UDP_PORT_NBDGM 138
#define UDP_PORT_SNMP 161
+#define UDP_PORT_SNMP_TRAP 162
+#define UDP_PORT_SRVLOC 427
#define UDP_PORT_PIM_RP_DISC 496
#define UDP_PORT_ISAKMP 500
+#define UDP_PORT_WHO 513
#define UDP_PORT_RIP 520
#define UDP_PORT_RIPNG 521
+#define UDP_PORT_NCP 524
#define UDP_PORT_VINES 573
#define UDP_PORT_RADIUS 1645
+#define UDP_PORT_L2TP 1701
#define UDP_PORT_RADIUS_NEW 1812
#define UDP_PORT_RADACCT 1646
#define UDP_PORT_RADACCT_NEW 1813
#define UDP_PORT_RX_LOW 7000
#define UDP_PORT_RX_HIGH 7009
#define UDP_PORT_RX_AFS_BACKUPS 7021
+#define UDP_PORT_WCCP 2048
struct hash_struct {
guint16 proto;
if (dissect_rpc(pd, offset, fd, tree))
return;
+ /* try to apply the plugins */
+#ifdef HAVE_PLUGINS
+ {
+ plugin *pt_plug = plugin_list;
+
+ if (pt_plug) {
+ while (pt_plug) {
+ if (pt_plug->enabled && !strcmp(pt_plug->protocol, "udp") &&
+ tree && dfilter_apply(pt_plug->filter, tree, pd)) {
+ pt_plug->dissector(pd, offset, fd, tree);
+ return;
+ }
+ pt_plug = pt_plug->next;
+ }
+ }
+ }
+#endif
+
/* XXX - we should do all of this through the table of ports. */
#define PORT_IS(port) (uh_sport == port || uh_dport == port)
if (PORT_IS(UDP_PORT_BOOTPS))
dissect_bootp(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_DNS))
dissect_dns(pd, offset, fd, tree);
+ else if (PORT_IS(UDP_PORT_SRVLOC))
+ dissect_srvloc(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_ISAKMP))
dissect_isakmp(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_RIP)) {
dissect_rip(pd, offset, fd, tree);
} else if (PORT_IS(UDP_PORT_RIPNG))
dissect_ripng(pd, offset, fd, tree);
+ else if (PORT_IS(UDP_PORT_NCP))
+ dissect_ncp(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_NBNS))
dissect_nbns(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_NBDGM))
dissect_nbdgm(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_NTP))
dissect_ntp(pd, offset, fd, tree);
+ else if (PORT_IS(UDP_PORT_WHO))
+ dissect_who(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_IPX)) /* RFC 1234 */
dissect_ipx(pd, offset, fd, tree);
else if ((uh_sport >= UDP_PORT_RX_LOW && uh_sport <= UDP_PORT_RX_HIGH) ||
(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 */
- else if (PORT_IS(UDP_PORT_SNMP))
+ else if (PORT_IS(UDP_PORT_SNMP) || PORT_IS(UDP_PORT_SNMP_TRAP))
dissect_snmp(pd, offset, fd, tree);
else if (PORT_IS(UDP_PORT_VINES)) {
/* FIXME: AFAIK, src and dst port must be the same */
/* This is the first point of call, but it adds a dynamic call */
udp_hash_add(MAX(uh_sport, uh_dport), dissect_tftp); /* Add to table */
dissect_tftp(pd, offset, fd, tree);
+ } else if (PORT_IS(UDP_PORT_TIME)) {
+ dissect_time(pd, offset, fd, tree);
} else if (PORT_IS(UDP_PORT_RADIUS) ||
PORT_IS(UDP_PORT_RADACCT) ||
PORT_IS(UDP_PORT_RADIUS_NEW) ||
PORT_IS(UDP_PORT_RADACCT_NEW) ) {
dissect_radius(pd, offset, fd, tree);
+ } else if ( PORT_IS(UDP_PORT_L2TP)) {
+ dissect_l2tp(pd,offset,fd,tree);
} else if ( PORT_IS(UDP_PORT_ICP)) {
dissect_icp(pd,offset,fd,tree);
} else if ( PORT_IS(UDP_PORT_ICQ)) {
dissect_icq(pd,offset,fd,tree);
+ } else if (PORT_IS(UDP_PORT_WCCP) ) {
+ dissect_wccp(pd, offset, fd, tree);
} else {
/* OK, find a routine in the table, else use the default */