aboutsummaryrefslogtreecommitdiffstats
path: root/packet-quake.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-11-27 07:13:32 +0000
committerGuy Harris <guy@alum.mit.edu>2001-11-27 07:13:32 +0000
commit07b2709f8a32951cc2503d2e048d662a01cb472c (patch)
tree21d265bf7402a2739905bd87227383ae0a9f78ab /packet-quake.c
parentfd456eaf0b5af46449882983b95529e073fd989f (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-quake.c')
-rw-r--r--packet-quake.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/packet-quake.c b/packet-quake.c
index 66cd853282..172aa2ebe9 100644
--- a/packet-quake.c
+++ b/packet-quake.c
@@ -4,7 +4,7 @@
* Uwe Girlich <uwe@planetquake.com>
* http://www.idsoftware.com/q1source/q1source.zip
*
- * $Id: packet-quake.c,v 1.20 2001/11/26 05:13:11 hagbard Exp $
+ * $Id: packet-quake.c,v 1.21 2001/11/27 07:13:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -80,6 +80,7 @@ static gint ett_quake_control = -1;
static gint ett_quake_control_colors = -1;
static gint ett_quake_flags = -1;
+static dissector_handle_t quake_handle;
static dissector_handle_t data_handle;
/* I took these names directly out of the Q1 source. */
@@ -244,7 +245,7 @@ dissect_quake_CCREP_ACCEPT
c = conversation_new( &pinfo->src, &pinfo->dst, PT_UDP, port,
pinfo->destport, 0);
if (c) {
- conversation_set_dissector(c, dissect_quake);
+ conversation_set_dissector(c, quake_handle);
}
if (tree) {
proto_tree_add_uint(tree, hf_quake_CCREP_ACCEPT_port,
@@ -519,15 +520,6 @@ dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint rest_length;
tvbuff_t *next_tvb;
- /*
- * XXX - this is a conversation dissector, and the code to
- * call a conversation dissector doesn't check for disabled
- * protocols or set "pinfo->current_proto".
- */
- CHECK_DISPLAY_AS_X(data_handle,proto_quake, tvb, pinfo, tree);
-
- pinfo->current_proto = "QUAKE";
-
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "QUAKE");
if (check_col(pinfo->fd, COL_INFO))
@@ -743,6 +735,8 @@ proto_register_quake(void)
proto_register_field_array(proto_quake, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ quake_handle = create_dissector_handle(dissect_quake, proto_quake);
+
/* Register a configuration option for port */
quake_module = prefs_register_protocol(proto_quake,
proto_reg_handoff_quake);
@@ -752,4 +746,3 @@ proto_register_quake(void)
10, &gbl_quakeServerPort);
}
-