diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-11-27 07:13:32 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-11-27 07:13:32 +0000 |
commit | f8783ef2faf90cd0a2d4c98608afc70ebd2b58ca (patch) | |
tree | 21d265bf7402a2739905bd87227383ae0a9f78ab /packet-wsp.c | |
parent | 5f90e47799c83f2e69f021af2622bebadaa37176 (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-wsp.c')
-rw-r--r-- | packet-wsp.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/packet-wsp.c b/packet-wsp.c index 51d7190802..af4e9fd955 100644 --- a/packet-wsp.c +++ b/packet-wsp.c @@ -2,7 +2,7 @@ * * Routines to dissect WSP component of WAP traffic. * - * $Id: packet-wsp.c,v 1.44 2001/11/21 01:21:08 guy Exp $ + * $Id: packet-wsp.c,v 1.45 2001/11/27 07:13:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -168,6 +168,12 @@ static gint ett_content_type = ETT_EMPTY; static gint ett_redirect_flags = ETT_EMPTY; static gint ett_redirect_afl = ETT_EMPTY; +/* Handle for WSP-over-UDP dissector */ +static dissector_handle_t wsp_fromudp_handle; + +/* Handle for WSP-over-WTP-over-UDP dissector */ +static dissector_handle_t wtp_fromudp_handle; + /* Handle for WMLC dissector */ static dissector_handle_t wmlc_handle; @@ -799,7 +805,7 @@ static gint get_integer (tvbuff_t *, guint, guint, value_type_t, guint *); /* Code to actually dissect the packets */ static void dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, dissector_t dissector) + proto_tree *tree, dissector_handle_t dissector_handle) { guint8 flags; proto_item *ti; @@ -924,7 +930,7 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo, conv = conversation_new(&redir_address, &pinfo->dst, PT_UDP, port_num, 0, NO_PORT2); } - conversation_set_dissector(conv, dissector); + conversation_set_dissector(conv, dissector_handle); break; case BT_IPv6: @@ -958,7 +964,7 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo, conv = conversation_new(&redir_address, &pinfo->dst, PT_UDP, port_num, 0, NO_PORT2); } - conversation_set_dissector(conv, dissector); + conversation_set_dissector(conv, dissector_handle); break; unknown_address_type: @@ -979,7 +985,7 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo, static void dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - dissector_t dissector, gboolean is_connectionless) + dissector_handle_t dissector_handle, gboolean is_connectionless) { frame_data *fdata = pinfo->fd; int offset = 0; @@ -1112,7 +1118,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case REDIRECT: dissect_redirect(tvb, offset, pinfo, wsp_tree, - dissector); + dissector_handle); break; case DISCONNECT: @@ -1280,7 +1286,7 @@ dissect_wsp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->fd, COL_INFO)) col_clear(pinfo->fd, COL_INFO); - dissect_wsp_common(tvb, pinfo, tree, dissect_wsp_fromudp, TRUE); + dissect_wsp_common(tvb, pinfo, tree, wsp_fromudp_handle, TRUE); } /* @@ -1294,7 +1300,7 @@ dissect_wsp_fromwap_co(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * XXX - what about WTLS->WTP->WSP? */ - dissect_wsp_common(tvb, pinfo, tree, dissect_wtp_fromudp, FALSE); + dissect_wsp_common(tvb, pinfo, tree, wtp_fromudp_handle, FALSE); } /* @@ -1312,7 +1318,7 @@ dissect_wsp_fromwap_cl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { col_clear(pinfo->fd, COL_INFO); } - dissect_wsp_common(tvb, pinfo, tree, dissect_wtp_fromudp, TRUE); + dissect_wsp_common(tvb, pinfo, tree, wtp_fromudp_handle, TRUE); } static void @@ -4052,6 +4058,11 @@ proto_register_wsp(void) register_dissector("wsp-co", dissect_wsp_fromwap_co, proto_wsp); register_dissector("wsp-cl", dissect_wsp_fromwap_cl, proto_wsp); register_heur_dissector_list("wsp", &heur_subdissector_list); + + wsp_fromudp_handle = create_dissector_handle(dissect_wsp_fromudp, + proto_wsp); + wtp_fromudp_handle = create_dissector_handle(dissect_wtp_fromudp, + proto_wsp); }; void |