summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Biot <obiot.ethereal@gmail.com>2004-02-06 01:07:51 +0000
committerOlivier Biot <obiot.ethereal@gmail.com>2004-02-06 01:07:51 +0000
commitca5a28560dd568d44c8b1c071f8d6ea077f32e51 (patch)
treefdd313499fcf5b7fec0517420fca63e705b23d4b
parentf3a4c61c9333aa0e5390f16eb3b6762d19d8b1f5 (diff)
downloadwireshark-ca5a28560dd568d44c8b1c071f8d6ea077f32e51.tar.gz
Add a new dissector table for multipart media encpsulation (similar to the
"media_type" dissector table defined in the HTTP dissector), allowing us to make the distinction between dissecting a standaone media type and an encapsulated media type (e.g., encapsulated in a multipart entity). Provide separate dissectors for "standalone" and "encapsulated" MMSE, hence fixing the needlessly clearing of the Info column when the MMSE is only part of the encapsulated entity (e.g., in the PAP protocol for WAP Push). svn path=/trunk/; revision=9988
-rw-r--r--packet-mmse.c82
-rwxr-xr-xpacket-multipart.c28
2 files changed, 88 insertions, 22 deletions
diff --git a/packet-mmse.c b/packet-mmse.c
index 6adf938a16..a1c6954080 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.31 2004/01/17 00:45:02 obiot Exp $
+ * $Id: packet-mmse.c,v 1.32 2004/02/06 01:07:51 obiot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -67,7 +67,10 @@
/*
* Forward declarations
*/
-static void dissect_mmse(tvbuff_t *, packet_info *, proto_tree *);
+static void dissect_mmse_standalone(tvbuff_t *, packet_info *, proto_tree *);
+static void dissect_mmse_encapsulated(tvbuff_t *, packet_info *, proto_tree *);
+static void dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ guint8 pdut, char *message_type);
/*
* Header field values
@@ -397,28 +400,21 @@ dissect_mmse_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if ((tvb_get_guint8(tvb, 2) != MM_TID_HDR) &&
(tvb_get_guint8(tvb, 2) != MM_VERSION_HDR))
return FALSE;
- dissect_mmse(tvb, pinfo, tree);
+ dissect_mmse_standalone(tvb, pinfo, tree);
return TRUE;
}
static void
-dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_mmse_standalone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint8 pdut;
- guint offset;
- guint8 field = 0;
- char *strval;
- guint length;
- guint count;
+ char *message_type;
- /* Set up structures needed to add the protocol subtree and manage it */
- proto_item *ti = NULL;
- proto_tree *mmse_tree = NULL;
-
- DebugLog(("dissect_mmse() - START (Packet %u)\n", pinfo->fd->num));
+ DebugLog(("dissect_mmse_standalone() - START (Packet %u)\n",
+ pinfo->fd->num));
pdut = tvb_get_guint8(tvb, 1);
- strval = match_strval(pdut, vals_message_type);
+ message_type = match_strval(pdut, vals_message_type);
/* Make entries in Protocol column and Info column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@@ -426,9 +422,49 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (check_col(pinfo->cinfo, COL_INFO)) {
col_clear(pinfo->cinfo, COL_INFO);
- col_add_fstr(pinfo->cinfo, COL_INFO, "MMS %s", strval);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "MMS %s", message_type);
+ }
+
+ dissect_mmse(tvb, pinfo, tree, pdut, message_type);
+}
+
+static void
+dissect_mmse_encapsulated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ guint8 pdut;
+ char *message_type;
+
+ DebugLog(("dissect_mmse_encapsulated() - START (Packet %u)\n",
+ pinfo->fd->num));
+
+ pdut = tvb_get_guint8(tvb, 1);
+ message_type = match_strval(pdut, vals_message_type);
+
+ /* Make entries in Info column on summary display */
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "(MMS %s)",
+ message_type);
}
+ dissect_mmse(tvb, pinfo, tree, pdut, message_type);
+}
+
+static void
+dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut,
+ char *message_type)
+{
+ guint offset;
+ guint8 field = 0;
+ char *strval;
+ guint length;
+ guint count;
+
+ /* Set up structures needed to add the protocol subtree and manage it */
+ proto_item *ti = NULL;
+ proto_tree *mmse_tree = NULL;
+
+ DebugLog(("dissect_mmse() - START (Packet %u)\n", pinfo->fd->num));
+
/* If tree == NULL then we are only interested in protocol dissection
* up to reassembly and handoff to subdissectors if applicable; the
* columns must be set appropriately too.
@@ -442,7 +478,7 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
DebugLog(("tree != NULL\n"));
ti = proto_tree_add_item(tree, proto_mmse, tvb, 0, -1, FALSE);
- proto_item_append_text(ti, ", Type: %s", strval);
+ proto_item_append_text(ti, ", Type: %s", message_type);
/* create display subtree for the protocol */
mmse_tree = proto_item_add_subtree(ti, ett_mmse);
@@ -1020,12 +1056,18 @@ proto_register_mmse(void)
void
proto_reg_handoff_mmse(void)
{
- dissector_handle_t mmse_handle;
+ dissector_handle_t mmse_standalone_handle;
+ dissector_handle_t mmse_encapsulated_handle;
heur_dissector_add("wsp", dissect_mmse_heur, proto_mmse);
- mmse_handle = create_dissector_handle(dissect_mmse, proto_mmse);
+ mmse_standalone_handle = create_dissector_handle(
+ dissect_mmse_standalone, proto_mmse);
+ mmse_encapsulated_handle = create_dissector_handle(
+ dissect_mmse_encapsulated, proto_mmse);
/* As the media types for WSP and HTTP are the same, the WSP dissector
* 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_standalone_handle);
+ dissector_add_string("multipart_media_type",
+ "application/vnd.wap.mms-message", mmse_encapsulated_handle);
}
diff --git a/packet-multipart.c b/packet-multipart.c
index 7f561da500..75de2696ba 100755
--- a/packet-multipart.c
+++ b/packet-multipart.c
@@ -3,7 +3,7 @@
* Copyright 2004, Anders Broman <anders.broman[at]ericsson.com>
* Copyright 2004, Olivier Biot <olivier.biot[at]siemens.com>
*
- * $Id: packet-multipart.c,v 1.5 2004/01/22 23:47:59 obiot Exp $
+ * $Id: packet-multipart.c,v 1.6 2004/02/06 01:07:51 obiot Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -70,6 +70,9 @@
#include <epan/packet.h>
+/* Dissector table for media requiring special attention in multipart
+ * encapsulation. */
+static dissector_table_t multipart_media_subdissector_table;
/* Initialize the protocol and registered fields */
static int proto_multipart = -1;
@@ -633,8 +636,18 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary,
gboolean dissected;
pinfo->private_data = parameters;
- dissected = dissector_try_string(media_type_dissector_table,
+ /*
+ * First try the dedicated multipart dissector table
+ */
+ dissected = dissector_try_string(multipart_media_subdissector_table,
+ content_type_str, tmp_tvb, pinfo, subtree);
+ if (! dissected) {
+ /*
+ * Fall back to the default media dissector table
+ */
+ dissected = dissector_try_string(media_type_dissector_table,
content_type_str, tmp_tvb, pinfo, subtree);
+ }
pinfo->private_data = save_private_data;
g_free(content_type_str);
content_type_str = NULL;
@@ -868,6 +881,17 @@ proto_register_multipart(void)
"Display multipart bodies with no media type dissector"
" as raw text (may cause problems with binary data).",
&display_unknown_body_as_text);
+
+ /*
+ * Dissectors requiring different behavior in cases where the media
+ * is contained in a multipart entity should register their multipart
+ * dissector in the dissector table below, which is similar to the
+ * "media_type" dissector table defined in the HTTP dissector code.
+ */
+ multipart_media_subdissector_table = register_dissector_table(
+ "multipart_media_type",
+ "Internet media type (for multipart processing)",
+ FT_STRING, BASE_NONE);
}