From 97c808c75cefd738279906855724e4d5f675cdd2 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 26 Sep 2012 18:10:29 +0000 Subject: replaced decode_boolean_bitfield calls with itemized filters svn path=/trunk/; revision=45152 --- epan/dissectors/packet-cdp.c | 139 ++++++++++++++++----------- epan/dissectors/packet-dnp.c | 74 +++++++++----- epan/dissectors/packet-dns.c | 96 ++++++++++++------ epan/dissectors/packet-lldp.c | 1 - epan/dissectors/packet-nbipx.c | 152 +++++++++++++++++++---------- epan/dissectors/packet-nbns.c | 203 +++++++++++++++++++++------------------ epan/dissectors/packet-netbios.c | 37 +++---- epan/dissectors/packet-nfs.c | 203 +++++++++++++++++++++------------------ epan/dissectors/packet-nfsacl.c | 101 ++++++++++--------- epan/dissectors/packet-rtcp.c | 10 +- 10 files changed, 592 insertions(+), 424 deletions(-) diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c index 97c00a6ef8..7ffb2760c2 100644 --- a/epan/dissectors/packet-cdp.c +++ b/epan/dissectors/packet-cdp.c @@ -65,6 +65,19 @@ static int hf_cdp_tlvlength = -1; static int hf_cdp_deviceid = -1; static int hf_cdp_platform = -1; static int hf_cdp_portid = -1; +static int hf_cdp_capabilities = -1; +static int hf_cdp_capabilities_router = -1; +static int hf_cdp_capabilities_trans_bridge = -1; +static int hf_cdp_capabilities_src_bridge = -1; +static int hf_cdp_capabilities_switch = -1; +static int hf_cdp_capabilities_host = -1; +static int hf_cdp_capabilities_igmp_capable = -1; +static int hf_cdp_capabilities_repeater = -1; +static int hf_cdp_spare_poe_tlv = -1; +static int hf_cdp_spare_poe_tlv_poe = -1; +static int hf_cdp_spare_poe_tlv_spare_pair_arch = -1; +static int hf_cdp_spare_poe_tlv_req_spare_pair_poe = -1; +static int hf_cdp_spare_poe_tlv_pse_spare_pair_poe = -1; static gint ett_cdp = -1; static gint ett_cdp_tlv = -1; @@ -1038,42 +1051,18 @@ dissect_capabilities(tvbuff_t *tvb, int offset, int length, proto_tree *tree) { proto_item *ti; proto_tree *capabilities_tree; - guint32 capabilities; if (length < 4) return; - capabilities = tvb_get_ntohl(tvb, offset); - ti = proto_tree_add_text(tree, tvb, offset, length, "Capabilities: 0x%08x", - capabilities); + ti = proto_tree_add_item(tree, hf_cdp_capabilities, tvb, offset, 4, ENC_BIG_ENDIAN); capabilities_tree = proto_item_add_subtree(ti, ett_cdp_capabilities); - proto_tree_add_text(capabilities_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(capabilities, 0x01, 4*8, - "Is a Router", - "Not a Router")); - proto_tree_add_text(capabilities_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(capabilities, 0x02, 4*8, - "Is a Transparent Bridge", - "Not a Transparent Bridge")); - proto_tree_add_text(capabilities_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(capabilities, 0x04, 4*8, - "Is a Source Route Bridge", - "Not a Source Route Bridge")); - proto_tree_add_text(capabilities_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(capabilities, 0x08, 4*8, - "Is a Switch", - "Not a Switch")); - proto_tree_add_text(capabilities_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(capabilities, 0x10, 4*8, - "Is a Host", - "Not a Host")); - proto_tree_add_text(capabilities_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(capabilities, 0x20, 4*8, - "Is IGMP capable", - "Not IGMP capable")); - proto_tree_add_text(capabilities_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(capabilities, 0x40, 4*8, - "Is a Repeater", - "Not a Repeater")); + proto_tree_add_item(capabilities_tree, hf_cdp_capabilities_router, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(capabilities_tree, hf_cdp_capabilities_trans_bridge, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(capabilities_tree, hf_cdp_capabilities_src_bridge, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(capabilities_tree, hf_cdp_capabilities_switch, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(capabilities_tree, hf_cdp_capabilities_host, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(capabilities_tree, hf_cdp_capabilities_igmp_capable, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(capabilities_tree, hf_cdp_capabilities_repeater, tvb, offset, 4, ENC_BIG_ENDIAN); } static void @@ -1176,33 +1165,17 @@ dissect_spare_poe_tlv(tvbuff_t *tvb, int offset, int length, { proto_item *ti; proto_tree *tlv_tree; - guint8 tlv_data; if (length == 0) { return; } - tlv_data = tvb_get_guint8(tvb, offset); - ti = proto_tree_add_text(tree, tvb, offset, length, - "Spare Pair PoE: 0x%02x", tlv_data); + ti = proto_tree_add_item(tree, hf_cdp_spare_poe_tlv, tvb, offset, 1, ENC_BIG_ENDIAN); tlv_tree = proto_item_add_subtree(ti, ett_cdp_spare_poe_tlv); - - proto_tree_add_text(tlv_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(tlv_data, 0x01, 8, - "PSE Four-Wire PoE Supported", - "PSE Four-Wire PoE Not Supported")); - proto_tree_add_text(tlv_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(tlv_data, 0x02, 8, - "PD Spare Pair Architecture Shared", - "PD Spare Pair Architecture Independent")); - proto_tree_add_text(tlv_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(tlv_data, 0x04, 8, - "PD Request Spare Pair PoE On", - "PD Request Spare Pair PoE Off")); - proto_tree_add_text(tlv_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(tlv_data, 0x08, 8, - "PSE Spare Pair PoE On", - "PSE Spare Pair PoE Off")); + proto_tree_add_item(tlv_tree, hf_cdp_spare_poe_tlv_poe, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_tree, hf_cdp_spare_poe_tlv_spare_pair_arch, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_tree, hf_cdp_spare_poe_tlv_req_spare_pair_poe, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_tree, hf_cdp_spare_poe_tlv_pse_spare_pair_poe, tvb, offset, 1, ENC_BIG_ENDIAN); } static void @@ -1275,8 +1248,66 @@ proto_register_cdp(void) { &hf_cdp_portid, {"Sent through Interface", "cdp.portid", FT_STRING, BASE_NONE, - NULL, 0, NULL, HFILL }} + NULL, 0, NULL, HFILL }}, + + { &hf_cdp_capabilities, + {"Capabilities", "cdp.capabilities", FT_UINT32, BASE_HEX, + NULL, 0, NULL, HFILL }}, + + { &hf_cdp_capabilities_router, + {"Router", "cdp.capabilities.router", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x01, NULL, HFILL }}, + + { &hf_cdp_capabilities_trans_bridge, + {"Transparent Bridge", "cdp.capabilities.trans_bridge", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x02, NULL, HFILL }}, + + { &hf_cdp_capabilities_src_bridge, + {"Source Route Bridge", "cdp.capabilities.src_bridge", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x04, NULL, HFILL }}, + + { &hf_cdp_capabilities_switch, + {"Switch", "cdp.capabilities.switch", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x08, NULL, HFILL }}, + + { &hf_cdp_capabilities_host, + {"Host", "cdp.capabilities.host", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x10, NULL, HFILL }}, + + { &hf_cdp_capabilities_igmp_capable, + {"IGMP capable", "cdp.capabilities.igmp_capable", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x20, NULL, HFILL }}, + + { &hf_cdp_capabilities_repeater, + {"Repeater", "cdp.capabilities.repeater", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x40, NULL, HFILL }}, + + { &hf_cdp_spare_poe_tlv, + { "Spare Pair PoE", "cdp.spare_poe_tlv", FT_UINT8, BASE_HEX, + NULL, 0x0, NULL, HFILL } + }, + + { &hf_cdp_spare_poe_tlv_poe, + { "PSE Four-Wire PoE", "csp.spare_poe_tlv.poe", FT_BOOLEAN, 8, + TFS(&tfs_supported_not_supported), 0x01, NULL, HFILL } + }, + + { &hf_cdp_spare_poe_tlv_spare_pair_arch, + { "PD Spare Pair Architecture", "cdp.spare_poe_tlv.spare_pair_arch", FT_BOOLEAN, 8, + TFS(&tfs_shared_independent), 0x02, NULL, HFILL } + }, + + { &hf_cdp_spare_poe_tlv_req_spare_pair_poe, + { "PD Request Spare Pair PoE", "cdp.spare_poe_tlv.req_spare_pair_poe", FT_BOOLEAN, 8, + TFS(&tfs_on_off), 0x04, NULL, HFILL } + }, + + { &hf_cdp_spare_poe_tlv_pse_spare_pair_poe, + { "PSE Spare Pair PoE", "cdp.spare_poe_tlv.pse_spare_pair_poe", FT_BOOLEAN, 8, + TFS(&tfs_on_off), 0x08, NULL, HFILL } + }, }; + static gint *ett[] = { &ett_cdp, &ett_cdp_tlv, diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 0eb6ad1045..2e65f272ef 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -601,6 +601,16 @@ static int hf_dnp3_al_aoq_b5 = -1; static int hf_dnp3_al_aoq_b6 = -1; static int hf_dnp3_al_aoq_b7 = -1; static int hf_dnp3_al_timestamp = -1; +static int hf_dnp3_al_file_perms = -1; +static int hf_dnp3_al_file_perms_read_owner = -1; +static int hf_dnp3_al_file_perms_write_owner = -1; +static int hf_dnp3_al_file_perms_exec_owner = -1; +static int hf_dnp3_al_file_perms_read_group = -1; +static int hf_dnp3_al_file_perms_write_group = -1; +static int hf_dnp3_al_file_perms_exec_group = -1; +static int hf_dnp3_al_file_perms_read_world = -1; +static int hf_dnp3_al_file_perms_write_world = -1; +static int hf_dnp3_al_file_perms_exec_world = -1; static int hf_dnp3_al_rel_timestamp = -1; static int hf_dnp3_al_ana16 = -1; static int hf_dnp3_al_ana32 = -1; @@ -1462,7 +1472,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, guint8 al_2bit, al_objq, al_objq_index, al_objq_code, al_ptflags, al_ctlobj_code, al_oct_len=0, al_ctlobj_code_c, al_ctlobj_code_m, al_ctlobj_code_tc, al_ctlobj_count, al_bi_val, bitindex=0; guint16 al_obj, al_val16=0, al_ctlobj_stat, al_relms, al_filename_offs, al_filename_len, al_file_ctrl_mode, - al_file_perms, temp; + temp; guint32 al_val32, al_ptaddr=0, al_ctlobj_on, al_ctlobj_off, file_data_size; nstime_t al_reltime, al_abstime; gboolean al_bit; @@ -2287,28 +2297,18 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, /* Perms */ if (al_file_ctrl_mode == AL_OBJ_FILE_MODE_WRITE) { - al_file_perms = tvb_get_letohs(tvb, data_pos); - perms_item = proto_tree_add_text(point_tree, tvb, offset, 2, "Permissions: %o", al_file_perms); - perms_tree = proto_item_add_subtree(perms_item, ett_dnp3_al_obj_point_perms); + perms_item = proto_tree_add_item(point_tree, hf_dnp3_al_file_perms, tvb, offset, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 0400, 16, "Read permission for owner", "no Read permission for owner")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 0200, 16, "Write permission for owner", "no Write permission for owner")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 0100, 16, "Execute permission for owner", "no Execute permission for owner")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 040, 16, "Read permission for group", "no Read permission for group")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 020, 16, "Write permission for group", "no Write permission for group")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 010, 16, "Execute permission for group", "no Execute permission for group")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 04, 16, "Read permission for world", "no Read permission for world")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 02, 16, "Write permission for world", "no Write permission for world")); - proto_tree_add_text(perms_tree, tvb, data_pos, 2, "%s", - decode_boolean_bitfield(al_file_perms, 01, 16, "Execute permission for world", "no Execute permission for world")); + perms_tree = proto_item_add_subtree(perms_item, ett_dnp3_al_obj_point_perms); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_read_owner, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_write_owner, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_exec_owner, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_read_group, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_write_group, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_exec_group, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_read_world, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_write_world, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(perms_tree, hf_dnp3_al_file_perms_exec_world, tvb, offset, 2, ENC_LITTLE_ENDIAN); } data_pos += 2; @@ -3476,6 +3476,36 @@ proto_register_dnp3(void) { &hf_dnp3_al_timestamp, { "Timestamp", "dnp3.al.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, "Object Timestamp", HFILL }}, + { &hf_dnp3_al_file_perms, + { "Permissions", "dnp3.al.file.perms", FT_UINT16, BASE_OCT, NULL, 0x0, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_read_owner, + { "Read permission for owner", "dnp3.al.file.perms.read_owner", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0400, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_write_owner, + { "Write permission for owner", "dnp3.al.file.perms.write_owner", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0200, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_exec_owner, + { "Execute permission for owner", "dnp3.al.file.perms.exec_owner", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0100, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_read_group, + { "Read permission for group", "dnp3.al.file.perms.read_group", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 040, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_write_group, + { "Write permission for group", "dnp3.al.file.perms.write_group", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 020, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_exec_group, + { "Execute permission for group", "dnp3.al.file.perms.exec_group", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 010, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_read_world, + { "Read permission for world", "dnp3.al.file.perms.read_world", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 04, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_write_world, + { "Write permission for world", "dnp3.al.file.perms.write_world", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 02, NULL, HFILL }}, + + { &hf_dnp3_al_file_perms_exec_world, + { "Execute permission for world", "dnp3.al.file.perms.exec_world", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 01, NULL, HFILL }}, + { &hf_dnp3_al_rel_timestamp, { "Relative Timestamp", "dnp3.al.reltimestamp", FT_RELATIVE_TIME, BASE_NONE, NULL, 0, "Object Relative Timestamp", HFILL }}, diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 197dbd08ee..a508dc3744 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -134,6 +134,15 @@ static int hf_dns_dnskey_protocol = -1; static int hf_dns_dnskey_algorithm = -1; static int hf_dns_dnskey_key_id = -1; static int hf_dns_dnskey_public_key = -1; +static int hf_dns_t_key_flags = -1; +static int hf_dns_t_key_flags_authentication = -1; +static int hf_dns_t_key_flags_confidentiality = -1; +static int hf_dns_t_key_flags_key_required = -1; +static int hf_dns_t_key_flags_associated_user = -1; +static int hf_dns_t_key_flags_associated_named_entity = -1; +static int hf_dns_t_key_flags_ipsec = -1; +static int hf_dns_t_key_flags_mime = -1; +static int hf_dns_t_key_flags_signatory = -1; static int hf_dns_rr_ns = -1; static int hf_dns_rr_opt = -1; static int hf_dns_rr_opt_code = -1; @@ -455,6 +464,7 @@ static const true_false_string tfs_flags_nsec3_optout = { "Additional insecure delegations allowed", "Additional insecure delegations forbidden" }; +static const true_false_string tfs_required_experimental = { "Experimental or optional", "Required" }; /* TSIG/TKEY extended errors */ #define TSIGERROR_BADSIG (16) @@ -1874,41 +1884,18 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, goto bad_rr; } flags = tvb_get_ntohs(tvb, cur_offset); - tf = proto_tree_add_text(rr_tree, tvb, cur_offset, 2, "Flags: 0x%04X", flags); + tf = proto_tree_add_item(rr_tree, hf_dns_t_key_flags, tvb, cur_offset, 2, ENC_BIG_ENDIAN); flags_tree = proto_item_add_subtree(tf, ett_t_key_flags); - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_boolean_bitfield(flags, 0x8000, - 2*8, "Key prohibited for authentication", - "Key allowed for authentication")); - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_boolean_bitfield(flags, 0x4000, - 2*8, "Key prohibited for confidentiality", - "Key allowed for confidentiality")); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_authentication, tvb, cur_offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_confidentiality, tvb, cur_offset, 2, ENC_BIG_ENDIAN); if ((flags & 0xC000) != 0xC000) { /* We have a key */ - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_boolean_bitfield(flags, 0x2000, - 2*8, "Key is experimental or optional", - "Key is required")); - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_boolean_bitfield(flags, 0x0400, - 2*8, "Key is associated with a user", - "Key is not associated with a user")); - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_boolean_bitfield(flags, 0x0200, - 2*8, "Key is associated with the named entity", - "Key is not associated with the named entity")); - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_boolean_bitfield(flags, 0x0080, - 2*8, "Key is valid for use with IPSEC", - "Key is not valid for use with IPSEC")); - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_boolean_bitfield(flags, 0x0040, - 2*8, "Key is valid for use with MIME security multiparts", - "Key is not valid for use with MIME security multiparts")); - proto_tree_add_text(flags_tree, tvb, cur_offset, 2, "%s", - decode_numeric_bitfield(flags, 0x000F, - 2*8, "Signatory = %u")); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_key_required, tvb, cur_offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_associated_user, tvb, cur_offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_associated_named_entity, tvb, cur_offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_ipsec, tvb, cur_offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_mime, tvb, cur_offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(flags_tree, hf_dns_t_key_flags_signatory, tvb, cur_offset, 2, ENC_BIG_ENDIAN); } cur_offset += 2; rr_len -= 2; @@ -4247,6 +4234,51 @@ proto_register_dns(void) FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dns_t_key_flags, + { "Flags", "dns.t_key.flags", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_authentication, + { "Key allowed for authentication", "dns.t_key.flags.authentication", + FT_BOOLEAN, 16, TFS(&tfs_not_allowed_allowed), 0x8000, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_confidentiality, + { "Key allowed for confidentiality", "dns.t_key.flags.confidentiality", + FT_BOOLEAN, 16, TFS(&tfs_not_allowed_allowed), 0x4000, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_key_required, + { "Key required", "dns.t_key.flags.required", + FT_BOOLEAN, 16, TFS(&tfs_required_experimental), 0x2000, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_associated_user, + { "Key is associated with a user", "dns.t_key.flags.associated_user", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0400, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_associated_named_entity, + { "Key is associated with the named entity", "dns.t_key.flags.associated_named_entity", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0200, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_ipsec, + { "Key use with IPSEC", "dns.t_key.flags.ipsec", + FT_BOOLEAN, 16, TFS(&tfs_valid_invalid), 0x0080, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_mime, + { "Key use with MIME security multiparts", "dns.t_key.flags.mime", + FT_BOOLEAN, 16, TFS(&tfs_valid_invalid), 0x0040, + NULL, HFILL }}, + + { &hf_dns_t_key_flags_signatory, + { "Signatory", "dns.t_key.flags.signatory", + FT_UINT16, BASE_DEC, NULL, 0x000F, + NULL, HFILL }}, + { &hf_dns_rr_ns, { "Name Server", "dns.resp.ns", FT_STRING, BASE_NONE, NULL, 0x0, diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index c83ddcd7cd..22e7f360b9 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -337,7 +337,6 @@ static const value_string power_type_802_3[] = { static const true_false_string tfs_ieee_802_3_pse_pd = { "PSE", "PD" }; static const true_false_string tfs_unknown_defined = { "Unknown", "Defined" }; -static const true_false_string tfs_shared_independent = { "Shared", "Independent" }; /* Power Type */ static const value_string media_power_type[] = { diff --git a/epan/dissectors/packet-nbipx.c b/epan/dissectors/packet-nbipx.c index 2ab6a350f9..2d77f4f269 100644 --- a/epan/dissectors/packet-nbipx.c +++ b/epan/dissectors/packet-nbipx.c @@ -31,6 +31,18 @@ #include "packet-netbios.h" static int proto_nbipx = -1; +static int hf_nbipx_name_flags = -1; +static int hf_nbipx_name_flags_group = -1; +static int hf_nbipx_name_flags_in_use = -1; +static int hf_nbipx_name_flags_registered = -1; +static int hf_nbipx_name_flags_duplicated = -1; +static int hf_nbipx_name_flags_deregistered = -1; +static int hf_nbipx_conn_control = -1; +static int hf_nbipx_conn_control_sys_packet = -1; +static int hf_nbipx_conn_control_ack = -1; +static int hf_nbipx_conn_control_attention = -1; +static int hf_nbipx_conn_control_end_msg = -1; +static int hf_nbipx_conn_control_resend = -1; static gint ett_nbipx = -1; static gint ett_nbipx_conn_ctrl = -1; @@ -181,6 +193,9 @@ static const value_string nbipx_data_stream_type_vals[] = { {0, NULL} }; +static const true_false_string tfs_system_non_system = { "System packet", "Non-system packet" }; +static const true_false_string tfs_required_not_required = { "Required", "Not required" }; + static void add_routers(proto_tree *tree, tvbuff_t *tvb, int offset) { @@ -208,7 +223,6 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *ti = NULL; int offset = 0; guint8 packet_type; - guint8 name_type_flag; proto_tree *name_type_flag_tree; proto_item *tf; char name[(NETBIOS_NAME_LEN - 1)*4 + 1]; @@ -277,7 +291,6 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case NBIPX_CHECK_NAME: case NBIPX_NAME_IN_USE: case NBIPX_DEREGISTER_NAME: - name_type_flag = tvb_get_guint8(tvb, offset); name_type = get_netbios_name(tvb, offset+2, name, (NETBIOS_NAME_LEN - 1)*4 + 1); if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s<%02x>", @@ -285,30 +298,14 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) name, name_type); } if (nbipx_tree) { - tf = proto_tree_add_text(nbipx_tree, tvb, offset, 1, - "Name type flag: 0x%02x", name_type_flag); - name_type_flag_tree = proto_item_add_subtree(tf, - ett_nbipx_name_type_flags); - proto_tree_add_text(name_type_flag_tree, tvb, offset, - 1, "%s", - decode_boolean_bitfield(name_type_flag, 0x80, 8, - "Group name", "Unique name")); - proto_tree_add_text(name_type_flag_tree, tvb, offset, - 1, "%s", - decode_boolean_bitfield(name_type_flag, 0x40, 8, - "Name in use", "Name not used")); - proto_tree_add_text(name_type_flag_tree, tvb, offset, - 1, "%s", - decode_boolean_bitfield(name_type_flag, 0x04, 8, - "Name registered", "Name not registered")); - proto_tree_add_text(name_type_flag_tree, tvb, offset, - 1, "%s", - decode_boolean_bitfield(name_type_flag, 0x02, 8, - "Name duplicated", "Name not duplicated")); - proto_tree_add_text(name_type_flag_tree, tvb, offset, - 1, "%s", - decode_boolean_bitfield(name_type_flag, 0x01, 8, - "Name deregistered", "Name not deregistered")); + tf = proto_tree_add_item(nbipx_tree, hf_nbipx_name_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); + name_type_flag_tree = proto_item_add_subtree(tf, ett_nbipx_name_type_flags); + + proto_tree_add_item(name_type_flag_tree, hf_nbipx_name_flags_group, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(name_type_flag_tree, hf_nbipx_name_flags_in_use, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(name_type_flag_tree, hf_nbipx_name_flags_registered, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(name_type_flag_tree, hf_nbipx_name_flags_duplicated, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(name_type_flag_tree, hf_nbipx_name_flags_deregistered, tvb, offset, 1, ENC_LITTLE_ENDIAN); } offset += 1; @@ -465,31 +462,17 @@ dissect_nbipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_conn_control(tvbuff_t *tvb, int offset, proto_tree *tree) { - guint8 conn_control; proto_item *ti; proto_tree *cc_tree; if (tree) { - conn_control = tvb_get_guint8(tvb, offset); - ti = proto_tree_add_text(tree, tvb, offset, 1, - "Connection control: 0x%02x", conn_control); + ti = proto_tree_add_item(tree, hf_nbipx_conn_control, tvb, offset, 1, ENC_LITTLE_ENDIAN); cc_tree = proto_item_add_subtree(ti, ett_nbipx_conn_ctrl); - proto_tree_add_text(cc_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(conn_control, 0x80, 8, - "System packet", "Non-system packet")); - proto_tree_add_text(cc_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(conn_control, 0x40, 8, - "Acknowledgement required", - "Acknowledgement not required")); - proto_tree_add_text(cc_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(conn_control, 0x20, 8, - "Attention", "No attention")); - proto_tree_add_text(cc_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(conn_control, 0x10, 8, - "End of message", "No end of message")); - proto_tree_add_text(cc_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(conn_control, 0x08, 8, - "Resend", "No resend")); + proto_tree_add_item(cc_tree, hf_nbipx_conn_control_sys_packet, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(cc_tree, hf_nbipx_conn_control_ack, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(cc_tree, hf_nbipx_conn_control_attention, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(cc_tree, hf_nbipx_conn_control_end_msg, tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(cc_tree, hf_nbipx_conn_control_resend, tvb, offset, 1, ENC_LITTLE_ENDIAN); } } @@ -508,19 +491,82 @@ dissect_packet_type(tvbuff_t *tvb, int offset, guint8 packet_type, void proto_register_nbipx(void) { -/* static hf_register_info hf[] = { - { &variable, - { "Name", "nbipx.abbreviation", TYPE, VALS_POINTER }}, - };*/ + static hf_register_info hf[] = { + { &hf_nbipx_name_flags, + { "Name type flag", "nmpi.name_flags", + FT_UINT8, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + { &hf_nbipx_name_flags_group, + { "Name", "nmpi.name_flags.group", + FT_BOOLEAN, 8, TFS(&tfs_group_unique_name), 0x80, + NULL, HFILL } + }, + { &hf_nbipx_name_flags_in_use, + { "In use", "nmpi.name_flags.in_use", + FT_BOOLEAN, 8, TFS(&tfs_used_notused), 0x40, + NULL, HFILL } + }, + { &hf_nbipx_name_flags_registered, + { "Registered", "nmpi.name_flags.registered", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04, + NULL, HFILL } + }, + { &hf_nbipx_name_flags_duplicated, + { "Duplicated", "nmpi.name_flags.duplicated", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, + NULL, HFILL } + }, + { &hf_nbipx_name_flags_deregistered, + { "Deregistered", "nmpi.name_flags.deregistered", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, + NULL, HFILL } + }, + { &hf_nbipx_name_flags, + { "Name type flag", "nmpi.name_flags", + FT_UINT8, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + { &hf_nbipx_conn_control, + { "Connection control", "nmpi.conn_control", + FT_UINT8, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + { &hf_nbipx_conn_control_sys_packet, + { "Packet", "nmpi.conn_control.sys_packet", + FT_BOOLEAN, 8, TFS(&tfs_system_non_system), 0x80, + NULL, HFILL } + }, + { &hf_nbipx_conn_control_ack, + { "Acknowledgement", "nmpi.conn_control.ack", + FT_BOOLEAN, 8, TFS(&tfs_required_not_required), 0x40, + NULL, HFILL } + }, + { &hf_nbipx_conn_control_attention, + { "Attention", "nmpi.conn_control.attention", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, + NULL, HFILL } + }, + { &hf_nbipx_conn_control_end_msg, + { "End of message", "nmpi.conn_control.end_msg", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, + NULL, HFILL } + }, + { &hf_nbipx_conn_control_resend, + { "Resend", "nmpi.conn_control.resend", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, + NULL, HFILL } + }, + }; + static gint *ett[] = { &ett_nbipx, &ett_nbipx_conn_ctrl, &ett_nbipx_name_type_flags, }; - proto_nbipx = proto_register_protocol("NetBIOS over IPX", - "NBIPX", "nbipx"); - /* proto_register_field_array(proto_nbipx, hf, array_length(hf));*/ + proto_nbipx = proto_register_protocol("NetBIOS over IPX", "NBIPX", "nbipx"); + proto_register_field_array(proto_nbipx, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } diff --git a/epan/dissectors/packet-nbns.c b/epan/dissectors/packet-nbns.c index ead357c28b..bb4ee1e556 100644 --- a/epan/dissectors/packet-nbns.c +++ b/epan/dissectors/packet-nbns.c @@ -53,6 +53,16 @@ static int hf_nbns_count_questions = -1; static int hf_nbns_count_answers = -1; static int hf_nbns_count_auth_rr = -1; static int hf_nbns_count_add_rr = -1; +static int hf_nbns_name_flags = -1; +static int hf_nbns_name_flags_group = -1; +static int hf_nbns_name_flags_ont = -1; +static int hf_nbns_name_flags_drg = -1; +static int hf_nbns_name_flags_cnf = -1; +static int hf_nbns_name_flags_act = -1; +static int hf_nbns_name_flags_prm = -1; +static int hf_nbns_nb_flags = -1; +static int hf_nbns_nb_flags_group = -1; +static int hf_nbns_nb_flags_ont = -1; static gint ett_nbns = -1; static gint ett_nbns_qd = -1; @@ -77,6 +87,7 @@ static gint ett_nbdgm = -1; static int proto_nbss = -1; static int hf_nbss_type = -1; static int hf_nbss_flags = -1; +static int hf_nbss_flags_e = -1; static int hf_nbss_length = -1; static int hf_nbss_cifs_length = -1; @@ -160,6 +171,11 @@ static const true_false_string tfs_flags_broadcast = { "Not a broadcast packet" }; +static const true_false_string tfs_nbss_flags_e = { + "Add 65536 to length", + "Add 0 to length" +}; + /* Opcodes */ #define OPCODE_QUERY 0 /* standard query */ #define OPCODE_REGISTRATION 5 /* registration */ @@ -233,6 +249,21 @@ static const value_string rcode_vals[] = { #define NAME_FLAGS_G (1<<(15-0)) /* group name */ +static const value_string name_flags_ont_vals[] = { + { NAME_FLAGS_ONT_B_NODE, "B-node" }, + { NAME_FLAGS_ONT_P_NODE, "P-node" }, + { NAME_FLAGS_ONT_M_NODE, "M-node" }, + { 0, NULL } +}; + +static const value_string nb_flags_ont_vals[] = { + { NB_FLAGS_ONT_B_NODE, "B-node" }, + { NB_FLAGS_ONT_P_NODE, "P-node" }, + { NB_FLAGS_ONT_M_NODE, "M-node" }, + { NB_FLAGS_ONT_H_NODE, "H-node" }, + { 0, NULL } +}; + static const char * nbns_type_name (int type) { @@ -515,111 +546,58 @@ nbns_add_nbns_flags(column_info *cinfo, proto_tree *nbns_tree, tvbuff_t *tvb, in } static void -nbns_add_nb_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset, gushort flags) +nbns_add_nb_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset) { - char *buf; proto_tree *field_tree; proto_item *tf; - - static const value_string nb_flags_ont_vals[] = { - { NB_FLAGS_ONT_B_NODE, "B-node" }, - { NB_FLAGS_ONT_P_NODE, "P-node" }, - { NB_FLAGS_ONT_M_NODE, "M-node" }, - { NB_FLAGS_ONT_H_NODE, "H-node" }, - { 0, NULL } - }; + gushort flags; if (!rr_tree) return; - buf = ep_alloc(MAX_BUF_SIZE); - g_snprintf(buf, MAX_BUF_SIZE, "%s", val_to_str_const(flags & NB_FLAGS_ONT, nb_flags_ont_vals, - "Unknown")); - g_strlcat(buf, ", ", MAX_BUF_SIZE); - if (flags & NB_FLAGS_G) - g_strlcat(buf, "group", MAX_BUF_SIZE); - else - g_strlcat(buf, "unique", MAX_BUF_SIZE); - buf[MAX_BUF_SIZE-1] = '\0'; - tf = proto_tree_add_text(rr_tree, tvb, offset, 2, "Flags: 0x%x (%s)", flags, - buf); + flags = tvb_get_ntohs(tvb, offset); + tf = proto_tree_add_item(rr_tree, hf_nbns_nb_flags, tvb, offset, 2, ENC_BIG_ENDIAN); field_tree = proto_item_add_subtree(tf, ett_nbns_nb_flags); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(flags, NB_FLAGS_G, - 2*8, - "Group name", - "Unique name")); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_enumerated_bitfield(flags, NB_FLAGS_ONT, - 2*8, nb_flags_ont_vals, "%s")); + proto_tree_add_item(field_tree, hf_nbns_nb_flags_group, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(field_tree, hf_nbns_nb_flags_ont, tvb, offset, 2, ENC_BIG_ENDIAN); + + proto_item_append_text(tf, "(%s, %s", + val_to_str_const(flags & NB_FLAGS_ONT, nb_flags_ont_vals, "Unknown"), + (flags & NB_FLAGS_G) ? "group" : "unique"); } static void -nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset, - gushort flags) +nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset) { - char *buf; proto_item *field_tree; proto_item *tf; - - static const value_string name_flags_ont_vals[] = { - { NAME_FLAGS_ONT_B_NODE, "B-node" }, - { NAME_FLAGS_ONT_P_NODE, "P-node" }, - { NAME_FLAGS_ONT_M_NODE, "M-node" }, - { 0, NULL } - }; + gushort flags; if (!rr_tree) return; - buf = ep_alloc(MAX_BUF_SIZE); - g_snprintf(buf, MAX_BUF_SIZE, "%s", val_to_str_const(flags & NAME_FLAGS_ONT, name_flags_ont_vals, - "Unknown")); - g_strlcat(buf, ", ", MAX_BUF_SIZE); - if (flags & NAME_FLAGS_G) - g_strlcat(buf, "group", MAX_BUF_SIZE); - else - g_strlcat(buf, "unique", MAX_BUF_SIZE); + flags = tvb_get_ntohs(tvb, offset); + tf = proto_tree_add_item(rr_tree, hf_nbns_name_flags, tvb, offset, 2, ENC_BIG_ENDIAN); + field_tree = proto_item_add_subtree(tf, ett_nbns_name_flags); + proto_tree_add_item(field_tree, hf_nbns_name_flags_group, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(field_tree, hf_nbns_name_flags_ont, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(field_tree, hf_nbns_name_flags_drg, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(field_tree, hf_nbns_name_flags_cnf, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(field_tree, hf_nbns_name_flags_act, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(field_tree, hf_nbns_name_flags_prm, tvb, offset, 2, ENC_BIG_ENDIAN); + + proto_item_append_text(tf, "(%s, %s", + val_to_str_const(flags & NAME_FLAGS_ONT, name_flags_ont_vals, "Unknown"), + (flags & NAME_FLAGS_G) ? "group" : "unique"); if (flags & NAME_FLAGS_DRG) - g_strlcat(buf, ", being deregistered", MAX_BUF_SIZE); + proto_item_append_text(tf, ", being deregistered"); if (flags & NAME_FLAGS_CNF) - g_strlcat(buf, ", in conflict", MAX_BUF_SIZE); + proto_item_append_text(tf, ", in conflict"); if (flags & NAME_FLAGS_ACT) - g_strlcat(buf, ", active", MAX_BUF_SIZE); + proto_item_append_text(tf, ", active"); if (flags & NAME_FLAGS_PRM) - g_strlcat(buf, ", permanent node name", MAX_BUF_SIZE); - buf[MAX_BUF_SIZE-1] = '\0'; - tf = proto_tree_add_text(rr_tree, tvb, offset, 2, "Name flags: 0x%x (%s)", - flags, buf); - field_tree = proto_item_add_subtree(tf, ett_nbns_name_flags); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(flags, NAME_FLAGS_G, - 2*8, - "Group name", - "Unique name")); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_enumerated_bitfield(flags, NAME_FLAGS_ONT, - 2*8, name_flags_ont_vals, "%s")); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(flags, NAME_FLAGS_DRG, - 2*8, - "Name is being deregistered", - "Name is not being deregistered")); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(flags, NAME_FLAGS_CNF, - 2*8, - "Name is in conflict", - "Name is not in conflict")); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(flags, NAME_FLAGS_ACT, - 2*8, - "Name is active", - "Name is not active")); - proto_tree_add_text(field_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(flags, NAME_FLAGS_PRM, - 2*8, - "Permanent node name", - "Not permanent node name")); + proto_item_append_text(tf, ", permanent node name"); + proto_item_append_text(tf, ")"); } static int @@ -643,7 +621,6 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset, char *name_str; guint num_names; char *nbname; - gushort name_flags; cur_offset = offset; @@ -708,9 +685,7 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset, data_len, "(incomplete entry)"); break; } - flags = tvb_get_ntohs(tvb, cur_offset); - nbns_add_nb_flags(rr_tree, tvb, cur_offset, - flags); + nbns_add_nb_flags(rr_tree, tvb, cur_offset); cur_offset += 2; data_len -= 2; @@ -777,9 +752,7 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset, goto out; } if (rr_tree) { - name_flags = tvb_get_ntohs(tvb, cur_offset); - nbns_add_name_flags(rr_tree, tvb, cur_offset, - name_flags); + nbns_add_name_flags(rr_tree, tvb, cur_offset); } cur_offset += 2; data_len -= 2; @@ -1555,9 +1528,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo, if (tree) { tf = proto_tree_add_uint(nbss_tree, hf_nbss_flags, tvb, offset, 1, flags); field_tree = proto_item_add_subtree(tf, ett_nbss_flags); - proto_tree_add_text(field_tree, tvb, offset, 1, "%s", - decode_boolean_bitfield(flags, NBSS_FLAGS_E, - 8, "Add 65536 to length", "Add 0 to length")); + proto_tree_add_item(field_tree, hf_nbss_flags_e, tvb, offset, 1, ENC_BIG_ENDIAN); } offset += 1; @@ -1944,7 +1915,47 @@ proto_register_nbt(void) { &hf_nbns_count_add_rr, { "Additional RRs", "nbns.count.add_rr", FT_UINT16, BASE_DEC, NULL, 0x0, - "Number of additional records in packet", HFILL }} + "Number of additional records in packet", HFILL }}, + { &hf_nbns_name_flags, + { "Name flags", "nbns.name_flags", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + { &hf_nbns_name_flags_group, + { "Name type", "nbns.name_flags.group", + FT_BOOLEAN, 16, TFS(&tfs_group_unique_name), NAME_FLAGS_G, + NULL, HFILL }}, + { &hf_nbns_name_flags_ont, + { "ONT", "nbns.name_flags.ont", + FT_UINT16, BASE_DEC, VALS(name_flags_ont_vals), NAME_FLAGS_ONT, + NULL, HFILL }}, + { &hf_nbns_name_flags_drg, + { "Name is being deregistered", "nbns.name_flags.drg", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), NAME_FLAGS_DRG, + NULL, HFILL }}, + { &hf_nbns_name_flags_cnf, + { "Name is in conflict", "nbns.name_flags.cnf", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), NAME_FLAGS_CNF, + NULL, HFILL }}, + { &hf_nbns_name_flags_act, + { "Name is active", "nbns.name_flags.act", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), NAME_FLAGS_ACT, + NULL, HFILL }}, + { &hf_nbns_name_flags_prm, + { "Permanent node name", "nbns.name_flags.prm", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), NAME_FLAGS_PRM, + NULL, HFILL }}, + { &hf_nbns_nb_flags, + { "Name flags", "nbns.nb_flags", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + { &hf_nbns_nb_flags_group, + { "Name type", "nbns.nb_flags.group", + FT_BOOLEAN, 16, TFS(&tfs_group_unique_name), NB_FLAGS_G, + NULL, HFILL }}, + { &hf_nbns_nb_flags_ont, + { "ONT", "nbns.nb_flags.ont", + FT_UINT16, BASE_DEC, VALS(nb_flags_ont_vals), NB_FLAGS_ONT, + NULL, HFILL }}, }; static hf_register_info hf_nbdgm[] = { @@ -1987,6 +1998,10 @@ proto_register_nbt(void) { "Flags", "nbss.flags", FT_UINT8, BASE_HEX, NULL, 0x0, "NBSS message flags", HFILL }}, + { &hf_nbss_flags_e, + { "Extend", "nbss.flags.e", + FT_BOOLEAN, 8, TFS(&tfs_nbss_flags_e), NBSS_FLAGS_E, + NULL, HFILL }}, { &hf_nbss_length, { "Length", "nbss.length", FT_UINT16, BASE_DEC, NULL, 0x0, diff --git a/epan/dissectors/packet-netbios.c b/epan/dissectors/packet-netbios.c index f0acf1b56e..0a86c324fa 100644 --- a/epan/dissectors/packet-netbios.c +++ b/epan/dissectors/packet-netbios.c @@ -104,6 +104,9 @@ static int hf_netb_local_ses_no = -1; static int hf_netb_remote_ses_no = -1; static int hf_netb_data1 = -1; static int hf_netb_data2 = -1; +static int hf_netb_data2_frame = -1; +static int hf_netb_data2_user = -1; +static int hf_netb_data2_status = -1; static int hf_netb_fragments = -1; static int hf_netb_fragment = -1; static int hf_netb_fragment_overlap = -1; @@ -796,7 +799,6 @@ dissect_netb_status_resp( tvbuff_t *tvb, int offset, proto_tree *tree) guint8 status_response = tvb_get_guint8( tvb, offset + NB_DATA1); proto_item *td2; proto_tree *data2_tree; - guint16 data2; nb_call_name_type( tvb, offset, tree); if (status_response == 0) { @@ -807,24 +809,13 @@ dissect_netb_status_resp( tvbuff_t *tvb, int offset, proto_tree *tree) "Status response: NetBIOS 2.1, %u names sent so far", status_response); } - data2 = tvb_get_letohs( tvb, offset + NB_DATA2); - td2 = proto_tree_add_text(tree, tvb, offset + NB_DATA2, 2, "Status: 0x%04x", - data2); + td2 = proto_tree_add_item(tree, hf_netb_data2, tvb, offset + NB_DATA2, 2, ENC_LITTLE_ENDIAN); data2_tree = proto_item_add_subtree(td2, ett_netb_status); - if (data2 & 0x8000) { - proto_tree_add_text(data2_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(data2, 0x8000, 8*2, - "Data length exceeds maximum frame size", NULL)); - } - if (data2 & 0x4000) { - proto_tree_add_text(data2_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(data2, 0x4000, 8*2, - "Data length exceeds user's buffer", NULL)); - } - proto_tree_add_text(data2_tree, tvb, offset, 2, "%s", - decode_numeric_bitfield(data2, 0x3FFF, 2*8, - "Status data length = %u")); + proto_tree_add_item(data2_tree, hf_netb_data2_frame, tvb, offset + NB_DATA2, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(data2_tree, hf_netb_data2_user, tvb, offset + NB_DATA2, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(data2_tree, hf_netb_data2_status, tvb, offset + NB_DATA2, 2, ENC_LITTLE_ENDIAN); + nb_xmit_corrl( tvb, offset, tree); netbios_add_name("Receiver's Name", tvb, offset + NB_RECVER_NAME, tree); netbios_add_name("Sender's Name", tvb, offset + NB_SENDER_NAME, @@ -1372,6 +1363,18 @@ void proto_register_netbios(void) { "DATA2 value", "netbios.data2", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_netb_data2_frame, + { "Data length exceeds maximum frame size", "netbios.data2.frame", FT_BOOLEAN, 16, + TFS(&tfs_yes_no), 0x8000, NULL, HFILL }}, + + { &hf_netb_data2_user, + { "Data length exceeds user's buffer", "netbios.data2.user", FT_BOOLEAN, 16, + TFS(&tfs_yes_no), 0x4000, NULL, HFILL }}, + + { &hf_netb_data2_status, + { "Status data length", "netbios.data2.status", FT_UINT16, BASE_DEC, NULL, 0x3FFF, + NULL, HFILL }}, + { &hf_netb_fragment_overlap, { "Fragment overlap", "netbios.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment overlaps with other fragments", HFILL }}, diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 30e34d3a07..01b2c44b41 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -209,6 +209,10 @@ static int hf_nfs_fsinfo_wtmult = -1; static int hf_nfs_fsinfo_dtpref = -1; static int hf_nfs_fsinfo_maxfilesize = -1; static int hf_nfs_fsinfo_properties = -1; +static int hf_nfs_fsinfo_properties_setattr = -1; +static int hf_nfs_fsinfo_properties_pathconf = -1; +static int hf_nfs_fsinfo_properties_symlinks = -1; +static int hf_nfs_fsinfo_properties_hardlinks = -1; static int hf_nfs_pathconf_linkmax = -1; static int hf_nfs_pathconf_name_max = -1; static int hf_nfs_pathconf_no_trunc = -1; @@ -279,6 +283,19 @@ static int hf_nfs_mode3_xgrp = -1; static int hf_nfs_mode3_roth = -1; static int hf_nfs_mode3_woth = -1; static int hf_nfs_mode3_xoth = -1; +static int hf_nfs_mode_name = -1; +static int hf_nfs_mode_set_user_id = -1; +static int hf_nfs_mode_set_group_id = -1; +static int hf_nfs_mode_save_swap_text = -1; +static int hf_nfs_mode_read_owner = -1; +static int hf_nfs_mode_write_owner = -1; +static int hf_nfs_mode_exec_owner = -1; +static int hf_nfs_mode_read_group = -1; +static int hf_nfs_mode_write_group = -1; +static int hf_nfs_mode_exec_group = -1; +static int hf_nfs_mode_read_other = -1; +static int hf_nfs_mode_write_other = -1; +static int hf_nfs_mode_exec_other = -1; /* NFSv4 */ static int hf_nfs_nfsstat4 = -1; @@ -2818,34 +2835,19 @@ dissect_mode(tvbuff_t *tvb, int offset, proto_tree *tree, const char* name) "%s: 0%o", name, mode); mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode); - - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_enumerated_bitfield(mode, 0160000, 16, - nfs2_mode_names, "%s")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 04000, 16, "Set user id on exec", "not SUID")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 02000, 16, "Set group id on exec", "not SGID")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 01000, 16, "Save swapped text even after use", "not save swapped text")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 0400, 16, "Read permission for owner", "no Read permission for owner")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 0200, 16, "Write permission for owner", "no Write permission for owner")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 0100, 16, "Execute permission for owner", "no Execute permission for owner")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 040, 16, "Read permission for group", "no Read permission for group")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 020, 16, "Write permission for group", "no Write permission for group")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 010, 16, "Execute permission for group", "no Execute permission for group")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 04, 16, "Read permission for others", "no Read permission for others")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 02, 16, "Write permission for others", "no Write permission for others")); - proto_tree_add_text(mode_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mode, 01, 16, "Execute permission for others", "no Execute permission for others")); + proto_tree_add_item(mode_tree, hf_nfs_mode_name, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_set_user_id, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_set_group_id, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_save_swap_text, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_read_owner, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_write_owner, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_exec_owner, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_read_group, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_write_group, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_exec_group, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_read_other, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_write_other, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mode_tree, hf_nfs_mode_exec_other, tvb, offset, 4, ENC_BIG_ENDIAN); } offset += 4; @@ -5926,6 +5928,7 @@ dissect_nfs3_fsstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, #define FSF3_HOMOGENEOUS 0x0008 #define FSF3_CANSETTIME 0x0010 +static const true_false_string tfs_nfs_pathconf = { "is valid for all files", "should be get for every single file" }; /* RFC 1813, Page 86..90 */ static int @@ -5945,14 +5948,6 @@ dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree) { guint32 status; - guint32 rtmax; - guint32 rtpref; - guint32 rtmult; - guint32 wtmax; - guint32 wtpref; - guint32 wtmult; - guint32 dtpref; - guint32 properties; proto_item* properties_item = NULL; proto_tree* properties_tree = NULL; const char *err; @@ -5962,81 +5957,35 @@ dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, case 0: offset = dissect_nfs_post_op_attr(tvb, offset, pinfo, tree, "obj_attributes"); - rtmax = tvb_get_ntohl(tvb, offset+0); - if (tree) - proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmax, tvb, - offset+0, 4, rtmax); + proto_tree_add_item(tree, hf_nfs_fsinfo_rtmax, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - rtpref = tvb_get_ntohl(tvb, offset+0); - if (tree) - proto_tree_add_uint(tree, hf_nfs_fsinfo_rtpref, tvb, - offset+0, 4, rtpref); + proto_tree_add_item(tree, hf_nfs_fsinfo_rtpref, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - rtmult = tvb_get_ntohl(tvb, offset+0); - if (tree) - proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmult, tvb, - offset+0, 4, rtmult); + proto_tree_add_item(tree, hf_nfs_fsinfo_rtmult, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - wtmax = tvb_get_ntohl(tvb, offset+0); - if (tree) - proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmax, tvb, - offset+0, 4, wtmax); + proto_tree_add_item(tree, hf_nfs_fsinfo_wtmax, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - wtpref = tvb_get_ntohl(tvb, offset+0); - if (tree) - proto_tree_add_uint(tree, hf_nfs_fsinfo_wtpref, tvb, - offset+0, 4, wtpref); + proto_tree_add_item(tree, hf_nfs_fsinfo_wtpref, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - wtmult = tvb_get_ntohl(tvb, offset+0); - if (tree) - proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmult, tvb, - offset+0, 4, wtmult); + proto_tree_add_item(tree, hf_nfs_fsinfo_wtmult, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - dtpref = tvb_get_ntohl(tvb, offset+0); - if (tree) - proto_tree_add_uint(tree, hf_nfs_fsinfo_dtpref, tvb, - offset+0, 4, dtpref); + proto_tree_add_item(tree, hf_nfs_fsinfo_dtpref, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsinfo_maxfilesize, offset); offset = dissect_nfstime3(tvb, offset, tree, hf_nfs_dtime, hf_nfs_dtime_sec, hf_nfs_dtime_nsec); - properties = tvb_get_ntohl(tvb, offset+0); if (tree) { - properties_item = proto_tree_add_uint(tree, - hf_nfs_fsinfo_properties, - tvb, offset+0, 4, properties); + properties_item = proto_tree_add_item(tree, hf_nfs_fsinfo_properties, + tvb, offset, 4, ENC_BIG_ENDIAN); properties_tree = proto_item_add_subtree(properties_item, ett_nfs_fsinfo_properties); - proto_tree_add_text(properties_tree, tvb, - offset, 4, "%s", - decode_boolean_bitfield(properties, - FSF3_CANSETTIME,5, - "SETATTR can set time on server", - "SETATTR can't set time on server")); - - proto_tree_add_text(properties_tree, tvb, - offset, 4, "%s", - decode_boolean_bitfield(properties, - FSF3_HOMOGENEOUS,5, - "PATHCONF is valid for all files", - "PATHCONF should be get for every single file")); - - proto_tree_add_text(properties_tree, tvb, - offset, 4, "%s", - decode_boolean_bitfield(properties, - FSF3_SYMLINK,5, - "File System supports symbolic links", - "File System does not symbolic hard links")); - - proto_tree_add_text(properties_tree, tvb, - offset, 4, "%s", - decode_boolean_bitfield(properties, - FSF3_LINK,5, - "File System supports hard links", - "File System does not support hard links")); + proto_tree_add_item(tree, hf_nfs_fsinfo_properties_setattr, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_nfs_fsinfo_properties_pathconf, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_nfs_fsinfo_properties_symlinks, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_nfs_fsinfo_properties_hardlinks, tvb, offset, 4, ENC_BIG_ENDIAN); } offset += 4; @@ -10998,6 +10947,18 @@ proto_register_nfs(void) { &hf_nfs_fsinfo_properties, { "Properties", "nfs.fsinfo.properties", FT_UINT32, BASE_HEX, NULL, 0, "File System Properties", HFILL }}, + { &hf_nfs_fsinfo_properties_setattr, { + "SETATTR can set time on server", "nfs.fsinfo.properties.setattr", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), FSF3_CANSETTIME, NULL, HFILL }}, + { &hf_nfs_fsinfo_properties_pathconf, { + "PATHCONF", "nfs.fsinfo.properties.pathconf", FT_BOOLEAN, 32, + TFS(&tfs_nfs_pathconf), FSF3_HOMOGENEOUS, NULL, HFILL }}, + { &hf_nfs_fsinfo_properties_symlinks, { + "File System supports symbolic links", "nfs.fsinfo.properties.symlinks", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), FSF3_SYMLINK, NULL, HFILL }}, + { &hf_nfs_fsinfo_properties_hardlinks, { + "File System supports hard links", "nfs.fsinfo.properties.hardlinks", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), FSF3_LINK, NULL, HFILL }}, { &hf_nfs_pathconf_linkmax, { "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC, NULL, 0, "Maximum number of hard links", HFILL }}, @@ -12249,6 +12210,58 @@ proto_register_nfs(void) "S_IXOTH", "nfs.mode3.xoth", FT_BOOLEAN, 32, TFS(&tfs_yes_no), 0x001, NULL, HFILL }}, + { &hf_nfs_mode_name, { + "Name", "nfs.mode.name", FT_UINT32, BASE_DEC, + VALS(nfs2_mode_names), 0160000, NULL, HFILL }}, + + { &hf_nfs_mode_set_user_id, { + "Set user id on exec", "nfs.mode.set_user_id", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 04000, NULL, HFILL }}, + + { &hf_nfs_mode_set_group_id, { + "Set group id on exec", "nfs.mode.set_group_id", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 02000, NULL, HFILL }}, + + { &hf_nfs_mode_save_swap_text, { + "Save swapped text even after use", "nfs.mode.save_swap_text", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 01000, NULL, HFILL }}, + + { &hf_nfs_mode_read_owner, { + "Read permission for owner", "nfs.mode.read_owner", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0400, NULL, HFILL }}, + + { &hf_nfs_mode_write_owner, { + "Read permission for owner", "nfs.mode.write_owner", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0200, NULL, HFILL }}, + + { &hf_nfs_mode_exec_owner, { + "Read permission for owner", "nfs.mode.exec_owner", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0100, NULL, HFILL }}, + + { &hf_nfs_mode_read_group, { + "Read permission for group", "nfs.mode.read_group", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 040, NULL, HFILL }}, + + { &hf_nfs_mode_write_group, { + "Read permission for group", "nfs.mode.write_group", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 020, NULL, HFILL }}, + + { &hf_nfs_mode_exec_group, { + "Read permission for group", "nfs.mode.exec_group", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 010, NULL, HFILL }}, + + { &hf_nfs_mode_read_other, { + "Read permission for others", "nfs.mode.read_other", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 04, NULL, HFILL }}, + + { &hf_nfs_mode_write_other, { + "Read permission for others", "nfs.mode.write_other", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 02, NULL, HFILL }}, + + { &hf_nfs_mode_exec_other, { + "Read permission for others", "nfs.mode.exec_other", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 01, NULL, HFILL }}, + { &hf_nfs_op_mask, { "op_mask", "nfs.op_mask", FT_UINT32, BASE_DEC, VALS(names_nfsv4_operation), 0, "Operation Mask", HFILL }}, diff --git a/epan/dissectors/packet-nfsacl.c b/epan/dissectors/packet-nfsacl.c index 5ca0921070..7be20fbe5b 100644 --- a/epan/dissectors/packet-nfsacl.c +++ b/epan/dissectors/packet-nfsacl.c @@ -31,6 +31,11 @@ #include "packet-nfs.h" static int proto_nfsacl = -1; +static int hf_nfsacl_mask = -1; +static int hf_nfsacl_mask_acl_entry = -1; +static int hf_nfsacl_mask_acl_count = -1; +static int hf_nfsacl_mask_default_acl_entry = -1; +static int hf_nfsacl_mask_default_acl_count = -1; static int hf_nfsacl_procedure_v1 = -1; static int hf_nfsacl_procedure_v2 = -1; static int hf_nfsacl_procedure_v3 = -1; @@ -41,6 +46,9 @@ static int hf_nfsacl_aclent = -1; static int hf_nfsacl_aclent_type = -1; static int hf_nfsacl_aclent_uid = -1; static int hf_nfsacl_aclent_perm = -1; +static int hf_nfsacl_aclent_perm_read = -1; +static int hf_nfsacl_aclent_perm_write = -1; +static int hf_nfsacl_aclent_perm_exec = -1; static int hf_nfsacl_create = -1; static gint ett_nfsacl = -1; @@ -68,38 +76,20 @@ static gint ett_nfsacl_aclent_entries = -1; #define ACL3_OK 0 static int -dissect_nfsacl_mask(tvbuff_t *tvb, int offset, proto_tree *tree, - const char *name) +dissect_nfsacl_mask(tvbuff_t *tvb, int offset, proto_tree *tree) { - guint32 mask; - proto_item *mask_item = NULL; - proto_tree *mask_tree = NULL; - - mask = tvb_get_ntohl(tvb, offset + 0); + proto_item *mask_item; + proto_tree *mask_tree; if (tree) { - mask_item = proto_tree_add_text(tree, tvb, offset, 4, "%s: 0x%02x", - name, mask); - - if (mask_item) - mask_tree = proto_item_add_subtree(mask_item, ett_nfsacl_mask); - } + mask_item = proto_tree_add_item(tree, hf_nfsacl_mask, tvb, offset, 4, ENC_BIG_ENDIAN); + mask_tree = proto_item_add_subtree(mask_item, ett_nfsacl_mask); - if (mask_tree) - { - proto_tree_add_text(mask_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mask, 0x01, 8, "ACL entry", - "(no ACL entry)")); - proto_tree_add_text(mask_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mask, 0x02, 8, "ACL count", - "(no ACL count)")); - proto_tree_add_text(mask_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mask, 0x04, 8, "default ACL entry", - "(no default ACL entry)")); - proto_tree_add_text(mask_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(mask, 0x08, 8, "default ACL count", - "(no default ACL count)")); + proto_tree_add_item(mask_tree, hf_nfsacl_mask_acl_entry, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mask_tree, hf_nfsacl_mask_acl_count, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mask_tree, hf_nfsacl_mask_default_acl_entry, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mask_tree, hf_nfsacl_mask_default_acl_count, tvb, offset, 4, ENC_BIG_ENDIAN); } offset += 4; @@ -140,7 +130,6 @@ dissect_nfsacl_aclent(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { proto_item *entry_item = NULL; proto_tree *entry_tree = NULL; - guint32 perm; proto_item *perm_item = NULL; proto_tree *perm_tree = NULL; @@ -154,26 +143,12 @@ dissect_nfsacl_aclent(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, offset = dissect_rpc_uint32(tvb, entry_tree, hf_nfsacl_aclent_type, offset); offset = dissect_rpc_uint32(tvb, entry_tree, hf_nfsacl_aclent_uid, offset); - perm = tvb_get_ntohl(tvb, offset); - - perm_item = proto_tree_add_uint(entry_tree, hf_nfsacl_aclent_perm, - tvb, offset, 4, perm); - - if (perm_item) - perm_tree = proto_item_add_subtree(perm_item, ett_nfsacl_aclent_perm); - - if (perm_tree) - { - proto_tree_add_text(perm_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(perm, NA_READ, 4, "READ", "no READ")); - - proto_tree_add_text(perm_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(perm, NA_WRITE, 4, "WRITE", "no WRITE")); - - proto_tree_add_text(perm_tree, tvb, offset, 4, "%s", - decode_boolean_bitfield(perm, NA_EXEC, 4, "EXEC", "no EXEC")); - } - + perm_item = proto_tree_add_item(entry_tree, hf_nfsacl_aclent_perm, + tvb, offset, 4, ENC_BIG_ENDIAN); + perm_tree = proto_item_add_subtree(perm_item, ett_nfsacl_aclent_perm); + proto_tree_add_item(perm_tree, hf_nfsacl_aclent_perm_read, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(perm_tree, hf_nfsacl_aclent_perm_write, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(perm_tree, hf_nfsacl_aclent_perm_exec, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; return offset; @@ -189,7 +164,7 @@ dissect_nfsacl_secattr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_item *entry_item = NULL; proto_tree *entry_tree = NULL; - offset = dissect_nfsacl_mask(tvb, offset, tree, "mask"); + offset = dissect_nfsacl_mask(tvb, offset, tree); offset = dissect_rpc_uint32(tvb, tree, hf_nfsacl_aclcnt, offset); aclcnt = tvb_get_ntohl(tvb, offset); @@ -250,7 +225,7 @@ dissect_nfsacl2_getacl_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { offset = dissect_fhandle(tvb, offset, pinfo, tree, "fhandle", NULL); - offset = dissect_nfsacl_mask(tvb, offset, tree, "mask"); + offset = dissect_nfsacl_mask(tvb, offset, tree); return offset; } @@ -424,7 +399,7 @@ dissect_nfsacl3_getacl_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "fhandle", NULL); - offset = dissect_nfsacl_mask(tvb, offset, tree, "mask"); + offset = dissect_nfsacl_mask(tvb, offset, tree); return offset; } @@ -564,6 +539,21 @@ void proto_register_nfsacl(void) { static hf_register_info hf[] = { + { &hf_nfsacl_mask, { + "Mask", "nfsacl.mask", FT_UINT32, BASE_HEX, + NULL, 0, NULL, HFILL }}, + { &hf_nfsacl_mask_acl_entry, { + "ACL entry", "nfsacl.mask.acl_entry", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x01, NULL, HFILL }}, + { &hf_nfsacl_mask_acl_count, { + "ACL count", "nfsacl.mask.acl_count", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x02, NULL, HFILL }}, + { &hf_nfsacl_mask_default_acl_entry, { + "Default ACL entry", "nfsacl.mask.default_acl_entry", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x04, NULL, HFILL }}, + { &hf_nfsacl_mask_default_acl_count, { + "Default ACL count", "nfsacl.mask.default_acl_count", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), 0x08, NULL, HFILL }}, { &hf_nfsacl_procedure_v1, { "V1 Procedure", "nfsacl.procedure_v1", FT_UINT32, BASE_DEC, VALS(nfsacl1_proc_vals), 0, NULL, HFILL }}, @@ -595,6 +585,15 @@ proto_register_nfsacl(void) { &hf_nfsacl_aclent_perm, { "Permissions", "nfsacl.aclent.perm", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, + { &hf_nfsacl_aclent_perm_read, { + "READ", "nfsacl.aclent.perm.read", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), NA_READ, NULL, HFILL }}, + { &hf_nfsacl_aclent_perm_write, { + "WRITE", "nfsacl.aclent.perm.write", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), NA_WRITE, NULL, HFILL }}, + { &hf_nfsacl_aclent_perm_exec, { + "EXEC", "nfsacl.aclent.perm.exec", FT_BOOLEAN, 32, + TFS(&tfs_yes_no), NA_EXEC, NULL, HFILL }}, /* V2 */ { &hf_nfsacl_create, { "create", "nfsacl.create", FT_BOOLEAN, BASE_NONE, diff --git a/epan/dissectors/packet-rtcp.c b/epan/dissectors/packet-rtcp.c index e379096918..e142cee4fd 100644 --- a/epan/dissectors/packet-rtcp.c +++ b/epan/dissectors/packet-rtcp.c @@ -808,7 +808,6 @@ static int dissect_rtcp_rtpfb_nack( tvbuff_t *tvb, int offset, proto_tree *rtcp_tree, proto_item *top_item) { int i; - char strbuf[64]; int nack_num_frames_lost; proto_tree *bitfield_tree; unsigned int rtcp_rtpfb_nack_pid; @@ -827,17 +826,18 @@ dissect_rtcp_rtpfb_nack( tvbuff_t *tvb, int offset, proto_tree *rtcp_tree, proto nack_num_frames_lost = 1; if (rtcp_rtpfb_nack_blp) { for (i = 0; i < 16; i ++) { - g_snprintf(strbuf, 64, "Frame %d also lost", rtcp_rtpfb_nack_pid + i + 1); - proto_tree_add_text(bitfield_tree, tvb, offset, 2, "%s", - decode_boolean_bitfield(rtcp_rtpfb_nack_blp, (1<