diff options
author | Michael Mann <mmann78@netscape.net> | 2014-11-30 12:51:30 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-12-01 08:52:03 +0000 |
commit | 4f9af8608cc4279b3f559db3d2f3bc6224ad58a5 (patch) | |
tree | dc87094a132b0fe6284bedb7573714038d017627 /epan/dissectors/packet-nsip.c | |
parent | 86c659c2721a659641aded94ec59d1a863cc86db (diff) |
Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.
Part 2 of many
Change-Id: I50815e7738b011382392f3078a7107d3d9eec4ec
Reviewed-on: https://code.wireshark.org/review/5542
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-nsip.c')
-rw-r--r-- | epan/dissectors/packet-nsip.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index 88377863c8..0aca414b2b 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -59,6 +59,7 @@ static int hf_nsip_ip_address_ipv4 = -1; static int hf_nsip_ip_address_ipv6 = -1; static int hf_nsip_end_flag = -1; static int hf_nsip_end_flag_spare = -1; +static int hf_nsip_control_bits = -1; static int hf_nsip_control_bits_r = -1; static int hf_nsip_control_bits_c = -1; static int hf_nsip_control_bits_spare = -1; @@ -594,27 +595,18 @@ decode_iei_end_flag(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { } static void -decode_iei_control_bits(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { +decode_iei_control_bits(nsip_ie_t *ie _U_, build_info_t *bi, int ie_start_offset) { guint8 control_bits; - proto_tree *field_tree; + static const int * flags[] = { + &hf_nsip_control_bits_r, + &hf_nsip_control_bits_c, + &hf_nsip_control_bits_spare, + NULL + }; control_bits = tvb_get_guint8(bi->tvb, bi->offset); - - if (bi->nsip_tree) { - field_tree = proto_tree_add_subtree_format(bi->nsip_tree, bi->tvb, ie_start_offset, - ie->total_length, ett_nsip_control_bits, NULL, - "NS SDU Control bits: %#02x", control_bits); - - proto_tree_add_boolean(field_tree, hf_nsip_control_bits_r, bi->tvb, - bi->offset, 1, - control_bits & NSIP_MASK_CONTROL_BITS_R); - proto_tree_add_boolean(field_tree, hf_nsip_control_bits_c, bi->tvb, - bi->offset, 1, - control_bits & NSIP_MASK_CONTROL_BITS_C); - proto_tree_add_uint(field_tree, hf_nsip_control_bits_spare, - bi->tvb, bi->offset, 1, - control_bits & NSIP_MASK_CONTROL_BITS_SPARE); - } + proto_tree_add_bitmask(bi->nsip_tree, bi->tvb, ie_start_offset, hf_nsip_control_bits, + ett_nsip_control_bits, flags, ENC_NA); bi->offset++; if (control_bits & NSIP_MASK_CONTROL_BITS_R) { @@ -1080,6 +1072,11 @@ proto_register_nsip(void) FT_UINT8, BASE_HEX, NULL, NSIP_MASK_END_FLAG_SPARE, NULL, HFILL } }, + { &hf_nsip_control_bits, + { "NS SDU Control bits", "nsip.control_bits", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, { &hf_nsip_control_bits_r, { "Request change flow", "nsip.control_bits.r", FT_BOOLEAN, 8, TFS(&tfs_set_notset), NSIP_MASK_CONTROL_BITS_R, |