diff options
author | Michael Mann <mmann78@netscape.net> | 2014-11-23 23:06:34 -0500 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-11-25 02:51:03 +0000 |
commit | e899c3e262594813fa765e44ad143d7f14d6d415 (patch) | |
tree | d29b23b24d3fd27c3ff72dfbfb6bbffa420de66a /epan/dissectors | |
parent | 4f8a6ec8669fe0b9b2ac642ab99cc853498e4721 (diff) |
Eliminate proto_tree_add_text from some dissectors.
Change-Id: Iadd80aab291e5de714891a9f3c79edeca19e9b93
Reviewed-on: https://code.wireshark.org/review/5458
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-dcerpc-epm.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-dcerpc-nt.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-dhcpv6.c | 56 | ||||
-rw-r--r-- | epan/dissectors/packet-trmac.c | 50 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_mac.c | 124 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-video.c | 60 | ||||
-rw-r--r-- | epan/dissectors/packet-vcdu.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-windows-common.c | 262 | ||||
-rw-r--r-- | epan/dissectors/packet-x29.c | 74 | ||||
-rw-r--r-- | epan/dissectors/packet-xmpp-utils.c | 2 |
10 files changed, 406 insertions, 287 deletions
diff --git a/epan/dissectors/packet-dcerpc-epm.c b/epan/dissectors/packet-dcerpc-epm.c index eafed8d94d..e9c3ecb981 100644 --- a/epan/dissectors/packet-dcerpc-epm.c +++ b/epan/dissectors/packet-dcerpc-epm.c @@ -47,6 +47,7 @@ static int hf_epm_hnd = -1; static int hf_epm_max_ents = -1; static int hf_epm_num_ents = -1; static int hf_epm_uuid = -1; +static int hf_epm_uuid_version = -1; static int hf_epm_tower_length = -1; /* static int hf_epm_tower_data = -1; */ static int hf_epm_max_towers = -1; @@ -367,7 +368,7 @@ epm_dissect_tower_data (tvbuff_t *tvb, int offset, uuid.Data4[4], uuid.Data4[5], uuid.Data4[6], uuid.Data4[7]); } - proto_tree_add_text(tr, tvb, offset+17, 2, "Version %d.%d", tvb_get_guint8(tvb, offset+17), tvb_get_guint8(tvb, offset+18)); + proto_tree_add_item(tr, hf_epm_uuid_version, tvb, offset+17, 2, ENC_BIG_ENDIAN); /* Major/minor bytes treated as big endian */ { guint16 version = tvb_get_ntohs(tvb, offset+17); @@ -457,6 +458,12 @@ epm_dissect_tower_data (tvbuff_t *tvb, int offset, return offset; } +static void +epm_fmt_uuid_version( gchar *result, guint32 revision ) +{ + g_snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", (guint8)(( revision & 0xFF00 ) >> 8), (guint8)(revision & 0xFF) ); +} + /* typedef struct { unsigned int tower_len, [size_is(tower_len)] char tower[]; @@ -706,6 +713,8 @@ proto_register_epm (void) { "Num entries", "epm.num_ents", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_epm_uuid, { "UUID", "epm.uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_epm_uuid_version, + { "Version", "epm.uuid_version", FT_UINT16, BASE_CUSTOM, epm_fmt_uuid_version, 0x0, NULL, HFILL }}, { &hf_epm_annotation, { "Annotation", "epm.annotation", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_epm_proto_named_pipes, diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c index d66612a96f..2502d5e860 100644 --- a/epan/dissectors/packet-dcerpc-nt.c +++ b/epan/dissectors/packet-dcerpc-nt.c @@ -44,6 +44,7 @@ int hf_nt_cs_size = -1; static int hf_lsa_String_name_len = -1; static int hf_lsa_String_name_size = -1; static int hf_nt_data_blob_len = -1; +static int hf_nt_data_blob_data = -1; static int hf_nt_midl_blob_len = -1; static int hf_nt_midl_fill_bytes = -1; static int hf_nt_midl_version = -1; @@ -98,7 +99,7 @@ dissect_ndr_datablob(tvbuff_t *tvb, int offset, packet_info *pinfo, offset = dissect_ndr_uint3264(tvb, offset, pinfo, subtree, di, drep, hf_nt_data_blob_len, &len); } - proto_tree_add_text(subtree, tvb, offset, (int)len, "Blob data"); + proto_tree_add_item(subtree, hf_nt_data_blob_data, tvb, offset, (int)len, ENC_NA); offset += (int)len; return offset; } @@ -1989,6 +1990,10 @@ void dcerpc_smb_init(int proto_dcerpc) { "Blob size", "dcerpc.nt.blob.size", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, + { &hf_nt_data_blob_data, + { "Blob data", "dcerpc.nt.blob.data", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, + { &hf_nt_midl_blob_len, { "Blob Length", "nt.midl_blob_len", FT_UINT64, BASE_DEC, NULL, 0, "Length of NDR encoded data that follows", HFILL }}, diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index aa17909478..282d94643c 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -188,6 +188,7 @@ static int hf_capabilities_encoding_length = -1; static int hf_capabilities_encoding_bytes = -1; static int hf_capabilities_encoding_number = -1; static int hf_cablelabs_ipv6_server = -1; +static int hf_cablelabs_docsis_version_number = -1; static gint ett_dhcpv6 = -1; static gint ett_dhcpv6_option = -1; @@ -196,6 +197,11 @@ static gint ett_dhcpv6_vendor_option = -1; static gint ett_dhcpv6_pkt_option = -1; static gint ett_dhcpv6_netserver_option = -1; static gint ett_dhcpv6_tlv5_type = -1; +static gint ett_dhcpv6_sip_server_domain_search_list_option = -1; +static gint ett_dhcpv6_dns_domain_search_list_option = -1; +static gint ett_dhcpv6_nis_domain_name_option = -1; +static gint ett_dhcpv6_nisp_domain_name_option = -1; +static gint ett_dhcpv6_bcmcs_servers_domain_search_list_option = -1; static expert_field ei_dhcpv6_bogus_length = EI_INIT; static expert_field ei_dhcpv6_malformed_option = EI_INIT; @@ -1188,15 +1194,9 @@ dissect_cablelabs_specific_opts(proto_tree *v_tree, proto_item *v_item, packet_i tagLen = tvb_get_guint8(tvb, sub_off); sub_off++; if ((tag == CL_OPTION_DOCS_CMTS_TLV_VERS_NUM) && (tagLen == 2)) { - int major = 0; - int minor = 0; - major = tvb_get_guint8(tvb, sub_off); - sub_off++; - minor = tvb_get_guint8(tvb, sub_off); - sub_off++; - proto_tree_add_text(subtree, tvb, sub_off-2, - 2, "DOCSIS Version Number %d.%d", - major, minor); + proto_tree_add_item(subtree, hf_cablelabs_docsis_version_number, tvb, sub_off, + 2, ENC_BIG_ENDIAN); + sub_off += 2; } else sub_off += tagLen; @@ -1205,7 +1205,7 @@ dissect_cablelabs_specific_opts(proto_tree *v_tree, proto_item *v_item, packet_i } } else - proto_tree_add_text(subtree, tvb, sub_off, 0, "empty"); + proto_item_append_text(ti, " (empty)"); break; case CL_CM_MAC_ADDR: opt_len = tlv_len; @@ -1270,6 +1270,13 @@ dissect_cablelabs_specific_opts(proto_tree *v_tree, proto_item *v_item, packet_i } } +static void +cablelabs_fmt_docsis_version( gchar *result, guint32 revision ) +{ + g_snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", (guint8)(( revision & 0xFF00 ) >> 8), (guint8)(revision & 0xFF) ); +} + + /* Returns the number of bytes consumed by this option. */ static int dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, @@ -1614,8 +1621,8 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, break; case OPTION_SIP_SERVER_D: if (optlen > 0) { - ti = proto_tree_add_text(subtree, tvb, off, optlen, "SIP Servers Domain Search List"); - dhcpv6_domain(subtree, ti, pinfo, hf_sip_server_domain_search_fqdn, tvb, off, optlen); + subtree_2 = proto_tree_add_subtree(subtree, tvb, off, optlen, ett_dhcpv6_sip_server_domain_search_list_option, &ti, "SIP Servers Domain Search List"); + dhcpv6_domain(subtree_2, ti, pinfo, hf_sip_server_domain_search_fqdn, tvb, off, optlen); } break; case OPTION_SIP_SERVER_A: @@ -1641,8 +1648,8 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, case OPTION_DOMAIN_LIST: if (optlen > 0) { - ti = proto_tree_add_text(subtree, tvb, off, optlen, "DNS Domain Search List"); - dhcpv6_domain(subtree, ti, pinfo, hf_domain_search_list_fqdn, tvb, off, optlen); + subtree_2 = proto_tree_add_subtree(subtree, tvb, off, optlen, ett_dhcpv6_dns_domain_search_list_option, &ti, "DNS Domain Search List"); + dhcpv6_domain(subtree_2, ti, pinfo, hf_domain_search_list_fqdn, tvb, off, optlen); } break; @@ -1665,14 +1672,14 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, break; case OPTION_NIS_DOMAIN_NAME: if (optlen > 0) { - ti = proto_tree_add_text(subtree, tvb, off, optlen, "nis-domain-name"); - dhcpv6_domain(subtree, ti, pinfo, hf_nis_fqdn, tvb, off, optlen); + subtree_2 = proto_tree_add_subtree(subtree, tvb, off, optlen, ett_dhcpv6_nis_domain_name_option, &ti, "nis-domain-name"); + dhcpv6_domain(subtree_2, ti, pinfo, hf_nis_fqdn, tvb, off, optlen); } break; case OPTION_NISP_DOMAIN_NAME: if (optlen > 0) { - ti = proto_tree_add_text(subtree, tvb, off, optlen, "nisp-domain-name"); - dhcpv6_domain(subtree, ti, pinfo, hf_nisp_fqdn, tvb, off, optlen); + subtree_2 = proto_tree_add_subtree(subtree, tvb, off, optlen, ett_dhcpv6_nisp_domain_name_option, &ti, "nisp-domain-name"); + dhcpv6_domain(subtree_2, ti, pinfo, hf_nisp_fqdn, tvb, off, optlen); } break; @@ -1697,8 +1704,8 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, /* BCMCS...: RFC 4280 */ case OPTION_BCMCS_SERVER_D: if (optlen > 0) { - ti = proto_tree_add_text(subtree, tvb, off, optlen, "BCMCS Servers Domain Search List"); - dhcpv6_domain(subtree, ti, pinfo, hf_bcmcs_servers_fqdn, tvb, off, optlen); + subtree_2 = proto_tree_add_subtree(subtree, tvb, off, optlen, ett_dhcpv6_bcmcs_servers_domain_search_list_option, &ti, "BCMCS Servers Domain Search List"); + dhcpv6_domain(subtree_2, ti, pinfo, hf_bcmcs_servers_fqdn, tvb, off, optlen); } break; case OPTION_BCMCS_SERVER_A: @@ -2303,6 +2310,8 @@ proto_register_dhcpv6(void) { "Suboption", "dhcpv6.cablelabs.opt", FT_UINT16, BASE_DEC | BASE_EXT_STRING, &cl_vendor_subopt_values_ext, 0, NULL, HFILL }}, { &hf_cablelabs_ipv6_server, { "IPv6 address", "dhcpv6.cablelabs.ipv6_server", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}}, + { &hf_cablelabs_docsis_version_number, + { "DOCSIS Version Number", "dhcpv6.cablelabs.docsis_version_number", FT_UINT16, BASE_CUSTOM, cablelabs_fmt_docsis_version, 0x0, NULL, HFILL}}, }; static gint *ett[] = { @@ -2312,7 +2321,12 @@ proto_register_dhcpv6(void) &ett_dhcpv6_vendor_option, &ett_dhcpv6_pkt_option, &ett_dhcpv6_netserver_option, - &ett_dhcpv6_tlv5_type + &ett_dhcpv6_tlv5_type, + &ett_dhcpv6_sip_server_domain_search_list_option, + &ett_dhcpv6_dns_domain_search_list_option, + &ett_dhcpv6_nis_domain_name_option, + &ett_dhcpv6_nisp_domain_name_option, + &ett_dhcpv6_bcmcs_servers_domain_search_list_option, }; static ei_register_info ei[] = { diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c index 92063f6578..df29d28572 100644 --- a/epan/dissectors/packet-trmac.c +++ b/epan/dissectors/packet-trmac.c @@ -67,6 +67,15 @@ static int hf_trmac_physical_drop_number = -1; static int hf_trmac_authorized_function_classes = -1; static int hf_trmac_local_ring_number = -1; static int hf_trmac_functional_addresses = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_trmac_unknown_subvector = -1; +static int hf_trmac_response_code48 = -1; +static int hf_trmac_product_instance_id = -1; +static int hf_trmac_ring_station_version_number = -1; +static int hf_trmac_wrap_data = -1; +static int hf_trmac_ring_station_status = -1; +static int hf_trmac_frame_forward = -1; +static int hf_trmac_response_code32 = -1; static gint ett_tr_mac = -1; static gint ett_tr_sv = -1; @@ -307,19 +316,17 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) break; } if (sv_length == 4) { - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Response Code: 0x%04X 0x%02X 0x%02x", - tvb_get_ntohs(tvb, svoff+2), - tvb_get_guint8(tvb, svoff+4), - tvb_get_guint8(tvb, svoff+5)); + proto_tree_add_uint_format_value(sv_tree, hf_trmac_response_code32, tvb, svoff+2, sv_length-2, + tvb_get_ntohl(tvb, svoff+2), "0x%04X 0x%02X 0x%02x", + tvb_get_ntohs(tvb, svoff+2), tvb_get_guint8(tvb, svoff+4), tvb_get_guint8(tvb, svoff+5)); proto_item_append_text(sv_item, ": 0x%04X 0x%02X 0x%02x", tvb_get_ntohs(tvb, svoff+2), tvb_get_guint8(tvb, svoff+4), tvb_get_guint8(tvb, svoff+5)); } else { - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Response Code: 0x%04X 0x%02X 0x%06X", + proto_tree_add_uint64_format_value(sv_tree, hf_trmac_response_code48, tvb, svoff+2, sv_length-2, + tvb_get_ntoh48(tvb, svoff+2), "0x%04X 0x%02X 0x%06X", tvb_get_ntohs(tvb, svoff+2), tvb_get_guint8(tvb, svoff+4), tvb_get_ntoh24(tvb, svoff+5)); @@ -343,23 +350,19 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) break; case 0x22: /* Product Instance ID */ - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Product Instance ID: ..."); + proto_tree_add_item(sv_tree, hf_trmac_product_instance_id, tvb, svoff+2, sv_length-2, ENC_NA); break; case 0x23: /* Ring Station Version Number */ - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Ring Station Version Number: ..."); + proto_tree_add_item(sv_tree, hf_trmac_ring_station_version_number, tvb, svoff+2, sv_length-2, ENC_NA); break; case 0x26: /* Wrap data */ - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Wrap Data: ... (%u bytes)", sv_length - 2); + proto_tree_add_item(sv_tree, hf_trmac_wrap_data, tvb, svoff+2, sv_length-2, ENC_NA); break; case 0x27: /* Frame Forward */ - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Frame Forward: ... (%d bytes)", sv_length - 2); + proto_tree_add_item(sv_tree, hf_trmac_frame_forward, tvb, svoff+2, sv_length-2, ENC_NA); break; case 0x28: /* Station Identifier */ @@ -375,8 +378,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) break; case 0x29: /* Ring Station Status */ - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Ring Station Status: ..."); + proto_tree_add_item(sv_tree, hf_trmac_ring_station_status, tvb, svoff+2, sv_length-2, ENC_NA); break; case 0x2A: /* Transmit Status Code */ @@ -468,8 +470,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) break; default: /* Unknown */ - proto_tree_add_text(sv_tree, tvb, svoff+2, sv_length-2, - "Unknown Subvector"); + proto_tree_add_item(sv_tree, hf_trmac_unknown_subvector, tvb, svoff+2, sv_length-2, ENC_NA); break; } return sv_length; @@ -661,6 +662,17 @@ proto_register_trmac(void) { &hf_trmac_error_code, { "Error Code", "trmac.error_code", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_trmac_response_code32, { "Response Code", "trmac.response_code", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_trmac_response_code48, { "Response Code", "trmac.response_code", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_trmac_product_instance_id, { "Product Instance ID", "trmac.product_instance_id", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_trmac_ring_station_version_number, { "Ring Station Version Number", "trmac.ring_station_version_number", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_trmac_wrap_data, { "Wrap Data", "trmac.wrap_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_trmac_frame_forward, { "Frame Forward", "trmac.frame_forward", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_trmac_ring_station_status, { "Ring Station Status", "trmac.ring_station_status", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_trmac_unknown_subvector, { "Unknown Subvector", "trmac.unknown_subvector", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + }; static gint *ett[] = { &ett_tr_mac, diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index b908a7f07e..5a47a393a8 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -65,6 +65,7 @@ static int hf_mac_trch_id = -1; /* static int hf_mac_edch_type2_flag = -1; */ static int hf_mac_edch_type2_tsn = -1; static int hf_mac_edch_type2_ss = -1; +static int hf_mac_edch_type2_ss_interpretation = -1; static int hf_mac_edch_type2_sdu = -1; static int hf_mac_edch_type2_sdu_data = -1; static int hf_mac_is_fraglink = -1; @@ -86,6 +87,14 @@ static expert_field ei_mac_rach_tctf_unknown = EI_INIT; static expert_field ei_mac_unknown_content = EI_INIT; static expert_field ei_mac_per_frame_info_missing = EI_INIT; static expert_field ei_mac_fach_content_type_unknown = EI_INIT; +static expert_field ei_mac_no_logical_channel = EI_INIT; +static expert_field ei_mac_faked_logical_channel_id = EI_INIT; +static expert_field ei_mac_macis_sdu_reassembled = EI_INIT; +static expert_field ei_mac_macis_sdu_first = EI_INIT; +static expert_field ei_mac_macis_sdu_middle = EI_INIT; +static expert_field ei_mac_macis_sdu_last = EI_INIT; +static expert_field ei_mac_macis_sdu_complete = EI_INIT; + static dissector_handle_t rlc_pcch_handle; static dissector_handle_t rlc_ccch_handle; @@ -535,17 +544,15 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_item_append_text(ti, " (DCCH)"); /*Show logical channel id*/ + channel_type = proto_tree_add_uint(dch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); + PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->lchid[pos]!= 255){ - channel_type = proto_tree_add_uint(dch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); - PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->fake_chid[pos]){ - channel_type = proto_tree_add_text(dch_tree, tvb,0, 0, "This is a faked logical channel id!"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_faked_logical_channel_id); } }else{ - channel_type = proto_tree_add_text(dch_tree, tvb,0, 0, "Frame is missing logical channel"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_no_logical_channel); } channel_type = proto_tree_add_uint(dch_tree, hf_mac_channel, tvb, 0, 0, MAC_DCCH); @@ -559,12 +566,11 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t case MAC_CONTENT_PS_DTCH: proto_item_append_text(ti, " (PS DTCH)"); /*Show logical channel id*/ - if(macinf->lchid[pos]!= 255){ - channel_type = proto_tree_add_uint(dch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); - PROTO_ITEM_SET_GENERATED(channel_type); - }else{ - channel_type = proto_tree_add_text(dch_tree, tvb,0, 0, "Frame is missing logical channel"); - PROTO_ITEM_SET_GENERATED(channel_type); + channel_type = proto_tree_add_uint(dch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); + PROTO_ITEM_SET_GENERATED(channel_type); + + if(macinf->lchid[pos]== 255){ + expert_add_info(pinfo, channel_type, &ei_mac_no_logical_channel); } channel_type = proto_tree_add_uint(dch_tree, hf_mac_channel, tvb, 0, 0, MAC_DTCH); @@ -574,16 +580,14 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t case MAC_CONTENT_CS_DTCH: proto_item_append_text(ti, " (CS DTCH)"); /*Show logical channel id*/ + channel_type = proto_tree_add_uint(dch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); + PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->lchid[pos]!= 255){ - channel_type = proto_tree_add_uint(dch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); - PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->fake_chid[pos]){ - channel_type = proto_tree_add_text(dch_tree, tvb,0, 0, "This is a faked logical channel id!"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_faked_logical_channel_id); } }else{ - channel_type = proto_tree_add_text(dch_tree, tvb,0, 0, "Frame is missing logical channel"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_no_logical_channel); } channel_type = proto_tree_add_uint(dch_tree, hf_mac_channel, tvb, 0, 0, MAC_DTCH); @@ -714,7 +718,7 @@ static tvbuff_t * add_to_tree(tvbuff_t * tvb, packet_info * pinfo, proto_tree * guint counter = 0; new_tvb = tvb_new_child_real_data(tvb, sdu->data, sdu->length, sdu->length); add_new_data_source(pinfo, new_tvb, "Reassembled MAC-is SDU"); - proto_tree_add_text(tree, new_tvb, 0, -1, "[Reassembled MAC-is SDU]"); + proto_tree_add_expert(tree, pinfo, &ei_mac_macis_sdu_reassembled, new_tvb, 0, -1); while (f) { proto_tree_add_uint_format_value(tree, hf_mac_is_fraglink, new_tvb, @@ -730,13 +734,13 @@ static tvbuff_t * add_to_tree(tvbuff_t * tvb, packet_info * pinfo, proto_tree * new_tvb = tvb_new_subset(tvb, offset, maclength, -1); switch (type) { case MAC_IS_HEAD: - proto_tree_add_text(tree, new_tvb, 0, -1, "[This MAC-is SDU is the first segment of a MAC-d PDU or MAC-c PDU.]"); + proto_tree_add_expert(tree, pinfo, &ei_mac_macis_sdu_first, new_tvb, 0, -1); break; case MAC_IS_MIDDLE: - proto_tree_add_text(tree, new_tvb, 0, -1, "[This MAC-is SDU is a middle segment of a MAC-d PDU or MAC-c PDU.]"); + proto_tree_add_expert(tree, pinfo, &ei_mac_macis_sdu_middle, new_tvb, 0, -1); break; case MAC_IS_TAIL: - proto_tree_add_text(tree, new_tvb, 0, -1, "[This MAC-is SDU is the last segment of a MAC-d PDU or MAC-c PDU.]"); + proto_tree_add_expert(tree, pinfo, &ei_mac_macis_sdu_last, new_tvb, 0, -1); break; } proto_tree_add_uint(tree, hf_mac_is_reasmin, new_tvb, 0, 0, sdu->frame_num); @@ -843,7 +847,7 @@ static tvbuff_t * mac_is_add_fragment(tvbuff_t * tvb _U_, packet_info *pinfo, pr return tvb_new_subset(tvb, offset, maclength, -1); } /* If clicking on a packet. */ - } else if (tree) { + } else { tvbuff_t * new_tvb = NULL; /* Middle segment */ if (no_sdus == 1 && ss == 3) { @@ -867,7 +871,7 @@ static tvbuff_t * mac_is_add_fragment(tvbuff_t * tvb _U_, packet_info *pinfo, pr } } else { new_tvb = tvb_new_subset(tvb, offset, maclength, -1); - proto_tree_add_text(tree, new_tvb, 0, -1, "[This MAC-is SDU is a complete MAC-d PDU or MAC-c PDU]"); + proto_tree_add_expert(tree, pinfo, &ei_mac_macis_sdu_complete, new_tvb, 0, -1); proto_tree_add_item(tree, hf_mac_edch_type2_sdu_data, new_tvb, 0, -1, ENC_NA); return new_tvb; } @@ -880,30 +884,38 @@ static void ss_interpretation(tvbuff_t * tvb, proto_tree * tree, guint8 ss, guin switch (ss) { case 0: if (number_of_mac_is_sdus > 1) { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The first MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU. The last MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The first MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU. The last MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU."); } else { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU."); } break; case 1: if (number_of_mac_is_sdus > 1) { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The last MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU. The first MAC-is SDU of the MAC-is PDU is the last segment of a MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The last MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU. The first MAC-is SDU of the MAC-is PDU is the last segment of a MAC-d PDU or MAC-c PDU."); } else { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The MAC-is SDU of the MAC-is PDU is the last segment of a MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The MAC-is SDU of the MAC-is PDU is the last segment of a MAC-d PDU or MAC-c PDU."); } break; case 2: if (number_of_mac_is_sdus > 1) { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The first MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU. The last MAC-is SDU of the MAC-is PDU is the first segment of a MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The first MAC-is SDU of the MAC-is PDU is a complete MAC-d PDU or MAC-c PDU. The last MAC-is SDU of the MAC-is PDU is the first segment of a MAC-d PDU or MAC-c PDU."); } else { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The MAC-is SDU of the MAC-is PDU is the first segment of a MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The MAC-is SDU of the MAC-is PDU is the first segment of a MAC-d PDU or MAC-c PDU."); } break; case 3: if (number_of_mac_is_sdus > 1) { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The first MAC-is SDU of the MAC-is PDU is the last segment of a MAC-d PDU or MAC-c PDU and the last MAC-is SDU of MAC-is PDU is the first segment of a MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The first MAC-is SDU of the MAC-is PDU is the last segment of a MAC-d PDU or MAC-c PDU and the last MAC-is SDU of MAC-is PDU is the first segment of a MAC-d PDU or MAC-c PDU."); } else { - proto_tree_add_text(tree, tvb, offset, 1, "SS interpretation: The MAC-is SDU is a middle segment of a MAC-d PDU or MAC-c PDU."); + proto_tree_add_uint_format_value(tree, hf_mac_edch_type2_ss_interpretation, tvb, offset, 1, ss, + "The MAC-is SDU is a middle segment of a MAC-d PDU or MAC-c PDU."); } break; } @@ -1181,16 +1193,14 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree case MAC_CONTENT_CCCH: proto_item_append_text(ti, " (CCCH)"); /*Set the logical channel id if it exists */ + channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); + PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->lchid[pos] != 255){ - channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); - PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->fake_chid[pos]){ - channel_type = proto_tree_add_text(hsdsch_tree, tvb,0, 0, "This is a faked logical channel id!"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_faked_logical_channel_id); } }else{ - channel_type = proto_tree_add_text(hsdsch_tree, tvb,0, 0, "Frame is missing logical channel"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_no_logical_channel); } /*Set the type of channel*/ channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_channel, tvb, 0, 0, MAC_DCCH); @@ -1206,22 +1216,17 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_channel_hsdsch, tvb, 0, 0, MAC_DCCH); PROTO_ITEM_SET_GENERATED(channel_type)*/ /*Set the logical channel id if it exists */ + channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); + PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->lchid[pos] != 255){ - channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); - PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->fake_chid[pos]){ - channel_type = proto_tree_add_text(hsdsch_tree, tvb,0, 0, "This is a faked logical channel id!"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_faked_logical_channel_id); } }else{ - channel_type = proto_tree_add_text(hsdsch_tree, tvb,0, 0, "Frame is missing logical channel"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_no_logical_channel); } /*Set the type of channel*/ - /*channel_type = proto_tree_add_text(hsdsch_tree, tvb,0, 0, "Logcial Channel Type: PS DTCH"); - PROTO_ITEM_SET_GENERATED(channel_type); - */ channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_channel, tvb, 0, 0, MAC_DCCH); PROTO_ITEM_SET_GENERATED(channel_type); @@ -1235,16 +1240,14 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_item_append_text(ti, " (PS DTCH)"); /*Set the logical channel id if it exists */ + channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); + PROTO_ITEM_SET_GENERATED(channel_type); if(macinf->lchid[pos] != 255){ - channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_lch_id, tvb, 0, 0, macinf->lchid[pos]); - PROTO_ITEM_SET_GENERATED(channel_type); - if(macinf->fake_chid[pos]){ - channel_type = proto_tree_add_text(hsdsch_tree, tvb,0, 0, "This is a faked logical channel id!"); - PROTO_ITEM_SET_GENERATED(channel_type); + if(macinf->fake_chid[pos]){ + expert_add_info(pinfo, channel_type, &ei_mac_faked_logical_channel_id); } }else{ - channel_type = proto_tree_add_text(hsdsch_tree, tvb,0, 0, "Frame is missing logical channel"); - PROTO_ITEM_SET_GENERATED(channel_type); + expert_add_info(pinfo, channel_type, &ei_mac_no_logical_channel); } /*Sets the channel type*/ @@ -1398,6 +1401,12 @@ proto_register_umts_mac(void) "Segmentation Status", HFILL } }, + { &hf_mac_edch_type2_ss_interpretation, + { "SS interpretation", + "mac.edch.type2.ss_interpretation", FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL + } + }, { &hf_mac_edch_type2_tsn, { "TSN", "mac.edch.type2.tsn", FT_UINT16, BASE_DEC, NULL, 0, @@ -1440,6 +1449,13 @@ proto_register_umts_mac(void) { &ei_mac_rach_tctf_unknown, { "mac.rach_tctf.unknown", PI_MALFORMED, PI_ERROR, "Unknown RACH TCTF", EXPFILL }}, { &ei_mac_cs_dtch_not_implemented, { "mac.cs_dtch.not_implemented", PI_DEBUG, PI_ERROR, "CS DTCH Is not implemented", EXPFILL }}, { &ei_mac_fach_content_type_unknown, { "mac.fach_content_type.unknown", PI_UNDECODED, PI_WARN, " Unimplemented FACH Content type!", EXPFILL }}, + { &ei_mac_no_logical_channel, { "mac.no_logical_channel", PI_PROTOCOL, PI_WARN, "Frame is missing logical channel", EXPFILL }}, + { &ei_mac_faked_logical_channel_id, { "mac.faked_logical_channel_id", PI_PROTOCOL, PI_WARN, "This is a faked logical channel id!", EXPFILL }}, + { &ei_mac_macis_sdu_reassembled, { "mac.macis_sdu.reassembled", PI_REASSEMBLE, PI_CHAT, "Reassembled MAC-is SDU", EXPFILL }}, + { &ei_mac_macis_sdu_first, { "mac.macis_sdu.first", PI_REASSEMBLE, PI_CHAT, "This MAC-is SDU is the first segment of a MAC-d PDU or MAC-c PDU", EXPFILL }}, + { &ei_mac_macis_sdu_middle, { "mac.macis_sdu.middle", PI_REASSEMBLE, PI_CHAT, "This MAC-is SDU is a middle segment of a MAC-d PDU or MAC-c PDU", EXPFILL }}, + { &ei_mac_macis_sdu_last, { "mac.macis_sdu.last", PI_REASSEMBLE, PI_CHAT, "This MAC-is SDU is the last segment of a MAC-d PDU or MAC-c PDU", EXPFILL }}, + { &ei_mac_macis_sdu_complete, { "mac.macis_sdu.complete", PI_REASSEMBLE, PI_CHAT, "This MAC-is SDU is a complete MAC-d PDU or MAC-c PDU", EXPFILL }}, }; expert_module_t* expert_umts_mac; diff --git a/epan/dissectors/packet-usb-video.c b/epan/dissectors/packet-usb-video.c index ef3475e9e9..6ac4a3babe 100644 --- a/epan/dissectors/packet-usb-video.c +++ b/epan/dissectors/packet-usb-video.c @@ -247,6 +247,7 @@ static int hf_usb_vid_cam_objective_focal_len_max = -1; static int hf_usb_vid_cam_ocular_focal_len = -1; static int hf_usb_vid_bControlSize = -1; static int hf_usb_vid_bmControl = -1; +static int hf_usb_vid_bmControl_bytes = -1; static int hf_usb_vid_control_default = -1; static int hf_usb_vid_control_min = -1; static int hf_usb_vid_control_max = -1; @@ -280,6 +281,7 @@ static int hf_usb_vid_format_bits_per_pixel = -1; static int hf_usb_vid_default_frame_index = -1; static int hf_usb_vid_aspect_ratio_x = -1; static int hf_usb_vid_aspect_ratio_y = -1; +static int hf_usb_vid_interlace_flags = -1; static int hf_usb_vid_is_interlaced = -1; static int hf_usb_vid_interlaced_fields = -1; static int hf_usb_vid_field_1_first = -1; @@ -328,6 +330,11 @@ static int hf_usb_vid_iExtension = -1; static int hf_usb_vid_iSelector = -1; static int hf_usb_vid_proc_standards = -1; static int hf_usb_vid_request_error = -1; +static int hf_usb_vid_descriptor_data = -1; +static int hf_usb_vid_control_data = -1; +static int hf_usb_vid_control_value = -1; +static int hf_usb_vid_value_data = -1; + /* Subtrees */ static gint ett_usb_vid = -1; @@ -867,7 +874,7 @@ dissect_usb_video_extension_unit(proto_tree *tree, tvbuff_t *tvb, int offset) /* @todo Display as FT_BYTES with a big-endian disclaimer? * See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7933 */ - proto_tree_add_text(tree, tvb, offset, control_size, "bmControl"); + proto_tree_add_bytes_format(tree, hf_usb_vid_bmControl_bytes, tvb, offset, control_size, NULL, "bmControl"); } offset += control_size; } @@ -1012,7 +1019,7 @@ dissect_usb_video_control_interface_descriptor(proto_tree *parent_tree, tvbuff_t /* Soak up descriptor bytes beyond those we know how to dissect */ if (offset < descriptor_len) { - proto_tree_add_text(tree, tvb, offset, descriptor_len-offset, "Descriptor data"); + proto_tree_add_item(tree, hf_usb_vid_descriptor_data, tvb, offset, descriptor_len-offset, ENC_NA); /* offset = descriptor_len; */ } @@ -1199,12 +1206,11 @@ dissect_usb_video_format(proto_tree *tree, tvbuff_t *tvb, int offset, #if 0 /* @todo Display "N/A" if Camera Terminal does not support scanning mode control */ if (something) - proto_tree_add_text(tree, tvb, offset, 1, "bmInterlaceFlags: Not applicable"); + proto_tree_add_uint_format_value(tree, hf_usb_vid_interlace_flags, tvb, offset, 1, tvb_get_guint8(tvb, offset), "Not applicable"); #endif - proto_tree_add_bitmask_text(tree, tvb, offset, 1, "bmInterlaceFlags", NULL, - ett_interlace_flags, interlace_bits, ENC_NA, - BMT_NO_APPEND); + proto_tree_add_bitmask(tree, tvb, offset, hf_usb_vid_interlace_flags, + ett_interlace_flags, interlace_bits, ENC_NA); offset++; proto_tree_add_item(tree, hf_usb_vid_copy_protect, tvb, offset, 1, ENC_NA); @@ -1391,7 +1397,7 @@ dissect_usb_video_streaming_interface_descriptor(proto_tree *parent_tree, tvbuff /* Soak up descriptor bytes beyond those we know how to dissect */ if (offset < descriptor_len) - proto_tree_add_text(tree, tvb, offset, descriptor_len-offset, "Descriptor data"); + proto_tree_add_item(tree, hf_usb_vid_descriptor_data, tvb, offset, descriptor_len-offset, ENC_NA); return descriptor_len; } @@ -1440,7 +1446,7 @@ dissect_usb_video_endpoint_descriptor(proto_tree *parent_tree, tvbuff_t *tvb, /* Soak up descriptor bytes beyond those we know how to dissect */ if (offset < descriptor_len) - proto_tree_add_text(tree, tvb, offset, descriptor_len-offset, "Descriptor data"); + proto_tree_add_item(tree, hf_usb_vid_descriptor_data, tvb, offset, descriptor_len-offset, ENC_NA); return descriptor_len; } @@ -1762,7 +1768,7 @@ dissect_usb_vid_control_value(proto_tree *tree, tvbuff_t *tvb, int offset, guint /* @todo Display as FT_BYTES with a big-endian disclaimer? * See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7933 */ - proto_tree_add_text(tree, tvb, offset, value_size, "%s", fallback_name); + proto_tree_add_bytes_format(tree, hf_usb_vid_control_value, tvb, offset, value_size, NULL, "%s", fallback_name); } } @@ -1906,7 +1912,7 @@ dissect_usb_vid_get_set(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, if (value_size > 0) { - proto_tree_add_text(tree, tvb, offset, -1, "Control data"); + proto_tree_add_item(tree, hf_usb_vid_control_data, tvb, offset, -1, ENC_NA); offset += value_size; } } @@ -2103,7 +2109,7 @@ dissect_usb_vid_interrupt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v break; default: - proto_tree_add_text(tree, tvb, offset, -1, "Value data"); + proto_tree_add_item(tree, hf_usb_vid_value_data, tvb, offset, -1, ENC_NA); offset += tvb_reported_length_remaining(tvb, offset); break; } @@ -2839,6 +2845,12 @@ proto_register_usb_vid(void) "Y dimension of picture aspect ratio", HFILL } }, + { &hf_usb_vid_interlace_flags, + { "bmInterlaceFlags", "usbvideo.format.interlace", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_usb_vid_is_interlaced, { "Interlaced stream", "usbvideo.format.interlace.D0", FT_BOOLEAN, 8, TFS(&is_interlaced_meaning), (1<<0), @@ -3164,6 +3176,12 @@ proto_register_usb_vid(void) "Available controls", HFILL } }, + { &hf_usb_vid_bmControl_bytes, + { "bmControl", "usbvideo.availableControls.bytes", + FT_BYTES, BASE_NONE, NULL, 0, + "Available controls", HFILL } + }, + { &hf_usb_vid_control_ifdesc_src_id, { "bSourceID", "usbvideo.sourceID", FT_UINT8, BASE_DEC, NULL, 0x0, "Entity to which this terminal/unit is connected", HFILL } @@ -3184,6 +3202,26 @@ proto_register_usb_vid(void) &vs_if_descriptor_subtypes_ext, 0, "Descriptor Subtype", HFILL } }, + + { &hf_usb_vid_descriptor_data, + { "Descriptor data", "usbvideo.descriptor_data", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + + { &hf_usb_vid_control_data, + { "Control data", "usbvideo.control_data", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + + { &hf_usb_vid_control_value, + { "Control value", "usbvideo.control_value", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + + { &hf_usb_vid_value_data, + { "Value data", "usbvideo.value_data", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, }; static gint *usb_vid_subtrees[] = { diff --git a/epan/dissectors/packet-vcdu.c b/epan/dissectors/packet-vcdu.c index dbb7c50f7c..346b9a414a 100644 --- a/epan/dissectors/packet-vcdu.c +++ b/epan/dissectors/packet-vcdu.c @@ -26,6 +26,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/prefs.h> #include <epan/to_str.h> #include <epan/wmem/wmem.h> @@ -63,6 +64,15 @@ static int hf_vcdu_vc_id = -1; static int hf_vcdu_seq = -1; static int hf_vcdu_replay = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_vcdu_data = -1; +static int hf_vcdu_ground_receipt_time = -1; +static int hf_vcdu_ccsds_all_fill = -1; +static int hf_vcdu_bitream_all_fill = -1; +static int hf_vcdu_bitream_all_data = -1; +static int hf_vcdu_bitream_all_data_anomaly = -1; +static int hf_vcdu_ccsds_continuation_packet = -1; + /* although technically not part of the vcdu header, the * first header pointer (for ccsds), and the last bit * pointer (for bitstream), are more easily processed by @@ -81,6 +91,8 @@ static gint ett_vcdu = -1; static gint ett_smex = -1; static gint ett_vcduh = -1; +static expert_field ei_vcdu_fhp_too_close_to_end_of_vcdu = EI_INIT; + /* * Bits in the first 16-bit header word */ @@ -322,7 +334,7 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* format ground receipt time into human readable time format for display */ time_string = smex_time_to_string(pb5_days, pb5_seconds, pb5_milliseconds); - proto_tree_add_text(smex_tree, tvb, offset-6, 6, "%s = Ground Receipt Time", time_string); + proto_tree_add_string(smex_tree, hf_vcdu_ground_receipt_time, tvb, offset-6, 6, time_string); proto_item_set_end(smex_header, tvb, offset); @@ -358,15 +370,15 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch (new_ptr) { case LBP_ALL_DATA: - proto_tree_add_text(vcdu_tree, tvb, 0, -1, "Bitream ALL Data"); + proto_tree_add_item(vcdu_tree, hf_vcdu_bitream_all_data, tvb, 0, -1, ENC_NA); break; case LBP_ALL_DATA_ANOMALY: - proto_tree_add_text(vcdu_tree, tvb, 0, -1, "Bitream ALL Data (Anomaly)"); + proto_tree_add_item(vcdu_tree, hf_vcdu_bitream_all_data_anomaly, tvb, 0, -1, ENC_NA); break; case LBP_ALL_FILL: - proto_tree_add_text(vcdu_tree, tvb, 0, -1, "Bitream ALL Fill"); + proto_tree_add_item(vcdu_tree, hf_vcdu_bitream_all_fill, tvb, 0, -1, ENC_NA); break; default: @@ -386,12 +398,12 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* process special cases of first header pointer */ if (FHP_ALL_FILL == new_ptr) { - proto_tree_add_text(vcdu_tree, tvb, 0, -1, "Ccsds ALL Fill"); + proto_tree_add_item(vcdu_tree, hf_vcdu_ccsds_all_fill, tvb, 0, -1, ENC_NA); } else if (FHP_CONTINUATION == new_ptr) { - proto_tree_add_text(vcdu_tree, tvb, 0, -1, "Ccsds Continuation Packet"); + proto_tree_add_item(vcdu_tree, hf_vcdu_ccsds_continuation_packet, tvb, 0, -1, ENC_NA); } /* process as many ccsds packet headers as we can using the ccsds packet dissector */ @@ -417,9 +429,7 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (! ccsds_tree_added) { - proto_tree_add_text(vcdu_tree, tvb, 0, -1, - "FHP too close to end of VCDU. Incomplete Hdr Info Available" - " - Unable to format CCSDS Hdr(s)." ); + proto_tree_add_expert(vcdu_tree, pinfo, &ei_vcdu_fhp_too_close_to_end_of_vcdu, tvb, 0, -1); } } @@ -436,7 +446,7 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (! ccsds_tree_added) { /* add "Data" section if ccsds parsing did not do so already */ - proto_tree_add_text(vcdu_tree, tvb, offset, -1, "Data"); + proto_tree_add_item(vcdu_tree, hf_vcdu_data, tvb, offset, -1, ENC_NA); } } } @@ -575,6 +585,15 @@ proto_register_vcdu(void) "VCDU Replay Flag", HFILL } }, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_vcdu_ground_receipt_time, { "Ground Receipt Time", "vcdu.ground_receipt_time", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_vcdu_bitream_all_data, { "Bitream ALL Data", "vcdu.bitream.all_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_vcdu_bitream_all_data_anomaly, { "Bitream ALL Data (Anomaly)", "vcdu.bitream.all_data_anomaly", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_vcdu_bitream_all_fill, { "Bitream ALL Fill", "vcdu.bitream.all_fill", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_vcdu_ccsds_all_fill, { "Ccsds ALL Fill", "vcdu.ccsds.all_fill", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_vcdu_ccsds_continuation_packet, { "Ccsds Continuation Packet", "vcdu.ccsds_continuation_packet", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_vcdu_data, { "Data", "vcdu.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + /* not really part of the vcdu header, but it's easier this way */ { &hf_vcdu_fhp, { "First Header Pointer", "vcdu.fhp", @@ -600,12 +619,20 @@ proto_register_vcdu(void) &ett_vcduh, }; + static ei_register_info ei[] = { + { &ei_vcdu_fhp_too_close_to_end_of_vcdu, { "vcdu.fhp_too_close_to_end_of_vcdu", PI_PROTOCOL, PI_WARN, "FHP too close to end of VCDU. Incomplete Hdr Info Available - Unable to format CCSDS Hdr(s).", EXPFILL }}, + }; + + expert_module_t* expert_vcdu; + /* Register the protocol name and description */ proto_vcdu = proto_register_protocol("VCDU", "VCDU", "vcdu"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_vcdu, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_vcdu = expert_register_protocol(proto_vcdu); + expert_register_field_array(expert_vcdu, ei, array_length(ei)); /* XX: Does this dissector need to be publicly registered ?? */ vcdu_handle = register_dissector("vcdu", dissect_vcdu, proto_vcdu); diff --git a/epan/dissectors/packet-windows-common.c b/epan/dissectors/packet-windows-common.c index afbd698da1..4241f96f0e 100644 --- a/epan/dissectors/packet-windows-common.c +++ b/epan/dissectors/packet-windows-common.c @@ -26,6 +26,7 @@ #include <string.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/exceptions.h> #include <epan/wmem/wmem.h> #include "packet-dcerpc.h" @@ -81,6 +82,16 @@ static int hf_nt_security_information_dacl = -1; static int hf_nt_security_information_group = -1; static int hf_nt_security_information_owner = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_nt_security_information = -1; +static int hf_nt_sec_desc_type = -1; +static int hf_nt_offset_to_dacl = -1; +static int hf_nt_offset_to_owner_sid = -1; +static int hf_nt_ace_flags_object = -1; +static int hf_nt_offset_to_group_sid = -1; +static int hf_nt_ace_flags = -1; +static int hf_nt_offset_to_sacl = -1; + static gint ett_nt_sec_desc = -1; static gint ett_nt_sec_desc_type = -1; static gint ett_nt_sid = -1; @@ -91,6 +102,14 @@ static gint ett_nt_ace_object = -1; static gint ett_nt_ace_object_flags = -1; static gint ett_nt_security_information = -1; +static expert_field ei_nt_owner_sid_beyond_reassembled_data = EI_INIT; +static expert_field ei_nt_ace_extends_beyond_reassembled_data = EI_INIT; +static expert_field ei_nt_ace_extends_beyond_capture = EI_INIT; +static expert_field ei_nt_group_sid_beyond_reassembled_data = EI_INIT; +static expert_field ei_nt_group_sid_beyond_captured_data = EI_INIT; +static expert_field ei_nt_owner_sid_beyond_captured_data = EI_INIT; + + /* WERR error codes */ VALUE_STRING_ARRAY2_GLOBAL_DEF(WERR_errors); /* XXX: Remove GLOBAL_DEF once all PIDL generated dissectors @@ -1188,25 +1207,27 @@ dissect_nt_64bit_time_ex(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_dat filetime_low = tvb_get_letohl(tvb, offset); filetime_high = tvb_get_letohl(tvb, offset + 4); if (filetime_low == 0 && filetime_high == 0) { - item = proto_tree_add_text(tree, tvb, offset, 8, - "%s: No time specified (0)", - proto_registrar_get_name(hf_date)); + ts.secs = 0; + ts.nsecs = 0; + item = proto_tree_add_time_format_value(tree, hf_date, tvb, offset, 8, + &ts, "No time specified (0)"); } else if(filetime_low==0 && filetime_high==0x80000000){ - item = proto_tree_add_text(tree, tvb, offset, 8, - "%s: Infinity (relative time)", - proto_registrar_get_name(hf_date)); + ts.secs = filetime_low; + ts.nsecs = filetime_high; + item = proto_tree_add_time_format_value(tree, hf_date, tvb, offset, 8, + &ts, "Infinity (relative time)"); } else if(filetime_low==0xffffffff && filetime_high==0x7fffffff){ - item = proto_tree_add_text(tree, tvb, offset, 8, - "%s: Infinity (absolute time)", - proto_registrar_get_name(hf_date)); + ts.secs = filetime_low; + ts.nsecs = filetime_high; + item = proto_tree_add_time_format_value(tree, hf_date, tvb, offset, 8, + &ts, "Infinity (absolute time)"); } else { if (nt_time_to_nstime(filetime_high, filetime_low, &ts, onesec_resolution)) { proto_tree_add_time(tree, hf_date, tvb, offset, 8, &ts); } else { - item = proto_tree_add_text(tree, tvb, offset, 8, - "%s: Time can't be converted", - proto_registrar_get_name(hf_date)); + item = proto_tree_add_time_format_value(tree, hf_date, tvb, offset, 8, + &ts, "Time can't be converted"); } } if (createdItem != NULL) @@ -1740,13 +1761,10 @@ dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* Generic access rights */ - item = proto_tree_add_text(subtree, tvb, offset - 4, 4, - "Generic rights: 0x%08x", + generic_tree = proto_tree_add_subtree_format(subtree, tvb, offset - 4, 4, + ett_nt_access_mask_generic, NULL, "Generic rights: 0x%08x", access & GENERIC_RIGHTS_MASK); - generic_tree = proto_item_add_subtree( - item, ett_nt_access_mask_generic); - proto_tree_add_boolean( generic_tree, hf_access_generic_read, tvb, offset - 4, 4, access); @@ -1777,13 +1795,10 @@ dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* Standard access rights */ - item = proto_tree_add_text(subtree, tvb, offset - 4, 4, - "Standard rights: 0x%08x", + standard_tree = proto_tree_add_subtree_format(subtree, tvb, offset - 4, 4, + ett_nt_access_mask_standard, NULL, "Standard rights: 0x%08x", access & STANDARD_RIGHTS_MASK); - standard_tree = proto_item_add_subtree( - item, ett_nt_access_mask_standard); - proto_tree_add_boolean( standard_tree, hf_access_standard_synchronise, tvb, offset - 4, 4, access); @@ -1809,18 +1824,15 @@ dissect_nt_access_mask(tvbuff_t *tvb, gint offset, packet_info *pinfo, boring fashion. */ if (ami && ami->specific_rights_name) - item = proto_tree_add_text(subtree, tvb, offset - 4, 4, - "%s specific rights: 0x%08x", + specific_tree = proto_tree_add_subtree_format(subtree, tvb, offset - 4, 4, + ett_nt_access_mask_specific, &item, "%s specific rights: 0x%08x", ami->specific_rights_name, access & SPECIFIC_RIGHTS_MASK); else - item = proto_tree_add_text(subtree, tvb, offset - 4, 4, - "Specific rights: 0x%08x", + specific_tree = proto_tree_add_subtree_format(subtree, tvb, offset - 4, 4, + ett_nt_access_mask_specific, &item, "Specific rights: 0x%08x", access & SPECIFIC_RIGHTS_MASK); - specific_tree = proto_item_add_subtree( - item, ett_nt_access_mask_specific); - if (ami && ami->specific_rights_fn) { guint32 mapped_access = access; proto_tree *specific_mapped; @@ -2022,26 +2034,24 @@ dissect_nt_ace_object(tvbuff_t *tvb, int offset, proto_tree *parent_tree) proto_item *item; proto_tree *tree; proto_item *flags_item; - proto_tree *flags_tree; guint32 flags; int old_offset=offset; const char *sep = " "; + static const int * ace_flags[] = { + &hf_nt_ace_flags_object_type_present, + &hf_nt_ace_flags_inherited_object_type_present, + NULL + }; tree = proto_tree_add_subtree(parent_tree, tvb, offset, 0, ett_nt_ace_object, &item, "ACE Object"); /* flags */ flags=tvb_get_letohl(tvb, offset); - flags_item = proto_tree_add_text(tree, tvb, offset, 4, - "ACE Object Flags (0x%08x)", flags); - flags_tree = proto_item_add_subtree(flags_item, ett_nt_ace_object_flags); + flags_item = proto_tree_add_bitmask(tree, tvb, offset, hf_nt_ace_flags_object, + ett_nt_ace_object_flags, ace_flags, ENC_LITTLE_ENDIAN); - proto_tree_add_boolean(flags_tree, hf_nt_ace_flags_object_type_present, - tvb, offset, 4, flags); APPEND_ACE_TEXT(flags&0x00000001, flags_item, "%sObject Type Present"); - - proto_tree_add_boolean(flags_tree, hf_nt_ace_flags_inherited_object_type_present, - tvb, offset, 4, flags); APPEND_ACE_TEXT(flags&0x00000002, flags_item, "%sInherited Object Type Present"); offset+=4; @@ -2067,48 +2077,33 @@ dissect_nt_v2_ace_flags(tvbuff_t *tvb, int offset, proto_tree *parent_tree, guint8 *data) { proto_item *item = NULL; - proto_tree *tree = NULL; guint8 mask; const char *sep = " "; + static const int * ace_flags[] = { + &hf_nt_ace_flags_failed_access, + &hf_nt_ace_flags_successful_access, + &hf_nt_ace_flags_inherited_ace, + &hf_nt_ace_flags_inherit_only, + &hf_nt_ace_flags_non_propagate_inherit, + &hf_nt_ace_flags_container_inherit, + &hf_nt_ace_flags_object_inherit, + NULL + }; mask = tvb_get_guint8(tvb, offset); if (data) *data = mask; + item = proto_tree_add_bitmask(parent_tree, tvb, offset, hf_nt_ace_flags, + ett_nt_ace_flags, ace_flags, ENC_NA); - if(parent_tree){ - item = proto_tree_add_text(parent_tree, tvb, offset, 1, - "NT ACE Flags: 0x%02x", mask); - tree = proto_item_add_subtree(item, ett_nt_ace_flags); - } - - proto_tree_add_boolean(tree, hf_nt_ace_flags_failed_access, - tvb, offset, 1, mask); APPEND_ACE_TEXT(mask&0x80, item, "%sFailed Access"); - - proto_tree_add_boolean(tree, hf_nt_ace_flags_successful_access, - tvb, offset, 1, mask); APPEND_ACE_TEXT(mask&0x40, item, "%sSuccessful Access"); - - proto_tree_add_boolean(tree, hf_nt_ace_flags_inherited_ace, - tvb, offset, 1, mask); APPEND_ACE_TEXT(mask&0x10, item, "%sInherited ACE"); - - proto_tree_add_boolean(tree, hf_nt_ace_flags_inherit_only, - tvb, offset, 1, mask); APPEND_ACE_TEXT(mask&0x08, item, "%sInherit Only"); - - proto_tree_add_boolean(tree, hf_nt_ace_flags_non_propagate_inherit, - tvb, offset, 1, mask); APPEND_ACE_TEXT(mask&0x04, item, "%sNo Propagate Inherit"); - - proto_tree_add_boolean(tree, hf_nt_ace_flags_container_inherit, - tvb, offset, 1, mask); APPEND_ACE_TEXT(mask&0x02, item, "%sContainer Inherit"); - - proto_tree_add_boolean(tree, hf_nt_ace_flags_object_inherit, - tvb, offset, 1, mask); APPEND_ACE_TEXT(mask&0x01, item, "%sObject Inherit"); @@ -2291,12 +2286,12 @@ dissect_nt_acl(tvbuff_t *tvb, int offset_a, packet_info *pinfo, } CATCH(BoundsError) { - proto_tree_add_text(tree, tvb, offset_v, 0, "ACE Extends beyond end of captured data"); + proto_tree_add_expert(tree, pinfo, &ei_nt_ace_extends_beyond_capture, tvb, offset_v, 0); missing_data = TRUE; } CATCH(ReportedBoundsError) { - proto_tree_add_text(tree, tvb, offset_v, 0, "ACE Extends beyond end of reassembled data"); + proto_tree_add_expert(tree, pinfo, &ei_nt_ace_extends_beyond_reassembled_data, tvb, offset_v, 0); missing_data = TRUE; } @@ -2377,50 +2372,28 @@ static const true_false_string tfs_sec_desc_type_self_relative = { static int dissect_nt_sec_desc_type(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - proto_item *item = NULL; - proto_tree *tree = NULL; - guint16 mask; - - mask = tvb_get_letohs(tvb, offset); - if(parent_tree){ - item = proto_tree_add_text(parent_tree, tvb, offset, 2, - "Type: 0x%04x", mask); - tree = proto_item_add_subtree(item, ett_nt_sec_desc_type); - } - - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_self_relative, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_rm_control_valid, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_sacl_protected, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_dacl_protected, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_sacl_auto_inherited, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_dacl_auto_inherited, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_sacl_auto_inherit_req, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_dacl_auto_inherit_req, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_server_security, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_dacl_trusted, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_sacl_defaulted, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_sacl_present, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_dacl_defaulted, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_dacl_present, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree,hf_nt_sec_desc_type_group_defaulted, - tvb, offset, 2, mask); - proto_tree_add_boolean(tree, hf_nt_sec_desc_type_owner_defaulted, - tvb, offset, 2, mask); + static const int * flags[] = { + &hf_nt_sec_desc_type_self_relative, + &hf_nt_sec_desc_type_rm_control_valid, + &hf_nt_sec_desc_type_sacl_protected, + &hf_nt_sec_desc_type_dacl_protected, + &hf_nt_sec_desc_type_sacl_auto_inherited, + &hf_nt_sec_desc_type_dacl_auto_inherited, + &hf_nt_sec_desc_type_sacl_auto_inherit_req, + &hf_nt_sec_desc_type_dacl_auto_inherit_req, + &hf_nt_sec_desc_type_server_security, + &hf_nt_sec_desc_type_dacl_trusted, + &hf_nt_sec_desc_type_sacl_defaulted, + &hf_nt_sec_desc_type_sacl_present, + &hf_nt_sec_desc_type_dacl_defaulted, + &hf_nt_sec_desc_type_dacl_present, + &hf_nt_sec_desc_type_group_defaulted, + &hf_nt_sec_desc_type_owner_defaulted, + NULL + }; + proto_tree_add_bitmask(parent_tree, tvb, offset, hf_nt_sec_desc_type, + ett_nt_sec_desc_type, flags, ENC_LITTLE_ENDIAN); offset += 2; return offset; @@ -2430,33 +2403,28 @@ int dissect_nt_security_information(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { proto_item *item = NULL; - proto_tree *tree = NULL; guint32 mask; + static const int * flags[] = { + &hf_nt_security_information_sacl, + &hf_nt_security_information_dacl, + &hf_nt_security_information_group, + &hf_nt_security_information_owner, + NULL + }; mask = tvb_get_letohl(tvb, offset); - if(parent_tree){ - item = proto_tree_add_text(parent_tree, tvb, offset, 4, - "SEC INFO: 0x%08x", mask); - tree = proto_item_add_subtree(item, ett_nt_security_information); - } + item = proto_tree_add_bitmask(parent_tree, tvb, offset, hf_nt_security_information, + ett_nt_security_information, flags, ENC_LITTLE_ENDIAN); - proto_tree_add_boolean(tree,hf_nt_security_information_sacl, - tvb, offset, 4, mask); if (mask & 0x00000008) { proto_item_append_text(item, " SACL"); } - proto_tree_add_boolean(tree,hf_nt_security_information_dacl, - tvb, offset, 4, mask); if (mask & 0x00000004) { proto_item_append_text(item, " DACL"); } - proto_tree_add_boolean(tree,hf_nt_security_information_group, - tvb, offset, 4, mask); if (mask & 0x00000002) { proto_item_append_text(item, " GROUP"); } - proto_tree_add_boolean(tree,hf_nt_security_information_owner, - tvb, offset, 4, mask); if (mask & 0x00000001) { proto_item_append_text(item, " OWNER"); } @@ -2502,40 +2470,40 @@ dissect_nt_sec_desc(tvbuff_t *tvb, int offset_a, packet_info *pinfo, owner_sid_offset = tvb_get_letohl(tvb, offset_v); if(owner_sid_offset != 0 && owner_sid_offset < 20){ /* Bogus value - points into fixed portion of descriptor */ - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to owner SID: %u (bogus, must be >= 20)", owner_sid_offset); + proto_tree_add_uint_format_value(tree, hf_nt_offset_to_owner_sid, tvb, offset_v, 4, owner_sid_offset, "%u (bogus, must be >= 20)", owner_sid_offset); owner_sid_offset = 0; } else - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to owner SID: %u", owner_sid_offset); + proto_tree_add_item(tree, hf_nt_offset_to_owner_sid, tvb, offset_v, 4, ENC_LITTLE_ENDIAN); offset_v += 4; /* offset to group sid */ group_sid_offset = tvb_get_letohl(tvb, offset_v); if(group_sid_offset != 0 && group_sid_offset < 20){ /* Bogus value - points into fixed portion of descriptor */ - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to group SID: %u (bogus, must be >= 20)", group_sid_offset); + proto_tree_add_uint_format_value(tree, hf_nt_offset_to_group_sid, tvb, offset_v, 4, group_sid_offset, "%u (bogus, must be >= 20)", group_sid_offset); group_sid_offset = 0; } else - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to group SID: %u", group_sid_offset); + proto_tree_add_item(tree, hf_nt_offset_to_group_sid, tvb, offset_v, 4, ENC_LITTLE_ENDIAN); offset_v += 4; /* offset to sacl */ sacl_offset = tvb_get_letohl(tvb, offset_v); if(sacl_offset != 0 && sacl_offset < 20){ /* Bogus value - points into fixed portion of descriptor */ - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to SACL: %u (bogus, must be >= 20)", sacl_offset); + proto_tree_add_uint_format_value(tree, hf_nt_offset_to_sacl, tvb, offset_v, 4, sacl_offset, "%u (bogus, must be >= 20)", sacl_offset); sacl_offset = 0; } else - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to SACL: %u", sacl_offset); + proto_tree_add_item(tree, hf_nt_offset_to_sacl, tvb, offset_v, 4, ENC_LITTLE_ENDIAN); offset_v += 4; /* offset to dacl */ dacl_offset = tvb_get_letohl(tvb, offset_v); if(dacl_offset != 0 && dacl_offset < 20){ /* Bogus value - points into fixed portion of descriptor */ - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to DACL: %u (bogus, must be >= 20)", dacl_offset); + proto_tree_add_uint_format_value(tree, hf_nt_offset_to_dacl, tvb, offset_v, 4, dacl_offset, "%u (bogus, must be >= 20)", dacl_offset); dacl_offset = 0; } else - proto_tree_add_text(tree, tvb, offset_v, 4, "Offset to DACL: %u", dacl_offset); + proto_tree_add_item(tree, hf_nt_offset_to_dacl, tvb, offset_v, 4, ENC_LITTLE_ENDIAN); offset_v += 4; end_offset = offset_v; @@ -2556,11 +2524,11 @@ dissect_nt_sec_desc(tvbuff_t *tvb, int offset_a, packet_info *pinfo, } CATCH(BoundsError) { - proto_tree_add_text(tree, tvb, item_offset, 0, "Owner SID beyond end of captured data"); + proto_tree_add_expert(tree, pinfo, &ei_nt_owner_sid_beyond_captured_data, tvb, item_offset, 0); } CATCH(ReportedBoundsError) { - proto_tree_add_text(tree, tvb, item_offset, 0, "Owner SID beyond end of reassembled data"); + proto_tree_add_expert(tree, pinfo, &ei_nt_owner_sid_beyond_reassembled_data, tvb, item_offset, 0); } ENDTRY; @@ -2582,11 +2550,11 @@ dissect_nt_sec_desc(tvbuff_t *tvb, int offset_a, packet_info *pinfo, } CATCH(BoundsError) { - proto_tree_add_text(tree, tvb, item_offset, 0, "Group SID beyond end of captured data"); + proto_tree_add_expert(tree, pinfo, &ei_nt_group_sid_beyond_captured_data, tvb, item_offset, 0); } CATCH(ReportedBoundsError) { - proto_tree_add_text(tree, tvb, item_offset, 0, "Group SID beyond end of reassembled data"); + proto_tree_add_expert(tree, pinfo, &ei_nt_group_sid_beyond_reassembled_data, tvb, item_offset, 0); } ENDTRY; @@ -2988,6 +2956,15 @@ proto_do_register_windows_common(int proto_smb) { "Owner", "nt.sec_info.owner", FT_BOOLEAN, 32, TFS(&flags_sec_info_owner), 0x00000001, NULL, HFILL }}, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_nt_ace_flags_object, { "ACE Object Flags", "nt.ace.object.flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nt_ace_flags, { "NT ACE Flags", "nt.ace.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nt_sec_desc_type, { "Type", "nt.sec_desc.type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nt_security_information, { "SEC INFO", "nt.sec_info", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nt_offset_to_owner_sid, { "Offset to owner SID", "nt.offset_to_owner_sid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nt_offset_to_group_sid, { "Offset to group SID", "nt.offset_to_group_sid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nt_offset_to_sacl, { "Offset to SACL", "nt.offset_to_sacl", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nt_offset_to_dacl, { "Offset to DACL", "nt.offset_to_dacl", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { @@ -3006,8 +2983,21 @@ proto_do_register_windows_common(int proto_smb) &ett_nt_security_information, }; + static ei_register_info ei[] = { + { &ei_nt_ace_extends_beyond_capture, { "nt.ace_extends_beyond_capture", PI_MALFORMED, PI_ERROR, "ACE Extends beyond end of captured data", EXPFILL }}, + { &ei_nt_ace_extends_beyond_reassembled_data, { "nt.ace_extends_beyond_reassembled_data", PI_MALFORMED, PI_ERROR, "ACE Extends beyond end of reassembled data", EXPFILL }}, + { &ei_nt_owner_sid_beyond_captured_data, { "nt.owner_sid.beyond_captured_data", PI_MALFORMED, PI_ERROR, "Owner SID beyond end of captured data", EXPFILL }}, + { &ei_nt_owner_sid_beyond_reassembled_data, { "nt.owner_sid.beyond_reassembled_data", PI_MALFORMED, PI_ERROR, "Owner SID beyond end of reassembled data", EXPFILL }}, + { &ei_nt_group_sid_beyond_captured_data, { "nt.group_sid.beyond_captured_data", PI_MALFORMED, PI_ERROR, "Group SID beyond end of captured data", EXPFILL }}, + { &ei_nt_group_sid_beyond_reassembled_data, { "nt.group_sid.beyond_reassembled_data", PI_MALFORMED, PI_ERROR, "Group SID beyond end of reassembled data", EXPFILL }}, + }; + + expert_module_t* expert_nt; + proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_smb, hf, array_length(hf)); + expert_nt = expert_register_protocol(proto_smb); + expert_register_field_array(expert_nt, ei, array_length(ei)); } /* diff --git a/epan/dissectors/packet-x29.c b/epan/dissectors/packet-x29.c index 72a009f45f..62344e409f 100644 --- a/epan/dissectors/packet-x29.c +++ b/epan/dissectors/packet-x29.c @@ -34,6 +34,17 @@ static int hf_msg_code = -1; static int hf_error_type = -1; static int hf_inv_msg_code = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_x29_pad_message_data = -1; +static int hf_x29_type_reference_value = -1; +static int hf_x29_type_reference = -1; +static int hf_x29_data = -1; +static int hf_x29_type_of_aspect = -1; +static int hf_x29_reselection_message_data = -1; +static int hf_x29_break_value = -1; +static int hf_x29_parameter = -1; +static int hf_x29_value = -1; + static gint ett_x29 = -1; /* @@ -73,6 +84,12 @@ static const value_string error_type_vals[] = { { 0, NULL }, }; +static const value_string reference_type_vals[] = { + { 0x01, "Change in PAD Aspect" }, + { 0x08, "Break" }, + { 0, NULL }, +}; + static int dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { @@ -120,11 +137,10 @@ dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) * XXX - dissect the references as per X.3. */ while (tvb_reported_length_remaining(tvb, offset) > 0) { - proto_tree_add_text(x29_tree, tvb, offset, 2, - "Parameter %u, value %u", - tvb_get_guint8(tvb, offset), - tvb_get_guint8(tvb, offset + 1)); - offset += 2; + proto_tree_add_item(x29_tree, hf_x29_parameter, tvb, offset, 1, ENC_NA); + offset++; + proto_tree_add_item(x29_tree, hf_x29_value, tvb, offset, 1, ENC_NA); + offset++; } break; @@ -148,39 +164,25 @@ dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) case BREAK_IND_MSG: if (tvb_reported_length_remaining(tvb, offset) > 0) { type_ref = tvb_get_guint8(tvb, offset); + proto_tree_add_item(x29_tree, hf_x29_type_reference, tvb, offset, 1, ENC_NA); + offset++; switch (type_ref) { case 0x01: /* change in PAD Aspect */ /* * XXX - dissect as per X.28. */ - proto_tree_add_text(x29_tree, tvb, - offset, 1, "Type reference: Change in PAD Aspect"); - offset++; - proto_tree_add_text(x29_tree, tvb, - offset, 1, "Type of aspect: 0x%02x", - type_ref); + proto_tree_add_item(x29_tree, hf_x29_type_of_aspect, tvb, offset, 1, ENC_NA); offset++; break; case 0x08: /* break */ - proto_tree_add_text(x29_tree, tvb, - offset, 1, "Type reference: Break"); - offset++; - proto_tree_add_text(x29_tree, tvb, - offset, 1, "Break value: 0x%02x", - type_ref); + proto_tree_add_item(x29_tree, hf_x29_break_value, tvb, offset, 1, ENC_NA); offset++; break; default: - proto_tree_add_text(x29_tree, tvb, - offset, 1, "Unknown type reference (0x%02x)", - type_ref); - offset++; - proto_tree_add_text(x29_tree, tvb, - offset, 1, "Type value: 0x%02x", - type_ref); + proto_tree_add_item(x29_tree, hf_x29_type_reference_value, tvb, offset, 1, ENC_NA); offset++; break; } @@ -191,21 +193,18 @@ dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) /* * XXX - dissect me. */ - proto_tree_add_text(x29_tree, tvb, offset, -1, - "Reselection message data"); + proto_tree_add_item(x29_tree, hf_x29_reselection_message_data, tvb, offset, -1, ENC_NA); break; case RESEL_WITH_TOA_NPI_MSG: /* * XXX - dissect me. */ - proto_tree_add_text(x29_tree, tvb, offset, -1, - "Reselection message data"); + proto_tree_add_item(x29_tree, hf_x29_reselection_message_data, tvb, offset, -1, ENC_NA); break; default: - proto_tree_add_text(x29_tree, tvb, offset, -1, - "PAD message data"); + proto_tree_add_item(x29_tree, hf_x29_pad_message_data, tvb, offset, -1, ENC_NA); break; } } else { @@ -229,9 +228,7 @@ dissect_x29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) */ linelen = next_offset - offset; - proto_tree_add_text(x29_tree, tvb, offset, - linelen, "Data: %s", - tvb_format_text(tvb, offset, linelen)); + proto_tree_add_item(x29_tree, hf_x29_data, tvb, offset, linelen, ENC_NA|ENC_ASCII); offset = next_offset; } } @@ -256,6 +253,17 @@ proto_register_x29(void) { "Invalid message code", "x29.inv_msg_code", FT_UINT8, BASE_HEX, VALS(message_code_vals), 0x0, "X.29 Error PAD message invalid message code", HFILL }}, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_x29_type_reference, { "Type reference", "x29.type_reference", FT_UINT8, BASE_DEC, VALS(reference_type_vals), 0x0, NULL, HFILL }}, + { &hf_x29_type_of_aspect, { "Type of aspect", "x29.type_of_aspect", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_x29_break_value, { "Break value", "x29.break_value", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_x29_type_reference_value, { "Type value", "x29.type_reference.value", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_x29_reselection_message_data, { "Reselection message data", "x29.reselection_message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_x29_pad_message_data, { "PAD message data", "x29.pad_message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_x29_data, { "Data", "x29.data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_x29_parameter, { "Parameter", "x29.parameter", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_x29_value, { "Value", "x29.value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_x29, diff --git a/epan/dissectors/packet-xmpp-utils.c b/epan/dissectors/packet-xmpp-utils.c index ae86ffce2b..59e36b7afa 100644 --- a/epan/dissectors/packet-xmpp-utils.c +++ b/epan/dissectors/packet-xmpp-utils.c @@ -1,4 +1,4 @@ -/* xmpp-utils.c +/* packet-xmpp-utils.c * Wireshark's XMPP dissector. * * Copyright 2011, Mariusz Okroj <okrojmariusz[]gmail.com> |