From 484c4cbaff87ad754967db29f62c49b4885abc3f Mon Sep 17 00:00:00 2001 From: wmeier Date: Fri, 17 Sep 2010 04:51:21 +0000 Subject: Use val_to_str_ext() & friends to access sminmpec_values[]; Also: packet-nhrp.c: #include sminmpec.h not req'd; git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@34143 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-3g-a11.c | 2 +- epan/dissectors/packet-bootp.c | 8 ++++---- epan/dissectors/packet-capwap.c | 10 +++++----- epan/dissectors/packet-dhcpv6.c | 8 ++++---- epan/dissectors/packet-diameter.c | 6 +++--- epan/dissectors/packet-gtp.c | 2 +- epan/dissectors/packet-gtpv2.c | 2 +- epan/dissectors/packet-l2tp.c | 6 +++--- epan/dissectors/packet-mip.c | 2 +- epan/dissectors/packet-mip6.c | 2 +- epan/dissectors/packet-mpls-echo.c | 2 +- epan/dissectors/packet-netflow.c | 2 +- epan/dissectors/packet-nhrp.c | 1 - epan/dissectors/packet-radius.c | 6 ++++-- epan/dissectors/packet-snmp.c | 4 ++-- epan/libwireshark.def | 4 +++- epan/sminmpec.h | 2 +- epan/value_string.c | 7 +++---- 18 files changed, 39 insertions(+), 37 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-3g-a11.c b/epan/dissectors/packet-3g-a11.c index 903265613e..87018115ea 100644 --- a/epan/dissectors/packet-3g-a11.c +++ b/epan/dissectors/packet-3g-a11.c @@ -1882,7 +1882,7 @@ proto_register_a11(void) }, { &hf_a11_vse_vid, { "Vendor ID", "a11.ext.vid", - FT_UINT32, BASE_HEX, VALS(sminmpec_values), 0, + FT_UINT32, BASE_HEX|BASE_EXT_STRING, &sminmpec_values_ext, 0, "Vendor ID.", HFILL } }, { &hf_a11_vse_apptype, diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index e6f15ae8e2..276d3e36cf 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -1268,7 +1268,7 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, int voff, enterprise = tvb_get_ntohl(tvb, optoff+2); proto_tree_add_text(v_tree, tvb, optoff + 2, 4, "Enterprise-number: %s (%u)", - val_to_str( enterprise, sminmpec_values, "Unknown"), + val_to_str_ext_const( enterprise, &sminmpec_values_ext, "Unknown"), enterprise); if (optlen > 6) { buf = tvb_bytes_to_str(tvb, optoff + 6, optlen - 11); @@ -1739,7 +1739,7 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, int voff, vti = proto_tree_add_text(v_tree, tvb, optoff, 4, "Enterprise-number: %s (%u)", - val_to_str(enterprise, sminmpec_values, "Unknown"), + val_to_str_ext_const(enterprise, &sminmpec_values_ext, "Unknown"), enterprise); data_len = tvb_get_guint8(tvb, optoff + 4); @@ -1782,7 +1782,7 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, int voff, vti = proto_tree_add_text(v_tree, tvb, optoff, 4, "Enterprise-number: %s (%u)", - val_to_str( enterprise, sminmpec_values, "Unknown"), + val_to_str_ext_const( enterprise, &sminmpec_values_ext, "Unknown"), enterprise); s_option_len = tvb_get_guint8(tvb, optoff + 4); @@ -2105,7 +2105,7 @@ bootp_dhcp_decode_agent_info(proto_tree *v_tree, tvbuff_t *tvb, int optoff, datalen = tvb_get_guint8(tvb, suboptoff+4); vti = proto_tree_add_text(v_tree, tvb, suboptoff, 4 + datalen + 1, "Enterprise-number: %s (%u)", - val_to_str( enterprise, sminmpec_values, "Unknown"), + val_to_str_ext_const( enterprise, &sminmpec_values_ext, "Unknown"), enterprise); suboptoff += 4; diff --git a/epan/dissectors/packet-capwap.c b/epan/dissectors/packet-capwap.c index fd7687cb75..5d1fa80104 100644 --- a/epan/dissectors/packet-capwap.c +++ b/epan/dissectors/packet-capwap.c @@ -1660,7 +1660,7 @@ proto_register_capwap_control(void) NULL, HFILL }}, { &hf_capwap_control_header_msg_type_enterprise_nbr, { "Message Type (Enterprise Number)", "capwap.control.header.message_type.enterprise_number", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x00, NULL, HFILL }}, { &hf_capwap_control_header_msg_type_enterprise_specific, { "Message Type (Enterprise Specific)", "capwap.control.header.message_type.enterprise_specific", @@ -1763,7 +1763,7 @@ proto_register_capwap_control(void) { &hf_capwap_msg_element_type_ac_information_vendor, { "AC Information Vendor", "capwap.control.message_element.ac_information.vendor", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_information_type, { "AC Information Type", "capwap.control.message_element.ac_information.type", @@ -1884,7 +1884,7 @@ proto_register_capwap_control(void) NULL, HFILL }}, { &hf_capwap_msg_element_type_vsp_vendor_identifier, { "Vendor Identifier", "capwap.control.message_element.vsp.vendor_identifier", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_vsp_vendor_element_id, { "Vendor Element ID", "capwap.control.message_element.vsp.vendor_element_id", @@ -1897,7 +1897,7 @@ proto_register_capwap_control(void) { &hf_capwap_msg_element_type_wtp_board_data_vendor, { "WTP Board Data Vendor", "capwap.control.message_element.wtp_board_data.vendor", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_board_data_type, { "Board Data Type", "capwap.control.message_element.wtp_board_data.type", @@ -1959,7 +1959,7 @@ proto_register_capwap_control(void) NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_vendor, { "WTP Descriptor Vendor", "capwap.control.message_element.wtp_descriptor.vendor", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_type, { "Descriptor Type", "capwap.control.message_element.wtp_descriptor.type", diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index a47b0d1f98..c3a0c8a6aa 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -1930,13 +1930,13 @@ proto_register_dhcpv6(void) { &hf_clientfqdn_s, { "S bit", "dhcpv6.clientfqdn.s", FT_BOOLEAN, 8, TFS(&fqdn_s), 0x1, "Whether the server SHOULD or SHOULD NOT perform the AAAA RR (FQDN-to-address) DNS updates", HFILL}}, { &hf_remoteid_enterprise, - { "Enterprise ID", "dhvpv6.remoteid.enterprise", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0, "RemoteID Enterprise Number", HFILL }}, + { "Enterprise ID", "dhvpv6.remoteid.enterprise", FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, "RemoteID Enterprise Number", HFILL }}, { &hf_vendoropts_enterprise, - { "Enterprise ID", "dhvpv6.vendoropts.enterprise", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0, "Vendor opts Enterprise Number", HFILL }}, + { "Enterprise ID", "dhvpv6.vendoropts.enterprise", FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, "Vendor opts Enterprise Number", HFILL }}, { &hf_vendorclass_enterprise, - { "Enterprise ID", "dhvpv6.vendorclass.enterprise", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0, "Vendor Class Enterprise Number", HFILL }}, + { "Enterprise ID", "dhvpv6.vendorclass.enterprise", FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, "Vendor Class Enterprise Number", HFILL }}, { &hf_duiden_enterprise, - { "Enterprise ID", "dhvpv6.duiden.enterprise", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0, "DUID EN Enterprise Number", HFILL }}, + { "Enterprise ID", "dhvpv6.duiden.enterprise", FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, "DUID EN Enterprise Number", HFILL }}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index d1d7d286a4..6f55a9d8b1 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -1444,7 +1444,7 @@ proto_register_diameter(void) { "Reserved","diameter.flags.reserved7", FT_BOOLEAN, 8, TFS(&tfs_set_notset), DIAM_FLAGS_RESERVED7, NULL, HFILL }}, { &hf_diameter_vendor_id, - { "VendorId", "diameter.vendorId", FT_UINT32, BASE_DEC, VALS(sminmpec_values), + { "VendorId", "diameter.vendorId", FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0,NULL, HFILL }}, { &hf_diameter_application_id, { "ApplicationId", "diameter.applicationId", FT_UINT32, BASE_DEC, dictionary.applications, @@ -1489,8 +1489,8 @@ proto_register_diameter(void) { "Reserved","diameter.avp.flags.reserved7", FT_BOOLEAN, 8, TFS(&tfs_set_notset), AVP_FLAGS_RESERVED7, NULL, HFILL }}, { &hf_diameter_avp_vendor_id, - { "AVP Vendor Id","diameter.avp.vendorId", FT_UINT32, BASE_DEC, - VALS(sminmpec_values), 0x0, NULL, HFILL }}, + { "AVP Vendor Id","diameter.avp.vendorId", FT_UINT32, BASE_DEC|BASE_EXT_STRING, + &sminmpec_values_ext, 0x0, NULL, HFILL }}, { &(unknown_avp.hf_value), { "Value","diameter.avp.unknown", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index 67b10e4b36..8b699c23e8 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -6656,7 +6656,7 @@ void proto_register_gtp(void) {&hf_gtp_chrg_ipv4, {"CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Charging Gateway address IPv4", HFILL}}, {&hf_gtp_chrg_ipv6, {"CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Charging Gateway address IPv6", HFILL}}, {&hf_gtp_ext_flow_label, {"Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL}}, - {&hf_gtp_ext_id, {"Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC, VALS(sminmpec_values), 0, "Extension Identifier", HFILL}}, + {&hf_gtp_ext_id, {"Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, "Extension Identifier", HFILL}}, {&hf_gtp_ext_val, {"Extension value", "gtp.ext_val", FT_BYTES, BASE_NONE, NULL, 0, "Extension Value", HFILL}}, {&hf_gtp_flags, {"Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL}}, {&hf_gtp_flags_ver, diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c index 0ced4701ba..c5eb15a8a4 100644 --- a/epan/dissectors/packet-gtpv2.c +++ b/epan/dissectors/packet-gtpv2.c @@ -2181,7 +2181,7 @@ void proto_register_gtpv2(void) }, { &hf_gtpv2_enterprise_id, {"Enterprise ID", "gtpv2.enterprise_id", - FT_UINT16, BASE_DEC, VALS(sminmpec_values), 0x0, + FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0, NULL, HFILL} }, { &hf_gtpv2_address_digits, diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index 908ad87998..c3b0188e13 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -629,12 +629,12 @@ static void process_control_avps(tvbuff_t *tvb, } else if (avp_vendor_id == VENDOR_CISCO) { /* Vendor-Specific AVP */ tf = proto_tree_add_text(l2tp_tree, tvb, idx, avp_len, "Vendor %s: %s AVP", - val_to_str(avp_vendor_id, sminmpec_values, "Unknown (%u)"), + val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"), val_to_str(avp_type, cisco_avp_type_vals, "Unknown (%u)")); } else { /* Vendor-Specific AVP */ tf = proto_tree_add_text(l2tp_tree, tvb, idx, avp_len, "Vendor %s AVP Type %u", - val_to_str(avp_vendor_id, sminmpec_values, "Unknown (%u)"), + val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"), avp_type); } @@ -2020,7 +2020,7 @@ proto_register_l2tp(void) "AVP Length", HFILL }}, { &hf_l2tp_avp_vendor_id, - { "Vendor ID", "l2tp.avp.vendor_id", FT_UINT16, BASE_DEC, VALS(sminmpec_values), 0, + { "Vendor ID", "l2tp.avp.vendor_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, "AVP Vendor ID", HFILL }}, { &hf_l2tp_avp_type, diff --git a/epan/dissectors/packet-mip.c b/epan/dissectors/packet-mip.c index 211b328f56..639cbd1cad 100644 --- a/epan/dissectors/packet-mip.c +++ b/epan/dissectors/packet-mip.c @@ -1231,7 +1231,7 @@ void proto_register_mip(void) }, { &hf_mip_cvse_vendor_org_id, { "CVSE Vendor/org ID", "mip.ext.cvse.vendor_id", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0, + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, NULL, HFILL } }, { &hf_mip_cvse_verizon_cvse_type , diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c index 7a1f9811b4..ac4de06206 100644 --- a/epan/dissectors/packet-mip6.c +++ b/epan/dissectors/packet-mip6.c @@ -2107,7 +2107,7 @@ proto_register_mip6(void) NULL, HFILL }}, { &hf_mip6_vsm_vid, { "VendorId", "mip6.vsm.vendorId", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x0, + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0, NULL, HFILL }}, { &hf_mip6_vsm_subtype, { "Subtype", "mip6.vsm.subtype", diff --git a/epan/dissectors/packet-mpls-echo.c b/epan/dissectors/packet-mpls-echo.c index c0bdd336a5..5de090e415 100644 --- a/epan/dissectors/packet-mpls-echo.c +++ b/epan/dissectors/packet-mpls-echo.c @@ -1373,7 +1373,7 @@ proto_register_mpls_echo(void) }, { &hf_mpls_echo_tlv_vendor, { "Vendor Id", "mpls_echo.tlv.vendor_id", - FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x0, "MPLS ECHO Vendor Id", HFILL} + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0, "MPLS ECHO Vendor Id", HFILL} }, { &hf_mpls_echo_tlv_ilso_addr_type, { "Address Type", "mpls_echo.tlv.ilso.addr_type", diff --git a/epan/dissectors/packet-netflow.c b/epan/dissectors/packet-netflow.c index 62fd7f7917..902dfd6b4e 100644 --- a/epan/dissectors/packet-netflow.c +++ b/epan/dissectors/packet-netflow.c @@ -4056,7 +4056,7 @@ dissect_v9_v10_template_fields(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree length = tvb_get_ntohs(tvb,offset+2); /* XXX: 0 length should not be allowed ? exception: "ScopeSystem" */ if ((ver == 10) && (type & 0x8000)) { /* IPFIX only */ pen = tvb_get_ntohl(tvb,offset+4); - pen_str = val_to_str_const(pen, sminmpec_values, "(Unknown)"); + pen_str = val_to_str_ext_const(pen, &sminmpec_values_ext, "(Unknown)"); } if (tplt->fields[fields_type] != NULL) { diff --git a/epan/dissectors/packet-nhrp.c b/epan/dissectors/packet-nhrp.c index 2b7d9e4e59..7604d6d96b 100644 --- a/epan/dissectors/packet-nhrp.c +++ b/epan/dissectors/packet-nhrp.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 0605bffda9..db08795e00 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -955,7 +955,7 @@ static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, if (vendor) { vendor_str = vendor->name; } else { - vendor_str = val_to_str(vendor_id, sminmpec_values, "Unknown"); + vendor_str = val_to_str_ext_const(vendor_id, &sminmpec_values_ext, "Unknown"); vendor = &no_vendor; } proto_item_append_text(avp_item, " v=%s(%u)", vendor_str, @@ -1776,7 +1776,9 @@ extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_i if ( ! vendor ) { vendor = g_malloc(sizeof(radius_vendor_info_t)); - vendor->name = g_strdup_printf("%s-%u",val_to_str(vendor_id, sminmpec_values, "Unknown"),vendor_id); + vendor->name = g_strdup_printf("%s-%u", + val_to_str_ext_const(vendor_id, &sminmpec_values_ext, "Unknown"), + vendor_id); vendor->code = vendor_id; vendor->attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal); vendor->ett = no_vendor.ett; diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index 178ab9114f..116773ccf2 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -3235,8 +3235,8 @@ void proto_register_snmp(void) { "Engine ID Conformance", "snmp.engineid.conform", FT_BOOLEAN, 8, TFS(&tfs_snmp_engineid_conform), F_SNMP_ENGINEID_CONFORM, "Engine ID RFC3411 Conformance", HFILL }}, { &hf_snmp_engineid_enterprise, { - "Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC, - VALS(sminmpec_values), 0, NULL, HFILL }}, + "Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC|BASE_RANGE_STRING, + &sminmpec_values_ext, 0, NULL, HFILL }}, { &hf_snmp_engineid_format, { "Engine ID Format", "snmp.engineid.format", FT_UINT8, BASE_DEC, VALS(snmp_engineid_format_vals), 0, NULL, HFILL }}, diff --git a/epan/libwireshark.def b/epan/libwireshark.def index 4ec02fb40d..d60ff418f6 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -934,7 +934,7 @@ sid_name_table DATA smb2_cmd_vals DATA smb_cmd_vals DATA smb_fid_types DATA -sminmpec_values DATA +sminmpec_values_ext DATA srtcp_add_address srtp_add_address ssl_dissector_add @@ -1130,7 +1130,9 @@ UnregRejectReason_vals DATA UnregRequestReason_vals DATA uri_str_to_bytes val_to_str +val_to_str_const val_to_str_ext +val_to_str_ext_const vals_pdu_type DATA vals_status DATA value_is_in_range diff --git a/epan/sminmpec.h b/epan/sminmpec.h index 6bf69aeb43..76ca22ecaf 100644 --- a/epan/sminmpec.h +++ b/epan/sminmpec.h @@ -80,6 +80,6 @@ #define VENDOR_CACE 32622 -WS_VAR_IMPORT const value_string sminmpec_values[]; +WS_VAR_IMPORT value_string_ext sminmpec_values_ext; #endif /* __SMINMPEC_H__ */ diff --git a/epan/value_string.c b/epan/value_string.c index b5d12a8998..91c22bbda7 100644 --- a/epan/value_string.c +++ b/epan/value_string.c @@ -158,12 +158,11 @@ match_strval_ext_init(const guint32 val, value_string_ext *vse) const value_string *vals = vse->vals; /* The way matching of value is done in a value_string: - * 0 default, value will be set in proto_register_field_init() - * 1 Sequential search (as in a normal value string) + * 0 Sequential search (as in a normal value string) + * 1 Binary search, the values MUST be in numerical order. * 2 The value used as an index(the value string MUST have all values 0-max defined) - * 3 Binary search, the valuse MUST be in numerical order. */ - enum { VS_SEARCH = 0, VS_INDEX, VS_BIN_TREE } type = VS_INDEX; + enum { VS_SEARCH = 0, VS_BIN_TREE, VS_INDEX } type = VS_INDEX; guint32 prev = 0; guint i; -- cgit v1.2.3