diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-07-03 09:53:22 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-07-03 09:53:22 +0000 |
commit | c4bd63678ca9d45e16ecd0e5c6c03938b9c05a93 (patch) | |
tree | 6770872ad310e90dc07714e3d7abf3d0097273a3 /packet-wsp.c | |
parent | b1156c9e32a268430200570f12994aacec0a1d03 (diff) |
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
Diffstat (limited to 'packet-wsp.c')
-rw-r--r-- | packet-wsp.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/packet-wsp.c b/packet-wsp.c index 49db0434c9..e0c5b39fe4 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.22 2001/06/18 22:27:30 guy Exp $ + * $Id: packet-wsp.c,v 1.23 2001/07/03 09:53:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -434,7 +434,7 @@ static guint get_uintvar (tvbuff_t *, guint, guint); /* Code to actually dissect the packets */ static void -dissect_wsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { frame_data *fdata = pinfo->fd; int offset = 0; @@ -463,20 +463,6 @@ dissect_wsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) it, if possible, summarize what's in the packet, so that a user looking at the list of packets can tell what type of packet it is. */ - /* Display protocol type depending on the port */ - if (check_col(fdata, COL_PROTOCOL)) - { - switch ( pinfo->match_port ) - { - case UDP_PORT_WSP: - col_set_str(fdata, COL_PROTOCOL, "WSP" ); - break; - case UDP_PORT_WTLS_WSP: - col_set_str(fdata, COL_PROTOCOL, "WTLS+WSP" ); - break; - } - } - /* Clear the Info column before we fetch anything from the packet */ if (check_col(fdata, COL_INFO)) { @@ -675,6 +661,30 @@ dissect_wsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } +/* + * Called directly from UDP. + * Put "WSP" into the "Protocol" column. + */ +static void +dissect_wsp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "WSP" ); + + dissect_wsp_common(tvb, pinfo, tree); +} + +/* + * Called from a higher-level WAP dissector. + * Leave the "Protocol" column alone - the dissector calling us should + * have set it. + */ +static void +dissect_wsp_fromwap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_wsp_common(tvb, pinfo, tree); +} + static void add_uri (proto_tree *tree, tvbuff_t *tvb, guint URILenOffset, guint URIOffset) { @@ -2130,7 +2140,7 @@ proto_register_wsp(void) proto_register_field_array(proto_wsp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("wsp", dissect_wsp, proto_wsp); + register_dissector("wsp", dissect_wsp_fromwap, proto_wsp); }; void @@ -2142,7 +2152,7 @@ proto_reg_handoff_wsp(void) wmlc_handle = find_dissector("wmlc"); /* Coming soon :) */ /* Only connection-less WSP has no previous handler */ - dissector_add("udp.port", UDP_PORT_WSP, dissect_wsp, proto_wsp); + dissector_add("udp.port", UDP_PORT_WSP, dissect_wsp_fromudp, proto_wsp); /* This dissector is also called from the WTP and WTLS dissectors */ } |