diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-06 21:32:39 -0400 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-09-07 17:08:29 +0000 |
commit | 2b27d91f2671d9fb9d9f8791e75d83c0cb3b73b2 (patch) | |
tree | f33941c31fdb5d755d6690d4d5d577a92e22fb50 /epan/dissectors/packet-xtp.c | |
parent | f76b4d934662451f05820408b4841d08a2b2d351 (diff) |
Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area.
Change-Id: Id8dab02df6f111c3462238c3de1bf201e037ca48
Reviewed-on: https://code.wireshark.org/review/4022
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: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-xtp.c')
-rw-r--r-- | epan/dissectors/packet-xtp.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/epan/dissectors/packet-xtp.c b/epan/dissectors/packet-xtp.c index 20b7ee2949..da7ceafbaa 100644 --- a/epan/dissectors/packet-xtp.c +++ b/epan/dissectors/packet-xtp.c @@ -304,6 +304,8 @@ static int hf_xtp_btag = -1; static int hf_xtp_diag_code = -1; static int hf_xtp_diag_val = -1; static int hf_xtp_diag_msg = -1; +static int hf_xtp_checksum = -1; +static int hf_xtp_data = -1; /* Initialize the subtree pointers */ static gint ett_xtp = -1; @@ -646,9 +648,7 @@ dissect_xtp_data(tvbuff_t *tvb, proto_tree *tree, guint32 offset, gboolean have_ len -= 8; } - proto_tree_add_text(xtp_subtree, tvb, offset, len, - "Data (%u byte%s)", len, - plurality(len, "", "s")); + proto_tree_add_item(xtp_subtree, hf_xtp_data, tvb, offset, len, ENC_NA); return; } @@ -1057,18 +1057,18 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, check_len); computed_cksum = in_cksum(cksum_vec, 1); if (computed_cksum == 0) { - proto_tree_add_text(xtp_tree, tvb, offset, 2, - "Checksum: 0x%04x [correct]", xtph->check); + proto_tree_add_uint_format_value(xtp_tree, hf_xtp_checksum, tvb, offset, 2, + xtph->check, "0x%04x [correct]", xtph->check); } else { - proto_tree_add_text(xtp_tree, tvb, offset, 2, - "Checksum: 0x%04x [incorrect, should be 0x%04x]", + proto_tree_add_uint_format_value(xtp_tree, hf_xtp_checksum, tvb, offset, 2, + xtph->check, "0x%04x [incorrect, should be 0x%04x]", xtph->check, in_cksum_shouldbe(xtph->check, computed_cksum)); } } else { - proto_tree_add_text(xtp_tree, tvb, offset, 2, - "Checksum: 0x%04x", xtph->check); + proto_tree_add_uint_format_value(xtp_tree, hf_xtp_checksum, tvb, offset, 2, + xtph->check, "0x%04x", xtph->check); } offset += 2; /* sort(2) */ @@ -1383,6 +1383,14 @@ proto_register_xtp(void) { "Message", "xtp.diag.msg", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_xtp_checksum, + { "Checksum", "xtp.checksum", + FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } + }, + { &hf_xtp_data, + { "Data", "xtp.data", + FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } + }, }; static gint *ett[] = { |