From 525fd71b367cc733535e25611728dbf18c7e98ff Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Tue, 14 Jun 2016 23:17:25 -0400 Subject: [PATCH] proto_tree_add_boolean -> proto_tree_add_bitmask_list_value Change-Id: Ic644042d238b5f2abcd874bca92c6dea55804ba9 Reviewed-on: https://code.wireshark.org/review/15913 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- .../asn1/ldap/packet-ldap-template.c | 29 ++-- epan/dissectors/packet-aim.c | 46 +++--- epan/dissectors/packet-bootp.c | 156 +++++++++++------- epan/dissectors/packet-bpdu.c | 30 ++-- epan/dissectors/packet-dec-dnart.c | 40 ++--- epan/dissectors/packet-dtn.c | 45 ++--- epan/dissectors/packet-frame.c | 28 ++-- epan/dissectors/packet-ldap.c | 35 ++-- epan/dissectors/packet-sita.c | 49 ++++-- epan/dissectors/packet-smb.c | 45 +++-- epan/dissectors/packet-windows-common.c | 151 +++++------------ 11 files changed, 322 insertions(+), 332 deletions(-) diff --git a/epan/dissectors/asn1/ldap/packet-ldap-template.c b/epan/dissectors/asn1/ldap/packet-ldap-template.c index 93506058fa..5d797d9e68 100644 --- a/epan/dissectors/asn1/ldap/packet-ldap-template.c +++ b/epan/dissectors/asn1/ldap/packet-ldap-template.c @@ -1705,23 +1705,20 @@ dissect_ldap_oid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* static void ldap_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 access) { - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CONTROL_ACCESS, tvb, offset, 4, access); + static const int * access_flags[] = { + &hf_ldap_AccessMask_ADS_CONTROL_ACCESS, + &hf_ldap_AccessMask_ADS_LIST_OBJECT, + &hf_ldap_AccessMask_ADS_DELETE_TREE, + &hf_ldap_AccessMask_ADS_WRITE_PROP, + &hf_ldap_AccessMask_ADS_READ_PROP, + &hf_ldap_AccessMask_ADS_SELF_WRITE, + &hf_ldap_AccessMask_ADS_LIST, + &hf_ldap_AccessMask_ADS_DELETE_CHILD, + &hf_ldap_AccessMask_ADS_CREATE_CHILD, + NULL + }; - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST_OBJECT, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_TREE, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_WRITE_PROP, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_READ_PROP, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_SELF_WRITE, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_CHILD, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CREATE_CHILD, tvb, offset, 4, access); + proto_tree_add_bitmask_list_value(tree, tvb, offset, 4, access_flags, access); } struct access_mask_info ldap_access_mask_info = { "LDAP", /* Name of specific rights */ diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c index fe0de740ab..44fc8dc4e0 100644 --- a/epan/dissectors/packet-aim.c +++ b/epan/dissectors/packet-aim.c @@ -1072,31 +1072,35 @@ dissect_aim_tlv_value_time(proto_item *ti _U_, guint16 valueid _U_, tvbuff_t *tv } int -dissect_aim_userclass(tvbuff_t *tvb, int offset, int len, proto_item *ti, guint32 flags) +dissect_aim_userclass(tvbuff_t *tvb, int offset, int len, proto_item *ti, guint32 value) { proto_tree *entry; + static const int * flags[] = { + &hf_aim_userclass_unconfirmed, + &hf_aim_userclass_administrator, + &hf_aim_userclass_aol, + &hf_aim_userclass_commercial, + &hf_aim_userclass_aim, + &hf_aim_userclass_away, + &hf_aim_userclass_icq, + &hf_aim_userclass_wireless, + &hf_aim_userclass_unknown100, + &hf_aim_userclass_imf, + &hf_aim_userclass_bot, + &hf_aim_userclass_unknown800, + &hf_aim_userclass_one_way_wireless, + &hf_aim_userclass_unknown2000, + &hf_aim_userclass_unknown4000, + &hf_aim_userclass_unknown8000, + &hf_aim_userclass_unknown10000, + &hf_aim_userclass_unknown20000, + &hf_aim_userclass_no_knock_knock, + &hf_aim_userclass_forward_mobile, + NULL + }; entry = proto_item_add_subtree(ti, ett_aim_userclass); - proto_tree_add_boolean(entry, hf_aim_userclass_unconfirmed, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_administrator, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_aol, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_commercial, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_aim, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_away, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_icq, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_wireless, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_unknown100, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_imf, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_bot, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_unknown800, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_one_way_wireless, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_unknown2000, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_unknown4000, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_unknown8000, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_unknown10000, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_unknown20000, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_no_knock_knock, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_userclass_forward_mobile, tvb, offset, len, flags); + proto_tree_add_bitmask_list_value(entry, tvb, offset, len, flags, value); return offset+len; } diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 48cce85779..fcda233520 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -4725,9 +4725,14 @@ dissect_packetcable_mta_cap(proto_tree *v_tree, packet_info *pinfo, tvbuff_t *tv } subtree = proto_item_add_subtree(ti, ett_bootp_option); if (raw_val == PKT_MDC_PROV_FLOWS) { - proto_tree_add_boolean(subtree, hf_bootp_pkt_mdc_supp_flow_secure, tvb, off + 4, 4, flow_val); - proto_tree_add_boolean(subtree, hf_bootp_pkt_mdc_supp_flow_hybrid, tvb, off + 4, 4, flow_val); - proto_tree_add_boolean(subtree, hf_bootp_pkt_mdc_supp_flow_basic, tvb, off + 4, 4, flow_val); + static const int * flows[] = { + &hf_bootp_pkt_mdc_supp_flow_secure, + &hf_bootp_pkt_mdc_supp_flow_hybrid, + &hf_bootp_pkt_mdc_supp_flow_basic, + NULL + }; + + proto_tree_add_bitmask_list_value(subtree, tvb, off + 4, 4, flows, flow_val); } else if (raw_val == PKT_MDC_MIBS) { /* 17 06 02 00 38 02 01 07 */ subopt_off = off + 4; @@ -4762,31 +4767,49 @@ dissect_packetcable_mta_cap(proto_tree *v_tree, packet_info *pinfo, tvbuff_t *tv } switch (raw_val) { - case PKT_MDC_MIB_CL: - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_cl_mta, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_cl_signaling, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_cl_management_event, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_cl_mta_extension, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_cl_mta_signaling_extension, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_cl_mta_mem_extention, tvb, subopt_off, 2, mib_val); - proto_tree_add_uint(subtree2, hf_bootp_pkt_mdc_mib_cl_reserved, tvb, subopt_off, 2, mib_val); + case PKT_MDC_MIB_CL: { + static const int * cl_flags[] = { + &hf_bootp_pkt_mdc_mib_cl_mta, + &hf_bootp_pkt_mdc_mib_cl_signaling, + &hf_bootp_pkt_mdc_mib_cl_management_event, + &hf_bootp_pkt_mdc_mib_cl_mta_extension, + &hf_bootp_pkt_mdc_mib_cl_mta_signaling_extension, + &hf_bootp_pkt_mdc_mib_cl_mta_mem_extention, + &hf_bootp_pkt_mdc_mib_cl_reserved, + NULL + }; + + proto_tree_add_bitmask_list_value(subtree2, tvb, subopt_off, 2, cl_flags, mib_val); + } break; - case PKT_MDC_MIB_IETF: - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_ietf_mta, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_ietf_signaling, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_ietf_management_event, tvb, subopt_off, 2, mib_val); - proto_tree_add_uint(subtree2, hf_bootp_pkt_mdc_mib_ietf_reserved, tvb, subopt_off, 2, mib_val); + case PKT_MDC_MIB_IETF: { + static const int * ietf_flags[] = { + &hf_bootp_pkt_mdc_mib_ietf_mta, + &hf_bootp_pkt_mdc_mib_ietf_signaling, + &hf_bootp_pkt_mdc_mib_ietf_management_event, + &hf_bootp_pkt_mdc_mib_ietf_reserved, + NULL + }; + + proto_tree_add_bitmask_list_value(subtree2, tvb, subopt_off, 2, ietf_flags, mib_val); + } break; - case PKT_MDC_MIB_EURO: - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_euro_mta, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_euro_signaling, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_euro_management_event, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_euro_mta_extension, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_euro_mta_signaling_extension, tvb, subopt_off, 2, mib_val); - proto_tree_add_boolean(subtree2, hf_bootp_pkt_mdc_mib_euro_mta_mem_extention, tvb, subopt_off, 2, mib_val); - proto_tree_add_uint(subtree2, hf_bootp_pkt_mdc_mib_euro_reserved, tvb, subopt_off, 2, mib_val); + case PKT_MDC_MIB_EURO: { + static const int * euro_flags[] = { + &hf_bootp_pkt_mdc_mib_euro_mta, + &hf_bootp_pkt_mdc_mib_euro_signaling, + &hf_bootp_pkt_mdc_mib_euro_management_event, + &hf_bootp_pkt_mdc_mib_euro_mta_extension, + &hf_bootp_pkt_mdc_mib_euro_mta_signaling_extension, + &hf_bootp_pkt_mdc_mib_euro_mta_mem_extention, + &hf_bootp_pkt_mdc_mib_euro_reserved, + NULL + }; + + proto_tree_add_bitmask_list_value(subtree2, tvb, subopt_off, 2, euro_flags, mib_val); + } break; default: @@ -5322,49 +5345,64 @@ dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboo subtree = proto_item_add_subtree(ti, ett_bootp_option); if (tlv_type == DOCSIS_CM_CAP_RNGHLDOFF_SUP && tlv_len >= 4) { + const int * flags[] = { + &hf_bootp_docsis_cm_cap_ranging_hold_off_cm, + &hf_bootp_docsis_cm_cap_ranging_hold_off_eps, + &hf_bootp_docsis_cm_cap_ranging_hold_off_emta, + &hf_bootp_docsis_cm_cap_ranging_hold_off_dsg, + NULL + }; val_uint16 = (val_other[2] << sizeof(guint8)) + val_other[3]; - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ranging_hold_off_cm, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ranging_hold_off_eps, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ranging_hold_off_emta, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ranging_hold_off_dsg, tvb, off + 2, 4, val_uint16); + + proto_tree_add_bitmask_list_value(subtree, tvb, off + 2, 4, flags, val_uint16); } if (tlv_type == DOCSIS_CM_CAP_USSYMRATE_SUP) { - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ussymrate_160, tvb, off + 2, 1, val_byte); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ussymrate_320, tvb, off + 2, 1, val_byte); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ussymrate_640, tvb, off + 2, 1, val_byte); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ussymrate_1280, tvb, off + 2, 1, val_byte); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ussymrate_2560, tvb, off + 2, 1, val_byte); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_ussymrate_5120, tvb, off + 2, 1, val_byte); + const int * flags[] = { + &hf_bootp_docsis_cm_cap_ussymrate_160, + &hf_bootp_docsis_cm_cap_ussymrate_320, + &hf_bootp_docsis_cm_cap_ussymrate_640, + &hf_bootp_docsis_cm_cap_ussymrate_1280, + &hf_bootp_docsis_cm_cap_ussymrate_2560, + &hf_bootp_docsis_cm_cap_ussymrate_5120, + NULL + }; + + proto_tree_add_bitmask_list_value(subtree, tvb, off + 2, 1, flags, val_byte); } if (tlv_type == DOCSIS_CM_CAP_Opt802MPLSSup && tlv_len >= 4) { + const int * flags[] = { + &hf_bootp_docsis_cm_cap_mpls_stpid, + &hf_bootp_docsis_cm_cap_mpls_svid, + &hf_bootp_docsis_cm_cap_mpls_spcp, + &hf_bootp_docsis_cm_cap_mpls_sdei, + &hf_bootp_docsis_cm_cap_mpls_ctpid, + &hf_bootp_docsis_cm_cap_mpls_cvid, + &hf_bootp_docsis_cm_cap_mpls_cpcp, + &hf_bootp_docsis_cm_cap_mpls_ccfi, + &hf_bootp_docsis_cm_cap_mpls_stci, + &hf_bootp_docsis_cm_cap_mpls_ctci, + &hf_bootp_docsis_cm_cap_mpls_itpid, + &hf_bootp_docsis_cm_cap_mpls_isid, + &hf_bootp_docsis_cm_cap_mpls_itci, + &hf_bootp_docsis_cm_cap_mpls_ipcp, + &hf_bootp_docsis_cm_cap_mpls_idei, + &hf_bootp_docsis_cm_cap_mpls_iuca, + &hf_bootp_docsis_cm_cap_mpls_btpid, + &hf_bootp_docsis_cm_cap_mpls_btci, + &hf_bootp_docsis_cm_cap_mpls_bpcp, + &hf_bootp_docsis_cm_cap_mpls_bdei, + &hf_bootp_docsis_cm_cap_mpls_bvid, + &hf_bootp_docsis_cm_cap_mpls_bda, + &hf_bootp_docsis_cm_cap_mpls_bsa, + &hf_bootp_docsis_cm_cap_mpls_tc, + &hf_bootp_docsis_cm_cap_mpls_label, + NULL + }; val_uint16 = (val_other[2] << sizeof(guint8)) + val_other[3]; - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_stpid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_svid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_spcp, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_sdei, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_ctpid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_cvid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_cpcp, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_ccfi, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_stci, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_ctci, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_itpid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_isid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_itci, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_ipcp, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_idei, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_iuca, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_btpid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_btci, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_bpcp, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_bdei, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_bvid, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_bda, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_bsa, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_tc, tvb, off + 2, 4, val_uint16); - proto_tree_add_boolean(subtree, hf_bootp_docsis_cm_cap_mpls_label, tvb, off + 2, 4, val_uint16); + + proto_tree_add_bitmask_list_value(subtree, tvb, off + 2, 4, flags, val_uint16); } if (opt125) { diff --git a/epan/dissectors/packet-bpdu.c b/epan/dissectors/packet-bpdu.c index 456e48f1f7..f7fe851b55 100644 --- a/epan/dissectors/packet-bpdu.c +++ b/epan/dissectors/packet-bpdu.c @@ -334,7 +334,6 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp guint16 msti_bridge_identifier_priority, msti_port_identifier_priority; int total_msti_length, offset, msti, msti_format; int msti_length_remaining; - guint8 agree_num = 0, dagree_num = 0; int spt_offset = 0; @@ -933,6 +932,14 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp /* version 4 length is 55 or more. */ if (version_4_length >= 53) { + static const int * agreements[] = { + &hf_bpdu_flags_agree_num, + &hf_bpdu_flags_dagree_num, + &hf_bpdu_flags_agree_valid, + &hf_bpdu_flags_restricted_role, + NULL + }; + spt_tree = proto_tree_add_subtree(bpdu_tree, tvb, bpdu_version_4_length, -1, ett_spt, NULL, "SPT Extension"); @@ -963,27 +970,12 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp spt_agree_data = tvb_get_guint8(tvb, spt_offset); sep = initial_sep; - if (agreement_item) { - agree_num = (spt_agree_data & 0x03); - proto_item_append_text(agreement_item, "%sAN: %d", sep, agree_num ); - } + proto_item_append_text(agreement_item, "%sAN: %d", sep, (spt_agree_data & 0x03)); - proto_tree_add_uint(agreement_tree, hf_bpdu_flags_agree_num, - tvb, spt_offset, 1, spt_agree_data); + proto_tree_add_bitmask_list_value(agreement_tree, tvb, spt_offset, 1, agreements, spt_agree_data); sep = cont_sep; - if (agreement_item) { - dagree_num = ((spt_agree_data & 0x0C) >> 2); - proto_item_append_text(agreement_item, "%sDAN: %d", sep, dagree_num); - } - proto_tree_add_uint(agreement_tree, hf_bpdu_flags_dagree_num, - tvb, spt_offset, 1, spt_agree_data); - - proto_tree_add_boolean(agreement_tree, hf_bpdu_flags_agree_valid, - tvb, spt_offset, 1, spt_agree_data); - - proto_tree_add_boolean(agreement_tree, hf_bpdu_flags_restricted_role, - tvb, spt_offset, 1, spt_agree_data); + proto_item_append_text(agreement_item, "%sDAN: %d", sep, ((spt_agree_data & 0x0C) >> 2)); if (sep != initial_sep) { proto_item_append_text(agreement_item, ")"); diff --git a/epan/dissectors/packet-dec-dnart.c b/epan/dissectors/packet-dec-dnart.c index 686bec33c0..1e8b4d8afa 100644 --- a/epan/dissectors/packet-dec-dnart.c +++ b/epan/dissectors/packet-dec-dnart.c @@ -430,16 +430,16 @@ dissect_dec_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ break; } } else if (msg_flags & RT_FLAGS_LONG_MSG){ - proto_tree_add_uint(flags_tree, hf_dec_rt_long_msg, - tvb, offset, 1, msg_flags); - proto_tree_add_boolean(flags_tree, hf_dec_rt_rqr, tvb, - offset, 1, msg_flags); - proto_tree_add_boolean(flags_tree, hf_dec_rt_rts, tvb, - offset, 1, msg_flags); - proto_tree_add_boolean(flags_tree, hf_dec_rt_inter_eth, tvb, - offset, 1, msg_flags); - proto_tree_add_boolean(flags_tree, hf_dec_rt_discard, tvb, - offset, 1, msg_flags); + const int * msg_bit_flags[] = { + &hf_dec_rt_long_msg, + &hf_dec_rt_rqr, + &hf_dec_rt_rts, + &hf_dec_rt_inter_eth, + &hf_dec_rt_discard, + NULL + }; + + proto_tree_add_bitmask_list_value(flags_tree, tvb, offset, 1, msg_bit_flags, msg_flags); /* Increment offset by three: 1 to get past the flags field @@ -884,8 +884,8 @@ handle_nsp_msg( /* This is the last field, the rest are data */ proto_tree_add_item(tree, hf_dec_rt_segnum, tvb, my_offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_boolean(tree, hf_dec_rt_delay, - tvb, my_offset, 2, seg_num); + proto_tree_add_item(tree, hf_dec_rt_delay, + tvb, my_offset, 2, ENC_LITTLE_ENDIAN); my_offset += 2; /* Compute the number of bytes in this data segment */ data_length = @@ -912,8 +912,8 @@ handle_nsp_msg( /* There are no ack/nak fields */ proto_tree_add_item(tree, hf_dec_rt_segnum, tvb, my_offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_boolean(tree, hf_dec_rt_delay, - tvb, my_offset, 2, ack_num); + proto_tree_add_item(tree, hf_dec_rt_delay, + tvb, my_offset, 2, ENC_LITTLE_ENDIAN); my_offset += 2; /* We are done, return my_offset */ break; @@ -932,8 +932,8 @@ handle_nsp_msg( /* This is the last field, the rest are data */ proto_tree_add_item(tree, hf_dec_rt_segnum, tvb, my_offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_boolean(tree, hf_dec_rt_delay, - tvb, my_offset, 2, seg_num); + proto_tree_add_item(tree, hf_dec_rt_delay, + tvb, my_offset, 2, ENC_LITTLE_ENDIAN); my_offset += 2; /* We are done, return my_offset */ break; @@ -952,8 +952,8 @@ handle_nsp_msg( /* There are no ack/nak fields */ proto_tree_add_item(tree, hf_dec_rt_segnum, tvb, my_offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_boolean(tree, hf_dec_rt_delay, - tvb, my_offset, 2, ack_num); + proto_tree_add_item(tree, hf_dec_rt_delay, + tvb, my_offset, 2, ENC_LITTLE_ENDIAN); my_offset += 2; /* We are done, return my_offset */ break; @@ -971,8 +971,8 @@ handle_nsp_msg( seg_num = tvb_get_letohs(tvb, my_offset); proto_tree_add_item(tree, hf_dec_rt_segnum, tvb, my_offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_boolean(tree, hf_dec_rt_delay, - tvb, my_offset, 2, seg_num); + proto_tree_add_item(tree, hf_dec_rt_delay, + tvb, my_offset, 2, ENC_LITTLE_ENDIAN); my_offset += 2; /* Now follows the ls_flags field */ ls_flags = tvb_get_guint8(tvb, my_offset); diff --git a/epan/dissectors/packet-dtn.c b/epan/dissectors/packet-dtn.c index 1f0c824baf..06cfe59a26 100644 --- a/epan/dissectors/packet-dtn.c +++ b/epan/dissectors/packet-dtn.c @@ -838,6 +838,24 @@ dissect_version_5_and_6_primary_header(packet_info *pinfo, guint8 srrflags; proto_item *ti; proto_tree *gen_flag_tree, *srr_flag_tree, *proc_flag_tree, *cos_flag_tree; + static const int * pri_flags[] = { + &hf_bundle_procflags_fragment, + &hf_bundle_procflags_admin, + &hf_bundle_procflags_dont_fragment, + &hf_bundle_procflags_cust_xfer_req, + &hf_bundle_procflags_dest_singleton, + &hf_bundle_procflags_application_ack, + NULL + }; + + static const int * srr_flags[] = { + &hf_bundle_srrflags_report_receipt, + &hf_bundle_srrflags_report_cust_accept, + &hf_bundle_srrflags_report_forward, + &hf_bundle_srrflags_report_delivery, + &hf_bundle_srrflags_report_deletion, + NULL + }; bundle_processing_control_flags = evaluate_sdnv_64(tvb, offset, &sdnv_length); @@ -857,18 +875,10 @@ dissect_version_5_and_6_primary_header(packet_info *pinfo, sdnv_length, *pri_hdr_procflags); gen_flag_tree = proto_item_add_subtree(ti, ett_gen_flags); - proto_tree_add_boolean(gen_flag_tree, hf_bundle_procflags_fragment, - tvb, offset, sdnv_length, *pri_hdr_procflags); - proto_tree_add_boolean(gen_flag_tree, hf_bundle_procflags_admin, - tvb, offset, sdnv_length, *pri_hdr_procflags); - proto_tree_add_boolean(gen_flag_tree, hf_bundle_procflags_dont_fragment, - tvb, offset, sdnv_length, *pri_hdr_procflags); - proto_tree_add_boolean(gen_flag_tree, hf_bundle_procflags_cust_xfer_req, - tvb, offset, sdnv_length, *pri_hdr_procflags); - proto_tree_add_boolean(gen_flag_tree, hf_bundle_procflags_dest_singleton, - tvb, offset, sdnv_length, *pri_hdr_procflags); - proto_tree_add_boolean(gen_flag_tree, hf_bundle_procflags_application_ack, - tvb, offset, sdnv_length, *pri_hdr_procflags); + /* With the variability of sdnv_length, proto_tree_add_bitmask_value + can't be used */ + + proto_tree_add_bitmask_list_value(gen_flag_tree, tvb, offset, sdnv_length, pri_flags, *pri_hdr_procflags); /* Primary Header COS Flags */ cosflags = (guint8) ((bundle_processing_control_flags >> 7) & 0x7f); @@ -884,16 +894,7 @@ dissect_version_5_and_6_primary_header(packet_info *pinfo, sdnv_length, srrflags); srr_flag_tree = proto_item_add_subtree(ti, ett_srr_flags); - proto_tree_add_boolean(srr_flag_tree, hf_bundle_srrflags_report_receipt, - tvb, offset, sdnv_length, srrflags); - proto_tree_add_boolean(srr_flag_tree, hf_bundle_srrflags_report_cust_accept, - tvb, offset, sdnv_length, srrflags); - proto_tree_add_boolean(srr_flag_tree, hf_bundle_srrflags_report_forward, - tvb, offset, sdnv_length, srrflags); - proto_tree_add_boolean(srr_flag_tree, hf_bundle_srrflags_report_delivery, - tvb, offset, sdnv_length, srrflags); - proto_tree_add_boolean(srr_flag_tree, hf_bundle_srrflags_report_deletion, - tvb, offset, sdnv_length, srrflags); + proto_tree_add_bitmask_list_value(srr_flag_tree, tvb, offset, sdnv_length, srr_flags, srrflags); offset += sdnv_length; /* -- hdr_length -- */ diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index b761e193c7..f24e7ab387 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -350,21 +350,25 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* if (pinfo->phdr->presence_flags & WTAP_HAS_PACK_FLAGS) { proto_tree *flags_tree; proto_item *flags_item; + static const int * flags[] = { + &hf_frame_pack_direction, + &hf_frame_pack_reception_type, + &hf_frame_pack_fcs_length, + &hf_frame_pack_reserved, + &hf_frame_pack_crc_error, + &hf_frame_pack_wrong_packet_too_long_error, + &hf_frame_pack_wrong_packet_too_short_error, + &hf_frame_pack_wrong_inter_frame_gap_error, + &hf_frame_pack_unaligned_frame_error, + &hf_frame_pack_start_frame_delimiter_error, + &hf_frame_pack_preamble_error, + &hf_frame_pack_symbol_error, + NULL + }; flags_item = proto_tree_add_uint(fh_tree, hf_frame_pack_flags, tvb, 0, 0, pinfo->phdr->pack_flags); flags_tree = proto_item_add_subtree(flags_item, ett_flags); - proto_tree_add_uint(flags_tree, hf_frame_pack_direction, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_uint(flags_tree, hf_frame_pack_reception_type, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_uint(flags_tree, hf_frame_pack_fcs_length, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_uint(flags_tree, hf_frame_pack_reserved, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_crc_error, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_wrong_packet_too_long_error, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_wrong_packet_too_short_error, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_wrong_inter_frame_gap_error, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_unaligned_frame_error, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_start_frame_delimiter_error, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_preamble_error, tvb, 0, 0, pinfo->phdr->pack_flags); - proto_tree_add_boolean(flags_tree, hf_frame_pack_symbol_error, tvb, 0, 0, pinfo->phdr->pack_flags); + proto_tree_add_bitmask_list_value(flags_tree, tvb, 0, 0, flags, pinfo->phdr->pack_flags); } if (pinfo->phdr->rec_type == REC_TYPE_PACKET) diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index fae5f52787..ba13fce40e 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -4624,23 +4624,20 @@ dissect_ldap_oid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* static void ldap_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 access) { - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CONTROL_ACCESS, tvb, offset, 4, access); + static const int * access_flags[] = { + &hf_ldap_AccessMask_ADS_CONTROL_ACCESS, + &hf_ldap_AccessMask_ADS_LIST_OBJECT, + &hf_ldap_AccessMask_ADS_DELETE_TREE, + &hf_ldap_AccessMask_ADS_WRITE_PROP, + &hf_ldap_AccessMask_ADS_READ_PROP, + &hf_ldap_AccessMask_ADS_SELF_WRITE, + &hf_ldap_AccessMask_ADS_LIST, + &hf_ldap_AccessMask_ADS_DELETE_CHILD, + &hf_ldap_AccessMask_ADS_CREATE_CHILD, + NULL + }; - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST_OBJECT, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_TREE, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_WRITE_PROP, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_READ_PROP, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_SELF_WRITE, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_CHILD, tvb, offset, 4, access); - - proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CREATE_CHILD, tvb, offset, 4, access); + proto_tree_add_bitmask_list_value(tree, tvb, offset, 4, access_flags, access); } struct access_mask_info ldap_access_mask_info = { "LDAP", /* Name of specific rights */ @@ -5673,7 +5670,7 @@ void proto_register_ldap(void) { NULL, HFILL }}, /*--- End of included file: packet-ldap-hfarr.c ---*/ -#line 2189 "./asn1/ldap/packet-ldap-template.c" +#line 2186 "./asn1/ldap/packet-ldap-template.c" }; /* List of subtrees */ @@ -5747,7 +5744,7 @@ void proto_register_ldap(void) { &ett_ldap_T_warning, /*--- End of included file: packet-ldap-ettarr.c ---*/ -#line 2203 "./asn1/ldap/packet-ldap-template.c" +#line 2200 "./asn1/ldap/packet-ldap-template.c" }; /* UAT for header fields */ static uat_field_t custom_attribute_types_uat_fields[] = { @@ -5917,7 +5914,7 @@ proto_reg_handoff_ldap(void) /*--- End of included file: packet-ldap-dis-tab.c ---*/ -#line 2356 "./asn1/ldap/packet-ldap-template.c" +#line 2353 "./asn1/ldap/packet-ldap-template.c" } diff --git a/epan/dissectors/packet-sita.c b/epan/dissectors/packet-sita.c index 69bdc6f6ba..2c4eb73042 100644 --- a/epan/dissectors/packet-sita.c +++ b/epan/dissectors/packet-sita.c @@ -159,34 +159,49 @@ dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ signal_flags, signals, BMT_NO_FALSE|BMT_NO_TFS); if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_RXED) { + static const int * errors1_flags[] = { + &hf_shortframe, + &hf_longframe, + &hf_collision, + &hf_parity, + &hf_framing, + NULL + }; + + static const int * errors2_flags[] = { + &hf_break, + &hf_crc, + &hf_length, + &hf_overrun, + &hf_rxdpll, + &hf_lostcd, + &hf_abort, + &hf_nonaligned, + NULL + }; + errors1_string = format_flags_string(errors1, rx_errors1_str); sita_errors1_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, ett_sita_errors1, NULL, "Receive Status: 0x%02x %s", errors1, errors1_string); - proto_tree_add_boolean(sita_errors1_tree, hf_shortframe, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_longframe, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_collision, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_parity, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_framing, tvb, 0, 0, errors1); + proto_tree_add_bitmask_list_value(sita_errors1_tree, tvb, 0, 0, errors1_flags, errors1); errors2_string = format_flags_string(errors2, rx_errors2_str); sita_errors2_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, ett_sita_errors2, NULL, "Receive Status: 0x%02x %s", errors2, errors2_string); - proto_tree_add_boolean(sita_errors2_tree, hf_break, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_crc, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_length, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_overrun, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_rxdpll, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_lostcd, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_abort, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_nonaligned, tvb, 0, 0, errors2); + proto_tree_add_bitmask_list_value(sita_errors2_tree, tvb, 0, 0, errors2_flags, errors2); } else { + static const int * errors2_flags[] = { + &hf_rtxlimit, + &hf_uarterror, + &hf_lostcts, + &hf_underrun, + NULL + }; + errors2_string = format_flags_string(errors2, tx_errors2_str); sita_errors1_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, ett_sita_errors1, NULL, "Transmit Status: 0x%02x %s", errors2, errors2_string); - proto_tree_add_boolean(sita_errors1_tree, hf_rtxlimit, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors1_tree, hf_uarterror, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors1_tree, hf_lostcts, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors1_tree, hf_underrun, tvb, 0, 0, errors2); + proto_tree_add_bitmask_list_value(sita_errors2_tree, tvb, 0, 0, errors2_flags, errors2); } } diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index 01dcb88650..9ce5fb651e 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -1323,20 +1323,24 @@ typedef struct _smb_uid_t { static void smb_file_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 mask) { + static const int * mask_flags[] = { + &hf_smb_file_access_mask_write_attribute, + &hf_smb_file_access_mask_read_attribute, + &hf_smb_file_access_mask_execute, + &hf_smb_file_access_mask_write_ea, + &hf_smb_file_access_mask_read_ea, + &hf_smb_file_access_mask_append_data, + &hf_smb_file_access_mask_write_data, + &hf_smb_file_access_mask_read_data, + NULL + }; + mask &= 0x0000ffff; if (mask == 0x000001ff) { proto_tree_add_uint(tree, hf_smb_file_access_mask_full_control, tvb, offset, 4, mask); } - - proto_tree_add_boolean(tree, hf_smb_file_access_mask_write_attribute, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_file_access_mask_read_attribute, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_file_access_mask_execute, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_file_access_mask_write_ea, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_file_access_mask_read_ea, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_file_access_mask_append_data, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_file_access_mask_write_data, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_file_access_mask_read_data, tvb, offset, 4, mask); + proto_tree_add_bitmask_list_value(tree, tvb, offset, 4, mask_flags, mask); } struct access_mask_info smb_file_access_mask_info = { "FILE", /* Name of specific rights */ @@ -1349,20 +1353,25 @@ struct access_mask_info smb_file_access_mask_info = { static void smb_dir_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 mask) { + static const int * mask_flags[] = { + &hf_smb_dir_access_mask_write_attribute, + &hf_smb_dir_access_mask_read_attribute, + &hf_smb_dir_access_mask_delete_child, + &hf_smb_dir_access_mask_traverse, + &hf_smb_dir_access_mask_write_ea, + &hf_smb_dir_access_mask_read_ea, + &hf_smb_dir_access_mask_add_subdir, + &hf_smb_dir_access_mask_add_file, + &hf_smb_dir_access_mask_list, + NULL + }; + mask &= 0x0000ffff; if (mask == 0x000001ff) { proto_tree_add_uint(tree, hf_smb_dir_access_mask_full_control, tvb, offset, 4, mask); } - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_write_attribute, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_read_attribute, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_delete_child, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_traverse, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_write_ea, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_read_ea, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_add_subdir, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_add_file, tvb, offset, 4, mask); - proto_tree_add_boolean(tree, hf_smb_dir_access_mask_list, tvb, offset, 4, mask); + proto_tree_add_bitmask_list_value(tree, tvb, offset, 4, mask_flags, mask); } struct access_mask_info smb_dir_access_mask_info = { "DIR", /* Name of specific rights */ diff --git a/epan/dissectors/packet-windows-common.c b/epan/dissectors/packet-windows-common.c index c63f15c655..ae17f5d8f5 100644 --- a/epan/dissectors/packet-windows-common.c +++ b/epan/dissectors/packet-windows-common.c @@ -1691,6 +1691,45 @@ dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *subtree, *generic_tree, *standard_tree, *specific_tree; guint32 access; + static const int * generic_access_flags[] = { + &hf_access_generic_read, + &hf_access_generic_write, + &hf_access_generic_execute, + &hf_access_generic_all, + &hf_access_maximum_allowed, + &hf_access_sacl, + NULL + }; + + static const int * standard_access_flags[] = { + &hf_access_standard_synchronise, + &hf_access_standard_write_owner, + &hf_access_standard_write_dac, + &hf_access_standard_read_control, + &hf_access_standard_delete, + NULL + }; + + static const int * access_specific_flags[] = { + &hf_access_specific_15, + &hf_access_specific_14, + &hf_access_specific_13, + &hf_access_specific_12, + &hf_access_specific_11, + &hf_access_specific_10, + &hf_access_specific_9, + &hf_access_specific_8, + &hf_access_specific_7, + &hf_access_specific_6, + &hf_access_specific_5, + &hf_access_specific_4, + &hf_access_specific_3, + &hf_access_specific_2, + &hf_access_specific_1, + &hf_access_specific_0, + NULL + }; + if (drep != NULL) { /* * Called from a DCE RPC protocol dissector, for a @@ -1725,33 +1764,7 @@ dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo, ett_nt_access_mask_generic, NULL, "Generic rights: 0x%08x", access & GENERIC_RIGHTS_MASK); - proto_tree_add_boolean( - generic_tree, hf_access_generic_read, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - generic_tree, hf_access_generic_write, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - generic_tree, hf_access_generic_execute, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - generic_tree, hf_access_generic_all, tvb, offset - 4, 4, - access); - - /* Reserved (??) */ - - proto_tree_add_boolean( - subtree, hf_access_maximum_allowed, tvb, offset - 4, 4, - access); - - /* Access system security */ - - proto_tree_add_boolean( - subtree, hf_access_sacl, tvb, offset - 4, 4, - access); + proto_tree_add_bitmask_list_value(generic_tree, tvb, offset - 4, 4, generic_access_flags, access); /* Standard access rights */ @@ -1759,25 +1772,7 @@ dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo, ett_nt_access_mask_standard, NULL, "Standard rights: 0x%08x", access & STANDARD_RIGHTS_MASK); - proto_tree_add_boolean( - standard_tree, hf_access_standard_synchronise, tvb, - offset - 4, 4, access); - - proto_tree_add_boolean( - standard_tree, hf_access_standard_write_owner, tvb, - offset - 4, 4, access); - - proto_tree_add_boolean( - standard_tree, hf_access_standard_write_dac, tvb, - offset - 4, 4, access); - - proto_tree_add_boolean( - standard_tree, hf_access_standard_read_control, tvb, - offset - 4, 4, access); - - proto_tree_add_boolean( - standard_tree, hf_access_standard_delete, tvb, offset - 4, 4, - access); + proto_tree_add_bitmask_list_value(standard_tree, tvb, offset - 4, 4, standard_access_flags, access); /* Specific access rights. Call the specific_rights_fn pointer if we have one, otherwise just display bits 0-15 in @@ -1818,69 +1813,7 @@ dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo, return offset; } - proto_tree_add_boolean( - specific_tree, hf_access_specific_15, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_14, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_13, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_12, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_11, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_10, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_9, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_8, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_7, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_6, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_5, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_4, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_3, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_2, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_1, tvb, offset - 4, 4, - access); - - proto_tree_add_boolean( - specific_tree, hf_access_specific_0, tvb, offset - 4, 4, - access); + proto_tree_add_bitmask_list_value(specific_tree, tvb, offset - 4, 4, access_specific_flags, access); return offset; }