diff options
author | Olivier Biot <obiot.ethereal@gmail.com> | 2003-12-08 20:37:15 +0000 |
---|---|---|
committer | Olivier Biot <obiot.ethereal@gmail.com> | 2003-12-08 20:37:15 +0000 |
commit | 2b8a6c6f4df1280c3ff2af6579f2ffce1effb602 (patch) | |
tree | cc6cebbfbaf48bb089f49a3719ddc5043182fbfb | |
parent | c468938693fa343b8426d06a82e7732231528a04 (diff) |
Get rid of the integer media type dissector table in WSP, WBXML and MMSE.
svn path=/trunk/; revision=9203
-rw-r--r-- | packet-mmse.c | 11 | ||||
-rw-r--r-- | packet-wbxml.c | 57 | ||||
-rw-r--r-- | packet-wsp.c | 71 |
3 files changed, 27 insertions, 112 deletions
diff --git a/packet-mmse.c b/packet-mmse.c index 1fcce75da2..f1c939c3a6 100644 --- a/packet-mmse.c +++ b/packet-mmse.c @@ -2,7 +2,7 @@ * Routines for MMS Message Encapsulation dissection * Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl> * - * $Id: packet-mmse.c,v 1.23 2003/12/07 18:09:52 obiot Exp $ + * $Id: packet-mmse.c,v 1.24 2003/12/08 20:37:15 obiot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -862,13 +862,8 @@ proto_reg_handoff_mmse(void) heur_dissector_add("wsp", dissect_mmse_heur, proto_mmse); mmse_handle = create_dissector_handle(dissect_mmse, proto_mmse); - dissector_add("wsp.content_type.integer", - MMS_CONTENT_TYPE, - mmse_handle); /* As the media types for WSP and HTTP are the same, the WSP dissector - * uses the same string dissector table as the HTTP protocol. This is - * not true for the integer representation of the WSP media types. */ + * uses the same string dissector table as the HTTP protocol. */ dissector_add_string("media_type", - "application/vnd.wap.mms-message", - mmse_handle); + "application/vnd.wap.mms-message", mmse_handle); } diff --git a/packet-wbxml.c b/packet-wbxml.c index cbbe964653..8d72aaa6b1 100644 --- a/packet-wbxml.c +++ b/packet-wbxml.c @@ -2,7 +2,7 @@ * Routines for wbxml dissection * Copyright 2003, Olivier Biot <olivier.biot (ad) siemens.com> * - * $Id: packet-wbxml.c,v 1.17 2003/12/07 18:09:52 obiot Exp $ + * $Id: packet-wbxml.c,v 1.18 2003/12/08 20:37:15 obiot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -3750,101 +3750,48 @@ proto_reg_handoff_wbxml(void) * See http://www.wapforum.org/wina/wsp-content-type.htm * * As the media types for WSP and HTTP are the same, the WSP dissector - * uses the same string dissector table as the HTTP protocol. This is - * not true for the integer representation of the WSP media types. + * uses the same string dissector table as the HTTP protocol. */ /**** Well-known WBXML WSP Content-Type values ****/ - /* application/vnd.wap.wmlc */ - dissector_add("wsp.content_type.integer", 0x14, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.wmlc", wbxml_handle); - - /* application/vnd.wap.wta-eventc */ - dissector_add("wsp.content_type.integer", 0x16, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.wta-eventc", wbxml_handle); - - /* application/vnd.wap.wbxml */ - dissector_add("wsp.content_type.integer", 0x29, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.wbxml", wbxml_handle); - - /* application/vnd.wap.sic */ - dissector_add("wsp.content_type.integer", 0x2E, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.sic", wbxml_handle); - - /* application/vnd.wap.slc */ - dissector_add("wsp.content_type.integer", 0x30, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.slc", wbxml_handle); - - /* application/vnd.wap.coc */ - dissector_add("wsp.content_type.integer", 0x32, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.coc", wbxml_handle); - - /* application/vnd.wap.connectivity-wbxml */ - dissector_add("wsp.content_type.integer", 0x36, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.connectivity-wbxml", wbxml_handle); - - /* application/vnd.wap.locc+wbxml */ - dissector_add("wsp.content_type.integer", 0x40, wbxml_handle); dissector_add_string("media_type", "application/vnd.wap.locc+wbxml", wbxml_handle); - - /* application/vnd.syncml.dm+wbxml */ - dissector_add("wsp.content_type.integer", 0x42, wbxml_handle); dissector_add_string("media_type", "application/vnd.syncml.dm+wbxml", wbxml_handle); - - /* application/vnd.oma.drm.rights+wbxml */ - dissector_add("wsp.content_type.integer", 0x4B, wbxml_handle); dissector_add_string("media_type", "application/vnd.oma.drm.rights+wbxml", wbxml_handle); /**** Registered WBXML WSP Content-Type values ****/ - /* application/vnd.uplanet.cacheop-wbxml */ - dissector_add("wsp.content_type.integer", 0x0201, wbxml_handle); dissector_add_string("media_type", "application/vnd.uplanet.cacheop-wbxml", wbxml_handle); - - /* application/vnd.uplanet.alert-wbxml */ - dissector_add("wsp.content_type.integer", 0x0203, wbxml_handle); dissector_add_string("media_type", "application/vnd.uplanet.alert-wbxml", wbxml_handle); - - /* application/vnd.uplanet.list-wbxml */ - dissector_add("wsp.content_type.integer", 0x0204, wbxml_handle); dissector_add_string("media_type", "application/vnd.uplanet.list-wbxml", wbxml_handle); - - /* application/vnd.uplanet.listcmd-wbxml */ - dissector_add("wsp.content_type.integer", 0x0205, wbxml_handle); dissector_add_string("media_type", "application/vnd.uplanet.listcmd-wbxml", wbxml_handle); - - /* application/vnd.uplanet.channel-wbxml */ - dissector_add("wsp.content_type.integer", 0x0206, wbxml_handle); dissector_add_string("media_type", "application/vnd.uplanet.channel-wbxml", wbxml_handle); - - /* application/vnd.uplanet.bearer-choice-wbxml */ - dissector_add("wsp.content_type.integer", 0x0209, wbxml_handle); dissector_add_string("media_type", "application/vnd.uplanet.bearer-choice-wbxml", wbxml_handle); - - /* application/vnd.phonecom.mmc-wbxml */ - dissector_add("wsp.content_type.integer", 0x020A, wbxml_handle); dissector_add_string("media_type", "application/vnd.phonecom.mmc-wbxml", wbxml_handle); - - /* application/vnd.nokia.syncset+wbxml */ - dissector_add("wsp.content_type.integer", 0x020B, wbxml_handle); dissector_add_string("media_type", "application/vnd.nokia.syncset+wbxml", wbxml_handle); diff --git a/packet-wsp.c b/packet-wsp.c index c92d60be65..8af1493908 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.93 2003/12/07 18:09:52 obiot Exp $ + * $Id: packet-wsp.c,v 1.94 2003/12/08 20:37:14 obiot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -300,9 +300,6 @@ static dissector_handle_t wsp_fromudp_handle; /* Handle for WTP-over-UDP dissector */ static dissector_handle_t wtp_fromudp_handle; -/* Handle for WBXML dissector */ -static dissector_handle_t wbxml_handle; - const value_string vals_pdu_type[] = { { 0x00, "Reserved" }, { 0x01, "Connect" }, @@ -1154,8 +1151,8 @@ typedef enum { VALUE_IN_LEN, } value_type_t; -static dissector_table_t wsp_dissector_table; -static dissector_table_t wsp_dissector_table_text; +/* Dissector tables for handoff */ +static dissector_table_t media_type_table; static heur_dissector_list_t heur_subdissector_list; static void add_uri (proto_tree *, packet_info *, tvbuff_t *, guint, guint); @@ -2055,10 +2052,11 @@ add_content_type(proto_tree *tree, tvbuff_t *tvb, guint32 val_start, *well_known_content = 0; wkh_1_WellKnownValue; + *textual_content = val_to_str(val, vals_content_types, + "<Unknown media type identifier 0x%X>"); ti = proto_tree_add_string(tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, - val_to_str(val_id & 0x7F, vals_content_types, - "<Unknown content type identifier 0x%X>")); + *textual_content); *well_known_content = val_id & 0x7F; ok = TRUE; wkh_2_TextualValue; @@ -2074,7 +2072,7 @@ add_content_type(proto_tree *tree, tvbuff_t *tvb, guint32 val_start, } else { ti = proto_tree_add_string(tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, - "<no content type has been specified>"); + "<no media type has been specified>"); *textual_content = NULL; *well_known_content = 0; } @@ -2095,11 +2093,11 @@ add_content_type(proto_tree *tree, tvbuff_t *tvb, guint32 val_start, } else if (is_integer_value(peek)) { get_integer_value(val, tvb, off, len, ok); if (ok) { + *textual_content = val_to_str(val, vals_content_types, + "<Unknown media type identifier 0x%X>"); ti = proto_tree_add_string(tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, - val_to_str(val, vals_content_types, - "<Unknown content type identifier 0x%X>")); - *textual_content = NULL; + *textual_content); *well_known_content = val; } off += len; @@ -4567,17 +4565,12 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Try finding a dissector for the content * first, then fallback. */ - if (contentTypeStr == NULL) { - /* - * Content type is numeric. - */ - found_match = dissector_try_port(wsp_dissector_table, - contentType, tmp_tvb, pinfo, tree); - } else { + found_match = FALSE; + if (contentTypeStr) { /* * Content type is a string. */ - found_match = dissector_try_string(wsp_dissector_table_text, + found_match = dissector_try_string(media_type_table, contentTypeStr, tmp_tvb, pinfo, tree); } if (! found_match) { @@ -4642,22 +4635,17 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Try finding a dissector for the content * first, then fallback. */ - if (contentTypeStr == NULL) { - /* - * Content type is numeric. - */ - found_match = dissector_try_port(wsp_dissector_table, - contentType, tmp_tvb, pinfo, tree); - } else { + found_match = FALSE; + if (contentTypeStr) { /* * Content type is a string. */ - found_match = dissector_try_string(wsp_dissector_table_text, + found_match = dissector_try_string(media_type_table, contentTypeStr, tmp_tvb, pinfo, tree); } if (! found_match) { if (! dissector_try_heuristic(heur_subdissector_list, - tmp_tvb, pinfo, tree)) + tmp_tvb, pinfo, tree)) if (tree) /* Only display if needed */ ti = proto_tree_add_item (wsp_tree, hf_wsp_reply_data, @@ -4708,17 +4696,12 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Try finding a dissector for the content * first, then fallback. */ - if (contentTypeStr == NULL) { - /* - * Content type is numeric. - */ - found_match = dissector_try_port(wsp_dissector_table, - contentType, tmp_tvb, pinfo, tree); - } else { + found_match = FALSE; + if (contentTypeStr) { /* * Content type is a string. */ - found_match = dissector_try_string(wsp_dissector_table_text, + found_match = dissector_try_string(media_type_table, contentTypeStr, tmp_tvb, pinfo, tree); } if (! found_match) { @@ -6504,14 +6487,9 @@ proto_register_wsp(void) register_dissector("wsp-co", dissect_wsp_fromwap_co, proto_wsp); register_dissector("wsp-cl", dissect_wsp_fromwap_cl, proto_wsp); - wsp_dissector_table = register_dissector_table( - "wsp.content_type.integer", - "WSP content type (well-known integer value)", - FT_UINT32, BASE_HEX); /* As the media types for WSP and HTTP are the same, the WSP dissector - * uses the same string dissector table as the HTTP protocol. This is - * not true for the integer representation of the WSP media types. */ - wsp_dissector_table_text = find_dissector_table("media_type"); + * uses the same string dissector table as the HTTP protocol. */ + media_type_table = find_dissector_table("media_type"); register_heur_dissector_list("wsp", &heur_subdissector_list); wsp_fromudp_handle = create_dissector_handle(dissect_wsp_fromudp, @@ -6522,11 +6500,6 @@ void proto_reg_handoff_wsp(void) { /* - * Get a handle for the WBXML dissector. - */ - wbxml_handle = find_dissector("wbxml"); - - /* * And get a handle for the WTP-over-UDP dissector. */ wtp_fromudp_handle = find_dissector("wtp-udp"); |