aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-dcerpc-atsvc.c447
-rw-r--r--epan/dissectors/packet-dcerpc-dfs.c186
-rw-r--r--epan/dissectors/packet-dcerpc-dnsserver.c377
-rw-r--r--epan/dissectors/packet-dcerpc-dssetup.c56
-rw-r--r--epan/dissectors/packet-dcerpc-eventlog.c130
-rw-r--r--epan/dissectors/packet-dcerpc-frsrpc.c375
-rw-r--r--epan/dissectors/packet-dcerpc-frstrans.c29
-rw-r--r--epan/dissectors/packet-dcerpc-initshutdown.c38
-rw-r--r--epan/dissectors/packet-dcerpc-lsa.c18
-rw-r--r--epan/dissectors/packet-dcerpc-mapi.c128
-rw-r--r--epan/dissectors/packet-dcerpc-samr.c721
-rw-r--r--epan/dissectors/packet-dcerpc-winreg.c186
-rw-r--r--epan/dissectors/packet-dcerpc-witness.c141
-rw-r--r--tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm69
14 files changed, 562 insertions, 2339 deletions
diff --git a/epan/dissectors/packet-dcerpc-atsvc.c b/epan/dissectors/packet-dcerpc-atsvc.c
index 2dd9fa8c78..afb9f2194d 100644
--- a/epan/dissectors/packet-dcerpc-atsvc.c
+++ b/epan/dissectors/packet-dcerpc-atsvc.c
@@ -362,272 +362,53 @@ static int atsvc_dissect_element_JobGetInfo_job_info__(tvbuff_t *tvb _U_, int of
int
atsvc_dissect_bitmap_DaysOfMonth(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * atsvc_atsvc_DaysOfMonth_fields[] = {
+ &hf_atsvc_atsvc_DaysOfMonth_First,
+ &hf_atsvc_atsvc_DaysOfMonth_Second,
+ &hf_atsvc_atsvc_DaysOfMonth_Third,
+ &hf_atsvc_atsvc_DaysOfMonth_Fourth,
+ &hf_atsvc_atsvc_DaysOfMonth_Fifth,
+ &hf_atsvc_atsvc_DaysOfMonth_Sixth,
+ &hf_atsvc_atsvc_DaysOfMonth_Seventh,
+ &hf_atsvc_atsvc_DaysOfMonth_Eight,
+ &hf_atsvc_atsvc_DaysOfMonth_Ninth,
+ &hf_atsvc_atsvc_DaysOfMonth_Tenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Eleventh,
+ &hf_atsvc_atsvc_DaysOfMonth_Twelfth,
+ &hf_atsvc_atsvc_DaysOfMonth_Thitteenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Fourteenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Fifteenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Sixteenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Seventeenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Eighteenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Ninteenth,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentyth,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentyfirst,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentysecond,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentythird,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentyfourth,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentyfifth,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentysixth,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentyseventh,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentyeighth,
+ &hf_atsvc_atsvc_DaysOfMonth_Twentyninth,
+ &hf_atsvc_atsvc_DaysOfMonth_Thirtieth,
+ &hf_atsvc_atsvc_DaysOfMonth_Thirtyfirst,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_atsvc_atsvc_DaysOfMonth);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_atsvc_atsvc_DaysOfMonth, atsvc_atsvc_DaysOfMonth_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_First, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "First");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Second, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "Second");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Third, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "Third");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Fourth, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "Fourth");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Fifth, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "Fifth");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Sixth, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "Sixth");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Seventh, tvb, offset-4, 4, flags);
- if (flags&( 0x00000040 )){
- proto_item_append_text(item, "Seventh");
- if (flags & (~( 0x00000040 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000040 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Eight, tvb, offset-4, 4, flags);
- if (flags&( 0x00000080 )){
- proto_item_append_text(item, "Eight");
- if (flags & (~( 0x00000080 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000080 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Ninth, tvb, offset-4, 4, flags);
- if (flags&( 0x00000100 )){
- proto_item_append_text(item, "Ninth");
- if (flags & (~( 0x00000100 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000100 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Tenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00000200 )){
- proto_item_append_text(item, "Tenth");
- if (flags & (~( 0x00000200 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000200 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Eleventh, tvb, offset-4, 4, flags);
- if (flags&( 0x00000400 )){
- proto_item_append_text(item, "Eleventh");
- if (flags & (~( 0x00000400 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000400 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twelfth, tvb, offset-4, 4, flags);
- if (flags&( 0x00000800 )){
- proto_item_append_text(item, "Twelfth");
- if (flags & (~( 0x00000800 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000800 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Thitteenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00001000 )){
- proto_item_append_text(item, "Thitteenth");
- if (flags & (~( 0x00001000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00001000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Fourteenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00002000 )){
- proto_item_append_text(item, "Fourteenth");
- if (flags & (~( 0x00002000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00002000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Fifteenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00004000 )){
- proto_item_append_text(item, "Fifteenth");
- if (flags & (~( 0x00004000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00004000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Sixteenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00008000 )){
- proto_item_append_text(item, "Sixteenth");
- if (flags & (~( 0x00008000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00008000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Seventeenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00010000 )){
- proto_item_append_text(item, "Seventeenth");
- if (flags & (~( 0x00010000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00010000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Eighteenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00020000 )){
- proto_item_append_text(item, "Eighteenth");
- if (flags & (~( 0x00020000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00020000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Ninteenth, tvb, offset-4, 4, flags);
- if (flags&( 0x00040000 )){
- proto_item_append_text(item, "Ninteenth");
- if (flags & (~( 0x00040000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00040000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentyth, tvb, offset-4, 4, flags);
- if (flags&( 0x00080000 )){
- proto_item_append_text(item, "Twentyth");
- if (flags & (~( 0x00080000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00080000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentyfirst, tvb, offset-4, 4, flags);
- if (flags&( 0x00100000 )){
- proto_item_append_text(item, "Twentyfirst");
- if (flags & (~( 0x00100000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00100000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentysecond, tvb, offset-4, 4, flags);
- if (flags&( 0x00200000 )){
- proto_item_append_text(item, "Twentysecond");
- if (flags & (~( 0x00200000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00200000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentythird, tvb, offset-4, 4, flags);
- if (flags&( 0x00400000 )){
- proto_item_append_text(item, "Twentythird");
- if (flags & (~( 0x00400000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00400000 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentyfourth, tvb, offset-4, 4, flags);
- if (flags&( 0x00800000 )){
- proto_item_append_text(item, "Twentyfourth");
- if (flags & (~( 0x00800000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00800000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentyfifth, tvb, offset-4, 4, flags);
- if (flags&( 0x01000000 )){
- proto_item_append_text(item, "Twentyfifth");
- if (flags & (~( 0x01000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01000000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentysixth, tvb, offset-4, 4, flags);
- if (flags&( 0x02000000 )){
- proto_item_append_text(item, "Twentysixth");
- if (flags & (~( 0x02000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02000000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentyseventh, tvb, offset-4, 4, flags);
- if (flags&( 0x04000000 )){
- proto_item_append_text(item, "Twentyseventh");
- if (flags & (~( 0x04000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x04000000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentyeighth, tvb, offset-4, 4, flags);
- if (flags&( 0x08000000 )){
- proto_item_append_text(item, "Twentyeighth");
- if (flags & (~( 0x08000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x08000000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Twentyninth, tvb, offset-4, 4, flags);
- if (flags&( 0x10000000 )){
- proto_item_append_text(item, "Twentyninth");
- if (flags & (~( 0x10000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x10000000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Thirtieth, tvb, offset-4, 4, flags);
- if (flags&( 0x20000000 )){
- proto_item_append_text(item, "Thirtieth");
- if (flags & (~( 0x20000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x20000000 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfMonth_Thirtyfirst, tvb, offset-4, 4, flags);
- if (flags&( 0x40000000 )){
- proto_item_append_text(item, "Thirtyfirst");
- if (flags & (~( 0x40000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x40000000 ));
-
- if (flags) {
+ if (flags & (~0x7fffffff)) {
+ flags &= (~0x7fffffff);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -646,63 +427,26 @@ atsvc_dissect_bitmap_DaysOfMonth(tvbuff_t *tvb _U_, int offset _U_, packet_info
int
atsvc_dissect_bitmap_Flags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * atsvc_atsvc_Flags_fields[] = {
+ &hf_atsvc_atsvc_Flags_JOB_RUN_PERIODICALLY,
+ &hf_atsvc_atsvc_Flags_JOB_EXEC_ERROR,
+ &hf_atsvc_atsvc_Flags_JOB_RUNS_TODAY,
+ &hf_atsvc_atsvc_Flags_JOB_ADD_CURRENT_DATE,
+ &hf_atsvc_atsvc_Flags_JOB_NONINTERACTIVE,
+ };
guint8 flags;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 1, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_atsvc_atsvc_Flags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_atsvc_atsvc_Flags, atsvc_atsvc_Flags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint8(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint8(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_Flags_JOB_RUN_PERIODICALLY, tvb, offset-1, 1, flags);
- if (flags&( 0x01 )){
- proto_item_append_text(item, "JOB_RUN_PERIODICALLY");
- if (flags & (~( 0x01 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_Flags_JOB_EXEC_ERROR, tvb, offset-1, 1, flags);
- if (flags&( 0x02 )){
- proto_item_append_text(item, "JOB_EXEC_ERROR");
- if (flags & (~( 0x02 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_Flags_JOB_RUNS_TODAY, tvb, offset-1, 1, flags);
- if (flags&( 0x04 )){
- proto_item_append_text(item, "JOB_RUNS_TODAY");
- if (flags & (~( 0x04 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x04 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_Flags_JOB_ADD_CURRENT_DATE, tvb, offset-1, 1, flags);
- if (flags&( 0x08 )){
- proto_item_append_text(item, "JOB_ADD_CURRENT_DATE");
- if (flags & (~( 0x08 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x08 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_Flags_JOB_NONINTERACTIVE, tvb, offset-1, 1, flags);
- if (flags&( 0x10 )){
- proto_item_append_text(item, "JOB_NONINTERACTIVE");
- if (flags & (~( 0x10 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x10 ));
-
- if (flags) {
+ if (flags & (~0x0000001f)) {
+ flags &= (~0x0000001f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -723,79 +467,28 @@ atsvc_dissect_bitmap_Flags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo
int
atsvc_dissect_bitmap_DaysOfWeek(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * atsvc_atsvc_DaysOfWeek_fields[] = {
+ &hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_MONDAY,
+ &hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_TUESDAY,
+ &hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_WEDNESDAY,
+ &hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_THURSDAY,
+ &hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_FRIDAY,
+ &hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_SATURDAY,
+ &hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_SUNDAY,
+ };
guint8 flags;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 1, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_atsvc_atsvc_DaysOfWeek);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_atsvc_atsvc_DaysOfWeek, atsvc_atsvc_DaysOfWeek_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint8(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint8(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_MONDAY, tvb, offset-1, 1, flags);
- if (flags&( 0x01 )){
- proto_item_append_text(item, "DAYSOFWEEK_MONDAY");
- if (flags & (~( 0x01 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_TUESDAY, tvb, offset-1, 1, flags);
- if (flags&( 0x02 )){
- proto_item_append_text(item, "DAYSOFWEEK_TUESDAY");
- if (flags & (~( 0x02 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_WEDNESDAY, tvb, offset-1, 1, flags);
- if (flags&( 0x04 )){
- proto_item_append_text(item, "DAYSOFWEEK_WEDNESDAY");
- if (flags & (~( 0x04 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x04 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_THURSDAY, tvb, offset-1, 1, flags);
- if (flags&( 0x08 )){
- proto_item_append_text(item, "DAYSOFWEEK_THURSDAY");
- if (flags & (~( 0x08 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x08 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_FRIDAY, tvb, offset-1, 1, flags);
- if (flags&( 0x10 )){
- proto_item_append_text(item, "DAYSOFWEEK_FRIDAY");
- if (flags & (~( 0x10 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x10 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_SATURDAY, tvb, offset-1, 1, flags);
- if (flags&( 0x20 )){
- proto_item_append_text(item, "DAYSOFWEEK_SATURDAY");
- if (flags & (~( 0x20 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x20 ));
-
- proto_tree_add_boolean(tree, hf_atsvc_atsvc_DaysOfWeek_DAYSOFWEEK_SUNDAY, tvb, offset-1, 1, flags);
- if (flags&( 0x40 )){
- proto_item_append_text(item, "DAYSOFWEEK_SUNDAY");
- if (flags & (~( 0x40 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x40 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x0000007f)) {
+ flags &= (~0x0000007f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-dfs.c b/epan/dissectors/packet-dcerpc-dfs.c
index 2f9ec2d96d..a10e0095b9 100644
--- a/epan/dissectors/packet-dcerpc-dfs.c
+++ b/epan/dissectors/packet-dcerpc-dfs.c
@@ -659,72 +659,28 @@ netdfs_dissect_struct_dfs_Info1(tvbuff_t *tvb _U_, int offset _U_, packet_info *
int
netdfs_dissect_bitmap_dfs_VolumeState(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * netdfs_dfs_VolumeState_fields[] = {
+ &hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_OK,
+ &hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_INCONSISTENT,
+ &hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_OFFLINE,
+ &hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_ONLINE,
+ &hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_STANDALONE,
+ &hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_AD_BLOB,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_netdfs_dfs_VolumeState);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_netdfs_dfs_VolumeState, netdfs_dfs_VolumeState_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_OK, tvb, offset-4, 4, flags);
- if (flags&( 0x1 )){
- proto_item_append_text(item, "DFS_VOLUME_STATE_OK");
- if (flags & (~( 0x1 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x1 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_INCONSISTENT, tvb, offset-4, 4, flags);
- if (flags&( 0x2 )){
- proto_item_append_text(item, "DFS_VOLUME_STATE_INCONSISTENT");
- if (flags & (~( 0x2 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x2 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_OFFLINE, tvb, offset-4, 4, flags);
- if (flags&( 0x4 )){
- proto_item_append_text(item, "DFS_VOLUME_STATE_OFFLINE");
- if (flags & (~( 0x4 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x4 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_ONLINE, tvb, offset-4, 4, flags);
- if (flags&( 0x8 )){
- proto_item_append_text(item, "DFS_VOLUME_STATE_ONLINE");
- if (flags & (~( 0x8 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x8 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_STANDALONE, tvb, offset-4, 4, flags);
- if (flags&( DFS_VOLUME_FLAVOR_STANDALONE )){
- proto_item_append_text(item, "DFS_VOLUME_STATE_STANDALONE");
- if (flags & (~( DFS_VOLUME_FLAVOR_STANDALONE )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( DFS_VOLUME_FLAVOR_STANDALONE ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_VolumeState_DFS_VOLUME_STATE_AD_BLOB, tvb, offset-4, 4, flags);
- if (flags&( DFS_VOLUME_FLAVOR_AD_BLOB )){
- proto_item_append_text(item, "DFS_VOLUME_STATE_AD_BLOB");
- if (flags & (~( DFS_VOLUME_FLAVOR_AD_BLOB )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( DFS_VOLUME_FLAVOR_AD_BLOB ));
-
- if (flags) {
+ if (flags & (~0x000001cd)) {
+ flags &= (~0x000001cd);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -838,48 +794,25 @@ netdfs_dissect_struct_dfs_Info2(tvbuff_t *tvb _U_, int offset _U_, packet_info *
int
netdfs_dissect_bitmap_dfs_StorageState(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * netdfs_dfs_StorageState_fields[] = {
+ &hf_netdfs_dfs_StorageState_DFS_STORAGE_STATE_OFFLINE,
+ &hf_netdfs_dfs_StorageState_DFS_STORAGE_STATE_ONLINE,
+ &hf_netdfs_dfs_StorageState_DFS_STORAGE_STATE_ACTIVE,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_netdfs_dfs_StorageState);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_netdfs_dfs_StorageState, netdfs_dfs_StorageState_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_StorageState_DFS_STORAGE_STATE_OFFLINE, tvb, offset-4, 4, flags);
- if (flags&( 1 )){
- proto_item_append_text(item, "DFS_STORAGE_STATE_OFFLINE");
- if (flags & (~( 1 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 1 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_StorageState_DFS_STORAGE_STATE_ONLINE, tvb, offset-4, 4, flags);
- if (flags&( 2 )){
- proto_item_append_text(item, "DFS_STORAGE_STATE_ONLINE");
- if (flags & (~( 2 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 2 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_StorageState_DFS_STORAGE_STATE_ACTIVE, tvb, offset-4, 4, flags);
- if (flags&( 4 )){
- proto_item_append_text(item, "DFS_STORAGE_STATE_ACTIVE");
- if (flags & (~( 4 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 4 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x00000007)) {
+ flags &= (~0x00000007);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1254,64 +1187,27 @@ netdfs_dissect_struct_dfs_Info4(tvbuff_t *tvb _U_, int offset _U_, packet_info *
int
netdfs_dissect_bitmap_dfs_PropertyFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * netdfs_dfs_PropertyFlags_fields[] = {
+ &hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_INSITE_REFERRALS,
+ &hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_ROOT_SCALABILITY,
+ &hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_SITE_COSTING,
+ &hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_TARGET_FAILBACK,
+ &hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_CLUSTER_ENABLED,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_netdfs_dfs_PropertyFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_netdfs_dfs_PropertyFlags, netdfs_dfs_PropertyFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_INSITE_REFERRALS, tvb, offset-4, 4, flags);
- if (flags&( 0x01 )){
- proto_item_append_text(item, "DFS_PROPERTY_FLAG_INSITE_REFERRALS");
- if (flags & (~( 0x01 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_ROOT_SCALABILITY, tvb, offset-4, 4, flags);
- if (flags&( 0x02 )){
- proto_item_append_text(item, "DFS_PROPERTY_FLAG_ROOT_SCALABILITY");
- if (flags & (~( 0x02 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_SITE_COSTING, tvb, offset-4, 4, flags);
- if (flags&( 0x04 )){
- proto_item_append_text(item, "DFS_PROPERTY_FLAG_SITE_COSTING");
- if (flags & (~( 0x04 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x04 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_TARGET_FAILBACK, tvb, offset-4, 4, flags);
- if (flags&( 0x08 )){
- proto_item_append_text(item, "DFS_PROPERTY_FLAG_TARGET_FAILBACK");
- if (flags & (~( 0x08 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x08 ));
-
- proto_tree_add_boolean(tree, hf_netdfs_dfs_PropertyFlags_DFS_PROPERTY_FLAG_CLUSTER_ENABLED, tvb, offset-4, 4, flags);
- if (flags&( 0x10 )){
- proto_item_append_text(item, "DFS_PROPERTY_FLAG_CLUSTER_ENABLED");
- if (flags & (~( 0x10 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x10 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x0000001f)) {
+ flags &= (~0x0000001f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-dnsserver.c b/epan/dissectors/packet-dcerpc-dnsserver.c
index 25a5b660db..020c58aab7 100644
--- a/epan/dissectors/packet-dcerpc-dnsserver.c
+++ b/epan/dissectors/packet-dcerpc-dnsserver.c
@@ -753,112 +753,33 @@ dnsserver_dissect_enum_DNS_RPC_BOOT_METHOD(tvbuff_t *tvb _U_, int offset _U_, pa
int
dnsserver_dissect_bitmap_DNS_LOG_LEVELS(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * dnsserver_DNS_LOG_LEVELS_fields[] = {
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_QUERY,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_NOTIFY,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_UPDATE,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_QUESTIONS,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_ANSWERS,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_SEND,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_RECV,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_UDP,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_TCP,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_FULL_PACKETS,
+ &hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_WRITE_THROUGH,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_dnsserver_DNS_LOG_LEVELS);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_dnsserver_DNS_LOG_LEVELS, dnsserver_DNS_LOG_LEVELS_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_QUERY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_QUERY");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_NOTIFY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_NOTIFY");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_UPDATE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_UPDATE");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_QUESTIONS, tvb, offset-4, 4, flags);
- if (flags&( 0x00000100 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_QUESTIONS");
- if (flags & (~( 0x00000100 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000100 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_ANSWERS, tvb, offset-4, 4, flags);
- if (flags&( 0x00000200 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_ANSWERS");
- if (flags & (~( 0x00000200 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000200 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_SEND, tvb, offset-4, 4, flags);
- if (flags&( 0x00001000 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_SEND");
- if (flags & (~( 0x00001000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00001000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_RECV, tvb, offset-4, 4, flags);
- if (flags&( 0x00002000 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_RECV");
- if (flags & (~( 0x00002000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00002000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_UDP, tvb, offset-4, 4, flags);
- if (flags&( 0x00004000 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_UDP");
- if (flags & (~( 0x00004000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00004000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_TCP, tvb, offset-4, 4, flags);
- if (flags&( 0x00008000 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_TCP");
- if (flags & (~( 0x00008000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00008000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_FULL_PACKETS, tvb, offset-4, 4, flags);
- if (flags&( 0x01000000 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_FULL_PACKETS");
- if (flags & (~( 0x01000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_LOG_LEVELS_DNS_LOG_LEVEL_WRITE_THROUGH, tvb, offset-4, 4, flags);
- if (flags&( 0x80000000 )){
- proto_item_append_text(item, "DNS_LOG_LEVEL_WRITE_THROUGH");
- if (flags & (~( 0x80000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x80000000 ));
-
- if (flags) {
+ if (flags & (~0x8100f331)) {
+ flags &= (~0x8100f331);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -875,48 +796,25 @@ dnsserver_dissect_bitmap_DNS_LOG_LEVELS(tvbuff_t *tvb _U_, int offset _U_, packe
int
dnsserver_dissect_bitmap_DNS_RPC_PROTOCOLS(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * dnsserver_DNS_RPC_PROTOCOLS_fields[] = {
+ &hf_dnsserver_DNS_RPC_PROTOCOLS_DNS_RPC_USE_TCPIP,
+ &hf_dnsserver_DNS_RPC_PROTOCOLS_DNS_RPC_USE_NAMED_PIPE,
+ &hf_dnsserver_DNS_RPC_PROTOCOLS_DNS_RPC_USE_LPC,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_dnsserver_DNS_RPC_PROTOCOLS);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_dnsserver_DNS_RPC_PROTOCOLS, dnsserver_DNS_RPC_PROTOCOLS_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_PROTOCOLS_DNS_RPC_USE_TCPIP, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "DNS_RPC_USE_TCPIP");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_PROTOCOLS_DNS_RPC_USE_NAMED_PIPE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "DNS_RPC_USE_NAMED_PIPE");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_PROTOCOLS_DNS_RPC_USE_LPC, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "DNS_RPC_USE_LPC");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- if (flags) {
+ if (flags & (~0x00000007)) {
+ flags &= (~0x00000007);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1015,80 +913,29 @@ dnsserver_dissect_enum_DNS_RECORD_TYPE(tvbuff_t *tvb _U_, int offset _U_, packet
int
dnsserver_dissect_bitmap_DNS_SELECT_FLAGS(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * dnsserver_DNS_SELECT_FLAGS_fields[] = {
+ &hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_AUTHORITY_DATA,
+ &hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_CACHE_DATA,
+ &hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_GLUE_DATA,
+ &hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_ROOT_HINT_DATA,
+ &hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_ADDITIONAL_DATA,
+ &hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_NO_CHILDREN,
+ &hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_ONLY_CHILDREN,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_dnsserver_DNS_SELECT_FLAGS);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_dnsserver_DNS_SELECT_FLAGS, dnsserver_DNS_SELECT_FLAGS_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_AUTHORITY_DATA, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "DNS_RPC_VIEW_AUTHORITY_DATA");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_CACHE_DATA, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "DNS_RPC_VIEW_CACHE_DATA");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_GLUE_DATA, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "DNS_RPC_VIEW_GLUE_DATA");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_ROOT_HINT_DATA, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "DNS_RPC_VIEW_ROOT_HINT_DATA");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_ADDITIONAL_DATA, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "DNS_RPC_VIEW_ADDITIONAL_DATA");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_NO_CHILDREN, tvb, offset-4, 4, flags);
- if (flags&( 0x00010000 )){
- proto_item_append_text(item, "DNS_RPC_VIEW_NO_CHILDREN");
- if (flags & (~( 0x00010000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00010000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_SELECT_FLAGS_DNS_RPC_VIEW_ONLY_CHILDREN, tvb, offset-4, 4, flags);
- if (flags&( 0x00020000 )){
- proto_item_append_text(item, "DNS_RPC_VIEW_ONLY_CHILDREN");
- if (flags & (~( 0x00020000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00020000 ));
-
- if (flags) {
+ if (flags & (~0x0003001f)) {
+ flags &= (~0x0003001f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1114,120 +961,34 @@ dnsserver_dissect_bitmap_DNS_SELECT_FLAGS(tvbuff_t *tvb _U_, int offset _U_, pac
int
dnsserver_dissect_bitmap_DNS_RPC_NODE_FLAGS(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * dnsserver_DNS_RPC_NODE_FLAGS_fields[] = {
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_CACHE_DATA,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_ZONE_ROOT,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_AUTH_ZONE_ROOT,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_ZONE_DELEGATION,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_RECOR_DEFAULT_TTL,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_RECORD_TTL_CHANGE,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_RECORD_CREATE_PTR,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_NODE_STICKY,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_NODE_COMPLETE,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_OPEN_ACL,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_AGING_ON,
+ &hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_SUPPRESS_NOTIFY,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_dnsserver_DNS_RPC_NODE_FLAGS);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_dnsserver_DNS_RPC_NODE_FLAGS, dnsserver_DNS_RPC_NODE_FLAGS_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_CACHE_DATA, tvb, offset-4, 4, flags);
- if (flags&( 0x80000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_CACHE_DATA");
- if (flags & (~( 0x80000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x80000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_ZONE_ROOT, tvb, offset-4, 4, flags);
- if (flags&( 0x40000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_ZONE_ROOT");
- if (flags & (~( 0x40000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x40000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_AUTH_ZONE_ROOT, tvb, offset-4, 4, flags);
- if (flags&( 0x20000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_AUTH_ZONE_ROOT");
- if (flags & (~( 0x20000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x20000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_ZONE_DELEGATION, tvb, offset-4, 4, flags);
- if (flags&( 0x10000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_ZONE_DELEGATION");
- if (flags & (~( 0x10000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x10000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_RECOR_DEFAULT_TTL, tvb, offset-4, 4, flags);
- if (flags&( 0x08000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_RECOR_DEFAULT_TTL");
- if (flags & (~( 0x08000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x08000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_RECORD_TTL_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x04000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_RECORD_TTL_CHANGE");
- if (flags & (~( 0x04000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x04000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_RECORD_CREATE_PTR, tvb, offset-4, 4, flags);
- if (flags&( 0x02000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_RECORD_CREATE_PTR");
- if (flags & (~( 0x02000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_NODE_STICKY, tvb, offset-4, 4, flags);
- if (flags&( 0x01000000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_NODE_STICKY");
- if (flags & (~( 0x01000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01000000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_NODE_COMPLETE, tvb, offset-4, 4, flags);
- if (flags&( 0x00800000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_NODE_COMPLETE");
- if (flags & (~( 0x00800000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00800000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_OPEN_ACL, tvb, offset-4, 4, flags);
- if (flags&( 0x00040000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_OPEN_ACL");
- if (flags & (~( 0x00040000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00040000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_AGING_ON, tvb, offset-4, 4, flags);
- if (flags&( 0x00020000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_AGING_ON");
- if (flags & (~( 0x00020000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00020000 ));
-
- proto_tree_add_boolean(tree, hf_dnsserver_DNS_RPC_NODE_FLAGS_DNS_RPC_FLAG_SUPPRESS_NOTIFY, tvb, offset-4, 4, flags);
- if (flags&( 0x00010000 )){
- proto_item_append_text(item, "DNS_RPC_FLAG_SUPPRESS_NOTIFY");
- if (flags & (~( 0x00010000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00010000 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0xff870000)) {
+ flags &= (~0xff870000);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-dssetup.c b/epan/dissectors/packet-dcerpc-dssetup.c
index 48485364cf..3a6ea31af0 100644
--- a/epan/dissectors/packet-dcerpc-dssetup.c
+++ b/epan/dissectors/packet-dcerpc-dssetup.c
@@ -164,56 +164,26 @@ dssetup_dissect_enum_DsRole(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinf
int
dssetup_dissect_bitmap_DsRoleFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * dssetup_dssetup_DsRoleFlags_fields[] = {
+ &hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_PRIMARY_DS_RUNNING,
+ &hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_PRIMARY_DS_MIXED_MODE,
+ &hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_UPGRADE_IN_PROGRESS,
+ &hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_dssetup_dssetup_DsRoleFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_dssetup_dssetup_DsRoleFlags, dssetup_dssetup_DsRoleFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_PRIMARY_DS_RUNNING, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "DS_ROLE_PRIMARY_DS_RUNNING");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_PRIMARY_DS_MIXED_MODE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "DS_ROLE_PRIMARY_DS_MIXED_MODE");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_UPGRADE_IN_PROGRESS, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "DS_ROLE_UPGRADE_IN_PROGRESS");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_dssetup_dssetup_DsRoleFlags_DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT, tvb, offset-4, 4, flags);
- if (flags&( 0x01000000 )){
- proto_item_append_text(item, "DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT");
- if (flags & (~( 0x01000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01000000 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x01000007)) {
+ flags &= (~0x01000007);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-eventlog.c b/epan/dissectors/packet-dcerpc-eventlog.c
index ca2b992a5a..18456733f4 100644
--- a/epan/dissectors/packet-dcerpc-eventlog.c
+++ b/epan/dissectors/packet-dcerpc-eventlog.c
@@ -380,56 +380,26 @@ eventlog_dissect_element_Record_strings(tvbuff_t *tvb, int offset, packet_info *
int
eventlog_dissect_bitmap_eventlogReadFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * eventlog_eventlogReadFlags_fields[] = {
+ &hf_eventlog_eventlogReadFlags_EVENTLOG_SEQUENTIAL_READ,
+ &hf_eventlog_eventlogReadFlags_EVENTLOG_SEEK_READ,
+ &hf_eventlog_eventlogReadFlags_EVENTLOG_FORWARDS_READ,
+ &hf_eventlog_eventlogReadFlags_EVENTLOG_BACKWARDS_READ,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_eventlog_eventlogReadFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_eventlog_eventlogReadFlags, eventlog_eventlogReadFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogReadFlags_EVENTLOG_SEQUENTIAL_READ, tvb, offset-4, 4, flags);
- if (flags&( 0x0001 )){
- proto_item_append_text(item, "EVENTLOG_SEQUENTIAL_READ");
- if (flags & (~( 0x0001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0001 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_eventlog_eventlogReadFlags_EVENTLOG_SEEK_READ, tvb, offset-4, 4, flags);
- if (flags&( 0x0002 )){
- proto_item_append_text(item, "EVENTLOG_SEEK_READ");
- if (flags & (~( 0x0002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0002 ));
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogReadFlags_EVENTLOG_FORWARDS_READ, tvb, offset-4, 4, flags);
- if (flags&( 0x0004 )){
- proto_item_append_text(item, "EVENTLOG_FORWARDS_READ");
- if (flags & (~( 0x0004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0004 ));
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogReadFlags_EVENTLOG_BACKWARDS_READ, tvb, offset-4, 4, flags);
- if (flags&( 0x0008 )){
- proto_item_append_text(item, "EVENTLOG_BACKWARDS_READ");
- if (flags & (~( 0x0008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0008 ));
-
- if (flags) {
+ if (flags & (~0x0000000f)) {
+ flags &= (~0x0000000f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -449,72 +419,28 @@ eventlog_dissect_bitmap_eventlogReadFlags(tvbuff_t *tvb _U_, int offset _U_, pac
int
eventlog_dissect_bitmap_eventlogEventTypes(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * eventlog_eventlogEventTypes_fields[] = {
+ &hf_eventlog_eventlogEventTypes_EVENTLOG_SUCCESS,
+ &hf_eventlog_eventlogEventTypes_EVENTLOG_ERROR_TYPE,
+ &hf_eventlog_eventlogEventTypes_EVENTLOG_WARNING_TYPE,
+ &hf_eventlog_eventlogEventTypes_EVENTLOG_INFORMATION_TYPE,
+ &hf_eventlog_eventlogEventTypes_EVENTLOG_AUDIT_SUCCESS,
+ &hf_eventlog_eventlogEventTypes_EVENTLOG_AUDIT_FAILURE,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_eventlog_eventlogEventTypes);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_eventlog_eventlogEventTypes, eventlog_eventlogEventTypes_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogEventTypes_EVENTLOG_SUCCESS, tvb, offset-4, 4, flags);
- if (flags&( 0x0000 )){
- proto_item_append_text(item, "EVENTLOG_SUCCESS");
- if (flags & (~( 0x0000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0000 ));
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogEventTypes_EVENTLOG_ERROR_TYPE, tvb, offset-4, 4, flags);
- if (flags&( 0x0001 )){
- proto_item_append_text(item, "EVENTLOG_ERROR_TYPE");
- if (flags & (~( 0x0001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0001 ));
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogEventTypes_EVENTLOG_WARNING_TYPE, tvb, offset-4, 4, flags);
- if (flags&( 0x0002 )){
- proto_item_append_text(item, "EVENTLOG_WARNING_TYPE");
- if (flags & (~( 0x0002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0002 ));
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogEventTypes_EVENTLOG_INFORMATION_TYPE, tvb, offset-4, 4, flags);
- if (flags&( 0x0004 )){
- proto_item_append_text(item, "EVENTLOG_INFORMATION_TYPE");
- if (flags & (~( 0x0004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0004 ));
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogEventTypes_EVENTLOG_AUDIT_SUCCESS, tvb, offset-4, 4, flags);
- if (flags&( 0x0008 )){
- proto_item_append_text(item, "EVENTLOG_AUDIT_SUCCESS");
- if (flags & (~( 0x0008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0008 ));
-
- proto_tree_add_boolean(tree, hf_eventlog_eventlogEventTypes_EVENTLOG_AUDIT_FAILURE, tvb, offset-4, 4, flags);
- if (flags&( 0x0010 )){
- proto_item_append_text(item, "EVENTLOG_AUDIT_FAILURE");
- if (flags & (~( 0x0010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x0010 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x0000001f)) {
+ flags &= (~0x0000001f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-frsrpc.c b/epan/dissectors/packet-dcerpc-frsrpc.c
index ec9931ba92..63b48f319b 100644
--- a/epan/dissectors/packet-dcerpc-frsrpc.c
+++ b/epan/dissectors/packet-dcerpc-frsrpc.c
@@ -887,168 +887,40 @@ frsrpc_dissect_struct_CommPktGSVN(tvbuff_t *tvb _U_, int offset _U_, packet_info
int
frsrpc_dissect_bitmap_CommPktCoCmdFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * frsrpc_frsrpc_CommPktCoCmdFlags_fields[] = {
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_ABORT_CO,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_VV_ACTIVATED,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_CONTENT_CMD,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_LOCATION_CMD,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_ONLIST,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_LOCALCO,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_RETRY,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_OUT_OF_ORDER,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_NEW_FILE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_CONTROL,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_DIRECTED_CO,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_VVJOIN_TO_ORIG,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_SKIP_ORIG_REC_C,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_MOVEIN_GEN,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_MORPH_GEN_HEAD,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_JUST_OID_RESET,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_COMPRESSED_STAGE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_SKIP_VV_UPDATE,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_frsrpc_frsrpc_CommPktCoCmdFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_frsrpc_frsrpc_CommPktCoCmdFlags, frsrpc_frsrpc_CommPktCoCmdFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_ABORT_CO, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_ABORT_CO");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_VV_ACTIVATED, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_VV_ACTIVATED");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_CONTENT_CMD, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_CONTENT_CMD");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_LOCATION_CMD, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_LOCATION_CMD");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_ONLIST, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_ONLIST");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_LOCALCO, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_LOCALCO");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_RETRY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000040 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_RETRY");
- if (flags & (~( 0x00000040 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000040 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_OUT_OF_ORDER, tvb, offset-4, 4, flags);
- if (flags&( 0x00000200 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_OUT_OF_ORDER");
- if (flags & (~( 0x00000200 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000200 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_NEW_FILE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000400 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_NEW_FILE");
- if (flags & (~( 0x00000400 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000400 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_CONTROL, tvb, offset-4, 4, flags);
- if (flags&( 0x00001000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_CONTROL");
- if (flags & (~( 0x00001000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00001000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_DIRECTED_CO, tvb, offset-4, 4, flags);
- if (flags&( 0x00002000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_DIRECTED_CO");
- if (flags & (~( 0x00002000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00002000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_VVJOIN_TO_ORIG, tvb, offset-4, 4, flags);
- if (flags&( 0x00040000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_VVJOIN_TO_ORIG");
- if (flags & (~( 0x00040000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00040000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_SKIP_ORIG_REC_C, tvb, offset-4, 4, flags);
- if (flags&( 0x00100000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_SKIP_ORIG_REC_C");
- if (flags & (~( 0x00100000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00100000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_MOVEIN_GEN, tvb, offset-4, 4, flags);
- if (flags&( 0x00200000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_MOVEIN_GEN");
- if (flags & (~( 0x00200000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00200000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_MORPH_GEN_HEAD, tvb, offset-4, 4, flags);
- if (flags&( 0x00400000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_MORPH_GEN_HEAD");
- if (flags & (~( 0x00400000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00400000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_JUST_OID_RESET, tvb, offset-4, 4, flags);
- if (flags&( 0x00800000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_JUST_OID_RESET");
- if (flags & (~( 0x00800000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00800000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_COMPRESSED_STAGE, tvb, offset-4, 4, flags);
- if (flags&( 0x01000000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_COMPRESSED_STAGE");
- if (flags & (~( 0x01000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01000000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdFlags_FRSRPC_CO_FLAG_SKIP_VV_UPDATE, tvb, offset-4, 4, flags);
- if (flags&( 0x02000000 )){
- proto_item_append_text(item, "FRSRPC_CO_FLAG_SKIP_VV_UPDATE");
- if (flags & (~( 0x02000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02000000 ));
-
- if (flags) {
+ if (flags & (~0x03f4367f)) {
+ flags &= (~0x03f4367f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1065,48 +937,25 @@ frsrpc_dissect_bitmap_CommPktCoCmdFlags(tvbuff_t *tvb _U_, int offset _U_, packe
int
frsrpc_dissect_bitmap_CommPktCoCmdIFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * frsrpc_frsrpc_CommPktCoCmdIFlags_fields[] = {
+ &hf_frsrpc_frsrpc_CommPktCoCmdIFlags_FRSRPC_CO_IFLAG_VVRETIRE_EXEC,
+ &hf_frsrpc_frsrpc_CommPktCoCmdIFlags_FRSRPC_CO_IFLAG_CO_ABORT,
+ &hf_frsrpc_frsrpc_CommPktCoCmdIFlags_FRSRPC_CO_IFLAG_DIR_ENUM_PENDING,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_frsrpc_frsrpc_CommPktCoCmdIFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_frsrpc_frsrpc_CommPktCoCmdIFlags, frsrpc_frsrpc_CommPktCoCmdIFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdIFlags_FRSRPC_CO_IFLAG_VVRETIRE_EXEC, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "FRSRPC_CO_IFLAG_VVRETIRE_EXEC");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdIFlags_FRSRPC_CO_IFLAG_CO_ABORT, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "FRSRPC_CO_IFLAG_CO_ABORT");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdIFlags_FRSRPC_CO_IFLAG_DIR_ENUM_PENDING, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "FRSRPC_CO_IFLAG_DIR_ENUM_PENDING");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- if (flags) {
+ if (flags & (~0x00000007)) {
+ flags &= (~0x00000007);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1174,136 +1023,36 @@ frsrpc_dissect_enum_CommPktCoCmdStatus(tvbuff_t *tvb _U_, int offset _U_, packet
int
frsrpc_dissect_bitmap_CommPktCoCmdContentCmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * frsrpc_frsrpc_CommPktCoCmdContentCmd_fields[] = {
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_DATA_OVERWRITE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_DATA_EXTEND,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_DATA_TRUNCATION,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NAMED_DATA_OVERWRITE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NAMED_DATA_EXTEND,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NAMED_DATA_TRUNCATION,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_FILE_CREATE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_FILE_DELETE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_EA_CHANGE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_SECURITY_CHANGE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_OLD_NAME,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NEW_NAME,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_BASIC_INFO_CHANGE,
+ &hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_COMPRESSION_CHANGE,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_frsrpc_frsrpc_CommPktCoCmdContentCmd);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_frsrpc_frsrpc_CommPktCoCmdContentCmd, frsrpc_frsrpc_CommPktCoCmdContentCmd_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_DATA_OVERWRITE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_DATA_OVERWRITE");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_DATA_EXTEND, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_DATA_EXTEND");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_DATA_TRUNCATION, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_DATA_TRUNCATION");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NAMED_DATA_OVERWRITE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_NAMED_DATA_OVERWRITE");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NAMED_DATA_EXTEND, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_NAMED_DATA_EXTEND");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NAMED_DATA_TRUNCATION, tvb, offset-4, 4, flags);
- if (flags&( 0x00000040 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_NAMED_DATA_TRUNCATION");
- if (flags & (~( 0x00000040 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000040 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_FILE_CREATE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000100 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_FILE_CREATE");
- if (flags & (~( 0x00000100 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000100 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_FILE_DELETE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000200 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_FILE_DELETE");
- if (flags & (~( 0x00000200 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000200 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_EA_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000400 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_EA_CHANGE");
- if (flags & (~( 0x00000400 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000400 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_SECURITY_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000800 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_SECURITY_CHANGE");
- if (flags & (~( 0x00000800 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000800 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_OLD_NAME, tvb, offset-4, 4, flags);
- if (flags&( 0x00001000 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_OLD_NAME");
- if (flags & (~( 0x00001000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00001000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_NEW_NAME, tvb, offset-4, 4, flags);
- if (flags&( 0x00002000 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_NEW_NAME");
- if (flags & (~( 0x00002000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00002000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_BASIC_INFO_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00004000 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_BASIC_INFO_CHANGE");
- if (flags & (~( 0x00004000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00004000 ));
-
- proto_tree_add_boolean(tree, hf_frsrpc_frsrpc_CommPktCoCmdContentCmd_FRSRPC_CONTENT_REASON_COMPRESSION_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00020000 )){
- proto_item_append_text(item, "FRSRPC_CONTENT_REASON_COMPRESSION_CHANGE");
- if (flags & (~( 0x00020000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00020000 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x00027f77)) {
+ flags &= (~0x00027f77);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-frstrans.c b/epan/dissectors/packet-dcerpc-frstrans.c
index e35afe0559..a9832775c4 100644
--- a/epan/dissectors/packet-dcerpc-frstrans.c
+++ b/epan/dissectors/packet-dcerpc-frstrans.c
@@ -362,32 +362,23 @@ frstrans_dissect_enum_ProtocolVersion(tvbuff_t *tvb _U_, int offset _U_, packet_
int
frstrans_dissect_bitmap_TransportFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * frstrans_frstrans_TransportFlags_fields[] = {
+ &hf_frstrans_frstrans_TransportFlags_FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_frstrans_frstrans_TransportFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_frstrans_frstrans_TransportFlags, frstrans_frstrans_TransportFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_frstrans_frstrans_TransportFlags_FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x00000001)) {
+ flags &= (~0x00000001);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-initshutdown.c b/epan/dissectors/packet-dcerpc-initshutdown.c
index 222d6195a1..93d39a38f2 100644
--- a/epan/dissectors/packet-dcerpc-initshutdown.c
+++ b/epan/dissectors/packet-dcerpc-initshutdown.c
@@ -201,40 +201,24 @@ initshutdown_dissect_enum_ReasonMinor(tvbuff_t *tvb _U_, int offset _U_, packet_
int
initshutdown_dissect_bitmap_ReasonFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * initshutdown_initshutdown_ReasonFlags_fields[] = {
+ &hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_USER_DEFINED,
+ &hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_PLANNED,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_initshutdown_initshutdown_ReasonFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_initshutdown_initshutdown_ReasonFlags, initshutdown_initshutdown_ReasonFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_USER_DEFINED, tvb, offset-4, 4, flags);
- if (flags&( 0x40000000 )){
- proto_item_append_text(item, "SHTDN_REASON_FLAG_USER_DEFINED");
- if (flags & (~( 0x40000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x40000000 ));
-
- proto_tree_add_boolean(tree, hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_PLANNED, tvb, offset-4, 4, flags);
- if (flags&( 0x80000000 )){
- proto_item_append_text(item, "SHTDN_REASON_FLAG_PLANNED");
- if (flags & (~( 0x80000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x80000000 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0xc0000000)) {
+ flags &= (~0xc0000000);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-lsa.c b/epan/dissectors/packet-dcerpc-lsa.c
index ba993ce799..e16db5c1b5 100644
--- a/epan/dissectors/packet-dcerpc-lsa.c
+++ b/epan/dissectors/packet-dcerpc-lsa.c
@@ -1614,26 +1614,12 @@ lsarpc_dissect_element_lsa_DomainInfoEfs_efs_blob_(tvbuff_t *tvb _U_, int offset
int
lsarpc_dissect_bitmap_security_secinfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_lsarpc_security_secinfo);
- }
-
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- if (flags) {
- proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
- }
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
return offset;
}
diff --git a/epan/dissectors/packet-dcerpc-mapi.c b/epan/dissectors/packet-dcerpc-mapi.c
index 629c663652..1f62029908 100644
--- a/epan/dissectors/packet-dcerpc-mapi.c
+++ b/epan/dissectors/packet-dcerpc-mapi.c
@@ -9209,120 +9209,34 @@ mapi_dissect_struct_OpenMessage_recipients(tvbuff_t *tvb _U_, int offset _U_, pa
int
mapi_dissect_bitmap_ulEventType(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * mapi_ulEventType_fields[] = {
+ &hf_mapi_ulEventType_fnevCriticalError,
+ &hf_mapi_ulEventType_fnevNewMail,
+ &hf_mapi_ulEventType_fnevObjectCreated,
+ &hf_mapi_ulEventType_fnevObjectDeleted,
+ &hf_mapi_ulEventType_fnevObjectModified,
+ &hf_mapi_ulEventType_fnevObjectMoved,
+ &hf_mapi_ulEventType_fnevObjectCopied,
+ &hf_mapi_ulEventType_fnevSearchComplete,
+ &hf_mapi_ulEventType_fnevTableModified,
+ &hf_mapi_ulEventType_fnevStatusObjectModified,
+ &hf_mapi_ulEventType_fnevReservedForMapi,
+ &hf_mapi_ulEventType_fnevExtended,
+ };
guint16 flags;
ALIGN_TO_2_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 2, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_mapi_ulEventType);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_mapi_ulEventType, mapi_ulEventType_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint16(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevCriticalError, tvb, offset-2, 2, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "fnevCriticalError");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevNewMail, tvb, offset-2, 2, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "fnevNewMail");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevObjectCreated, tvb, offset-2, 2, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "fnevObjectCreated");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevObjectDeleted, tvb, offset-2, 2, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "fnevObjectDeleted");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevObjectModified, tvb, offset-2, 2, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "fnevObjectModified");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevObjectMoved, tvb, offset-2, 2, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "fnevObjectMoved");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevObjectCopied, tvb, offset-2, 2, flags);
- if (flags&( 0x00000040 )){
- proto_item_append_text(item, "fnevObjectCopied");
- if (flags & (~( 0x00000040 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000040 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevSearchComplete, tvb, offset-2, 2, flags);
- if (flags&( 0x00000080 )){
- proto_item_append_text(item, "fnevSearchComplete");
- if (flags & (~( 0x00000080 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000080 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevTableModified, tvb, offset-2, 2, flags);
- if (flags&( 0x00000100 )){
- proto_item_append_text(item, "fnevTableModified");
- if (flags & (~( 0x00000100 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000100 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevStatusObjectModified, tvb, offset-2, 2, flags);
- if (flags&( 0x00000200 )){
- proto_item_append_text(item, "fnevStatusObjectModified");
- if (flags & (~( 0x00000200 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000200 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevReservedForMapi, tvb, offset-2, 2, flags);
- if (flags&( 0x40000000 )){
- proto_item_append_text(item, "fnevReservedForMapi");
- if (flags & (~( 0x40000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x40000000 ));
-
- proto_tree_add_boolean(tree, hf_mapi_ulEventType_fnevExtended, tvb, offset-2, 2, flags);
- if (flags&( 0x80000000 )){
- proto_item_append_text(item, "fnevExtended");
- if (flags & (~( 0x80000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x80000000 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0xc00003ff)) {
+ flags &= (~0xc00003ff);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-samr.c b/epan/dissectors/packet-dcerpc-samr.c
index 06513ca67a..abe981d4f8 100644
--- a/epan/dissectors/packet-dcerpc-samr.c
+++ b/epan/dissectors/packet-dcerpc-samr.c
@@ -2348,184 +2348,42 @@ samr_dissect_enum_RejectReason(tvbuff_t *tvb _U_, int offset _U_, packet_info *p
int
samr_dissect_bitmap_AcctFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * samr_samr_AcctFlags_fields[] = {
+ &hf_samr_samr_AcctFlags_ACB_DISABLED,
+ &hf_samr_samr_AcctFlags_ACB_HOMDIRREQ,
+ &hf_samr_samr_AcctFlags_ACB_PWNOTREQ,
+ &hf_samr_samr_AcctFlags_ACB_TEMPDUP,
+ &hf_samr_samr_AcctFlags_ACB_NORMAL,
+ &hf_samr_samr_AcctFlags_ACB_MNS,
+ &hf_samr_samr_AcctFlags_ACB_DOMTRUST,
+ &hf_samr_samr_AcctFlags_ACB_WSTRUST,
+ &hf_samr_samr_AcctFlags_ACB_SVRTRUST,
+ &hf_samr_samr_AcctFlags_ACB_PWNOEXP,
+ &hf_samr_samr_AcctFlags_ACB_AUTOLOCK,
+ &hf_samr_samr_AcctFlags_ACB_ENC_TXT_PWD_ALLOWED,
+ &hf_samr_samr_AcctFlags_ACB_SMARTCARD_REQUIRED,
+ &hf_samr_samr_AcctFlags_ACB_TRUSTED_FOR_DELEGATION,
+ &hf_samr_samr_AcctFlags_ACB_NOT_DELEGATED,
+ &hf_samr_samr_AcctFlags_ACB_USE_DES_KEY_ONLY,
+ &hf_samr_samr_AcctFlags_ACB_DONT_REQUIRE_PREAUTH,
+ &hf_samr_samr_AcctFlags_ACB_PW_EXPIRED,
+ &hf_samr_samr_AcctFlags_ACB_TRUST_AUTH_DELEGAT,
+ &hf_samr_samr_AcctFlags_ACB_NO_AUTH_DATA_REQD,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_samr_samr_AcctFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_samr_samr_AcctFlags, samr_samr_AcctFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_DISABLED, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "ACB_DISABLED");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_HOMDIRREQ, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "ACB_HOMDIRREQ");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_PWNOTREQ, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "ACB_PWNOTREQ");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_TEMPDUP, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "ACB_TEMPDUP");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_NORMAL, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "ACB_NORMAL");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_MNS, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "ACB_MNS");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_DOMTRUST, tvb, offset-4, 4, flags);
- if (flags&( 0x00000040 )){
- proto_item_append_text(item, "ACB_DOMTRUST");
- if (flags & (~( 0x00000040 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000040 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_WSTRUST, tvb, offset-4, 4, flags);
- if (flags&( 0x00000080 )){
- proto_item_append_text(item, "ACB_WSTRUST");
- if (flags & (~( 0x00000080 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000080 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_SVRTRUST, tvb, offset-4, 4, flags);
- if (flags&( 0x00000100 )){
- proto_item_append_text(item, "ACB_SVRTRUST");
- if (flags & (~( 0x00000100 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000100 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_PWNOEXP, tvb, offset-4, 4, flags);
- if (flags&( 0x00000200 )){
- proto_item_append_text(item, "ACB_PWNOEXP");
- if (flags & (~( 0x00000200 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000200 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_AUTOLOCK, tvb, offset-4, 4, flags);
- if (flags&( 0x00000400 )){
- proto_item_append_text(item, "ACB_AUTOLOCK");
- if (flags & (~( 0x00000400 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000400 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_ENC_TXT_PWD_ALLOWED, tvb, offset-4, 4, flags);
- if (flags&( 0x00000800 )){
- proto_item_append_text(item, "ACB_ENC_TXT_PWD_ALLOWED");
- if (flags & (~( 0x00000800 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000800 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_SMARTCARD_REQUIRED, tvb, offset-4, 4, flags);
- if (flags&( 0x00001000 )){
- proto_item_append_text(item, "ACB_SMARTCARD_REQUIRED");
- if (flags & (~( 0x00001000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00001000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_TRUSTED_FOR_DELEGATION, tvb, offset-4, 4, flags);
- if (flags&( 0x00002000 )){
- proto_item_append_text(item, "ACB_TRUSTED_FOR_DELEGATION");
- if (flags & (~( 0x00002000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00002000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_NOT_DELEGATED, tvb, offset-4, 4, flags);
- if (flags&( 0x00004000 )){
- proto_item_append_text(item, "ACB_NOT_DELEGATED");
- if (flags & (~( 0x00004000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00004000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_USE_DES_KEY_ONLY, tvb, offset-4, 4, flags);
- if (flags&( 0x00008000 )){
- proto_item_append_text(item, "ACB_USE_DES_KEY_ONLY");
- if (flags & (~( 0x00008000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00008000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_DONT_REQUIRE_PREAUTH, tvb, offset-4, 4, flags);
- if (flags&( 0x00010000 )){
- proto_item_append_text(item, "ACB_DONT_REQUIRE_PREAUTH");
- if (flags & (~( 0x00010000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00010000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_PW_EXPIRED, tvb, offset-4, 4, flags);
- if (flags&( 0x00020000 )){
- proto_item_append_text(item, "ACB_PW_EXPIRED");
- if (flags & (~( 0x00020000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00020000 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_TRUST_AUTH_DELEGAT, tvb, offset-4, 4, flags);
- if (flags&( 0x00040000 )){
- proto_item_append_text(item, "ACB_TRUST_AUTH_DELEGAT");
- if (flags & (~( 0x00040000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00040000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_AcctFlags_ACB_NO_AUTH_DATA_REQD, tvb, offset-4, 4, flags);
- if (flags&( 0x00080000 )){
- proto_item_append_text(item, "ACB_NO_AUTH_DATA_REQD");
- if (flags & (~( 0x00080000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00080000 ));
-
- if (flags) {
+ if (flags & (~0x000fffff)) {
+ flags &= (~0x000fffff);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -2778,72 +2636,28 @@ samr_dissect_enum_Role(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_
int
samr_dissect_bitmap_PasswordProperties(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * samr_samr_PasswordProperties_fields[] = {
+ &hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_COMPLEX,
+ &hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_NO_ANON_CHANGE,
+ &hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_NO_CLEAR_CHANGE,
+ &hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_LOCKOUT_ADMINS,
+ &hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_STORE_CLEARTEXT,
+ &hf_samr_samr_PasswordProperties_DOMAIN_REFUSE_PASSWORD_CHANGE,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_samr_samr_PasswordProperties);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_samr_samr_PasswordProperties, samr_samr_PasswordProperties_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_COMPLEX, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "DOMAIN_PASSWORD_COMPLEX");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_NO_ANON_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "DOMAIN_PASSWORD_NO_ANON_CHANGE");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_NO_CLEAR_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "DOMAIN_PASSWORD_NO_CLEAR_CHANGE");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_LOCKOUT_ADMINS, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "DOMAIN_PASSWORD_LOCKOUT_ADMINS");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_PasswordProperties_DOMAIN_PASSWORD_STORE_CLEARTEXT, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "DOMAIN_PASSWORD_STORE_CLEARTEXT");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_PasswordProperties_DOMAIN_REFUSE_PASSWORD_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "DOMAIN_REFUSE_PASSWORD_CHANGE");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x0000003f)) {
+ flags &= (~0x0000003f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -3881,80 +3695,29 @@ samr_dissect_struct_Ids(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U
int
samr_dissect_bitmap_GroupAttrs(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * samr_samr_GroupAttrs_fields[] = {
+ &hf_samr_samr_GroupAttrs_SE_GROUP_MANDATORY,
+ &hf_samr_samr_GroupAttrs_SE_GROUP_ENABLED_BY_DEFAULT,
+ &hf_samr_samr_GroupAttrs_SE_GROUP_ENABLED,
+ &hf_samr_samr_GroupAttrs_SE_GROUP_OWNER,
+ &hf_samr_samr_GroupAttrs_SE_GROUP_USE_FOR_DENY_ONLY,
+ &hf_samr_samr_GroupAttrs_SE_GROUP_RESOURCE,
+ &hf_samr_samr_GroupAttrs_SE_GROUP_LOGON_ID,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_samr_samr_GroupAttrs);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_samr_samr_GroupAttrs, samr_samr_GroupAttrs_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_samr_samr_GroupAttrs_SE_GROUP_MANDATORY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "SE_GROUP_MANDATORY");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_GroupAttrs_SE_GROUP_ENABLED_BY_DEFAULT, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "SE_GROUP_ENABLED_BY_DEFAULT");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_GroupAttrs_SE_GROUP_ENABLED, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "SE_GROUP_ENABLED");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_GroupAttrs_SE_GROUP_OWNER, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "SE_GROUP_OWNER");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_GroupAttrs_SE_GROUP_USE_FOR_DENY_ONLY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "SE_GROUP_USE_FOR_DENY_ONLY");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_GroupAttrs_SE_GROUP_RESOURCE, tvb, offset-4, 4, flags);
- if (flags&( 0x20000000 )){
- proto_item_append_text(item, "SE_GROUP_RESOURCE");
- if (flags & (~( 0x20000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x20000000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_GroupAttrs_SE_GROUP_LOGON_ID, tvb, offset-4, 4, flags);
- if (flags&( 0xC0000000 )){
- proto_item_append_text(item, "SE_GROUP_LOGON_ID");
- if (flags & (~( 0xC0000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0xC0000000 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0xe000001f)) {
+ flags &= (~0xe000001f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -5940,264 +5703,52 @@ samr_dissect_struct_UserInfo20(tvbuff_t *tvb _U_, int offset _U_, packet_info *p
int
samr_dissect_bitmap_FieldsPresent(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * samr_samr_FieldsPresent_fields[] = {
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_ACCOUNT_NAME,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_FULL_NAME,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_RID,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_PRIMARY_GID,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_DESCRIPTION,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_COMMENT,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_HOME_DIRECTORY,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_HOME_DRIVE,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_LOGON_SCRIPT,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_PROFILE_PATH,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_WORKSTATIONS,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_LAST_LOGON,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_LAST_LOGOFF,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_LOGON_HOURS,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_BAD_PWD_COUNT,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_NUM_LOGONS,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_ALLOW_PWD_CHANGE,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_FORCE_PWD_CHANGE,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_LAST_PWD_CHANGE,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_ACCT_EXPIRY,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_ACCT_FLAGS,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_PARAMETERS,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_COUNTRY_CODE,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_CODE_PAGE,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_NT_PASSWORD_PRESENT,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_LM_PASSWORD_PRESENT,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_PRIVATE_DATA,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_EXPIRED_FLAG,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_SEC_DESC,
+ &hf_samr_samr_FieldsPresent_SAMR_FIELD_OWF_PWD,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_samr_samr_FieldsPresent);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_samr_samr_FieldsPresent, samr_samr_FieldsPresent_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_ACCOUNT_NAME, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "SAMR_FIELD_ACCOUNT_NAME");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_FULL_NAME, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "SAMR_FIELD_FULL_NAME");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_RID, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "SAMR_FIELD_RID");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_PRIMARY_GID, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "SAMR_FIELD_PRIMARY_GID");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_DESCRIPTION, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "SAMR_FIELD_DESCRIPTION");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_COMMENT, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "SAMR_FIELD_COMMENT");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_HOME_DIRECTORY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000040 )){
- proto_item_append_text(item, "SAMR_FIELD_HOME_DIRECTORY");
- if (flags & (~( 0x00000040 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000040 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_HOME_DRIVE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000080 )){
- proto_item_append_text(item, "SAMR_FIELD_HOME_DRIVE");
- if (flags & (~( 0x00000080 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000080 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_LOGON_SCRIPT, tvb, offset-4, 4, flags);
- if (flags&( 0x00000100 )){
- proto_item_append_text(item, "SAMR_FIELD_LOGON_SCRIPT");
- if (flags & (~( 0x00000100 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000100 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_PROFILE_PATH, tvb, offset-4, 4, flags);
- if (flags&( 0x00000200 )){
- proto_item_append_text(item, "SAMR_FIELD_PROFILE_PATH");
- if (flags & (~( 0x00000200 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000200 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_WORKSTATIONS, tvb, offset-4, 4, flags);
- if (flags&( 0x00000400 )){
- proto_item_append_text(item, "SAMR_FIELD_WORKSTATIONS");
- if (flags & (~( 0x00000400 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000400 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_LAST_LOGON, tvb, offset-4, 4, flags);
- if (flags&( 0x00000800 )){
- proto_item_append_text(item, "SAMR_FIELD_LAST_LOGON");
- if (flags & (~( 0x00000800 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000800 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_LAST_LOGOFF, tvb, offset-4, 4, flags);
- if (flags&( 0x00001000 )){
- proto_item_append_text(item, "SAMR_FIELD_LAST_LOGOFF");
- if (flags & (~( 0x00001000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00001000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_LOGON_HOURS, tvb, offset-4, 4, flags);
- if (flags&( 0x00002000 )){
- proto_item_append_text(item, "SAMR_FIELD_LOGON_HOURS");
- if (flags & (~( 0x00002000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00002000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_BAD_PWD_COUNT, tvb, offset-4, 4, flags);
- if (flags&( 0x00004000 )){
- proto_item_append_text(item, "SAMR_FIELD_BAD_PWD_COUNT");
- if (flags & (~( 0x00004000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00004000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_NUM_LOGONS, tvb, offset-4, 4, flags);
- if (flags&( 0x00008000 )){
- proto_item_append_text(item, "SAMR_FIELD_NUM_LOGONS");
- if (flags & (~( 0x00008000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00008000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_ALLOW_PWD_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00010000 )){
- proto_item_append_text(item, "SAMR_FIELD_ALLOW_PWD_CHANGE");
- if (flags & (~( 0x00010000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00010000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_FORCE_PWD_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00020000 )){
- proto_item_append_text(item, "SAMR_FIELD_FORCE_PWD_CHANGE");
- if (flags & (~( 0x00020000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00020000 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_LAST_PWD_CHANGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00040000 )){
- proto_item_append_text(item, "SAMR_FIELD_LAST_PWD_CHANGE");
- if (flags & (~( 0x00040000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00040000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_ACCT_EXPIRY, tvb, offset-4, 4, flags);
- if (flags&( 0x00080000 )){
- proto_item_append_text(item, "SAMR_FIELD_ACCT_EXPIRY");
- if (flags & (~( 0x00080000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00080000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_ACCT_FLAGS, tvb, offset-4, 4, flags);
- if (flags&( 0x00100000 )){
- proto_item_append_text(item, "SAMR_FIELD_ACCT_FLAGS");
- if (flags & (~( 0x00100000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00100000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_PARAMETERS, tvb, offset-4, 4, flags);
- if (flags&( 0x00200000 )){
- proto_item_append_text(item, "SAMR_FIELD_PARAMETERS");
- if (flags & (~( 0x00200000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00200000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_COUNTRY_CODE, tvb, offset-4, 4, flags);
- if (flags&( 0x00400000 )){
- proto_item_append_text(item, "SAMR_FIELD_COUNTRY_CODE");
- if (flags & (~( 0x00400000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00400000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_CODE_PAGE, tvb, offset-4, 4, flags);
- if (flags&( 0x00800000 )){
- proto_item_append_text(item, "SAMR_FIELD_CODE_PAGE");
- if (flags & (~( 0x00800000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00800000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_NT_PASSWORD_PRESENT, tvb, offset-4, 4, flags);
- if (flags&( 0x01000000 )){
- proto_item_append_text(item, "SAMR_FIELD_NT_PASSWORD_PRESENT");
- if (flags & (~( 0x01000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01000000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_LM_PASSWORD_PRESENT, tvb, offset-4, 4, flags);
- if (flags&( 0x02000000 )){
- proto_item_append_text(item, "SAMR_FIELD_LM_PASSWORD_PRESENT");
- if (flags & (~( 0x02000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02000000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_PRIVATE_DATA, tvb, offset-4, 4, flags);
- if (flags&( 0x04000000 )){
- proto_item_append_text(item, "SAMR_FIELD_PRIVATE_DATA");
- if (flags & (~( 0x04000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x04000000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_EXPIRED_FLAG, tvb, offset-4, 4, flags);
- if (flags&( 0x08000000 )){
- proto_item_append_text(item, "SAMR_FIELD_EXPIRED_FLAG");
- if (flags & (~( 0x08000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x08000000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_SEC_DESC, tvb, offset-4, 4, flags);
- if (flags&( 0x10000000 )){
- proto_item_append_text(item, "SAMR_FIELD_SEC_DESC");
- if (flags & (~( 0x10000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x10000000 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_FieldsPresent_SAMR_FIELD_OWF_PWD, tvb, offset-4, 4, flags);
- if (flags&( 0x20000000 )){
- proto_item_append_text(item, "SAMR_FIELD_OWF_PWD");
- if (flags & (~( 0x20000000 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x20000000 ));
-
- if (flags) {
+ if (flags & (~0x3fffffff)) {
+ flags &= (~0x3fffffff);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -8319,72 +7870,28 @@ samr_dissect_ConnectInfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _
int
samr_dissect_bitmap_ValidateFieldsPresent(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * samr_samr_ValidateFieldsPresent_fields[] = {
+ &hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET,
+ &hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME,
+ &hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_LOCKOUT_TIME,
+ &hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT,
+ &hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH,
+ &hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_PASSWORD_HISTORY,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_samr_samr_ValidateFieldsPresent);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_samr_samr_ValidateFieldsPresent, samr_samr_ValidateFieldsPresent_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_LOCKOUT_TIME, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "SAMR_VALIDATE_FIELD_LOCKOUT_TIME");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH, tvb, offset-4, 4, flags);
- if (flags&( 0x00000010 )){
- proto_item_append_text(item, "SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH");
- if (flags & (~( 0x00000010 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000010 ));
-
- proto_tree_add_boolean(tree, hf_samr_samr_ValidateFieldsPresent_SAMR_VALIDATE_FIELD_PASSWORD_HISTORY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000020 )){
- proto_item_append_text(item, "SAMR_VALIDATE_FIELD_PASSWORD_HISTORY");
- if (flags & (~( 0x00000020 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000020 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x0000003f)) {
+ flags &= (~0x0000003f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-winreg.c b/epan/dissectors/packet-dcerpc-winreg.c
index b83d259d70..4c152cbb27 100644
--- a/epan/dissectors/packet-dcerpc-winreg.c
+++ b/epan/dissectors/packet-dcerpc-winreg.c
@@ -645,26 +645,12 @@ cnf_dissect_winreg_String(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t
int
winreg_dissect_bitmap_security_secinfo(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_winreg_security_secinfo);
- }
-
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- if (flags) {
- proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
- }
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
return offset;
}
@@ -895,56 +881,26 @@ winreg_dissect_struct_SecBuf(tvbuff_t *tvb _U_, int offset _U_, packet_info *pin
int
winreg_dissect_bitmap_KeyOptions(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * winreg_winreg_KeyOptions_fields[] = {
+ &hf_winreg_winreg_KeyOptions_REG_OPTION_VOLATILE,
+ &hf_winreg_winreg_KeyOptions_REG_OPTION_CREATE_LINK,
+ &hf_winreg_winreg_KeyOptions_REG_OPTION_BACKUP_RESTORE,
+ &hf_winreg_winreg_KeyOptions_REG_OPTION_OPEN_LINK,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_winreg_winreg_KeyOptions);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_winreg_winreg_KeyOptions, winreg_winreg_KeyOptions_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_KeyOptions_REG_OPTION_VOLATILE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "REG_OPTION_VOLATILE");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_KeyOptions_REG_OPTION_CREATE_LINK, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "REG_OPTION_CREATE_LINK");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_winreg_winreg_KeyOptions_REG_OPTION_BACKUP_RESTORE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "REG_OPTION_BACKUP_RESTORE");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_KeyOptions_REG_OPTION_OPEN_LINK, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "REG_OPTION_OPEN_LINK");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- if (flags) {
+ if (flags & (~0x0000000f)) {
+ flags &= (~0x0000000f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1143,56 +1099,26 @@ winreg_dissect_struct_ValNameBuf(tvbuff_t *tvb _U_, int offset _U_, packet_info
int
winreg_dissect_bitmap_NotifyChangeType(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * winreg_winreg_NotifyChangeType_fields[] = {
+ &hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_NAME,
+ &hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_ATTRIBUTES,
+ &hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_LAST_SET,
+ &hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_SECURITY,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_winreg_winreg_NotifyChangeType);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_winreg_winreg_NotifyChangeType, winreg_winreg_NotifyChangeType_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_NAME, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "REG_NOTIFY_CHANGE_NAME");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_ATTRIBUTES, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "REG_NOTIFY_CHANGE_ATTRIBUTES");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_LAST_SET, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "REG_NOTIFY_CHANGE_LAST_SET");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_NotifyChangeType_REG_NOTIFY_CHANGE_SECURITY, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "REG_NOTIFY_CHANGE_SECURITY");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
-
- if (flags) {
+ if (flags & (~0x0000000f)) {
+ flags &= (~0x0000000f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1210,56 +1136,26 @@ winreg_dissect_bitmap_NotifyChangeType(tvbuff_t *tvb _U_, int offset _U_, packet
int
winreg_dissect_bitmap_RestoreKeyFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * winreg_winreg_RestoreKeyFlags_fields[] = {
+ &hf_winreg_winreg_RestoreKeyFlags_REG_WHOLE_HIVE_VOLATILE,
+ &hf_winreg_winreg_RestoreKeyFlags_REG_REFRESH_HIVE,
+ &hf_winreg_winreg_RestoreKeyFlags_REG_NO_LAZY_FLUSH,
+ &hf_winreg_winreg_RestoreKeyFlags_REG_FORCE_RESTORE,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_winreg_winreg_RestoreKeyFlags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_winreg_winreg_RestoreKeyFlags, winreg_winreg_RestoreKeyFlags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_RestoreKeyFlags_REG_WHOLE_HIVE_VOLATILE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000001 )){
- proto_item_append_text(item, "REG_WHOLE_HIVE_VOLATILE");
- if (flags & (~( 0x00000001 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000001 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_RestoreKeyFlags_REG_REFRESH_HIVE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000002 )){
- proto_item_append_text(item, "REG_REFRESH_HIVE");
- if (flags & (~( 0x00000002 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000002 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_RestoreKeyFlags_REG_NO_LAZY_FLUSH, tvb, offset-4, 4, flags);
- if (flags&( 0x00000004 )){
- proto_item_append_text(item, "REG_NO_LAZY_FLUSH");
- if (flags & (~( 0x00000004 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000004 ));
-
- proto_tree_add_boolean(tree, hf_winreg_winreg_RestoreKeyFlags_REG_FORCE_RESTORE, tvb, offset-4, 4, flags);
- if (flags&( 0x00000008 )){
- proto_item_append_text(item, "REG_FORCE_RESTORE");
- if (flags & (~( 0x00000008 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00000008 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x0000000f)) {
+ flags &= (~0x0000000f);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/epan/dissectors/packet-dcerpc-witness.c b/epan/dissectors/packet-dcerpc-witness.c
index fa8d131d41..2c7ddf9148 100644
--- a/epan/dissectors/packet-dcerpc-witness.c
+++ b/epan/dissectors/packet-dcerpc-witness.c
@@ -407,48 +407,25 @@ witness_dissect_enum_interfaceInfo_state(tvbuff_t *tvb _U_, int offset _U_, pack
int
witness_dissect_bitmap_interfaceInfo_flags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * witness_witness_interfaceInfo_flags_fields[] = {
+ &hf_witness_witness_interfaceInfo_flags_WITNESS_INFO_IPv4_VALID,
+ &hf_witness_witness_interfaceInfo_flags_WITNESS_INFO_IPv6_VALID,
+ &hf_witness_witness_interfaceInfo_flags_WITNESS_INFO_WITNESS_IF,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_witness_witness_interfaceInfo_flags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_witness_witness_interfaceInfo_flags, witness_witness_interfaceInfo_flags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_witness_witness_interfaceInfo_flags_WITNESS_INFO_IPv4_VALID, tvb, offset-4, 4, flags);
- if (flags&( 0x01 )){
- proto_item_append_text(item, "WITNESS_INFO_IPv4_VALID");
- if (flags & (~( 0x01 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01 ));
-
- proto_tree_add_boolean(tree, hf_witness_witness_interfaceInfo_flags_WITNESS_INFO_IPv6_VALID, tvb, offset-4, 4, flags);
- if (flags&( 0x02 )){
- proto_item_append_text(item, "WITNESS_INFO_IPv6_VALID");
- if (flags & (~( 0x02 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02 ));
-
- proto_tree_add_boolean(tree, hf_witness_witness_interfaceInfo_flags_WITNESS_INFO_WITNESS_IF, tvb, offset-4, 4, flags);
- if (flags&( 0x04 )){
- proto_item_append_text(item, "WITNESS_INFO_WITNESS_IF");
- if (flags & (~( 0x04 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x04 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x00000007)) {
+ flags &= (~0x00000007);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -730,56 +707,26 @@ witness_dissect_struct_ResourceChange(tvbuff_t *tvb _U_, int offset _U_, packet_
int
witness_dissect_bitmap_IPaddrInfo_flags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * witness_witness_IPaddrInfo_flags_fields[] = {
+ &hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_V4,
+ &hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_V6,
+ &hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_ONLINE,
+ &hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_OFFLINE,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_witness_witness_IPaddrInfo_flags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_witness_witness_IPaddrInfo_flags, witness_witness_IPaddrInfo_flags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
+ proto_item_append_text(item, ": (No values set)");
- proto_tree_add_boolean(tree, hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_V4, tvb, offset-4, 4, flags);
- if (flags&( 0x01 )){
- proto_item_append_text(item, "WITNESS_IPADDR_V4");
- if (flags & (~( 0x01 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01 ));
-
- proto_tree_add_boolean(tree, hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_V6, tvb, offset-4, 4, flags);
- if (flags&( 0x02 )){
- proto_item_append_text(item, "WITNESS_IPADDR_V6");
- if (flags & (~( 0x02 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x02 ));
-
- proto_tree_add_boolean(tree, hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_ONLINE, tvb, offset-4, 4, flags);
- if (flags&( 0x08 )){
- proto_item_append_text(item, "WITNESS_IPADDR_ONLINE");
- if (flags & (~( 0x08 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x08 ));
-
- proto_tree_add_boolean(tree, hf_witness_witness_IPaddrInfo_flags_WITNESS_IPADDR_OFFLINE, tvb, offset-4, 4, flags);
- if (flags&( 0x10 )){
- proto_item_append_text(item, "WITNESS_IPADDR_OFFLINE");
- if (flags & (~( 0x10 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x10 ));
-
- if (flags) {
+ if (flags & (~0x0000001b)) {
+ flags &= (~0x0000001b);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
@@ -1010,40 +957,24 @@ witness_dissect_element_notifyResponse_num(tvbuff_t *tvb _U_, int offset _U_, pa
int
witness_dissect_bitmap_RegisterEx_flags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
-
+ proto_item *item;
+ static const int * witness_witness_RegisterEx_flags_fields[] = {
+ &hf_witness_witness_RegisterEx_flags_WITNESS_REGISTER_NONE,
+ &hf_witness_witness_RegisterEx_flags_WITNESS_REGISTER_IP_NOTIFICATION,
+ };
guint32 flags;
ALIGN_TO_4_BYTES;
- if (parent_tree) {
- item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
- tree = proto_item_add_subtree(item,ett_witness_witness_RegisterEx_flags);
- }
+ item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,
+ ett_witness_witness_RegisterEx_flags, witness_witness_RegisterEx_flags_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);
- offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, -1, &flags);
- proto_item_append_text(item, ": ");
+ offset = dissect_ndr_uint32(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);
if (!flags)
- proto_item_append_text(item, "(No values set)");
-
- proto_tree_add_boolean(tree, hf_witness_witness_RegisterEx_flags_WITNESS_REGISTER_NONE, tvb, offset-4, 4, flags);
- if (flags&( 0x00 )){
- proto_item_append_text(item, "WITNESS_REGISTER_NONE");
- if (flags & (~( 0x00 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x00 ));
-
- proto_tree_add_boolean(tree, hf_witness_witness_RegisterEx_flags_WITNESS_REGISTER_IP_NOTIFICATION, tvb, offset-4, 4, flags);
- if (flags&( 0x01 )){
- proto_item_append_text(item, "WITNESS_REGISTER_IP_NOTIFICATION");
- if (flags & (~( 0x01 )))
- proto_item_append_text(item, ", ");
- }
- flags&=(~( 0x01 ));
+ proto_item_append_text(item, ": (No values set)");
- if (flags) {
+ if (flags & (~0x00000001)) {
+ flags &= (~0x00000001);
proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
}
diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 67419d5999..24b61433ea 100644
--- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -200,6 +200,8 @@ sub Bitmap($$$$)
{
my ($self,$e,$name,$ifname) = @_;
my $dissectorname = "$ifname\_dissect\_bitmap\_".StripPrefixes($name, $self->{conformance}->{strip_prefixes});
+ my $element_count = 0;
+ my $total_ev = 0;
$self->register_ett("ett_$ifname\_$name");
@@ -210,9 +212,26 @@ sub Bitmap($$$$)
$self->pidl_code("$dissectorname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)");
$self->pidl_code("{");
$self->indent;
- $self->pidl_code("proto_item *item = NULL;");
- $self->pidl_code("proto_tree *tree = NULL;");
- $self->pidl_code("");
+ foreach (@{$e->{ELEMENTS}}) {
+ next unless (/([^ ]*) (.*)/);
+ $element_count++;
+ }
+ if ($element_count > 0) {
+ $self->pidl_code("proto_item *item;");
+ $self->pidl_code("static const int * $ifname\_$name\_fields[] = {");
+ $self->indent;
+ foreach (@{$e->{ELEMENTS}}) {
+ next unless (/([^ ]*) (.*)/);
+ my ($en,$ev) = ($1,$2);
+ my $hf_bitname = "hf_$ifname\_$name\_$1";
+
+ $ev =~ s/[()\s]//g;
+ $total_ev += hex($ev);
+ $self->pidl_code("&$hf_bitname,");
+ }
+ $self->deindent;
+ $self->pidl_code("};");
+ }
$self->pidl_code("g$e->{BASE_TYPE} flags;");
if ($e->{ALIGN} > 1) {
@@ -221,18 +240,23 @@ sub Bitmap($$$$)
$self->pidl_code("");
- $self->pidl_code("if (parent_tree) {");
- $self->indent;
- $self->pidl_code("item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, $e->{ALIGN}, DREP_ENC_INTEGER(drep));");
- $self->pidl_code("tree = proto_item_add_subtree(item,ett_$ifname\_$name);");
- $self->deindent;
- $self->pidl_code("}\n");
+ if ($element_count > 0) {
+ $self->pidl_code("item = proto_tree_add_bitmask_with_flags(parent_tree, tvb, offset, hf_index,");
+ $self->pidl_code("\t\t\tett_$ifname\_$name, $ifname\_$name\_fields, DREP_ENC_INTEGER(drep), BMT_NO_FALSE);");
+ $self->pidl_code("");
- $self->pidl_code("offset = dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, tree, di, drep, -1, &flags);");
+ $self->pidl_code("offset = dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);");
+ $self->pidl_code("");
- $self->pidl_code("proto_item_append_text(item, \": \");\n");
- $self->pidl_code("if (!flags)");
- $self->pidl_code("\tproto_item_append_text(item, \"(No values set)\");\n");
+ $self->pidl_code("if (!flags)");
+ $self->pidl_code("\tproto_item_append_text(item, \": (No values set)\");\n");
+ } else {
+ $self->pidl_code("proto_tree_add_item(parent_tree, hf_index, tvb, offset, $e->{ALIGN}, DREP_ENC_INTEGER(drep));");
+ $self->pidl_code("");
+
+ $self->pidl_code("offset = dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, parent_tree, di, drep, -1, &flags);");
+ $self->pidl_code("");
+ }
foreach (@{$e->{ELEMENTS}}) {
next unless (/([^ ]*) (.*)/);
@@ -254,20 +278,15 @@ sub Bitmap($$$$)
$self->pidl_def(" \"$en is NOT SET\",");
}
$self->pidl_def("};");
-
- $self->pidl_code("proto_tree_add_boolean(tree, $hf_bitname, tvb, offset-$e->{ALIGN}, $e->{ALIGN}, flags);");
- $self->pidl_code("if (flags&$ev){");
- $self->pidl_code("\tproto_item_append_text(item, \"$en\");");
- $self->pidl_code("\tif (flags & (~$ev))");
- $self->pidl_code("\t\tproto_item_append_text(item, \", \");");
- $self->pidl_code("}");
- $self->pidl_code("flags&=(~$ev);");
- $self->pidl_code("");
}
- $self->pidl_code("if (flags) {");
- $self->pidl_code("\tproto_item_append_text(item, \"Unknown bitmap value 0x%x\", flags);");
- $self->pidl_code("}\n");
+ if ($element_count > 0) {
+ my $total_ev_hex = sprintf("0x%08x", $total_ev);
+ $self->pidl_code("if (flags & (~$total_ev_hex)) {");
+ $self->pidl_code("\tflags &= (~$total_ev_hex);");
+ $self->pidl_code("\tproto_item_append_text(item, \"Unknown bitmap value 0x%x\", flags);");
+ $self->pidl_code("}\n");
+ }
$self->pidl_code("return offset;");
$self->deindent;
$self->pidl_code("}\n");