aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-12-01 00:18:41 -0500
committerAnders Broman <a.broman58@gmail.com>2014-12-01 12:18:44 +0000
commite77507b0eac903e74389ef1bf2dfa51d4cf00aad (patch)
treed9a99ae5315842fd1d3cc957c8adac50a779e5ed /epan
parent542439e64aef746512a5a8d3835e49805087c706 (diff)
Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.
Part 3 of many, but this concludes the strict conversion to proto_tree_add_bitmask. Patches to follow with use proto_tree_add_bitmask_xxx (some functions still need to be written) Change-Id: Ic2435667c6a7f1d40602124e5044954d2a296180 Reviewed-on: https://code.wireshark.org/review/5553 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')
-rw-r--r--epan/dissectors/packet-oampdu.c78
-rw-r--r--epan/dissectors/packet-pcep.c24
-rw-r--r--epan/dissectors/packet-ppp.c102
-rw-r--r--epan/dissectors/packet-q2931.c37
-rw-r--r--epan/dissectors/packet-q933.c12
-rw-r--r--epan/dissectors/packet-radius_packetcable.c1
-rw-r--r--epan/dissectors/packet-rsvp.c43
-rw-r--r--epan/dissectors/packet-rx.c33
-rw-r--r--epan/dissectors/packet-ses.c275
-rw-r--r--epan/dissectors/packet-smb-browse.c82
-rw-r--r--epan/dissectors/packet-smb-direct.c15
-rw-r--r--epan/dissectors/packet-smb.c1024
-rw-r--r--epan/dissectors/packet-smb2.c89
-rw-r--r--epan/dissectors/packet-sna.c26
-rw-r--r--epan/dissectors/packet-spnego.c50
-rw-r--r--epan/dissectors/packet-srvloc.c48
-rw-r--r--epan/dissectors/packet-telnet.c5
-rw-r--r--epan/dissectors/packet-tr.c28
-rw-r--r--epan/dissectors/packet-usb-video.c14
-rw-r--r--epan/dissectors/packet-winsrepl.c18
-rw-r--r--epan/dissectors/packet-wsp.c65
-rw-r--r--epan/dissectors/packet-ypserv.c14
-rw-r--r--epan/dissectors/packet-zbee-nwk.c40
-rw-r--r--epan/dissectors/packet-zbee-zcl.c32
-rw-r--r--epan/dissectors/packet-zebra.c28
25 files changed, 798 insertions, 1385 deletions
diff --git a/epan/dissectors/packet-oampdu.c b/epan/dissectors/packet-oampdu.c
index a17b94ec56..3495736815 100644
--- a/epan/dissectors/packet-oampdu.c
+++ b/epan/dissectors/packet-oampdu.c
@@ -1182,7 +1182,6 @@ dissect_oampdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
{
- guint16 raw_word;
guint8 raw_octet;
guint8 info_type;
guint32 offset;
@@ -1192,10 +1191,6 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
proto_tree *info_tree;
proto_item *info_item;
- proto_tree *state_tree;
- proto_item *state_item;
- proto_tree *cfg_tree;
- proto_item *cfg_item;
proto_item *oui_item;
proto_item *item;
@@ -1234,72 +1229,55 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
if ((info_type==OAMPDU_INFO_TYPE_LOCAL)||(info_type==OAMPDU_INFO_TYPE_REMOTE))
{
- raw_octet = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(info_tree, hf_oampdu_info_len,
- tvb, offset, 1, raw_octet);
+ static const int * info_states[] = {
+ &hf_oampdu_info_state_parser,
+ &hf_oampdu_info_state_mux,
+ NULL
+ };
+ static const int * info_config[] = {
+ &hf_oampdu_info_oamConfig_mode,
+ &hf_oampdu_info_oamConfig_uni,
+ &hf_oampdu_info_oamConfig_lpbk,
+ &hf_oampdu_info_oamConfig_event,
+ &hf_oampdu_info_oamConfig_var,
+ NULL
+ };
+
+ proto_tree_add_item(info_tree, hf_oampdu_info_len,
+ tvb, offset, 1, ENC_NA);
offset += OAMPDU_INFO_LENGTH_SZ;
- raw_octet = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(info_tree, hf_oampdu_info_version,
- tvb, offset, 1, raw_octet);
+ proto_tree_add_item(info_tree, hf_oampdu_info_version,
+ tvb, offset, 1, ENC_NA);
offset += OAMPDU_INFO_VERSION_SZ;
- raw_word = tvb_get_ntohs(tvb, offset);
- proto_tree_add_uint(info_tree, hf_oampdu_info_revision,
- tvb, offset, 2, raw_word);
+ proto_tree_add_item(info_tree, hf_oampdu_info_revision,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
offset += OAMPDU_INFO_REVISION_SZ;
/* Build OAM State field field */
raw_octet = tvb_get_guint8(tvb, offset);
- state_item = proto_tree_add_uint(info_tree, hf_oampdu_info_state,
- tvb, offset, 1, raw_octet);
-
if (raw_octet == OAMPDU_INFO_TYPE_LOCAL)
- state_tree = proto_item_add_subtree(state_item, ett_oampdu_local_info_state);
+ proto_tree_add_bitmask(info_tree, tvb, offset, hf_oampdu_info_state, ett_oampdu_local_info_state, info_states, ENC_NA);
else
- state_tree = proto_item_add_subtree(state_item, ett_oampdu_remote_info_state);
-
- proto_tree_add_uint(state_tree, hf_oampdu_info_state_parser,
- tvb, offset, 1, raw_octet);
-
- proto_tree_add_boolean(state_tree, hf_oampdu_info_state_mux,
- tvb, offset, 1, raw_octet);
+ proto_tree_add_bitmask(info_tree, tvb, offset, hf_oampdu_info_state, ett_oampdu_remote_info_state, info_states, ENC_NA);
offset += OAMPDU_INFO_STATE_SZ;
/* Build OAM configuration field */
raw_octet = tvb_get_guint8(tvb, offset);
- cfg_item = proto_tree_add_uint(info_tree, hf_oampdu_info_oamConfig,
- tvb, offset, 1, raw_octet);
-
if (raw_octet == OAMPDU_INFO_TYPE_LOCAL)
- cfg_tree = proto_item_add_subtree(cfg_item, ett_oampdu_local_info_config);
+ proto_tree_add_bitmask(info_tree, tvb, offset, hf_oampdu_info_oamConfig, ett_oampdu_local_info_config, info_config, ENC_NA);
else
- cfg_tree = proto_item_add_subtree(cfg_item, ett_oampdu_remote_info_config);
-
- proto_tree_add_boolean(cfg_tree, hf_oampdu_info_oamConfig_mode,
- tvb, offset, 1, raw_octet);
-
- proto_tree_add_boolean(cfg_tree, hf_oampdu_info_oamConfig_uni,
- tvb, offset, 1, raw_octet);
-
- proto_tree_add_boolean(cfg_tree, hf_oampdu_info_oamConfig_lpbk,
- tvb, offset, 1, raw_octet);
-
- proto_tree_add_boolean(cfg_tree, hf_oampdu_info_oamConfig_event,
- tvb, offset, 1, raw_octet);
-
- proto_tree_add_boolean(cfg_tree, hf_oampdu_info_oamConfig_var,
- tvb, offset, 1, raw_octet);
+ proto_tree_add_bitmask(info_tree, tvb, offset, hf_oampdu_info_oamConfig, ett_oampdu_remote_info_config, info_config, ENC_NA);
offset += OAMPDU_INFO_OAM_CONFIG_SZ;
- raw_word = tvb_get_ntohs(tvb, offset);
- item = proto_tree_add_uint(info_tree, hf_oampdu_info_oampduConfig,
- tvb, offset, 2, raw_word);
+ item = proto_tree_add_item(info_tree, hf_oampdu_info_oampduConfig,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(item, " (bytes)");
@@ -1321,8 +1299,8 @@ dissect_oampdu_information(tvbuff_t *tvb, proto_tree *tree)
{
/* see IEEE802.3, section 57.5.2.3 for more details */
raw_octet = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(info_tree, hf_oampdu_info_len,
- tvb, offset, 1, raw_octet);
+ proto_tree_add_item(info_tree, hf_oampdu_info_len,
+ tvb, offset, 1, ENC_NA);
offset += OAMPDU_INFO_LENGTH_SZ;
diff --git a/epan/dissectors/packet-pcep.c b/epan/dissectors/packet-pcep.c
index 22667ac367..2fd61a0b33 100644
--- a/epan/dissectors/packet-pcep.c
+++ b/epan/dissectors/packet-pcep.c
@@ -984,7 +984,7 @@ dissect_pcep_tlvs(proto_tree *pcep_obj, tvbuff_t *tvb, int offset, gint length,
break;
case 17: /* SYMBOLIC-PATH-NAME TLV */
- proto_tree_add_item(tlv, hf_pcep_symbolic_path_name, tvb, offset+4+j, tlv_length, ENC_NA);
+ proto_tree_add_item(tlv, hf_pcep_symbolic_path_name, tvb, offset+4+j, tlv_length, ENC_ASCII|ENC_NA);
break;
case 18: /* IPV4-LSP-IDENTIFIERS TLV */
@@ -1007,7 +1007,7 @@ dissect_pcep_tlvs(proto_tree *pcep_obj, tvbuff_t *tvb, int offset, gint length,
proto_tree_add_item(tlv, hf_pcep_lsp_error_code, tvb, offset+4+j, 4, ENC_NA);
case 21: /* RSVP-ERROR-SPEC TLV */
- proto_tree_add_item(tlv, hf_pcep_rsvp_user_error_spec, tvb, offset+4+j, tlv_length, ENC_NA);
+ proto_tree_add_item(tlv, hf_pcep_rsvp_user_error_spec, tvb, offset+4+j, tlv_length, ENC_ASCII|ENC_NA);
break;
case 23: /* LSP-DB-VERSION TLV */
@@ -1015,7 +1015,7 @@ dissect_pcep_tlvs(proto_tree *pcep_obj, tvbuff_t *tvb, int offset, gint length,
break;
case 24: /* SPEAKER-ENTITY-ID TLV */
- proto_tree_add_item(tlv, hf_pcep_speaker_entity_id, tvb, offset+4+j, tlv_length, ENC_NA);
+ proto_tree_add_item(tlv, hf_pcep_speaker_entity_id, tvb, offset+4+j, tlv_length, ENC_ASCII|ENC_NA);
break;
default:
@@ -1219,11 +1219,9 @@ static void
dissect_subobj_unnumb_interfaceID(proto_tree *pcep_subobj_tree, packet_info *pinfo, tvbuff_t *tvb, int offset, int obj_class, gint ett_pcep_obj, guint length)
{
proto_tree *pcep_subobj_unnumb_interfaceID;
- proto_tree *pcep_subobj_unnumb_interfaceID_flags;
proto_item *ti;
guint32 router_ID;
guint32 interface_ID;
- guint16 reserved_flags;
ti = proto_tree_add_item(pcep_subobj_tree, hf_PCEPF_SUBOBJ_UNNUM_INTERFACEID, tvb, offset, length, ENC_NA);
pcep_subobj_unnumb_interfaceID = proto_item_add_subtree(ti, ett_pcep_obj);
@@ -1234,7 +1232,6 @@ dissect_subobj_unnumb_interfaceID(proto_tree *pcep_subobj_tree, packet_info *pin
return;
}
- reserved_flags = tvb_get_ntohs(tvb, offset+2);
router_ID = tvb_get_ipv4(tvb, offset+4);
interface_ID = tvb_get_ntohl(tvb, offset+8);
proto_item_append_text(ti, ": %s:%u", ip_to_str ((guint8 *) &router_ID),
@@ -1250,15 +1247,18 @@ dissect_subobj_unnumb_interfaceID(proto_tree *pcep_subobj_tree, packet_info *pin
break;
case PCEP_RECORD_ROUTE_OBJ:
+ {
+ static const int * flags[] = {
+ &pcep_subobj_flags_lpa,
+ &pcep_subobj_flags_lpu,
+ NULL
+ };
+
proto_tree_add_item(pcep_subobj_unnumb_interfaceID, hf_PCEPF_SUBOBJ, tvb, offset, 1, ENC_NA);
proto_tree_add_item(pcep_subobj_unnumb_interfaceID, hf_pcep_subobj_unnumb_interfaceID_length, tvb, offset+1, 1, ENC_NA);
-
- ti = proto_tree_add_item(pcep_subobj_unnumb_interfaceID, hf_pcep_subobj_unnumb_interfaceID_flags, tvb, offset+2, 2, ENC_BIG_ENDIAN);
- pcep_subobj_unnumb_interfaceID_flags = proto_item_add_subtree(ti, ett_pcep_obj);
- proto_tree_add_boolean(pcep_subobj_unnumb_interfaceID_flags, pcep_subobj_flags_lpa, tvb, offset+2, 1, (reserved_flags & 0xff00)>>8);
- proto_tree_add_boolean(pcep_subobj_unnumb_interfaceID_flags, pcep_subobj_flags_lpu, tvb, offset+2, 1, (reserved_flags & 0xff00)>>8);
-
+ proto_tree_add_bitmask(pcep_subobj_unnumb_interfaceID, tvb, offset+2, hf_pcep_subobj_unnumb_interfaceID_flags, ett_pcep_obj, flags, ENC_BIG_ENDIAN);
proto_tree_add_item(pcep_subobj_unnumb_interfaceID, hf_pcep_subobj_unnumb_interfaceID_reserved_rrobj, tvb, offset+3, 1, ENC_NA);
+ }
break;
case PCEP_IRO_OBJ:
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index 81759814d1..835810ef44 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -268,6 +268,7 @@ static gint ett_pppmux_subframe_flags = -1;
static gint ett_pppmux_subframe_info = -1;
static int proto_mp = -1;
+static int hf_mp_frag = -1;
static int hf_mp_frag_first = -1;
static int hf_mp_frag_last = -1;
static int hf_mp_short_sequence_num_reserved = -1;
@@ -4109,13 +4110,20 @@ static const value_string bcp_mac_type_vals[] = {
static void
dissect_bcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_item *ti, *flags_item;
- proto_tree *bcp_tree, *flags_tree;
+ proto_item *ti;
+ proto_tree *bcp_tree;
int offset = 0;
guint8 flags;
guint8 mac_type;
gint captured_length, reported_length, pad_length;
tvbuff_t *next_tvb;
+ static const int * bcp_flags[] = {
+ &hf_bcp_fcs_present,
+ &hf_bcp_zeropad,
+ &hf_bcp_bcontrol,
+ &hf_bcp_pads,
+ NULL
+ };
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP BCP");
col_clear(pinfo->cinfo, COL_INFO);
@@ -4127,18 +4135,8 @@ dissect_bcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (flags & BCP_IS_BCONTROL) {
col_set_str(pinfo->cinfo, COL_INFO, "Bridge control");
}
- if (tree) {
- flags_item = proto_tree_add_uint(bcp_tree, hf_bcp_flags, tvb, offset,
- 1, flags);
- flags_tree = proto_item_add_subtree(flags_item, ett_bcp_flags);
- proto_tree_add_boolean(flags_tree, hf_bcp_fcs_present, tvb, offset,
- 1, flags);
- proto_tree_add_boolean(flags_tree, hf_bcp_zeropad, tvb, offset, 1,
- flags);
- proto_tree_add_boolean(flags_tree, hf_bcp_bcontrol, tvb, offset, 1,
- flags);
- proto_tree_add_uint(flags_tree, hf_bcp_pads, tvb, offset, 1, flags);
- }
+
+ proto_tree_add_bitmask(bcp_tree, tvb, offset, hf_bcp_flags, ett_bcp_flags, bcp_flags, ENC_NA);
offset++;
mac_type = tvb_get_guint8(tvb, offset);
@@ -4725,12 +4723,18 @@ dissect_cdpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static gboolean mp_short_seqno = FALSE; /* Default to long sequence numbers */
#define MP_FRAG_MASK 0xC0
-#define MP_FRAG(bits) ((bits) & MP_FRAG_MASK)
#define MP_FRAG_FIRST 0x80
#define MP_FRAG_LAST 0x40
#define MP_FRAG_RESERVED 0x3f
#define MP_FRAG_RESERVED_SHORT 0x30
+static const value_string mp_frag_vals[] = {
+ { MP_FRAG_FIRST, "First" },
+ { MP_FRAG_LAST, "Last" },
+ { MP_FRAG_FIRST|MP_FRAG_LAST, "First, Last" },
+ { 0, NULL }
+};
+
/* According to RFC 1990, the length the MP header isn't indicated anywhere
in the header itself. It starts out at four bytes and can be
negotiated down to two using LCP. We currently have a preference
@@ -4739,56 +4743,37 @@ static gboolean mp_short_seqno = FALSE; /* Default to long sequence numbers */
static void
dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_tree *mp_tree = NULL, *hdr_tree;
- proto_item *ti = NULL;
- guint8 flags;
- const gchar *flag_str;
+ proto_tree *mp_tree;
+ proto_item *ti;
gint hdrlen;
tvbuff_t *next_tvb;
+ static const int * mp_flags[] = {
+ &hf_mp_frag_first,
+ &hf_mp_frag_last,
+ &hf_mp_sequence_num_reserved,
+ NULL
+ };
+ static const int * mp_short_flags[] = {
+ &hf_mp_frag_first,
+ &hf_mp_frag_last,
+ &hf_mp_short_sequence_num_reserved,
+ NULL
+ };
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP MP");
col_set_str(pinfo->cinfo, COL_INFO, "PPP Multilink");
- if (tree) {
- ti = proto_tree_add_item(tree, proto_mp, tvb, 0,
+ ti = proto_tree_add_item(tree, proto_mp, tvb, 0,
mp_short_seqno ? 2 : 4, ENC_NA);
- mp_tree = proto_item_add_subtree(ti, ett_mp);
- }
-
- flags = tvb_get_guint8(tvb, 0);
+ mp_tree = proto_item_add_subtree(ti, ett_mp);
- if (tree) {
- switch (MP_FRAG(flags)) {
- case MP_FRAG_FIRST:
- flag_str = "First";
- break;
- case MP_FRAG_LAST:
- flag_str = "Last";
- break;
- case MP_FRAG_FIRST|MP_FRAG_LAST:
- flag_str = "First, Last";
- break;
- default:
- flag_str = "Unknown";
- break;
- }
- ti = proto_tree_add_text(mp_tree, tvb, 0, 1, "Fragment: 0x%2X (%s)",
- MP_FRAG(flags), flag_str);
- hdr_tree = proto_item_add_subtree(ti, ett_mp_flags);
-
- proto_tree_add_boolean(hdr_tree, hf_mp_frag_first, tvb, 0, 1, flags);
- proto_tree_add_boolean(hdr_tree, hf_mp_frag_last, tvb, 0, 1, flags);
- if (mp_short_seqno) {
- proto_tree_add_item(hdr_tree, hf_mp_short_sequence_num_reserved, tvb, 0, 1,
- ENC_BIG_ENDIAN);
- proto_tree_add_item(mp_tree, hf_mp_short_sequence_num, tvb, 0, 2,
- ENC_BIG_ENDIAN);
- } else {
- proto_tree_add_item(hdr_tree, hf_mp_sequence_num_reserved, tvb, 0, 1,
- ENC_BIG_ENDIAN);
- proto_tree_add_item(mp_tree, hf_mp_sequence_num, tvb, 1, 3,
- ENC_BIG_ENDIAN);
- }
+ if (mp_short_seqno) {
+ proto_tree_add_bitmask(mp_tree, tvb, 0, hf_mp_frag, ett_mp_flags, mp_short_flags, ENC_NA);
+ proto_tree_add_item(mp_tree, hf_mp_short_sequence_num, tvb, 0, 2, ENC_BIG_ENDIAN);
+ } else {
+ proto_tree_add_bitmask(mp_tree, tvb, 0, hf_mp_frag, ett_mp_flags, mp_flags, ENC_NA);
+ proto_tree_add_item(mp_tree, hf_mp_sequence_num, tvb, 1, 3,
+ ENC_BIG_ENDIAN);
}
hdrlen = mp_short_seqno ? 2 : 4;
@@ -5496,6 +5481,9 @@ void
proto_register_mp(void)
{
static hf_register_info hf[] = {
+ { &hf_mp_frag,
+ { "Fragment", "mp.frag", FT_UINT8, BASE_HEX,
+ VALS(mp_frag_vals), MP_FRAG_MASK, NULL, HFILL }},
{ &hf_mp_frag_first,
{ "First fragment", "mp.first", FT_BOOLEAN, 8,
TFS(&tfs_yes_no), MP_FRAG_FIRST, NULL, HFILL }},
diff --git a/epan/dissectors/packet-q2931.c b/epan/dissectors/packet-q2931.c
index 541b5000e9..0a7e3e132e 100644
--- a/epan/dissectors/packet-q2931.c
+++ b/epan/dissectors/packet-q2931.c
@@ -1888,7 +1888,6 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int offset = 0;
proto_tree *q2931_tree = NULL;
proto_item *ti;
- proto_tree *ext_tree;
guint8 call_ref_len;
guint8 call_ref[15];
guint8 message_type;
@@ -1901,6 +1900,15 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int codeset;
gboolean non_locking_shift;
#endif
+ static const int * ext_flags[] = {
+ &hf_q2931_message_flag,
+ NULL
+ };
+ static const int * ext_flags_follow_inst[] = {
+ &hf_q2931_message_flag,
+ &hf_q2931_message_action_indicator,
+ NULL
+ };
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.2931");
@@ -1918,12 +1926,10 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 1;
if (call_ref_len != 0) {
tvb_memcpy(tvb, call_ref, offset, call_ref_len);
- if (q2931_tree != NULL) {
- proto_tree_add_boolean(q2931_tree, hf_q2931_call_ref_flag,
- tvb, offset, 1, (call_ref[0] & 0x80) != 0);
- call_ref[0] &= 0x7F;
- proto_tree_add_bytes(q2931_tree, hf_q2931_call_ref, tvb, offset, call_ref_len, call_ref);
- }
+ proto_tree_add_boolean(q2931_tree, hf_q2931_call_ref_flag,
+ tvb, offset, 1, (call_ref[0] & 0x80) != 0);
+ call_ref[0] &= 0x7F;
+ proto_tree_add_bytes(q2931_tree, hf_q2931_call_ref, tvb, offset, call_ref_len, call_ref);
offset += call_ref_len;
}
message_type = tvb_get_guint8(tvb, offset);
@@ -1931,21 +1937,14 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str_ext(message_type, &q2931_message_type_vals_ext,
"Unknown message type (0x%02X)"));
- if (q2931_tree != NULL)
- proto_tree_add_uint(q2931_tree, hf_q2931_message_type, tvb, offset, 1, message_type);
+ proto_tree_add_uint(q2931_tree, hf_q2931_message_type, tvb, offset, 1, message_type);
offset += 1;
message_type_ext = tvb_get_guint8(tvb, offset);
- if (q2931_tree != NULL) {
- ti = proto_tree_add_uint(q2931_tree, hf_q2931_message_type_ext, tvb,
- offset, 1, message_type_ext);
- ext_tree = proto_item_add_subtree(ti, ett_q2931_ext);
- proto_tree_add_boolean(ext_tree, hf_q2931_message_flag, tvb,
- offset, 1, message_type_ext);
- if (message_type_ext & Q2931_MSG_TYPE_EXT_FOLLOW_INST) {
- proto_tree_add_uint(ext_tree, hf_q2931_message_action_indicator, tvb,
- offset, 1, message_type_ext);
- }
+ if (message_type_ext & Q2931_MSG_TYPE_EXT_FOLLOW_INST) {
+ proto_tree_add_bitmask(q2931_tree, tvb, offset, hf_q2931_message_type_ext, ett_q2931_ext, ext_flags_follow_inst, ENC_NA);
+ } else {
+ proto_tree_add_bitmask(q2931_tree, tvb, offset, hf_q2931_message_type_ext, ett_q2931_ext, ext_flags, ENC_NA);
}
offset += 1;
diff --git a/epan/dissectors/packet-q933.c b/epan/dissectors/packet-q933.c
index 78fa31cca4..c7e29aacc9 100644
--- a/epan/dissectors/packet-q933.c
+++ b/epan/dissectors/packet-q933.c
@@ -1820,13 +1820,11 @@ dissect_q933(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 1;
if (call_ref_len != 0) {
tvb_memcpy(tvb, call_ref, offset, call_ref_len);
- if (q933_tree != NULL) {
- proto_tree_add_boolean(q933_tree, hf_q933_call_ref_flag,
- tvb, offset, 1, (call_ref[0] & 0x80) != 0);
- call_ref[0] &= 0x7F;
- proto_tree_add_bytes(q933_tree, hf_q933_call_ref,
- tvb, offset, call_ref_len, call_ref);
- }
+ proto_tree_add_boolean(q933_tree, hf_q933_call_ref_flag,
+ tvb, offset, 1, (call_ref[0] & 0x80) != 0);
+ call_ref[0] &= 0x7F;
+ proto_tree_add_bytes(q933_tree, hf_q933_call_ref,
+ tvb, offset, call_ref_len, call_ref);
offset += call_ref_len;
}
message_type = tvb_get_guint8(tvb, offset);
diff --git a/epan/dissectors/packet-radius_packetcable.c b/epan/dissectors/packet-radius_packetcable.c
index 1fa941f9a9..9df03463f3 100644
--- a/epan/dissectors/packet-radius_packetcable.c
+++ b/epan/dissectors/packet-radius_packetcable.c
@@ -395,6 +395,7 @@ static const gchar* dissect_packetcable_surv_df_sec(proto_tree* tree _U_, tvbuff
#define PACKETCABLE_MESSAGE_WAITING (1 << 3)
static const gchar* dissect_packetcable_term_dsply_info(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo _U_) {
+ /* XXX - this logic seems buggy because the offsets don't line up */
guint8 bitmask = tvb_get_guint8(tvb, 2);
guint intval = 1;
proto_item* ti = proto_tree_add_item(tree, hf_packetcable_terminal_display_info_terminal_display_status_bitmask,
diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c
index 6d67befa5c..ed71a2725f 100644
--- a/epan/dissectors/packet-rsvp.c
+++ b/epan/dissectors/packet-rsvp.c
@@ -5095,42 +5095,27 @@ dissect_rsvp_admin_status(proto_tree *ti, proto_tree *rsvp_object_tree,
int rsvp_class _U_, int type)
{
int offset2 = offset + 4;
- proto_tree *ti2, *rsvp_admin_subtree;
guint32 status;
+ static const int * status_flags[] = {
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_REFLECT],
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_HANDOVER],
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_LOCKOUT],
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_INHIBIT],
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_CALL_MGMT],
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_TESTING],
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_DOWN],
+ &hf_rsvp_filter[RSVPF_ADMIN_STATUS_DELETE],
+ NULL
+ };
proto_item_set_text(ti, "ADMIN STATUS: ");
switch(type) {
case 1:
proto_tree_add_uint(rsvp_object_tree, hf_rsvp_ctype, tvb, offset+3, 1, type);
status = tvb_get_ntohl(tvb, offset2);
- ti2 = proto_tree_add_item(rsvp_object_tree, hf_rsvp_admin_status, tvb, offset2, 4, ENC_BIG_ENDIAN);
- rsvp_admin_subtree =
- proto_item_add_subtree(ti2, TREE(TT_ADMIN_STATUS_FLAGS));
-
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_REFLECT],
- tvb, offset2, 4, status);
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_HANDOVER],
- tvb, offset2, 4, status);
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_LOCKOUT],
- tvb, offset2, 4, status);
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_INHIBIT],
- tvb, offset2, 4, status);
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_CALL_MGMT],
- tvb, offset2, 4, status);
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_TESTING],
- tvb, offset2, 4, status);
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_DOWN],
- tvb, offset2, 4, status);
- proto_tree_add_boolean(rsvp_admin_subtree,
- hf_rsvp_filter[RSVPF_ADMIN_STATUS_DELETE],
- tvb, offset2, 4, status);
+
+ proto_tree_add_bitmask(rsvp_object_tree, tvb, offset2, hf_rsvp_admin_status, TREE(TT_ADMIN_STATUS_FLAGS), status_flags, ENC_BIG_ENDIAN);
+
proto_item_set_text(ti, "ADMIN-STATUS: %s%s%s%s%s%s%s%s",
(status & (1<<31)) ? "Reflect " : "",
(status & (1<<6)) ? "Handover " : "",
diff --git a/epan/dissectors/packet-rx.c b/epan/dissectors/packet-rx.c
index a934be7a9a..531f4f7784 100644
--- a/epan/dissectors/packet-rx.c
+++ b/epan/dissectors/packet-rx.c
@@ -412,27 +412,18 @@ dissect_rx_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int
static int
dissect_rx_flags(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *parent_tree, int offset)
{
- proto_tree *tree;
- proto_item *item;
- guint8 flags;
-
- flags = tvb_get_guint8(tvb, offset);
- rxinfo->flags = flags;
-
- item = proto_tree_add_uint(parent_tree, hf_rx_flags, tvb,
- offset, 1, flags);
- tree = proto_item_add_subtree(item, ett_rx_flags);
-
- proto_tree_add_boolean(tree, hf_rx_flags_free_packet, tvb,
- offset, 1, flags);
- proto_tree_add_boolean(tree, hf_rx_flags_more_packets, tvb,
- offset, 1, flags);
- proto_tree_add_boolean(tree, hf_rx_flags_last_packet, tvb,
- offset, 1, flags);
- proto_tree_add_boolean(tree, hf_rx_flags_request_ack, tvb,
- offset, 1, flags);
- proto_tree_add_boolean(tree, hf_rx_flags_clientinit, tvb,
- offset, 1, flags);
+ static const int * flags[] = {
+ &hf_rx_flags_free_packet,
+ &hf_rx_flags_more_packets,
+ &hf_rx_flags_last_packet,
+ &hf_rx_flags_request_ack,
+ &hf_rx_flags_clientinit,
+ NULL
+ };
+
+ rxinfo->flags = tvb_get_guint8(tvb, offset);
+
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_rx_flags, ett_rx_flags, flags, ENC_NA);
offset += 1;
return offset;
diff --git a/epan/dissectors/packet-ses.c b/epan/dissectors/packet-ses.c
index 6111634120..3f5068b3cd 100644
--- a/epan/dissectors/packet-ses.c
+++ b/epan/dissectors/packet-ses.c
@@ -80,6 +80,7 @@ static int hf_enclosure_item_options_flags = -1;
static int hf_token_item_options_flags = -1;
static gint ett_connect_protocol_options_flags = -1;
+static gint ett_transport_options_flags = -1;
static gint ett_protocol_version_flags = -1;
static gint ett_enclosure_item_flags = -1;
static gint ett_token_item_flags = -1;
@@ -190,6 +191,7 @@ static int hf_ses_transport_protocol_error = -1;
static int hf_ses_transport_user_abort = -1;
static int hf_ses_parameter_length = -1;
static int hf_ses_transport_connection = -1;
+static int hf_ses_transport_option_flags = -1;
/* clses header fields */
static int proto_clses = -1;
@@ -391,9 +393,54 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
{
gboolean has_user_information = TRUE;
guint16 flags;
- proto_item *tf;
- proto_tree *flags_tree;
asn1_ctx_t asn1_ctx;
+ static const int * item_option_flags[] = {
+ &hf_release_token,
+ &hf_major_activity_token,
+ &hf_synchronize_minor_token,
+ &hf_data_token,
+ NULL
+ };
+ static const int * transport_option_flags[] = {
+ &hf_ses_transport_connection,
+ &hf_ses_transport_user_abort,
+ &hf_ses_transport_protocol_error,
+ &hf_ses_transport_no_reason,
+ &hf_ses_transport_implementation_restriction,
+ NULL
+ };
+ static const int * protocol_options_flags[] = {
+ &hf_able_to_receive_extended_concatenated_SPDU,
+ NULL
+ };
+ static const int * req_options_flags[] = {
+ &hf_session_exception_report,
+ &hf_data_separation_function_unit,
+ &hf_symmetric_synchronize_function_unit,
+ &hf_typed_data_function_unit,
+ &hf_exception_function_unit,
+ &hf_capability_function_unit,
+ &hf_negotiated_release_function_unit,
+ &hf_activity_management_function_unit,
+ &hf_resynchronize_function_unit,
+ &hf_major_resynchronize_function_unit,
+ &hf_minor_resynchronize_function_unit,
+ &hf_expedited_data_resynchronize_function_unit,
+ &hf_duplex_function_unit,
+ &hf_half_duplex_function_unit,
+ NULL
+ };
+ static const int * version_flags[] = {
+ &hf_protocol_version_2,
+ &hf_protocol_version_1,
+ NULL
+ };
+ static const int * enclosure_flags[] = {
+ &hf_end_of_SSDU,
+ &hf_beginning_of_SSDU,
+ NULL
+ };
+
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
switch (param_type)
@@ -401,45 +448,37 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
case Called_SS_user_Reference:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_called_ss_user_reference,
tvb, offset, param_len, ENC_NA);
- }
break;
case Calling_SS_user_Reference:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_calling_ss_user_reference,
tvb, offset, param_len, ENC_NA);
- }
break;
case Common_Reference:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_common_reference,
tvb, offset, param_len, ENC_NA);
- }
break;
case Additional_Reference_Information:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_additional_reference_information,
tvb, offset, param_len, ENC_NA);
- }
break;
case Token_Item:
@@ -449,23 +488,8 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
"Length is %u, should be 1", param_len);
break;
}
- if (tree)
- {
- flags = tvb_get_guint8(tvb, offset);
- tf = proto_tree_add_uint(param_tree,
- hf_token_item_options_flags, tvb, offset, 1,
- flags);
- flags_tree = proto_item_add_subtree(tf,
- ett_token_item_flags);
- proto_tree_add_boolean(flags_tree, hf_release_token,
- tvb, offset, 1, flags);
- proto_tree_add_boolean(flags_tree,
- hf_major_activity_token, tvb, offset, 1, flags);
- proto_tree_add_boolean(flags_tree,
- hf_synchronize_minor_token, tvb, offset, 1, flags);
- proto_tree_add_boolean(flags_tree, hf_data_token, tvb,
- offset, 1, flags);
- }
+
+ proto_tree_add_bitmask(param_tree, tvb, offset, hf_token_item_options_flags, ett_token_item_flags, item_option_flags, ENC_NA);
break;
case Transport_Disconnect:
@@ -475,27 +499,15 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
"Length is %u, should be 1", param_len);
break;
}
- if (tree)
- {
- guint8 flags8;
-
- flags8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(param_tree, hf_ses_transport_connection, tvb, offset, 1, ENC_NA);
-
- proto_tree_add_item(param_tree, hf_ses_transport_user_abort, tvb, offset, 1, ENC_NA);
- if(flags8 & user_abort )
- {
- session->abort_type = SESSION_USER_ABORT;
- }
- else
- {
- session->abort_type = SESSION_PROVIDER_ABORT;
- }
+ proto_tree_add_bitmask(param_tree, tvb, offset, hf_ses_transport_option_flags, ett_transport_options_flags, transport_option_flags, ENC_NA);
-
- proto_tree_add_item(param_tree, hf_ses_transport_protocol_error, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(param_tree, hf_ses_transport_no_reason, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(param_tree, hf_ses_transport_implementation_restriction, tvb, offset, 1, ENC_NA);
+ if(tvb_get_guint8(tvb, offset) & user_abort )
+ {
+ session->abort_type = SESSION_USER_ABORT;
+ }
+ else
+ {
+ session->abort_type = SESSION_PROVIDER_ABORT;
}
break;
@@ -506,18 +518,8 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
"Length is %u, should be 1", param_len);
break;
}
- if (tree)
- {
- flags = tvb_get_guint8(tvb, offset);
- tf = proto_tree_add_uint(param_tree,
- hf_connect_protocol_options_flags, tvb, offset, 1,
- flags);
- flags_tree = proto_item_add_subtree(tf,
- ett_connect_protocol_options_flags);
- proto_tree_add_boolean(flags_tree,
- hf_able_to_receive_extended_concatenated_SPDU,
- tvb, offset, 1, flags);
- }
+
+ proto_tree_add_bitmask(param_tree, tvb, offset, hf_connect_protocol_options_flags, ett_connect_protocol_options_flags, protocol_options_flags, ENC_NA);
break;
case Session_Requirement:
@@ -527,52 +529,7 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
"Length is %u, should be 2", param_len);
break;
}
- if (tree)
- {
- flags = tvb_get_ntohs(tvb, offset);
- tf = proto_tree_add_uint(param_tree,
- hf_session_user_req_flags, tvb, offset, 2,
- flags);
- flags_tree = proto_item_add_subtree(tf,
- ett_ses_req_options_flags);
- proto_tree_add_boolean(flags_tree,
- hf_session_exception_report, tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_data_separation_function_unit, tvb, offset, 2,
- flags);
- proto_tree_add_boolean(flags_tree,
- hf_symmetric_synchronize_function_unit,
- tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_typed_data_function_unit, tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_exception_function_unit, tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_capability_function_unit, tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_negotiated_release_function_unit,
- tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_activity_management_function_unit,
- tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_resynchronize_function_unit, tvb, offset, 2,
- flags);
- proto_tree_add_boolean(flags_tree,
- hf_major_resynchronize_function_unit,
- tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_minor_resynchronize_function_unit,
- tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_expedited_data_resynchronize_function_unit,
- tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_duplex_function_unit, tvb, offset, 2, flags);
- proto_tree_add_boolean(flags_tree,
- hf_half_duplex_function_unit,
- tvb, offset, 2, flags);
- }
+ proto_tree_add_bitmask(param_tree, tvb, offset, hf_session_user_req_flags, ett_ses_req_options_flags, req_options_flags, ENC_BIG_ENDIAN);
break;
case TSDU_Maximum_Size:
@@ -600,30 +557,16 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
"Length is %u, should be 1", param_len);
break;
}
- if (tree)
- {
- flags = tvb_get_guint8(tvb, offset);
- tf = proto_tree_add_uint(param_tree,
- hf_version_number_options_flags, tvb, offset, 1,
- flags);
- flags_tree = proto_item_add_subtree(tf,
- ett_protocol_version_flags);
- proto_tree_add_boolean(flags_tree,
- hf_protocol_version_2, tvb, offset, 1, flags);
- proto_tree_add_boolean(flags_tree,
- hf_protocol_version_1, tvb, offset, 1, flags);
- }
+ proto_tree_add_bitmask(param_tree, tvb, offset, hf_version_number_options_flags, ett_protocol_version_flags, version_flags, ENC_BIG_ENDIAN);
break;
case Initial_Serial_Number:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_initial_serial_number,
tvb, offset, param_len, ENC_ASCII|ENC_NA);
- }
break;
case EnclosureItem:
@@ -635,18 +578,8 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
}
flags = tvb_get_guint8(tvb, offset);
*enclosure_item_flags = (guint8) flags;
- if (tree)
- {
- tf = proto_tree_add_uint(param_tree,
- hf_enclosure_item_options_flags, tvb, offset, 1,
- flags);
- flags_tree = proto_item_add_subtree(tf,
- ett_enclosure_item_flags);
- proto_tree_add_boolean(flags_tree, hf_end_of_SSDU,
- tvb, offset, 1, flags);
- proto_tree_add_boolean(flags_tree, hf_beginning_of_SSDU,
- tvb, offset, 1, flags);
- }
+ proto_tree_add_bitmask(param_tree, tvb, offset, hf_enclosure_item_options_flags, ett_enclosure_item_flags, enclosure_flags, ENC_BIG_ENDIAN);
+
if (flags & END_SPDU) {
/*
* In Data Transfer and Typed Data SPDUs, (X.225: 8.3.{11,13}.4)
@@ -698,26 +631,22 @@ dissect_parameter(tvbuff_t *tvb, int offset, proto_tree *tree,
case Activity_Identifier:
if (param_len == 0)
break;
- if (tree)
- {
- /* 8.3.29.2 The parameter fields shall be as specified in Table 37.
- * Activity Identifier m 41 6 octets maximum
- */
- proto_tree_add_item(param_tree,
- hf_activity_identifier,
- tvb, offset, param_len, ENC_NA);
- }
+
+ /* 8.3.29.2 The parameter fields shall be as specified in Table 37.
+ * Activity Identifier m 41 6 octets maximum
+ */
+ proto_tree_add_item(param_tree,
+ hf_activity_identifier,
+ tvb, offset, param_len, ENC_NA);
break;
case Serial_Number:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_serial_number,
tvb, offset, param_len, ENC_ASCII|ENC_NA);
- }
break;
case Reason_Code:
@@ -755,67 +684,55 @@ PICS. */
case Calling_Session_Selector:
if (param_len == 0)
break;
- if (tree)
- {
+
proto_tree_add_item(param_tree,
hf_calling_session_selector,
tvb, offset, param_len, ENC_NA);
- }
break;
case Called_Session_Selector:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_called_session_selector,
tvb, offset, param_len, ENC_NA);
- }
break;
case Second_Serial_Number:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_second_serial_number,
tvb, offset, param_len, ENC_ASCII|ENC_NA);
- }
break;
case Second_Initial_Serial_Number:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_second_initial_serial_number,
tvb, offset, param_len, ENC_ASCII|ENC_NA);
- }
break;
case Large_Initial_Serial_Number:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_large_initial_serial_number,
tvb, offset, param_len, ENC_ASCII|ENC_NA);
- }
break;
case Large_Second_Initial_Serial_Number:
if (param_len == 0)
break;
- if (tree)
- {
- proto_tree_add_item(param_tree,
+
+ proto_tree_add_item(param_tree,
hf_large_second_initial_serial_number,
tvb, offset, param_len, ENC_ASCII|ENC_NA);
- }
break;
default:
@@ -1929,6 +1846,7 @@ proto_register_ses(void)
/* Generated from convert_proto_tree_add_text.pl */
{ &hf_ses_user_data, { "User data", "ses.user_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ { &hf_ses_transport_option_flags, { "Flags", "ses.transport_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
{ &hf_ses_transport_connection, { "Transport connection", "ses.transport_flags.connection", FT_BOOLEAN, 8, TFS(&tfs_released_kept), transport_connection_is_released, NULL, HFILL }},
{ &hf_ses_transport_user_abort, { "User abort", "ses.transport_flags.user_abort", FT_BOOLEAN, 8, TFS(&tfs_yes_no), user_abort, NULL, HFILL }},
{ &hf_ses_transport_protocol_error, { "Protocol error", "ses.transport_flags.protocol_error", FT_BOOLEAN, 8, TFS(&tfs_yes_no), protocol_error, NULL, HFILL }},
@@ -1945,6 +1863,7 @@ proto_register_ses(void)
&ett_ses,
&ett_ses_param,
&ett_connect_protocol_options_flags,
+ &ett_transport_options_flags,
&ett_protocol_version_flags,
&ett_enclosure_item_flags,
&ett_token_item_flags,
diff --git a/epan/dissectors/packet-smb-browse.c b/epan/dissectors/packet-smb-browse.c
index 141f29ac5d..2243d581d0 100644
--- a/epan/dissectors/packet-smb-browse.c
+++ b/epan/dissectors/packet-smb-browse.c
@@ -386,53 +386,30 @@ static const true_false_string tfs_os_nts = {
static void
dissect_election_criterion_os(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- proto_tree *tree = NULL;
- proto_item *item = NULL;
- guint8 os;
-
- os = tvb_get_guint8(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_uint(parent_tree, hf_election_os, tvb, offset, 1, os);
- tree = proto_item_add_subtree(item, ett_browse_election_os);
- }
-
- proto_tree_add_boolean(tree, hf_election_os_wfw,
- tvb, offset, 1, os);
- proto_tree_add_boolean(tree, hf_election_os_ntw,
- tvb, offset, 1, os);
- proto_tree_add_boolean(tree, hf_election_os_nts,
- tvb, offset, 1, os);
+ static const int * flags[] = {
+ &hf_election_os_wfw,
+ &hf_election_os_ntw,
+ &hf_election_os_nts,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_election_os, ett_browse_election_os, flags, ENC_NA);
}
static void
dissect_election_criterion_desire(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- proto_tree *tree = NULL;
- proto_item *item = NULL;
- guint8 desire;
-
- desire = tvb_get_guint8(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_uint(parent_tree, hf_election_desire, tvb, offset, 1, desire);
- tree = proto_item_add_subtree(item, ett_browse_election_desire);
- }
-
- proto_tree_add_boolean(tree, hf_election_desire_flags_backup,
- tvb, offset, 1, desire);
- proto_tree_add_boolean(tree, hf_election_desire_flags_standby,
- tvb, offset, 1, desire);
- proto_tree_add_boolean(tree, hf_election_desire_flags_master,
- tvb, offset, 1, desire);
- proto_tree_add_boolean(tree, hf_election_desire_flags_domain_master,
- tvb, offset, 1, desire);
- proto_tree_add_boolean(tree, hf_election_desire_flags_wins,
- tvb, offset, 1, desire);
- proto_tree_add_boolean(tree, hf_election_desire_flags_nt,
- tvb, offset, 1, desire);
+ static const int * flags[] = {
+ &hf_election_desire_flags_backup,
+ &hf_election_desire_flags_standby,
+ &hf_election_desire_flags_master,
+ &hf_election_desire_flags_domain_master,
+ &hf_election_desire_flags_wins,
+ &hf_election_desire_flags_nt,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_election_desire, ett_browse_election_desire, flags, ENC_NA);
}
static void
@@ -584,7 +561,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr
guint32 periodicity;
guint8 *host_name;
gint namelen;
- guint8 server_count, reset_cmd;
+ guint8 server_count;
guint8 os_major_ver, os_minor_ver;
const gchar *windows_version;
int i;
@@ -765,21 +742,14 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr
break;
case BROWSE_RESETBROWSERSTATE_ANNOUNCEMENT: {
- proto_tree *sub_tree;
- proto_item *reset_item;
-
- /* the subcommand follows ... one of three values */
-
- reset_cmd = tvb_get_guint8(tvb, offset);
- reset_item = proto_tree_add_uint(tree, hf_mb_reset_command, tvb,
- offset, 1, reset_cmd);
- sub_tree = proto_item_add_subtree(reset_item, ett_browse_reset_cmd_flags);
- proto_tree_add_boolean(sub_tree, hf_mb_reset_demote, tvb,
- offset, 1, reset_cmd);
- proto_tree_add_boolean(sub_tree, hf_mb_reset_flush, tvb,
- offset, 1, reset_cmd);
- proto_tree_add_boolean(sub_tree, hf_mb_reset_stop, tvb,
- offset, 1, reset_cmd);
+ static const int * flags[] = {
+ &hf_mb_reset_demote,
+ &hf_mb_reset_flush,
+ &hf_mb_reset_stop,
+ NULL
+ };
+
+ proto_tree_add_bitmask(tree, tvb, offset, hf_mb_reset_command, ett_browse_reset_cmd_flags, flags, ENC_NA);
break;
}
diff --git a/epan/dissectors/packet-smb-direct.c b/epan/dissectors/packet-smb-direct.c
index 6d6c8aba18..7eccb96ef9 100644
--- a/epan/dissectors/packet-smb-direct.c
+++ b/epan/dissectors/packet-smb-direct.c
@@ -213,15 +213,16 @@ dissect_smb_direct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
proto_tree *data_tree = NULL;
int offset = 0;
guint32 status = 0;
- guint16 flags = 0;
- proto_tree *flags_tree = NULL;
- proto_item *flags_item = NULL;
guint32 remaining_length = 0;
guint32 data_offset = 0;
guint32 data_length = 0;
guint rlen = tvb_reported_length(tvb);
gint len = 0;
tvbuff_t *next_tvb = NULL;
+ static const int * flags[] = {
+ &hf_smb_direct_flags_response_requested,
+ NULL
+ };
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMBDirect");
col_clear(pinfo->cinfo, COL_INFO);
@@ -354,12 +355,8 @@ dissect_smb_direct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- flags = tvb_get_letohs(tvb, offset);
- flags_item = proto_tree_add_item(data_tree, hf_smb_direct_flags,
- tvb, offset, 2, ENC_LITTLE_ENDIAN);
- flags_tree = proto_item_add_subtree(flags_item, ett_smb_direct_flags);
- proto_tree_add_boolean(flags_tree, hf_smb_direct_flags_response_requested,
- tvb, offset, 2, flags);
+ proto_tree_add_bitmask(tree, tvb, offset, hf_smb_direct_flags,
+ ett_smb_direct_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
/* 2 bytes reserved */
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index a890f8f6bc..70ec8335d9 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -303,6 +303,8 @@ static int hf_smb_access_sharing = -1;
static int hf_smb_access_locality = -1;
static int hf_smb_access_caching = -1;
static int hf_smb_access_writetru = -1;
+static int hf_smb_desired_access = -1;
+static int hf_smb_granted_access = -1;
static int hf_smb_create_time = -1;
static int hf_smb_modify_time = -1;
static int hf_smb_backup_time = -1;
@@ -585,6 +587,7 @@ static int hf_smb_ff2_information_level = -1;
static int hf_smb_qpi_loi = -1;
static int hf_smb_spi_loi = -1;
#if 0
+static int hf_smb_sfi = -1;
static int hf_smb_sfi_writetru = -1;
static int hf_smb_sfi_caching = -1;
#endif
@@ -1680,31 +1683,18 @@ static const true_false_string tfs_da_writetru = {
"Write through disabled"
};
static int
-dissect_access(tvbuff_t *tvb, proto_tree *parent_tree, int offset, const char *type)
+dissect_access(tvbuff_t *tvb, proto_tree *parent_tree, int offset, int hf_access)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_text(parent_tree, tvb, offset, 2,
- "%s Access: 0x%04x", type, mask);
- tree = proto_item_add_subtree(item, ett_smb_desiredaccess);
-
- proto_tree_add_boolean(tree, hf_smb_access_writetru,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_access_caching,
- tvb, offset, 2, mask);
- proto_tree_add_uint(tree, hf_smb_access_locality,
- tvb, offset, 2, mask);
- proto_tree_add_uint(tree, hf_smb_access_sharing,
- tvb, offset, 2, mask);
- proto_tree_add_uint(tree, hf_smb_access_mode,
- tvb, offset, 2, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_access_writetru,
+ &hf_smb_access_caching,
+ &hf_smb_access_locality,
+ &hf_smb_access_sharing,
+ &hf_smb_access_mode,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_access, ett_smb_desiredaccess, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -1795,30 +1785,17 @@ static const true_false_string tfs_file_attribute_encrypted = {
static int
dissect_file_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_file_attr_16bit, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_file_attributes);
-
- proto_tree_add_boolean(tree, hf_smb_file_attr_archive_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_directory_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_volume_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_system_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_hidden_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_read_only_16bit,
- tvb, offset, 2, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_file_attr_archive_16bit,
+ &hf_smb_file_attr_directory_16bit,
+ &hf_smb_file_attr_volume_16bit,
+ &hf_smb_file_attr_system_16bit,
+ &hf_smb_file_attr_hidden_16bit,
+ &hf_smb_file_attr_read_only_16bit,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_file_attr_16bit, ett_smb_file_attributes, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -1902,30 +1879,17 @@ dissect_file_ext_attr(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
static int
dissect_dir_info_file_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint8 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_guint8(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_file_attr_8bit, tvb, offset, 1, ENC_NA);
- tree = proto_item_add_subtree(item, ett_smb_file_attributes);
-
- proto_tree_add_boolean(tree, hf_smb_file_attr_read_only_8bit,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_hidden_8bit,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_system_8bit,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_volume_8bit,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_directory_8bit,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_archive_8bit,
- tvb, offset, 1, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_file_attr_read_only_8bit,
+ &hf_smb_file_attr_hidden_8bit,
+ &hf_smb_file_attr_system_8bit,
+ &hf_smb_file_attr_volume_8bit,
+ &hf_smb_file_attr_directory_8bit,
+ &hf_smb_file_attr_archive_8bit,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_file_attr_8bit, ett_smb_file_attributes, flags, ENC_NA);
offset += 1;
return offset;
@@ -1963,31 +1927,19 @@ static const true_false_string tfs_search_attribute_archive = {
static int
dissect_search_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_search_attribute, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_search);
-
- proto_tree_add_boolean(tree, hf_smb_search_attribute_read_only,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_search_attribute_hidden,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_search_attribute_system,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_search_attribute_volume,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_search_attribute_directory,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_search_attribute_archive,
- tvb, offset, 2, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_search_attribute_read_only,
+ &hf_smb_search_attribute_hidden,
+ &hf_smb_search_attribute_system,
+ &hf_smb_search_attribute_volume,
+ &hf_smb_search_attribute_directory,
+ &hf_smb_search_attribute_archive,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_search_attribute, ett_smb_search, flags, ENC_LITTLE_ENDIAN);
offset += 2;
+
return offset;
}
@@ -2001,47 +1953,26 @@ dissect_search_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
static int
dissect_extended_file_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset)
{
- guint32 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohl(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_file_eattr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_file_attributes);
- }
- proto_tree_add_boolean(tree, hf_smb_file_attr_read_only_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_hidden_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_system_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_volume_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_directory_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_archive_16bit,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_device,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_normal,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_temporary,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_sparse,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_reparse,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_compressed,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_offline,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_not_content_indexed,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_file_attr_encrypted,
- tvb, offset, 2, mask);
+ static const int * flags[] = {
+ &hf_smb_file_attr_read_only_16bit,
+ &hf_smb_file_attr_hidden_16bit,
+ &hf_smb_file_attr_system_16bit,
+ &hf_smb_file_attr_volume_16bit,
+ &hf_smb_file_attr_directory_16bit,
+ &hf_smb_file_attr_archive_16bit,
+ &hf_smb_file_attr_device,
+ &hf_smb_file_attr_normal,
+ &hf_smb_file_attr_temporary,
+ &hf_smb_file_attr_sparse,
+ &hf_smb_file_attr_reparse,
+ &hf_smb_file_attr_compressed,
+ &hf_smb_file_attr_offline,
+ &hf_smb_file_attr_not_content_indexed,
+ &hf_smb_file_attr_encrypted,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_file_eattr, ett_smb_file_attributes, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -2149,54 +2080,32 @@ static int
dissect_negprot_capabilities(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
guint32 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohl(tvb, offset);
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_server_cap, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_capabilities);
+ static const int * flags[] = {
+ &hf_smb_server_cap_raw_mode,
+ &hf_smb_server_cap_mpx_mode,
+ &hf_smb_server_cap_unicode,
+ &hf_smb_server_cap_large_files,
+ &hf_smb_server_cap_nt_smbs,
+ &hf_smb_server_cap_rpc_remote_apis,
+ &hf_smb_server_cap_nt_status,
+ &hf_smb_server_cap_level_ii_oplocks,
+ &hf_smb_server_cap_lock_and_read,
+ &hf_smb_server_cap_nt_find,
+ &hf_smb_server_cap_dfs,
+ &hf_smb_server_cap_infolevel_passthru,
+ &hf_smb_server_cap_large_readx,
+ &hf_smb_server_cap_large_writex,
+ &hf_smb_server_cap_lwio,
+ &hf_smb_server_cap_unix,
+ &hf_smb_server_cap_compressed_data,
+ &hf_smb_server_cap_dynamic_reauth,
+ &hf_smb_server_cap_extended_security,
+ NULL
+ };
- proto_tree_add_boolean(tree, hf_smb_server_cap_raw_mode,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_mpx_mode,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_unicode,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_large_files,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_nt_smbs,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_rpc_remote_apis,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_nt_status,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_level_ii_oplocks,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_lock_and_read,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_nt_find,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_dfs,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_infolevel_passthru,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_large_readx,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_large_writex,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_lwio,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_unix,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_compressed_data,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_dynamic_reauth,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_server_cap_extended_security,
- tvb, offset, 4, mask);
- }
+ mask = tvb_get_letohl(tvb, offset);
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_server_cap, ett_smb_capabilities, flags, ENC_LITTLE_ENDIAN);
return mask;
}
@@ -2215,19 +2124,13 @@ static const true_false_string tfs_rm_write = {
static int
dissect_negprot_rawmode(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_rm, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_rawmode);
+ static const int * flags[] = {
+ &hf_smb_rm_read,
+ &hf_smb_rm_write,
+ NULL
+ };
- proto_tree_add_boolean(tree, hf_smb_rm_read, tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_rm_write, tvb, offset, 2, mask);
- }
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_rm, ett_smb_rawmode, flags, ENC_LITTLE_ENDIAN);
offset += 2;
@@ -2258,28 +2161,27 @@ static const true_false_string tfs_sm_sig_required = {
static int
dissect_negprot_security_mode(tvbuff_t *tvb, proto_tree *parent_tree, int offset, int wc)
{
- guint16 mask = 0;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ static const int * flags13[] = {
+ &hf_smb_sm_mode16,
+ &hf_smb_sm_password16,
+ NULL
+ };
+ static const int * flags17[] = {
+ &hf_smb_sm_mode,
+ &hf_smb_sm_password,
+ &hf_smb_sm_signatures,
+ &hf_smb_sm_sig_required,
+ NULL
+ };
switch(wc) {
case 13:
- mask = tvb_get_letohs(tvb, offset);
- item = proto_tree_add_item(parent_tree, hf_smb_sm16, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_mode);
- proto_tree_add_boolean(tree, hf_smb_sm_mode16, tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_sm_password16, tvb, offset, 2, mask);
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_sm16, ett_smb_mode, flags13, ENC_LITTLE_ENDIAN);
offset += 2;
break;
case 17:
- mask = tvb_get_guint8(tvb, offset);
- item = proto_tree_add_item(parent_tree, hf_smb_sm, tvb, offset, 1, ENC_NA);
- tree = proto_item_add_subtree(item, ett_smb_mode);
- proto_tree_add_boolean(tree, hf_smb_sm_mode, tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_sm_password, tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_sm_signatures, tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_sm_sig_required, tvb, offset, 1, mask);
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_sm, ett_smb_mode, flags17, ENC_LITTLE_ENDIAN);
offset += 1;
break;
}
@@ -3018,22 +2920,13 @@ static const value_string of_open[] = {
static int
dissect_open_function(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_open_function, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_openfunction);
- }
-
- proto_tree_add_boolean(tree, hf_smb_open_function_create,
- tvb, offset, 2, mask);
- proto_tree_add_uint(tree, hf_smb_open_function_open,
- tvb, offset, 2, mask);
+ static const int * flags[] = {
+ &hf_smb_open_function_create,
+ &hf_smb_open_function_open,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_open_function, ett_smb_openfunction, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -3055,24 +2948,14 @@ static const true_false_string tfs_mf_verify = {
static int
dissect_move_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_move_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_move_copy_flags);
- }
-
- proto_tree_add_boolean(tree, hf_smb_move_flags_verify,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_move_flags_dir,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_move_flags_file,
- tvb, offset, 2, mask);
+ static const int * flags[] = {
+ &hf_smb_move_flags_verify,
+ &hf_smb_move_flags_dir,
+ &hf_smb_move_flags_file,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_move_flags, ett_smb_move_copy_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -3093,32 +2976,18 @@ static const true_false_string tfs_cf_ea_action = {
static int
dissect_copy_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_copy_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_move_copy_flags);
- }
-
- proto_tree_add_boolean(tree, hf_smb_copy_flags_ea_action,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_copy_flags_tree_copy,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_copy_flags_verify,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_copy_flags_source_mode,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_copy_flags_dest_mode,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_copy_flags_dir,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_copy_flags_file,
- tvb, offset, 2, mask);
+ static const int * flags[] = {
+ &hf_smb_copy_flags_ea_action,
+ &hf_smb_copy_flags_tree_copy,
+ &hf_smb_copy_flags_verify,
+ &hf_smb_copy_flags_source_mode,
+ &hf_smb_copy_flags_dest_mode,
+ &hf_smb_copy_flags_dir,
+ &hf_smb_copy_flags_file,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_copy_flags, ett_smb_move_copy_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -3303,7 +3172,7 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
WORD_COUNT;
/* desired access */
- offset = dissect_access(tvb, tree, offset, "Desired");
+ offset = dissect_access(tvb, tree, offset, hf_smb_desired_access);
/* Search Attributes */
offset = dissect_search_attributes(tvb, tree, offset);
@@ -3746,7 +3615,7 @@ dissect_open_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 4;
/* granted access */
- offset = dissect_access(tvb, tree, offset, "Granted");
+ offset = dissect_access(tvb, tree, offset, hf_smb_granted_access);
BYTE_COUNT;
@@ -5711,13 +5580,18 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
guint8 wc, cmd = 0xff, lt = 0, ol = 0;
guint16 andxoffset = 0, un = 0, ln = 0, bc, fid, num_lock = 0, num_unlock = 0;
guint32 to;
- proto_item *litem = NULL;
- proto_tree *ltree = NULL;
proto_item *it = NULL;
proto_tree *tr = NULL;
int old_offset = offset;
smb_locking_saved_info_t *ld = NULL;
-
+ static const int * locks[] = {
+ &hf_smb_lock_type_large,
+ &hf_smb_lock_type_cancel,
+ &hf_smb_lock_type_change,
+ &hf_smb_lock_type_oplock,
+ &hf_smb_lock_type_shared,
+ NULL
+ };
DISSECTOR_ASSERT(si);
@@ -5748,21 +5622,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* lock type */
lt = tvb_get_guint8(tvb, offset);
- if (tree) {
- litem = proto_tree_add_item(tree, hf_smb_lock_type, tvb, offset, 1, ENC_NA);
- ltree = proto_item_add_subtree(litem, ett_smb_lock_type);
-
- proto_tree_add_boolean(ltree, hf_smb_lock_type_large,
- tvb, offset, 1, lt);
- proto_tree_add_boolean(ltree, hf_smb_lock_type_cancel,
- tvb, offset, 1, lt);
- proto_tree_add_boolean(ltree, hf_smb_lock_type_change,
- tvb, offset, 1, lt);
- proto_tree_add_boolean(ltree, hf_smb_lock_type_oplock,
- tvb, offset, 1, lt);
- proto_tree_add_boolean(ltree, hf_smb_lock_type_shared,
- tvb, offset, 1, lt);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_smb_lock_type, ett_smb_lock_type, locks, ENC_NA);
offset += 1;
/* oplock level */
@@ -6082,21 +5942,13 @@ static const true_false_string tfs_oa_lock = {
static int
dissect_open_action(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_open_action, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_open_action);
+ static const int * flags[] = {
+ &hf_smb_open_action_lock,
+ &hf_smb_open_action_open,
+ NULL
+ };
- proto_tree_add_boolean(tree, hf_smb_open_action_lock,
- tvb, offset, 2, mask);
- proto_tree_add_uint(tree, hf_smb_open_action_open,
- tvb, offset, 2, mask);
- }
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_open_action, ett_smb_open_action, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -6200,7 +6052,7 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
offset = dissect_open_flags(tvb, tree, offset, 0x0007);
/* desired access */
- offset = dissect_access(tvb, tree, offset, "Desired");
+ offset = dissect_access(tvb, tree, offset, hf_smb_desired_access);
/* Search Attributes */
offset = dissect_search_attributes(tvb, tree, offset);
@@ -6286,35 +6138,27 @@ static const value_string ipc_state_read_mode_vals[] = {
};
int
-dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset,
- gboolean setstate_flag)
+dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset, gboolean setstate_flag)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_ipc_state, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_ipc_state);
+ static const int * setstate_flags[] = {
+ &hf_smb_ipc_state_nonblocking,
+ &hf_smb_ipc_state_read_mode,
+ NULL
+ };
+ static const int * not_setstate_flags[] = {
+ &hf_smb_ipc_state_nonblocking,
+ &hf_smb_ipc_state_endpoint,
+ &hf_smb_ipc_state_pipe_type,
+ &hf_smb_ipc_state_read_mode,
+ &hf_smb_ipc_state_icount,
+ NULL
+ };
- proto_tree_add_boolean(tree, hf_smb_ipc_state_nonblocking,
- tvb, offset, 2, mask);
- if (!setstate_flag) {
- proto_tree_add_uint(tree, hf_smb_ipc_state_endpoint,
- tvb, offset, 2, mask);
- proto_tree_add_uint(tree, hf_smb_ipc_state_pipe_type,
- tvb, offset, 2, mask);
- }
- proto_tree_add_uint(tree, hf_smb_ipc_state_read_mode,
- tvb, offset, 2, mask);
- if (!setstate_flag) {
- proto_tree_add_uint(tree, hf_smb_ipc_state_icount,
- tvb, offset, 2, mask);
- }
+ if (!setstate_flag) {
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_ipc_state, ett_smb_ipc_state, not_setstate_flags, ENC_LITTLE_ENDIAN);
+ } else {
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_ipc_state, ett_smb_ipc_state, setstate_flags, ENC_LITTLE_ENDIAN);
}
-
offset += 2;
return offset;
@@ -6375,7 +6219,7 @@ dissect_open_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 4;
/* granted access */
- offset = dissect_access(tvb, tree, offset, "Granted");
+ offset = dissect_access(tvb, tree, offset, hf_smb_granted_access);
/* File Type */
ftype = tvb_get_letohs(tvb, offset);
@@ -6996,19 +6840,12 @@ static const true_false_string tfs_setup_action_guest = {
static int
dissect_setup_action(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_setup_action, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_setup_action);
+ static const int * flags[] = {
+ &hf_smb_setup_action_guest,
+ NULL
+ };
- proto_tree_add_boolean(tree, hf_smb_setup_action_guest,
- tvb, offset, 2, mask);
- }
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_setup_action, ett_smb_setup_action, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -7596,28 +7433,16 @@ static const true_false_string tfs_connect_support_extended_signature = {
static int
dissect_connect_support_bits(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_connect_support, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_connect_support_bits);
-
- proto_tree_add_boolean(tree, hf_smb_connect_support_search,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_connect_support_in_dfs,
- tvb, offset, 2, mask);
- proto_tree_add_uint(tree, hf_smb_connect_support_csc_mask_vals,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_connect_support_uniquefilename,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_connect_support_extended_signature,
- tvb, offset, 2, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_connect_support_search,
+ &hf_smb_connect_support_in_dfs,
+ &hf_smb_connect_support_csc_mask_vals,
+ &hf_smb_connect_support_uniquefilename,
+ &hf_smb_connect_support_extended_signature,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_connect_support, ett_smb_connect_support_bits, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -7641,24 +7466,14 @@ static const true_false_string tfs_extended_response = {
static int
dissect_connect_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_connect_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_connect_flags);
-
- proto_tree_add_boolean(tree, hf_smb_connect_flags_dtid,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_connect_flags_ext_sig,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_connect_flags_ext_resp,
- tvb, offset, 2, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_connect_flags_dtid,
+ &hf_smb_connect_flags_ext_sig,
+ &hf_smb_connect_flags_ext_resp,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_connect_flags, ett_smb_connect_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -8245,22 +8060,13 @@ typedef struct _nt_trans_data {
static int
dissect_nt_security_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint8 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_guint8(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_nt_security_flags, tvb, offset, 1, ENC_NA);
- tree = proto_item_add_subtree(item, ett_smb_nt_security_flags);
-
- proto_tree_add_boolean(tree, hf_smb_nt_security_flags_context_tracking,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_security_flags_effective_only,
- tvb, offset, 1, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_nt_security_flags_context_tracking,
+ &hf_smb_nt_security_flags_effective_only,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_nt_security_flags, ett_smb_nt_security_flags, flags, ENC_NA);
offset += 1;
return offset;
@@ -8367,64 +8173,39 @@ static const true_false_string tfs_nt_create_options_open_for_free_space_query =
int
dissect_nt_notify_completion_filter(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint32 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohl(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_nt_notify_completion_filter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_nt_notify_completion_filter);
-
- proto_tree_add_boolean(tree, hf_smb_nt_notify_file_name,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_dir_name,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_attributes,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_size,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_last_write,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_last_access,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_creation,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_ea,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_security,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_stream_name,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_stream_size,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_notify_stream_write,
- tvb, offset, 4, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_nt_notify_file_name,
+ &hf_smb_nt_notify_dir_name,
+ &hf_smb_nt_notify_attributes,
+ &hf_smb_nt_notify_size,
+ &hf_smb_nt_notify_last_write,
+ &hf_smb_nt_notify_last_access,
+ &hf_smb_nt_notify_creation,
+ &hf_smb_nt_notify_ea,
+ &hf_smb_nt_notify_security,
+ &hf_smb_nt_notify_stream_name,
+ &hf_smb_nt_notify_stream_size,
+ &hf_smb_nt_notify_stream_write,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_nt_notify_completion_filter, ett_smb_nt_notify_completion_filter, flags, ENC_LITTLE_ENDIAN);
offset += 4;
+
return offset;
}
static int
dissect_nt_ioctl_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint8 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_guint8(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_nt_ioctl_flags_completion_filter, tvb, offset, 1, ENC_NA);
- tree = proto_item_add_subtree(item, ett_smb_nt_ioctl_flags);
-
- proto_tree_add_boolean(tree, hf_smb_nt_ioctl_flags_root_handle,
- tvb, offset, 1, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_nt_ioctl_flags_root_handle,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_nt_ioctl_flags_completion_filter, ett_smb_nt_ioctl_flags, flags, ENC_NA);
offset += 1;
+
return offset;
}
@@ -8460,26 +8241,15 @@ static const true_false_string tfs_nt_qsd_sacl = {
int
dissect_security_information_mask(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint32 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohl(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_nt_qsd, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_security_information_mask);
-
- proto_tree_add_boolean(tree, hf_smb_nt_qsd_owner,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_qsd_group,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_qsd_dacl,
- tvb, offset, 4, mask);
- proto_tree_add_boolean(tree, hf_smb_nt_qsd_sacl,
- tvb, offset, 4, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_nt_qsd_owner,
+ &hf_smb_nt_qsd_group,
+ &hf_smb_nt_qsd_dacl,
+ &hf_smb_nt_qsd_sacl,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_nt_qsd, ett_smb_security_information_mask, flags, ENC_LITTLE_ENDIAN);
offset += 4;
return offset;
@@ -10746,9 +10516,15 @@ static int
dissect_ff2_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, smb_info_t *si)
{
guint16 mask;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
smb_transact2_info_t *t2i;
+ static const int * flags[] = {
+ &hf_smb_ff2_backup,
+ &hf_smb_ff2_continue,
+ &hf_smb_ff2_resume,
+ &hf_smb_ff2_close_eos,
+ &hf_smb_ff2_close,
+ NULL
+ };
mask = tvb_get_letohs(tvb, offset);
@@ -10762,22 +10538,7 @@ dissect_ff2_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, in
}
}
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_ff2, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_find_first2_flags);
-
- proto_tree_add_boolean(tree, hf_smb_ff2_backup,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_ff2_continue,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_ff2_resume,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_ff2_close_eos,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_ff2_close,
- tvb, offset, 2, mask);
- }
-
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_ff2, ett_smb_find_first2_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -10787,23 +10548,13 @@ dissect_ff2_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, in
static int
dissect_sfi_ioflag(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_text(parent_tree, tvb, offset, 2,
- "IO Flag: 0x%04x", mask);
- tree = proto_item_add_subtree(item, ett_smb_ioflag);
-
- proto_tree_add_boolean(tree, hf_smb_sfi_writetru,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_sfi_caching,
- tvb, offset, 2, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_sfi_writetru,
+ &hf_smb_sfi_caching,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_sfi, ett_smb_ioflag, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -10867,7 +10618,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo,
/* desired access */
CHECK_BYTE_COUNT_TRANS(2);
- offset = dissect_access(tvb, tree, offset, "Desired");
+ offset = dissect_access(tvb, tree, offset, hf_smb_desired_access);
bc -= 2;
/* Search Attributes */
@@ -11273,20 +11024,14 @@ static guint16
dissect_transaction_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
guint16 mask;
- proto_item *item;
- proto_tree *tree;
+ static const int * flags[] = {
+ &hf_smb_transaction_flags_owt,
+ &hf_smb_transaction_flags_dtid,
+ NULL
+ };
mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_transaction_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_transaction_flags);
-
- proto_tree_add_boolean(tree, hf_smb_transaction_flags_owt,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_transaction_flags_dtid,
- tvb, offset, 2, mask);
- }
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_transaction_flags, ett_smb_transaction_flags, flags, ENC_LITTLE_ENDIAN);
return mask;
}
@@ -11295,21 +11040,13 @@ dissect_transaction_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
static int
dissect_get_dfs_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_get_dfs_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_get_dfs_flags);
+ static const int * flags[] = {
+ &hf_smb_get_dfs_server_hold_storage,
+ &hf_smb_get_dfs_fielding,
+ NULL
+ };
- proto_tree_add_boolean(tree, hf_smb_get_dfs_server_hold_storage,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_get_dfs_fielding,
- tvb, offset, 2, mask);
- }
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_get_dfs_flags, ett_smb_get_dfs_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -11318,22 +11055,13 @@ dissect_get_dfs_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
static int
dissect_dfs_referral_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_dfs_referral_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_dfs_referral_flags);
-
- proto_tree_add_boolean(tree, hf_smb_dfs_referral_flags_name_list_referral,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_dfs_referral_flags_target_set_boundary,
- tvb, offset, 2, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_dfs_referral_flags_name_list_referral,
+ &hf_smb_dfs_referral_flags_target_set_boundary,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_dfs_referral_flags, ett_smb_dfs_referral_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -12730,35 +12458,19 @@ static const true_false_string tfs_i2f_hidden = {
static int
dissect_unix_info2_file_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset, int hf)
{
- guint32 flags;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- flags = tvb_get_letohl(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_uint(parent_tree, hf, tvb, offset, 4,
- flags);
- tree = proto_item_add_subtree(item, ett_smb_info2_file_flags);
- }
-
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_secure_delete,
- tvb, offset, 4, flags);
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_enable_undelete,
- tvb, offset, 4, flags);
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_synchronous,
- tvb, offset, 4, flags);
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_immutable,
- tvb, offset, 4, flags);
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_append_only,
- tvb, offset, 4, flags);
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_do_not_backup,
- tvb, offset, 4, flags);
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_no_update_atime,
- tvb, offset, 4, flags);
- proto_tree_add_boolean(tree, hf_smb_unix_info2_file_flags_hidden,
- tvb, offset, 4, flags);
+ static const int * flags[] = {
+ &hf_smb_unix_info2_file_flags_secure_delete,
+ &hf_smb_unix_info2_file_flags_enable_undelete,
+ &hf_smb_unix_info2_file_flags_synchronous,
+ &hf_smb_unix_info2_file_flags_immutable,
+ &hf_smb_unix_info2_file_flags_append_only,
+ &hf_smb_unix_info2_file_flags_do_not_backup,
+ &hf_smb_unix_info2_file_flags_no_update_atime,
+ &hf_smb_unix_info2_file_flags_hidden,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf, ett_smb_info2_file_flags, flags, ENC_LITTLE_ENDIAN);
offset += 4;
return offset;
@@ -15277,64 +14989,43 @@ dissect_ff2_response_data(tvbuff_t * tvb, packet_info * pinfo,
static int
dissect_fs_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint32 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohl(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_fs_attr, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_fs_attributes);
-
+ static const int * flags[] = {
/* case sensitive search */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_css,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_css,
/* case preserved names */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_cpn,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_cpn,
/* unicode on disk */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_uod,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_uod,
/* persistent acls */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_pacls,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_pacls,
/* file compression */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_fc,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_fc,
/* volume quotas */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_vq,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_vq,
/* sparse files */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_ssf,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_ssf,
/* reparse points */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_srp,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_srp,
/* remote storage */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_srs,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_srs,
/* lfn apis */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_sla,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_sla,
/* volume is compressed */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_vic,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_vic,
/* support oids */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_soids,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_soids,
/* encryption */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_se,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_se,
/* named streams */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_ns,
- tvb, offset, 4, mask);
+ &hf_smb_fs_attr_ns,
/* read only volume */
- proto_tree_add_boolean(tree, hf_smb_fs_attr_rov,
- tvb, offset, 4, mask);
- }
+ &hf_smb_fs_attr_rov,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_fs_attr, ett_smb_fs_attributes, flags, ENC_LITTLE_ENDIAN);
offset += 4;
+
return offset;
}
@@ -15562,9 +15253,6 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
{
int fn_len, vll;
const char *fn;
- guint support = 0;
- proto_item *item = NULL;
- proto_tree *ti = NULL;
if (!*bcp) {
return offset;
@@ -15810,7 +15498,16 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
break;
}
- case 0x301: /* MAC_QUERY_FS_INFO */
+ case 0x301: { /* MAC_QUERY_FS_INFO */
+ static const int * support_flags[] = {
+ &hf_smb_mac_sup_access_ctrl,
+ &hf_smb_mac_sup_getset_comments,
+ &hf_smb_mac_sup_desktopdb_calls,
+ &hf_smb_mac_sup_unique_ids,
+ &hf_smb_mac_sup_streams,
+ NULL
+ };
+
/* Create time */
CHECK_BYTE_COUNT_TRANS_SUBR(8);
offset = dissect_nt_64bit_time(tvb, tree, offset, hf_smb_create_time);
@@ -15868,21 +15565,10 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
COUNT_BYTES_TRANS_SUBR(4);
/* Mac Support Flags */
CHECK_BYTE_COUNT_TRANS_SUBR(4);
- support = tvb_get_letohl(tvb, offset);
- item = proto_tree_add_item(tree, hf_smb_mac_sup, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- ti = proto_item_add_subtree(item, ett_smb_mac_support_flags);
- proto_tree_add_boolean(ti, hf_smb_mac_sup_access_ctrl,
- tvb, offset, 4, support);
- proto_tree_add_boolean(ti, hf_smb_mac_sup_getset_comments,
- tvb, offset, 4, support);
- proto_tree_add_boolean(ti, hf_smb_mac_sup_desktopdb_calls,
- tvb, offset, 4, support);
- proto_tree_add_boolean(ti, hf_smb_mac_sup_unique_ids,
- tvb, offset, 4, support);
- proto_tree_add_boolean(ti, hf_smb_mac_sup_streams,
- tvb, offset, 4, support);
+ proto_tree_add_bitmask(tree, tvb, offset, hf_smb_mac_sup, ett_smb_mac_support_flags, support_flags, ENC_LITTLE_ENDIAN);
COUNT_BYTES_TRANS_SUBR(4);
break;
+ }
case 1006: /* QUERY_FS_QUOTA_INFO */
offset = dissect_nt_quota(tvb, tree, offset, bcp);
break;
@@ -16145,7 +15831,7 @@ dissect_transaction2_response_parameters(tvbuff_t *tvb, packet_info *pinfo, prot
offset += 4;
/* granted access */
- offset = dissect_access(tvb, tree, offset, "Granted");
+ offset = dissect_access(tvb, tree, offset, hf_smb_granted_access);
/* File Type */
proto_tree_add_item(tree, hf_smb_file_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -17385,33 +17071,20 @@ static const true_false_string tfs_smb_flags_response = {
static int
dissect_smb_flags(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint8 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_guint8(tvb, offset);
-
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_flags, tvb, offset, 1, ENC_NA);
- tree = proto_item_add_subtree(item, ett_smb_flags);
-
- proto_tree_add_boolean(tree, hf_smb_flags_response,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_flags_notify,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_flags_oplock,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_flags_canon,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_flags_caseless,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_flags_receive_buffer,
- tvb, offset, 1, mask);
- proto_tree_add_boolean(tree, hf_smb_flags_lock,
- tvb, offset, 1, mask);
- }
+ static const int * flags[] = {
+ &hf_smb_flags_response,
+ &hf_smb_flags_notify,
+ &hf_smb_flags_oplock,
+ &hf_smb_flags_canon,
+ &hf_smb_flags_caseless,
+ &hf_smb_flags_receive_buffer,
+ &hf_smb_flags_lock,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_flags, ett_smb_flags, flags, ENC_NA);
offset += 1;
+
return offset;
}
@@ -17468,42 +17141,25 @@ static const true_false_string tfs_smb_flags2_string = {
static int
dissect_smb_flags2(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
- guint16 mask;
- proto_item *item;
- proto_tree *tree;
-
- mask = tvb_get_letohs(tvb, offset);
+ static const int * flags[] = {
+ &hf_smb_flags2_string,
+ &hf_smb_flags2_nt_error,
+ &hf_smb_flags2_roe,
+ &hf_smb_flags2_dfs,
+ &hf_smb_flags2_esn,
+ &hf_smb_flags2_reparse_path,
+ &hf_smb_flags2_long_names_used,
+ &hf_smb_flags2_sec_sig_required,
+ &hf_smb_flags2_compressed,
+ &hf_smb_flags2_sec_sig,
+ &hf_smb_flags2_ea,
+ &hf_smb_flags2_long_names_allowed,
+ NULL
+ };
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_smb_flags2, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb_flags2);
-
- proto_tree_add_boolean(tree, hf_smb_flags2_string,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_nt_error,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_roe,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_dfs,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_esn,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_reparse_path,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_long_names_used,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_sec_sig_required,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_compressed,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_sec_sig,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_ea,
- tvb, offset, 2, mask);
- proto_tree_add_boolean(tree, hf_smb_flags2_long_names_allowed,
- tvb, offset, 2, mask);
- }
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_flags2, ett_smb_flags2, flags, ENC_LITTLE_ENDIAN);
offset += 2;
+
return offset;
}
@@ -18752,6 +18408,14 @@ proto_register_smb(void)
{ "Caching", "smb.access.caching", FT_BOOLEAN, 16,
TFS(&tfs_da_caching), 0x1000, "Caching mode?", HFILL }},
+ { &hf_smb_desired_access,
+ { "Desired Access", "smb.access.desired", FT_UINT16, BASE_HEX,
+ NULL, 0x0, NULL, HFILL }},
+
+ { &hf_smb_granted_access,
+ { "Granted Access", "smb.access.granted", FT_UINT16, BASE_HEX,
+ NULL, 0x0, NULL, HFILL }},
+
{ &hf_smb_access_writetru,
{ "Writethrough", "smb.access.writethrough", FT_BOOLEAN, 16,
TFS(&tfs_da_writetru), 0x4000, "Writethrough mode?", HFILL }},
@@ -19900,6 +19564,10 @@ proto_register_smb(void)
&spi_loi_vals_ext, 0, "Level of interest for TRANSACTION[2] SET_{FILE,PATH}_INFO commands", HFILL }},
#if 0
+ { &hf_smb_sfi,
+ { "IO Flag", "smb.sfi_flags", FT_UINT16, BASE_HEX,
+ NULL, 0x0, NULL, HFILL }},
+
{ &hf_smb_sfi_writetru,
{ "Writethrough", "smb.sfi_writethrough", FT_BOOLEAN, 16,
TFS(&tfs_da_writetru), 0x0010, "Writethrough mode?", HFILL }},
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index 44f170a52b..05f724d76a 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -426,6 +426,7 @@ static gint ett_smb2_lock_info = -1;
static gint ett_smb2_lock_flags = -1;
static gint ett_smb2_transform_enc_alg = -1;
static gint ett_smb2_buffercode = -1;
+static gint ett_smb2_ioctl_network_interface_capabilities = -1;
static expert_field ei_smb2_invalid_length = EI_INIT;
static expert_field ei_smb2_bad_response = EI_INIT;
@@ -2264,24 +2265,18 @@ dissect_smb2_buffercode(proto_tree *parent_tree, tvbuff_t *tvb, int offset, guin
static int
dissect_smb2_capabilities(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
- guint32 cap;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- cap = tvb_get_letohl(tvb, offset);
-
- item = proto_tree_add_item(parent_tree, hf_smb2_capabilities, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb2_capabilities);
-
-
- proto_tree_add_boolean(tree, hf_smb2_cap_dfs, tvb, offset, 4, cap);
- proto_tree_add_boolean(tree, hf_smb2_cap_leasing, tvb, offset, 4, cap);
- proto_tree_add_boolean(tree, hf_smb2_cap_large_mtu, tvb, offset, 4, cap);
- proto_tree_add_boolean(tree, hf_smb2_cap_multi_channel, tvb, offset, 4, cap);
- proto_tree_add_boolean(tree, hf_smb2_cap_persistent_handles, tvb, offset, 4, cap);
- proto_tree_add_boolean(tree, hf_smb2_cap_directory_leasing, tvb, offset, 4, cap);
- proto_tree_add_boolean(tree, hf_smb2_cap_encryption, tvb, offset, 4, cap);
+ static const int * flags[] = {
+ &hf_smb2_cap_dfs,
+ &hf_smb2_cap_leasing,
+ &hf_smb2_cap_large_mtu,
+ &hf_smb2_cap_multi_channel,
+ &hf_smb2_cap_persistent_handles,
+ &hf_smb2_cap_directory_leasing,
+ &hf_smb2_cap_encryption,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_capabilities, ett_smb2_capabilities, flags, ENC_LITTLE_ENDIAN);
offset += 4;
return offset;
@@ -2295,18 +2290,13 @@ dissect_smb2_capabilities(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
static int
dissect_smb2_secmode(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
- guint8 sm;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- sm = tvb_get_guint8(tvb, offset);
-
- item = proto_tree_add_item(parent_tree, hf_smb2_security_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb2_sec_mode);
-
- proto_tree_add_boolean(tree, hf_smb2_secmode_flags_sign_enabled, tvb, offset, 1, sm);
- proto_tree_add_boolean(tree, hf_smb2_secmode_flags_sign_required, tvb, offset, 1, sm);
+ static const int * flags[] = {
+ &hf_smb2_secmode_flags_sign_enabled,
+ &hf_smb2_secmode_flags_sign_required,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_security_mode, ett_smb2_sec_mode, flags, ENC_LITTLE_ENDIAN);
offset += 1;
return offset;
@@ -2317,17 +2307,12 @@ dissect_smb2_secmode(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
static int
dissect_smb2_ses_req_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
- guint8 sf;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- sf = tvb_get_guint8(tvb, offset);
-
- item = proto_tree_add_item(parent_tree, hf_smb2_ses_req_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb2_ses_req_flags);
-
- proto_tree_add_boolean(tree, hf_smb2_ses_req_flags_session_binding, tvb, offset, 1, sf);
+ static const int * flags[] = {
+ &hf_smb2_ses_req_flags_session_binding,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_ses_req_flags, ett_smb2_ses_req_flags, flags, ENC_LITTLE_ENDIAN);
offset += 1;
return offset;
@@ -2339,18 +2324,13 @@ dissect_smb2_ses_req_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
static int
dissect_smb2_ses_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
- guint16 sf;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
- sf = tvb_get_letohs(tvb, offset);
-
- item = proto_tree_add_item(parent_tree, hf_smb2_session_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- tree = proto_item_add_subtree(item, ett_smb2_ses_flags);
-
- proto_tree_add_boolean(tree, hf_smb2_ses_flags_guest, tvb, offset, 2, sf);
- proto_tree_add_boolean(tree, hf_smb2_ses_flags_null, tvb, offset, 2, sf);
+ static const int * flags[] = {
+ &hf_smb2_ses_flags_guest,
+ &hf_smb2_ses_flags_null,
+ NULL
+ };
+ proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb2_session_flags, ett_smb2_ses_flags, flags, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -4408,6 +4388,11 @@ dissect_smb2_NETWORK_INTERFACE_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tre
guint64 link_speed;
gfloat val = 0;
const char *unit = NULL;
+ static const int * capability_flags[] = {
+ &hf_smb2_ioctl_network_interface_capability_rdma,
+ &hf_smb2_ioctl_network_interface_capability_rss,
+ NULL
+ };
next_offset = tvb_get_letohl(tvb, offset);
if (next_offset) {
@@ -4427,9 +4412,8 @@ dissect_smb2_NETWORK_INTERFACE_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tre
/* capabilities */
capabilities = tvb_get_letohl(tvb, offset);
- proto_tree_add_item(sub_tree, hf_smb2_ioctl_network_interface_capabilities, tvb, offset, 4, ENC_LITTLE_ENDIAN);
- proto_tree_add_boolean(sub_tree, hf_smb2_ioctl_network_interface_capability_rdma, tvb, offset, 4, capabilities);
- proto_tree_add_boolean(sub_tree, hf_smb2_ioctl_network_interface_capability_rss, tvb, offset, 4, capabilities);
+ proto_tree_add_bitmask(sub_tree, tvb, offset, hf_smb2_ioctl_network_interface_capabilities, ett_smb2_ioctl_network_interface_capabilities, capability_flags, ENC_LITTLE_ENDIAN);
+
if (capabilities != 0) {
proto_item_append_text(item, "%s%s",
(capabilities & NETWORK_INTERFACE_CAP_RDMA)?", RDMA":"",
@@ -8441,6 +8425,7 @@ proto_register_smb2(void)
&ett_smb2_svhdx_open_device_context,
&ett_smb2_transform_enc_alg,
&ett_smb2_buffercode,
+ &ett_smb2_ioctl_network_interface_capabilities,
};
static ei_register_info ei[] = {
diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c
index df5cd1de72..8131683c4d 100644
--- a/epan/dissectors/packet-sna.c
+++ b/epan/dissectors/packet-sna.c
@@ -2369,33 +2369,25 @@ dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree *parent_tree)
{
guint16 length;
- guint16 type;
int cont;
int offset = 0;
- proto_tree *gds_tree;
- proto_item *gds_item;
+ static const int * flags[] = {
+ &hf_sna_gds_len,
+ &hf_sna_gds_cont,
+ &hf_sna_gds_type,
+ NULL
+ };
do {
length = tvb_get_ntohs(tvb, offset) & 0x7fff;
cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
- type = tvb_get_ntohs(tvb, offset+2);
if (length < 2 ) /* escape sequence ? */
return;
- if (tree) {
- gds_item = proto_tree_add_item(tree, hf_sna_gds, tvb,
- offset, length, ENC_NA);
- gds_tree = proto_item_add_subtree(gds_item,
- ett_sna_gds);
-
- proto_tree_add_uint(gds_tree, hf_sna_gds_len, tvb,
- offset, 2, length);
- proto_tree_add_boolean(gds_tree, hf_sna_gds_cont, tvb,
- offset, 2, cont);
- proto_tree_add_uint(gds_tree, hf_sna_gds_type, tvb,
- offset+2, 2, type);
- }
+
+ proto_tree_add_bitmask(tree, tvb, offset, hf_sna_gds, ett_sna_gds, flags, ENC_BIG_ENDIAN);
offset += length;
+
} while(cont);
if (tvb_offset_exists(tvb, offset))
call_dissector(data_handle,
diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c
index 5e7cb3c54e..e5a3e1110c 100644
--- a/epan/dissectors/packet-spnego.c
+++ b/epan/dissectors/packet-spnego.c
@@ -89,7 +89,7 @@ static int hf_spnego_krb5_cfx_rrc = -1;
static int hf_spnego_krb5_cfx_seq = -1;
-/*--- Included file: packet-spnego-hf.c ---*/
+/*--- Included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-hf.c ---*/
#line 1 "../../asn1/spnego/packet-spnego-hf.c"
static int hf_spnego_negTokenInit = -1; /* T_negTokenInit */
static int hf_spnego_negTokenTarg = -1; /* NegTokenTarg */
@@ -116,7 +116,7 @@ static int hf_spnego_ContextFlags_anonFlag = -1;
static int hf_spnego_ContextFlags_confFlag = -1;
static int hf_spnego_ContextFlags_integFlag = -1;
-/*--- End of included file: packet-spnego-hf.c ---*/
+/*--- End of included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-hf.c ---*/
#line 84 "../../asn1/spnego/packet-spnego-template.c"
/* Global variables */
@@ -132,7 +132,7 @@ static gint ett_spnego_krb5 = -1;
static gint ett_spnego_krb5_cfx_flags = -1;
-/*--- Included file: packet-spnego-ett.c ---*/
+/*--- Included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-ett.c ---*/
#line 1 "../../asn1/spnego/packet-spnego-ett.c"
static gint ett_spnego_NegotiationToken = -1;
static gint ett_spnego_MechTypeList = -1;
@@ -143,7 +143,7 @@ static gint ett_spnego_ContextFlags = -1;
static gint ett_spnego_NegTokenTarg = -1;
static gint ett_spnego_InitialContextToken_U = -1;
-/*--- End of included file: packet-spnego-ett.c ---*/
+/*--- End of included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-ett.c ---*/
#line 98 "../../asn1/spnego/packet-spnego-template.c"
static expert_field ei_spnego_decrypted_keytype = EI_INIT;
@@ -162,7 +162,7 @@ static int dissect_spnego_NegTokenInit2(gboolean implicit_tag, tvbuff_t *tvb,
proto_tree *tree, int hf_index);
-/*--- Included file: packet-spnego-fn.c ---*/
+/*--- Included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-fn.c ---*/
#line 1 "../../asn1/spnego/packet-spnego-fn.c"
@@ -562,7 +562,7 @@ dissect_spnego_InitialContextToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
}
-/*--- End of included file: packet-spnego-fn.c ---*/
+/*--- End of included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-fn.c ---*/
#line 115 "../../asn1/spnego/packet-spnego-template.c"
/*
* This is the SPNEGO KRB5 dissector. It is not true KRB5, but some ASN.1
@@ -1397,26 +1397,16 @@ dissect_spnego_krb5_getmic_base(tvbuff_t *tvb, int offset, packet_info *pinfo _U
static int
dissect_spnego_krb5_cfx_flags(tvbuff_t *tvb, int offset,
proto_tree *spnego_krb5_tree,
- guint8 cfx_flags)
+ guint8 cfx_flags _U_)
{
- proto_tree *cfx_flags_tree;
- proto_item *tf;
-
- tf = proto_tree_add_uint(spnego_krb5_tree,
- hf_spnego_krb5_cfx_flags,
- tvb, offset, 1, cfx_flags);
- cfx_flags_tree = proto_item_add_subtree(tf, ett_spnego_krb5_cfx_flags);
-
- proto_tree_add_boolean(cfx_flags_tree,
- hf_spnego_krb5_cfx_flags_04,
- tvb, offset, 1, cfx_flags);
- proto_tree_add_boolean(cfx_flags_tree,
- hf_spnego_krb5_cfx_flags_02,
- tvb, offset, 1, cfx_flags);
- proto_tree_add_boolean(cfx_flags_tree,
- hf_spnego_krb5_cfx_flags_01,
- tvb, offset, 1, cfx_flags);
+ static const int * flags[] = {
+ &hf_spnego_krb5_cfx_flags_04,
+ &hf_spnego_krb5_cfx_flags_02,
+ &hf_spnego_krb5_cfx_flags_01,
+ NULL
+ };
+ proto_tree_add_bitmask(spnego_krb5_tree, tvb, offset, hf_spnego_krb5_cfx_flags, ett_spnego_krb5_cfx_flags, flags, ENC_NA);
return (offset + 1);
}
@@ -1861,7 +1851,7 @@ void proto_register_spnego(void) {
NULL, 0, "KRB5 Sequence Number", HFILL}},
-/*--- Included file: packet-spnego-hfarr.c ---*/
+/*--- Included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-hfarr.c ---*/
#line 1 "../../asn1/spnego/packet-spnego-hfarr.c"
{ &hf_spnego_negTokenInit,
{ "negTokenInit", "spnego.negTokenInit_element",
@@ -1956,8 +1946,8 @@ void proto_register_spnego(void) {
FT_BOOLEAN, 8, NULL, 0x02,
NULL, HFILL }},
-/*--- End of included file: packet-spnego-hfarr.c ---*/
-#line 1412 "../../asn1/spnego/packet-spnego-template.c"
+/*--- End of included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-hfarr.c ---*/
+#line 1402 "../../asn1/spnego/packet-spnego-template.c"
};
/* List of subtrees */
@@ -1968,7 +1958,7 @@ void proto_register_spnego(void) {
&ett_spnego_krb5_cfx_flags,
-/*--- Included file: packet-spnego-ettarr.c ---*/
+/*--- Included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-ettarr.c ---*/
#line 1 "../../asn1/spnego/packet-spnego-ettarr.c"
&ett_spnego_NegotiationToken,
&ett_spnego_MechTypeList,
@@ -1979,8 +1969,8 @@ void proto_register_spnego(void) {
&ett_spnego_NegTokenTarg,
&ett_spnego_InitialContextToken_U,
-/*--- End of included file: packet-spnego-ettarr.c ---*/
-#line 1422 "../../asn1/spnego/packet-spnego-template.c"
+/*--- End of included file: /home/mmann/wireshark/asn1/spnego/packet-spnego-ettarr.c ---*/
+#line 1412 "../../asn1/spnego/packet-spnego-template.c"
};
static ei_register_info ei[] = {
diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c
index c9b7741290..1483aef0b5 100644
--- a/epan/dissectors/packet-srvloc.c
+++ b/epan/dissectors/packet-srvloc.c
@@ -805,8 +805,8 @@ static int
dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
int offset = 0;
- proto_item *ti, *tf;
- proto_tree *srvloc_tree, *srvloc_flags;
+ proto_item *ti;
+ proto_tree *srvloc_tree;
guint8 version;
guint8 function;
guint16 encoding;
@@ -837,23 +837,20 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
proto_tree_add_uint(srvloc_tree, hf_srvloc_function, tvb, offset + 1, 1,
function);
if (version < 2) {
+ static const int * v1_flags[] = {
+ &hf_srvloc_flags_v1_overflow,
+ &hf_srvloc_flags_v1_monolingual,
+ &hf_srvloc_flags_v1_url_auth,
+ &hf_srvloc_flags_v1_attribute_auth,
+ &hf_srvloc_flags_v1_fresh,
+ NULL
+ };
+
length = tvb_get_ntohs(tvb, offset + 2);
proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 2,
length);
flags = tvb_get_guint8(tvb, offset + 4);
- tf = proto_tree_add_uint(srvloc_tree, hf_srvloc_flags_v1, tvb, offset + 4, 1,
- flags);
- srvloc_flags = proto_item_add_subtree(tf, ett_srvloc_flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_overflow,
- tvb, offset+4, 1, flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_monolingual,
- tvb, offset+4, 1, flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_url_auth,
- tvb, offset+4, 1, flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_attribute_auth,
- tvb, offset+4, 1, flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_fresh,
- tvb, offset+4, 1, flags);
+ proto_tree_add_bitmask(srvloc_tree, tvb, offset + 4, hf_srvloc_flags_v1, ett_srvloc_flags, v1_flags, ENC_NA);
proto_tree_add_text(srvloc_tree, tvb, offset + 5, 1, "Dialect: %u",
tvb_get_guint8(tvb, offset + 5));
proto_tree_add_text(srvloc_tree, tvb, offset + 6, 2, "Language: %s",
@@ -1058,19 +1055,16 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
}
}
else { /* Version 2 */
+ static const int * v2_flags[] = {
+ &hf_srvloc_flags_v2_overflow,
+ &hf_srvloc_flags_v2_fresh,
+ &hf_srvloc_flags_v2_reqmulti,
+ NULL
+ };
+
length = tvb_get_ntoh24(tvb, offset + 2);
- proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 3,
- length);
- flags = tvb_get_ntohs(tvb, offset + 5);
- tf = proto_tree_add_uint(srvloc_tree, hf_srvloc_flags_v2, tvb, offset + 5, 2,
- flags);
- srvloc_flags = proto_item_add_subtree(tf, ett_srvloc_flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_overflow,
- tvb, offset+5, 1, flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_fresh,
- tvb, offset+5, 1, flags);
- proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_reqmulti,
- tvb, offset+5, 1, flags);
+ proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 3, length);
+ proto_tree_add_bitmask(srvloc_tree, tvb, offset + 5, hf_srvloc_flags_v2, ett_srvloc_flags, v2_flags, ENC_BIG_ENDIAN);
next_ext_off = tvb_get_ntoh24(tvb, offset + 7);
proto_tree_add_uint(srvloc_tree, hf_srvloc_nextextoff, tvb, offset + 7, 3,
diff --git a/epan/dissectors/packet-telnet.c b/epan/dissectors/packet-telnet.c
index d19228bb5a..bb64ae1f61 100644
--- a/epan/dissectors/packet-telnet.c
+++ b/epan/dissectors/packet-telnet.c
@@ -967,10 +967,9 @@ static const value_string auth_krb5_types[] = {
static void
dissect_authentication_type_pair(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, proto_tree *tree)
{
- guint8 type, mod;
+ guint8 mod;
- type=tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(tree, hf_telnet_auth_type, tvb, offset, 1, type);
+ proto_tree_add_item(tree, hf_telnet_auth_type, tvb, offset, 1, ENC_NA);
mod=tvb_get_guint8(tvb, offset+1);
proto_tree_add_uint(tree, hf_telnet_auth_mod_enc, tvb, offset+1, 1, mod);
diff --git a/epan/dissectors/packet-tr.c b/epan/dissectors/packet-tr.c
index 404208103a..83afb858ca 100644
--- a/epan/dissectors/packet-tr.c
+++ b/epan/dissectors/packet-tr.c
@@ -383,7 +383,7 @@ capture_tr(const guchar *pd, int offset, int len, packet_counts *ld) {
static void
dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_tree *tr_tree, *bf_tree;
+ proto_tree *tr_tree;
proto_item *ti, *hidden_item;
guint8 rcf1, rcf2;
tvbuff_t *next_tvb;
@@ -554,26 +554,30 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* protocol analysis tree */
if (tree) {
+ static const int * ac[] = {
+ &hf_tr_priority,
+ &hf_tr_frame,
+ &hf_tr_monitor_cnt,
+ &hf_tr_priority_reservation,
+ NULL
+ };
+ static const int * fc_flags[] = {
+ &hf_tr_fc_type,
+ &hf_tr_fc_pcf,
+ NULL
+ };
+
/* Create Token-Ring Tree */
ti = proto_tree_add_item(tree, proto_tr, tr_tvb, 0, TR_MIN_HEADER_LEN + actual_rif_bytes, ENC_NA);
tr_tree = proto_item_add_subtree(ti, ett_token_ring);
/* Create the Access Control bitfield tree */
trh->ac = tvb_get_guint8(tr_tvb, 0);
- ti = proto_tree_add_uint(tr_tree, hf_tr_ac, tr_tvb, 0, 1, trh->ac);
- bf_tree = proto_item_add_subtree(ti, ett_token_ring_ac);
-
- proto_tree_add_uint(bf_tree, hf_tr_priority, tr_tvb, 0, 1, trh->ac);
- proto_tree_add_boolean(bf_tree, hf_tr_frame, tr_tvb, 0, 1, trh->ac);
- proto_tree_add_uint(bf_tree, hf_tr_monitor_cnt, tr_tvb, 0, 1, trh->ac);
- proto_tree_add_uint(bf_tree, hf_tr_priority_reservation, tr_tvb, 0, 1, trh->ac);
+ proto_tree_add_bitmask(tr_tree, tr_tvb, 0, hf_tr_ac, ett_token_ring_ac, ac, ENC_NA);
/* Create the Frame Control bitfield tree */
- ti = proto_tree_add_uint(tr_tree, hf_tr_fc, tr_tvb, 1, 1, trh->fc);
- bf_tree = proto_item_add_subtree(ti, ett_token_ring_fc);
+ proto_tree_add_bitmask(tr_tree, tr_tvb, 1, hf_tr_fc, ett_token_ring_fc, fc_flags, ENC_NA);
- proto_tree_add_uint(bf_tree, hf_tr_fc_type, tr_tvb, 1, 1, trh->fc);
- proto_tree_add_uint(bf_tree, hf_tr_fc_pcf, tr_tvb, 1, 1, trh->fc);
proto_tree_add_ether(tr_tree, hf_tr_dst, tr_tvb, 2, 6, (const guint8 *)trh->dst.data);
proto_tree_add_ether(tr_tree, hf_tr_src, tr_tvb, 8, 6, (const guint8 *)trh->src.data);
hidden_item = proto_tree_add_ether(tr_tree, hf_tr_addr, tr_tvb, 2, 6, (const guint8 *)trh->dst.data);
diff --git a/epan/dissectors/packet-usb-video.c b/epan/dissectors/packet-usb-video.c
index 6ac4a3babe..44155ba2f8 100644
--- a/epan/dissectors/packet-usb-video.c
+++ b/epan/dissectors/packet-usb-video.c
@@ -1180,16 +1180,12 @@ dissect_usb_video_format(proto_tree *tree, tvbuff_t *tvb, int offset,
}
else if (subtype == VS_FORMAT_MJPEG)
{
- proto_item *flags_item = NULL;
- proto_tree *flags_tree = NULL;
- guint8 bmFlags;
-
- flags_item = proto_tree_add_item(tree, hf_usb_vid_mjpeg_flags, tvb, offset, 1, ENC_NA);
- flags_tree = proto_item_add_subtree(flags_item, ett_mjpeg_flags);
-
- bmFlags = tvb_get_guint8(tvb, offset);
+ static const int * flags[] = {
+ &hf_usb_vid_mjpeg_fixed_samples,
+ NULL
+ };
- proto_tree_add_boolean(flags_tree, hf_usb_vid_mjpeg_fixed_samples, tvb, offset, 1, bmFlags);
+ proto_tree_add_bitmask(tree, tvb, offset, hf_usb_vid_mjpeg_flags, ett_mjpeg_flags, flags, ENC_NA);
offset++;
}
else
diff --git a/epan/dissectors/packet-winsrepl.c b/epan/dissectors/packet-winsrepl.c
index 48328cb778..7737a521fe 100644
--- a/epan/dissectors/packet-winsrepl.c
+++ b/epan/dissectors/packet-winsrepl.c
@@ -379,8 +379,6 @@ dissect_winsrepl_wins_name(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
{
proto_item *name_item = NULL, *ti;
proto_tree *name_tree = NULL;
- proto_item *flags_item;
- proto_tree *flags_tree;
int old_offset = winsrepl_offset;
tvbuff_t *name_tvb = NULL;
guint32 name_len;
@@ -388,6 +386,14 @@ dissect_winsrepl_wins_name(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
int name_type;
guint32 flags;
guint32 addr;
+ static const int * name_flags[] = {
+ &hf_winsrepl_name_flags_rectype,
+ &hf_winsrepl_name_flags_recstate,
+ &hf_winsrepl_name_flags_local,
+ &hf_winsrepl_name_flags_hosttype,
+ &hf_winsrepl_name_flags_static,
+ NULL
+ };
if (sub_tree) {
name_tree = proto_tree_add_subtree_format(sub_tree, winsrepl_tvb, winsrepl_offset, -1,
@@ -434,13 +440,7 @@ dissect_winsrepl_wins_name(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
* anything in the Samba code about them.
*/
flags = tvb_get_ntohl(winsrepl_tvb, winsrepl_offset);
- flags_item = proto_tree_add_uint(name_tree, hf_winsrepl_name_flags, winsrepl_tvb, winsrepl_offset, 4, flags);
- flags_tree = proto_item_add_subtree(flags_item, ett_winsrepl_flags);
- proto_tree_add_uint(flags_tree, hf_winsrepl_name_flags_rectype, winsrepl_tvb, winsrepl_offset, 4, flags);
- proto_tree_add_uint(flags_tree, hf_winsrepl_name_flags_recstate, winsrepl_tvb, winsrepl_offset, 4, flags);
- proto_tree_add_boolean(flags_tree, hf_winsrepl_name_flags_local, winsrepl_tvb, winsrepl_offset, 4, flags);
- proto_tree_add_uint(flags_tree, hf_winsrepl_name_flags_hosttype, winsrepl_tvb, winsrepl_offset, 4, flags);
- proto_tree_add_boolean(flags_tree, hf_winsrepl_name_flags_static, winsrepl_tvb, winsrepl_offset, 4, flags);
+ proto_tree_add_bitmask(name_tree, winsrepl_tvb, winsrepl_offset, hf_winsrepl_name_flags, ett_winsrepl_flags, name_flags, ENC_BIG_ENDIAN);
winsrepl_offset += 4;
/* GROUP_FLAG */
diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c
index bdcb838ee2..a8295a8658 100644
--- a/epan/dissectors/packet-wsp.c
+++ b/epan/dissectors/packet-wsp.c
@@ -4287,6 +4287,12 @@ parameter_value_q (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start)
return offset;
}
+static const int * address_length_flags[] = {
+ &hf_address_flags_length_bearer_type_included,
+ &hf_address_flags_length_port_number_included,
+ &hf_address_flags_length_address_len,
+ NULL
+};
/* Code to actually dissect the packets */
@@ -4302,15 +4308,12 @@ static void
dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dissector_handle_t dissector_handle)
{
- guint8 flags;
proto_item *ti;
proto_tree *addresses_tree = NULL;
proto_tree *addr_tree = NULL;
- proto_tree *flags_tree;
guint8 bearer_type;
guint8 address_flags_len;
int address_len;
- proto_tree *address_flags_tree;
guint16 port_num;
guint32 address_ipv4;
struct e_in6_addr address_ipv6;
@@ -4318,20 +4321,17 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
conversation_t *conv;
guint32 idx = 0; /* Address index */
guint32 address_record_len; /* Length of the entire address record */
+ static const int * flags[] = {
+ &hf_wsp_redirect_permanent,
+ &hf_wsp_redirect_reuse_security_session,
+ NULL
+ };
+
/*
* Redirect flags.
*/
- flags = tvb_get_guint8 (tvb, offset);
- if (tree) {
- ti = proto_tree_add_uint (tree, hf_wsp_redirect_flags,
- tvb, offset, 1, flags);
- flags_tree = proto_item_add_subtree (ti, ett_redirect_flags);
- proto_tree_add_boolean (flags_tree, hf_wsp_redirect_permanent,
- tvb, offset, 1, flags);
- proto_tree_add_boolean (flags_tree, hf_wsp_redirect_reuse_security_session,
- tvb, offset, 1, flags);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_wsp_redirect_flags, ett_redirect_flags, flags, ENC_NA);
offset++;
/*
@@ -4355,38 +4355,24 @@ dissect_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ (address_flags_len & PORT_NUMBER_INCLUDED ? 2 : 0)
;
- if (tree) {
- ti = proto_tree_add_uint(addresses_tree, hf_address_entry,
- tvb, offset, 1 + address_record_len, idx);
- addr_tree = proto_item_add_subtree(ti, ett_address);
-
- ti = proto_tree_add_uint (addr_tree, hf_address_flags_length,
- tvb, offset, 1, address_flags_len);
- address_flags_tree = proto_item_add_subtree (ti, ett_address_flags);
- proto_tree_add_boolean (address_flags_tree, hf_address_flags_length_bearer_type_included,
- tvb, offset, 1, address_flags_len);
- proto_tree_add_boolean (address_flags_tree, hf_address_flags_length_port_number_included,
- tvb, offset, 1, address_flags_len);
- proto_tree_add_uint (address_flags_tree, hf_address_flags_length_address_len,
- tvb, offset, 1, address_flags_len);
- }
+ ti = proto_tree_add_uint(addresses_tree, hf_address_entry,
+ tvb, offset, 1 + address_record_len, idx);
+ addr_tree = proto_item_add_subtree(ti, ett_address);
+
+ proto_tree_add_bitmask(addr_tree, tvb, offset, hf_address_flags_length, ett_address_flags, address_length_flags, ENC_NA);
offset++;
if (address_flags_len & BEARER_TYPE_INCLUDED) {
bearer_type = tvb_get_guint8 (tvb, offset);
- if (tree) {
- proto_tree_add_uint (addr_tree, hf_address_bearer_type,
+ proto_tree_add_uint (addr_tree, hf_address_bearer_type,
tvb, offset, 1, bearer_type);
- }
offset++;
} else {
bearer_type = 0x00; /* XXX */
}
if (address_flags_len & PORT_NUMBER_INCLUDED) {
port_num = tvb_get_ntohs (tvb, offset);
- if (tree) {
- proto_tree_add_uint (addr_tree, hf_address_port_num,
+ proto_tree_add_uint (addr_tree, hf_address_port_num,
tvb, offset, 2, port_num);
- }
offset += 2;
} else {
/*
@@ -4523,7 +4509,6 @@ add_addresses(proto_tree *tree, tvbuff_t *tvb, int hf)
guint8 bearer_type;
guint8 address_flags_len;
int address_len;
- proto_tree *address_flags_tree;
guint32 tvb_len = tvb_length(tvb);
guint32 offset = 0;
guint32 idx = 0; /* Address index */
@@ -4558,15 +4543,7 @@ add_addresses(proto_tree *tree, tvbuff_t *tvb, int hf)
tvb, offset, 1 + address_record_len, idx);
addr_tree = proto_item_add_subtree(ti, ett_address);
- ti = proto_tree_add_uint (addr_tree, hf_address_flags_length,
- tvb, offset, 1, address_flags_len);
- address_flags_tree = proto_item_add_subtree (ti, ett_address_flags);
- proto_tree_add_boolean (address_flags_tree, hf_address_flags_length_bearer_type_included,
- tvb, offset, 1, address_flags_len);
- proto_tree_add_boolean (address_flags_tree, hf_address_flags_length_port_number_included,
- tvb, offset, 1, address_flags_len);
- proto_tree_add_uint (address_flags_tree, hf_address_flags_length_address_len,
- tvb, offset, 1, address_flags_len);
+ proto_tree_add_bitmask(addr_tree, tvb, offset, hf_address_flags_length, ett_address_flags, address_length_flags, ENC_NA);
offset++;
if (address_flags_len & BEARER_TYPE_INCLUDED) {
bearer_type = tvb_get_guint8 (tvb, offset);
diff --git a/epan/dissectors/packet-ypserv.c b/epan/dissectors/packet-ypserv.c
index a43fa26c5f..33f6615660 100644
--- a/epan/dissectors/packet-ypserv.c
+++ b/epan/dissectors/packet-ypserv.c
@@ -159,11 +159,8 @@ dissect_domain_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
{
proto_item_append_text(tree, " DOMAIN reply");
- if ( tree )
- {
- proto_tree_add_boolean(tree, hf_ypserv_servesdomain, tvb,
- offset, 4, tvb_get_ntohl(tvb,offset));
- }
+ proto_tree_add_item(tree, hf_ypserv_servesdomain, tvb,
+ offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
@@ -174,11 +171,8 @@ dissect_domain_nonack_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, p
{
proto_item_append_text(tree, " DOMAIN_NONACK reply");
- if ( tree )
- {
- proto_tree_add_boolean(tree, hf_ypserv_servesdomain, tvb,
- offset, 4, tvb_get_ntohl(tvb,offset));
- }
+ proto_tree_add_item(tree, hf_ypserv_servesdomain, tvb,
+ offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c
index 5d973a6056..2d7e96a941 100644
--- a/epan/dissectors/packet-zbee-nwk.c
+++ b/epan/dissectors/packet-zbee-nwk.c
@@ -117,6 +117,7 @@ static int hf_zbee_nwk_cmd_leave_rejoin = -1;
static int hf_zbee_nwk_cmd_leave_request = -1;
static int hf_zbee_nwk_cmd_leave_children = -1;
static int hf_zbee_nwk_cmd_relay_count = -1;
+static int hf_zbee_nwk_cmd_cinfo = -1;
static int hf_zbee_nwk_cmd_cinfo_alt_coord = -1;
static int hf_zbee_nwk_cmd_cinfo_type = -1;
static int hf_zbee_nwk_cmd_cinfo_power = -1;
@@ -1140,32 +1141,17 @@ dissect_zbee_nwk_route_rec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static guint
dissect_zbee_nwk_rejoin_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, zbee_nwk_packet * packet, guint offset)
{
- proto_tree *field_tree;
- proto_item *ti;
-
- guint8 capabilities;
+ static const int * capabilities[] = {
+ &hf_zbee_nwk_cmd_cinfo_alt_coord,
+ &hf_zbee_nwk_cmd_cinfo_type,
+ &hf_zbee_nwk_cmd_cinfo_power,
+ &hf_zbee_nwk_cmd_cinfo_idle_rx,
+ &hf_zbee_nwk_cmd_cinfo_security,
+ &hf_zbee_nwk_cmd_cinfo_alloc,
+ NULL
+ };
- /* Get and dispaly the capabilities information. */
- capabilities = tvb_get_guint8(tvb, offset);
- if (tree) {
- /* Create a subtree for the capability information. */
- ti = proto_tree_add_text(tree, tvb, offset, 1, "Capability Information");
- field_tree = proto_item_add_subtree(ti, ett_zbee_nwk_cmd_cinfo);
-
- /* Add the capability info flags. */
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_cinfo_alt_coord, tvb, offset, 1,
- capabilities & ZBEE_CINFO_ALT_COORD);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_cinfo_type, tvb, offset, 1,
- capabilities & ZBEE_CINFO_FFD);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_cinfo_power, tvb, offset, 1,
- capabilities & ZBEE_CINFO_POWER);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_cinfo_idle_rx, tvb, offset, 1,
- capabilities & ZBEE_CINFO_IDLE_RX);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_cinfo_security, tvb, offset, 1,
- capabilities & ZBEE_CINFO_SECURITY);
- proto_tree_add_boolean(field_tree, hf_zbee_nwk_cmd_cinfo_alloc, tvb, offset, 1,
- capabilities & ZBEE_CINFO_ALLOC);
- }
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_cmd_cinfo, ett_zbee_nwk_cmd_cinfo, capabilities, ENC_NA);
offset += 1;
/* Update the info column.*/
@@ -1830,6 +1816,10 @@ void proto_register_zbee_nwk(void)
{ "Relay Count", "zbee_nwk.cmd.relay_count", FT_UINT8, BASE_DEC, NULL, 0x0,
"Number of relays required to route to the destination.", HFILL }},
+ { &hf_zbee_nwk_cmd_cinfo,
+ { "Capability Information", "zbee_nwk.cmd.cinfo", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_nwk_cmd_cinfo_alt_coord,
{ "Alternate Coordinator", "zbee_nwk.cmd.cinfo.alt_coord", FT_BOOLEAN, 8, NULL,
IEEE802154_CMD_CINFO_ALT_PAN_COORD,
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index 0cf9936291..ac57361869 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -1102,6 +1102,13 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 1;
break;
case ZBEE_ZCL_CSC_THERMOSTAT_C_SWS:
+ {
+ static const int * modes[] = {
+ &hf_zbee_zcl_thermostat_client_sws_mfs_heat,
+ &hf_zbee_zcl_thermostat_client_sws_mfs_cool,
+ NULL
+ };
+
/* Set Weekly Schedule. */
number_of_transitions = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(zcl_tree, hf_zbee_zcl_thermostat_client_sws_n_trans, tvb, offset, 1,
@@ -1119,13 +1126,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
offset += 1;
mode_for_sequence = tvb_get_guint8(tvb, offset);
- ti = proto_tree_add_uint_format(zcl_tree, hf_zbee_zcl_thermostat_client_sws_mfs, tvb,
- offset, 1, mode_for_sequence, "Mode for Sequence");
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_thermostat_client_sws_mfs);
- proto_tree_add_boolean(sub_tree, hf_zbee_zcl_thermostat_client_sws_mfs_heat, tvb,
- offset, 1, mode_for_sequence);
- proto_tree_add_boolean(sub_tree, hf_zbee_zcl_thermostat_client_sws_mfs_cool, tvb,
- offset, 1, mode_for_sequence);
+ proto_tree_add_bitmask(zcl_tree, tvb, offset, hf_zbee_zcl_thermostat_client_sws_mfs, ett_zbee_zcl_thermostat_client_sws_mfs, modes, ENC_NA);
offset += 1;
for (i = 1; i <= number_of_transitions; ++i) {
switch (mode_for_sequence) {
@@ -1168,6 +1169,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
}
}
+ }
break;
}
}
@@ -1181,6 +1183,13 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 1;
switch (packet.cmd_id) {
case ZBEE_ZCL_CSC_THERMOSTAT_S_GWSR:
+ {
+ static const int * modes[] = {
+ &hf_zbee_zcl_thermostat_server_gwsr_mfs_heat,
+ &hf_zbee_zcl_thermostat_server_gwsr_mfs_cool,
+ NULL
+ };
+
/* Get Weekly Schedule Response. */
number_of_transitions = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(zcl_tree, hf_zbee_zcl_thermostat_server_gwsr_n_trans, tvb, offset,
@@ -1198,13 +1207,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
offset += 1;
mode_for_sequence = tvb_get_guint8(tvb, offset);
- ti = proto_tree_add_uint_format(zcl_tree, hf_zbee_zcl_thermostat_server_gwsr_mfs, tvb,
- offset, 1, mode_for_sequence, "Mode for Sequence");
- sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_thermostat_server_gwsr_mfs);
- proto_tree_add_boolean(sub_tree, hf_zbee_zcl_thermostat_server_gwsr_mfs_heat, tvb,
- offset, 1, mode_for_sequence);
- proto_tree_add_boolean(sub_tree, hf_zbee_zcl_thermostat_server_gwsr_mfs_cool, tvb,
- offset, 1, mode_for_sequence);
+ proto_tree_add_bitmask(zcl_tree, tvb, offset, hf_zbee_zcl_thermostat_server_gwsr_mfs, ett_zbee_zcl_thermostat_server_gwsr_mfs, modes, ENC_NA);
offset += 1;
for (i = 1; i <= number_of_transitions; ++i) {
switch (mode_for_sequence) {
@@ -1247,6 +1250,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
}
}
+ }
break;
}
}
diff --git a/epan/dissectors/packet-zebra.c b/epan/dissectors/packet-zebra.c
index 0cb7c6e493..9af6819f85 100644
--- a/epan/dissectors/packet-zebra.c
+++ b/epan/dissectors/packet-zebra.c
@@ -256,23 +256,17 @@ zebra_route_ifindex(proto_tree *tree, tvbuff_t *tvb, int offset, guint16 len)
}
static guint8
-zebra_route_message(proto_tree *tree, tvbuff_t *tvb, int offset, guint8 message)
+zebra_route_message(proto_tree *tree, tvbuff_t *tvb, int offset)
{
- proto_item *ti;
- proto_tree *msg_tree;
-
- ti = proto_tree_add_uint(tree, hf_zebra_message, tvb,
- offset, 1, message);
- msg_tree = proto_item_add_subtree(ti, ett_message);
-
- proto_tree_add_boolean(msg_tree, hf_zebra_msg_nexthop,
- tvb, offset, 1, message);
- proto_tree_add_boolean(msg_tree, hf_zebra_msg_index,
- tvb, offset, 1, message);
- proto_tree_add_boolean(msg_tree, hf_zebra_msg_distance,
- tvb, offset, 1, message);
- proto_tree_add_boolean(msg_tree, hf_zebra_msg_metric,
- tvb, offset, 1, message);
+ static const int * flags[] = {
+ &hf_zebra_msg_nexthop,
+ &hf_zebra_msg_index,
+ &hf_zebra_msg_distance,
+ &hf_zebra_msg_metric,
+ NULL
+ };
+
+ proto_tree_add_bitmask(tree, tvb, offset, hf_zebra_message, ett_message, flags, ENC_NA);
offset += 1;
return offset;
@@ -294,7 +288,7 @@ zebra_route(proto_tree *tree, tvbuff_t *tvb, int offset, guint16 len,
offset += 1;
message = tvb_get_guint8(tvb, offset);
- offset = zebra_route_message(tree, tvb, offset, message);
+ offset = zebra_route_message(tree, tvb, offset);
prefixlen = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(tree, hf_zebra_prefixlen, tvb,