diff options
author | Michael Mann <mmann78@netscape.net> | 2014-08-07 08:36:30 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-08 05:51:52 +0000 |
commit | a22b7075f84b8faf83a3ef05e45ea6d922c5001f (patch) | |
tree | 519e874bc10d1231b0dd9632dd91dabbb11502ef /epan/dissectors/packet-fefd.c | |
parent | 532a98dc8c827471e143c81517b7ebb321400f84 (diff) |
Eliminate proto_tree_add_text from some dissectors.
Change-Id: I6f1710a093fc548c718defa9b40ab68877ede977
Reviewed-on: https://code.wireshark.org/review/3470
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-fefd.c')
-rw-r--r-- | epan/dissectors/packet-fefd.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/epan/dissectors/packet-fefd.c b/epan/dissectors/packet-fefd.c index 603a0c4199..b11ffa509e 100644 --- a/epan/dissectors/packet-fefd.c +++ b/epan/dissectors/packet-fefd.c @@ -46,6 +46,9 @@ static int hf_fefd_flags_rsy = -1; static int hf_fefd_checksum = -1; static int hf_fefd_tlvtype = -1; static int hf_fefd_tlvlength = -1; +static int hf_fefd_device_id = -1; +static int hf_fefd_sent_through_interface = -1; +static int hf_fefd_data = -1; static gint ett_fefd = -1; static gint ett_fefd_flags = -1; @@ -94,7 +97,6 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int offset = 0; guint16 type; guint16 length; - proto_item *tlvi; proto_tree *tlv_tree; int real_length; @@ -128,10 +130,9 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length = tvb_get_ntohs(tvb, offset + TLV_LENGTH); if (length < 4) { if (tree) { - tlvi = proto_tree_add_text(fefd_tree, tvb, offset, 4, - "TLV with invalid length %u (< 4)", + tlv_tree = proto_tree_add_subtree_format(fefd_tree, tvb, offset, 4, /* XXX - expert info? */ + ett_fefd_tlv, NULL, "TLV with invalid length %u (< 4)", length); - tlv_tree = proto_item_add_subtree(tlvi, ett_fefd_tlv); proto_tree_add_uint(tlv_tree, hf_fefd_tlvtype, tvb, offset + TLV_TYPE, 2, type); proto_tree_add_uint(tlv_tree, hf_fefd_tlvlength, tvb, @@ -159,9 +160,8 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset + TLV_TYPE, 2, type); proto_tree_add_uint(tlv_tree, hf_fefd_tlvlength, tvb, offset + TLV_LENGTH, 2, length); - proto_tree_add_text(tlv_tree, tvb, offset + 4, - length - 4, "Device ID: %s", - tvb_format_stringzpad(tvb, offset + 4, length - 4)); + proto_tree_add_item(tlv_tree, hf_fefd_device_id, tvb, offset + 4, + length - 4, ENC_NA|ENC_ASCII); } offset += length; break; @@ -190,10 +190,8 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset + TLV_TYPE, 2, type); proto_tree_add_uint(tlv_tree, hf_fefd_tlvlength, tvb, offset + TLV_LENGTH, 2, length); - proto_tree_add_text(tlv_tree, tvb, offset + 4, - real_length - 4, - "Sent through Interface: %s", - tvb_format_text(tvb, offset + 4, real_length - 4)); + proto_tree_add_item(tlv_tree, hf_fefd_sent_through_interface, tvb, offset + 4, + real_length - 4, ENC_NA|ENC_ASCII); } offset += real_length; break; @@ -213,8 +211,8 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(tlv_tree, hf_fefd_tlvlength, tvb, offset + TLV_LENGTH, 2, length); if (length > 4) { - proto_tree_add_text(tlv_tree, tvb, offset + 4, - length - 4, "Data"); + proto_tree_add_item(tlv_tree, hf_fefd_data, tvb, offset + 4, + length - 4, ENC_NA); } else { return; } @@ -259,8 +257,21 @@ proto_register_fefd(void) { &hf_fefd_tlvlength, { "Length", "fefd.tlv.len", FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL }} + NULL, HFILL }}, + + { &hf_fefd_device_id, + { "Device ID", "fefd.device_id", FT_STRINGZ, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_fefd_sent_through_interface, + { "Sent through Interface", "fefd.sent_through_interface", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_fefd_data, + { "Data", "fefd.data", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; + static gint *ett[] = { &ett_fefd, &ett_fefd_flags, |