From Michel Marti:
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 30 Nov 2006 07:12:59 +0000 (07:12 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 30 Nov 2006 07:12:59 +0000 (07:12 +0000)
The attached patch fixes decoding of the "X-Mms-Reply-Charging-Deadline" header.
According to the OMA-TS-MMS-ENC specs, this header is encoded like this:
  Reply-charging-deadline-value = Value-length \
    (Absolute-token Date-value | Relative-token Delta-seconds-value)

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20019 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-mmse.c

index d0581574818a29f00f8d478058f38a8212922588..03a7b6eecc799ac84e88ac9b3c7312ea9f4f0f99 100644 (file)
@@ -237,7 +237,8 @@ static int hf_mmse_retrieve_status  = -1;
 static int hf_mmse_retrieve_text       = -1;
 static int hf_mmse_read_status         = -1;
 static int hf_mmse_reply_charging      = -1;
 static int hf_mmse_retrieve_text       = -1;
 static int hf_mmse_read_status         = -1;
 static int hf_mmse_reply_charging      = -1;
-static int hf_mmse_reply_charging_deadline     = -1;
+static int hf_mmse_reply_charging_deadline_abs = -1;
+static int hf_mmse_reply_charging_deadline_rel = -1;
 static int hf_mmse_reply_charging_id   = -1;
 static int hf_mmse_reply_charging_size = -1;
 static int hf_mmse_prev_sent_by        = -1;
 static int hf_mmse_reply_charging_id   = -1;
 static int hf_mmse_reply_charging_size = -1;
 static int hf_mmse_prev_sent_by        = -1;
@@ -439,13 +440,6 @@ static const value_string vals_reply_charging[] = {
     { 0x00, NULL },
 };
 
     { 0x00, NULL },
 };
 
-static const value_string vals_reply_charging_deadline[] = {
-    { 0x80, "Absolute" },
-    { 0x81, "Relative" },
-
-    { 0x00, NULL },
-};
-
 /*!
  * Decodes a Text-string from the protocol data
  *     Text-string = [Quote] *TEXT End-of-string
 /*!
  * Decodes a Text-string from the protocol data
  *     Text-string = [Quote] *TEXT End-of-string
@@ -1123,12 +1117,32 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut,
                    }
                    break;
                case MM_REPLY_CHARGING_DEADLINE_HDR:    /* Well-known-value */
                    }
                    break;
                case MM_REPLY_CHARGING_DEADLINE_HDR:    /* Well-known-value */
-                   field = tvb_get_guint8(tvb, offset++);
+                   /*
+                    * Value-length(Absolute-token Date-value|
+                    *              Relative-token Delta-seconds-value)
+                    */
+                   length = get_value_length(tvb, offset, &count);
+                   field = tvb_get_guint8(tvb, offset + count);
                    if (tree) {
                    if (tree) {
-                       proto_tree_add_uint(mmse_tree,
-                               hf_mmse_reply_charging_deadline,
-                               tvb, offset - 2, 2, field);
+                       guint            tval;
+                       nstime_t         tmptime;
+                       guint            cnt;
+
+                       tval = get_long_integer(tvb, offset + count + 1, &cnt);
+                       tmptime.secs = tval;
+                       tmptime.nsecs = 0;
+
+                       tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1);
+                       if (field == 0x80)
+                           proto_tree_add_time(mmse_tree, hf_mmse_reply_charging_deadline_abs,
+                                   tvb, offset - 1,
+                                   length + count + 1, &tmptime);
+                       else
+                           proto_tree_add_time(mmse_tree, hf_mmse_reply_charging_deadline_rel,
+                                   tvb, offset - 1,
+                                   length + count + 1, &tmptime);
                    }
                    }
+                   offset += length + count;
                    break;
                case MM_REPLY_CHARGING_ID_HDR:  /* Text-string */
                    length = get_text_string(tvb, offset, &strval);
                    break;
                case MM_REPLY_CHARGING_ID_HDR:  /* Text-string */
                    length = get_text_string(tvb, offset, &strval);
@@ -1558,10 +1572,17 @@ proto_register_mmse(void)
                HFILL
            }
        },
                HFILL
            }
        },
-       {   &hf_mmse_reply_charging_deadline,
-           {   "X-Mms-Reply-Charging-Deadline", "mmse.reply_charging_deadline",
-               FT_UINT8, BASE_HEX, VALS(vals_reply_charging_deadline), 0x00,
-               "MMS-specific message reply charging deadline type.",
+       {   &hf_mmse_reply_charging_deadline_abs,
+           {   "X-Mms-Reply-Charging-Deadline", "mmse.reply_charging_deadline.abs",
+               FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
+               "The latest time of the recipient(s) to submit the Reply MM.",
+               HFILL
+           }
+       },
+       {   &hf_mmse_reply_charging_deadline_rel,
+           {   "X-Mms-Reply-Charging-Deadline", "mmse.reply_charging_deadline.rel",
+               FT_RELATIVE_TIME, BASE_NONE, NULL, 0x00,
+               "The latest time of the recipient(s) to submit the Reply MM.",
                HFILL
            }
        },
                HFILL
            }
        },