From Tom Uijldert: modify MMSE dissector to also accept content that is

not multipart.

Replace my fix to create subtrees for POST data with Tom's.

svn path=/trunk/; revision=5968
This commit is contained in:
Guy Harris 2002-08-07 08:34:55 +00:00
parent 1c7b05f665
commit 48dbb301c8
3 changed files with 21 additions and 20 deletions

View File

@ -2,7 +2,7 @@
* Routines for MMS Message Encapsulation dissection * Routines for MMS Message Encapsulation dissection
* Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl> * Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl>
* *
* $Id: packet-mmse.c,v 1.15 2002/08/05 08:37:45 guy Exp $ * $Id: packet-mmse.c,v 1.16 2002/08/07 08:34:55 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -613,8 +613,7 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (field == MM_CTYPE_HDR) { if (field == MM_CTYPE_HDR) {
/* /*
* Eeehh, we're now actually back to good old WSP content-type * Eeehh, we're now actually back to good old WSP content-type
* encoding for multipart/related and multipart/mixed MIME-types. * encoding. Let's steal that from the WSP-dissector.
* Let's steal that from the WSP-dissector.
*/ */
tvbuff_t *tmp_tvb; tvbuff_t *tmp_tvb;
guint type; guint type;
@ -622,7 +621,7 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = add_content_type(mmse_tree, tvb, offset, &type, &type_str); offset = add_content_type(mmse_tree, tvb, offset, &type, &type_str);
tmp_tvb = tvb_new_subset(tvb, offset, -1, -1); tmp_tvb = tvb_new_subset(tvb, offset, -1, -1);
add_multipart_data(mmse_tree, tmp_tvb); add_post_data(mmse_tree, tmp_tvb, type, type_str);
} }
} }

View File

@ -2,7 +2,7 @@
* *
* Routines to dissect WSP component of WAP traffic. * Routines to dissect WSP component of WAP traffic.
* *
* $Id: packet-wsp.c,v 1.60 2002/08/02 23:36:04 jmayer Exp $ * $Id: packet-wsp.c,v 1.61 2002/08/07 08:34:55 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -192,12 +192,12 @@ static gint ett_header_warning = ETT_EMPTY;
static gint ett_header_cache_control_parameters = ETT_EMPTY; static gint ett_header_cache_control_parameters = ETT_EMPTY;
static gint ett_header_cache_control_field_names = ETT_EMPTY; static gint ett_header_cache_control_field_names = ETT_EMPTY;
static gint ett_capabilities = ETT_EMPTY; static gint ett_capabilities = ETT_EMPTY;
static gint ett_post = ETT_EMPTY;
static gint ett_content_type = ETT_EMPTY; static gint ett_content_type = ETT_EMPTY;
static gint ett_redirect_flags = ETT_EMPTY; static gint ett_redirect_flags = ETT_EMPTY;
static gint ett_redirect_afl = ETT_EMPTY; static gint ett_redirect_afl = ETT_EMPTY;
static gint ett_multiparts = ETT_EMPTY; static gint ett_multiparts = ETT_EMPTY;
static gint ett_mpartlist = ETT_EMPTY; static gint ett_mpartlist = ETT_EMPTY;
static gint ett_post_data = ETT_EMPTY;
/* Handle for WSP-over-UDP dissector */ /* Handle for WSP-over-UDP dissector */
static dissector_handle_t wsp_fromudp_handle; static dissector_handle_t wsp_fromudp_handle;
@ -944,8 +944,8 @@ static int add_parameter_charset (proto_tree *, tvbuff_t *, int, int);
static int add_constrained_encoding (proto_tree *, tvbuff_t *, int, int); static int add_constrained_encoding (proto_tree *, tvbuff_t *, int, int);
static int add_parameter_type (proto_tree *, tvbuff_t *, int, int); static int add_parameter_type (proto_tree *, tvbuff_t *, int, int);
static int add_parameter_text (proto_tree *, tvbuff_t *, int, int, int, const char *); static int add_parameter_text (proto_tree *, tvbuff_t *, int, int, int, const char *);
static void add_post_data (proto_tree *, tvbuff_t *, guint, const char *);
static void add_post_variable (proto_tree *, tvbuff_t *, guint, guint, guint, guint); static void add_post_variable (proto_tree *, tvbuff_t *, guint, guint, guint, guint);
static void add_multipart_data (proto_tree *, tvbuff_t *);
static void add_pragma_header (proto_tree *, tvbuff_t *, int, tvbuff_t *, static void add_pragma_header (proto_tree *, tvbuff_t *, int, tvbuff_t *,
value_type_t, int); value_type_t, int);
static void add_transfer_encoding_header (proto_tree *, tvbuff_t *, int, static void add_transfer_encoding_header (proto_tree *, tvbuff_t *, int,
@ -1343,8 +1343,7 @@ dissect_wsp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Runs from start of headers+headerLength to end of frame */ /* Runs from start of headers+headerLength to end of frame */
offset = nextOffset+headerLength; offset = nextOffset+headerLength;
tmp_tvb = tvb_new_subset (tvb, offset, tvb_reported_length (tvb)-offset, tvb_reported_length (tvb)-offset); tmp_tvb = tvb_new_subset (tvb, offset, tvb_reported_length (tvb)-offset, tvb_reported_length (tvb)-offset);
add_post_data (wsp_tree, tmp_tvb, add_post_data (wsp_tree, tmp_tvb, contentType, contentTypeStr);
contentType, contentTypeStr);
} }
if (tvb_reported_length_remaining(tvb, headerStart + count + uriLength + headersLength) > 0) if (tvb_reported_length_remaining(tvb, headerStart + count + uriLength + headersLength) > 0)
{ {
@ -3786,7 +3785,7 @@ add_parameter_text (proto_tree *tree, tvbuff_t *value_buff, int startOffset,
return offset; return offset;
} }
static void void
add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType, add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType,
const char *contentTypeStr) const char *contentTypeStr)
{ {
@ -3797,11 +3796,11 @@ add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType,
guint valueEnd = 0; guint valueEnd = 0;
guint8 peek = 0; guint8 peek = 0;
proto_item *ti; proto_item *ti;
proto_tree *subtree; proto_tree *sub_tree;
/* VERIFY ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,-1,bo_little_endian); */ /* VERIFY ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,-1,bo_little_endian); */
ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,-1,bo_little_endian); ti = proto_tree_add_item (tree, hf_wsp_post_data,tvb,offset,-1,bo_little_endian);
subtree = proto_item_add_subtree(ti, ett_post_data); sub_tree = proto_item_add_subtree(ti, ett_post);
if (contentTypeStr == NULL && contentType == 0x12) if (contentTypeStr == NULL && contentType == 0x12)
{ {
@ -3821,7 +3820,7 @@ add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType,
{ {
if (variableEnd > 0) if (variableEnd > 0)
{ {
add_post_variable (subtree, tvb, variableStart, variableEnd, valueStart, offset); add_post_variable (sub_tree, tvb, variableStart, variableEnd, valueStart, offset);
} }
variableStart = offset+1; variableStart = offset+1;
variableEnd = 0; variableEnd = 0;
@ -3833,13 +3832,13 @@ add_post_data (proto_tree *tree, tvbuff_t *tvb, guint contentType,
/* See if there's outstanding data */ /* See if there's outstanding data */
if (variableEnd > 0) if (variableEnd > 0)
{ {
add_post_variable (subtree, tvb, variableStart, variableEnd, valueStart, offset); add_post_variable (sub_tree, tvb, variableStart, variableEnd, valueStart, offset);
} }
} }
else if ((contentType == 0x22) || (contentType == 0x23) || (contentType == 0x23) || (contentType == 0x24) || else if ((contentType == 0x22) || (contentType == 0x23) || (contentType == 0x23) || (contentType == 0x24) ||
(contentType == 0x25) || (contentType == 0x26) || (contentType == 0x33)) (contentType == 0x25) || (contentType == 0x26) || (contentType == 0x33))
{ {
add_multipart_data(subtree, tvb); add_multipart_data(sub_tree, tvb);
} }
} }
@ -3883,7 +3882,7 @@ add_post_variable (proto_tree *tree, tvbuff_t *tvb, guint variableStart, guint v
g_free (valueBuffer); g_free (valueBuffer);
} }
void static void
add_multipart_data (proto_tree *tree, tvbuff_t *tvb) add_multipart_data (proto_tree *tree, tvbuff_t *tvb)
{ {
int offset = 0; int offset = 0;
@ -4762,7 +4761,7 @@ proto_register_wsp(void)
} }
}, },
{ &hf_wsp_post_data, { &hf_wsp_post_data,
{ "Post Data", { "Data (Post)",
"wsp.post.data", "wsp.post.data",
FT_NONE, BASE_NONE, NULL, 0x00, FT_NONE, BASE_NONE, NULL, 0x00,
"Post Data", HFILL "Post Data", HFILL
@ -4885,12 +4884,12 @@ proto_register_wsp(void)
&ett_header_cache_control_parameters, &ett_header_cache_control_parameters,
&ett_header_cache_control_field_names, &ett_header_cache_control_field_names,
&ett_capabilities, &ett_capabilities,
&ett_post,
&ett_content_type, &ett_content_type,
&ett_redirect_flags, &ett_redirect_flags,
&ett_redirect_afl, &ett_redirect_afl,
&ett_multiparts, &ett_multiparts,
&ett_mpartlist, &ett_mpartlist,
&ett_post_data
}; };
/* Register the protocol name and description */ /* Register the protocol name and description */

View File

@ -2,7 +2,7 @@
* *
* Declarations for disassembly of WSP component of WAP traffic. * Declarations for disassembly of WSP component of WAP traffic.
* *
* $Id: packet-wsp.h,v 1.4 2001/12/07 11:10:53 guy Exp $ * $Id: packet-wsp.h,v 1.5 2002/08/07 08:34:55 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@zing.org>
@ -61,7 +61,10 @@ static const value_string vals_wsp_reason_codes[] = {
{ 0xEE, "Content type cannot be processed" }, { 0xEE, "Content type cannot be processed" },
}; };
void add_multipart_data (proto_tree *, tvbuff_t *); /*
* exported functionality
*/
void add_post_data (proto_tree *, tvbuff_t *, guint, const char *);
guint add_content_type (proto_tree *, tvbuff_t *, guint, guint *, const char **); guint add_content_type (proto_tree *, tvbuff_t *, guint, guint *, const char **);
#endif /* packet-wsp.h */ #endif /* packet-wsp.h */