aboutsummaryrefslogtreecommitdiffstats
path: root/packet-socks.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-11-27 07:13:32 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-11-27 07:13:32 +0000
commitf8783ef2faf90cd0a2d4c98608afc70ebd2b58ca (patch)
tree21d265bf7402a2739905bd87227383ae0a9f78ab /packet-socks.c
parent5f90e47799c83f2e69f021af2622bebadaa37176 (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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4281 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-socks.c')
-rw-r--r--packet-socks.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/packet-socks.c b/packet-socks.c
index 0509708f72..4a31977a9c 100644
--- a/packet-socks.c
+++ b/packet-socks.c
@@ -2,7 +2,7 @@
* Routines for socks versions 4 &5 packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
- * $Id: packet-socks.c,v 1.28 2001/11/21 23:16:21 gram Exp $
+ * $Id: packet-socks.c,v 1.29 2001/11/27 07:13:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -122,6 +122,11 @@ static int hf_socks_dstport = -1;
static int hf_socks_command = -1;
+/************* Dissector handles ***********/
+
+static dissector_handle_t socks_handle;
+static dissector_handle_t socks_udp_handle;
+
/************* State Machine names ***********/
enum SockState {
@@ -420,7 +425,7 @@ new_udp_conversation( socks_hash_entry_t *hash_info, packet_info *pinfo){
g_assert( conversation);
conversation_add_proto_data(conversation, proto_socks, hash_info);
- conversation_set_dissector(conversation, socks_udp_dissector);
+ conversation_set_dissector(conversation, socks_udp_handle);
}
@@ -950,7 +955,7 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
hash_info);
/* set dissector for now */
- conversation_set_dissector(conversation, dissect_socks);
+ conversation_set_dissector(conversation, socks_handle);
}
/* display summary window information */
@@ -1115,6 +1120,10 @@ proto_register_socks( void){
proto_register_subtree_array(ett, array_length(ett));
register_init_routine( &socks_reinit); /* register re-init routine */
+
+ socks_udp_handle = create_dissector_handle(socks_udp_dissector,
+ proto_socks);
+ socks_handle = create_dissector_handle(dissect_socks, proto_socks);
}