diff options
-rw-r--r-- | epan/dissectors/packet-3g-a11.c | 40 | ||||
-rw-r--r-- | epan/dissectors/packet-6lowpan.c | 45 | ||||
-rw-r--r-- | epan/dissectors/packet-9p.c | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-afs.c | 73 | ||||
-rw-r--r-- | epan/dissectors/packet-agentx.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-aim-generic.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-aim-messaging.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-aim.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-aodv.c | 246 | ||||
-rw-r--r-- | epan/dissectors/packet-assa_r3.c | 373 | ||||
-rw-r--r-- | epan/dissectors/packet-bacnet.c | 34 | ||||
-rw-r--r-- | epan/dissectors/packet-bat.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-batadv.c | 160 | ||||
-rw-r--r-- | epan/dissectors/packet-bootp.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-ccsds.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-csm-encaps.c | 20 |
16 files changed, 586 insertions, 574 deletions
diff --git a/epan/dissectors/packet-3g-a11.c b/epan/dissectors/packet-3g-a11.c index bc4d8f6945..92e51745f7 100644 --- a/epan/dissectors/packet-3g-a11.c +++ b/epan/dissectors/packet-3g-a11.c @@ -547,6 +547,17 @@ static const value_string a11_ses_msid_type_vals[] = { 0, NULL }, }; +static const int * a11_flags[] = { + &hf_a11_s, + &hf_a11_b, + &hf_a11_d, + &hf_a11_m, + &hf_a11_g, + &hf_a11_v, + &hf_a11_t, + NULL +}; + static void decode_sse(proto_tree *ext_tree, packet_info *pinfo, tvbuff_t *tvb, int offset, guint ext_len, proto_item *ext_len_item) { @@ -1538,10 +1549,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ /* Set up structures we will need to add the protocol subtree and manage it */ proto_item *ti; proto_tree *a11_tree = NULL; - proto_item *tf; - proto_tree *flags_tree; guint8 type; - guint8 flags; guint offset = 0; if (!tvb_bytes_exist(tvb, offset, 1)) @@ -1579,17 +1587,8 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ offset += 1; /* flags */ - flags = tvb_get_guint8(tvb, offset); - tf = proto_tree_add_uint(a11_tree, hf_a11_flags, tvb, - offset, 1, flags); - flags_tree = proto_item_add_subtree(tf, ett_a11_flags); - proto_tree_add_boolean(flags_tree, hf_a11_s, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_b, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_d, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_m, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_g, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_v, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_t, tvb, offset, 1, flags); + proto_tree_add_bitmask(a11_tree, tvb, offset, hf_a11_flags, + ett_a11_flags, a11_flags, ENC_NA); offset += 1; /* lifetime */ @@ -1908,17 +1907,8 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ offset += 1; /* flags */ - flags = tvb_get_guint8(tvb, offset); - tf = proto_tree_add_uint(a11_tree, hf_a11_flags, tvb, - offset, 1, flags); - flags_tree = proto_item_add_subtree(tf, ett_a11_flags); - proto_tree_add_boolean(flags_tree, hf_a11_s, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_b, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_d, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_m, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_g, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_v, tvb, offset, 1, flags); - proto_tree_add_boolean(flags_tree, hf_a11_t, tvb, offset, 1, flags); + proto_tree_add_bitmask(a11_tree, tvb, offset, hf_a11_flags, + ett_a11_flags, a11_flags, ENC_NA); offset += 1; /* lifetime */ diff --git a/epan/dissectors/packet-6lowpan.c b/epan/dissectors/packet-6lowpan.c index 8bb22c9611..c33437f8db 100644 --- a/epan/dissectors/packet-6lowpan.c +++ b/epan/dissectors/packet-6lowpan.c @@ -198,6 +198,7 @@ static int hf_6lowpan_pattern = -1; static int hf_6lowpan_nhc_pattern = -1; /* Header compression fields. */ +static int hf_6lowpan_hc1_encoding = -1; static int hf_6lowpan_hc1_source_prefix = -1; static int hf_6lowpan_hc1_source_ifc = -1; static int hf_6lowpan_hc1_dest_prefix = -1; @@ -205,6 +206,7 @@ static int hf_6lowpan_hc1_dest_ifc = -1; static int hf_6lowpan_hc1_class = -1; static int hf_6lowpan_hc1_next = -1; static int hf_6lowpan_hc1_more = -1; +static int hf_6lowpan_hc2_udp_encoding = -1; static int hf_6lowpan_hc2_udp_src = -1; static int hf_6lowpan_hc2_udp_dst = -1; static int hf_6lowpan_hc2_udp_len = -1; @@ -275,6 +277,7 @@ static int hf_6lowpan_frag_dgram_offset = -1; /* Protocol tree handles. */ static gint ett_6lowpan = -1; static gint ett_6lowpan_hc1 = -1; +static gint ett_6lowpan_hc1_encoding = -1; static gint ett_6lowpan_hc2_udp = -1; static gint ett_6lowpan_iphc = -1; static gint ett_6lowpan_nhc_ext = -1; @@ -1047,6 +1050,22 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg guint8 ipv6_class; struct ip6_hdr ipv6; struct lowpan_nhdr *nhdr_list; + static const int * hc1_encodings[] = { + &hf_6lowpan_hc1_source_prefix, + &hf_6lowpan_hc1_source_ifc, + &hf_6lowpan_hc1_dest_prefix, + &hf_6lowpan_hc1_dest_ifc, + &hf_6lowpan_hc1_class, + &hf_6lowpan_hc1_next, + &hf_6lowpan_hc1_more, + NULL + }; + static const int * hc2_encodings[] = { + &hf_6lowpan_hc2_udp_src, + &hf_6lowpan_hc2_udp_dst, + &hf_6lowpan_hc2_udp_len, + NULL + }; /*===================================================== * Parse HC Encoding Flags @@ -1062,27 +1081,16 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg /* Get and display the HC1 encoding bits. */ hc1_encoding = tvb_get_guint8(tvb, offset); next_header = ((hc1_encoding & LOWPAN_HC1_NEXT) >> 1); - if (tree) { - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_prefix, tvb, offset, 1, hc1_encoding & LOWPAN_HC1_SOURCE_PREFIX); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_ifc, tvb, offset, 1, hc1_encoding & LOWPAN_HC1_SOURCE_IFC); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_prefix, tvb, offset, 1, hc1_encoding & LOWPAN_HC1_DEST_PREFIX); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_ifc, tvb, offset, 1, hc1_encoding & LOWPAN_HC1_DEST_IFC); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_class, tvb, offset, 1, hc1_encoding & LOWPAN_HC1_TRAFFIC_CLASS); - proto_tree_add_uint(hc_tree, hf_6lowpan_hc1_next, tvb, offset, 1, hc1_encoding & LOWPAN_HC1_NEXT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_more, tvb, offset, 1, hc1_encoding & LOWPAN_HC1_MORE); - } + proto_tree_add_bitmask(hc_tree, tvb, offset, hf_6lowpan_hc1_encoding, + ett_6lowpan_hc1_encoding, hc1_encodings, ENC_NA); offset += 1; /* Get and display the HC2 encoding bits, if present. */ if (hc1_encoding & LOWPAN_HC1_MORE) { if (next_header == LOWPAN_HC1_NEXT_UDP) { hc_udp_encoding = tvb_get_guint8(tvb, offset); - if (tree) { - hc_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_6lowpan_hc2_udp, NULL, "HC_UDP Encoding"); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_src, tvb, offset, 1, hc_udp_encoding & LOWPAN_HC2_UDP_SRCPORT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_dst, tvb, offset, 1, hc_udp_encoding & LOWPAN_HC2_UDP_DSTPORT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_len, tvb, offset, 1, hc_udp_encoding & LOWPAN_HC2_UDP_LENGTH); - } + proto_tree_add_bitmask(tree, tvb, offset, hf_6lowpan_hc2_udp_encoding, + ett_6lowpan_hc2_udp, hc2_encodings, ENC_NA); offset += 1; } else { @@ -2505,6 +2513,9 @@ proto_register_6lowpan(void) FT_UINT8, BASE_HEX, VALS(lowpan_nhc_patterns), 0x0, NULL, HFILL }}, /* HC1 header fields. */ + { &hf_6lowpan_hc1_encoding, + { "HC1 Encoding", "6lowpan.hc1.encoding", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_6lowpan_hc1_source_prefix, { "Source prefix", "6lowpan.hc1.src_prefix", FT_BOOLEAN, 8, TFS(&lowpan_compression), LOWPAN_HC1_SOURCE_PREFIX, NULL, HFILL }}, @@ -2528,6 +2539,9 @@ proto_register_6lowpan(void) FT_BOOLEAN, 8, NULL, LOWPAN_HC1_MORE, NULL, HFILL }}, /* HC_UDP header fields. */ + { &hf_6lowpan_hc2_udp_encoding, + { "HC_UDP Encoding", "6lowpan.hc2.udp.encoding", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_6lowpan_hc2_udp_src, { "Source port", "6lowpan.hc2.udp.src", FT_BOOLEAN, 8, TFS(&lowpan_compression), LOWPAN_HC2_UDP_SRCPORT, NULL, HFILL }}, @@ -2730,6 +2744,7 @@ proto_register_6lowpan(void) static gint *ett[] = { &ett_6lowpan, &ett_6lowpan_hc1, + &ett_6lowpan_hc1_encoding, &ett_6lowpan_hc2_udp, &ett_6lowpan_iphc, &ett_6lowpan_nhc_ext, diff --git a/epan/dissectors/packet-9p.c b/epan/dissectors/packet-9p.c index 1da4c6bb1e..a246d02f1f 100644 --- a/epan/dissectors/packet-9p.c +++ b/epan/dissectors/packet-9p.c @@ -977,13 +977,19 @@ static expert_field ei_9P_msgtype = EI_INIT; static GHashTable *_9p_hashtable = NULL; -static void dissect_9P_mode(tvbuff_t *tvb, proto_item *tree, int offset); static void dissect_9P_dm(tvbuff_t *tvb, proto_item *tree, int offset, int iscreate); static void dissect_9P_qid(tvbuff_t *tvb, proto_tree *tree, int offset); static void dissect_9P_lflags(tvbuff_t *tvb, proto_tree *tree, int offset); static void dissect_9P_getattrflags(tvbuff_t *tvb, proto_tree *tree, int offset); static void dissect_9P_setattrflags(tvbuff_t *tvb, proto_tree *tree, int offset); +static const int * _9P_modes[] = { + &hf_9P_mode_c, + &hf_9P_mode_t, + &hf_9P_mode_rwx, + NULL +}; + struct _9p_hashkey { guint32 conv_index; guint16 tag; @@ -1462,8 +1468,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_item_append_text(ti, " (%s)", conv_get_fid(pinfo, fid)); offset += 4; - ti = proto_tree_add_item(ninep_tree, hf_9P_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN); - dissect_9P_mode(tvb, ti, offset); + proto_tree_add_bitmask(ninep_tree, tvb, offset, hf_9P_mode, ett_9P_omode, _9P_modes, ENC_LITTLE_ENDIAN); offset += 1; conv_set_tag(pinfo, tag, ninemsg, _9P_NOFID, NULL); @@ -1491,8 +1496,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre dissect_9P_dm(tvb, ti, offset, 1); offset += 4; - ti = proto_tree_add_item(ninep_tree, hf_9P_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN); - dissect_9P_mode(tvb, ti, offset); + proto_tree_add_bitmask(ninep_tree, tvb, offset, hf_9P_mode, ett_9P_omode, _9P_modes, ENC_LITTLE_ENDIAN); offset += 1; if (_9p_version == _9P2000_u) { @@ -2169,21 +2173,6 @@ static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void return tvb_captured_length(tvb); } -/* dissect 9P open mode flags */ -static void dissect_9P_mode(tvbuff_t *tvb, proto_item *item, int offset) -{ - proto_item *mode_tree; - guint8 mode; - - mode = tvb_get_guint8(tvb, offset); - mode_tree = proto_item_add_subtree(item, ett_9P_omode); - if(!mode_tree) - return; - proto_tree_add_boolean(mode_tree, hf_9P_mode_c, tvb, offset, 1, mode); - proto_tree_add_boolean(mode_tree, hf_9P_mode_t, tvb, offset, 1, mode); - proto_tree_add_uint(mode_tree, hf_9P_mode_rwx, tvb, offset, 1, mode); -} - /* dissect 9P Qid */ static void dissect_9P_qid(tvbuff_t *tvb, proto_tree *tree, int offset) { diff --git a/epan/dissectors/packet-afs.c b/epan/dissectors/packet-afs.c index 468f6b69d2..d056c09bfa 100644 --- a/epan/dissectors/packet-afs.c +++ b/epan/dissectors/packet-afs.c @@ -674,50 +674,38 @@ static const fragment_items afs_frag_items = { tree = save; \ } +static const int * status_mask_flags[] = { + &hf_afs_fs_status_mask_setmodtime, + &hf_afs_fs_status_mask_setowner, + &hf_afs_fs_status_mask_setgroup, + &hf_afs_fs_status_mask_setmode, + &hf_afs_fs_status_mask_setsegsize, + &hf_afs_fs_status_mask_fsync, + NULL +}; + /* Output a Status mask */ #define OUT_FS_STATUSMASK() \ - { proto_tree *save_ofsm, *ti_ofsm; \ - guint32 mask_ofsm; \ - mask_ofsm = tvb_get_ntohl(tvb, offset); \ - ti_ofsm = proto_tree_add_uint(tree, hf_afs_fs_status_mask, tvb, offset, \ - 4, mask_ofsm); \ - save_ofsm = tree; \ - tree = proto_item_add_subtree(ti_ofsm, ett_afs_status_mask); \ - proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setmodtime, \ - tvb,offset,4, mask_ofsm); \ - proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setowner, \ - tvb,offset,4, mask_ofsm); \ - proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setgroup, \ - tvb,offset,4, mask_ofsm); \ - proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setmode, \ - tvb,offset,4, mask_ofsm); \ - proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setsegsize, \ - tvb,offset,4, mask_ofsm); \ - proto_tree_add_boolean(tree, hf_afs_fs_status_mask_fsync, \ - tvb,offset,4, mask_ofsm); \ + { \ + proto_tree_add_bitmask(tree, tvb, offset, hf_afs_fs_status_mask, \ + ett_afs_status_mask, status_mask_flags, ENC_BIG_ENDIAN); \ offset += 4; \ - tree = save_ofsm; \ } +static const int * vldb_flags[] = { + &hf_afs_vldb_flags_rwexists, + &hf_afs_vldb_flags_roexists, + &hf_afs_vldb_flags_bkexists, + &hf_afs_vldb_flags_dfsfileset, + NULL +}; + /* Output vldb flags */ #define OUT_VLDB_Flags() \ - { proto_tree *save, *ti; \ - guint32 flags; \ - flags = tvb_get_ntohl(tvb, offset); \ - ti = proto_tree_add_uint(tree, hf_afs_vldb_flags, tvb, offset, \ - 4, flags); \ - save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_vldb_flags); \ - proto_tree_add_boolean(tree, hf_afs_vldb_flags_rwexists, \ - tvb,offset,4, flags); \ - proto_tree_add_boolean(tree, hf_afs_vldb_flags_roexists, \ - tvb,offset,4, flags); \ - proto_tree_add_boolean(tree, hf_afs_vldb_flags_bkexists, \ - tvb,offset,4, flags); \ - proto_tree_add_boolean(tree, hf_afs_vldb_flags_dfsfileset, \ - tvb,offset,4, flags); \ + { \ + proto_tree_add_bitmask(tree, tvb, offset, hf_afs_vldb_flags, \ + ett_afs_vldb_flags, vldb_flags, ENC_BIG_ENDIAN); \ offset += 4; \ - tree = save; \ } @@ -834,7 +822,7 @@ static const fragment_items afs_frag_items = { /* Output a AFS acl */ #define ACLOUT(who, positive, acl, bytes) \ - { proto_tree *save, *ti; \ + { proto_tree *save; \ int tmpoffset; \ int acllen; \ char tmp[10]; \ @@ -846,11 +834,10 @@ static const fragment_items afs_frag_items = { if ( acl & PRSFS_WRITE ) g_strlcat(tmp, "w", 10); \ if ( acl & PRSFS_LOCK ) g_strlcat(tmp, "k", 10); \ if ( acl & PRSFS_ADMINISTER ) g_strlcat(tmp, "a", 10); \ - ti = proto_tree_add_text(tree, tvb, offset, bytes, \ - "ACL: %s %s%s", \ - who, tmp, positive ? "" : " (negative)"); \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_acl); \ + tree = proto_tree_add_subtree_format(tree, tvb, offset, bytes, \ + ett_afs_acl, NULL, "ACL: %s %s%s", \ + who, tmp, positive ? "" : " (negative)"); \ proto_tree_add_string(tree,hf_afs_fs_acl_entity, tvb,offset,(int)strlen(who), who);\ tmpoffset = offset + (int)strlen(who) + 1; \ acllen = bytes - (int)strlen(who) - 1; \ @@ -993,8 +980,8 @@ static const fragment_items afs_frag_items = { proto_tree_add_time(tree,hf_afs_ubik_version_epoch, tvb,offset-8, \ 4,&ts); \ else \ - proto_tree_add_text(tree, tvb, offset-8, \ - 4,"Epoch: 0"); \ + proto_tree_add_time_format_value(tree, hf_afs_ubik_version_epoch, tvb, offset-8, \ + 4, &ts, "0"); \ proto_tree_add_uint(tree,hf_afs_ubik_version_counter, tvb,offset-4, \ 4,counter); \ tree = save; \ diff --git a/epan/dissectors/packet-agentx.c b/epan/dissectors/packet-agentx.c index 29930c7b2f..c6ec5c45a5 100644 --- a/epan/dissectors/packet-agentx.c +++ b/epan/dissectors/packet-agentx.c @@ -43,7 +43,7 @@ static int proto_agentx = -1; static int hf_version = -1; static int hf_type = -1; -/* static int hf_flags = -1; */ +static int hf_flags = -1; static int hf_flags_register = -1; static int hf_flags_newindex = -1; static int hf_flags_anyindex = -1; @@ -789,7 +789,7 @@ static int dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; - proto_tree* agentx_tree, *pdu_hdr_tree, *flags_tree; + proto_tree* agentx_tree, *pdu_hdr_tree; proto_item *t_item; guint8 version; guint8 type; @@ -798,6 +798,14 @@ dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da guint32 trans_id; guint32 packet_id; guint32 payload_len; + static const int * pdu_flags[] = { + &hf_flags_register, + &hf_flags_newindex, + &hf_flags_anyindex, + &hf_flags_context, + &hf_flags_byteorder, + NULL + }; version = tvb_get_guint8(tvb, 0); offset+=1; type = tvb_get_guint8(tvb, 1); offset+=1; @@ -818,7 +826,7 @@ dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da if(!tree) - return 0; + return tvb_captured_length(tvb); /*t_item = proto_tree_add_item(tree, proto_agentx, tvb, 0, -1, ENC_NA);*/ t_item = proto_tree_add_protocol_format(tree, proto_agentx, tvb, 0, -1, @@ -833,13 +841,7 @@ dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da proto_tree_add_uint(pdu_hdr_tree, hf_version, tvb, 0, 1, version); proto_tree_add_uint(pdu_hdr_tree, hf_type, tvb, 1, 1, type); - - flags_tree = proto_tree_add_subtree_format(pdu_hdr_tree, tvb, 2, 1, ett_flags, NULL, "Flags: 0x%02x", flags); - proto_tree_add_boolean(flags_tree, hf_flags_register, tvb, 2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_flags_newindex, tvb, 2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_flags_anyindex, tvb, 2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_flags_context, tvb, 2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_flags_byteorder, tvb, 2, 1, flags); + proto_tree_add_bitmask(pdu_hdr_tree, tvb, 2, hf_flags, ett_flags, pdu_flags, ENC_NA); proto_tree_add_uint(pdu_hdr_tree, hf_session_id, tvb, 4, 4, session_id); proto_tree_add_uint(pdu_hdr_tree, hf_trans_id, tvb, 8, 4, trans_id); @@ -941,11 +943,9 @@ proto_register_agentx(void) { "Type", "agentx.type", FT_UINT8, BASE_DEC | BASE_EXT_STRING, &type_values_ext, 0x0, "header type", HFILL }}, -#if 0 { &hf_flags, { "Flags", "agentx.flags", FT_UINT8, BASE_DEC, NULL, 0x0, "header type", HFILL }}, -#endif { &hf_flags_register, { "Register", "agentx.flags.register", FT_BOOLEAN, 8, TFS(&tfs_yes_no), diff --git a/epan/dissectors/packet-aim-generic.c b/epan/dissectors/packet-aim-generic.c index e2577be8be..2561116923 100644 --- a/epan/dissectors/packet-aim-generic.c +++ b/epan/dissectors/packet-aim-generic.c @@ -356,14 +356,14 @@ static int dissect_aim_generic_migration_req(tvbuff_t *tvb, packet_info *pinfo, static int dissect_aim_generic_setprivflags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree) { - int offset = 0; - guint32 flags = tvb_get_ntoh24(tvb, offset); - proto_item *ti = proto_tree_add_uint(gen_tree, hf_generic_priv_flags, tvb, offset, 4, flags); - proto_tree *entry = proto_item_add_subtree(ti, ett_generic_priv_flags); - proto_tree_add_boolean(entry, hf_generic_allow_idle_see, tvb, offset, 4, flags); - proto_tree_add_boolean(entry, hf_generic_allow_member_see, tvb, offset, 4, flags); - offset+=4; - return offset; + static const int * flags[] = { + &hf_generic_allow_idle_see, + &hf_generic_allow_member_see, + NULL + }; + + proto_tree_add_bitmask(gen_tree, tvb, 0, hf_generic_priv_flags, ett_generic_priv_flags, flags, ENC_BIG_ENDIAN); + return 4; } static int dissect_aim_generic_selfinfo_repl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree) diff --git a/epan/dissectors/packet-aim-messaging.c b/epan/dissectors/packet-aim-messaging.c index 5aa0734174..f772c1f172 100644 --- a/epan/dissectors/packet-aim-messaging.c +++ b/epan/dissectors/packet-aim-messaging.c @@ -482,22 +482,19 @@ dissect_aim_plugin(proto_tree *entry, tvbuff_t *tvb, int offset, e_uuid_t* out_p static int dissect_aim_rendezvous_extended_message(tvbuff_t *tvb, proto_tree *msg_tree) { - guint8 /*message_type,*/message_flags; int offset = 0; - proto_item *ti_flags; - proto_tree *flags_entry; guint16 text_length; guint8* text; + static const int * flags[] = { + &hf_aim_rendezvous_extended_data_message_flags_normal, + &hf_aim_rendezvous_extended_data_message_flags_auto, + &hf_aim_rendezvous_extended_data_message_flags_multi, + NULL + }; - /* TODO: parse and present message_type */ - /* message_type = tvb_get_guint8(tvb, offset); */ proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; - message_flags = tvb_get_guint8(tvb, offset); - ti_flags = proto_tree_add_uint(msg_tree, hf_aim_rendezvous_extended_data_message_flags, tvb, offset, 1, message_flags); - flags_entry = proto_item_add_subtree(ti_flags, ett_aim_extended_data_message_flags); - proto_tree_add_boolean(flags_entry, hf_aim_rendezvous_extended_data_message_flags_normal, tvb, offset, 1, message_flags); - proto_tree_add_boolean(flags_entry, hf_aim_rendezvous_extended_data_message_flags_auto, tvb, offset, 1, message_flags); - proto_tree_add_boolean(flags_entry, hf_aim_rendezvous_extended_data_message_flags_multi, tvb, offset, 1, message_flags); + proto_tree_add_bitmask(msg_tree, tvb, offset, hf_aim_rendezvous_extended_data_message_flags, + ett_aim_extended_data_message_flags, flags, ENC_NA); offset+=1; proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_status_code, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; proto_tree_add_item(msg_tree, hf_aim_rendezvous_extended_data_message_priority_code, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c index e10435940d..1b271b2bb5 100644 --- a/epan/dissectors/packet-aim.c +++ b/epan/dissectors/packet-aim.c @@ -646,17 +646,6 @@ dissect_aim_userinfo(tvbuff_t *tvb, packet_info *pinfo, return dissect_aim_tlv_list(tvb, pinfo, offset, tree, aim_onlinebuddy_tlvs); } -static int -dissect_aim_fnac_flags(tvbuff_t *tvb, int offset, int len, proto_item *ti, - guint16 flags) -{ - proto_tree *entry = proto_item_add_subtree(ti, ett_aim_fnac_flags); - proto_tree_add_boolean(entry, hf_aim_fnac_flag_next_is_related, tvb, offset, len, flags); - proto_tree_add_boolean(entry, hf_aim_fnac_flag_contains_version, tvb, offset, len, flags); - - return offset + len; -} - static void dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *aim_tree, proto_tree *root_tree) @@ -665,7 +654,6 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset, guint16 subtype_id; guint16 flags; guint32 id; - proto_item *ti1; proto_tree *aim_tree_fnac = NULL; tvbuff_t *subtvb; int orig_offset; @@ -687,6 +675,12 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset, if( aim_tree && subtype != NULL ) { + static const int * fnac_flags[] = { + &hf_aim_fnac_flag_next_is_related, + &hf_aim_fnac_flag_contains_version, + NULL + }; + offset = orig_offset; aim_tree_fnac = proto_tree_add_subtree_format(aim_tree, tvb, 6, 10, ett_aim_fnac, NULL, "FNAC: Family: %s (0x%04x), Subtype: %s (0x%04x)", @@ -704,10 +698,9 @@ dissect_aim_snac(tvbuff_t *tvb, packet_info *pinfo, int offset, offset += 2; - ti1 = proto_tree_add_uint(aim_tree_fnac, hf_aim_fnac_flags, tvb, offset, - 2, flags); - - offset = dissect_aim_fnac_flags(tvb, offset, 2, ti1, flags); + proto_tree_add_bitmask(aim_tree_fnac, tvb, offset, hf_aim_fnac_flags, + ett_aim_fnac_flags, fnac_flags, ENC_BIG_ENDIAN); + offset += 2; proto_tree_add_uint(aim_tree_fnac, hf_aim_fnac_id, tvb, offset, 4, id); diff --git a/epan/dissectors/packet-aodv.c b/epan/dissectors/packet-aodv.c index edfa4a5d6b..9e9e6b7986 100644 --- a/epan/dissectors/packet-aodv.c +++ b/epan/dissectors/packet-aodv.c @@ -110,7 +110,7 @@ typedef struct v6_ext { /* Initialize the protocol and registered fields */ static int proto_aodv = -1; static int hf_aodv_type = -1; -/* static int hf_aodv_flags = -1; */ +static int hf_aodv_flags = -1; static int hf_aodv_prefix_sz = -1; static int hf_aodv_hopcount = -1; static int hf_aodv_rreq_id = -1; @@ -201,7 +201,6 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, { int offset = 1; proto_item *tj; - proto_tree *aodv_flags_tree; guint8 flags; guint8 hop_count; guint32 rreq_id; @@ -212,42 +211,37 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, struct e_in6_addr orig_addr_v6; guint32 orig_seqno; int extlen; + static const int * aodv_flags[] = { + &hf_aodv_flags_rreq_join, + &hf_aodv_flags_rreq_repair, + &hf_aodv_flags_rreq_gratuitous, + &hf_aodv_flags_rreq_destinationonly, + &hf_aodv_flags_rreq_unknown, + NULL + }; flags = tvb_get_guint8(tvb, offset); - if (aodv_tree) { - aodv_flags_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, 1, ett_aodv_flags, &tj, "Flags:"); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_join, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_repair, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_gratuitous, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_destinationonly, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_unknown, - tvb, offset, 1, flags); - if (flags & RREQ_JOIN) - proto_item_append_text(tj, " J"); - if (flags & RREQ_REP) - proto_item_append_text(tj, " R"); - if (flags & RREQ_GRATRREP) - proto_item_append_text(tj, " G"); - if (flags & RREQ_DESTONLY) - proto_item_append_text(tj, " D"); - if (flags & RREQ_UNKNSEQ) - proto_item_append_text(tj, " U"); - } + tj = proto_tree_add_bitmask(aodv_tree, tvb, offset, hf_aodv_flags, + ett_aodv_flags, aodv_flags, ENC_NA); + if (flags & RREQ_JOIN) + proto_item_append_text(tj, " J"); + if (flags & RREQ_REP) + proto_item_append_text(tj, " R"); + if (flags & RREQ_GRATRREP) + proto_item_append_text(tj, " G"); + if (flags & RREQ_DESTONLY) + proto_item_append_text(tj, " D"); + if (flags & RREQ_UNKNSEQ) + proto_item_append_text(tj, " U"); offset += 2; /* skip reserved byte */ hop_count = tvb_get_guint8(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, offset, 1, + proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, offset, 1, hop_count); offset += 1; rreq_id = tvb_get_ntohl(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_rreq_id, tvb, offset, 4, + proto_tree_add_uint(aodv_tree, hf_aodv_rreq_id, tvb, offset, 4, rreq_id); offset += 4; @@ -276,8 +270,7 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, } dest_seqno = tvb_get_ntohl(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, offset, 4, + proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, offset, 4, dest_seqno); offset += 4; @@ -306,8 +299,7 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, } orig_seqno = tvb_get_ntohl(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_orig_seqno, tvb, offset, 4, + proto_tree_add_uint(aodv_tree, hf_aodv_orig_seqno, tvb, offset, 4, orig_seqno); col_append_fstr(pinfo->cinfo, COL_INFO, " Id=%u Hcnt=%u DSN=%u OSN=%u", rreq_id, @@ -316,11 +308,9 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, orig_seqno); offset += 4; - if (aodv_tree) { - extlen = tvb_reported_length_remaining(tvb, offset); - if (extlen > 0) - dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); - } + extlen = tvb_reported_length_remaining(tvb, offset); + if (extlen > 0) + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } static void @@ -329,7 +319,6 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, { int offset = 1; proto_item *tj; - proto_tree *aodv_flags_tree; guint8 flags; guint8 prefix_sz; guint8 hop_count; @@ -340,19 +329,19 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, struct e_in6_addr orig_addr_v6; guint32 lifetime; int extlen; + static const int * aodv_flags[] = { + &hf_aodv_flags_rrep_repair, + &hf_aodv_flags_rrep_ack, + NULL + }; flags = tvb_get_guint8(tvb, offset); - if (aodv_tree) { - aodv_flags_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, 1, ett_aodv_flags, &tj, "Flags:"); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rrep_repair, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rrep_ack, tvb, - offset, 1, flags); - if (flags & RREP_REP) - proto_item_append_text(tj, " R"); - if (flags & RREP_ACK_REQ) - proto_item_append_text(tj, " A"); - } + tj = proto_tree_add_bitmask(aodv_tree, tvb, offset, hf_aodv_flags, + ett_aodv_flags, aodv_flags, ENC_NA); + if (flags & RREP_REP) + proto_item_append_text(tj, " R"); + if (flags & RREP_ACK_REQ) + proto_item_append_text(tj, " A"); offset += 1; prefix_sz = tvb_get_guint8(tvb, offset) & 0x1F; @@ -435,11 +424,9 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, lifetime); offset += 4; - if (aodv_tree) { - extlen = tvb_reported_length_remaining(tvb, offset); - if (extlen > 0) - dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); - } + extlen = tvb_reported_length_remaining(tvb, offset); + if (extlen > 0) + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } static void @@ -448,27 +435,27 @@ dissect_aodv_rerr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, { int offset = 1; proto_item *tj; - proto_tree *aodv_flags_tree; proto_tree *aodv_unreach_dest_tree; guint8 flags; guint8 dest_count; int i; + static const int * aodv_flags[] = { + &hf_aodv_flags_rerr_nodelete, + NULL + }; flags = tvb_get_guint8(tvb, offset); - if (aodv_tree) { - aodv_flags_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, 1, ett_aodv_flags, &tj, "Flags:"); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rerr_nodelete, - tvb, offset, 1, flags); - if (flags & RERR_NODEL) - proto_item_append_text(tj, " N"); - } + tj = proto_tree_add_bitmask(aodv_tree, tvb, offset, hf_aodv_flags, + ett_aodv_flags, aodv_flags, ENC_NA); + if (flags & RERR_NODEL) + proto_item_append_text(tj, " N"); offset += 2; /* skip reserved byte */ dest_count = tvb_get_guint8(tvb, offset); if (aodv_tree) proto_tree_add_uint(aodv_tree, hf_aodv_destcount, tvb, offset, 1, dest_count); - col_append_fstr(pinfo->cinfo, COL_INFO, ", Dest Count=%u", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Dest Count=%u", dest_count); offset += 1; @@ -505,7 +492,6 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, { int offset = 1; proto_item *tj; - proto_tree *aodv_flags_tree; guint8 flags; guint8 hop_count; guint32 rreq_id; @@ -514,54 +500,47 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, struct e_in6_addr dest_addr_v6; struct e_in6_addr orig_addr_v6; int extlen; + static const int * aodv_flags[] = { + &hf_aodv_flags_rreq_join, + &hf_aodv_flags_rreq_repair, + &hf_aodv_flags_rreq_gratuitous, + &hf_aodv_flags_rreq_destinationonly, + &hf_aodv_flags_rreq_unknown, + NULL + }; flags = tvb_get_guint8(tvb, offset); - if (aodv_tree) { - aodv_flags_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, 1, ett_aodv_flags, &tj, "Flags:"); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_join, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_repair, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_gratuitous, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_destinationonly, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_unknown, - tvb, offset, 1, flags); - if (flags & RREQ_JOIN) - proto_item_append_text(tj, " J"); - if (flags & RREQ_REP) - proto_item_append_text(tj, " R"); - if (flags & RREQ_GRATRREP) - proto_item_append_text(tj, " G"); - if (flags & RREQ_DESTONLY) - proto_item_append_text(tj, " D"); - if (flags & RREQ_UNKNSEQ) - proto_item_append_text(tj, " U"); - } + tj = proto_tree_add_bitmask(aodv_tree, tvb, offset, hf_aodv_flags, + ett_aodv_flags, aodv_flags, ENC_NA); + if (flags & RREQ_JOIN) + proto_item_append_text(tj, " J"); + if (flags & RREQ_REP) + proto_item_append_text(tj, " R"); + if (flags & RREQ_GRATRREP) + proto_item_append_text(tj, " G"); + if (flags & RREQ_DESTONLY) + proto_item_append_text(tj, " D"); + if (flags & RREQ_UNKNSEQ) + proto_item_append_text(tj, " U"); offset += 2; /* skip reserved byte */ hop_count = tvb_get_guint8(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, offset, 1, + proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, offset, 1, hop_count); offset += 1; rreq_id = tvb_get_ntohl(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_rreq_id, tvb, offset, 4, + proto_tree_add_uint(aodv_tree, hf_aodv_rreq_id, tvb, offset, 4, rreq_id); offset += 4; dest_seqno = tvb_get_ntohl(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, offset, 4, + proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, offset, 4, dest_seqno); offset += 4; orig_seqno = tvb_get_ntohl(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_orig_seqno, tvb, offset, 4, + proto_tree_add_uint(aodv_tree, hf_aodv_orig_seqno, tvb, offset, 4, orig_seqno); offset += 4; @@ -573,7 +552,7 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, ip6_to_str(&dest_addr_v6)); } - col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", + col_append_fstr(pinfo->cinfo, COL_INFO, ", D: %s", ip6_to_str(&dest_addr_v6)); offset += INET6_ADDRLEN; @@ -585,7 +564,7 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, ip6_to_str(&orig_addr_v6)); } - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, ", O: %s Id=%u Hcnt=%u DSN=%u OSN=%u", ip6_to_str(&orig_addr_v6), rreq_id, @@ -594,11 +573,9 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, orig_seqno); offset += INET6_ADDRLEN; - if (aodv_tree) { - extlen = tvb_reported_length_remaining(tvb, offset); - if (extlen > 0) - dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); - } + extlen = tvb_reported_length_remaining(tvb, offset); + if (extlen > 0) + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } static void @@ -607,7 +584,6 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo, { int offset = 1; proto_item *tj; - proto_tree *aodv_flags_tree; guint8 flags; guint8 prefix_sz; guint8 hop_count; @@ -616,36 +592,33 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo, struct e_in6_addr orig_addr_v6; guint32 lifetime; int extlen; + static const int * aodv_flags[] = { + &hf_aodv_flags_rrep_repair, + &hf_aodv_flags_rrep_ack, + NULL + }; flags = tvb_get_guint8(tvb, offset); - if (aodv_tree) { - aodv_flags_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, 1, ett_aodv_flags, &tj, "Flags:"); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rrep_repair, - tvb, offset, 1, flags); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rrep_ack, tvb, - offset, 1, flags); - if (flags & RREP_REP) - proto_item_append_text(tj, " R"); - if (flags & RREP_ACK_REQ) - proto_item_append_text(tj, " A"); - } + tj = proto_tree_add_bitmask(aodv_tree, tvb, offset, hf_aodv_flags, + ett_aodv_flags, aodv_flags, ENC_NA); + if (flags & RREP_REP) + proto_item_append_text(tj, " R"); + if (flags & RREP_ACK_REQ) + proto_item_append_text(tj, " A"); offset += 1; prefix_sz = tvb_get_guint8(tvb, offset) & 0x7F; - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_prefix_sz, tvb, offset, 1, + proto_tree_add_uint(aodv_tree, hf_aodv_prefix_sz, tvb, offset, 1, prefix_sz); offset += 1; hop_count = tvb_get_guint8(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, offset, 1, + proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, offset, 1, hop_count); offset += 1; dest_seqno = tvb_get_ntohl(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, offset, 4, + proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, offset, 4, dest_seqno); offset += 4; @@ -686,11 +659,9 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo, lifetime); offset += 4; - if (aodv_tree) { - extlen = tvb_reported_length_remaining(tvb, offset); - if (extlen > 0) - dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); - } + extlen = tvb_reported_length_remaining(tvb, offset); + if (extlen > 0) + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } static void @@ -699,28 +670,27 @@ dissect_aodv_draft_01_v6_rerr(tvbuff_t *tvb, packet_info *pinfo, { int offset = 1; proto_item *tj; - proto_tree *aodv_flags_tree; proto_tree *aodv_unreach_dest_tree; guint8 flags; guint8 dest_count; int i; + static const int * aodv_flags[] = { + &hf_aodv_flags_rerr_nodelete, + NULL + }; flags = tvb_get_guint8(tvb, offset); - if (aodv_tree) { - aodv_flags_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, 1, ett_aodv_flags, &tj, "Flags:"); - proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rerr_nodelete, - tvb, offset, 1, flags); - if (flags & RERR_NODEL) - proto_item_append_text(tj, " N"); - } + tj = proto_tree_add_bitmask(aodv_tree, tvb, offset, hf_aodv_flags, + ett_aodv_flags, aodv_flags, ENC_NA); + if (flags & RERR_NODEL) + proto_item_append_text(tj, " N"); offset += 2; /* skip reserved byte */ dest_count = tvb_get_guint8(tvb, offset); - if (aodv_tree) - proto_tree_add_uint(aodv_tree, hf_aodv_destcount, tvb, offset, 1, + proto_tree_add_uint(aodv_tree, hf_aodv_destcount, tvb, offset, 1, dest_count); - col_append_fstr(pinfo->cinfo, COL_INFO, ", Dest Count=%u", + col_append_fstr(pinfo->cinfo, COL_INFO, ", Dest Count=%u", dest_count); offset += 1; @@ -816,13 +786,11 @@ proto_register_aodv(void) FT_UINT8, BASE_DEC, VALS(type_vals), 0x0, "AODV packet type", HFILL } }, -#if 0 { &hf_aodv_flags, { "Flags", "aodv.flags", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, -#endif { &hf_aodv_flags_rreq_join, { "RREQ Join", "aodv.flags.rreq_join", FT_BOOLEAN, 8, TFS(&tfs_set_notset), RREQ_JOIN, diff --git a/epan/dissectors/packet-assa_r3.c b/epan/dissectors/packet-assa_r3.c index 95f2a9be9d..5208200e4a 100644 --- a/epan/dissectors/packet-assa_r3.c +++ b/epan/dissectors/packet-assa_r3.c @@ -1090,7 +1090,38 @@ static gint hf_r3_configitemdata_16 = -1; static gint hf_r3_configitemdata_32 = -1; static gint hf_r3_configitemdata_string = -1; -static gint hf_r3_timezonearray [32]; +static gint hf_r3_timezonearray0 = -1; +static gint hf_r3_timezonearray1 = -1; +static gint hf_r3_timezonearray2 = -1; +static gint hf_r3_timezonearray3 = -1; +static gint hf_r3_timezonearray4 = -1; +static gint hf_r3_timezonearray5 = -1; +static gint hf_r3_timezonearray6 = -1; +static gint hf_r3_timezonearray7 = -1; +static gint hf_r3_timezonearray8 = -1; +static gint hf_r3_timezonearray9 = -1; +static gint hf_r3_timezonearray10 = -1; +static gint hf_r3_timezonearray11 = -1; +static gint hf_r3_timezonearray12 = -1; +static gint hf_r3_timezonearray13 = -1; +static gint hf_r3_timezonearray14 = -1; +static gint hf_r3_timezonearray15 = -1; +static gint hf_r3_timezonearray16 = -1; +static gint hf_r3_timezonearray17 = -1; +static gint hf_r3_timezonearray18 = -1; +static gint hf_r3_timezonearray19 = -1; +static gint hf_r3_timezonearray20 = -1; +static gint hf_r3_timezonearray21 = -1; +static gint hf_r3_timezonearray22 = -1; +static gint hf_r3_timezonearray23 = -1; +static gint hf_r3_timezonearray24 = -1; +static gint hf_r3_timezonearray25 = -1; +static gint hf_r3_timezonearray26 = -1; +static gint hf_r3_timezonearray27 = -1; +static gint hf_r3_timezonearray28 = -1; +static gint hf_r3_timezonearray29 = -1; +static gint hf_r3_timezonearray30 = -1; +static gint hf_r3_timezonearray31 = -1; static gint hf_r3_expireon_year = -1; static gint hf_r3_expireon_month = -1; @@ -1171,7 +1202,14 @@ static gint hf_r3_definetimezone_starttime_hours = -1; static gint hf_r3_definetimezone_starttime_minutes = -1; static gint hf_r3_definetimezone_endtime_hours = -1; static gint hf_r3_definetimezone_endtime_minutes = -1; -static gint hf_r3_definetimezone_daymap [7]; +static gint hf_r3_definetimezone_daymap = -1; +static gint hf_r3_definetimezone_daymap0 = -1; +static gint hf_r3_definetimezone_daymap1 = -1; +static gint hf_r3_definetimezone_daymap2 = -1; +static gint hf_r3_definetimezone_daymap3 = -1; +static gint hf_r3_definetimezone_daymap4 = -1; +static gint hf_r3_definetimezone_daymap5 = -1; +static gint hf_r3_definetimezone_daymap6 = -1; static gint hf_r3_definetimezone_exceptiongroup = -1; static gint hf_r3_definetimezone_mode = -1; static gint hf_r3_definetimezone_calendar = -1; @@ -1213,7 +1251,23 @@ static gint hf_r3_alarmlogdump_endtime_day = -1; static gint hf_r3_alarmlogdump_endtime_hours = -1; static gint hf_r3_alarmlogdump_endtime_minutes = -1; -static gint hf_r3_nvramclearoptions [16]; +static gint hf_r3_nvramclearoptions = -1; +static gint hf_r3_nvramclearoptions0 = -1; +static gint hf_r3_nvramclearoptions1 = -1; +static gint hf_r3_nvramclearoptions2 = -1; +static gint hf_r3_nvramclearoptions3 = -1; +static gint hf_r3_nvramclearoptions4 = -1; +static gint hf_r3_nvramclearoptions5 = -1; +static gint hf_r3_nvramclearoptions6 = -1; +static gint hf_r3_nvramclearoptions7 = -1; +static gint hf_r3_nvramclearoptions8 = -1; +static gint hf_r3_nvramclearoptions9 = -1; +static gint hf_r3_nvramclearoptions10 = -1; +static gint hf_r3_nvramclearoptions11 = -1; +static gint hf_r3_nvramclearoptions12 = -1; +static gint hf_r3_nvramclearoptions13 = -1; +static gint hf_r3_nvramclearoptions14 = -1; +static gint hf_r3_nvramclearoptions15 = -1; static gint hf_r3_writeeventlog_user = -1; static gint hf_r3_writeeventlog_event = -1; @@ -1312,6 +1366,7 @@ static gint hf_r3_capabilities_length = -1; static gint hf_r3_capabilities_type = -1; static gint hf_r3_capabilities_value = -1; +static gint hf_r3_lockstate = -1; static gint hf_r3_lockstate_passage = -1; static gint hf_r3_lockstate_panic = -1; static gint hf_r3_lockstate_lockout = -1; @@ -2953,6 +3008,73 @@ static const string_string r3_snmortisenames [] = { NULL, NULL } }; +static const int * r3_timezonearray[] = { + &hf_r3_timezonearray0, + &hf_r3_timezonearray1, + &hf_r3_timezonearray2, + &hf_r3_timezonearray3, + &hf_r3_timezonearray4, + &hf_r3_timezonearray5, + &hf_r3_timezonearray6, + &hf_r3_timezonearray7, + &hf_r3_timezonearray8, + &hf_r3_timezonearray9, + &hf_r3_timezonearray10, + &hf_r3_timezonearray11, + &hf_r3_timezonearray12, + &hf_r3_timezonearray13, + &hf_r3_timezonearray14, + &hf_r3_timezonearray15, + &hf_r3_timezonearray16, + &hf_r3_timezonearray17, + &hf_r3_timezonearray18, + &hf_r3_timezonearray19, + &hf_r3_timezonearray20, + &hf_r3_timezonearray21, + &hf_r3_timezonearray22, + &hf_r3_timezonearray23, + &hf_r3_timezonearray24, + &hf_r3_timezonearray25, + &hf_r3_timezonearray26, + &hf_r3_timezonearray27, + &hf_r3_timezonearray28, + &hf_r3_timezonearray29, + &hf_r3_timezonearray30, + &hf_r3_timezonearray31, + NULL +}; + +static const int * r3_definetimezone_daymap[] = { + &hf_r3_definetimezone_daymap0, + &hf_r3_definetimezone_daymap1, + &hf_r3_definetimezone_daymap2, + &hf_r3_definetimezone_daymap3, + &hf_r3_definetimezone_daymap4, + &hf_r3_definetimezone_daymap5, + &hf_r3_definetimezone_daymap6, + NULL +}; + +static const int * r3_nvramclearoptions[] = { + &hf_r3_nvramclearoptions0, + &hf_r3_nvramclearoptions1, + &hf_r3_nvramclearoptions2, + &hf_r3_nvramclearoptions3, + &hf_r3_nvramclearoptions4, + &hf_r3_nvramclearoptions5, + &hf_r3_nvramclearoptions6, + &hf_r3_nvramclearoptions7, + &hf_r3_nvramclearoptions8, + &hf_r3_nvramclearoptions9, + &hf_r3_nvramclearoptions10, + &hf_r3_nvramclearoptions11, + &hf_r3_nvramclearoptions12, + &hf_r3_nvramclearoptions13, + &hf_r3_nvramclearoptions14, + &hf_r3_nvramclearoptions15, + NULL +}; + /* * Mapping table so dissect_r3_cmd_setconfig() knows what the configuration item type is */ @@ -3728,20 +3850,7 @@ dissect_r3_upstreamfields (tvbuff_t *tvb, guint32 start_offset, guint32 length, } else { - proto_item *timezone_item; - proto_tree *timezone_tree; - guint32 i; - guint32 tz; - - if (!upstreamfield_tree) - break; - - tz = tvb_get_letohl (tvb, offset); - timezone_item = proto_tree_add_item (upstreamfield_tree, hf_r3_upstreamfieldarray [fieldType], tvb, offset, 4, ENC_LITTLE_ENDIAN); - timezone_tree = proto_item_add_subtree (timezone_item, ett_r3timezone); - - for (i = 0; i < 32; i++) - proto_tree_add_boolean (timezone_tree, hf_r3_timezonearray [i], tvb, offset, 4, tz); + proto_tree_add_bitmask(upstreamfield_tree, tvb, offset, hf_r3_upstreamfieldarray[fieldType], ett_r3timezone, r3_timezonearray, ENC_LITTLE_ENDIAN); } } break; @@ -4624,39 +4733,35 @@ dissect_r3_upstreammfgfield_peekpoke (tvbuff_t *tvb, guint32 start_offset, guint static void dissect_r3_upstreammfgfield_lockstate (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree) { - proto_tree *ls_tree; - guint ls; - - if (!tree) - return; +static const int * r3_lockstate_flags[] = { + &hf_r3_lockstate_passage, + &hf_r3_lockstate_panic, + &hf_r3_lockstate_lockout, + &hf_r3_lockstate_relock, + &hf_r3_lockstate_autoopen, + &hf_r3_lockstate_nextauto, + &hf_r3_lockstate_lockstate, + &hf_r3_lockstate_wantstate, + &hf_r3_lockstate_remote, + &hf_r3_lockstate_update, + &hf_r3_lockstate_exceptionspresent, + &hf_r3_lockstate_exceptionsactive, + &hf_r3_lockstate_timezonespresent, + &hf_r3_lockstate_timezonesactive, + &hf_r3_lockstate_autounlockspresent, + &hf_r3_lockstate_autounlocksactive, + &hf_r3_lockstate_uapmspresent, + &hf_r3_lockstate_uapmsactive, + &hf_r3_lockstate_uapmrelockspresent, + &hf_r3_lockstate_uapmreslocksactive, + &hf_r3_lockstate_nvramprotect, + &hf_r3_lockstate_nvramchecksum, + NULL +}; - DISSECTOR_ASSERT(start_offset == 0); + DISSECTOR_ASSERT(start_offset == 0); - ls = tvb_get_letoh24 (tvb, 0); - ls_tree = proto_tree_add_subtree_format(tree, tvb, 0, -1, ett_r3lockstate, NULL, "Lock State (0x%06x)", ls); - - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_passage, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_panic, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_lockout, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_relock, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_autoopen, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_nextauto, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_lockstate, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_wantstate, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_remote, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_update, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_exceptionspresent, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_exceptionsactive, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_timezonespresent, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_timezonesactive, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_autounlockspresent, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_autounlocksactive, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_uapmspresent, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_uapmsactive, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_uapmrelockspresent, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_uapmreslocksactive, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_nvramprotect, tvb, 0, 3, ls); - proto_tree_add_boolean (ls_tree, hf_r3_lockstate_nvramchecksum, tvb, 0, 3, ls); + proto_tree_add_bitmask(tree, tvb, start_offset, hf_r3_lockstate, ett_r3lockstate, r3_lockstate_flags, ENC_LITTLE_ENDIAN); } static void @@ -5361,20 +5466,7 @@ dissect_r3_cmd_manageuser (tvbuff_t *tvb, guint32 start_offset, guint32 length _ } else { - proto_item *timezone_item; - proto_tree *timezone_tree; - guint32 i; - guint32 tz; - - if (!tree) - break; - - tz = tvb_get_letohl (payload_tvb, offset); - timezone_item = proto_tree_add_item (mu_tree, hf_r3_upstreamfieldarray [paramType], payload_tvb, offset, 4, ENC_LITTLE_ENDIAN); - timezone_tree = proto_item_add_subtree (timezone_item, ett_r3timezone); - - for (i = 0; i < 32; i++) - proto_tree_add_boolean (timezone_tree, hf_r3_timezonearray [i], payload_tvb, offset, 4, tz); + proto_tree_add_bitmask(mu_tree, payload_tvb, offset, hf_r3_upstreamfieldarray[paramType], ett_r3timezone, r3_timezonearray, ENC_LITTLE_ENDIAN); } } break; @@ -5526,10 +5618,8 @@ dissect_r3_cmd_definetimezone (tvbuff_t *tvb, guint32 start_offset, guint32 leng { proto_tree *starttime_tree; proto_tree *endtime_tree; - proto_tree *daymap_tree; guint8 cmdLen; tvbuff_t *payload_tvb; - guint32 i; guint8 tzmode; if (!tree) @@ -5559,12 +5649,7 @@ dissect_r3_cmd_definetimezone (tvbuff_t *tvb, guint32 start_offset, guint32 leng proto_tree_add_item (endtime_tree, hf_r3_definetimezone_endtime_hours, payload_tvb, 3, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item (endtime_tree, hf_r3_definetimezone_endtime_minutes, payload_tvb, 4, 1, ENC_LITTLE_ENDIAN); - daymap_tree = proto_tree_add_subtree_format(tree, payload_tvb, 5, 1, ett_r3definetimezonedaymap, NULL, - "Day Map (0x%02x)", tvb_get_guint8 (payload_tvb, 5)); - - for (i = 0; i < 7; i++) - proto_tree_add_boolean (daymap_tree, hf_r3_definetimezone_daymap [i], payload_tvb, 5, 1, - tvb_get_guint8 (payload_tvb, 5)); + proto_tree_add_bitmask(tree, payload_tvb, 5, hf_r3_definetimezone_daymap, ett_r3definetimezonedaymap, r3_definetimezone_daymap, ENC_NA); proto_tree_add_item (tree, hf_r3_definetimezone_exceptiongroup, payload_tvb, 6, 1, ENC_LITTLE_ENDIAN); proto_tree_add_uint (tree, hf_r3_definetimezone_mode, payload_tvb, 7, 1, @@ -5954,28 +6039,10 @@ dissect_r3_cmd_powertableselection (tvbuff_t *tvb, guint32 start_offset, guint32 static void dissect_r3_cmd_clearnvram (tvbuff_t *tvb, guint32 start_offset, guint32 length _U_, packet_info *pinfo _U_, proto_tree *tree) { - proto_tree *nvram_tree; - guint8 cmdLen; - tvbuff_t *payload_tvb; - guint32 nvramclearoptions; - guint32 i; - - if (!tree) - return; - - cmdLen = tvb_get_guint8 (tvb, start_offset + 0); - payload_tvb = tvb_new_subset_length (tvb, start_offset + 2, cmdLen - 2); - proto_tree_add_item (tree, hf_r3_commandlength, tvb, start_offset + 0, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item (tree, hf_r3_command, tvb, start_offset + 1, 1, ENC_LITTLE_ENDIAN); - - nvramclearoptions = tvb_get_letohs (payload_tvb, 0); - - nvram_tree = proto_tree_add_subtree_format(tree, payload_tvb, 0, 2, ett_r3clearnvram, NULL, - "NVRAM Clean Options (0x%04x)", nvramclearoptions); - - for (i = 0; i < 16; i++) - proto_tree_add_boolean (nvram_tree, hf_r3_nvramclearoptions [i], payload_tvb, 0, 2, nvramclearoptions); + proto_tree_add_bitmask(tree, tvb, start_offset + 2, hf_r3_nvramclearoptions, + ett_r3clearnvram, r3_nvramclearoptions, ENC_LITTLE_ENDIAN); } static void @@ -7093,162 +7160,162 @@ void proto_register_r3 (void) NULL, HFILL } }, - { &hf_r3_timezonearray [ 0], + { &hf_r3_timezonearray0, { "Timezone 0", "r3.timezone.0", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000001, NULL, HFILL } }, - { &hf_r3_timezonearray [ 1], + { &hf_r3_timezonearray1, { "Timezone 1", "r3.timezone.1", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000002, NULL, HFILL } }, - { &hf_r3_timezonearray [ 2], + { &hf_r3_timezonearray2, { "Timezone 2", "r3.timezone.2", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000004, NULL, HFILL } }, - { &hf_r3_timezonearray [ 3], + { &hf_r3_timezonearray3, { "Timezone 3", "r3.timezone.3", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000008, NULL, HFILL } }, - { &hf_r3_timezonearray [ 4], + { &hf_r3_timezonearray4, { "Timezone 4", "r3.timezone.4", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000010, NULL, HFILL } }, - { &hf_r3_timezonearray [ 5], + { &hf_r3_timezonearray5, { "Timezone 5", "r3.timezone.5", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000020, NULL, HFILL } }, - { &hf_r3_timezonearray [ 6], + { &hf_r3_timezonearray6, { "Timezone 6", "r3.timezone.6", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000040, NULL, HFILL } }, - { &hf_r3_timezonearray [ 7], + { &hf_r3_timezonearray7, { "Timezone 7", "r3.timezone.7", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000080, NULL, HFILL } }, - { &hf_r3_timezonearray [ 8], + { &hf_r3_timezonearray8, { "Timezone 8", "r3.timezone.8", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000100, NULL, HFILL } }, - { &hf_r3_timezonearray [ 9], + { &hf_r3_timezonearray9, { "Timezone 9", "r3.timezone.9", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000200, NULL, HFILL } }, - { &hf_r3_timezonearray [10], + { &hf_r3_timezonearray10, { "Timezone 10", "r3.timezone.10", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000400, NULL, HFILL } }, - { &hf_r3_timezonearray [11], + { &hf_r3_timezonearray11, { "Timezone 11", "r3.timezone.11", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00000800, NULL, HFILL } }, - { &hf_r3_timezonearray [12], + { &hf_r3_timezonearray12, { "Timezone 12", "r3.timezone.12", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00001000, NULL, HFILL } }, - { &hf_r3_timezonearray [13], + { &hf_r3_timezonearray13, { "Timezone 13", "r3.timezone.13", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00002000, NULL, HFILL } }, - { &hf_r3_timezonearray [14], + { &hf_r3_timezonearray14, { "Timezone 14", "r3.timezone.14", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00004000, NULL, HFILL } }, - { &hf_r3_timezonearray [15], + { &hf_r3_timezonearray15, { "Timezone 15", "r3.timezone.15", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00008000, NULL, HFILL } }, - { &hf_r3_timezonearray [16], + { &hf_r3_timezonearray16, { "Timezone 16", "r3.timezone.16", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00010000, NULL, HFILL } }, - { &hf_r3_timezonearray [17], + { &hf_r3_timezonearray17, { "Timezone 17", "r3.timezone.17", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00020000, NULL, HFILL } }, - { &hf_r3_timezonearray [18], + { &hf_r3_timezonearray18, { "Timezone 18", "r3.timezone.18", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00040000, NULL, HFILL } }, - { &hf_r3_timezonearray [19], + { &hf_r3_timezonearray19, { "Timezone 19", "r3.timezone.19", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00080000, NULL, HFILL } }, - { &hf_r3_timezonearray [20], + { &hf_r3_timezonearray20, { "Timezone 20", "r3.timezone.20", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00100000, NULL, HFILL } }, - { &hf_r3_timezonearray [21], + { &hf_r3_timezonearray21, { "Timezone 21", "r3.timezone.21", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00200000, NULL, HFILL } }, - { &hf_r3_timezonearray [22], + { &hf_r3_timezonearray22, { "Timezone 22", "r3.timezone.22", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00400000, NULL, HFILL } }, - { &hf_r3_timezonearray [23], + { &hf_r3_timezonearray23, { "Timezone 23", "r3.timezone.23", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x00800000, NULL, HFILL } }, - { &hf_r3_timezonearray [24], + { &hf_r3_timezonearray24, { "Timezone 24", "r3.timezone.24", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x01000000, NULL, HFILL } }, - { &hf_r3_timezonearray [25], + { &hf_r3_timezonearray25, { "Timezone 25", "r3.timezone.25", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x02000000, NULL, HFILL } }, - { &hf_r3_timezonearray [26], + { &hf_r3_timezonearray26, { "Timezone 26", "r3.timezone.26", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x04000000, NULL, HFILL } }, - { &hf_r3_timezonearray [27], + { &hf_r3_timezonearray27, { "Timezone 27", "r3.timezone.27", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x08000000, NULL, HFILL } }, - { &hf_r3_timezonearray [28], + { &hf_r3_timezonearray28, { "Timezone 28", "r3.timezone.28", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x10000000, NULL, HFILL } }, - { &hf_r3_timezonearray [29], + { &hf_r3_timezonearray29, { "Timezone 29", "r3.timezone.29", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x20000000, NULL, HFILL } }, - { &hf_r3_timezonearray [30], + { &hf_r3_timezonearray30, { "Timezone 30", "r3.timezone.30", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x40000000, NULL, HFILL } }, - { &hf_r3_timezonearray [31], + { &hf_r3_timezonearray31, { "Timezone 31", "r3.timezone.31", FT_BOOLEAN, 32, TFS (&tfs_enabled_disabled), 0x80000000, NULL, HFILL } @@ -7605,37 +7672,42 @@ void proto_register_r3 (void) FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, - { &hf_r3_definetimezone_daymap [0], + { &hf_r3_definetimezone_daymap, + { "Day Map", "r3.definetimezone.daymap", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_r3_definetimezone_daymap0, { "Sunday", "r3.definetimezone.daymap.sunday", FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000001, NULL, HFILL } }, - { &hf_r3_definetimezone_daymap [1], + { &hf_r3_definetimezone_daymap1, { "Monday", "r3.definetimezone.daymap.monday", FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000002, NULL, HFILL } }, - { &hf_r3_definetimezone_daymap [2], + { &hf_r3_definetimezone_daymap2, { "Tuesday", "r3.definetimezone.daymap.tuesday", FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000004, NULL, HFILL } }, - { &hf_r3_definetimezone_daymap [3], + { &hf_r3_definetimezone_daymap3, { "Wednesday", "r3.definetimezone.daymap.wednesday", FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000008, NULL, HFILL } }, - { &hf_r3_definetimezone_daymap [4], + { &hf_r3_definetimezone_daymap4, { "Thursday", "r3.definetimezone.daymap.thursday", FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000010, NULL, HFILL } }, - { &hf_r3_definetimezone_daymap [5], + { &hf_r3_definetimezone_daymap5, { "Friday", "r3.definetimezone.daymap.friday", FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000020, NULL, HFILL } }, - { &hf_r3_definetimezone_daymap [6], + { &hf_r3_definetimezone_daymap6, { "Saturday", "r3.definetimezone.daymap.saturday", FT_BOOLEAN, 8, TFS (&tfs_enabled_disabled), 0x00000040, NULL, HFILL } @@ -7825,82 +7897,87 @@ void proto_register_r3 (void) NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 0], + { &hf_r3_nvramclearoptions, + { "NVRAM Clean Options", "r3.nvramclear", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_r3_nvramclearoptions0, { "NVRAMCLEAROPTIONS_CFGINSTALLER", "r3.nvramclear.cfginstaller", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000001, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 1], + { &hf_r3_nvramclearoptions1, { "NVRAMCLEAROPTIONS_CFGADMIN", "r3.nvramclear.cfgadmin", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000002, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 2], + { &hf_r3_nvramclearoptions2, { "NVRAMCLEAROPTIONS_EXCEPTIONS", "r3.nvramclear.exceptions", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000004, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 3], + { &hf_r3_nvramclearoptions3, { "NVRAMCLEAROPTIONS_EXCEPTIONGROUPS", "r3.nvramclear.exceptiongroups", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000008, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 4], + { &hf_r3_nvramclearoptions4, { "NVRAMCLEAROPTIONS_CALENDARS", "r3.nvramclear.calendars", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000010, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 5], + { &hf_r3_nvramclearoptions5, { "NVRAMCLEAROPTIONS_TIMEZONES", "r3.nvramclear.timezones", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000020, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 6], + { &hf_r3_nvramclearoptions6, { "NVRAMCLEAROPTIONS_FILTERS", "r3.nvramclear.filters", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000040, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 7], + { &hf_r3_nvramclearoptions7, { "NVRAMCLEAROPTIONS_EVENTLOG", "r3.nvramclear.eventlog", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000080, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 8], + { &hf_r3_nvramclearoptions8, { "NVRAMCLEAROPTIONS_USERDATA", "r3.nvramclear.userdata", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000100, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [ 9], + { &hf_r3_nvramclearoptions9, { "NVRAMCLEAROPTIONS_DECLINEDLOG", "r3.nvramclear.declinedlog", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000200, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [10], + { &hf_r3_nvramclearoptions10, { "NVRAMCLEAROPTIONS_ALARMLOG", "r3.nvramclear.alarmlog", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000400, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [11], + { &hf_r3_nvramclearoptions11, { "NVRAMCLEAROPTIONS_LRUCACHE", "r3.nvramclear.lrucache", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00000800, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [12], + { &hf_r3_nvramclearoptions12, { "NVRAMCLEAROPTIONS_DBHASH", "r3.nvramclear.dbhash", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00001000, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [13], + { &hf_r3_nvramclearoptions13, { "NVRAMCLEAROPTIONS_CFGSYSTEM", "r3.nvramclear.cfgsystem", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00002000, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [14], + { &hf_r3_nvramclearoptions14, { "NVRAMCLEAROPTIONS_UNUSED", "r3.nvramclear.unused", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00004000, NULL, HFILL } }, - { &hf_r3_nvramclearoptions [15], + { &hf_r3_nvramclearoptions15, { "NVRAMCLEAROPTIONS_USEBACKUP", "r3.nvramclear.usebackup", FT_BOOLEAN, 16, TFS (&tfs_enabled_disabled), 0x00008000, NULL, HFILL } @@ -8350,6 +8427,12 @@ void proto_register_r3 (void) NULL, HFILL } }, + { &hf_r3_lockstate, + { "Lock State", "r3.lockstate", + FT_UINT24, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_r3_lockstate_passage, { "Passage", "r3.lockstate.passage", FT_BOOLEAN, 24, NULL, 0x00000001, diff --git a/epan/dissectors/packet-bacnet.c b/epan/dissectors/packet-bacnet.c index 3482f9d2da..ba4ad9ae15 100644 --- a/epan/dissectors/packet-bacnet.c +++ b/epan/dissectors/packet-bacnet.c @@ -171,9 +171,7 @@ static void dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; - proto_item *ct; proto_tree *bacnet_tree; - proto_tree *control_tree; gint offset; guint8 bacnet_version; @@ -187,6 +185,17 @@ dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 i; tvbuff_t *next_tvb; guint32 vendor_id; + static const int * control_flags[] = { + &hf_bacnet_control_net, + &hf_bacnet_control_res1, + &hf_bacnet_control_dest, + &hf_bacnet_control_res2, + &hf_bacnet_control_src, + &hf_bacnet_control_expect, + &hf_bacnet_control_prio_high, + &hf_bacnet_control_prio_low, + NULL + }; col_set_str(pinfo->cinfo, COL_PROTOCOL, "BACnet-NPDU"); @@ -206,25 +215,8 @@ dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bacnet_version,"0x%02x (%s)",bacnet_version, (bacnet_version == 0x01)?"ASHRAE 135-1995":"unknown"); offset ++; - ct = proto_tree_add_uint(bacnet_tree, hf_bacnet_control, - tvb, offset, 1, bacnet_control); - control_tree = proto_item_add_subtree(ct, ett_bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_net, - tvb, offset, 1, bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_res1, tvb, - offset, 1, bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_dest, tvb, - offset, 1, bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_res2, tvb, - offset, 1, bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_src, tvb, - offset, 1, bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_expect, tvb, - offset, 1, bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_prio_high, - tvb, offset, 1, bacnet_control); - proto_tree_add_boolean(control_tree, hf_bacnet_control_prio_low, - tvb, offset, 1, bacnet_control); + proto_tree_add_bitmask(bacnet_tree, tvb, offset, hf_bacnet_control, + ett_bacnet_control, control_flags, ENC_NA); offset ++; if (bacnet_control & BAC_CONTROL_DEST) { /* DNET, DLEN, DADR */ proto_tree_add_item(bacnet_tree, hf_bacnet_dnet, diff --git a/epan/dissectors/packet-bat.c b/epan/dissectors/packet-bat.c index f5dcfa9b04..5d8341e311 100644 --- a/epan/dissectors/packet-bat.c +++ b/epan/dissectors/packet-bat.c @@ -232,12 +232,17 @@ static void dissect_bat_gwflags(tvbuff_t *tvb, guint8 gwflags, int offset, proto static int dissect_bat_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - proto_item *tf, *tgw; - proto_tree *bat_batman_tree = NULL, *flag_tree; + proto_item *tgw; + proto_tree *bat_batman_tree = NULL; struct batman_packet_v5 *batman_packeth; const guint8 *old_orig_addr, *orig_addr; guint32 old_orig, orig; gint i; + static const int * batman_flags[] = { + &hf_bat_batman_flags_unidirectional, + &hf_bat_batman_flags_directlink, + NULL + }; tvbuff_t *next_tvb; @@ -279,12 +284,8 @@ static int dissect_bat_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree_add_item(bat_batman_tree, hf_bat_batman_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(bat_batman_tree, hf_bat_batman_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_bat_batman_flags); - proto_tree_add_boolean(flag_tree, hf_bat_batman_flags_unidirectional, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_bat_batman_flags_directlink, tvb, offset, 1, batman_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(bat_batman_tree, tvb, offset, hf_bat_batman_flags, + ett_bat_batman_flags, batman_flags, ENC_NA); offset += 1; proto_tree_add_item(bat_batman_tree, hf_bat_batman_ttl, tvb, offset, 1, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-batadv.c b/epan/dissectors/packet-batadv.c index 50d21f9096..3484555228 100644 --- a/epan/dissectors/packet-batadv.c +++ b/epan/dissectors/packet-batadv.c @@ -690,6 +690,45 @@ static const value_string tvlv_tt_typenames[] = { {0, NULL} }; +static const int * batman_v5_flags[] = { + &hf_batadv_batman_flags_directlink, + &hf_batadv_batman_flags_vis_server, + NULL +}; + +static const int * batman_v9_flags[] = { + &hf_batadv_batman_flags_directlink, + &hf_batadv_batman_flags_vis_server, + &hf_batadv_batman_flags_primaries_first_hop, + NULL +}; + +static const int * batman_v14_flags[] = { + &hf_batadv_batman_flags_directlink, + &hf_batadv_batman_flags_vis_server, + &hf_batadv_batman_flags_primaries_first_hop, + &hf_batadv_batman_flags_not_best_next_hop, + NULL +}; + +static const int * unicast_frag_flags[] = { + &hf_batadv_unicast_frag_flags_head, + &hf_batadv_unicast_frag_flags_largetail, + NULL +}; + +static const int * tt_query_flags[] = { + &hf_batadv_tt_query_flags_type, + &hf_batadv_tt_query_flags_full_table, + NULL +}; + +static const int * tt_entry_flags[] = { + &hf_batadv_tt_entry_flags_change_del, + &hf_batadv_tt_entry_flags_client_roam, + NULL +}; + static const fragment_items msg_frag_items = { /* Fragment subtrees */ &ett_msg_fragment, @@ -994,8 +1033,8 @@ static void dissect_batadv_gwflags(tvbuff_t *tvb, guint8 gwflags, int offset, pr static int dissect_batadv_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - proto_item *tf, *tgw; - proto_tree *batadv_batman_tree = NULL, *flag_tree; + proto_item *tgw; + proto_tree *batadv_batman_tree = NULL; guint8 type; struct batman_packet_v5 *batman_packeth; const guint8 *prev_sender_addr, *orig_addr; @@ -1050,12 +1089,8 @@ static int dissect_batadv_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinf proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_directlink, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_vis_server, tvb, offset, 1, batman_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_batman_tree, tvb, offset, hf_batadv_batman_flags, + ett_batadv_batman_flags, batman_v5_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_ttl, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1104,8 +1139,7 @@ static int dissect_batadv_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinf static int dissect_batadv_batman_v7(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - proto_item *tf; - proto_tree *batadv_batman_tree = NULL, *flag_tree; + proto_tree *batadv_batman_tree = NULL; guint8 type; struct batman_packet_v7 *batman_packeth; const guint8 *prev_sender_addr, *orig_addr; @@ -1158,12 +1192,8 @@ static int dissect_batadv_batman_v7(tvbuff_t *tvb, int offset, packet_info *pinf proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_directlink, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_vis_server, tvb, offset, 1, batman_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_batman_tree, tvb, offset, hf_batadv_batman_flags, + ett_batadv_batman_flags, batman_v5_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_tq, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1205,8 +1235,8 @@ static int dissect_batadv_batman_v7(tvbuff_t *tvb, int offset, packet_info *pinf static int dissect_batadv_batman_v9(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - proto_item *tf, *tgw; - proto_tree *batadv_batman_tree = NULL, *flag_tree; + proto_item *tgw; + proto_tree *batadv_batman_tree = NULL; guint8 type; struct batman_packet_v9 *batman_packeth; const guint8 *prev_sender_addr, *orig_addr; @@ -1260,13 +1290,8 @@ static int dissect_batadv_batman_v9(tvbuff_t *tvb, int offset, packet_info *pinf proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_directlink, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_vis_server, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_primaries_first_hop, tvb, offset, 1, batman_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_batman_tree, tvb, offset, hf_batadv_batman_flags, + ett_batadv_batman_flags, batman_v9_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_tq, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1315,8 +1340,8 @@ static int dissect_batadv_batman_v9(tvbuff_t *tvb, int offset, packet_info *pinf static int dissect_batadv_batman_v10(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - proto_item *tf, *tgw; - proto_tree *batadv_batman_tree = NULL, *flag_tree; + proto_item *tgw; + proto_tree *batadv_batman_tree = NULL; guint8 type; struct batman_packet_v10 *batman_packeth; const guint8 *prev_sender_addr, *orig_addr; @@ -1370,13 +1395,8 @@ static int dissect_batadv_batman_v10(tvbuff_t *tvb, int offset, packet_info *pin proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_directlink, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_vis_server, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_primaries_first_hop, tvb, offset, 1, batman_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_batman_tree, tvb, offset, hf_batadv_batman_flags, + ett_batadv_batman_flags, batman_v9_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_tq, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1425,8 +1445,7 @@ static int dissect_batadv_batman_v10(tvbuff_t *tvb, int offset, packet_info *pin static int dissect_batadv_batman_v11(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - proto_item *tf; - proto_tree *batadv_batman_tree = NULL, *flag_tree; + proto_tree *batadv_batman_tree = NULL; guint8 type; struct batman_packet_v11 *batman_packeth; const guint8 *prev_sender_addr, *orig_addr; @@ -1479,13 +1498,8 @@ static int dissect_batadv_batman_v11(tvbuff_t *tvb, int offset, packet_info *pin proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_directlink, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_vis_server, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_primaries_first_hop, tvb, offset, 1, batman_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_batman_tree, tvb, offset, hf_batadv_batman_flags, + ett_batadv_batman_flags, batman_v9_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_tq, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1527,8 +1541,8 @@ static int dissect_batadv_batman_v11(tvbuff_t *tvb, int offset, packet_info *pin static int dissect_batadv_batman_v14(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - proto_item *tf, *tgw; - proto_tree *batadv_batman_tree = NULL, *flag_tree; + proto_item *tgw; + proto_tree *batadv_batman_tree = NULL; guint8 type; struct batman_packet_v14 *batman_packeth; const guint8 *prev_sender_addr, *orig_addr; @@ -1588,14 +1602,8 @@ static int dissect_batadv_batman_v14(tvbuff_t *tvb, int offset, packet_info *pin proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_ttl, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_directlink, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_vis_server, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_primaries_first_hop, tvb, offset, 1, batman_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_batman_flags_not_best_next_hop, tvb, offset, 1, batman_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_batman_tree, tvb, offset, hf_batadv_batman_flags, + ett_batadv_batman_flags, batman_v14_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(batadv_batman_tree, hf_batadv_batman_seqno32, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -2818,12 +2826,11 @@ static void dissect_batadv_unicast_frag(tvbuff_t *tvb, packet_info *pinfo, proto static void dissect_batadv_unicast_frag_v12(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *tf; struct unicast_frag_packet_v12 *unicast_frag_packeth; const guint8 *dest_addr, *orig_addr; gboolean save_fragmented; fragment_head *frag_msg = NULL; - proto_tree *batadv_unicast_frag_tree = NULL, *flag_tree; + proto_tree *batadv_unicast_frag_tree = NULL; tvbuff_t *new_tvb; int offset = 0; @@ -2875,12 +2882,8 @@ static void dissect_batadv_unicast_frag_v12(tvbuff_t *tvb, packet_info *pinfo, p proto_tree_add_item(batadv_unicast_frag_tree, hf_batadv_unicast_frag_ttl, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_unicast_frag_tree, hf_batadv_unicast_frag_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_unicast_frag_flags_head, tvb, offset, 1, unicast_frag_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_unicast_frag_flags_largetail, tvb, offset, 1, unicast_frag_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_unicast_frag_tree, tvb, offset, hf_batadv_unicast_frag_flags, + ett_batadv_batman_flags, unicast_frag_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_ether(batadv_unicast_frag_tree, hf_batadv_unicast_frag_orig, tvb, offset, 6, orig_addr); @@ -2924,12 +2927,11 @@ static void dissect_batadv_unicast_frag_v12(tvbuff_t *tvb, packet_info *pinfo, p static void dissect_batadv_unicast_frag_v14(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *tf; struct unicast_frag_packet_v14 *unicast_frag_packeth; const guint8 *dest_addr, *orig_addr; gboolean save_fragmented; fragment_head *frag_msg = NULL; - proto_tree *batadv_unicast_frag_tree = NULL, *flag_tree; + proto_tree *batadv_unicast_frag_tree = NULL; tvbuff_t *new_tvb; int offset = 0; @@ -2986,12 +2988,8 @@ static void dissect_batadv_unicast_frag_v14(tvbuff_t *tvb, packet_info *pinfo, p proto_tree_add_ether(batadv_unicast_frag_tree, hf_batadv_unicast_frag_dst, tvb, offset, 6, dest_addr); offset += 6; - tf = proto_tree_add_item(batadv_unicast_frag_tree, hf_batadv_unicast_frag_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_batman_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_unicast_frag_flags_head, tvb, offset, 1, unicast_frag_packeth->flags); - proto_tree_add_boolean(flag_tree, hf_batadv_unicast_frag_flags_largetail, tvb, offset, 1, unicast_frag_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_unicast_frag_tree, tvb, offset, hf_batadv_unicast_frag_flags, + ett_batadv_batman_flags, unicast_frag_flags, ENC_BIG_ENDIAN); offset += 1; /* Skip 1 byte of padding. */ @@ -3608,8 +3606,7 @@ static void dissect_batadv_tt_query_v14(tvbuff_t *tvb, packet_info *pinfo _U_, p { struct tt_query_packet_v14 *tt_query_packeth; const guint8 *dst_addr, *src_addr; - proto_item *tf; - proto_tree *batadv_tt_query_tree = NULL, *flag_tree; + proto_tree *batadv_tt_query_tree = NULL; tvbuff_t *next_tvb; gint length_remaining; @@ -3669,12 +3666,8 @@ static void dissect_batadv_tt_query_v14(tvbuff_t *tvb, packet_info *pinfo _U_, p proto_tree_add_item(batadv_tt_query_tree, hf_batadv_tt_query_ttl, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tf = proto_tree_add_item(batadv_tt_query_tree, hf_batadv_tt_query_flags, tvb, offset, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_tt_query_flags); - proto_tree_add_uint(flag_tree, hf_batadv_tt_query_flags_type, tvb, offset, 1, tt_type); - proto_tree_add_boolean(flag_tree, hf_batadv_tt_query_flags_full_table, tvb, offset, 1, tt_query_packeth->flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_tt_query_tree, tvb, offset, hf_batadv_tt_query_flags, + ett_batadv_tt_query_flags, tt_query_flags, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_ether(batadv_tt_query_tree, hf_batadv_tt_query_dst, tvb, offset, 6, dst_addr); @@ -3734,11 +3727,8 @@ static void dissect_batadv_tt_query_v14(tvbuff_t *tvb, packet_info *pinfo _U_, p static void dissect_tt_entry_v14(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { const guint8 *entry; - guint8 flags; - proto_item *tf; - proto_tree *batadv_tt_entry_tree = NULL, *flag_tree; + proto_tree *batadv_tt_entry_tree = NULL; - flags = tvb_get_guint8(tvb, 0); entry = tvb_get_ptr(tvb, 1, 6); if (tree) { @@ -3754,12 +3744,8 @@ static void dissect_tt_entry_v14(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr batadv_tt_entry_tree = proto_item_add_subtree(ti, ett_batadv_tt_entry); } - tf = proto_tree_add_item(batadv_tt_entry_tree, hf_batadv_tt_entry_flags, tvb, 0, 1, ENC_BIG_ENDIAN); - /* <flags> */ - flag_tree = proto_item_add_subtree(tf, ett_batadv_tt_entry_flags); - proto_tree_add_boolean(flag_tree, hf_batadv_tt_entry_flags_change_del, tvb, 0, 1, flags); - proto_tree_add_boolean(flag_tree, hf_batadv_tt_entry_flags_client_roam, tvb, 0, 1, flags); - /* </flags> */ + proto_tree_add_bitmask(batadv_tt_entry_tree, tvb, 0, hf_batadv_tt_entry_flags, + ett_batadv_tt_entry_flags, tt_entry_flags, ENC_BIG_ENDIAN); proto_tree_add_ether(batadv_tt_entry_tree, hf_batadv_tt_entry, tvb, 1, 6, entry); } diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index f45e3d3557..cf444d9379 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -5139,7 +5139,6 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *bp_tree; proto_item *bp_ti, *ti; - proto_tree *flag_tree; proto_item *fi, *hidden_item; guint8 op; guint8 htype, hlen; @@ -5151,6 +5150,12 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 flags, secs; int offset_delta; guint8 overload = 0; /* DHCP option overload */ + static const int * bootp_flags[] = { + &hf_bootp_flags_broadcast, + &hf_bootp_flags_reserved, + NULL + }; + rfc3396_dns_domain_search_list.total_number_of_block = 0; rfc3396_dns_domain_search_list.tvb_composite = NULL; rfc3396_sip_server.total_number_of_block = 0; @@ -5266,15 +5271,11 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) 8, 2, ENC_BIG_ENDIAN); } flags = tvb_get_ntohs(tvb, 10); - fi = proto_tree_add_uint(bp_tree, hf_bootp_flags, tvb, - 10, 2, flags); + fi = proto_tree_add_bitmask(bp_tree, tvb, 10, hf_bootp_flags, + ett_bootp_flags, bootp_flags, ENC_NA); proto_item_append_text(fi, " (%s)", (flags & BOOTP_BC) ? "Broadcast" : "Unicast"); - flag_tree = proto_item_add_subtree(fi, ett_bootp_flags); - proto_tree_add_boolean(flag_tree, hf_bootp_flags_broadcast, tvb, - 10, 2, flags); - proto_tree_add_uint(flag_tree, hf_bootp_flags_reserved, tvb, - 10, 2, flags); + proto_tree_add_item(bp_tree, hf_bootp_ip_client, tvb, 12, 4, ENC_BIG_ENDIAN); proto_tree_add_item(bp_tree, hf_bootp_ip_your, tvb, diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c index 9938ecb31a..34ad3e0426 100644 --- a/epan/dissectors/packet-ccsds.c +++ b/epan/dissectors/packet-ccsds.c @@ -48,6 +48,7 @@ void proto_reg_handoff_ccsds(void); static int proto_ccsds = -1; /* primary ccsds header */ +static int hf_ccsds_header_flags = -1; static int hf_ccsds_apid = -1; static int hf_ccsds_version = -1; static int hf_ccsds_secheader = -1; @@ -87,6 +88,7 @@ static int hf_ccsds_checkword_good = -1; static int hf_ccsds_checkword_bad = -1; /* Initialize the subtree pointers */ +static gint ett_ccsds_primary_header_flags = -1; static gint ett_ccsds = -1; static gint ett_ccsds_primary_header = -1; static gint ett_ccsds_secondary_header = -1; @@ -322,7 +324,13 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 checkword_field = 0; guint16 checkword_sum = 0; tvbuff_t *next_tvb; - + static const int * header_flags[] = { + &hf_ccsds_version, + &hf_ccsds_type, + &hf_ccsds_secheader, + &hf_ccsds_apid, + NULL + }; col_set_str(pinfo->cinfo, COL_PROTOCOL, "CCSDS"); col_set_str(pinfo->cinfo, COL_INFO, "CCSDS Packet"); @@ -352,10 +360,8 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) primary_header_tree = proto_tree_add_subtree(ccsds_tree, tvb, offset, CCSDS_PRIMARY_HEADER_LENGTH, ett_ccsds_primary_header, &primary_header, "Primary CCSDS Header"); - proto_tree_add_uint(primary_header_tree, hf_ccsds_version, tvb, offset, 2, first_word); - proto_tree_add_uint(primary_header_tree, hf_ccsds_type, tvb, offset, 2, first_word); - proto_tree_add_boolean(primary_header_tree, hf_ccsds_secheader, tvb, offset, 2, first_word); - proto_tree_add_uint(primary_header_tree, hf_ccsds_apid, tvb, offset, 2, first_word); + proto_tree_add_bitmask(primary_header_tree, tvb, offset, hf_ccsds_header_flags, + ett_ccsds_primary_header_flags, header_flags, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(primary_header_tree, hf_ccsds_seqflag, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -508,6 +514,11 @@ proto_register_ccsds(void) static hf_register_info hf[] = { /* primary ccsds header flags */ + { &hf_ccsds_header_flags, + { "Header Flags", "ccsds.header_flags", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, { &hf_ccsds_version, { "Version", "ccsds.version", FT_UINT16, BASE_DEC, NULL, HDR_VERSION, @@ -672,6 +683,7 @@ proto_register_ccsds(void) /* Setup protocol subtree array */ static gint *ett[] = { + &ett_ccsds_primary_header_flags, &ett_ccsds, &ett_ccsds_primary_header, &ett_ccsds_secondary_header, diff --git a/epan/dissectors/packet-csm-encaps.c b/epan/dissectors/packet-csm-encaps.c index 59be0b45db..c6af938b4c 100644 --- a/epan/dissectors/packet-csm-encaps.c +++ b/epan/dissectors/packet-csm-encaps.c @@ -189,9 +189,8 @@ csm_to_host(guint16 fc, guint16 ct) static void dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti, *subitem; + proto_item *ti; proto_tree *csm_encaps_tree = NULL; - proto_tree *csm_encaps_control_tree = NULL; guint16 function_code, channel, class_type; guint control, type, sequence, length; guint i; @@ -259,21 +258,20 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { + static const int * control_flags[] = { + &hf_csm_encaps_ctrl_ack, + &hf_csm_encaps_ctrl_ack_suppress, + &hf_csm_encaps_ctrl_endian, + NULL + }; + ti = proto_tree_add_item(tree, proto_csm_encaps, tvb, 0, -1, ENC_NA); csm_encaps_tree = proto_item_add_subtree(ti, ett_csm_encaps); - - - proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_opcode, tvb, 0, 2, ENC_BIG_ENDIAN); proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_seq, tvb, 2, 1, ENC_BIG_ENDIAN); - subitem = proto_tree_add_uint(csm_encaps_tree, hf_csm_encaps_ctrl, tvb, 3, 1, control); - csm_encaps_control_tree = proto_item_add_subtree(subitem, ett_csm_encaps_control); - - proto_tree_add_boolean(csm_encaps_control_tree, hf_csm_encaps_ctrl_ack, tvb, 3, 1, control); - proto_tree_add_boolean(csm_encaps_control_tree, hf_csm_encaps_ctrl_ack_suppress, tvb, 3, 1, control); - proto_tree_add_boolean(csm_encaps_control_tree, hf_csm_encaps_ctrl_endian, tvb, 3, 1, control); + proto_tree_add_bitmask(tree, tvb, 3, hf_csm_encaps_ctrl, ett_csm_encaps_control, control_flags, ENC_NA); proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_channel, tvb, 4, 2, ENC_BIG_ENDIAN); proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_length, tvb, 6, 1, ENC_BIG_ENDIAN); |