aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bthfp.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-bthfp.c')
-rw-r--r--epan/dissectors/packet-bthfp.c330
1 files changed, 164 insertions, 166 deletions
diff --git a/epan/dissectors/packet-bthfp.c b/epan/dissectors/packet-bthfp.c
index bb267fec9f..2e6bc45138 100644
--- a/epan/dissectors/packet-bthfp.c
+++ b/epan/dissectors/packet-bthfp.c
@@ -20,161 +20,162 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
+#include <epan/strutil.h>
#include "packet-btrfcomm.h"
#include "packet-btsdp.h"
-static int proto_bthfp = -1;
-
-static int hf_command = -1;
-static int hf_parameters = -1;
-static int hf_role = -1;
-static int hf_at_cmd = -1;
-static int hf_at_cmd_type = -1;
-static int hf_at_command_line_prefix = -1;
-static int hf_at_ignored = -1;
-static int hf_parameter = -1;
-static int hf_unknown_parameter = -1;
-static int hf_data = -1;
-static int hf_fragment = -1;
-static int hf_fragmented = -1;
-static int hf_brsf_hs = -1;
-static int hf_brsf_hs_ec_nr_function = -1;
-static int hf_brsf_hs_call_waiting_or_tree_way = -1;
-static int hf_brsf_hs_cli_presentation = -1;
-static int hf_brsf_hs_voice_recognition_activation = -1;
-static int hf_brsf_hs_remote_volume_control = -1;
-static int hf_brsf_hs_enhanced_call_status = -1;
-static int hf_brsf_hs_enhanced_call_control = -1;
-static int hf_brsf_hs_codec_negotiation = -1;
-static int hf_brsf_hs_hf_indicators = -1;
-static int hf_brsf_hs_esco_s4_t2_settings_support = -1;
-static int hf_brsf_hs_reserved = -1;
-static int hf_brsf_ag = -1;
-static int hf_brsf_ag_three_way_calling = -1;
-static int hf_brsf_ag_ec_nr_function = -1;
-static int hf_brsf_ag_voice_recognition_function = -1;
-static int hf_brsf_ag_inband_ring_tone = -1;
-static int hf_brsf_ag_attach_number_to_voice_tag = -1;
-static int hf_brsf_ag_ability_to_reject_a_call = -1;
-static int hf_brsf_ag_enhanced_call_status = -1;
-static int hf_brsf_ag_enhanced_call_control = -1;
-static int hf_brsf_ag_extended_error_result_codes = -1;
-static int hf_brsf_ag_codec_negotiation = -1;
-static int hf_brsf_ag_hf_indicators = -1;
-static int hf_brsf_ag_esco_s4_t2_settings_support = -1;
-static int hf_brsf_ag_reserved = -1;
-static int hf_vgs = -1;
-static int hf_vgm = -1;
-static int hf_nrec = -1;
-static int hf_bvra_vrect = -1;
-static int hf_bsir = -1;
-static int hf_btrh = -1;
-static int hf_chld_mode = -1;
-static int hf_chld_mode_1x = -1;
-static int hf_chld_mode_2x = -1;
-static int hf_chld_supported_modes = -1;
-static int hf_cmer_mode = -1;
-static int hf_cmer_keyp = -1;
-static int hf_cmer_disp = -1;
-static int hf_cmer_ind = -1;
-static int hf_cmer_bfr = -1;
-static int hf_cmee = -1;
-static int hf_cme_error = -1;
-static int hf_cnum_speed = -1;
-static int hf_cnum_service = -1;
-static int hf_cnum_itc = -1;
-static int hf_bcs_codec = -1;
-static int hf_bac_codec = -1;
-static int hf_binp_request = -1;
-static int hf_binp_response = -1;
-static int hf_ciev_indicator_index = -1;
-static int hf_vts_dtmf = -1;
-static int hf_vts_duration = -1;
-static int hf_cops_mode = -1;
-static int hf_cops_format = -1;
-static int hf_cops_operator = -1;
-static int hf_cops_act = -1;
-static int hf_at_number = -1;
-static int hf_at_type = -1;
-static int hf_at_subaddress = -1;
-static int hf_at_subaddress_type = -1;
-static int hf_at_alpha = -1;
-static int hf_at_priority = -1;
-static int hf_at_cli_validity = -1;
-static int hf_clip_mode = -1;
-static int hf_clip_status = -1;
-static int hf_clcc_id = -1;
-static int hf_clcc_dir = -1;
-static int hf_clcc_stat = -1;
-static int hf_clcc_mode = -1;
-static int hf_clcc_mpty = -1;
-static int hf_ccwa_show_result_code = -1;
-static int hf_ccwa_mode = -1;
-static int hf_ccwa_class = -1;
-static int hf_biev_assigned_number = -1;
-static int hf_biev_value = -1;
-static int hf_bind_parameter = -1;
-static int hf_bia_indicator[20] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
-static int hf_indicator[20] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
-static int hf_aplefm_state = -1;
-static int hf_aplsiri_state = -1;
-static int hf_iphoneaccev_count = -1;
-static int hf_iphoneaccev_key = -1;
-static int hf_iphoneaccev_value = -1;
-static int hf_xapl_accessory_info = -1;
-static int hf_xapl_accessory_info_vendor_id = -1;
-static int hf_xapl_accessory_info_product_id = -1;
-static int hf_xapl_accessory_info_version = -1;
-static int hf_xapl_host_info = -1;
-static int hf_xapl_features = -1;
-static int hf_xapl_features_reserved_x = -1;
-static int hf_xapl_features_noise_reduction_status_reporting = -1;
-static int hf_xapl_features_siri_status_reporting = -1;
-static int hf_xapl_features_docked_or_powered = -1;
-static int hf_xapl_features_battery_reporting = -1;
-static int hf_xapl_features_reserved = -1;
-
-static expert_field ei_non_mandatory_command = EI_INIT;
-static expert_field ei_invalid_usage = EI_INIT;
-static expert_field ei_unknown_parameter = EI_INIT;
-static expert_field ei_brfs_hs_reserved_bits = EI_INIT;
-static expert_field ei_brfs_ag_reserved_bits = EI_INIT;
-static expert_field ei_vgm_gain = EI_INIT;
-static expert_field ei_vgs_gain = EI_INIT;
-static expert_field ei_nrec = EI_INIT;
-static expert_field ei_bvra = EI_INIT;
-static expert_field ei_bcs = EI_INIT;
-static expert_field ei_bac = EI_INIT;
-static expert_field ei_bsir = EI_INIT;
-static expert_field ei_btrh = EI_INIT;
-static expert_field ei_binp = EI_INIT;
-static expert_field ei_biev_assigned_number = EI_INIT;
-static expert_field ei_biev_assigned_number_no = EI_INIT;
-static expert_field ei_bia = EI_INIT;
-static expert_field ei_cmer_mode = EI_INIT;
-static expert_field ei_cmer_keyp = EI_INIT;
-static expert_field ei_cmer_disp = EI_INIT;
-static expert_field ei_cmer_ind = EI_INIT;
-static expert_field ei_cmer_btr = EI_INIT;
-static expert_field ei_chld_mode = EI_INIT;
-static expert_field ei_ciev_indicator = EI_INIT;
-static expert_field ei_vts_dtmf = EI_INIT;
-static expert_field ei_at_type = EI_INIT;
-static expert_field ei_cnum_service = EI_INIT;
-static expert_field ei_cnum_itc = EI_INIT;
-static expert_field ei_aplefm_out_of_range = EI_INIT;
-static expert_field ei_aplsiri_out_of_range = EI_INIT;
-static expert_field ei_iphoneaccev_key_out_of_range = EI_INIT;
-static expert_field ei_xapl_features_reserved = EI_INIT;
-static expert_field ei_parameter_blank = EI_INIT;
-
-static gint ett_bthfp = -1;
-static gint ett_bthfp_command = -1;
-static gint ett_bthfp_parameters = -1;
-static gint ett_bthfp_brsf_hf = -1;
-static gint ett_bthfp_brsf_ag = -1;
-static gint ett_bthfp_xapl_features = -1;
-static gint ett_bthfp_xapl_accessory_info = -1;
+static int proto_bthfp;
+
+static int hf_command;
+static int hf_parameters;
+static int hf_role;
+static int hf_at_cmd;
+static int hf_at_cmd_type;
+static int hf_at_command_line_prefix;
+static int hf_at_ignored;
+static int hf_parameter;
+static int hf_unknown_parameter;
+static int hf_data;
+static int hf_fragment;
+static int hf_fragmented;
+static int hf_brsf_hs;
+static int hf_brsf_hs_ec_nr_function;
+static int hf_brsf_hs_call_waiting_or_tree_way;
+static int hf_brsf_hs_cli_presentation;
+static int hf_brsf_hs_voice_recognition_activation;
+static int hf_brsf_hs_remote_volume_control;
+static int hf_brsf_hs_enhanced_call_status;
+static int hf_brsf_hs_enhanced_call_control;
+static int hf_brsf_hs_codec_negotiation;
+static int hf_brsf_hs_hf_indicators;
+static int hf_brsf_hs_esco_s4_t2_settings_support;
+static int hf_brsf_hs_reserved;
+static int hf_brsf_ag;
+static int hf_brsf_ag_three_way_calling;
+static int hf_brsf_ag_ec_nr_function;
+static int hf_brsf_ag_voice_recognition_function;
+static int hf_brsf_ag_inband_ring_tone;
+static int hf_brsf_ag_attach_number_to_voice_tag;
+static int hf_brsf_ag_ability_to_reject_a_call;
+static int hf_brsf_ag_enhanced_call_status;
+static int hf_brsf_ag_enhanced_call_control;
+static int hf_brsf_ag_extended_error_result_codes;
+static int hf_brsf_ag_codec_negotiation;
+static int hf_brsf_ag_hf_indicators;
+static int hf_brsf_ag_esco_s4_t2_settings_support;
+static int hf_brsf_ag_reserved;
+static int hf_vgs;
+static int hf_vgm;
+static int hf_nrec;
+static int hf_bvra_vrect;
+static int hf_bsir;
+static int hf_btrh;
+static int hf_chld_mode;
+static int hf_chld_mode_1x;
+static int hf_chld_mode_2x;
+static int hf_chld_supported_modes;
+static int hf_cmer_mode;
+static int hf_cmer_keyp;
+static int hf_cmer_disp;
+static int hf_cmer_ind;
+static int hf_cmer_bfr;
+static int hf_cmee;
+static int hf_cme_error;
+static int hf_cnum_speed;
+static int hf_cnum_service;
+static int hf_cnum_itc;
+static int hf_bcs_codec;
+static int hf_bac_codec;
+static int hf_binp_request;
+static int hf_binp_response;
+static int hf_ciev_indicator_index;
+static int hf_vts_dtmf;
+static int hf_vts_duration;
+static int hf_cops_mode;
+static int hf_cops_format;
+static int hf_cops_operator;
+static int hf_cops_act;
+static int hf_at_number;
+static int hf_at_type;
+static int hf_at_subaddress;
+static int hf_at_subaddress_type;
+static int hf_at_alpha;
+static int hf_at_priority;
+static int hf_at_cli_validity;
+static int hf_clip_mode;
+static int hf_clip_status;
+static int hf_clcc_id;
+static int hf_clcc_dir;
+static int hf_clcc_stat;
+static int hf_clcc_mode;
+static int hf_clcc_mpty;
+static int hf_ccwa_show_result_code;
+static int hf_ccwa_mode;
+static int hf_ccwa_class;
+static int hf_biev_assigned_number;
+static int hf_biev_value;
+static int hf_bind_parameter;
+static int hf_bia_indicator[20];
+static int hf_indicator[20];
+static int hf_aplefm_state;
+static int hf_aplsiri_state;
+static int hf_iphoneaccev_count;
+static int hf_iphoneaccev_key;
+static int hf_iphoneaccev_value;
+static int hf_xapl_accessory_info;
+static int hf_xapl_accessory_info_vendor_id;
+static int hf_xapl_accessory_info_product_id;
+static int hf_xapl_accessory_info_version;
+static int hf_xapl_host_info;
+static int hf_xapl_features;
+static int hf_xapl_features_reserved_x;
+static int hf_xapl_features_noise_reduction_status_reporting;
+static int hf_xapl_features_siri_status_reporting;
+static int hf_xapl_features_docked_or_powered;
+static int hf_xapl_features_battery_reporting;
+static int hf_xapl_features_reserved;
+
+static expert_field ei_non_mandatory_command;
+static expert_field ei_invalid_usage;
+static expert_field ei_unknown_parameter;
+static expert_field ei_brfs_hs_reserved_bits;
+static expert_field ei_brfs_ag_reserved_bits;
+static expert_field ei_vgm_gain;
+static expert_field ei_vgs_gain;
+static expert_field ei_nrec;
+static expert_field ei_bvra;
+static expert_field ei_bcs;
+static expert_field ei_bac;
+static expert_field ei_bsir;
+static expert_field ei_btrh;
+static expert_field ei_binp;
+static expert_field ei_biev_assigned_number;
+static expert_field ei_biev_assigned_number_no;
+static expert_field ei_bia;
+static expert_field ei_cmer_mode;
+static expert_field ei_cmer_keyp;
+static expert_field ei_cmer_disp;
+static expert_field ei_cmer_ind;
+static expert_field ei_cmer_btr;
+static expert_field ei_chld_mode;
+static expert_field ei_ciev_indicator;
+static expert_field ei_vts_dtmf;
+static expert_field ei_at_type;
+static expert_field ei_cnum_service;
+static expert_field ei_cnum_itc;
+static expert_field ei_aplefm_out_of_range;
+static expert_field ei_aplsiri_out_of_range;
+static expert_field ei_iphoneaccev_key_out_of_range;
+static expert_field ei_xapl_features_reserved;
+static expert_field ei_parameter_blank;
+
+static gint ett_bthfp;
+static gint ett_bthfp_command;
+static gint ett_bthfp_parameters;
+static gint ett_bthfp_brsf_hf;
+static gint ett_bthfp_brsf_ag;
+static gint ett_bthfp_xapl_features;
+static gint ett_bthfp_xapl_accessory_info;
static dissector_handle_t bthfp_handle;
@@ -325,7 +326,7 @@ static const value_string cme_error_vals[] = {
{ 40, "Network Personalization PIN Required" },
{ 41, "Network Personalization PUK Required" },
{ 42, "Network Subset Personalization PIN Required" },
- { 43, "Network Subset upersonalization PUK Required" },
+ { 43, "Network Subset Personalization PUK Required" },
{ 44, "Service Provider Personalization PIN Required" },
{ 45, "Service Provider Personalization PUK Required" },
{ 46, "Corporate Personalization PIN Required" },
@@ -378,7 +379,7 @@ static const value_string cops_act_vals[] = {
static const range_string at_type_vals[] = {
{ 128, 143, "The phone number format may be a national or international format, and may contain prefix and/or escape digits. No changes on the number presentation are required." },
- { 144, 159, " The phone number format is an international number, including the country code prefix. If the plus sign (\"+\") is not included as part of the number and shall be added by the AG as needed." },
+ { 144, 159, "The phone number format is an international number, including the country code prefix. If the plus sign (\"+\") is not included as part of the number and shall be added by the AG as needed." },
{ 160, 175, "National number. No prefix nor escape digits included." },
{ 0, 0, NULL }
};
@@ -1716,7 +1717,7 @@ dissect_ciev_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case 0:
value = get_uint_parameter(parameter_stream, parameter_length);
proto_tree_add_uint(tree, hf_ciev_indicator_index, tvb, offset, parameter_length, value);
- *data = wmem_alloc(wmem_packet_scope(), sizeof(guint));
+ *data = wmem_alloc(pinfo->pool, sizeof(guint));
*((guint *) *data) = value;
break;
case 1:
@@ -1813,12 +1814,12 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (!command_number) {
proto_tree_add_item(tree, hf_data, tvb, offset, length, ENC_NA | ENC_ASCII);
- col_str = (guint8 *) wmem_alloc(wmem_packet_scope(), length + 1);
+ col_str = (guint8 *) wmem_alloc(pinfo->pool, length + 1);
tvb_memcpy(tvb, col_str, offset, length);
col_str[length] = '\0';
}
- at_stream = (guint8 *) wmem_alloc(wmem_packet_scope(), length + 1);
+ at_stream = (guint8 *) wmem_alloc(pinfo->pool, length + 1);
tvb_memcpy(tvb, at_stream, offset, length);
at_stream[length] = '\0';
@@ -1919,9 +1920,7 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (i_at_cmd && i_at_cmd->name == NULL) {
char *name;
- name = (char *) wmem_alloc(wmem_packet_scope(), i_char + 2);
- (void) g_strlcpy(name, at_command, i_char + 1);
- name[i_char + 1] = '\0';
+ name = format_text(pinfo->pool, at_command, i_char + 1);
proto_item_append_text(command_item, ": %s (Unknown)", name);
proto_item_append_text(pitem, " (Unknown - Non-Standard HFP Command)");
expert_add_info(pinfo, pitem, &ei_non_mandatory_command);
@@ -2277,7 +2276,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* Detect reassemble end character: \r for HS or \n for AG */
length = tvb_reported_length(tvb);
- at_stream = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, length, ENC_ASCII);
+ at_stream = tvb_get_string_enc(pinfo->pool, tvb, 0, length, ENC_ASCII);
reassemble_start_offset = 0;
@@ -2438,12 +2437,11 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
}
} else {
- col_append_fstr(pinfo->cinfo, COL_INFO, "Fragment: %s",
- tvb_format_text_wsp(wmem_packet_scope(), tvb, offset, tvb_captured_length_remaining(tvb, offset)));
pitem = proto_tree_add_item(main_tree, hf_fragmented, tvb, 0, 0, ENC_NA);
proto_item_set_generated(pitem);
- proto_tree_add_item(main_tree, hf_fragment, tvb, offset,
- tvb_captured_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
+ char *display_str;
+ proto_tree_add_item_ret_display_string(main_tree, hf_fragment, tvb, offset, -1, ENC_ASCII, pinfo->pool, &display_str);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Fragment: %s", display_str);
offset = tvb_captured_length(tvb);
}
@@ -3134,7 +3132,7 @@ proto_register_bthfp(void)
},
{ &hf_xapl_accessory_info_vendor_id,
{ "Vendor ID", "bthfp.xapl.accessory_info.vendor_id",
- FT_UINT16, BASE_HEX, NULL, 0,
+ FT_UINT32, BASE_HEX, NULL, 0,
NULL, HFILL}
},
{ &hf_xapl_accessory_info_product_id,