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-ftp.c | |
parent | fd456eaf0b5af46449882983b95529e073fd989f (diff) |
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-ftp.c')
-rw-r--r-- | packet-ftp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packet-ftp.c b/packet-ftp.c index a2119e1d86..d80ed89a8d 100644 --- a/packet-ftp.c +++ b/packet-ftp.c @@ -3,7 +3,7 @@ * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * Copyright 2001, Juan Toledo <toledo@users.sourceforge.net> (Passive FTP) * - * $Id: packet-ftp.c,v 1.36 2001/11/21 02:01:06 guy Exp $ + * $Id: packet-ftp.c,v 1.37 2001/11/27 07:13:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -60,6 +60,8 @@ static int hf_ftp_response_data = -1; static gint ett_ftp = -1; static gint ett_ftp_data = -1; +static dissector_handle_t ftpdata_handle; + #define TCP_PORT_FTPDATA 20 #define TCP_PORT_FTP 21 @@ -188,7 +190,7 @@ handle_pasv_response(const u_char *line, int linelen, packet_info *pinfo) &pinfo->dst, PT_TCP, server_port, 0, NO_PORT2); conversation_set_dissector(conversation, - dissect_ftpdata); + ftpdata_handle); } break; } @@ -432,6 +434,8 @@ proto_register_ftp(void) proto_ftp_data = proto_register_protocol("FTP Data", "FTP-DATA", "ftp-data"); proto_register_field_array(proto_ftp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + ftpdata_handle = create_dissector_handle(dissect_ftpdata, proto_ftp_data); } void |