diff options
author | Michael Mann <mmann78@netscape.net> | 2014-08-01 10:08:57 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-08-03 16:30:10 +0000 |
commit | 5db1352526e71727091ff0e1c0e97821eec4e4cb (patch) | |
tree | 01f836967616b7ae8b2840c488b500c7ff13d55c /epan/dissectors/packet-chdlc.c | |
parent | 3fa5625ea074908d5617111a7edfcf6d95e6108a (diff) |
Eliminate proto_tree_add_text from some dissectors.
Change-Id: I398e9cf4f6882e76644aa758e12c39a39159e95f
Reviewed-on: https://code.wireshark.org/review/3319
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-chdlc.c')
-rw-r--r-- | epan/dissectors/packet-chdlc.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/epan/dissectors/packet-chdlc.c b/epan/dissectors/packet-chdlc.c index f30a0faf5e..b280bdb42b 100644 --- a/epan/dissectors/packet-chdlc.c +++ b/epan/dissectors/packet-chdlc.c @@ -48,15 +48,18 @@ void proto_reg_handoff_slarp(void); static int proto_chdlc = -1; static int hf_chdlc_addr = -1; static int hf_chdlc_proto = -1; +static int hf_chdlc_clns_padding = -1; static gint ett_chdlc = -1; static int proto_slarp = -1; static int hf_slarp_ptype = -1; static int hf_slarp_address = -1; +static int hf_slarp_netmask = -1; static int hf_slarp_mysequence = -1; /* static int hf_slarp_yoursequence = -1; */ + static gint ett_slarp = -1; static dissector_handle_t data_handle; @@ -127,12 +130,10 @@ chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype, int chdlctype_id) { tvbuff_t *next_tvb; - int padbyte = 0; + int padbyte; - if (tree) { - proto_tree_add_uint(fh_tree, chdlctype_id, tvb, + proto_tree_add_uint(fh_tree, chdlctype_id, tvb, offset_after_chdlctype - 2, 2, chdlc_type); - } padbyte = tvb_get_guint8(tvb, offset_after_chdlctype); if (chdlc_type == CHDLCTYPE_OSI && @@ -140,8 +141,7 @@ chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype, padbyte == NLPID_ISO9542_ESIS || padbyte == NLPID_ISO10589_ISIS)) { /* There is a Padding Byte for CLNS protocols over Cisco HDLC */ - proto_tree_add_text(fh_tree, tvb, offset_after_chdlctype, 1, "CLNS Padding: 0x%02x", - padbyte); + proto_tree_add_item(fh_tree, hf_chdlc_clns_padding, tvb, offset_after_chdlctype, 1, ENC_NA); next_tvb = tvb_new_subset_remaining(tvb, offset_after_chdlctype + 1); } else { next_tvb = tvb_new_subset_remaining(tvb, offset_after_chdlctype); @@ -210,7 +210,11 @@ proto_register_chdlc(void) { &hf_chdlc_proto, { "Protocol", "chdlc.protocol", FT_UINT16, BASE_HEX, VALS(chdlc_vals), 0x0, NULL, HFILL }}, + { &hf_chdlc_clns_padding, + { "CLNS Padding", "chdlc.clns_padding", FT_UINT8, BASE_HEX, + NULL, 0x0, NULL, HFILL }}, }; + static gint *ett[] = { &ett_chdlc, }; @@ -296,8 +300,7 @@ dissect_slarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { proto_tree_add_uint(slarp_tree, hf_slarp_ptype, tvb, 0, 4, code); proto_tree_add_item(slarp_tree, hf_slarp_address, tvb, 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_text(slarp_tree, tvb, 8, 4, - "Netmask: %s", tvb_ip_to_str(tvb, 8)); + proto_tree_add_item(slarp_tree, hf_slarp_netmask, tvb, 8, 4, ENC_BIG_ENDIAN); } break; @@ -340,6 +343,9 @@ proto_register_slarp(void) NULL, 0x0, NULL, HFILL }}, /* XXX - need an FT_ for netmasks, which is like FT_IPV4 but doesn't get translated to a host name. */ + { &hf_slarp_netmask, + { "Netmask", "slarp.netmask", FT_IPv4, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, { &hf_slarp_mysequence, { "Outgoing sequence number", "slarp.mysequence", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, |