diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-11-27 07:13:32 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-11-27 07:13:32 +0000 |
commit | 07b2709f8a32951cc2503d2e048d662a01cb472c (patch) | |
tree | 21d265bf7402a2739905bd87227383ae0a9f78ab /packet-tftp.c | |
parent | fd456eaf0b5af46449882983b95529e073fd989f (diff) | |
download | wireshark-07b2709f8a32951cc2503d2e048d662a01cb472c.tar.gz wireshark-07b2709f8a32951cc2503d2e048d662a01cb472c.tar.bz2 wireshark-07b2709f8a32951cc2503d2e048d662a01cb472c.zip |
Change "conversation_set_dissector()" to take a dissector handle, rather
than a pointer to a dissector function, as an argument.
This means that the conversation dissector is called through
"call_dissector()", so the dissector itself doesn't have to worry about
checking whether the protocol is enabled or setting
"pinfo->current_proto", so get rid of the code that does that in
conversation dissectors. Also, make the conversation dissectors static.
Get rid of some direct calls to dissectors; replace them with calls
through handles, and, again, get rid of code to check whether a protocol
is enabled and set "pinfo->current_proto" where that code isn't needed.
Make those dissectors static if they aren't already static.
Add a routine "create_dissector_handle()" to create a dissector handle
without registering it by name, if the dissector isn't used outside the
module in which it's defined.
svn path=/trunk/; revision=4281
Diffstat (limited to 'packet-tftp.c')
-rw-r--r-- | packet-tftp.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/packet-tftp.c b/packet-tftp.c index 39c40324db..7bd1ffa5ad 100644 --- a/packet-tftp.c +++ b/packet-tftp.c @@ -5,7 +5,7 @@ * Craig Newell <CraigN@cheque.uq.edu.au> * RFC2347 TFTP Option Extension * - * $Id: packet-tftp.c,v 1.31 2001/11/26 05:13:12 hagbard Exp $ + * $Id: packet-tftp.c,v 1.32 2001/11/27 07:13:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -55,7 +55,7 @@ static int hf_tftp_error_string = -1; static gint ett_tftp = -1; -static dissector_handle_t data_handle; +static dissector_handle_t tftp_handle; #define UDP_PORT_TFTP 69 @@ -101,10 +101,6 @@ dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) u_int i1; guint16 error; - CHECK_DISPLAY_AS_X(data_handle,proto_tftp, tvb, pinfo, tree); - - pinfo->current_proto = "TFTP"; - /* * The first TFTP packet goes to the TFTP port; the second one * comes from some *other* port, but goes back to the same @@ -129,7 +125,7 @@ dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (conversation == NULL) { conversation = conversation_new(&pinfo->src, &pinfo->dst, PT_UDP, pinfo->srcport, 0, NO_PORT2); - conversation_set_dissector(conversation, dissect_tftp); + conversation_set_dissector(conversation, tftp_handle); } } @@ -343,11 +339,12 @@ proto_register_tftp(void) "TFTP", "tftp"); proto_register_field_array(proto_tftp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + tftp_handle = create_dissector_handle(dissect_tftp, proto_tftp); } void proto_reg_handoff_tftp(void) { - data_handle = find_dissector("data"); dissector_add("udp.port", UDP_PORT_TFTP, dissect_tftp, proto_tftp); } |