From e412fb51ae52b4210c6f3a3ae0a652b29ee27add Mon Sep 17 00:00:00 2001 From: jake Date: Thu, 30 Nov 2006 07:12:59 +0000 Subject: [PATCH] From Michel Marti: 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 | 53 ++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index d058157481..03a7b6eecc 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -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_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; @@ -439,13 +440,6 @@ static const value_string vals_reply_charging[] = { { 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 @@ -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 */ - 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) { - 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); @@ -1558,10 +1572,17 @@ proto_register_mmse(void) 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 } }, -- 2.25.1