diff options
author | Michael Mann <mmann78@netscape.net> | 2015-04-22 07:57:37 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-04-22 23:24:45 +0000 |
commit | 8d6324f759639c7d3c0cab839ca1d3c42c93f895 (patch) | |
tree | e2a36618d1c6892347c03bf479fc3eb15f5d9571 /epan/dissectors/packet-ositp.c | |
parent | 825aa502e7a1730141a3bfbf463f23167fb0b975 (diff) |
Convert proto_tree_add_boolean to proto_tree_add_bitmask_[value|value_with_flags|list]
Part 2 of a few
Change-Id: Ic1f1aafe2ed02dce95b15c03a91cbd68807a5cf4
Reviewed-on: https://code.wireshark.org/review/8165
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ositp.c')
-rw-r--r-- | epan/dissectors/packet-ositp.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/epan/dissectors/packet-ositp.c b/epan/dissectors/packet-ositp.c index b7a2b260f8..15db2649a9 100644 --- a/epan/dissectors/packet-ositp.c +++ b/epan/dissectors/packet-ositp.c @@ -1512,6 +1512,12 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, tvbuff_t *next_tvb; guint tpdu_len; heur_dtbl_entry_t *hdtbl_entry; + static const int * class_options[] = { + &hf_cotp_class, + &hf_cotp_opts_extended_formats, + &hf_cotp_opts_no_explicit_flow_control, + NULL, + }; src_ref = tvb_get_ntohs(tvb, offset + P_SRC_REF); @@ -1531,26 +1537,20 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, "%s TPDU src-ref: 0x%04x dst-ref: 0x%04x", (tpdu == CR_TPDU) ? "CR" : "CC", src_ref, dst_ref); - if (tree) { - ti = proto_tree_add_item(tree, proto_cotp, tvb, offset, li + 1, ENC_NA); - cotp_tree = proto_item_add_subtree(ti, ett_cotp); - proto_tree_add_uint(cotp_tree, hf_cotp_li, tvb, offset, 1,li); - } + ti = proto_tree_add_item(tree, proto_cotp, tvb, offset, li + 1, ENC_NA); + cotp_tree = proto_item_add_subtree(ti, ett_cotp); + proto_tree_add_uint(cotp_tree, hf_cotp_li, tvb, offset, 1,li); offset += 1; - if (tree) { - item = proto_tree_add_uint(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu); - } + item = proto_tree_add_uint(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu); offset += 1; li -= 1; - if (tree) - proto_tree_add_uint(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref); + proto_tree_add_uint(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref); offset += 2; li -= 2; - if (tree) - proto_tree_add_uint(cotp_tree, hf_cotp_srcref, tvb, offset, 2, src_ref); + proto_tree_add_uint(cotp_tree, hf_cotp_srcref, tvb, offset, 2, src_ref); offset += 2; li -= 2; @@ -1560,17 +1560,10 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, expert_add_info_format(pinfo, item, &ei_cotp_connection, "Connection %s: 0x%x -> 0x%x", tpdu == CR_TPDU ? "Request(CR)" : "Confirm(CC)", src_ref, dst_ref); } - if (tree) { - proto_tree_add_uint(cotp_tree, hf_cotp_class, tvb, offset, 1, class_option); - proto_tree_add_boolean(cotp_tree, hf_cotp_opts_extended_formats, tvb, - offset, 1, class_option); - proto_tree_add_boolean(cotp_tree, hf_cotp_opts_no_explicit_flow_control, - tvb, offset, 1, class_option); - } + proto_tree_add_bitmask_list(cotp_tree, tvb, offset, 1, class_options, ENC_NA); offset += 1; li -= 1; - if (tree) { /* Microsoft runs their Remote Desktop Protocol atop ISO COTP atop TPKT, and does some weird stuff in the CR packet: @@ -1595,9 +1588,8 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, XXX - have TPKT know that a given session is an RDP session, and let us know, so we know whether to check for this stuff. */ - ositp_decode_var_part(tvb, offset, li, class_option, tpdu_len , pinfo, + ositp_decode_var_part(tvb, offset, li, class_option, tpdu_len , pinfo, cotp_tree); - } offset += li; /* |