diff options
author | Michael Mann <mmann78@netscape.net> | 2014-08-13 08:56:22 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-14 04:21:05 +0000 |
commit | d68d0e88b4924a610b5cd2fd3a748b00c9bbab1a (patch) | |
tree | f46c04238502faa689c173f1b8420c8d19d3c51e /epan/dissectors/packet-mmse.c | |
parent | f64421df3f230e89e0d83e327926f4c46fbd70dc (diff) |
Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the neighborhood.
Change-Id: If73a029f564219782c313d4154c24c7ce7458b52
Reviewed-on: https://code.wireshark.org/review/3574
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-mmse.c')
-rw-r--r-- | epan/dissectors/packet-mmse.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index eef33948ae..306c5078c1 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -242,6 +242,9 @@ static int hf_mmse_prev_sent_by_address = -1; static int hf_mmse_prev_sent_date = -1; static int hf_mmse_prev_sent_date_fwd_count = -1; static int hf_mmse_prev_sent_date_date = -1; +static int hf_mmse_header_uint = -1; +static int hf_mmse_header_string = -1; +static int hf_mmse_header_bytes = -1; /* * Initialize the subtree pointers @@ -1228,14 +1231,15 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, guint8 peek = tvb_get_guint8(tvb, offset); const char *hdr_name = val_to_str(field, vals_mm_header_names, "Unknown field (0x%02x)"); + const char *str; DebugLog(("\t\tUndecoded well-known header: %s\n", hdr_name)); if (peek & 0x80) { /* Well-known value */ length = 1; if (tree) { - proto_tree_add_text(mmse_tree, tvb, offset - 1, - length + 1, + proto_tree_add_uint_format(mmse_tree, hf_mmse_header_uint, tvb, offset - 1, + length + 1, peek, "%s: <Well-known value 0x%02x>" " (not decoded)", hdr_name, peek); @@ -1243,10 +1247,9 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, } else if ((peek == 0) || (peek >= 0x20)) { /* Text */ length = get_text_string(tvb, offset, &strval); if (tree) { - proto_tree_add_text(mmse_tree, tvb, offset - 1, - length + 1, "%s: %s (Not decoded)", - hdr_name, - format_text(strval, strlen(strval))); + str = format_text(strval, strlen(strval)); + proto_tree_add_string_format(mmse_tree, hf_mmse_header_string, tvb, offset - 1, + length + 1, str, "%s: %s (Not decoded)", hdr_name, str); } } else { /* General form with length */ if (peek == 0x1F) { /* Value length in guintvar */ @@ -1258,8 +1261,8 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, length = 1 + tvb_get_guint8(tvb, offset); } if (tree) { - proto_tree_add_text(mmse_tree, tvb, offset - 1, - length + 1, "%s: " + proto_tree_add_bytes_format(mmse_tree, hf_mmse_header_bytes, tvb, offset - 1, + length + 1, NULL, "%s: " "<Value in general form> (not decoded)", hdr_name); } @@ -1633,7 +1636,21 @@ proto_register_mmse(void) HFILL } }, - + { &hf_mmse_header_uint, + { "Header Uint Value", "mmse.previously_sent_date.date", + FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL + } + }, + { &hf_mmse_header_string, + { "Header String Value", "mmse.header.string", + FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL + } + }, + { &hf_mmse_header_bytes, + { "Header Byte array", "mmse.header.bytes", + FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL + } + }, }; |