aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake-reg-dotc18
-rw-r--r--packet-dns.c13
-rw-r--r--packet-dns.h4
-rw-r--r--packet-udp.c5
-rw-r--r--proto.c10
-rw-r--r--register.h3
6 files changed, 41 insertions, 12 deletions
diff --git a/make-reg-dotc b/make-reg-dotc
index 40730eaa33..11d7e63590 100755
--- a/make-reg-dotc
+++ b/make-reg-dotc
@@ -13,6 +13,10 @@ rm -f register.c-tmp
echo '/* Do not modify this file. */' >register.c-tmp
echo '/* It is created automatically by the Makefile. */'>>register.c-tmp
echo '#include "register.h"' >>register.c-tmp
+
+#
+# Build code to call all the protocol registration routines.
+#
echo 'void register_all_protocols(void) {' >>register.c-tmp
for f in "$@"
do
@@ -23,4 +27,18 @@ do
grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcdir/$f 2>/dev/null
done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp
echo '}' >>register.c-tmp
+
+#
+# Build code to call all the protocol handoff registration routines.
+#
+echo 'void register_all_protocol_handoffs(void) {' >>register.c-tmp
+for f in "$@"
+do
+ grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcdir/$f 2>/dev/null
+done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp
+for f in "$@"
+do
+ grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcdir/$f 2>/dev/null
+done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp
+echo '}' >>register.c-tmp
mv register.c-tmp register.c
diff --git a/packet-dns.c b/packet-dns.c
index f5f50a02e3..f744baa3ac 100644
--- a/packet-dns.c
+++ b/packet-dns.c
@@ -1,7 +1,7 @@
/* packet-dns.c
* Routines for DNS packet disassembly
*
- * $Id: packet-dns.c,v 1.40 2000/03/30 01:52:39 guy Exp $
+ * $Id: packet-dns.c,v 1.41 2000/04/04 06:17:28 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -61,6 +61,9 @@ static gint ett_t_key_flags = -1;
/* DNS structs and definitions */
+/* Port used for DNS. */
+#define UDP_PORT_DNS 53
+
/* Offsets of fields in the DNS header. */
#define DNS_ID 0
#define DNS_FLAGS 2
@@ -1483,7 +1486,7 @@ dissect_answer_records(const u_char *pd, int cur_off, int dns_data_offset,
return cur_off - start_off;
}
-void
+static void
dissect_dns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
int dns_data_offset;
@@ -1696,3 +1699,9 @@ proto_register_dns(void)
proto_register_field_array(proto_dns, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
+
+void
+proto_reg_handoff_dns(void)
+{
+ dissector_add("udp.port", UDP_PORT_DNS, dissect_dns);
+}
diff --git a/packet-dns.h b/packet-dns.h
index 45777a954e..523e9a1e1b 100644
--- a/packet-dns.h
+++ b/packet-dns.h
@@ -2,7 +2,7 @@
* Definitions for packet disassembly structures and routines used both by
* DNS and NBNS.
*
- * $Id: packet-dns.h,v 1.7 2000/03/30 01:52:40 guy Exp $
+ * $Id: packet-dns.h,v 1.8 2000/04/04 06:17:28 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -40,6 +40,4 @@ add_rr_to_tree(proto_item *trr, int rr_type, int offset, const char *name,
int namelen, const char *type_name, const char *class_name, u_int ttl,
u_short data_len);
-void dissect_dns(const u_char *, int, frame_data *, proto_tree *);
-
#endif /* packet-dns.h */
diff --git a/packet-udp.c b/packet-udp.c
index 1e6e4492a0..4879eaa083 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.56 2000/04/04 05:54:59 guy Exp $
+ * $Id: packet-udp.c,v 1.57 2000/04/04 06:17:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -49,7 +49,6 @@
#include "packet-auto_rp.h"
#include "packet-bootp.h"
#include "packet-dhis.h"
-#include "packet-dns.h"
#include "packet-hsrp.h"
#include "packet-icp.h"
#include "packet-icq.h"
@@ -96,7 +95,6 @@ typedef struct _e_udphdr {
#define UDP_PORT_TIME 37
#define UDP_PORT_TACACS 49
-#define UDP_PORT_DNS 53
#define UDP_PORT_BOOTPS 67
#define UDP_PORT_TFTP 69
#define UDP_PORT_NTP 123
@@ -275,7 +273,6 @@ proto_register_udp(void)
dissector_add("udp.port", UDP_PORT_TIME, dissect_time);
dissector_add("udp.port", UDP_PORT_TACACS, dissect_tacacs);
- dissector_add("udp.port", UDP_PORT_DNS, dissect_dns);
dissector_add("udp.port", UDP_PORT_BOOTPS, dissect_bootp);
dissector_add("udp.port", UDP_PORT_NTP, dissect_ntp);
dissector_add("udp.port", UDP_PORT_NBNS, dissect_nbns);
diff --git a/proto.c b/proto.c
index c8fdb54c63..6a788cc57d 100644
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.58 2000/04/04 02:34:39 gram Exp $
+ * $Id: proto.c,v 1.59 2000/04/04 06:17:29 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -193,9 +193,15 @@ proto_init(void)
tree_is_expanded[0] = FALSE;
num_tree_types = 1;
- /* Have each dissector register its protocols and fields. */
+ /* Have each dissector register its protocols and fields, and
+ do whatever one-time initialization it needs to do. */
register_all_protocols();
+ /* Now have the ones that register a "handoff", i.e. that
+ specify that another dissector for a protocol under which
+ this dissector's protocol lives call it. */
+ register_all_protocol_handoffs();
+
/* Register one special-case FT_TEXT_ONLY field for use when
converting ethereal to new-style proto_tree. These fields
are merely strings on the GUI tree; they are not filterable */
diff --git a/register.h b/register.h
index 47f3afde94..3e418876e3 100644
--- a/register.h
+++ b/register.h
@@ -1,7 +1,7 @@
/* register.h
* Definitions for protocol registration
*
- * $Id: register.h,v 1.1 1999/10/20 06:28:29 guy Exp $
+ * $Id: register.h,v 1.2 2000/04/04 06:17:30 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -27,5 +27,6 @@
#define __REGISTER_H__
extern void register_all_protocols(void);
+extern void register_all_protocol_handoffs(void);
#endif /* __REGISTER_H__ */