Ethereal-dev: [Ethereal-dev] Another MMSE dissector patch...

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Martin Gignac <lmcgign@xxxxxxxxxxxxxxx>
Date: Wed, 5 Jun 2002 19:46:58 -0400 (EDT)
Hi,

Here's a small patch that lets the MMSE dissector properly recognize
M-Delivery.ind packets as well as M-Retrieve.conf packets that do not
contain a Transaction-Id header.

The original dissector expected the Transaction-Id after the Message-Type
header to properly recognize an MMS packet. According to the spec, the
Transaction-Id is not mandatory in an M-Retrieve.conf packet nor is it
even used in an M-Delivery.ind packet. Since the MMS-Version header
immediately follows the Message-Type if a Transaction-Id header is not
present, the dissector now checks for the presence of either headers to
recognize an MMS packet.

I'm not a C programmer (I only know BASIC... from decades ago), so the
suggested patch might definitely not be the best or most efficient way to
achieve this (but it was the only way I knew of) so you might want to
optimize the expression's evaluation if it's possible...

Regards,
-martin
--- packet-mmse.c.orig	Wed Jun  5 19:27:16 2002
+++ packet-mmse.c	Wed Jun  5 19:31:58 2002
@@ -332,14 +332,16 @@
 
     /*
      * Check if data makes sense for it to be dissected as MMSE:  Message-type
-     * field must make sense and followed by Transaction-Id header
+     * field must make sense and followed by either Transaction-Id
+     * or MMS-Version header
      */
     if (tvb_get_guint8(tvb, 0) != MM_MTYPE_HDR)
 	return FALSE;
     pdut = tvb_get_guint8(tvb, 1);
     if (match_strval(pdut, vals_message_type) == NULL)
 	return FALSE;
-    if (tvb_get_guint8(tvb, 2) != MM_TID_HDR)
+    if ((tvb_get_guint8(tvb, 2) != MM_TID_HDR) &&
+	(tvb_get_guint8(tvb, 2) != MM_VERSION_HDR))
 	return FALSE;
     dissect_mmse(tvb, pinfo, tree);
     return TRUE;