#include "packet-wap.h"
#include "packet-wsp.h"
/* #include "packet-mmse.h" */ /* We autoregister */
-#include <epan/emem.h>
#define MM_QUOTE 0x7F /* Quoted string */
#define DebugLog(x) ;
#endif
-
/*
* Forward declarations
*/
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, const char *message_type);
* Header field values
*/
/* MMS 1.0 */
-#define MM_BCC_HDR 0x81 /* Bcc */
-#define MM_CC_HDR 0x82 /* Cc */
+#define MM_BCC_HDR 0x81 /* Bcc */
+#define MM_CC_HDR 0x82 /* Cc */
#define MM_CLOCATION_HDR 0x83 /* X-Mms-Content-Location */
-#define MM_CTYPE_HDR 0x84 /* Content-Type */
+#define MM_CTYPE_HDR 0x84 /* Content-Type */
#define MM_DATE_HDR 0x85 /* Date */
#define MM_DREPORT_HDR 0x86 /* X-Mms-Delivery-Report */
#define MM_DTIME_HDR 0x87 /* X-Mms-Delivery-Time */
{ MM_PREV_SENT_DATE_HDR, "X-Mms-Previously-Sent-Date" },
/* MMS 1.2 */
{ MM_STORE_HDR, "X-Mms-Store" },
- { MM_MM_STATE_HDR, "X-Mms-MM-State " },
- { MM_MM_FLAGS_HDR, "X-Mms-MM-Flags " },
+ { MM_MM_STATE_HDR, "X-Mms-MM-State" },
+ { MM_MM_FLAGS_HDR, "X-Mms-MM-Flags" },
{ MM_STORE_STATUS_HDR, "X-Mms-Store-Status" },
{ MM_STORE_STATUS_TEXT_HDR, "X-Mms-Store-Status-Text" },
{ MM_STORED_HDR, "X-Mms-Stored" },
{ 0xE9, "Permanent: Reply charging not supported" },
/* MMS 1.2 */
{ 0xEA, "Permanent: Address hiding not supported" },
-
+
{ 0x00, NULL },
};
{ 0x86, "Forwarded" },
/* MMS 1.2 */
{ 0x87, "Unreachable" },
-
+
{ 0x00, NULL },
};
* \return The length in bytes of the entire field
*/
static guint
-get_text_string(tvbuff_t *tvb, guint offset, char **strval)
+get_text_string(tvbuff_t *tvb, guint offset, const char **strval)
{
guint len;
- DebugLog(("get_text_string(tvb = %p, offset = %u, **strval) - start\n",
+ DebugLog(("get_text_string(tvb = %p, offset = %u, **strval) - start\n",
tvb, offset));
len = tvb_strsize(tvb, offset);
DebugLog((" [1] tvb_strsize(tvb, offset) == %u\n", len));
if (tvb_get_guint8(tvb, offset) == MM_QUOTE)
- *strval = (char *)tvb_memcpy(tvb, ep_alloc(len-1), offset+1, len-1);
+ *strval = ep_tvb_memdup(tvb, offset+1, len-1);
else
- *strval = (char *)tvb_memcpy(tvb, ep_alloc(len), offset, len);
+ *strval = ep_tvb_memdup(tvb, offset, len);
DebugLog((" [3] Return(len) == %u\n", len));
return len;
}
* \return The length in bytes of the entire field
*/
static guint
-get_encoded_strval(tvbuff_t *tvb, guint offset, char **strval)
+get_encoded_strval(tvbuff_t *tvb, guint offset, const char **strval)
{
guint field;
guint length;
message_type = val_to_str(pdut, vals_message_type, "Unknown type %u");
/* Make entries in Protocol column and Info column on summary display */
- if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "MMSE");
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MMSE");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_clear(pinfo->cinfo, COL_INFO);
{
guint offset;
guint8 field = 0;
- char *strval;
+ const char *strval;
guint length;
guint count;
guint8 version = 0x80; /* Default to MMSE 1.0 */
* columns must be set appropriately too.
* If tree != NULL then we also want to display the protocol tree
* with its fields.
- *
+ *
* In the interest of speed, skip protocol tree item generation
* if tree is NULL.
*/
if (tree) {
DebugLog(("tree != NULL\n"));
- ti = proto_tree_add_item(tree, proto_mmse, tvb, 0, -1, FALSE);
+ ti = proto_tree_add_item(tree, proto_mmse, tvb, 0, -1, ENC_NA);
proto_item_append_text(ti, ", Type: %s", message_type);
/* create display subtree for the protocol */
mmse_tree = proto_item_add_subtree(ti, ett_mmse);
version = tvb_get_guint8(tvb, offset++);
if (tree) {
guint8 major, minor;
+ char *vers_string;
major = (version & 0x70) >> 4;
minor = version & 0x0F;
if (minor == 0x0F)
- strval = g_strdup_printf("%u", major);
+ vers_string = g_strdup_printf("%u", major);
else
- strval = g_strdup_printf("%u.%u", major, minor);
+ vers_string = g_strdup_printf("%u.%u", major, minor);
proto_tree_add_string(mmse_tree, hf_mmse_mms_version,
- tvb, offset - 2, 2, strval);
- g_free(strval);
+ tvb, offset - 2, 2, vers_string);
+ g_free(vers_string);
}
break;
case MM_BCC_HDR: /* Encoded-string-value */
/* Value-length Integer-value Encoded-string-value */
length = get_value_length(tvb, offset, &count);
if (tree) {
- guint32 fwd_count, count1, count2;
+ guint32 fwd_count, count1, count2;
proto_tree *subtree = NULL;
- proto_item *ti = NULL;
+ proto_item *tii = NULL;
/* 1. Forwarded-count-value := Integer-value */
fwd_count = get_integer_value(tvb, offset + count,
&count1);
count2 = get_encoded_strval(tvb,
offset + count + count1, &strval);
/* Now render the fields */
- ti = proto_tree_add_string_format(mmse_tree,
+ tii = proto_tree_add_string_format(mmse_tree,
hf_mmse_prev_sent_by,
tvb, offset - 1, 1 + count + length,
strval, "%s (Forwarded-count=%u)",
format_text(strval, strlen(strval)),
fwd_count);
- subtree = proto_item_add_subtree(ti,
+ subtree = proto_item_add_subtree(tii,
ett_mmse_hdr_details);
proto_tree_add_uint(subtree,
hf_mmse_prev_sent_by_fwd_count,
/* Value-Length Forwarded-count-value Date-value */
length = get_value_length(tvb, offset, &count);
if (tree) {
- guint32 fwd_count, count1, count2;
+ guint32 fwd_count, count1, count2;
guint tval;
nstime_t tmptime;
proto_tree *subtree = NULL;
- proto_item *ti = NULL;
+ proto_item *tii = NULL;
/* 1. Forwarded-count-value := Integer-value */
fwd_count = get_integer_value(tvb, offset + count,
&count1);
&count2);
tmptime.secs = tval;
tmptime.nsecs = 0;
- strval = abs_time_to_str(&tmptime);
+ strval = abs_time_to_str(&tmptime, ABSOLUTE_TIME_LOCAL,
+ TRUE);
/* Now render the fields */
tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1);
- ti = proto_tree_add_string_format(mmse_tree,
+ tii = proto_tree_add_string_format(mmse_tree,
hf_mmse_prev_sent_date,
tvb, offset - 1, 1 + count + length,
strval, "%s (Forwarded-count=%u)",
format_text(strval, strlen(strval)),
fwd_count);
- subtree = proto_item_add_subtree(ti,
+ subtree = proto_item_add_subtree(tii,
ett_mmse_hdr_details);
proto_tree_add_uint(subtree,
hf_mmse_prev_sent_date_fwd_count,
}
offset += length;
} else { /* Literal WSP header encoding */
- guint length2;
- char *strval2;
+ guint length2;
+ const char *strval2;
--offset;
length = get_text_string(tvb, offset, &strval);
proto_tree_add_string_format(mmse_tree,
hf_mmse_ffheader, tvb, offset,
length + length2,
- (const char *) tvb_get_ptr(
- tvb, offset, length + length2),
+ tvb_get_ephemeral_string(tvb, offset,
+ length + length2),
"%s: %s",
format_text(strval, strlen(strval)),
format_text(strval2, strlen(strval2)));
DebugLog(("Calling add_content_type() in WSP dissector\n"));
offset = add_content_type(mmse_tree, tvb, offset, &type, &type_str);
DebugLog(("Generating new TVB subset (offset = %u)\n", offset));
- tmp_tvb = tvb_new_subset(tvb, offset, -1, -1);
+ tmp_tvb = tvb_new_subset_remaining(tvb, offset);
DebugLog(("Add POST data\n"));
add_post_data(mmse_tree, tmp_tvb, type, type_str, pinfo);
DebugLog(("Done!\n"));
{ &hf_mmse_transaction_id,
{ "X-Mms-Transaction-ID", "mmse.transaction_id",
FT_STRING, BASE_NONE, NULL, 0x00,
- "A unique identifier for this transaction. "
- "Identifies request and corresponding response only.",
+ "A unique identifier for this transaction. Identifies request and corresponding response only.",
HFILL
}
},
},
{ &hf_mmse_date,
{ "Date", "mmse.date",
- FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00,
"Arrival timestamp of the message or sending timestamp.",
HFILL
}
},
{ &hf_mmse_delivery_time_abs,
{ "X-Mms-Delivery-Time", "mmse.delivery_time.abs",
- FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00,
"The time at which message delivery is desired.",
HFILL
}
},
{ &hf_mmse_expiry_abs,
{ "X-Mms-Expiry", "mmse.expiry.abs",
- FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00,
"Time when message expires and need not be delivered anymore.",
HFILL
}
},
{ &hf_mmse_reply_charging_deadline_abs,
{ "X-Mms-Reply-Charging-Deadline", "mmse.reply_charging_deadline.abs",
- FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00,
"The latest time of the recipient(s) to submit the Reply MM.",
HFILL
}