aboutsummaryrefslogtreecommitdiffstats
path: root/packet-dns.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-04-04 06:17:30 +0000
committerGuy Harris <guy@alum.mit.edu>2000-04-04 06:17:30 +0000
commit1ffa3cfa2b664a4920805cb40dd9fe85bf3ca1fe (patch)
treecb4e40fa15b5c560beef61457ce5fa239ac6db66 /packet-dns.c
parente6d47076b8f8c64f34b9f169a117836b2719da89 (diff)
Make "make-reg-dotc" generate a "register_all_protocol_handoffs()"
routine, which calls all routines found in the dissector source files with names that match " proto_reg_handoff_[a-z_0-9A-Z]*". Call "register_all_protocol_handoffs()" after calling "register_all_protocols()" - "register_all_protocols()" needs to be called first, so that all protocols can register their fields, because registering a dissector as being called if field "proto.port" is equal to N requires that "proto.port" be a registered field. Give DNS a handoff registration routine, and register its dissector to be called if "udp.port" is UDP_PORT_DNS; remove the registration of DNS from "packet-udp.c", and make "dissect_dns()" static (as nobody else need know that it exists). svn path=/trunk/; revision=1788
Diffstat (limited to 'packet-dns.c')
-rw-r--r--packet-dns.c13
1 files changed, 11 insertions, 2 deletions
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);
+}