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-wtp.c | |
parent | b1156c9e32a268430200570f12994aacec0a1d03 (diff) | |
download | wireshark-c4bd63678ca9d45e16ecd0e5c6c03938b9c05a93.tar.gz wireshark-c4bd63678ca9d45e16ecd0e5c6c03938b9c05a93.tar.bz2 wireshark-c4bd63678ca9d45e16ecd0e5c6c03938b9c05a93.zip |
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-wtp.c')
-rw-r--r-- | packet-wtp.c | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/packet-wtp.c b/packet-wtp.c index 3b5143f79f..4d67675278 100644 --- a/packet-wtp.c +++ b/packet-wtp.c @@ -2,7 +2,7 @@ * * Routines to dissect WTP component of WAP traffic. * - * $Id: packet-wtp.c,v 1.14 2001/06/18 02:17:54 guy Exp $ + * $Id: packet-wtp.c,v 1.15 2001/07/03 09:53:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -180,7 +180,7 @@ static char retransmission_indicator(unsigned char octet); /* Code to actually dissect the packets */ static void -dissect_wtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { frame_data *fdata = pinfo->fd; @@ -212,27 +212,10 @@ dissect_wtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int i; tvbuff_t *wsp_tvb = NULL; -/* Make entries in Protocol column and Info column of summary display */ - #ifdef DEBUG fprintf( stderr, "dissect_wtp: (Entering) Frame data at %p\n", fdata ); fprintf( stderr, "dissect_wtp: tvb length is %d\n", tvb_reported_length( tvb ) ); #endif - /* Display protocol type depending on the port */ - if (check_col(fdata, COL_PROTOCOL)) - { - switch ( pinfo->match_port ) - { - case UDP_PORT_WTP_WSP: - col_add_fstr(fdata, COL_PROTOCOL, "WTP+WSP" ); - break; - case UDP_PORT_WTLS_WTP_WSP: - col_add_fstr(fdata, COL_PROTOCOL, "WTLS+WTP+WSP" ); - break; - default: - break; - } - } if (check_col(fdata, COL_INFO)) { col_clear(fdata, COL_INFO); }; @@ -428,7 +411,7 @@ dissect_wtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fprintf( stderr, "dissect_wtp: (4) tree was %p\n", tree ); #endif } - + /* Any remaining data ought to be WSP data, * so hand off to the WSP dissector */ if (tvb_reported_length (tvb) > cbHeader) @@ -443,6 +426,37 @@ dissect_wtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) #endif } +/* + * Called directly from UDP. + * Put "WTP+WSP" into the "Protocol" column. + */ +static void +dissect_wtp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "WTP+WSP" ); + + dissect_wtp_common(tvb, pinfo, tree); +} + +/* + * Called from a higher-level WAP dissector, presumably WTLS. + * Put "WTLS+WSP+WTP" to the "Protocol" column. + * + * XXX - is this supposed to be called from WTLS? If so, we're not + * calling it.... + * + * XXX - can this be called from any other dissector? + */ +static void +dissect_wtp_fromwap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "WTLS+WTP+WSP" ); + + dissect_wtp_common(tvb, pinfo, tree); +} + static char pdu_type(unsigned char octet) { char ch = (octet >> 3) & 0x0F; @@ -639,6 +653,8 @@ proto_register_wtp(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_wtp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + register_dissector("wtp", dissect_wtp_fromwap, proto_wtp); }; void @@ -649,5 +665,6 @@ proto_reg_handoff_wtp(void) */ wsp_handle = find_dissector("wsp"); - dissector_add("udp.port", UDP_PORT_WTP_WSP, dissect_wtp, proto_wtp); + dissector_add("udp.port", UDP_PORT_WTP_WSP, dissect_wtp_fromudp, + proto_wtp); } |