From 1ffa3cfa2b664a4920805cb40dd9fe85bf3ca1fe Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 4 Apr 2000 06:17:30 +0000 Subject: 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 --- packet-dns.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'packet-dns.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 @@ -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); +} -- cgit v1.2.3