1 /* packet-bthci_evt.c
2  * Routines for the Bluetooth HCI Event dissection
3  * Copyright 2002, Christoph Scholz <scholz@cs.uni-bonn.de>
4  *  From: http://affix.sourceforge.net/archive/ethereal_affix-3.patch
5  *
6  * Refactored for wireshark checkin
7  *   Ronnie Sahlberg 2006
8  *
9  * Updated to HCI specification 2.1 + EDR
10  *   Allan M. Madsen 2007
11  * Updated to HCI specification 3.0+HS & 4.0
12  *   Allan M. Madsen 2012
13  *
14  * Wireshark - Network traffic analyzer
15  * By Gerald Combs <gerald@wireshark.org>
16  * Copyright 1998 Gerald Combs
17  *
18  * SPDX-License-Identifier: GPL-2.0-or-later
19  */
20 
21 #include "config.h"
22 
23 #include <epan/packet.h>
24 #include <epan/addr_resolv.h>
25 #include <epan/expert.h>
26 #include <epan/prefs.h>
27 #include <epan/decode_as.h>
28 #include <epan/tap.h>
29 #include <epan/proto_data.h>
30 
31 #include <wsutil/utf8_entities.h>
32 
33 #include "packet-bluetooth.h"
34 #include "packet-bthci_sco.h"
35 #include "packet-bthci_cmd.h"
36 #include "packet-bthci_evt.h"
37 
38 static dissector_handle_t bthci_cmd_handle;
39 static dissector_handle_t bthci_evt_handle;
40 static dissector_handle_t btcommon_cod_handle;
41 static dissector_handle_t btcommon_eir_handle;
42 static dissector_handle_t btcommon_ad_handle;
43 static dissector_handle_t btcommon_le_channel_map_handle;
44 
45 /* Initialize the protocol and registered fields */
46 static int proto_bthci_evt = -1;
47 static int hf_bthci_evt_code = -1;
48 static int hf_bthci_evt_param_length = -1;
49 static int hf_bthci_evt_num_command_packets = -1;
50 static int hf_bthci_evt_num_handles = -1;
51 static int hf_bthci_evt_connection_handle = -1;
52 static int hf_bthci_evt_num_compl_packets = -1;
53 static int hf_bthci_evt_ret_params = -1;
54 static int hf_bthci_evt_status = -1;
55 static int hf_bthci_evt_status_pending = -1;
56 static int hf_bthci_evt_opcode = -1;
57 static int hf_bthci_evt_ogf = -1;
58 static int hf_bthci_evt_ocf = -1;
59 static int hf_bthci_evt_ocf_link_control = -1;
60 static int hf_bthci_evt_ocf_link_policy = -1;
61 static int hf_bthci_evt_ocf_host_controller_and_baseband = -1;
62 static int hf_bthci_evt_ocf_informational = -1;
63 static int hf_bthci_evt_ocf_status = -1;
64 static int hf_bthci_evt_ocf_testing = -1;
65 static int hf_bthci_evt_ocf_logo_testing = -1;
66 static int hf_bthci_evt_ocf_low_energy = -1;
67 static int hf_bthci_evt_bd_addr = -1;
68 static int hf_bthci_evt_link_type = -1;
69 static int hf_bthci_evt_encryption_mode = -1;
70 static int hf_bthci_evt_reason = -1;
71 static int hf_bthci_evt_remote_name = -1;
72 static int hf_bthci_evt_encryption_enable = -1;
73 static int hf_bthci_evt_key_flag = -1;
74 static int hf_bthci_evt_vers_nr = -1;
75 static int hf_bthci_bthci_evt_hci_version = -1;
76 static int hf_bthci_evt_hci_revision = -1;
77 static int hf_bthci_evt_comp_id = -1;
78 static int hf_bthci_evt_sub_vers_nr = -1;
79 static int hf_bthci_evt_flags = -1;
80 static int hf_bthci_evt_service_type = -1;
81 static int hf_bthci_evt_token_rate = -1;
82 static int hf_bthci_evt_peak_bandwidth = -1;
83 static int hf_bthci_evt_latency = -1;
84 static int hf_bthci_evt_delay_variation = -1;
85 static int hf_bthci_evt_hardware_code = -1;
86 static int hf_bthci_evt_role = -1;
87 static int hf_bthci_evt_curr_role = -1;
88 static int hf_bthci_evt_curr_mode = -1;
89 static int hf_bthci_evt_interval = -1;
90 static int hf_bthci_evt_link_key = -1;
91 static int hf_bthci_evt_key_type = -1;
92 static int hf_bthci_evt_max_slots = -1;
93 static int hf_bthci_evt_clock_offset = -1;
94 static int hf_bthci_evt_clock_offset_32 = -1;
95 static int hf_bthci_evt_page_scan_mode = -1;
96 static int hf_bthci_evt_page_scan_repetition_mode = -1;
97 static int hf_bthci_evt_reserved = -1;
98 static int hf_bthci_evt_page_scan_period_mode = -1;
99 static int hf_bthci_evt_num_keys = -1;
100 static int hf_bthci_evt_num_keys_read = -1;
101 static int hf_bthci_evt_max_num_keys = -1;
102 static int hf_bthci_evt_num_responses = -1;
103 static int hf_bthci_evt_num_keys_written = -1;
104 static int hf_bthci_evt_num_keys_deleted = -1;
105 static int hf_bthci_evt_link_policy_setting_switch = -1;
106 static int hf_bthci_evt_link_policy_setting_hold = -1;
107 static int hf_bthci_evt_link_policy_setting_sniff = -1;
108 static int hf_bthci_evt_link_policy_setting_park = -1;
109 static int hf_bthci_evt_pin_type = -1;
110 static int hf_bthci_evt_device_name = -1;
111 static int hf_bthci_evt_timeout = -1;
112 static int hf_bthci_evt_scan_enable = -1;
113 static int hf_bthci_evt_authentication_enable = -1;
114 static int hf_bthci_evt_sco_flow_cont_enable = -1;
115 static int hf_bthci_evt_window = -1;
116 static int hf_bthci_evt_input_unused = -1;
117 static int hf_bthci_evt_input_coding = -1;
118 static int hf_bthci_evt_input_data_format = -1;
119 static int hf_bthci_evt_input_sample_size = -1;
120 static int hf_bthci_evt_linear_pcm_bit_pos = -1;
121 static int hf_bthci_evt_air_coding_format = -1;
122 static int hf_bthci_evt_num_broadcast_retransm = -1;
123 static int hf_bthci_evt_hold_mode_act_page = -1;
124 static int hf_bthci_evt_hold_mode_act_inquiry = -1;
125 static int hf_bthci_evt_hold_mode_act_periodic = -1;
126 static int hf_bthci_evt_transmit_power_level = -1;
127 static int hf_bthci_evt_max_transmit_power_level = -1;
128 static int hf_bthci_evt_transmit_power_level_gfsk = -1;
129 static int hf_bthci_evt_transmit_power_level_dqpsk = -1;
130 static int hf_bthci_evt_transmit_power_level_8dpsk = -1;
131 static int hf_bthci_evt_flush_to_us = -1;
132 static int hf_bthci_evt_num_supp_iac = -1;
133 static int hf_bthci_evt_num_curr_iac = -1;
134 static int hf_bthci_evt_iac_lap = -1;
135 static int hf_bthci_evt_loopback_mode = -1;
136 static int hf_bthci_evt_country_code = -1;
137 static int hf_bthci_evt_failed_contact_counter = -1;
138 static int hf_bthci_evt_link_quality = -1;
139 static int hf_bthci_evt_rssi = -1;
140 static int hf_bthci_evt_host_data_packet_length_acl = -1;
141 static int hf_bthci_evt_host_data_packet_length_sco = -1;
142 static int hf_bthci_evt_host_total_num_acl_data_packets = -1;
143 static int hf_bthci_evt_host_total_num_sco_data_packets = -1;
144 static int hf_bthci_evt_page_number = -1;
145 static int hf_bthci_evt_max_page_number = -1;
146 static int hf_bthci_evt_local_supported_cmds = -1;
147 static int hf_bthci_evt_fec_required = -1;
148 static int hf_bthci_evt_err_data_reporting = -1;
149 static int hf_bthci_evt_scan_type = -1;
150 static int hf_bthci_evt_inq_mode = -1;
151 static int hf_bthci_evt_power_level_type = -1;
152 static int hf_lmp_features = -1;
153 static int hf_lmp_feature_3slot_packets = -1;
154 static int hf_lmp_feature_5slot_packets = -1;
155 static int hf_lmp_feature_encryption = -1;
156 static int hf_lmp_feature_slot_offset = -1;
157 static int hf_lmp_feature_timing_accuracy = -1;
158 static int hf_lmp_feature_role_switch = -1;
159 static int hf_lmp_feature_hold_mode = -1;
160 static int hf_lmp_feature_sniff_mode = -1;
161 static int hf_lmp_feature_park_state = -1;
162 static int hf_lmp_feature_power_control_requests = -1;
163 static int hf_lmp_feature_channel_quality_driven_data_rate = -1;
164 static int hf_lmp_feature_sco_link = -1;
165 static int hf_lmp_feature_hv2_packets = -1;
166 static int hf_lmp_feature_hv3_packets = -1;
167 static int hf_lmp_feature_u_law_log_synchronous_data = -1;
168 static int hf_lmp_feature_a_law_log_synchronous_data = -1;
169 static int hf_lmp_feature_cvsd_synchronous_data = -1;
170 static int hf_lmp_feature_paging_parameter_negotiation = -1;
171 static int hf_lmp_feature_power_control = -1;
172 static int hf_lmp_feature_transparent_synchronous_data = -1;
173 static int hf_lmp_feature_flow_control_lag = -1;
174 static int hf_lmp_feature_broadcast_encryption = -1;
175 static int hf_lmp_feature_reserved_24 = -1;
176 static int hf_lmp_feature_edr_acl_2mbps_mode = -1;
177 static int hf_lmp_feature_edr_acl_3mbps_mode = -1;
178 static int hf_lmp_feature_enhanced_inquiry_scan = -1;
179 static int hf_lmp_feature_interlaced_inquiry_scan = -1;
180 static int hf_lmp_feature_interlaced_page_scan = -1;
181 static int hf_lmp_feature_rssi_with_inquiry_results = -1;
182 static int hf_lmp_feature_ev3_packets = -1;
183 static int hf_lmp_feature_ev4_packets = -1;
184 static int hf_lmp_feature_ev5_packets = -1;
185 static int hf_lmp_feature_reserved_34 = -1;
186 static int hf_lmp_feature_afh_capable_slave = -1;
187 static int hf_lmp_feature_afh_classification_slave = -1;
188 static int hf_lmp_feature_br_edr_not_supported = -1;
189 static int hf_lmp_feature_le_supported_controller = -1;
190 static int hf_lmp_feature_3slot_edr_acl_packets = -1;
191 static int hf_lmp_feature_5slot_edr_acl_packets = -1;
192 static int hf_lmp_feature_sniff_subrating = -1;
193 static int hf_lmp_feature_pause_encryption = -1;
194 static int hf_lmp_feature_afh_capable_master = -1;
195 static int hf_lmp_feature_afh_classification_master = -1;
196 static int hf_lmp_feature_edr_esco_2mbps_mode = -1;
197 static int hf_lmp_feature_edr_esco_3mbps_mode = -1;
198 static int hf_lmp_feature_3slot_edr_esco_packets = -1;
199 static int hf_lmp_feature_extended_inquiry_response = -1;
200 static int hf_lmp_feature_simultaneous_le_and_br_edr_controller = -1;
201 static int hf_lmp_feature_reserved_50 = -1;
202 static int hf_lmp_feature_secure_simple_pairing = -1;
203 static int hf_lmp_feature_encapsulated_pdu = -1;
204 static int hf_lmp_feature_erroneous_data_reporting = -1;
205 static int hf_lmp_feature_non_flushable_packet_boundary_flag = -1;
206 static int hf_lmp_feature_reserved_55 = -1;
207 static int hf_lmp_feature_link_supervision_timeout_changed_event = -1;
208 static int hf_lmp_feature_inquiry_tx_power_level = -1;
209 static int hf_lmp_feature_enhanced_power_control = -1;
210 static int hf_lmp_feature_reserved_59_62 = -1;
211 static int hf_lmp_feature_extended_features = -1;
212 static int hf_lmp_feature_secure_simple_pairing_host = -1;
213 static int hf_lmp_feature_le_supported_host = -1;
214 static int hf_lmp_feature_simultaneous_le_and_br_edr_host = -1;
215 static int hf_lmp_feature_secure_connections_host = -1;
216 static int hf_lmp_feature_reserved_68_71 = -1;
217 static int hf_lmp_feature_csb_master_operation = -1;
218 static int hf_lmp_feature_csb_slave_operation = -1;
219 static int hf_lmp_feature_synchronization_train = -1;
220 static int hf_lmp_feature_synchronization_scan = -1;
221 static int hf_lmp_feature_inquiry_response_notification_event = -1;
222 static int hf_lmp_feature_generalized_interlaced_scan = -1;
223 static int hf_lmp_feature_coarse_clock_adjustment = -1;
224 static int hf_lmp_feature_reserved_135 = -1;
225 static int hf_lmp_feature_secure_connections_controller = -1;
226 static int hf_lmp_feature_ping = -1;
227 static int hf_lmp_feature_reserved_138 = -1;
228 static int hf_lmp_feature_train_nudging = -1;
229 static int hf_lmp_feature_slot_availability_mask = -1;
230 static int hf_lmp_feature_reserved = -1;
231 static int hf_bthci_evt_sync_link_type = -1;
232 static int hf_bthci_evt_sync_tx_interval = -1;
233 static int hf_bthci_evt_sync_rtx_window = -1;
234 static int hf_bthci_evt_sync_rx_packet_length = -1;
235 static int hf_bthci_evt_sync_tx_packet_length = -1;
236 static int hf_bthci_evt_air_mode = -1;
237 static int hf_bthci_evt_max_tx_latency = -1;
238 static int hf_bthci_evt_max_rx_latency = -1;
239 static int hf_bthci_evt_min_remote_timeout = -1;
240 static int hf_bthci_evt_min_local_timeout = -1;
241 static int hf_bthci_evt_link_supervision_timeout = -1;
242 static int hf_bthci_evt_token_bucket_size = -1;
243 static int hf_bthci_evt_flow_direction = -1;
244 static int hf_bthci_evt_afh_ch_assessment_mode = -1;
245 static int hf_bthci_evt_lmp_handle = -1;
246 static int hf_bthci_evt_clock = -1;
247 static int hf_bthci_evt_clock_accuracy = -1;
248 static int hf_bthci_evt_afh_mode = -1;
249 static int hf_bthci_evt_afh_channel_map = -1;
250 static int hf_bthci_evt_simple_pairing_mode = -1;
251 static int hf_bthci_evt_randomizer_r = -1;
252 static int hf_bthci_evt_hash_c = -1;
253 static int hf_bthci_evt_io_capability = -1;
254 static int hf_bthci_evt_oob_data_present = -1;
255 static int hf_bthci_evt_auth_requirements = -1;
256 static int hf_bthci_evt_numeric_value = -1;
257 static int hf_bthci_evt_passkey = -1;
258 static int hf_bthci_evt_notification_type = -1;
259 static int hf_bthci_evt_data_length = -1;
260 static int hf_bthci_evt_location_domain_aware = -1;
261 static int hf_bthci_evt_location_domain = -1;
262 static int hf_bthci_evt_location_domain_options = -1;
263 static int hf_bthci_evt_location_options = -1;
264 static int hf_bthci_evt_flow_control_mode = -1;
265 static int hf_bthci_evt_physical_link_handle = -1;
266 static int hf_bthci_evt_flow_spec_identifier = -1;
267 static int hf_bthci_evt_logical_link_handle = -1;
268 static int hf_bthci_evt_max_acl_data_packet_length = -1;
269 static int hf_bthci_evt_data_block_length = -1;
270 static int hf_bthci_evt_total_num_data_blocks = -1;
271 static int hf_bthci_evt_enc_key_size = -1;
272 static int hf_bthci_evt_amp_remaining_assoc_length = -1;
273 static int hf_bthci_evt_amp_assoc_fragment = -1;
274 static int hf_bthci_evt_amp_status = -1;
275 static int hf_bthci_evt_total_bandwidth = -1;
276 static int hf_bthci_evt_max_guaranteed_bandwidth = -1;
277 static int hf_bthci_evt_min_latency = -1;
278 static int hf_bthci_evt_max_pdu_size = -1;
279 static int hf_bthci_evt_amp_controller_type = -1;
280 static int hf_bthci_evt_pal_capabilities_00 = -1;
281 static int hf_bthci_evt_max_amp_assoc_length = -1;
282 static int hf_bthci_evt_max_flush_to_us = -1;
283 static int hf_bthci_evt_best_effort_flush_to_us = -1;
284 static int hf_bthci_evt_link_loss_reason = -1;
285 static int hf_bthci_evt_num_compl_blocks = -1;
286 static int hf_bthci_evt_test_scenario = -1;
287 static int hf_bthci_evt_report_reason = -1;
288 static int hf_bthci_evt_report_event_type = -1;
289 static int hf_bthci_evt_num_frames = -1;
290 static int hf_bthci_evt_num_error_frames = -1;
291 static int hf_bthci_evt_num_bits = -1;
292 static int hf_bthci_evt_num_error_bits = -1;
293 static int hf_bthci_evt_short_range_mode_state = -1;
294 static int hf_bthci_evt_le_supported_host = -1;
295 static int hf_bthci_evt_le_simultaneous_host = -1;
296 static int hf_bthci_evt_le_acl_data_pkt_len = -1;
297 static int hf_bthci_evt_total_num_le_acl_data_pkts = -1;
298 static int hf_bthci_evt_iso_data_pkt_len = -1;
299 static int hf_bthci_evt_total_num_iso_data_pkts = -1;
300 static int hf_bthci_evt_white_list_size = -1;
301 static int hf_bthci_evt_le_channel_map = -1;
302 static int hf_bthci_evt_encrypted_data = -1;
303 static int hf_bthci_evt_random_number = -1;
304 static int hf_bthci_evt_le_num_packets = -1;
305 static int hf_bthci_evt_le_meta_subevent = -1;
306 static int hf_bthci_evt_le_peer_address_type = -1;
307 static int hf_bthci_evt_le_local_rpa = -1;
308 static int hf_bthci_evt_le_peer_rpa = -1;
309 static int hf_bthci_evt_le_con_interval = -1;
310 static int hf_bthci_evt_le_min_interval = -1;
311 static int hf_bthci_evt_le_max_interval = -1;
312 static int hf_bthci_evt_le_con_latency = -1;
313 static int hf_bthci_evt_le_supervision_timeout = -1;
314 static int hf_bthci_evt_le_max_tx_octets = -1;
315 static int hf_bthci_evt_le_max_tx_time = -1;
316 static int hf_bthci_evt_le_max_rx_octets = -1;
317 static int hf_bthci_evt_le_max_rx_time = -1;
318 static int hf_bthci_evt_le_local_p_256_public_key = -1;
319 static int hf_bthci_evt_le_dhkey = -1;
320 static int hf_bthci_evt_encrypted_diversifier = -1;
321 static int hf_bthci_evt_le_master_clock_accuracy = -1;
322 static int hf_bthci_evt_num_reports = -1;
323 static int hf_bthci_evt_advts_event_type = -1;
324 static int hf_bthci_evt_le_states = -1;
325 static int hf_bthci_evt_le_states_00 = -1;
326 static int hf_bthci_evt_le_states_01 = -1;
327 static int hf_bthci_evt_le_states_02 = -1;
328 static int hf_bthci_evt_le_states_03 = -1;
329 static int hf_bthci_evt_le_states_04 = -1;
330 static int hf_bthci_evt_le_states_05 = -1;
331 static int hf_bthci_evt_le_states_06 = -1;
332 static int hf_bthci_evt_le_states_07 = -1;
333 static int hf_bthci_evt_le_states_10 = -1;
334 static int hf_bthci_evt_le_states_11 = -1;
335 static int hf_bthci_evt_le_states_12 = -1;
336 static int hf_bthci_evt_le_states_13 = -1;
337 static int hf_bthci_evt_le_states_14 = -1;
338 static int hf_bthci_evt_le_states_15 = -1;
339 static int hf_bthci_evt_le_states_16 = -1;
340 static int hf_bthci_evt_le_states_17 = -1;
341 static int hf_bthci_evt_le_states_20 = -1;
342 static int hf_bthci_evt_le_states_21 = -1;
343 static int hf_bthci_evt_le_states_22 = -1;
344 static int hf_bthci_evt_le_states_23 = -1;
345 static int hf_bthci_evt_le_states_24 = -1;
346 static int hf_bthci_evt_le_states_25 = -1;
347 static int hf_bthci_evt_le_states_26 = -1;
348 static int hf_bthci_evt_le_states_27 = -1;
349 static int hf_bthci_evt_le_states_30 = -1;
350 static int hf_bthci_evt_le_states_31 = -1;
351 static int hf_bthci_evt_le_states_32 = -1;
352 static int hf_bthci_evt_le_states_33 = -1;
353 static int hf_bthci_evt_le_states_34 = -1;
354 static int hf_changed_in_frame = -1;
355 static int hf_command_in_frame = -1;
356 static int hf_pending_in_frame = -1;
357 static int hf_response_in_frame = -1;
358 static int hf_command_pending_time_delta = -1;
359 static int hf_command_response_time_delta = -1;
360 static int hf_pending_response_time_delta = -1;
361 static int hf_bthci_evt_le_features = -1;
362 static int hf_bthci_evt_le_features_encryption = -1;
363 static int hf_bthci_evt_le_features_connection_parameters_request_procedure = -1;
364 static int hf_bthci_evt_le_features_extended_reject_indication = -1;
365 static int hf_bthci_evt_le_features_slave_initiated_features_exchange = -1;
366 static int hf_bthci_evt_le_features_ping = -1;
367 static int hf_bthci_evt_le_features_data_packet_length_extension = -1;
368 static int hf_bthci_evt_le_features_ll_privacy = -1;
369 static int hf_bthci_evt_le_features_extended_scanner_filter_policies = -1;
370 static int hf_bthci_evt_le_features_2m_phy = -1;
371 static int hf_bthci_evt_le_features_stable_modulation_index_tx =-1;
372 static int hf_bthci_evt_le_features_stable_modulation_index_rx = -1;
373 static int hf_bthci_evt_le_features_coded_phy = -1;
374 static int hf_bthci_evt_le_features_extended_advertising = -1;
375 static int hf_bthci_evt_le_features_periodic_advertising = -1;
376 static int hf_bthci_evt_le_features_channel_selection_algorithm_2 = -1;
377 static int hf_bthci_evt_le_features_power_class_1 = -1;
378 static int hf_bthci_evt_le_features_minimum_number_of_used_channels_procedure = -1;
379 static int hf_bthci_evt_le_features_connection_cte_request = -1;
380 static int hf_bthci_evt_le_features_connection_cte_response = -1;
381 static int hf_bthci_evt_le_features_connectionless_cte_tx = -1;
382 static int hf_bthci_evt_le_features_connectionless_cte_rx = -1;
383 static int hf_bthci_evt_le_features_antenna_switching_during_cte_tx_aod = -1;
384 static int hf_bthci_evt_le_features_antenna_switching_during_cte_rx_aoa = -1;
385 static int hf_bthci_evt_le_features_receiving_cte = -1;
386 static int hf_bthci_evt_le_features_periodic_advertising_sync_transfer_sender = -1;
387 static int hf_bthci_evt_le_features_periodic_advertising_sync_transfer_receiver = -1;
388 static int hf_bthci_evt_le_features_sleep_clock_accuracy_updates = -1;
389 static int hf_bthci_evt_le_features_remote_public_key_validation = -1;
390 static int hf_bthci_evt_le_features_cis_master = -1;
391 static int hf_bthci_evt_le_features_cis_slave = -1;
392 static int hf_bthci_evt_le_features_isochronous_broadcaster = -1;
393 static int hf_bthci_evt_le_features_synchronized_receiver = -1;
394 static int hf_bthci_evt_le_features_isochronous_channels_host_support = -1;
395 static int hf_bthci_evt_le_features_power_control_request = -1;
396 static int hf_bthci_evt_le_features_power_change_indication = -1;
397 static int hf_bthci_evt_le_features_path_loss_monitoring = -1;
398 static int hf_bthci_evt_le_features_periodic_advertising_adi = -1;
399 static int hf_bthci_evt_le_features_connection_subrating = -1;
400 static int hf_bthci_evt_le_features_connection_subrating_host_support = -1;
401 static int hf_bthci_evt_le_features_channel_classification = -1;
402 static int hf_bthci_evt_le_features_reserved = -1;
403 static int hf_bthci_evt_mws_number_of_transports = -1;
404 static int hf_bthci_evt_mws_transport_layers = -1;
405 static int hf_bthci_evt_mws_transport_layers_item = -1;
406 static int hf_bthci_evt_mws_transport_layer = -1;
407 static int hf_bthci_evt_mws_number_of_baud_rates = -1;
408 static int hf_bthci_evt_mws_to_mws_baud_rates = -1;
409 static int hf_bthci_evt_mws_to_mws_baud_rates_tranport_item = -1;
410 static int hf_bthci_evt_mws_to_mws_baud_rate = -1;
411 static int hf_bthci_evt_mws_from_mws_baud_rates = -1;
412 static int hf_bthci_evt_mws_from_mws_baud_rates_tranport_item = -1;
413 static int hf_bthci_evt_mws_from_mws_baud_rate = -1;
414 static int hf_bthci_evt_selected_tx_power = -1;
415 static int hf_bthci_evt_which_clock = -1;
416 static int hf_bthci_evt_slot_offset = -1;
417 static int hf_bthci_evt_lt_addr = -1;
418 static int hf_bthci_evt_next_broadcast_instant = -1;
419 static int hf_bthci_evt_connectionless_slave_broadcast_interval = -1;
420 static int hf_bthci_evt_service_data = -1;
421 static int hf_bthci_evt_local_sam_index = -1;
422 static int hf_bthci_evt_local_sam_tx_availability = -1;
423 static int hf_bthci_evt_local_sam_rx_availability = -1;
424 static int hf_bthci_evt_remote_sam_index = -1;
425 static int hf_bthci_evt_remote_sam_tx_availability = -1;
426 static int hf_bthci_evt_remote_sam_rx_availability = -1;
427 static int hf_bthci_evt_receive_status = -1;
428 static int hf_bthci_evt_fragment = -1;
429 static int hf_bthci_evt_data = -1;
430 static int hf_bthci_evt_le_number_of_reports = -1;
431 static int hf_bthci_evt_le_report = -1;
432 static int hf_bthci_evt_le_event_type = -1;
433 static int hf_bthci_evt_le_direct_address_type = -1;
434 static int hf_bthci_evt_le_direct_bd_addr = -1;
435 static int hf_bthci_evt_le_address_type = -1;
436 static int hf_bthci_evt_le_rssi = -1;
437 static int hf_bthci_evt_le_tx_phy = -1;
438 static int hf_bthci_evt_le_rx_phy = -1;
439 static int hf_bthci_evt_max_adv_data_length = -1;
440 static int hf_bthci_evt_num_supported_adv_sets = -1;
441 static int hf_bthci_evt_number_of_supported_codecs = -1;
442 static int hf_bthci_evt_number_of_supported_vendor_codecs = -1;
443 static int hf_bthci_evt_codecs = -1;
444 static int hf_bthci_evt_vendor_codecs = -1;
445 static int hf_bthci_evt_vendor_codecs_item = -1;
446 static int hf_bthci_evt_codec_id = -1;
447 static int hf_bthci_evt_vendor_codec_id = -1;
448 static int hf_bthci_evt_mws_bt_rx_priority_assert_offset = -1;
449 static int hf_bthci_evt_mws_bt_rx_priority_assert_jitter = -1;
450 static int hf_bthci_evt_mws_bt_rx_priority_deassert_offset = -1;
451 static int hf_bthci_evt_mws_bt_rx_priority_deassert_jitter = -1;
452 static int hf_bthci_evt_mws_bt_tx_priority_assert_offset = -1;
453 static int hf_bthci_evt_mws_bt_tx_priority_assert_jitter = -1;
454 static int hf_bthci_evt_mws_bt_tx_priority_deassert_offset = -1;
455 static int hf_bthci_evt_mws_bt_tx_priority_deassert_jitter = -1;
456 static int hf_bthci_evt_mws_802_rx_priority_assert_offset = -1;
457 static int hf_bthci_evt_mws_802_rx_priority_assert_jitter = -1;
458 static int hf_bthci_evt_mws_802_rx_priority_deassert_offset = -1;
459 static int hf_bthci_evt_mws_802_rx_priority_deassert_jitter = -1;
460 static int hf_bthci_evt_mws_802_tx_priority_assert_offset = -1;
461 static int hf_bthci_evt_mws_802_tx_priority_assert_jitter = -1;
462 static int hf_bthci_evt_mws_802_tx_priority_deassert_offset = -1;
463 static int hf_bthci_evt_mws_802_tx_priority_deassert_jitter = -1;
464 static int hf_bthci_evt_sync_train_interval = -1;
465 static int hf_bthci_evt_sync_train_to = -1;
466 static int hf_bthci_evt_secure_connection_host_support = -1;
467 static int hf_bthci_evt_authenticated_payload_timeout = -1;
468 static int hf_bthci_evt_c192 = -1;
469 static int hf_bthci_evt_r192 = -1;
470 static int hf_bthci_evt_c256 = -1;
471 static int hf_bthci_evt_r256 = -1;
472 static int hf_bthci_evt_extended_inquiry_length = -1;
473 static int hf_bthci_evt_suggested_max_tx_octets = -1;
474 static int hf_bthci_evt_suggested_max_tx_time = -1;
475 static int hf_bthci_evt_suggested_max_rx_octets = -1;
476 static int hf_bthci_evt_suggested_max_rx_time = -1;
477 static int hf_bthci_evt_resolving_list_size = -1;
478 static int hf_bthci_evt_primary_phy = -1;
479 static int hf_bthci_evt_secondary_phy = -1;
480 static int hf_bthci_evt_advertising_sid = -1;
481 static int hf_bthci_evt_tx_power = -1;
482 static int hf_bthci_evt_periodic_advertising_interval = -1;
483 static int hf_bthci_evt_num_compl_ext_advertising_events = -1;
484 static int hf_bthci_evt_channel_selection_algorithm = -1;
485 static int hf_bthci_evt_advertiser_clock_accuracy = -1;
486 static int hf_bthci_evt_advertiser_phy = -1;
487 static int hf_bthci_evt_periodic_adv_list_size = -1;
488 static int hf_bthci_evt_min_tx_power = -1;
489 static int hf_bthci_evt_max_tx_power = -1;
490 static int hf_bthci_evt_rf_tx_path_compensation = -1;
491 static int hf_bthci_evt_rf_rx_path_compensation = -1;
492 static int hf_bthci_evt_sync_handle = -1;
493 static int hf_bthci_evt_data_status = -1;
494 static int hf_bthci_evt_advertising_handle = -1;
495 static int hf_bthci_evt_channel_index = -1;
496 static int hf_bthci_evt_cte_rssi = -1;
497 static int hf_bthci_evt_antenna_id = -1;
498 static int hf_bthci_evt_cte_type = -1;
499 static int hf_bthci_evt_slot_durations = -1;
500 static int hf_bthci_evt_packet_status = -1;
501 static int hf_bthci_evt_event_counter = -1;
502 static int hf_bthci_evt_sample_count = -1;
503 static int hf_bthci_evt_i_sample = -1;
504 static int hf_bthci_evt_q_sample = -1;
505 static int hf_bthci_evt_service_data_past = -1;
506 static int hf_bthci_evt_number_antennae = -1;
507 static int hf_bthci_evt_max_cte_length = -1;
508 static int hf_bthci_evt_max_length_antenna_switching_pattern = -1;
509 static int hf_bthci_evt_max_encryption_key_size = -1;
510 static int hf_bthci_evt_sdu_packet_seq_num = -1;
511 static int hf_bthci_evt_sdu_packet_timestamp = -1;
512 static int hf_bthci_evt_sdu_packet_offset = -1;
513 static int hf_bthci_evt_cig_id = -1;
514 static int hf_bthci_evt_cis_id = -1;
515 static int hf_bthci_evt_cis_count = -1;
516 static int hf_bthci_evt_cis_handle = -1;
517 static int hf_bthci_evt_cis_bis_handle = -1;
518 static int hf_bthci_evt_big_handle = -1;
519 static int hf_bthci_evt_received_packet_counter = -1;
520 static int hf_bthci_evt_missed_packet_counter = -1;
521 static int hf_bthci_evt_failed_packet_counter = -1;
522 static int hf_bthci_evt_pkt_count_tx_unacked = -1;
523 static int hf_bthci_evt_pkt_count_tx_flushed = -1;
524 static int hf_bthci_evt_pkt_count_tx_last_subevent = -1;
525 static int hf_bthci_evt_pkt_count_tx_retransmitted = -1;
526 static int hf_bthci_evt_pkt_count_rx_crc_error = -1;
527 static int hf_bthci_evt_pkt_count_rx_unreceived = -1;
528 static int hf_bthci_evt_pkt_count_rx_duplicate = -1;
529 static int hf_bthci_evt_phy_and_coding = -1;
530 static int hf_bthci_evt_cig_sync_delay = -1;
531 static int hf_bthci_evt_big_sync_delay = -1;
532 static int hf_bthci_evt_cis_sync_delay = -1;
533 static int hf_bthci_evt_transport_latency_m_to_s = -1;
534 static int hf_bthci_evt_transport_latency_s_to_m = -1;
535 static int hf_bthci_evt_big_transport_latency = -1;
536 static int hf_bthci_evt_phy_m_to_s = -1;
537 static int hf_bthci_evt_phy_s_to_m = -1;
538 static int hf_bthci_evt_bn_m_to_s = -1;
539 static int hf_bthci_evt_bn_s_to_m = -1;
540 static int hf_bthci_evt_ft_m_to_s = -1;
541 static int hf_bthci_evt_ft_s_to_m = -1;
542 static int hf_bthci_evt_max_pdu_m_to_s = -1;
543 static int hf_bthci_evt_max_pdu_s_to_m = -1;
544 static int hf_bthci_evt_phy = -1;
545 static int hf_bthci_evt_nse = -1;
546 static int hf_bthci_evt_bn = -1;
547 static int hf_bthci_evt_pto = -1;
548 static int hf_bthci_evt_irc = -1;
549 static int hf_bthci_evt_max_pdu = -1;
550 static int hf_bthci_evt_iso_interval = -1;
551 static int hf_bthci_evt_num_bis = -1;
552 static int hf_bthci_evt_bis_handle = -1;
553 static int hf_bthci_evt_current_path_loss = -1;
554 static int hf_bthci_evt_zone_entered = -1;
555 static int hf_bthci_evt_power_report_reason = -1;
556 static int hf_bthci_evt_power_level_delta = -1;
557 static int hf_bthci_evt_sdu_interval = -1;
558 static int hf_bthci_evt_max_sdu = -1;
559 static int hf_bthci_evt_framing = -1;
560 static int hf_bthci_evt_peer_clock_accuracy = -1;
561 static int hf_bthci_evt_subrate_factor = -1;
562 static int hf_bthci_evt_continuation_number = -1;
563 static int hf_packet_type_acl = -1;
564 static int hf_packet_type_acl_dh5 = -1;
565 static int hf_packet_type_acl_dm5 = -1;
566 static int hf_packet_type_acl_3dh5 = -1;
567 static int hf_packet_type_acl_2dh5 = -1;
568 static int hf_packet_type_acl_dh3 = -1;
569 static int hf_packet_type_acl_dm3 = -1;
570 static int hf_packet_type_acl_3dh3 = -1;
571 static int hf_packet_type_acl_2dh3 = -1;
572 static int hf_packet_type_acl_reserved_5_7 = -1;
573 static int hf_packet_type_acl_dh1 = -1;
574 static int hf_packet_type_acl_dm1 = -1;
575 static int hf_packet_type_acl_3dh1 = -1;
576 static int hf_packet_type_acl_2dh1 = -1;
577 static int hf_packet_type_acl_reserved_0 = -1;
578 static int hf_packet_type_sco = -1;
579 static int hf_packet_type_sco_reserved_15_8 = -1;
580 static int hf_packet_type_sco_hv3 = -1;
581 static int hf_packet_type_sco_hv2 = -1;
582 static int hf_packet_type_sco_hv1 = -1;
583 static int hf_packet_type_sco_reserved_4_0 = -1;
584 
585 static int * const hfx_bthci_evt_le_features[] = {
586     &hf_bthci_evt_le_features_encryption,
587     &hf_bthci_evt_le_features_connection_parameters_request_procedure,
588     &hf_bthci_evt_le_features_extended_reject_indication,
589     &hf_bthci_evt_le_features_slave_initiated_features_exchange,
590     &hf_bthci_evt_le_features_ping,
591     &hf_bthci_evt_le_features_data_packet_length_extension,
592     &hf_bthci_evt_le_features_ll_privacy,
593     &hf_bthci_evt_le_features_extended_scanner_filter_policies,
594     &hf_bthci_evt_le_features_2m_phy,
595     &hf_bthci_evt_le_features_stable_modulation_index_tx,
596     &hf_bthci_evt_le_features_stable_modulation_index_rx,
597     &hf_bthci_evt_le_features_coded_phy,
598     &hf_bthci_evt_le_features_extended_advertising,
599     &hf_bthci_evt_le_features_periodic_advertising,
600     &hf_bthci_evt_le_features_channel_selection_algorithm_2,
601     &hf_bthci_evt_le_features_power_class_1,
602     &hf_bthci_evt_le_features_minimum_number_of_used_channels_procedure,
603     &hf_bthci_evt_le_features_connection_cte_request,
604     &hf_bthci_evt_le_features_connection_cte_response,
605     &hf_bthci_evt_le_features_connectionless_cte_tx,
606     &hf_bthci_evt_le_features_connectionless_cte_rx,
607     &hf_bthci_evt_le_features_antenna_switching_during_cte_tx_aod,
608     &hf_bthci_evt_le_features_antenna_switching_during_cte_rx_aoa,
609     &hf_bthci_evt_le_features_receiving_cte,
610     &hf_bthci_evt_le_features_periodic_advertising_sync_transfer_sender,
611     &hf_bthci_evt_le_features_periodic_advertising_sync_transfer_receiver,
612     &hf_bthci_evt_le_features_sleep_clock_accuracy_updates,
613     &hf_bthci_evt_le_features_remote_public_key_validation,
614     &hf_bthci_evt_le_features_cis_master,
615     &hf_bthci_evt_le_features_cis_slave,
616     &hf_bthci_evt_le_features_isochronous_broadcaster,
617     &hf_bthci_evt_le_features_synchronized_receiver,
618     &hf_bthci_evt_le_features_isochronous_channels_host_support,
619     &hf_bthci_evt_le_features_power_control_request,
620     &hf_bthci_evt_le_features_power_change_indication,
621     &hf_bthci_evt_le_features_path_loss_monitoring,
622     &hf_bthci_evt_le_features_periodic_advertising_adi,
623     &hf_bthci_evt_le_features_connection_subrating,
624     &hf_bthci_evt_le_features_connection_subrating_host_support,
625     &hf_bthci_evt_le_features_channel_classification,
626     &hf_bthci_evt_le_features_reserved,
627     NULL
628 };
629 
630 static int * const hfx_packet_type_acl[] = {
631     &hf_packet_type_acl_dh5,
632     &hf_packet_type_acl_dm5,
633     &hf_packet_type_acl_3dh5,
634     &hf_packet_type_acl_2dh5,
635     &hf_packet_type_acl_dh3,
636     &hf_packet_type_acl_dm3,
637     &hf_packet_type_acl_3dh3,
638     &hf_packet_type_acl_2dh3,
639     &hf_packet_type_acl_reserved_5_7,
640     &hf_packet_type_acl_dh1,
641     &hf_packet_type_acl_dm1,
642     &hf_packet_type_acl_3dh1,
643     &hf_packet_type_acl_2dh1,
644     &hf_packet_type_acl_reserved_0,
645     NULL
646 };
647 
648 static int * const hfx_packet_type_sco[] = {
649     &hf_packet_type_sco_reserved_15_8,
650     &hf_packet_type_sco_hv3,
651     &hf_packet_type_sco_hv2,
652     &hf_packet_type_sco_hv1,
653     &hf_packet_type_sco_reserved_4_0,
654     NULL
655 };
656 
657 static expert_field ei_event_undecoded = EI_INIT;
658 static expert_field ei_event_unknown_event = EI_INIT;
659 static expert_field ei_event_unexpected_event = EI_INIT;
660 static expert_field ei_event_unexpected_parameter = EI_INIT;
661 static expert_field ei_event_unknown_command = EI_INIT;
662 static expert_field ei_parameter_unexpected = EI_INIT;
663 static expert_field ei_manufacturer_data_changed = EI_INIT;
664 static expert_field ei_hci_revision_changed = EI_INIT;
665 static expert_field ei_lmp_subversion_changed = EI_INIT;
666 static expert_field ei_bad_link_type = EI_INIT;
667 
668 static dissector_table_t vendor_dissector_table;
669 static dissector_table_t hci_vendor_table;
670 
671 static int hf_bthci_evt_ext_advts_event_type = -1;
672 static int hf_bthci_evt_ext_advts_event_type_connectable = -1;
673 static int hf_bthci_evt_ext_advts_event_type_scannable = -1;
674 static int hf_bthci_evt_ext_advts_event_type_directed = -1;
675 static int hf_bthci_evt_ext_advts_event_type_scan_response = -1;
676 static int hf_bthci_evt_ext_advts_event_type_legacy = -1;
677 static int hf_bthci_evt_ext_advts_event_type_data_status = -1;
678 static int hf_bthci_evt_ext_advts_event_type_reserved = -1;
679 
680 static int * const hfx_bthci_evt_le_ext_advts_evt_type[] = {
681     &hf_bthci_evt_ext_advts_event_type_connectable,
682     &hf_bthci_evt_ext_advts_event_type_scannable,
683     &hf_bthci_evt_ext_advts_event_type_directed,
684     &hf_bthci_evt_ext_advts_event_type_scan_response,
685     &hf_bthci_evt_ext_advts_event_type_legacy,
686     &hf_bthci_evt_ext_advts_event_type_data_status,
687     &hf_bthci_evt_ext_advts_event_type_reserved,
688     NULL
689 };
690 
691 static int hf_bthci_evt_supported_switching_sample_rates = -1;
692 static int hf_bthci_evt_supported_switching_sample_rates_1us_switching_aod_tx = -1;
693 static int hf_bthci_evt_supported_switching_sample_rates_1us_sampling_aod_rx = -1;
694 static int hf_bthci_evt_supported_switching_sample_rates_1us_switching_and_sampling_aoa_rx = -1;
695 static int hf_bthci_evt_supported_switching_sample_rates_reserved = -1;
696 
697 static int * const hfx_bthci_evt_supported_switching_sample_rates[] = {
698     &hf_bthci_evt_supported_switching_sample_rates_1us_switching_aod_tx,
699     &hf_bthci_evt_supported_switching_sample_rates_1us_sampling_aod_rx,
700     &hf_bthci_evt_supported_switching_sample_rates_1us_switching_and_sampling_aoa_rx,
701     &hf_bthci_evt_supported_switching_sample_rates_reserved,
702     NULL
703 };
704 
705 static int hf_bthci_evt_simple_pairing_options = -1;
706 static int hf_bthci_evt_simple_pairing_options_remote_public_key_validation = -1;
707 static int hf_bthci_evt_simple_pairing_options_reserved = -1;
708 
709 static int * const hfx_bthci_evt_simple_pairing_options[] = {
710     &hf_bthci_evt_simple_pairing_options_remote_public_key_validation,
711     &hf_bthci_evt_simple_pairing_options_reserved,
712     NULL
713 };
714 
715 static int hf_bthci_evt_transmit_power_level_flags = -1;
716 static int hf_bthci_evt_transmit_power_level_flags_minimum_power = -1;
717 static int hf_bthci_evt_transmit_power_level_flags_maximum_power = -1;
718 static int hf_bthci_evt_transmit_power_level_flags_reserved = -1;
719 
720 static int * const hfx_bthci_evt_transmit_power_level_flags[] = {
721     &hf_bthci_evt_transmit_power_level_flags_minimum_power,
722     &hf_bthci_evt_transmit_power_level_flags_maximum_power,
723     &hf_bthci_evt_transmit_power_level_flags_reserved,
724     NULL
725 };
726 
727 /* Initialize the subtree pointers */
728 static gint ett_bthci_evt = -1;
729 static gint ett_opcode = -1;
730 static gint ett_lmp_subtree = -1;
731 static gint ett_ptype_subtree = -1;
732 static gint ett_le_state_subtree = -1;
733 static gint ett_le_channel_map = -1;
734 static gint ett_le_features = -1;
735 static gint ett_le_report = -1;
736 static gint ett_codecs = -1;
737 static gint ett_mws_transport_layers = -1;
738 static gint ett_mws_transport_layers_item = -1;
739 static gint ett_mws_to_mws_baud_rates = -1;
740 static gint ett_mws_to_mws_baud_rates_transport_item = -1;
741 static gint ett_mws_from_mws_baud_rates = -1;
742 static gint ett_mws_from_mws_baud_rates_transport_item = -1;
743 static gint ett_expert = -1;
744 static gint ett_le_ext_advts_event_type = -1;
745 static gint ett_iq_sample_list = -1;
746 static gint ett_iq_samples = -1;
747 static gint ett_simple_pairing_options = -1;
748 static gint ett_supported_switching_sample_rates = -1;
749 static gint ett_transmit_power_level_flags = -1;
750 
751 extern value_string_ext ext_usb_vendors_vals;
752 extern value_string_ext ext_usb_products_vals;
753 extern value_string_ext did_vendor_id_source_vals_ext;
754 
755 enum command_status {
756     COMMAND_STATUS_NORMAL,
757     COMMAND_STATUS_PENDING,
758     COMMAND_STATUS_RESULT
759 };
760 
761 typedef struct _opcode_list_data_t {
762     guint16              opcode;
763     enum command_status  command_status;
764 } opcode_list_data_t;
765 
766 static const value_string evt_code_vals[] = {
767     {0x01, "Inquiry Complete"},
768     {0x02, "Inquiry Result"},
769     {0x03, "Connect Complete"},
770     {0x04, "Connect Request"},
771     {0x05, "Disconnect Complete"},
772     {0x06, "Authentication Complete"},
773     {0x07, "Remote Name Request Complete"},
774     {0x08, "Encryption Change"},
775     {0x09, "Change Connection Link Key Complete"},
776     {0x0a, "Master Link Key Complete"},
777     {0x0b, "Read Remote Supported Features"},
778     {0x0c, "Read Remote Version Information Complete"},
779     {0x0d, "QoS Setup Complete"},
780     {0x0e, "Command Complete"},
781     {0x0f, "Command Status"},
782     {0x10, "Hardware Error"},
783     {0x11, "Flush Occurred"},
784     {0x12, "Role Change"},
785     {0x13, "Number of Completed Packets"},
786     {0x14, "Mode Change"},
787     {0x15, "Return Link Keys"},
788     {0x16, "PIN Code Request"},
789     {0x17, "Link Key Request"},
790     {0x18, "Link Key Notification"},
791     {0x19, "Loopback Command"},
792     {0x1a, "Data Buffer Overflow"},
793     {0x1b, "Max Slots Change"},
794     {0x1c, "Read Clock Offset Complete"},
795     {0x1d, "Connection Packet Type Changed"},
796     {0x1e, "QoS Violation"},
797     {0x1f, "Page Scan Mode Change"},
798     {0x20, "Page Scan Repetition Mode Change"},
799     {0x21, "Flow Specification Complete"},
800     {0x22, "Inquiry Result With RSSI"},
801     {0x23, "Read Remote Extended Features Complete"},
802     {0x2c, "Synchronous Connection Complete"},
803     {0x2d, "Synchronous Connection Changed"},
804     {0x2e, "Sniff Subrating"},
805     {0x2f, "Extended Inquiry Result"},
806     {0x30, "Encryption Key Refresh Complete"},
807     {0x31, "IO Capability Request"},
808     {0x32, "IO Capability Response"},
809     {0x33, "User Confirmation Request"},
810     {0x34, "User Passkey Request"},
811     {0x35, "Remote OOB Data Request"},
812     {0x36, "Simple Pairing Complete"},
813     {0x38, "Link Supervision Timeout Changed"},
814     {0x39, "Enhanced Flush Complete"},
815     {0x3b, "User Passkey Notification"},
816     {0x3c, "Keypress Notification"},
817     {0x3d, "Remote Host Supported Features Notification"},
818     {0x3e, "LE Meta"},
819     {0x40, "Physical Link Complete"},
820     {0x41, "Channel Selected"},
821     {0x42, "Disconnect Physical Link Complete"},
822     {0x43, "Physical Link Loss Early Warning"},
823     {0x44, "Physical Link Recovery"},
824     {0x45, "Logical Link Complete"},
825     {0x46, "Disconnect Logical Link Complete"},
826     {0x47, "Flow Spec Modify Complete"},
827     {0x48, "Number Of Completed Data Blocks"},
828     {0x49, "AMP Start Test"},
829     {0x4a, "AMP Test End"},
830     {0x4b, "AMP Receiver Report"},
831     {0x4c, "Short Range Mode Change Complete"},
832     {0x4d, "AMP Status Change"},
833     /* From "Bluetooth Core Specification Addendum 4 */
834     {0x4e, "Triggered Clock Capture"},
835     {0x4f, "Synchronization Train Complete"},
836     {0x50, "Synchronization Train Received"},
837     {0x51, "Connectionless Slave Broadcast Receive"},
838     {0x52, "Connectionless Slave Broadcast Timeout"},
839     {0x53, "Truncated Page Complete"},
840     {0x54, "Slave Page Response Timeout"},
841     {0x55, "Connectionless Slave Broadcast Channel Map Change"},
842     {0x56, "Inquiry Response Notification"},
843     /* Core 4 */
844     {0x57, "Authenticated Payload Timeout Expired"},
845     /* Core 5 */
846     {0x58, "SAM Status Change"},
847     /* Other */
848     /*{0xfe, "Bluetooth Logo Testing"}, // According to ESR05 it is not assigned */
849     {0xff, "Vendor-Specific"},
850     {0, NULL}
851 };
852 value_string_ext bthci_evt_evt_code_vals_ext = VALUE_STRING_EXT_INIT(evt_code_vals);
853 
854 static const value_string bthci_cmd_status_pending_vals[] = {
855     {0x00, "Pending"},
856     {0, NULL }
857 };
858 
859 static const value_string evt_link_types[]  = {
860     {0x00, "SCO connection (Voice Channels)"},
861     {0x01, "ACL connection (Data Channels)"},
862     {0x02, "eSCO connection (Voice Channels)"},
863     {0, NULL }
864 };
865 
866 static const value_string evt_sync_link_types[]  = {
867     {0x00, "SCO connection"},
868     {0x02, "eSCO connection"},
869     {0, NULL }
870 };
871 
872 static const value_string evt_encryption_modes[] = {
873     {0x00, "Encryption Disabled"},
874     {0x01, "Encryption only for point-to-point packets"},
875     {0x02, "Encryption for both point-to-point and broadcast packets"},
876     {0, NULL }
877 };
878 
879 static const value_string evt_encryption_enable[] = {
880     {0x00, "Link Level Encryption is OFF"},
881     {0x01, "Link Level Encryption is ON"},
882     {0, NULL }
883 };
884 
885 static const value_string evt_key_flag[] = {
886     {0x00, "Using Semi-permanent Link Key"},
887     {0x01, "Using Temporary Link Key"},
888     {0, NULL }
889 };
890 
891 /* Taken from https://www.bluetooth.org/Technical/AssignedNumbers/link_manager.htm */
892 const value_string bthci_evt_lmp_version[] = {
893     {0x00, "1.0b"},
894     {0x01, "1.1"},
895     {0x02, "1.2"},
896     {0x03, "2.0 + EDR"},
897     {0x04, "2.1 + EDR"},
898     {0x05, "3.0 + HS"},
899     {0x06, "4.0"},
900     {0x07, "4.1"},
901     {0x08, "4.2"},
902     {0x09, "5.0"},
903     {0x0a, "5.1"},
904     {0x0b, "5.2"},
905     {0x0c, "5.3"},
906     {0, NULL }
907 };
908 
909 /* Taken from https://www.bluetooth.org/Technical/AssignedNumbers/hci.htm
910  * (requires a login/password)
911  */
912 const value_string bthci_evt_hci_version[] = {
913     {0x00, "1.0b"},
914     {0x01, "1.1"},
915     {0x02, "1.2"},
916     {0x03, "2.0 + EDR"},
917     {0x04, "2.1 + EDR"},
918     {0x05, "3.0 + HS"},
919     {0x06, "4.0"},
920     {0x07, "4.1"},
921     {0x08, "4.2"},
922     {0x09, "5.0"},
923     {0x0a, "5.1"},
924     {0x0b, "5.2"},
925     {0x0c, "5.3"},
926     {0, NULL }
927 };
928 
929 static const value_string evt_service_types[] = {
930     {0x00, "No Traffic Available"},
931     {0x01, "Best Effort Available"},
932     {0x02, "Guaranteed Available"},
933     {0, NULL }
934 };
935 
936 static const value_string evt_role_vals[] = {
937     {0x00, "Currently the Master for specified BD_ADDR"},
938     {0x01, "Currently the Slave for specified BD_ADDR"},
939     {0, NULL }
940 };
941 
942 static const value_string evt_role_vals_handle[] = {
943     {0x00, "Currently the Master for this connection handle"},
944     {0x01, "Currently the Slave for this connection handle"},
945     {0, NULL }
946 };
947 
948 static const value_string evt_modes[] = {
949     {0x00, "Active Mode"},
950     {0x01, "Hold Mode"},
951     {0x02, "Sniff Mode"},
952     {0x03, "Park Mode"},
953     {0, NULL }
954 };
955 
956 static const value_string evt_key_types[] = {
957     {0x00, "Combination Key"},
958     {0x01, "Local Unit Key"},
959     {0x02, "Remote Unit Key"},
960     {0x03, "Debug Combination Key"},
961     {0x04, "Unauthenticated Combination Key"},
962     {0x05, "Authenticated Combination Key"},
963     {0x06, "Changed Combination Key"},
964     {0, NULL }
965 };
966 
967 static const value_string evt_scan_types[] = {
968     {0x00, "Standard Scan" },
969     {0x01, "Interlaced Scan" },
970     {0, NULL }
971 };
972 
973 static const value_string evt_power_level_types[] = {
974     {0x00, "Read Current Transmission Power Level" },
975     {0x01, "Read Maximum Transmission Power Level" },
976     {0, NULL }
977 };
978 
979 static const value_string evt_pin_types[] = {
980     {0x00, "Variable PIN" },
981     {0x01, "Fixed PIN" },
982     {0, NULL }
983 };
984 
985 static const value_string evt_auth_enable_values[] = {
986     {0x00, "Disabled" },
987     {0x01, "Enabled for all connections "},
988     {0, NULL }
989 };
990 
991 static const value_string evt_enable_values[] = {
992     {0x00, "Disabled" },
993     {0x01, "Enabled"},
994     {0, NULL }
995 };
996 
997 static const value_string evt_loopback_modes[] = {
998     {0x00, "No Loopback mode enabled" },
999     {0x01, "Enable Local Loopback" },
1000     {0x02, "Enable Remote Loopback" },
1001     {0, NULL }
1002 };
1003 
1004 static const value_string evt_country_code_values[] = {
1005     {0x0, "North America & Europe (except France) and Japan" },
1006     {0x1, "France" },
1007     {0, NULL }
1008 };
1009 
1010 static const value_string evt_flow_direction_values[] = {
1011     {0x0, "Outgoing Traffic" },
1012     {0x1, "Incoming Traffic" },
1013     {0, NULL }
1014 };
1015 
1016 static const value_string evt_flow_ctrl_mode[] = {
1017     { 0x00, "Packet based" },
1018     { 0x01, "Data Block based" },
1019     { 0, NULL }
1020 };
1021 
1022 static const value_string evt_amp_status[] = {
1023     { 0x00, "Controller available but currently physically powered down" },
1024     { 0x01, "Controller available exclusively for Bluetooth" },
1025     { 0x02, "No capacity available for Bluetooth operation" },
1026     { 0x03, "Low capacity available for Bluetooth operation" },
1027     { 0x04, "Medium capacity available for Bluetooth operation" },
1028     { 0x05, "High capacity available for Bluetooth operation" },
1029     { 0x06, "Full capacity available for Bluetooth operation" },
1030     { 0, NULL }
1031 };
1032 
1033 const value_string bthci_evt_controller_types[] = {
1034     { 0x00, "Primary BR/EDR" },
1035     { 0x01, "802.11 AMP" },
1036     { 0, NULL }
1037 };
1038 
1039 static const value_string evt_link_loss_reasons[] = {
1040     { 0x00, "Unknown" },
1041     { 0x01, "Range related" },
1042     { 0x02, "Bandwidth related" },
1043     { 0x03, "Resolving Conflict" },
1044     { 0x04, "Interference" },
1045     { 0, NULL }
1046 };
1047 
1048 static const value_string evt_report_reasons[] = {
1049     { 0x00, "Configured Interval" },
1050     { 0x01, "Test Ended" },
1051     { 0, NULL }
1052 };
1053 
1054 static const value_string evt_report_event_types[] = {
1055     { 0x00, "Frames Received" },
1056     { 0x01, "Frames Received & Bits in Error" },
1057     { 0, NULL }
1058 };
1059 
1060 static const value_string evt_le_meta_subevent[] = {
1061     { 0x01, "LE Connection Complete" },
1062     { 0x02, "LE Advertising Report" },
1063     { 0x03, "LE Connection Update Complete" },
1064     { 0x04, "LE Read Remote Features Complete" },
1065     { 0x05, "LE Long Term Key Request" },
1066     { 0x06, "LE Remote Connection Parameter Request" },
1067     { 0x07, "LE Data Length Change" },
1068     { 0x08, "LE Read Local P-256 Public Key Complete" },
1069     { 0x09, "LE Generate DHKey Complete" },
1070     { 0x0A, "LE Enhanced Connection Complete" },
1071     { 0x0B, "LE Direct Advertising Report" },
1072     { 0x0C, "LE PHY Update Complete" },
1073     { 0x0D, "LE Extended Advertising Report" },
1074     { 0x0E, "LE Periodic Advertising Sync Established" },
1075     { 0x0F, "LE Periodic Advertising Report" },
1076     { 0x10, "LE Periodic Advertising Sync Lost" },
1077     { 0x11, "LE Scan Timeout" },
1078     { 0x12, "LE Advertising Set Terminated" },
1079     { 0x13, "LE Scan Request Received" },
1080     { 0x14, "LE Channel Selection Algorithm" },
1081     { 0x15, "LE Connectionless IQ Report" },
1082     { 0x16, "LE Connection IQ Report" },
1083     { 0x17, "LE CTE Request Failed" },
1084     { 0x18, "LE Periodic Advertising Sync Transfer Received" },
1085     { 0x19, "LE CIS Established" },
1086     { 0x1A, "LE CIS Request" },
1087     { 0x1B, "LE Create BIG Complete" },
1088     { 0x1C, "LE Terminate BIG Complete" },
1089     { 0x1D, "LE BIG Sync Established" },
1090     { 0x1E, "LE BIG Sync Lost" },
1091     { 0x1F, "LE Request Peer SCA Complete" },
1092     { 0x20, "LE Path Loss Threshold" },
1093     { 0x21, "LE Transmit Power Reporting" },
1094     { 0x22, "LE BIGInfo Advertising Report" },
1095     { 0x23, "LE Subrate Change" },
1096     { 0, NULL }
1097 };
1098 
1099 static const value_string evt_le_advertising_evt_types[] = {
1100     { 0x00, "Connectable Undirected Advertising" },
1101     { 0x01, "Connectable Directed Advertising" },
1102     { 0x02, "Scannable Undirected Advertising" },
1103     { 0x03, "Non-Connectable Undirected Advertising" },
1104     { 0x04, "Scan Response" },
1105     { 0, NULL }
1106 };
1107 
1108 static const value_string evt_air_mode_vals[] = {
1109     { 0x00,  UTF8_MICRO_SIGN "-law log" },
1110     { 0x01,  "A-law log" },
1111     { 0x02,  "CVSD" },
1112     { 0x03,  "Transparent Data" },
1113     { 0, NULL }
1114 };
1115 
1116 const value_string bthci_evt_mws_transport_layer_vals[] = {
1117     { 0x00,  "Disabled" },
1118     { 0x01,  "WCI-1 Transport" },
1119     { 0x02,  "WCI-2 Transport" },
1120     { 0, NULL }
1121 };
1122 
1123 static const value_string which_clock_vals[] = {
1124     { 0x00,  "Local Clock" },
1125     { 0x01,  "Piconet Clock" },
1126     { 0, NULL }
1127 };
1128 
1129 static const value_string receive_status_vals[] = {
1130     { 0x00,  "Packet Received Successfully" },
1131     { 0x01,  "Fragment, Data_Length or Data Fields Invalid" },
1132     { 0, NULL }
1133 };
1134 
1135 static const value_string fragment_vals[] = {
1136     { 0x00,  "Continuation" },
1137     { 0x01,  "Start" },
1138     { 0x02,  "End" },
1139     { 0x03,  "No Fragmentation" },
1140     { 0, NULL }
1141 };
1142 
1143 static const value_string event_type_vals[] = {
1144     { 0x01,  "Connectable directed advertising (ADV_DIRECT_IND)" },
1145     { 0, NULL }
1146 };
1147 
1148 const value_string bthci_evt_codec_id_vals[] = {
1149     { 0x00,  "u-Law log" },
1150     { 0x01,  "A-law log" },
1151     { 0x02,  "CVSD" },
1152     { 0x03,  "Transparent" },
1153     { 0x04,  "Linear PCM" },
1154     { 0x05,  "mSBC" },
1155     { 0xFF,  "Vendor Specific" },
1156     { 0, NULL }
1157 };
1158 
1159 static const value_string ext_adv_data_status_vals[] = {
1160     {0x00, "Complete" },
1161     {0x01, "Incomplete, more to come"},
1162     {0x02, "Incomplete, truncated, no more to come"},
1163     {0x03, "Reserved"},
1164     {0, NULL }
1165 };
1166 
1167 static const value_string bthci_evt_primary_phy_vals[] = {
1168     {0x01, "LE 1M"},
1169     {0x03, "LE Coded"},
1170     {0, NULL }
1171 };
1172 
1173 static const value_string bthci_evt_secondary_phy_vals[] = {
1174     {0x00, "No packets on the secondary advertising channel"},
1175     {0x01, "LE 1M"},
1176     {0x02, "LE 2M"},
1177     {0x03, "LE Coded"},
1178     {0, NULL }
1179 };
1180 
1181 static const value_string channel_selection_algo_vals[] = {
1182     { 0x00,  "#1" },
1183     { 0x01,  "#2" },
1184     { 0, NULL }
1185 };
1186 
1187 static const value_string unique_sam_disabled[] = {
1188     { 0xFF, "SAM disabled, all slots available" },
1189     { 0, NULL }
1190 };
1191 
1192 static const value_string packet_status_vals[] = {
1193     { 0x00, "CRC correct" },
1194     { 0x01, "CRC incorrect, Length and CTETime fields used to determine sampling points" },
1195     { 0x02, "CRC incorrect, position and length of the CTE determined in some other way" },
1196     { 0xFF, "Insufficient resources, Channel Index, CTE Type, and Slot Durations invalid" },
1197     { 0, NULL }
1198 };
1199 
1200 static const value_string zone_entered_vals[] = {
1201     { 0x00, "Low" },
1202     { 0x01, "Medium" },
1203     { 0x02, "High" },
1204     { 0, NULL }
1205 };
1206 
1207 static const value_string power_report_reason_vals[] = {
1208     { 0x00, "Local Transmit Power Changed" },
1209     { 0x01, "Remote Transmit Power Changed" },
1210     { 0x02, "Host Requested Read Command Completed" },
1211     { 0, NULL }
1212 };
1213 
1214 static const unit_name_string units_number_events = { " (number events)", NULL };
1215 
1216 
1217 void proto_register_bthci_evt(void);
1218 void proto_reg_handoff_bthci_evt(void);
1219 
bthci_evt_vendor_prompt(packet_info * pinfo _U_,gchar * result)1220 static void bthci_evt_vendor_prompt(packet_info *pinfo _U_, gchar* result)
1221 {
1222     g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Vendor as");
1223 }
1224 
bthci_evt_vendor_value(packet_info * pinfo _U_)1225 static gpointer bthci_evt_vendor_value(packet_info *pinfo _U_)
1226 {
1227     return NULL;
1228 }
1229 
add_opcode(wmem_list_t * opcode_list,guint16 opcode,enum command_status command_status)1230 static void add_opcode(wmem_list_t *opcode_list, guint16 opcode, enum command_status command_status) {
1231     opcode_list_data_t *opcode_list_data;
1232 
1233     opcode_list_data = wmem_new(wmem_packet_scope(), opcode_list_data_t);
1234     if (opcode_list_data) {
1235         opcode_list_data->opcode  = opcode;
1236         opcode_list_data->command_status = command_status;
1237         wmem_list_append(opcode_list, opcode_list_data);
1238     }
1239 }
1240 
1241 static void
save_remote_device_name(tvbuff_t * tvb,gint offset,packet_info * pinfo,guint8 size,guint8 * bd_addr,bluetooth_data_t * bluetooth_data)1242 save_remote_device_name(tvbuff_t *tvb, gint offset, packet_info *pinfo,
1243         guint8 size, guint8 *bd_addr, bluetooth_data_t *bluetooth_data)
1244 {
1245     gint             i = 0;
1246     guint8           length;
1247     wmem_tree_key_t  key[6];
1248     guint32          interface_id;
1249     guint32          adapter_id;
1250     guint32          bd_addr_oui;
1251     guint32          bd_addr_id;
1252     guint32          frame_number;
1253     gchar           *name;
1254     device_name_t   *device_name;
1255 
1256     if (!(!pinfo->fd->visited && bd_addr)) return;
1257 
1258     interface_id = bluetooth_data->interface_id;
1259     adapter_id   = bluetooth_data->adapter_id;
1260 
1261     while (i < size) {
1262         length = tvb_get_guint8(tvb, offset + i);
1263         if (length == 0) break;
1264 
1265         switch(tvb_get_guint8(tvb, offset + i + 1)) {
1266         case 0x08: /* Device Name, shortened */
1267         case 0x09: /* Device Name, full */
1268             name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + i + 2, length - 1, ENC_UTF_8);
1269 
1270             frame_number = pinfo->num;
1271             bd_addr_oui = bd_addr[0] << 16 | bd_addr[1] << 8 | bd_addr[2];
1272             bd_addr_id  = bd_addr[3] << 16 | bd_addr[4] << 8 | bd_addr[5];
1273 
1274             key[0].length = 1;
1275             key[0].key    = &interface_id;
1276             key[1].length = 1;
1277             key[1].key    = &adapter_id;
1278             key[2].length = 1;
1279             key[2].key    = &bd_addr_id;
1280             key[3].length = 1;
1281             key[3].key    = &bd_addr_oui;
1282             key[4].length = 1;
1283             key[4].key    = &frame_number;
1284             key[5].length = 0;
1285             key[5].key    = NULL;
1286 
1287             device_name = (device_name_t *) wmem_new(wmem_file_scope(), device_name_t);
1288             device_name->bd_addr_oui =  bd_addr[0] << 16 | bd_addr[1] << 8 | bd_addr[2];
1289             device_name->bd_addr_id =  bd_addr[3] << 16 | bd_addr[4] << 8 | bd_addr[5];
1290             device_name->name = wmem_strdup(wmem_file_scope(), name);
1291 
1292             wmem_tree_insert32_array(bluetooth_data->bdaddr_to_name, key, device_name);
1293 
1294             break;
1295         }
1296 
1297         i += length + 1;
1298     }
1299 }
1300 
send_hci_summary_status_tap(guint8 status,packet_info * pinfo,bluetooth_data_t * bluetooth_data)1301 static void send_hci_summary_status_tap(guint8 status, packet_info *pinfo, bluetooth_data_t *bluetooth_data)
1302 {
1303     if (have_tap_listener(bluetooth_hci_summary_tap)) {
1304         bluetooth_hci_summary_tap_t  *tap_hci_summary;
1305 
1306         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
1307 
1308         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
1309         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
1310 
1311         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_STATUS;
1312         tap_hci_summary->status = status;
1313         if (try_val_to_str_ext(status, &bthci_cmd_status_vals_ext))
1314             tap_hci_summary->name = val_to_str_ext(status, &bthci_cmd_status_vals_ext, "Unknown 0x%02x");
1315         else
1316             tap_hci_summary->name = NULL;
1317         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
1318     }
1319 }
1320 
send_hci_summary_pending_tap(packet_info * pinfo,bluetooth_data_t * bluetooth_data)1321 static void send_hci_summary_pending_tap(packet_info *pinfo, bluetooth_data_t *bluetooth_data)
1322 {
1323     if (have_tap_listener(bluetooth_hci_summary_tap)) {
1324         bluetooth_hci_summary_tap_t  *tap_hci_summary;
1325 
1326         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
1327 
1328         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
1329         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
1330 
1331         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_STATUS_PENDING;
1332         tap_hci_summary->status = 0;
1333         tap_hci_summary->name = "Pending";
1334         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
1335     }
1336 }
1337 
send_hci_summary_reason_tap(guint8 reason,packet_info * pinfo,bluetooth_data_t * bluetooth_data)1338 static void send_hci_summary_reason_tap(guint8 reason, packet_info *pinfo, bluetooth_data_t *bluetooth_data)
1339 {
1340     if (have_tap_listener(bluetooth_hci_summary_tap)) {
1341         bluetooth_hci_summary_tap_t  *tap_hci_summary;
1342 
1343         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
1344 
1345         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
1346         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
1347 
1348         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_REASON;
1349         tap_hci_summary->reason = reason;
1350         if (try_val_to_str_ext(reason, &bthci_cmd_status_vals_ext))
1351             tap_hci_summary->name = val_to_str_ext(reason, &bthci_cmd_status_vals_ext, "Unknown 0x%02x");
1352         else
1353             tap_hci_summary->name = NULL;
1354         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
1355     }
1356 }
1357 
1358 static int
dissect_iq_sample_list(tvbuff_t * tvb,int offset,proto_tree * tree)1359 dissect_iq_sample_list(tvbuff_t *tvb, int offset, proto_tree *tree)
1360 {
1361     guint8 samples;
1362 
1363     proto_tree_add_item(tree, hf_bthci_evt_sample_count, tvb, offset, 1, ENC_NA);
1364     samples = tvb_get_guint8(tvb, offset);
1365     offset += 1;
1366 
1367     if (samples > 0) {
1368         guint8 i;
1369         proto_item *sub_item;
1370         proto_tree *sub_tree;
1371 
1372         sub_item = proto_tree_add_none_format(tree, hf_bthci_evt_le_report, tvb, offset, 2 * samples, "IQ Samples");
1373         sub_tree = proto_item_add_subtree(sub_item, ett_iq_sample_list);
1374 
1375         for (i = 0; i < samples; i++) {
1376             proto_item *sample_item;
1377             proto_tree *sample_tree;
1378 
1379             sample_item = proto_tree_add_none_format(sub_tree, hf_bthci_evt_le_report, tvb, offset, 2, "Sample %2d, I:%4d, Q:%4d",
1380                                                         i, tvb_get_gint8(tvb, offset), tvb_get_gint8(tvb, offset+1));
1381             sample_tree = proto_item_add_subtree(sample_item, ett_iq_samples);
1382 
1383             proto_tree_add_item(sample_tree, hf_bthci_evt_i_sample, tvb, offset, 1, ENC_NA);
1384             offset += 1;
1385             proto_tree_add_item(sample_tree, hf_bthci_evt_q_sample, tvb, offset, 1, ENC_NA);
1386             offset += 1;
1387         }
1388     }
1389     return offset;
1390 }
1391 
1392 
1393 static int
dissect_bthci_evt_inquire_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1394 dissect_bthci_evt_inquire_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
1395         proto_tree *tree, bluetooth_data_t *bluetooth_data)
1396 {
1397     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1398     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
1399     offset += 1;
1400 
1401     return offset;
1402 }
1403 
1404 static int
dissect_bthci_evt_connect_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1405 dissect_bthci_evt_connect_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
1406         proto_tree *tree, bluetooth_data_t *bluetooth_data)
1407 {
1408     guint32       connection_handle;
1409     guint8        bd_addr[6];
1410     guint8        status;
1411 
1412     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1413     status = tvb_get_guint8(tvb, offset);
1414     send_hci_summary_status_tap(status, pinfo, bluetooth_data);
1415     offset += 1;
1416 
1417     connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
1418     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1419     offset += 2;
1420 
1421     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
1422     if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
1423         wmem_tree_key_t    key[5];
1424         guint32            k_interface_id;
1425         guint32            k_adapter_id;
1426         guint32            k_connection_handle;
1427         guint32            k_frame_number;
1428         remote_bdaddr_t   *remote_bdaddr;
1429         chandle_session_t *chandle_session;
1430         connection_mode_t *connection_mode;
1431 
1432         k_interface_id = bluetooth_data->interface_id;
1433         k_adapter_id = bluetooth_data->adapter_id;
1434         k_connection_handle = connection_handle;
1435         k_frame_number = pinfo->num;
1436 
1437         key[0].length = 1;
1438         key[0].key    = &k_interface_id;
1439         key[1].length = 1;
1440         key[1].key    = &k_adapter_id;
1441         key[2].length = 1;
1442         key[2].key    = &k_connection_handle;
1443         key[3].length = 1;
1444         key[3].key    = &k_frame_number;
1445         key[4].length = 0;
1446         key[4].key    = NULL;
1447 
1448         remote_bdaddr = (remote_bdaddr_t *) wmem_new(wmem_file_scope(), remote_bdaddr_t);
1449         remote_bdaddr->interface_id = bluetooth_data->interface_id;
1450         remote_bdaddr->adapter_id = bluetooth_data->adapter_id;
1451         remote_bdaddr->chandle = connection_handle;
1452         memcpy(remote_bdaddr->bd_addr, bd_addr, 6);
1453 
1454         wmem_tree_insert32_array(bluetooth_data->chandle_to_bdaddr, key, remote_bdaddr);
1455 
1456         chandle_session = (chandle_session_t *) wmem_new(wmem_file_scope(), chandle_session_t);
1457         chandle_session->connect_in_frame = k_frame_number;
1458         chandle_session->disconnect_in_frame = max_disconnect_in_frame;
1459         chandle_session->link_type = BT_LINK_TYPE_ACL;
1460         wmem_tree_insert32_array(bluetooth_data->chandle_sessions, key, chandle_session);
1461 
1462         connection_mode = (connection_mode_t *) wmem_new(wmem_file_scope(), connection_mode_t);
1463         connection_mode->mode = 0;
1464         connection_mode->change_in_frame = k_frame_number;
1465 
1466         wmem_tree_insert32_array(bluetooth_data->chandle_to_mode, key, connection_mode);
1467     }
1468 
1469     proto_tree_add_item(tree, hf_bthci_evt_link_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1470     offset += 1;
1471 
1472     proto_tree_add_item(tree, hf_bthci_evt_encryption_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1473     offset += 1;
1474 
1475     return offset;
1476 }
1477 
1478 static int
dissect_bthci_evt_connect_request(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1479 dissect_bthci_evt_connect_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
1480 {
1481     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
1482 
1483     call_dissector(btcommon_cod_handle, tvb_new_subset_length(tvb, offset, 3), pinfo, tree);
1484     offset += 3;
1485 
1486     proto_tree_add_item(tree, hf_bthci_evt_link_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1487     offset += 1;
1488 
1489     return offset;
1490 }
1491 
1492 static int
dissect_bthci_evt_disconnect_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1493 dissect_bthci_evt_disconnect_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
1494         proto_tree *tree, bluetooth_data_t *bluetooth_data)
1495 {
1496     guint32          connection_handle;
1497     guint8           status;
1498 
1499     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1500     status = tvb_get_guint8(tvb, offset);
1501     send_hci_summary_status_tap(status, pinfo, bluetooth_data);
1502     offset += 1;
1503 
1504     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1505     connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
1506     offset += 2;
1507 
1508     proto_tree_add_item(tree, hf_bthci_evt_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1509     send_hci_summary_reason_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
1510     offset += 1;
1511 
1512     if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
1513         wmem_tree_key_t     key[4];
1514         guint32             interface_id;
1515         guint32             adapter_id;
1516         chandle_session_t  *chandle_session;
1517         wmem_tree_t        *subtree;
1518 
1519         interface_id      = bluetooth_data->interface_id;
1520         adapter_id        = bluetooth_data->adapter_id;
1521 
1522         key[0].length = 1;
1523         key[0].key    = &interface_id;
1524         key[1].length = 1;
1525         key[1].key    = &adapter_id;
1526         key[2].length = 1;
1527         key[2].key    = &connection_handle;
1528         key[3].length = 0;
1529         key[3].key    = NULL;
1530 
1531         subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->chandle_sessions, key);
1532         chandle_session = (subtree) ? (chandle_session_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
1533         if (chandle_session && chandle_session->connect_in_frame < pinfo->num)
1534             chandle_session->disconnect_in_frame = pinfo->num;
1535     }
1536 
1537     return offset;
1538 }
1539 
1540 static int
dissect_bthci_evt_auth_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1541 dissect_bthci_evt_auth_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
1542         proto_tree *tree, bluetooth_data_t *bluetooth_data)
1543 {
1544     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1545     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
1546     offset += 1;
1547 
1548     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1549     offset += 2;
1550 
1551     return offset;
1552 }
1553 
1554 static int
dissect_bthci_evt_lmp_features(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree,guint8 page_numer)1555 dissect_bthci_evt_lmp_features(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 page_numer)
1556 {
1557     guint8      fc_lag;
1558     proto_item *fl_lag_item;
1559     proto_tree *lmp_tree = NULL;
1560 
1561     if (tree) {
1562         proto_item *lmp_item;
1563 
1564         lmp_item = proto_tree_add_item(tree, hf_lmp_features, tvb, offset, 8, ENC_NA);
1565         lmp_tree = proto_item_add_subtree(lmp_item, ett_lmp_subtree);
1566     }
1567 
1568     switch (page_numer) {
1569     case 0:
1570         proto_tree_add_item(lmp_tree, hf_lmp_feature_3slot_packets,                          tvb, offset, 1, ENC_LITTLE_ENDIAN);
1571         proto_tree_add_item(lmp_tree, hf_lmp_feature_5slot_packets,                          tvb, offset, 1, ENC_LITTLE_ENDIAN);
1572         proto_tree_add_item(lmp_tree, hf_lmp_feature_encryption,                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
1573         proto_tree_add_item(lmp_tree, hf_lmp_feature_slot_offset,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1574         proto_tree_add_item(lmp_tree, hf_lmp_feature_timing_accuracy,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
1575         proto_tree_add_item(lmp_tree, hf_lmp_feature_role_switch,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1576         proto_tree_add_item(lmp_tree, hf_lmp_feature_hold_mode,                              tvb, offset, 1, ENC_LITTLE_ENDIAN);
1577         proto_tree_add_item(lmp_tree, hf_lmp_feature_sniff_mode,                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
1578         offset += 1;
1579 
1580         proto_tree_add_item(lmp_tree, hf_lmp_feature_park_state,                             tvb, offset, 1, ENC_LITTLE_ENDIAN);
1581         proto_tree_add_item(lmp_tree, hf_lmp_feature_power_control_requests,                 tvb, offset, 1, ENC_LITTLE_ENDIAN);
1582         proto_tree_add_item(lmp_tree, hf_lmp_feature_channel_quality_driven_data_rate,       tvb, offset, 1, ENC_LITTLE_ENDIAN);
1583         proto_tree_add_item(lmp_tree, hf_lmp_feature_sco_link,                               tvb, offset, 1, ENC_LITTLE_ENDIAN);
1584         proto_tree_add_item(lmp_tree, hf_lmp_feature_hv2_packets,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1585         proto_tree_add_item(lmp_tree, hf_lmp_feature_hv3_packets,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1586         proto_tree_add_item(lmp_tree, hf_lmp_feature_u_law_log_synchronous_data,             tvb, offset, 1, ENC_LITTLE_ENDIAN);
1587         proto_tree_add_item(lmp_tree, hf_lmp_feature_a_law_log_synchronous_data,             tvb, offset, 1, ENC_LITTLE_ENDIAN);
1588         offset += 1;
1589 
1590         proto_tree_add_item(lmp_tree, hf_lmp_feature_cvsd_synchronous_data,                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
1591         proto_tree_add_item(lmp_tree, hf_lmp_feature_paging_parameter_negotiation,           tvb, offset, 1, ENC_LITTLE_ENDIAN);
1592         proto_tree_add_item(lmp_tree, hf_lmp_feature_power_control,                          tvb, offset, 1, ENC_LITTLE_ENDIAN);
1593         proto_tree_add_item(lmp_tree, hf_lmp_feature_transparent_synchronous_data,           tvb, offset, 1, ENC_LITTLE_ENDIAN);
1594         fl_lag_item = proto_tree_add_item(lmp_tree,hf_lmp_feature_flow_control_lag,          tvb, offset, 1, ENC_LITTLE_ENDIAN);
1595         fc_lag = (tvb_get_guint8(tvb, offset) & 0x70) >> 4;
1596         proto_item_append_text(fl_lag_item, " (%i bytes)", 256 * fc_lag);
1597 
1598         proto_tree_add_item(lmp_tree,hf_lmp_feature_broadcast_encryption,                    tvb, offset, 1, ENC_LITTLE_ENDIAN);
1599         offset += 1;
1600 
1601         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_24,                            tvb, offset, 1, ENC_NA);
1602         proto_tree_add_item(lmp_tree, hf_lmp_feature_edr_acl_2mbps_mode,                     tvb, offset, 1, ENC_LITTLE_ENDIAN);
1603         proto_tree_add_item(lmp_tree, hf_lmp_feature_edr_acl_3mbps_mode,                     tvb, offset, 1, ENC_LITTLE_ENDIAN);
1604         proto_tree_add_item(lmp_tree, hf_lmp_feature_enhanced_inquiry_scan,                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
1605         proto_tree_add_item(lmp_tree, hf_lmp_feature_interlaced_inquiry_scan,                tvb, offset, 1, ENC_LITTLE_ENDIAN);
1606         proto_tree_add_item(lmp_tree, hf_lmp_feature_interlaced_page_scan,                   tvb, offset, 1, ENC_LITTLE_ENDIAN);
1607         proto_tree_add_item(lmp_tree, hf_lmp_feature_rssi_with_inquiry_results,              tvb, offset, 1, ENC_LITTLE_ENDIAN);
1608         proto_tree_add_item(lmp_tree, hf_lmp_feature_ev3_packets,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1609         offset += 1;
1610 
1611         proto_tree_add_item(lmp_tree, hf_lmp_feature_ev4_packets,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1612         proto_tree_add_item(lmp_tree, hf_lmp_feature_ev5_packets,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1613         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_34,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1614         proto_tree_add_item(lmp_tree, hf_lmp_feature_afh_capable_slave,                      tvb, offset, 1, ENC_LITTLE_ENDIAN);
1615         proto_tree_add_item(lmp_tree, hf_lmp_feature_afh_classification_slave,               tvb, offset, 1, ENC_LITTLE_ENDIAN);
1616         proto_tree_add_item(lmp_tree, hf_lmp_feature_br_edr_not_supported,                   tvb, offset, 1, ENC_LITTLE_ENDIAN);
1617         proto_tree_add_item(lmp_tree, hf_lmp_feature_le_supported_controller,                tvb, offset, 1, ENC_LITTLE_ENDIAN);
1618         proto_tree_add_item(lmp_tree, hf_lmp_feature_3slot_edr_acl_packets,                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
1619         offset += 1;
1620 
1621         proto_tree_add_item(lmp_tree, hf_lmp_feature_5slot_edr_acl_packets,                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
1622         proto_tree_add_item(lmp_tree, hf_lmp_feature_sniff_subrating,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
1623         proto_tree_add_item(lmp_tree, hf_lmp_feature_pause_encryption,                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
1624         proto_tree_add_item(lmp_tree, hf_lmp_feature_afh_capable_master,                     tvb, offset, 1, ENC_LITTLE_ENDIAN);
1625         proto_tree_add_item(lmp_tree, hf_lmp_feature_afh_classification_master,              tvb, offset, 1, ENC_LITTLE_ENDIAN);
1626         proto_tree_add_item(lmp_tree, hf_lmp_feature_edr_esco_2mbps_mode,                    tvb, offset, 1, ENC_LITTLE_ENDIAN);
1627         proto_tree_add_item(lmp_tree, hf_lmp_feature_edr_esco_3mbps_mode,                    tvb, offset, 1, ENC_LITTLE_ENDIAN);
1628         proto_tree_add_item(lmp_tree, hf_lmp_feature_3slot_edr_esco_packets,                 tvb, offset, 1, ENC_LITTLE_ENDIAN);
1629         offset += 1;
1630 
1631         proto_tree_add_item(lmp_tree, hf_lmp_feature_extended_inquiry_response,              tvb, offset, 1, ENC_LITTLE_ENDIAN);
1632         proto_tree_add_item(lmp_tree, hf_lmp_feature_simultaneous_le_and_br_edr_controller,  tvb, offset, 1, ENC_LITTLE_ENDIAN);
1633         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_50,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1634         proto_tree_add_item(lmp_tree, hf_lmp_feature_secure_simple_pairing,                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
1635         proto_tree_add_item(lmp_tree, hf_lmp_feature_encapsulated_pdu,                       tvb, offset, 1, ENC_LITTLE_ENDIAN);
1636         proto_tree_add_item(lmp_tree, hf_lmp_feature_erroneous_data_reporting,               tvb, offset, 1, ENC_LITTLE_ENDIAN);
1637         proto_tree_add_item(lmp_tree, hf_lmp_feature_non_flushable_packet_boundary_flag,     tvb, offset, 1, ENC_LITTLE_ENDIAN);
1638         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_55,                            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1639         offset += 1;
1640 
1641         proto_tree_add_item(lmp_tree, hf_lmp_feature_link_supervision_timeout_changed_event, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1642         proto_tree_add_item(lmp_tree, hf_lmp_feature_inquiry_tx_power_level,                 tvb, offset, 1, ENC_LITTLE_ENDIAN);
1643         proto_tree_add_item(lmp_tree, hf_lmp_feature_enhanced_power_control,                 tvb, offset, 1, ENC_LITTLE_ENDIAN);
1644         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_59_62,                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
1645         proto_tree_add_item(lmp_tree, hf_lmp_feature_extended_features,                      tvb, offset, 1, ENC_LITTLE_ENDIAN);
1646         offset += 1;
1647 
1648         break;
1649     case 1:
1650         proto_tree_add_item(lmp_tree, hf_lmp_feature_secure_simple_pairing_host,             tvb, offset, 1, ENC_LITTLE_ENDIAN);
1651         proto_tree_add_item(lmp_tree, hf_lmp_feature_le_supported_host,                      tvb, offset, 1, ENC_LITTLE_ENDIAN);
1652         proto_tree_add_item(lmp_tree, hf_lmp_feature_simultaneous_le_and_br_edr_host,        tvb, offset, 1, ENC_LITTLE_ENDIAN);
1653         proto_tree_add_item(lmp_tree, hf_lmp_feature_secure_connections_host,                tvb, offset, 1, ENC_LITTLE_ENDIAN);
1654         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_68_71,                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
1655         offset += 1;
1656 
1657         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved,                               tvb, offset, 7, ENC_NA);
1658         offset += 7;
1659 
1660         break;
1661     case 2:
1662         proto_tree_add_item(lmp_tree, hf_lmp_feature_csb_master_operation,                   tvb, offset, 1, ENC_LITTLE_ENDIAN);
1663         proto_tree_add_item(lmp_tree, hf_lmp_feature_csb_slave_operation,                    tvb, offset, 1, ENC_LITTLE_ENDIAN);
1664         proto_tree_add_item(lmp_tree, hf_lmp_feature_synchronization_train,                  tvb, offset, 1, ENC_LITTLE_ENDIAN);
1665         proto_tree_add_item(lmp_tree, hf_lmp_feature_synchronization_scan,                   tvb, offset, 1, ENC_LITTLE_ENDIAN);
1666         proto_tree_add_item(lmp_tree, hf_lmp_feature_inquiry_response_notification_event,    tvb, offset, 1, ENC_LITTLE_ENDIAN);
1667         proto_tree_add_item(lmp_tree, hf_lmp_feature_generalized_interlaced_scan,            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1668         proto_tree_add_item(lmp_tree, hf_lmp_feature_coarse_clock_adjustment,                tvb, offset, 1, ENC_LITTLE_ENDIAN);
1669         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_135,                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
1670         offset += 1;
1671 
1672         proto_tree_add_item(lmp_tree, hf_lmp_feature_secure_connections_controller,          tvb, offset, 1, ENC_LITTLE_ENDIAN);
1673         proto_tree_add_item(lmp_tree, hf_lmp_feature_ping,                                   tvb, offset, 1, ENC_LITTLE_ENDIAN);
1674         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved_138,                           tvb, offset, 1, ENC_LITTLE_ENDIAN);
1675         proto_tree_add_item(lmp_tree, hf_lmp_feature_train_nudging,                          tvb, offset, 1, ENC_LITTLE_ENDIAN);
1676         proto_tree_add_item(lmp_tree, hf_lmp_feature_slot_availability_mask,                 tvb, offset, 1, ENC_LITTLE_ENDIAN);
1677         offset += 1;
1678 
1679         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved,                               tvb, offset, 6, ENC_NA);
1680         offset += 6;
1681 
1682         break;
1683     default:
1684         proto_tree_add_item(lmp_tree, hf_lmp_feature_reserved,                               tvb, offset, 8, ENC_NA);
1685         offset += 8;
1686     }
1687 
1688     return offset;
1689 }
1690 
1691 static int
dissect_bthci_evt_pin_code_request(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1692 dissect_bthci_evt_pin_code_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
1693 {
1694     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
1695 
1696     return offset;
1697 }
1698 
1699 static int
dissect_bthci_evt_link_key_request(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1700 dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
1701 {
1702     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
1703 
1704     return offset;
1705 }
1706 
1707 static int
dissect_bthci_evt_link_key_notification(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1708 dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
1709 {
1710     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
1711 
1712     proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
1713     offset += 16;
1714 
1715     proto_tree_add_item(tree, hf_bthci_evt_key_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1716     offset += 1;
1717 
1718     return offset;
1719 }
1720 
1721 static int
dissect_bthci_evt_return_link_keys(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1722 dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
1723 {
1724     guint8 evt_num_keys;
1725 
1726     evt_num_keys = tvb_get_guint8(tvb, offset);
1727     proto_tree_add_item(tree, hf_bthci_evt_num_keys, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1728     offset += 1;
1729 
1730     while (evt_num_keys--) {
1731         offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
1732 
1733         proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
1734         offset += 16;
1735 
1736     }
1737 
1738     return offset;
1739 }
1740 
1741 static int
dissect_bthci_evt_read_remote_support_features_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1742 dissect_bthci_evt_read_remote_support_features_complete(tvbuff_t *tvb, int offset,
1743         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
1744 {
1745     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1746     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
1747     offset += 1;
1748 
1749     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1750     offset += 2;
1751 
1752     offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, 0);
1753 
1754     return offset;
1755 }
1756 
1757 static int
dissect_bthci_evt_remote_name_req_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1758 dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset,
1759         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
1760 {
1761     guint8      bd_addr[6];
1762 
1763     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1764     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
1765     offset += 1;
1766 
1767     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
1768 
1769     proto_tree_add_item(tree, hf_bthci_evt_remote_name, tvb, offset, 248, ENC_UTF_8|ENC_NA);
1770     if (!pinfo->fd->visited) {
1771         wmem_tree_key_t key[6];
1772         guint32         interface_id;
1773         guint32         adapter_id;
1774         guint32         bd_addr_oui;
1775         guint32         bd_addr_id;
1776         guint32         frame_number;
1777         gchar           *name;
1778         device_name_t   *device_name;
1779 
1780         name = tvb_get_string_enc(wmem_file_scope(), tvb, offset, 248, ENC_UTF_8);
1781         interface_id = bluetooth_data->interface_id;
1782         adapter_id   = bluetooth_data->adapter_id;
1783         frame_number = pinfo->num;
1784         bd_addr_oui  = bd_addr[0] << 16 | bd_addr[1] << 8 | bd_addr[2];
1785         bd_addr_id   = bd_addr[3] << 16 | bd_addr[4] << 8 | bd_addr[5];
1786 
1787         key[0].length = 1;
1788         key[0].key    = &interface_id;
1789         key[1].length = 1;
1790         key[1].key    = &adapter_id;
1791         key[2].length = 1;
1792         key[2].key    = &bd_addr_id;
1793         key[3].length = 1;
1794         key[3].key    = &bd_addr_oui;
1795         key[4].length = 1;
1796         key[4].key    = &frame_number;
1797         key[5].length = 0;
1798         key[5].key    = NULL;
1799 
1800         device_name = (device_name_t *) wmem_new(wmem_file_scope(), device_name_t);
1801         device_name->bd_addr_oui =  bd_addr[0] << 16 | bd_addr[1] << 8 | bd_addr[2];
1802         device_name->bd_addr_id =  bd_addr[3] << 16 | bd_addr[4] << 8 | bd_addr[5];
1803         device_name->name = name;
1804 
1805         wmem_tree_insert32_array(bluetooth_data->bdaddr_to_name, key, device_name);
1806     }
1807 
1808     if (have_tap_listener(bluetooth_device_tap)) {
1809         bluetooth_device_tap_t  *tap_device;
1810 
1811         tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
1812         tap_device->interface_id  = bluetooth_data->interface_id;
1813         tap_device->adapter_id    = bluetooth_data->adapter_id;
1814         memcpy(tap_device->bd_addr, bd_addr, 6);
1815         tap_device->has_bd_addr = TRUE;
1816         tap_device->is_local = FALSE;
1817         tap_device->type = BLUETOOTH_DEVICE_NAME;
1818         tap_device->data.name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 248, ENC_UTF_8);
1819         tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
1820     }
1821 
1822     offset += 248;
1823 
1824     return offset;
1825 }
1826 
1827 static int
dissect_bthci_evt_read_remote_version_information_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,bluetooth_data_t * bluetooth_data,proto_tree * tree)1828 dissect_bthci_evt_read_remote_version_information_complete(tvbuff_t *tvb, int offset,
1829         packet_info *pinfo, bluetooth_data_t *bluetooth_data, proto_tree *tree)
1830 {
1831     proto_tree_add_item(tree, hf_bthci_evt_status,            tvb, offset, 1, ENC_LITTLE_ENDIAN);
1832     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
1833     offset += 1;
1834 
1835     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1836     offset += 2;
1837 
1838     proto_tree_add_item(tree, hf_bthci_evt_vers_nr,           tvb, offset, 1, ENC_LITTLE_ENDIAN);
1839     offset += 1;
1840 
1841     proto_tree_add_item(tree, hf_bthci_evt_comp_id,           tvb, offset, 2, ENC_LITTLE_ENDIAN);
1842     offset += 2;
1843 
1844     proto_tree_add_item(tree, hf_bthci_evt_sub_vers_nr,       tvb, offset, 2, ENC_LITTLE_ENDIAN);
1845     offset += 2;
1846 
1847     if (have_tap_listener(bluetooth_device_tap)) {
1848         wmem_tree_t              *subtree;
1849         wmem_tree_key_t           key[4];
1850         guint32                   interface_id;
1851         guint32                   adapter_id;
1852         guint32                   connection_handle;
1853         remote_bdaddr_t          *remote_bdaddr;
1854         bluetooth_device_tap_t   *tap_device;
1855         guint8                    lmp_version;
1856         guint16                   lmp_subversion;
1857         guint16                   manufacturer;
1858 
1859         lmp_version    = tvb_get_guint8(tvb, offset - 5);
1860         manufacturer   = tvb_get_letohs(tvb, offset - 4);
1861         lmp_subversion = tvb_get_letohs(tvb, offset - 2);
1862 
1863         interface_id      = bluetooth_data->interface_id;
1864         adapter_id        = bluetooth_data->adapter_id;
1865         connection_handle = tvb_get_guint16(tvb, offset - 7, ENC_LITTLE_ENDIAN) & 0x0fff;
1866 
1867         key[0].length = 1;
1868         key[0].key    = &interface_id;
1869         key[1].length = 1;
1870         key[1].key    = &adapter_id;
1871         key[2].length = 1;
1872         key[2].key    = &connection_handle;
1873         key[3].length = 0;
1874         key[3].key    = NULL;
1875 
1876         subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->chandle_to_bdaddr, key);
1877         remote_bdaddr = (subtree) ? (remote_bdaddr_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
1878 
1879         tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
1880         tap_device->type = BLUETOOTH_DEVICE_REMOTE_VERSION;
1881         tap_device->interface_id  = bluetooth_data->interface_id;
1882         tap_device->adapter_id    = bluetooth_data->adapter_id;
1883 
1884         if (remote_bdaddr) {
1885             tap_device->has_bd_addr = TRUE;
1886             memcpy(tap_device->bd_addr, remote_bdaddr->bd_addr, 6);
1887         } else {
1888             tap_device->has_bd_addr = FALSE;
1889         }
1890         tap_device->is_local = FALSE;
1891         tap_device->data.remote_version.lmp_version     = lmp_version;
1892         tap_device->data.remote_version.lmp_subversion  = lmp_subversion;
1893         tap_device->data.remote_version.manufacturer    = manufacturer;
1894         tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
1895     }
1896 
1897     return offset;
1898 }
1899 
1900 static int
dissect_bthci_evt_flush_occurred(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)1901 dissect_bthci_evt_flush_occurred(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1902 {
1903     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1904     offset += 2;
1905 
1906     return offset;
1907 }
1908 
1909 static int
dissect_bthci_evt_number_of_completed_packets(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)1910 dissect_bthci_evt_number_of_completed_packets(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1911 {
1912     guint8 evt_num_handles;
1913 
1914     evt_num_handles = tvb_get_guint8(tvb, offset);
1915     proto_tree_add_item(tree, hf_bthci_evt_num_handles, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1916     offset += 1;
1917 
1918     while (evt_num_handles--) {
1919         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1920         offset += 2;
1921 
1922         proto_tree_add_item(tree, hf_bthci_evt_num_compl_packets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1923         offset += 2;
1924 
1925     }
1926 
1927     return offset;
1928 }
1929 
1930 static int
dissect_bthci_evt_mode_change(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1931 dissect_bthci_evt_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo,
1932         proto_tree *tree, bluetooth_data_t *bluetooth_data)
1933 {
1934     proto_item *handle_item;
1935     guint32     connection_handle;
1936     guint8      mode;
1937     guint8      status;
1938 
1939     proto_tree_add_item(tree, hf_bthci_evt_status,                   tvb, offset, 1, ENC_LITTLE_ENDIAN);
1940     status = tvb_get_guint8(tvb, offset);
1941     send_hci_summary_status_tap(status, pinfo, bluetooth_data);
1942     offset += 1;
1943 
1944     proto_tree_add_item(tree, hf_bthci_evt_connection_handle,        tvb, offset, 2, ENC_LITTLE_ENDIAN);
1945     connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
1946     offset += 2;
1947 
1948     proto_tree_add_item(tree, hf_bthci_evt_curr_mode,                tvb, offset, 1, ENC_LITTLE_ENDIAN);
1949     mode = tvb_get_guint8(tvb, offset);
1950     offset += 1;
1951 
1952     handle_item = proto_tree_add_item(tree, hf_bthci_evt_interval,   tvb, offset, 2, ENC_LITTLE_ENDIAN);
1953     proto_item_append_text(handle_item, " Baseband slots (%f msec)", tvb_get_letohs(tvb, offset)*0.625);
1954     offset += 2;
1955 
1956     if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
1957         wmem_tree_key_t     key[5];
1958         guint32             interface_id;
1959         guint32             adapter_id;
1960         guint32             frame_number;
1961         connection_mode_t  *connection_mode;
1962 
1963         interface_id = bluetooth_data->interface_id;
1964         adapter_id   = bluetooth_data->adapter_id;
1965         frame_number = pinfo->num;
1966 
1967         key[0].length = 1;
1968         key[0].key    = &interface_id;
1969         key[1].length = 1;
1970         key[1].key    = &adapter_id;
1971         key[2].length = 1;
1972         key[2].key    = &connection_handle;
1973         key[3].length = 1;
1974         key[3].key    = &frame_number;
1975         key[4].length = 0;
1976         key[4].key    = NULL;
1977 
1978         connection_mode = (connection_mode_t *) wmem_new(wmem_file_scope(), connection_mode_t);
1979         connection_mode->mode = mode;
1980         connection_mode->change_in_frame = frame_number;
1981 
1982         wmem_tree_insert32_array(bluetooth_data->chandle_to_mode, key, connection_mode);
1983     }
1984 
1985     return offset;
1986 }
1987 
1988 static int
dissect_bthci_evt_role_change(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)1989 dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo,
1990         proto_tree *tree, bluetooth_data_t *bluetooth_data)
1991 {
1992     guint8  bd_addr[6];
1993     guint8  role;
1994     guint8  status;
1995 
1996     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1997     status = tvb_get_guint8(tvb, offset);
1998     send_hci_summary_status_tap(status, pinfo, bluetooth_data);
1999     offset += 1;
2000 
2001     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
2002 
2003     proto_tree_add_item(tree, hf_bthci_evt_role,   tvb, offset, 1, ENC_LITTLE_ENDIAN);
2004     role = tvb_get_guint8(tvb, offset);
2005     offset += 1;
2006 
2007     if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
2008         guint32           interface_id;
2009         guint32           adapter_id;
2010         guint32           bd_addr_oui;
2011         guint32           bd_addr_id;
2012         guint32           frame_number;
2013         wmem_tree_key_t   key[6];
2014         device_role_t    *device_role;
2015 
2016         interface_id = bluetooth_data->interface_id;
2017         adapter_id   = bluetooth_data->adapter_id;
2018         frame_number = pinfo->num;
2019         bd_addr_oui  = bd_addr[0] << 16 | bd_addr[1] << 8 | bd_addr[2];
2020         bd_addr_id   = bd_addr[3] << 16 | bd_addr[4] << 8 | bd_addr[5];
2021 
2022         key[0].length = 1;
2023         key[0].key    = &interface_id;
2024         key[1].length = 1;
2025         key[1].key    = &adapter_id;
2026         key[2].length = 1;
2027         key[2].key    = &bd_addr_id;
2028         key[3].length = 1;
2029         key[3].key    = &bd_addr_oui;
2030         key[4].length = 1;
2031         key[4].key    = &frame_number;
2032         key[5].length = 0;
2033         key[5].key    = NULL;
2034 
2035         device_role = (device_role_t *) wmem_new(wmem_file_scope(), device_role_t);
2036         device_role->change_in_frame = frame_number;
2037         if (role == 0)
2038             device_role->role = ROLE_SLAVE;
2039         else if (role == 1)
2040             device_role->role = ROLE_MASTER;
2041         else
2042             device_role->role = ROLE_UNKNOWN;
2043 
2044         wmem_tree_insert32_array(bluetooth_data->bdaddr_to_role, key, device_role);
2045     }
2046 
2047     return offset;
2048 }
2049 
2050 static int
dissect_bthci_evt_hardware_error(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2051 dissect_bthci_evt_hardware_error(tvbuff_t *tvb, int offset, packet_info *pinfo,
2052         proto_tree *tree, bluetooth_data_t *bluetooth_data)
2053 {
2054     proto_tree_add_item(tree, hf_bthci_evt_hardware_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2055     offset += 1;
2056 
2057     if (have_tap_listener(bluetooth_hci_summary_tap)) {
2058         bluetooth_hci_summary_tap_t  *tap_hci_summary;
2059 
2060         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
2061 
2062         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
2063         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
2064 
2065         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_HARDWARE_ERROR;
2066         tap_hci_summary->hardware_error = tvb_get_guint8(tvb, offset - 1);
2067         tap_hci_summary->name = NULL;
2068         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
2069     }
2070 
2071     return offset;
2072 }
2073 
2074 static int
dissect_bthci_evt_loopback_command(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2075 dissect_bthci_evt_loopback_command(tvbuff_t *tvb, int offset,
2076         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2077 {
2078     tvbuff_t *next_tvb;
2079 
2080     next_tvb = tvb_new_subset_remaining(tvb, offset);
2081     call_dissector_with_data(bthci_cmd_handle, next_tvb, pinfo, tree, bluetooth_data);
2082 
2083     offset += tvb_reported_length_remaining(tvb, offset);
2084 
2085     return offset;
2086 }
2087 
2088 static int
dissect_bthci_evt_data_buffer_overflow(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)2089 dissect_bthci_evt_data_buffer_overflow(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2090 {
2091     proto_tree_add_item(tree, hf_bthci_evt_link_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2092     offset += 1;
2093 
2094     return offset;
2095 }
2096 
2097 static int
dissect_bthci_evt_read_clock_offset_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2098 dissect_bthci_evt_read_clock_offset_complete(tvbuff_t *tvb, int offset,
2099         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2100 {
2101     proto_item *handle_item;
2102     gint16      clk;
2103 
2104     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2105     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2106     offset += 1;
2107 
2108     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2109     offset += 2;
2110 
2111     handle_item = proto_tree_add_item(tree, hf_bthci_evt_clock_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2112     clk = tvb_get_letohs(tvb, offset) & 0x7FFF; /* only bits 0-14 are valid  */
2113     proto_item_append_text(handle_item, " (%g ms)", 1.25*clk);
2114     offset += 2;
2115 
2116     return offset;
2117 }
2118 
2119 static int
dissect_bthci_evt_max_slots_change(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)2120 dissect_bthci_evt_max_slots_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2121 {
2122     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2123     offset += 2;
2124 
2125     proto_tree_add_item(tree, hf_bthci_evt_max_slots,         tvb, offset, 1, ENC_LITTLE_ENDIAN);
2126     offset += 1;
2127 
2128     return offset;
2129 }
2130 
2131 static int
dissect_bthci_evt_qos_violation(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)2132 dissect_bthci_evt_qos_violation(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2133 {
2134     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2135     offset += 2;
2136 
2137     return offset;
2138 }
2139 
2140 static int
dissect_bthci_evt_conn_packet_type_changed(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2141 dissect_bthci_evt_conn_packet_type_changed(tvbuff_t *tvb, int offset,
2142         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2143 {
2144     proto_item         *connection_handle_subtree;
2145     guint32             connection_handle;
2146     guint32             link_type = BT_LINK_TYPE_UNKNOWN;
2147     wmem_tree_key_t     key[4];
2148     guint32             interface_id;
2149     guint32             adapter_id;
2150     chandle_session_t  *chandle_session;
2151     wmem_tree_t        *subtree;
2152 
2153 
2154     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2155     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2156     offset += 1;
2157 
2158     connection_handle_subtree = proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2159     connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
2160     offset += 2;
2161 
2162     interface_id      = bluetooth_data->interface_id;
2163     adapter_id        = bluetooth_data->adapter_id;
2164 
2165     key[0].length = 1;
2166     key[0].key    = &interface_id;
2167     key[1].length = 1;
2168     key[1].key    = &adapter_id;
2169     key[2].length = 1;
2170     key[2].key    = &connection_handle;
2171     key[3].length = 0;
2172     key[3].key    = NULL;
2173 
2174     subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->chandle_sessions, key);
2175     chandle_session = (subtree) ? (chandle_session_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
2176     if (chandle_session && chandle_session->connect_in_frame < pinfo->num)
2177         link_type = chandle_session->link_type;
2178 
2179     if (link_type == BT_LINK_TYPE_ACL) {
2180         proto_tree_add_bitmask(tree, tvb, offset, hf_packet_type_acl, ett_ptype_subtree, hfx_packet_type_acl, ENC_LITTLE_ENDIAN);
2181     } else if (link_type == BT_LINK_TYPE_SCO) {
2182         proto_tree_add_bitmask(tree, tvb, offset, hf_packet_type_sco, ett_ptype_subtree, hfx_packet_type_sco, ENC_LITTLE_ENDIAN);
2183     } else {
2184         /* Unknown or wrong link type (Link Layer from BTLE), show mix or ACL and SCO */
2185         expert_add_info(pinfo, connection_handle_subtree, &ei_bad_link_type);
2186 
2187         proto_tree_add_bitmask(tree, tvb, offset, hf_packet_type_acl, ett_ptype_subtree, hfx_packet_type_acl, ENC_LITTLE_ENDIAN);
2188         proto_tree_add_bitmask(tree, tvb, offset, hf_packet_type_sco, ett_ptype_subtree, hfx_packet_type_sco, ENC_LITTLE_ENDIAN);
2189     }
2190     offset += 2;
2191 
2192     return offset;
2193 }
2194 
2195 static int
dissect_bthci_evt_command_status(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * main_tree,proto_tree * tree,wmem_list_t * opcode_list,bluetooth_data_t * bluetooth_data)2196 dissect_bthci_evt_command_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
2197         proto_tree *main_tree, proto_tree *tree, wmem_list_t *opcode_list,
2198         bluetooth_data_t *bluetooth_data)
2199 {
2200     proto_item  *ti_opcode;
2201     proto_tree  *opcode_tree;
2202     guint8       status_code;
2203     guint16      opcode;
2204     guint8       ogf;
2205     gint         hfx;
2206 
2207     status_code = tvb_get_guint8(tvb, offset);
2208 
2209     if (status_code != 0) {
2210         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2211         send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2212     }
2213     else {
2214         proto_tree_add_item(tree, hf_bthci_evt_status_pending, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2215         send_hci_summary_pending_tap(pinfo, bluetooth_data);
2216     }
2217     offset += 1;
2218 
2219     proto_tree_add_item(tree, hf_bthci_evt_num_command_packets, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2220     offset += 1;
2221 
2222     opcode = tvb_get_letohs(tvb, offset);
2223     ogf = opcode >> 10;
2224 
2225     if (have_tap_listener(bluetooth_hci_summary_tap)) {
2226         bluetooth_hci_summary_tap_t  *tap_hci_summary;
2227 
2228         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
2229 
2230         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
2231         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
2232 
2233         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE;
2234         tap_hci_summary->ogf = ogf;
2235         tap_hci_summary->ocf = opcode & 0x03ff;
2236         tap_hci_summary->event = 0x0f; /* Command Status */
2237         if (try_val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext))
2238             tap_hci_summary->name = val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext, "Unknown 0x%04x");
2239         else
2240             tap_hci_summary->name = NULL;
2241         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
2242     }
2243 
2244     if (status_code != 0)
2245         add_opcode(opcode_list, opcode, COMMAND_STATUS_RESULT);
2246     else
2247         add_opcode(opcode_list, opcode, COMMAND_STATUS_PENDING);
2248 
2249     ti_opcode = proto_tree_add_item(tree, hf_bthci_evt_opcode, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2250     opcode_tree = proto_item_add_subtree(ti_opcode, ett_opcode);
2251     proto_tree_add_item(opcode_tree, hf_bthci_evt_ogf, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2252 
2253     if (ogf == HCI_OGF_LINK_CONTROL)
2254         hfx = hf_bthci_evt_ocf_link_control;
2255     else if (ogf == HCI_OGF_LINK_POLICY)
2256         hfx = hf_bthci_evt_ocf_link_policy;
2257     else if (ogf == HCI_OGF_HOST_CONTROLLER)
2258         hfx = hf_bthci_evt_ocf_host_controller_and_baseband;
2259     else if (ogf == HCI_OGF_INFORMATIONAL)
2260         hfx = hf_bthci_evt_ocf_informational;
2261     else if (ogf == HCI_OGF_STATUS)
2262         hfx = hf_bthci_evt_ocf_status;
2263     else if (ogf == HCI_OGF_TESTING)
2264         hfx = hf_bthci_evt_ocf_testing;
2265     else if (ogf == HCI_OGF_LOW_ENERGY)
2266         hfx = hf_bthci_evt_ocf_low_energy;
2267     else if (ogf == HCI_OGF_LOGO_TESTING)
2268         hfx = hf_bthci_evt_ocf_logo_testing;
2269     else
2270         hfx = hf_bthci_evt_ocf;
2271     proto_tree_add_item(opcode_tree, hfx, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2272     offset += 2;
2273 
2274     if (ogf == HCI_OGF_VENDOR_SPECIFIC) {
2275         col_append_fstr(pinfo->cinfo, COL_INFO, " (Vendor Command 0x%04X [(opcode 0x%04X])", opcode & 0x03ff, opcode);
2276 
2277         if (!dissector_try_payload_new(vendor_dissector_table, tvb, pinfo, main_tree, TRUE, bluetooth_data)) {
2278             if (bluetooth_data) {
2279                 hci_vendor_data_t  *hci_vendor_data;
2280                 wmem_tree_key_t     key[3];
2281                 guint32             interface_id;
2282                 guint32             adapter_id;
2283 
2284                 interface_id = bluetooth_data->interface_id;
2285                 adapter_id   = bluetooth_data->adapter_id;
2286 
2287                 key[0].length = 1;
2288                 key[0].key    = &interface_id;
2289                 key[1].length = 1;
2290                 key[1].key    = &adapter_id;
2291                 key[2].length = 0;
2292                 key[2].key    = NULL;
2293 
2294                 hci_vendor_data = (hci_vendor_data_t *) wmem_tree_lookup32_array(bluetooth_data->hci_vendors, key);
2295                 if (hci_vendor_data) {
2296                     gint sub_offset;
2297 
2298                     sub_offset = dissector_try_uint_new(hci_vendor_table, hci_vendor_data->manufacturer, tvb, pinfo, main_tree, TRUE, bluetooth_data);
2299 
2300                     if (sub_offset > 0 && sub_offset < tvb_captured_length_remaining(tvb, offset))
2301                         proto_tree_add_expert(tree, pinfo, &ei_parameter_unexpected, tvb, offset + sub_offset, tvb_captured_length_remaining(tvb, sub_offset + offset));
2302                 }
2303             }
2304         }
2305 
2306         return tvb_captured_length(tvb);
2307     } else {
2308         col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
2309                 val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext, "Unknown 0x%04x"));
2310     }
2311 
2312     return offset;
2313 }
2314 
2315 static int
dissect_bthci_evt_page_scan_mode_change(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2316 dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2317 {
2318     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2319 
2320     proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2321     offset += 1;
2322 
2323     return offset;
2324 }
2325 
2326 static int
dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2327 dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2328 {
2329     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2330 
2331     proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2332     offset += 1;
2333 
2334     return offset;
2335 }
2336 
2337 static int
dissect_bthci_evt_inquire_result_with_rssi(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data,guint8 * bd_addr)2338 dissect_bthci_evt_inquire_result_with_rssi(tvbuff_t *tvb, int offset,
2339         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data, guint8 *bd_addr)
2340 {
2341     guint8 num, evt_num_responses;
2342 
2343     evt_num_responses = tvb_get_guint8(tvb, offset);
2344     proto_tree_add_item(tree, hf_bthci_evt_num_responses, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2345     offset += 1;
2346 
2347     for (num = 0; num < evt_num_responses; num++) {
2348         offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, (num == 0) ? bd_addr : NULL);
2349 
2350         proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2351         offset += 1;
2352 
2353         proto_tree_add_item(tree, hf_bthci_evt_reserved, tvb, offset, 1, ENC_NA);
2354         offset += 1;
2355 
2356         call_dissector(btcommon_cod_handle, tvb_new_subset_length(tvb, offset, 3), pinfo, tree);
2357         offset += 3;
2358 
2359         proto_tree_add_item(tree, hf_bthci_evt_clock_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2360         offset += 2;
2361 
2362         proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2363         offset += 1;
2364 
2365     }
2366 
2367     return offset;
2368 }
2369 
2370 static int
dissect_bthci_evt_io_capability_request(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2371 dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2372 {
2373     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2374 
2375     return offset;
2376 }
2377 
2378 static int
dissect_bthci_evt_io_capability_response(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2379 dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2380 {
2381     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2382 
2383     proto_tree_add_item(tree, hf_bthci_evt_io_capability,     tvb, offset, 1, ENC_LITTLE_ENDIAN);
2384     offset += 1;
2385 
2386     proto_tree_add_item(tree, hf_bthci_evt_oob_data_present,  tvb, offset, 1, ENC_LITTLE_ENDIAN);
2387     offset += 1;
2388 
2389     proto_tree_add_item(tree, hf_bthci_evt_auth_requirements, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2390     offset += 1;
2391 
2392     return offset;
2393 }
2394 
2395 static int
dissect_bthci_evt_user_confirmation_request(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2396 dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2397 {
2398     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2399 
2400     proto_tree_add_item(tree, hf_bthci_evt_numeric_value, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2401     offset += 4;
2402 
2403     return offset;
2404 }
2405 
2406 static int
dissect_bthci_evt_user_passkey_request(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2407 dissect_bthci_evt_user_passkey_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2408 {
2409     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2410 
2411     return offset;
2412 }
2413 
2414 static int
dissect_bthci_evt_remote_oob_data_request(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2415 dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2416 {
2417     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2418 
2419     return offset;
2420 }
2421 
2422 static int
dissect_bthci_evt_simple_pairing_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2423 dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2424 {
2425     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2426     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2427     offset += 1;
2428 
2429     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2430 
2431     return offset;
2432 }
2433 
2434 static int
dissect_bthci_evt_user_passkey_notification(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2435 dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2436 {
2437     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2438 
2439     proto_tree_add_item(tree, hf_bthci_evt_passkey, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2440     offset += 4;
2441 
2442     return offset;
2443 }
2444 
2445 static int
dissect_bthci_evt_keypress_notification(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2446 dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2447 {
2448     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2449 
2450     proto_tree_add_item(tree, hf_bthci_evt_notification_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2451     offset += 1;
2452 
2453     return offset;
2454 }
2455 
2456 static int
dissect_bthci_evt_remote_host_sup_feat_notification(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)2457 dissect_bthci_evt_remote_host_sup_feat_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
2458 {
2459     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2460     offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, 0);
2461 
2462     return offset;
2463 }
2464 
2465 static int
dissect_bthci_evt_le_meta(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,wmem_list_t * opcode_list,bluetooth_data_t * bluetooth_data)2466 dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo,
2467         proto_tree *tree, wmem_list_t *opcode_list, bluetooth_data_t *bluetooth_data)
2468 {
2469     proto_item  *item;
2470     guint8       subevent_code;
2471     guint16      connection_handle;
2472     guint8       bd_addr[6];
2473     guint8       status;
2474 
2475     subevent_code = tvb_get_guint8(tvb, offset);
2476     proto_tree_add_item(tree, hf_bthci_evt_le_meta_subevent, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2477 
2478     if (have_tap_listener(bluetooth_hci_summary_tap)) {
2479         bluetooth_hci_summary_tap_t  *tap_hci_summary;
2480 
2481         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
2482 
2483         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
2484         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
2485 
2486         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_SUBEVENT;
2487         tap_hci_summary->event = 0x3E; /* LE Meta */
2488         tap_hci_summary->subevent = subevent_code;
2489         if (try_val_to_str(subevent_code, evt_le_meta_subevent))
2490             tap_hci_summary->name = val_to_str(subevent_code, evt_le_meta_subevent, "Unknown 0x%04x");
2491         else
2492             tap_hci_summary->name = NULL;
2493         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
2494     }
2495 
2496     col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", val_to_str(subevent_code, evt_le_meta_subevent, "Unknown 0x%02x"));
2497 
2498     offset += 1;
2499 
2500     switch(subevent_code) {
2501         case 0x01: /* LE Connection Complete */
2502             proto_tree_add_item(tree, hf_bthci_evt_status,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
2503             status = tvb_get_guint8(tvb, offset);
2504             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
2505             offset += 1;
2506 
2507             proto_tree_add_item(tree, hf_bthci_evt_connection_handle,             tvb, offset, 2, ENC_LITTLE_ENDIAN);
2508             connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
2509             offset += 2;
2510 
2511             proto_tree_add_item(tree, hf_bthci_evt_role,                          tvb, offset, 1, ENC_LITTLE_ENDIAN);
2512             offset += 1;
2513 
2514             proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type,          tvb, offset, 1, ENC_LITTLE_ENDIAN);
2515             offset += 1;
2516 
2517             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
2518 
2519             item = proto_tree_add_item(tree, hf_bthci_evt_le_con_interval,        tvb, offset, 2, ENC_LITTLE_ENDIAN);
2520             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
2521             offset += 2;
2522 
2523             proto_tree_add_item(tree, hf_bthci_evt_le_con_latency,                tvb, offset, 2, ENC_LITTLE_ENDIAN);
2524             offset += 2;
2525 
2526             item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2527             proto_item_append_text(item, " (%g sec)", tvb_get_letohs(tvb, offset)*0.01);
2528             offset += 2;
2529 
2530             proto_tree_add_item(tree, hf_bthci_evt_le_master_clock_accuracy,      tvb, offset, 1, ENC_LITTLE_ENDIAN);
2531             offset += 1;
2532 
2533             if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
2534                 wmem_tree_key_t    key[5];
2535                 guint32            k_interface_id;
2536                 guint32            k_adapter_id;
2537                 guint32            k_connection_handle;
2538                 guint32            k_frame_number;
2539                 remote_bdaddr_t   *remote_bdaddr;
2540                 chandle_session_t *chandle_session;
2541 
2542                 k_interface_id = bluetooth_data->interface_id;
2543                 k_adapter_id = bluetooth_data->adapter_id;
2544                 k_connection_handle = connection_handle;
2545                 k_frame_number = pinfo->num;
2546 
2547                 key[0].length = 1;
2548                 key[0].key    = &k_interface_id;
2549                 key[1].length = 1;
2550                 key[1].key    = &k_adapter_id;
2551                 key[2].length = 1;
2552                 key[2].key    = &k_connection_handle;
2553                 key[3].length = 1;
2554                 key[3].key    = &k_frame_number;
2555                 key[4].length = 0;
2556                 key[4].key    = NULL;
2557 
2558                 remote_bdaddr = (remote_bdaddr_t *) wmem_new(wmem_file_scope(), remote_bdaddr_t);
2559                 remote_bdaddr->interface_id = bluetooth_data->interface_id;
2560                 remote_bdaddr->adapter_id = bluetooth_data->adapter_id;
2561                 remote_bdaddr->chandle = connection_handle;
2562                 memcpy(remote_bdaddr->bd_addr, bd_addr, 6);
2563 
2564                 wmem_tree_insert32_array(bluetooth_data->chandle_to_bdaddr, key, remote_bdaddr);
2565 
2566                 chandle_session = (chandle_session_t *) wmem_new(wmem_file_scope(), chandle_session_t);
2567                 chandle_session->connect_in_frame = k_frame_number;
2568                 chandle_session->disconnect_in_frame = max_disconnect_in_frame;
2569                 chandle_session->link_type = BT_LINK_TYPE_LL;
2570                 wmem_tree_insert32_array(bluetooth_data->chandle_sessions, key, chandle_session);
2571             }
2572 
2573             add_opcode(opcode_list, 0x200D, COMMAND_STATUS_NORMAL); /* LE Create Connection */
2574 
2575             break;
2576         case 0x02: /* LE Advertising Report */
2577         {
2578             guint8 i, num_reports, length;
2579 
2580             num_reports = tvb_get_guint8(tvb, offset);
2581             proto_tree_add_item(tree, hf_bthci_evt_num_reports,                   tvb, offset, 1, ENC_LITTLE_ENDIAN);
2582             offset += 1;
2583             for (i = 0; i < num_reports; i++) {
2584                 proto_tree_add_item(tree, hf_bthci_evt_advts_event_type,          tvb, offset, 1, ENC_LITTLE_ENDIAN);
2585                 offset += 1;
2586                 proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type,      tvb, offset, 1, ENC_LITTLE_ENDIAN);
2587                 offset += 1;
2588                 offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
2589                 length = tvb_get_guint8(tvb, offset);
2590                 proto_tree_add_item(tree, hf_bthci_evt_data_length,               tvb, offset, 1, ENC_LITTLE_ENDIAN);
2591                 offset += 1;
2592 
2593                 if (length > 0) {
2594                     bluetooth_eir_ad_data_t *ad_data;
2595 
2596                     ad_data = wmem_new0(wmem_packet_scope(), bluetooth_eir_ad_data_t);
2597                     ad_data->interface_id = bluetooth_data->interface_id;
2598                     ad_data->adapter_id = bluetooth_data->adapter_id;
2599                     ad_data->bd_addr = bd_addr;
2600 
2601                     call_dissector_with_data(btcommon_ad_handle, tvb_new_subset_length(tvb, offset, length), pinfo, tree, ad_data);
2602                     save_remote_device_name(tvb, offset, pinfo, length, bd_addr, bluetooth_data);
2603                     offset += length;
2604                 }
2605 
2606                 proto_tree_add_item(tree, hf_bthci_evt_rssi,                      tvb, offset, 1, ENC_LITTLE_ENDIAN);
2607                 offset += 1;
2608                 }
2609             }
2610             break;
2611         case 0x03: /* LE Connection Update Complete */
2612             proto_tree_add_item(tree, hf_bthci_evt_status,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
2613             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2614             offset += 1;
2615 
2616             proto_tree_add_item(tree, hf_bthci_evt_connection_handle,             tvb, offset, 2, ENC_LITTLE_ENDIAN);
2617             offset += 2;
2618             item = proto_tree_add_item(tree, hf_bthci_evt_le_con_interval,        tvb, offset, 2, ENC_LITTLE_ENDIAN);
2619             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
2620             offset += 2;
2621             proto_tree_add_item(tree, hf_bthci_evt_le_con_latency,                tvb, offset, 2, ENC_LITTLE_ENDIAN);
2622             offset += 2;
2623             item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2624             proto_item_append_text(item, " (%g sec)",                             tvb_get_letohs(tvb, offset)*0.01);
2625             offset += 2;
2626 
2627             add_opcode(opcode_list, 0x2013, COMMAND_STATUS_NORMAL); /* LE Connection Update */
2628             break;
2629         case 0x04: /* LE Read Remote Features Complete */
2630             proto_tree_add_item(tree, hf_bthci_evt_status,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
2631             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2632             offset += 1;
2633 
2634             proto_tree_add_item(tree, hf_bthci_evt_connection_handle,             tvb, offset, 2, ENC_LITTLE_ENDIAN);
2635             offset += 2;
2636 
2637             proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_evt_le_features, ett_le_features, hfx_bthci_evt_le_features, ENC_LITTLE_ENDIAN);
2638             offset += 8;
2639 
2640             add_opcode(opcode_list, 0x2016, COMMAND_STATUS_NORMAL); /* LE Read Remote Features */
2641             break;
2642         case 0x05: /* LE Long Term Key Request */
2643             proto_tree_add_item(tree, hf_bthci_evt_connection_handle,             tvb, offset, 2, ENC_LITTLE_ENDIAN);
2644             offset += 2;
2645             proto_tree_add_item(tree, hf_bthci_evt_random_number,                 tvb, offset, 8, ENC_NA);
2646             offset += 8;
2647             proto_tree_add_item(tree, hf_bthci_evt_encrypted_diversifier,         tvb, offset, 2, ENC_LITTLE_ENDIAN);
2648             offset += 2;
2649             break;
2650         case 0x06: /* LE Remote Connection Parameter Request */
2651             proto_tree_add_item(tree, hf_bthci_evt_connection_handle,             tvb, offset, 2, ENC_LITTLE_ENDIAN);
2652             offset += 2;
2653 
2654             item = proto_tree_add_item(tree, hf_bthci_evt_le_min_interval,        tvb, offset, 2, ENC_LITTLE_ENDIAN);
2655             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset) * 1.25);
2656             offset += 2;
2657 
2658             item = proto_tree_add_item(tree, hf_bthci_evt_le_max_interval,        tvb, offset, 2, ENC_LITTLE_ENDIAN);
2659             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset) * 1.25);
2660             offset += 2;
2661 
2662             proto_tree_add_item(tree, hf_bthci_evt_le_con_latency,                tvb, offset, 2, ENC_LITTLE_ENDIAN);
2663             offset += 2;
2664 
2665             item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2666             proto_item_append_text(item, " (%g sec)", tvb_get_letohs(tvb, offset) * 0.01);
2667             offset += 2;
2668 
2669             break;
2670         case 0x07: /* LE Data Length Change */
2671             proto_tree_add_item(tree, hf_bthci_evt_connection_handle,             tvb, offset, 2, ENC_LITTLE_ENDIAN);
2672             offset += 2;
2673 
2674             proto_tree_add_item(tree, hf_bthci_evt_le_max_tx_octets,              tvb, offset, 2, ENC_LITTLE_ENDIAN);
2675             offset += 2;
2676 
2677             proto_tree_add_item(tree, hf_bthci_evt_le_max_tx_time,                tvb, offset, 2, ENC_LITTLE_ENDIAN);
2678             offset += 2;
2679 
2680             proto_tree_add_item(tree, hf_bthci_evt_le_max_rx_octets,              tvb, offset, 2, ENC_LITTLE_ENDIAN);
2681             offset += 2;
2682 
2683             proto_tree_add_item(tree, hf_bthci_evt_le_max_rx_time,                tvb, offset, 2, ENC_LITTLE_ENDIAN);
2684             offset += 2;
2685 
2686             break;
2687         case 0x08: /* LE Read Local P-256 Public Key Complete */
2688             proto_tree_add_item(tree, hf_bthci_evt_status,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
2689             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2690             offset += 1;
2691 
2692             proto_tree_add_item(tree, hf_bthci_evt_le_local_p_256_public_key,     tvb, offset, 64, ENC_NA);
2693             offset += 64;
2694 
2695             add_opcode(opcode_list, 0x2025, COMMAND_STATUS_NORMAL); /* LE Read Local P-256 Public Key */
2696 
2697             break;
2698         case 0x09: /* LE Generate DHKey Complete */
2699             proto_tree_add_item(tree, hf_bthci_evt_status,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
2700             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
2701             offset += 1;
2702 
2703             proto_tree_add_item(tree, hf_bthci_evt_le_dhkey,                      tvb, offset, 32, ENC_NA);
2704             offset += 32;
2705 
2706             add_opcode(opcode_list, 0x2026, COMMAND_STATUS_NORMAL); /* LE Generate DHKey */
2707 
2708             break;
2709         case 0x0A: /* LE Enhanced Connection Complete */
2710             proto_tree_add_item(tree, hf_bthci_evt_status,                        tvb, offset, 1, ENC_LITTLE_ENDIAN);
2711             status = tvb_get_guint8(tvb, offset);
2712             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
2713             offset += 1;
2714 
2715             proto_tree_add_item(tree, hf_bthci_evt_connection_handle,             tvb, offset, 2, ENC_LITTLE_ENDIAN);
2716             connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
2717             offset += 2;
2718 
2719             proto_tree_add_item(tree, hf_bthci_evt_role,                          tvb, offset, 1, ENC_LITTLE_ENDIAN);
2720             offset += 1;
2721 
2722             proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type,          tvb, offset, 1, ENC_LITTLE_ENDIAN);
2723             offset += 1;
2724 
2725             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
2726             offset = dissect_bd_addr(hf_bthci_evt_le_local_rpa, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2727             offset = dissect_bd_addr(hf_bthci_evt_le_peer_rpa, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2728 
2729             item = proto_tree_add_item(tree, hf_bthci_evt_le_con_interval,        tvb, offset, 2, ENC_LITTLE_ENDIAN);
2730             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
2731             offset += 2;
2732 
2733             proto_tree_add_item(tree, hf_bthci_evt_le_con_latency,                tvb, offset, 2, ENC_LITTLE_ENDIAN);
2734             offset += 2;
2735 
2736             item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2737             proto_item_append_text(item, " (%g sec)", tvb_get_letohs(tvb, offset)*0.01);
2738             offset += 2;
2739 
2740             proto_tree_add_item(tree, hf_bthci_evt_le_master_clock_accuracy,      tvb, offset, 1, ENC_LITTLE_ENDIAN);
2741             offset += 1;
2742 
2743             if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
2744                 wmem_tree_key_t    key[5];
2745                 guint32            k_interface_id;
2746                 guint32            k_adapter_id;
2747                 guint32            k_connection_handle;
2748                 guint32            k_frame_number;
2749                 remote_bdaddr_t   *remote_bdaddr;
2750                 chandle_session_t *chandle_session;
2751 
2752                 k_interface_id = bluetooth_data->interface_id;
2753                 k_adapter_id = bluetooth_data->adapter_id;
2754                 k_connection_handle = connection_handle;
2755                 k_frame_number = pinfo->num;
2756 
2757                 key[0].length = 1;
2758                 key[0].key    = &k_interface_id;
2759                 key[1].length = 1;
2760                 key[1].key    = &k_adapter_id;
2761                 key[2].length = 1;
2762                 key[2].key    = &k_connection_handle;
2763                 key[3].length = 1;
2764                 key[3].key    = &k_frame_number;
2765                 key[4].length = 0;
2766                 key[4].key    = NULL;
2767 
2768                 remote_bdaddr = (remote_bdaddr_t *) wmem_new(wmem_file_scope(), remote_bdaddr_t);
2769                 remote_bdaddr->interface_id = bluetooth_data->interface_id;
2770                 remote_bdaddr->adapter_id = bluetooth_data->adapter_id;
2771                 remote_bdaddr->chandle = connection_handle;
2772                 memcpy(remote_bdaddr->bd_addr, bd_addr, 6);
2773 
2774                 wmem_tree_insert32_array(bluetooth_data->chandle_to_bdaddr, key, remote_bdaddr);
2775 
2776                 chandle_session = (chandle_session_t *) wmem_new(wmem_file_scope(), chandle_session_t);
2777                 chandle_session->connect_in_frame = k_frame_number;
2778                 chandle_session->disconnect_in_frame = max_disconnect_in_frame;
2779                 chandle_session->link_type = BT_LINK_TYPE_LL;
2780                 wmem_tree_insert32_array(bluetooth_data->chandle_sessions, key, chandle_session);
2781             }
2782 
2783             add_opcode(opcode_list, 0x200D, COMMAND_STATUS_NORMAL); /* LE Create Connection */
2784 
2785             break;
2786         case 0x0B: /* LE Direct Advertising Report */
2787             {
2788             guint8  number_of_reports;
2789             guint8  report_id = 1;
2790 
2791             proto_tree_add_item(tree, hf_bthci_evt_le_number_of_reports, tvb, offset, 1, ENC_NA);
2792             number_of_reports = tvb_get_guint8(tvb, offset);
2793             offset += 1;
2794 
2795             while (number_of_reports) {
2796                 proto_item *report_item;
2797                 proto_tree *report_tree;
2798 
2799                 report_item = proto_tree_add_none_format(tree, hf_bthci_evt_le_report, tvb, offset, 16, "Item %u",
2800                         report_id);
2801                 report_tree = proto_item_add_subtree(report_item, ett_le_report);
2802 
2803                 proto_tree_add_item(report_tree, hf_bthci_evt_le_event_type, tvb, offset, 1, ENC_NA);
2804                 offset += 1;
2805 
2806                 proto_tree_add_item(report_tree, hf_bthci_evt_le_direct_address_type, tvb, offset, 1, ENC_NA);
2807                 offset += 1;
2808 
2809                 offset = dissect_bd_addr(hf_bthci_evt_le_direct_bd_addr, pinfo, report_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2810 
2811                 proto_tree_add_item(report_tree, hf_bthci_evt_le_address_type, tvb, offset, 1, ENC_NA);
2812                 offset += 1;
2813 
2814                 offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, report_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2815 
2816                 proto_tree_add_item(report_tree, hf_bthci_evt_le_rssi, tvb, offset, 1, ENC_NA);
2817                 offset += 1;
2818 
2819                 report_id += 1;
2820                 number_of_reports--;
2821             }
2822 
2823             }
2824             break;
2825         case 0x0C: /* LE PHY Update Complete */
2826             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2827             status = tvb_get_guint8(tvb, offset);
2828             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
2829             offset += 1;
2830 
2831             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2832             offset += 2;
2833 
2834             proto_tree_add_item(tree, hf_bthci_evt_le_tx_phy, tvb, offset, 1, ENC_NA);
2835             offset += 1;
2836 
2837             proto_tree_add_item(tree, hf_bthci_evt_le_rx_phy, tvb, offset, 1, ENC_NA);
2838             offset += 1;
2839 
2840             break;
2841         case 0x0D: /* LE Extended Advertising Report */
2842             {
2843             guint8 i, num_reports, length;
2844 
2845             num_reports = tvb_get_guint8(tvb, offset);
2846             proto_tree_add_item(tree, hf_bthci_evt_num_reports, tvb, offset, 1, ENC_NA);
2847             offset += 1;
2848             for (i = 0; i < num_reports; i++) {
2849 
2850                 proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_evt_ext_advts_event_type, ett_le_ext_advts_event_type, hfx_bthci_evt_le_ext_advts_evt_type, ENC_LITTLE_ENDIAN);
2851                 offset += 2;
2852                 proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type, tvb, offset, 1, ENC_NA);
2853                 offset += 1;
2854                 offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
2855 
2856                 proto_tree_add_item(tree, hf_bthci_evt_primary_phy, tvb, offset, 1, ENC_NA);
2857                 offset += 1;
2858                 proto_tree_add_item(tree, hf_bthci_evt_secondary_phy, tvb, offset, 1, ENC_NA);
2859                 offset += 1;
2860                 item = proto_tree_add_item(tree, hf_bthci_evt_advertising_sid, tvb, offset, 1, ENC_NA);
2861                 if (tvb_get_guint8(tvb, offset) == 0xFF)
2862                     proto_item_append_text(item, " (not available)");
2863                 offset += 1;
2864 
2865                 item = proto_tree_add_item(tree, hf_bthci_evt_tx_power, tvb, offset, 1, ENC_NA);
2866                 if (tvb_get_guint8(tvb, offset) == 127)
2867                     proto_item_append_text(item, " (not available)");
2868                 offset += 1;
2869 
2870                 item = proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, ENC_NA);
2871                 if (tvb_get_guint8(tvb, offset) == 127)
2872                     proto_item_append_text(item, " (not available)");
2873                 offset += 1;
2874 
2875                 item = proto_tree_add_item(tree, hf_bthci_evt_periodic_advertising_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2876                 if (tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) == 0x0000)
2877                     proto_item_append_text(item, " (no periodic advertising)");
2878                 else
2879                     proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
2880                 offset += 2;
2881 
2882                 proto_tree_add_item(tree, hf_bthci_evt_le_direct_address_type, tvb, offset, 1, ENC_NA);
2883                 offset += 1;
2884 
2885                 offset = dissect_bd_addr(hf_bthci_evt_le_direct_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2886 
2887                 length = tvb_get_guint8(tvb, offset);
2888                 proto_tree_add_item(tree, hf_bthci_evt_data_length, tvb, offset, 1, ENC_NA);
2889                 offset += 1;
2890 
2891                 if (length > 0) {
2892                     bluetooth_eir_ad_data_t *ad_data;
2893 
2894                     ad_data = wmem_new0(wmem_packet_scope(), bluetooth_eir_ad_data_t);
2895                     ad_data->interface_id = bluetooth_data->interface_id;
2896                     ad_data->adapter_id = bluetooth_data->adapter_id;
2897                     ad_data->bd_addr = bd_addr;
2898 
2899                     call_dissector_with_data(btcommon_ad_handle, tvb_new_subset_length(tvb, offset, length), pinfo, tree, ad_data);
2900                     save_remote_device_name(tvb, offset, pinfo, length, bd_addr, bluetooth_data);
2901                     offset += length;
2902                 }
2903             }
2904             }
2905             break;
2906         case 0x0E: /* LE Periodic Advertising Sync Established */
2907             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
2908             status = tvb_get_guint8(tvb, offset);
2909             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
2910             offset += 1;
2911             proto_tree_add_item(tree, hf_bthci_evt_sync_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2912             offset += 2;
2913             proto_tree_add_item(tree, hf_bthci_evt_advertising_sid, tvb, offset, 1, ENC_NA);
2914             offset += 1;
2915             proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type, tvb, offset, 1, ENC_NA);
2916             offset += 1;
2917             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
2918             proto_tree_add_item(tree, hf_bthci_evt_advertiser_phy, tvb, offset, 1, ENC_NA);
2919             offset += 1;
2920             item = proto_tree_add_item(tree, hf_bthci_evt_periodic_advertising_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2921             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
2922             offset += 2;
2923             proto_tree_add_item(tree, hf_bthci_evt_advertiser_clock_accuracy, tvb, offset, 1, ENC_NA);
2924             offset += 1;
2925             break;
2926         case 0x0F: /* LE Periodic Advertising Report */
2927             {
2928             guint8 length;
2929             proto_tree_add_item(tree, hf_bthci_evt_sync_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2930             offset += 2;
2931             item = proto_tree_add_item(tree, hf_bthci_evt_tx_power, tvb, offset, 1, ENC_NA);
2932             if (tvb_get_guint8(tvb, offset) == 127)
2933                     proto_item_append_text(item, " (not available)");
2934             offset += 1;
2935             item = proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, ENC_NA);
2936             if (tvb_get_guint8(tvb, offset) == 127)
2937                     proto_item_append_text(item, " (not available)");
2938             offset += 1;
2939             proto_tree_add_item(tree, hf_bthci_evt_cte_type, tvb, offset, 1, ENC_NA);
2940             offset += 1;
2941             proto_tree_add_item(tree, hf_bthci_evt_data_status, tvb, offset, 1, ENC_NA);
2942             offset += 1;
2943             proto_tree_add_item(tree, hf_bthci_evt_data_length, tvb, offset, 1, ENC_NA);
2944             length = tvb_get_guint8(tvb, offset);
2945             offset += 1;
2946             proto_tree_add_item(tree, hf_bthci_evt_data, tvb, offset, length, ENC_NA);
2947             offset += length;
2948             }
2949             break;
2950         case 0x10: /* LE Periodic Advertising Sync Lost */
2951             proto_tree_add_item(tree, hf_bthci_evt_sync_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2952             offset += 2;
2953             break;
2954         case 0x12: /* LE Advertising Set Terminated */
2955             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
2956             status = tvb_get_guint8(tvb, offset);
2957             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
2958             offset += 1;
2959             proto_tree_add_item(tree, hf_bthci_evt_advertising_handle, tvb, offset, 1, ENC_NA);
2960             offset += 1;
2961             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2962             offset += 2;
2963             proto_tree_add_item(tree, hf_bthci_evt_num_compl_ext_advertising_events, tvb, offset, 1, ENC_NA);
2964             offset += 1;
2965             break;
2966         case 0x13: /* LE Scan Request Received */
2967             proto_tree_add_item(tree, hf_bthci_evt_advertising_handle, tvb, offset, 1, ENC_NA);
2968             offset += 1;
2969             proto_tree_add_item(tree, hf_bthci_evt_le_address_type, tvb, offset, 1, ENC_NA);
2970             offset += 1;
2971 
2972             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
2973             break;
2974         case 0x14: /* LE Channel Selection Algorithm */
2975             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2976             offset += 2;
2977             proto_tree_add_item(tree, hf_bthci_evt_channel_selection_algorithm, tvb, offset, 1, ENC_NA);
2978             offset += 1;
2979             break;
2980         case 0x15: /* LE Connectionless IQ Report */
2981             proto_tree_add_item(tree, hf_bthci_evt_sync_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2982             offset += 2;
2983             proto_tree_add_item(tree, hf_bthci_evt_channel_index, tvb, offset, 1, ENC_NA);
2984             offset += 1;
2985             item = proto_tree_add_item(tree, hf_bthci_evt_cte_rssi, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2986             proto_item_append_text(item, " (%g dBm)", tvb_get_letohis(tvb, offset)*0.1);
2987             offset += 2;
2988             proto_tree_add_item(tree, hf_bthci_evt_antenna_id, tvb, offset, 1, ENC_NA);
2989             offset += 1;
2990             proto_tree_add_item(tree, hf_bthci_evt_cte_type, tvb, offset, 1, ENC_NA);
2991             offset += 1;
2992             proto_tree_add_item(tree, hf_bthci_evt_slot_durations, tvb, offset, 1, ENC_NA);
2993             offset += 1;
2994             proto_tree_add_item(tree, hf_bthci_evt_packet_status, tvb, offset, 1, ENC_NA);
2995             offset += 1;
2996             proto_tree_add_item(tree, hf_bthci_evt_event_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2997             offset += 2;
2998             offset = dissect_iq_sample_list(tvb, offset, tree);
2999             break;
3000         case 0x16: /* LE Connection IQ Report */
3001             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3002             offset += 2;
3003             proto_tree_add_item(tree, hf_bthci_evt_le_rx_phy, tvb, offset, 1, ENC_NA);
3004             offset += 1;
3005             proto_tree_add_item(tree, hf_bthci_evt_channel_index, tvb, offset, 1, ENC_NA);
3006             offset += 1;
3007             item = proto_tree_add_item(tree, hf_bthci_evt_cte_rssi, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3008             proto_item_append_text(item, " (%g dBm)", tvb_get_letohis(tvb, offset)*0.1);
3009             offset += 2;
3010             proto_tree_add_item(tree, hf_bthci_evt_antenna_id, tvb, offset, 1, ENC_NA);
3011             offset += 1;
3012             proto_tree_add_item(tree, hf_bthci_evt_cte_type, tvb, offset, 1, ENC_NA);
3013             offset += 1;
3014             proto_tree_add_item(tree, hf_bthci_evt_slot_durations, tvb, offset, 1, ENC_NA);
3015             offset += 1;
3016             proto_tree_add_item(tree, hf_bthci_evt_packet_status, tvb, offset, 1, ENC_NA);
3017             offset += 1;
3018             proto_tree_add_item(tree, hf_bthci_evt_event_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3019             offset += 2;
3020             offset = dissect_iq_sample_list(tvb, offset, tree);
3021             break;
3022         case 0x17: /* LE CTE Request Failed */
3023             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3024             status = tvb_get_guint8(tvb, offset);
3025             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3026             offset += 1;
3027             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3028             offset += 2;
3029             break;
3030         case 0x18: /* LE Periodic Advertising Sync Transfer Received */
3031             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3032             status = tvb_get_guint8(tvb, offset);
3033             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3034             offset += 1;
3035             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3036             offset += 2;
3037             proto_tree_add_item(tree, hf_bthci_evt_service_data_past, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3038             offset += 2;
3039             proto_tree_add_item(tree, hf_bthci_evt_sync_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3040             offset += 2;
3041             proto_tree_add_item(tree, hf_bthci_evt_advertising_sid, tvb, offset, 1, ENC_NA);
3042             offset += 1;
3043             proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type, tvb, offset, 1, ENC_NA);
3044             offset += 1;
3045             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
3046             proto_tree_add_item(tree, hf_bthci_evt_advertiser_phy, tvb, offset, 1, ENC_NA);
3047             offset += 1;
3048             item = proto_tree_add_item(tree, hf_bthci_evt_periodic_advertising_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3049             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
3050             offset += 2;
3051             proto_tree_add_item(tree, hf_bthci_evt_advertiser_clock_accuracy, tvb, offset, 1, ENC_NA);
3052             offset += 1;
3053             break;
3054         case 0x19: /* LE CIS Established */
3055             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3056             status = tvb_get_guint8(tvb, offset);
3057             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3058             offset += 1;
3059             proto_tree_add_item(tree, hf_bthci_evt_cis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3060             connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
3061             offset += 2;
3062 
3063             if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
3064                 wmem_tree_key_t    key[5];
3065                 guint32            k_interface_id;
3066                 guint32            k_adapter_id;
3067                 guint32            k_connection_handle;
3068                 guint32            k_frame_number;
3069                 chandle_session_t *chandle_session;
3070 
3071                 k_interface_id = bluetooth_data->interface_id;
3072                 k_adapter_id = bluetooth_data->adapter_id;
3073                 k_connection_handle = connection_handle;
3074                 k_frame_number = pinfo->num;
3075 
3076                 key[0].length = 1;
3077                 key[0].key    = &k_interface_id;
3078                 key[1].length = 1;
3079                 key[1].key    = &k_adapter_id;
3080                 key[2].length = 1;
3081                 key[2].key    = &k_connection_handle;
3082                 key[3].length = 1;
3083                 key[3].key    = &k_frame_number;
3084                 key[4].length = 0;
3085                 key[4].key    = NULL;
3086 
3087                 chandle_session = (chandle_session_t *) wmem_new(wmem_file_scope(), chandle_session_t);
3088                 chandle_session->connect_in_frame = k_frame_number;
3089                 chandle_session->disconnect_in_frame = max_disconnect_in_frame;
3090                 chandle_session->link_type = BT_LINK_TYPE_ISO;
3091                 wmem_tree_insert32_array(bluetooth_data->chandle_sessions, key, chandle_session);
3092             }
3093 
3094             proto_tree_add_item(tree, hf_bthci_evt_cig_sync_delay, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3095             offset += 3;
3096             proto_tree_add_item(tree, hf_bthci_evt_cis_sync_delay, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3097             offset += 3;
3098             proto_tree_add_item(tree, hf_bthci_evt_transport_latency_m_to_s, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3099             offset += 3;
3100             proto_tree_add_item(tree, hf_bthci_evt_transport_latency_s_to_m, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3101             offset += 3;
3102             proto_tree_add_item(tree, hf_bthci_evt_phy_m_to_s, tvb, offset, 1, ENC_NA);
3103             offset += 1;
3104             proto_tree_add_item(tree, hf_bthci_evt_phy_s_to_m, tvb, offset, 1, ENC_NA);
3105             offset += 1;
3106             proto_tree_add_item(tree, hf_bthci_evt_nse, tvb, offset, 1, ENC_NA);
3107             offset += 1;
3108             proto_tree_add_item(tree, hf_bthci_evt_bn_m_to_s, tvb, offset, 1, ENC_NA);
3109             offset += 1;
3110             proto_tree_add_item(tree, hf_bthci_evt_bn_s_to_m, tvb, offset, 1, ENC_NA);
3111             offset += 1;
3112             proto_tree_add_item(tree, hf_bthci_evt_ft_m_to_s, tvb, offset, 1, ENC_NA);
3113             offset += 1;
3114             proto_tree_add_item(tree, hf_bthci_evt_ft_s_to_m, tvb, offset, 1, ENC_NA);
3115             offset += 1;
3116             proto_tree_add_item(tree, hf_bthci_evt_max_pdu_m_to_s, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3117             offset += 2;
3118             proto_tree_add_item(tree, hf_bthci_evt_max_pdu_s_to_m, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3119             offset += 2;
3120             item = proto_tree_add_item(tree, hf_bthci_evt_iso_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3121             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset) * 1.25);
3122             offset += 2;
3123             break;
3124         case 0x1A: /* LE CIS Request */
3125             {
3126             guint32 chandle, k_shandle;
3127             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3128             chandle = tvb_get_letohs(tvb, offset) & 0xfff;
3129             offset += 2;
3130             proto_tree_add_item(tree, hf_bthci_evt_cis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3131             k_shandle = tvb_get_letohs(tvb, offset) & 0xfff;
3132             offset += 2;
3133             proto_tree_add_item(tree, hf_bthci_evt_cig_id, tvb, offset, 1, ENC_NA);
3134             offset += 1;
3135             proto_tree_add_item(tree, hf_bthci_evt_cis_id, tvb, offset, 1, ENC_NA);
3136             offset += 1;
3137 
3138             if (!pinfo->fd->visited) {
3139                 wmem_tree_key_t     key[5];
3140                 guint32             interface_id;
3141                 guint32             adapter_id;
3142                 guint32             frame_number;
3143                 stream_connection_handle_pair_t *stream_connection_handle_pair;
3144 
3145                 interface_id = bluetooth_data->interface_id;
3146                 adapter_id   = bluetooth_data->adapter_id;
3147                 frame_number = pinfo->num;
3148 
3149                 key[0].length = 1;
3150                 key[0].key    = &interface_id;
3151                 key[1].length = 1;
3152                 key[1].key    = &adapter_id;
3153                 key[2].length = 1;
3154                 key[2].key    = &k_shandle;
3155                 key[3].length = 1;
3156                 key[3].key    = &frame_number;
3157                 key[4].length = 0;
3158                 key[4].key    = NULL;
3159 
3160                 stream_connection_handle_pair = (stream_connection_handle_pair_t *) wmem_new(wmem_file_scope(), stream_connection_handle_pair_t);
3161                 stream_connection_handle_pair->chandle = chandle;
3162                 stream_connection_handle_pair->change_in_frame = frame_number;
3163 
3164                 wmem_tree_insert32_array(bluetooth_data->shandle_to_chandle, key, stream_connection_handle_pair);
3165             }
3166             }
3167             break;
3168         case 0x1B: /* LE Create BIG Complete */
3169             {
3170             guint8 num_bis;
3171 
3172             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3173             status = tvb_get_guint8(tvb, offset);
3174             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3175             offset += 1;
3176             proto_tree_add_item(tree, hf_bthci_evt_big_handle, tvb, offset, 1, ENC_NA);
3177             offset += 1;
3178             proto_tree_add_item(tree, hf_bthci_evt_big_sync_delay, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3179             offset += 3;
3180             proto_tree_add_item(tree, hf_bthci_evt_big_transport_latency, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3181             offset += 3;
3182             proto_tree_add_item(tree, hf_bthci_evt_phy, tvb, offset, 1, ENC_NA);
3183             offset += 1;
3184             proto_tree_add_item(tree, hf_bthci_evt_nse, tvb, offset, 1, ENC_NA);
3185             offset += 1;
3186             proto_tree_add_item(tree, hf_bthci_evt_bn, tvb, offset, 1, ENC_NA);
3187             offset += 1;
3188             proto_tree_add_item(tree, hf_bthci_evt_pto, tvb, offset, 1, ENC_NA);
3189             offset += 1;
3190             proto_tree_add_item(tree, hf_bthci_evt_irc, tvb, offset, 1, ENC_NA);
3191             offset += 1;
3192             proto_tree_add_item(tree, hf_bthci_evt_max_pdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3193             offset += 2;
3194             item = proto_tree_add_item(tree, hf_bthci_evt_iso_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3195             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset) * 1.25);
3196             offset += 2;
3197             proto_tree_add_item(tree, hf_bthci_evt_num_bis, tvb, offset, 1, ENC_NA);
3198             num_bis = tvb_get_guint8(tvb, offset);
3199             offset += 1;
3200             while (num_bis) {
3201                 proto_tree_add_item(tree, hf_bthci_evt_bis_handle, tvb, offset, 2, ENC_NA);
3202                 offset += 2;
3203                 num_bis -= 1;
3204             }
3205             }
3206             break;
3207         case 0x1C: /* LE Terminate BIG Complete */
3208         case 0x1E: /* LE BIG Sync Lost */
3209             proto_tree_add_item(tree, hf_bthci_evt_big_handle, tvb, offset, 1, ENC_NA);
3210             offset += 1;
3211             proto_tree_add_item(tree, hf_bthci_evt_reason, tvb, offset, 1, ENC_NA);
3212             send_hci_summary_reason_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3213             offset += 1;
3214             break;
3215         case 0x1D: /* LE BIG Sync Established */
3216             {
3217             guint8 num_bis;
3218 
3219             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3220             status = tvb_get_guint8(tvb, offset);
3221             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3222             offset += 1;
3223             proto_tree_add_item(tree, hf_bthci_evt_big_handle, tvb, offset, 1, ENC_NA);
3224             offset += 1;
3225             proto_tree_add_item(tree, hf_bthci_evt_big_transport_latency, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3226             offset += 3;
3227             proto_tree_add_item(tree, hf_bthci_evt_nse, tvb, offset, 1, ENC_NA);
3228             offset += 1;
3229             proto_tree_add_item(tree, hf_bthci_evt_bn, tvb, offset, 1, ENC_NA);
3230             offset += 1;
3231             proto_tree_add_item(tree, hf_bthci_evt_pto, tvb, offset, 1, ENC_NA);
3232             offset += 1;
3233             proto_tree_add_item(tree, hf_bthci_evt_irc, tvb, offset, 1, ENC_NA);
3234             offset += 1;
3235             proto_tree_add_item(tree, hf_bthci_evt_max_pdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3236             offset += 2;
3237             item = proto_tree_add_item(tree, hf_bthci_evt_iso_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3238             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset) * 1.25);
3239             offset += 2;
3240             proto_tree_add_item(tree, hf_bthci_evt_num_bis, tvb, offset, 1, ENC_NA);
3241             num_bis = tvb_get_guint8(tvb, offset);
3242             offset += 1;
3243             while (num_bis) {
3244                 proto_tree_add_item(tree, hf_bthci_evt_bis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3245                 offset += 2;
3246                 num_bis -= 1;
3247             }
3248             }
3249             break;
3250         case 0x1F: /* LE Request Peer SCA Complete */
3251             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3252             status = tvb_get_guint8(tvb, offset);
3253             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3254             offset += 1;
3255             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3256             offset += 2;
3257             proto_tree_add_item(tree, hf_bthci_evt_peer_clock_accuracy, tvb, offset, 1, ENC_NA);
3258             offset += 1;
3259             break;
3260         case 0x20: /* LE Path Loss Threshold */
3261             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3262             offset += 2;
3263             proto_tree_add_item(tree, hf_bthci_evt_current_path_loss, tvb, offset, 1, ENC_NA);
3264             offset += 1;
3265             proto_tree_add_item(tree, hf_bthci_evt_zone_entered, tvb, offset, 1, ENC_NA);
3266             offset += 1;
3267             break;
3268         case 0x21: /* LE Transmit Power Reporting */
3269             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3270             status = tvb_get_guint8(tvb, offset);
3271             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3272             offset += 1;
3273             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3274             offset += 2;
3275             proto_tree_add_item(tree, hf_bthci_evt_power_report_reason, tvb, offset, 1, ENC_NA);
3276             offset += 1;
3277             proto_tree_add_item(tree, hf_bthci_evt_phy_and_coding, tvb, offset, 1, ENC_NA);
3278             offset += 1;
3279             item = proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3280             if (tvb_get_guint8(tvb, offset) == 0x7f)
3281                 proto_item_append_text(item, " (Not Available)");
3282             else if (tvb_get_guint8(tvb, offset) == 0x7e)
3283                 proto_item_append_text(item, " (Peer Not Managing Power Level on PHY)");
3284             offset += 1;
3285             proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_evt_transmit_power_level_flags,
3286                                    ett_transmit_power_level_flags, hfx_bthci_evt_transmit_power_level_flags, ENC_NA);
3287             offset += 1;
3288             proto_tree_add_item(tree, hf_bthci_evt_power_level_delta, tvb, offset, 1, ENC_NA);
3289             offset += 1;
3290             break;
3291         case 0x22: /* LE BIGInfo Advertising Report */
3292             proto_tree_add_item(tree, hf_bthci_evt_sync_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3293             offset += 2;
3294             proto_tree_add_item(tree, hf_bthci_evt_num_bis, tvb, offset, 1, ENC_NA);
3295             offset += 1;
3296             proto_tree_add_item(tree, hf_bthci_evt_nse, tvb, offset, 1, ENC_NA);
3297             offset += 1;
3298             item = proto_tree_add_item(tree, hf_bthci_evt_iso_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3299             proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset) * 1.25);
3300             offset += 2;
3301             proto_tree_add_item(tree, hf_bthci_evt_bn, tvb, offset, 1, ENC_NA);
3302             offset += 1;
3303             proto_tree_add_item(tree, hf_bthci_evt_pto, tvb, offset, 1, ENC_NA);
3304             offset += 1;
3305             proto_tree_add_item(tree, hf_bthci_evt_irc, tvb, offset, 1, ENC_NA);
3306             offset += 1;
3307             proto_tree_add_item(tree, hf_bthci_evt_max_pdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3308             offset += 2;
3309             proto_tree_add_item(tree, hf_bthci_evt_sdu_interval, tvb, offset, 3, ENC_LITTLE_ENDIAN);
3310             offset += 3;
3311             proto_tree_add_item(tree, hf_bthci_evt_max_sdu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3312             offset += 2;
3313             proto_tree_add_item(tree, hf_bthci_evt_phy, tvb, offset, 1, ENC_NA);
3314             offset += 1;
3315             proto_tree_add_item(tree, hf_bthci_evt_framing, tvb, offset, 1, ENC_NA);
3316             offset += 1;
3317             proto_tree_add_item(tree, hf_bthci_evt_encryption_mode, tvb, offset, 1, ENC_NA);
3318             offset += 1;
3319             break;
3320         case 0x23: /* LE Subrate Change */
3321             {
3322             guint32 underlying_events;
3323             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
3324             status = tvb_get_guint8(tvb, offset);
3325             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3326             offset += 1;
3327             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3328             offset += 2;
3329             proto_tree_add_item(tree, hf_bthci_evt_subrate_factor, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3330             offset += 2;
3331             item = proto_tree_add_item(tree, hf_bthci_evt_le_con_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3332             underlying_events = (tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) + 1)*
3333                                                 tvb_get_guint16(tvb, offset - 2, ENC_LITTLE_ENDIAN) - 1;
3334             proto_item_append_text(item, ", %u underlying events", underlying_events);
3335             offset += 2;
3336             proto_tree_add_item(tree, hf_bthci_evt_continuation_number, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3337             offset += 2;
3338             item = proto_tree_add_item(tree, hf_bthci_evt_le_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3339             proto_item_append_text(item, " (%g sec)", tvb_get_letohs(tvb, offset)*0.01);
3340             offset += 2;
3341             }
3342             break;
3343         default:
3344             break;
3345     }
3346     return offset;
3347 }
3348 
3349 static int
dissect_bthci_evt_physical_link_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3350 dissect_bthci_evt_physical_link_complete(tvbuff_t *tvb, int offset,
3351         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3352 {
3353     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3354     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3355     offset += 1;
3356 
3357     proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3358     offset += 1;
3359     return offset;
3360 }
3361 
3362 static int
dissect_bthci_evt_channel_select_physical_link_recovery(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)3363 dissect_bthci_evt_channel_select_physical_link_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
3364 {
3365     proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3366     offset += 1;
3367     return offset;
3368 }
3369 
3370 static int
dissect_bthci_evt_disconnect_physical_link_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3371 dissect_bthci_evt_disconnect_physical_link_complete(tvbuff_t *tvb, int offset,
3372         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3373 {
3374     proto_tree_add_item(tree, hf_bthci_evt_status,               tvb, offset, 1, ENC_LITTLE_ENDIAN);
3375     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3376     offset += 1;
3377 
3378     proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3379     offset += 1;
3380 
3381     proto_tree_add_item(tree, hf_bthci_evt_reason,               tvb, offset, 1, ENC_LITTLE_ENDIAN);
3382     send_hci_summary_reason_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3383     offset += 1;
3384 
3385     return offset;
3386 }
3387 
3388 static int
dissect_bthci_evt_physical_link_loss_early_warning(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)3389 dissect_bthci_evt_physical_link_loss_early_warning(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
3390 {
3391     proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3392     offset += 1;
3393     proto_tree_add_item(tree, hf_bthci_evt_link_loss_reason,     tvb, offset, 1, ENC_LITTLE_ENDIAN);
3394     offset += 1;
3395     return offset;
3396 }
3397 
3398 static int
dissect_bthci_evt_logical_link_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3399 dissect_bthci_evt_logical_link_complete(tvbuff_t *tvb, int offset,
3400         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3401 {
3402     proto_tree_add_item(tree, hf_bthci_evt_status,               tvb, offset, 1, ENC_LITTLE_ENDIAN);
3403     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3404     offset += 1;
3405 
3406     proto_tree_add_item(tree, hf_bthci_evt_logical_link_handle,  tvb, offset, 2, ENC_LITTLE_ENDIAN);
3407     offset += 2;
3408     proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3409     offset += 1;
3410     proto_tree_add_item(tree, hf_bthci_evt_flow_spec_identifier, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3411     offset += 1;
3412     return offset;
3413 }
3414 
3415 static int
dissect_bthci_evt_disconnect_logical_link_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3416 dissect_bthci_evt_disconnect_logical_link_complete(tvbuff_t *tvb, int offset,
3417         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3418 {
3419     proto_tree_add_item(tree, hf_bthci_evt_status,              tvb, offset, 1, ENC_LITTLE_ENDIAN);
3420     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3421     offset += 1;
3422 
3423     proto_tree_add_item(tree, hf_bthci_evt_logical_link_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3424     offset += 2;
3425 
3426     proto_tree_add_item(tree, hf_bthci_evt_reason,              tvb, offset, 1, ENC_LITTLE_ENDIAN);
3427     send_hci_summary_reason_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3428     offset += 1;
3429 
3430     return offset;
3431 }
3432 
3433 static int
dissect_bthci_evt_flow_spec_modify_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3434 dissect_bthci_evt_flow_spec_modify_complete(tvbuff_t *tvb, int offset,
3435         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3436 {
3437     proto_tree_add_item(tree, hf_bthci_evt_status,            tvb, offset, 1, ENC_LITTLE_ENDIAN);
3438     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3439     offset += 1;
3440 
3441     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3442     offset += 2;
3443     return offset;
3444 }
3445 
3446 static int
dissect_bthci_evt_number_of_completed_data_blocks(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)3447 dissect_bthci_evt_number_of_completed_data_blocks(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
3448 {
3449     guint8 evt_num_handles;
3450 
3451     proto_tree_add_item(tree, hf_bthci_evt_total_num_data_blocks, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3452     offset += 2;
3453 
3454     evt_num_handles = tvb_get_guint8(tvb, offset);
3455     proto_tree_add_item(tree, hf_bthci_evt_num_handles, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3456     offset += 1;
3457 
3458     while (evt_num_handles--) {
3459         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3460         offset += 2;
3461         proto_tree_add_item(tree, hf_bthci_evt_num_compl_packets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3462         offset += 2;
3463         proto_tree_add_item(tree, hf_bthci_evt_num_compl_blocks,  tvb, offset, 2, ENC_LITTLE_ENDIAN);
3464         offset += 2;
3465     }
3466     return offset;
3467 }
3468 
3469 static int
dissect_bthci_evt_amp_start_stop_test(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3470 dissect_bthci_evt_amp_start_stop_test(tvbuff_t *tvb, int offset,
3471         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3472 {
3473     proto_tree_add_item(tree, hf_bthci_evt_status,        tvb, offset, 1, ENC_LITTLE_ENDIAN);
3474     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3475     offset += 1;
3476 
3477     proto_tree_add_item(tree, hf_bthci_evt_test_scenario, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3478     offset += 1;
3479     return offset;
3480 }
3481 
3482 static int
dissect_bthci_evt_amp_receiver_test(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)3483 dissect_bthci_evt_amp_receiver_test(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
3484 {
3485     proto_tree_add_item(tree, hf_bthci_evt_amp_controller_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3486     offset += 1;
3487     proto_tree_add_item(tree, hf_bthci_evt_report_reason,       tvb, offset, 1, ENC_LITTLE_ENDIAN);
3488     offset += 1;
3489     proto_tree_add_item(tree, hf_bthci_evt_report_event_type,   tvb, offset, 1, ENC_LITTLE_ENDIAN);
3490     offset += 1;
3491     proto_tree_add_item(tree, hf_bthci_evt_num_frames,          tvb, offset, 2, ENC_LITTLE_ENDIAN);
3492     offset += 2;
3493     proto_tree_add_item(tree, hf_bthci_evt_num_error_frames,    tvb, offset, 2, ENC_LITTLE_ENDIAN);
3494     offset += 2;
3495     proto_tree_add_item(tree, hf_bthci_evt_num_bits,            tvb, offset, 4, ENC_LITTLE_ENDIAN);
3496     offset += 4;
3497     proto_tree_add_item(tree, hf_bthci_evt_num_error_bits,      tvb, offset, 4, ENC_LITTLE_ENDIAN);
3498     offset += 4;
3499     return offset;
3500 }
3501 
3502 static int
dissect_bthci_evt_short_range_mode_change_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3503 dissect_bthci_evt_short_range_mode_change_complete(tvbuff_t *tvb, int offset,
3504         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3505 {
3506     proto_tree_add_item(tree, hf_bthci_evt_status,                 tvb, offset, 1, ENC_LITTLE_ENDIAN);
3507     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3508     offset += 1;
3509 
3510     proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle,   tvb, offset, 1, ENC_LITTLE_ENDIAN);
3511     offset += 1;
3512     proto_tree_add_item(tree, hf_bthci_evt_short_range_mode_state, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3513     offset += 1;
3514     return offset;
3515 }
3516 
3517 static int
dissect_bthci_evt_amp_status_change(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)3518 dissect_bthci_evt_amp_status_change(tvbuff_t *tvb, int offset,
3519         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
3520 {
3521     proto_tree_add_item(tree, hf_bthci_evt_status,     tvb, offset, 1, ENC_LITTLE_ENDIAN);
3522     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3523     offset += 1;
3524 
3525     proto_tree_add_item(tree, hf_bthci_evt_amp_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3526     offset += 1;
3527     return offset;
3528 }
3529 
3530 static int
dissect_bthci_evt_sam_status_change(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)3531 dissect_bthci_evt_sam_status_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
3532 {
3533     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3534     offset += 2;
3535 
3536     proto_tree_add_item(tree, hf_bthci_evt_local_sam_index, tvb, offset, 1, ENC_NA);
3537     offset += 1;
3538 
3539     proto_tree_add_item(tree, hf_bthci_evt_local_sam_tx_availability, tvb, offset, 1, ENC_NA);
3540     offset += 1;
3541 
3542     proto_tree_add_item(tree, hf_bthci_evt_local_sam_rx_availability, tvb, offset, 1, ENC_NA);
3543     offset += 1;
3544 
3545     proto_tree_add_item(tree, hf_bthci_evt_remote_sam_index, tvb, offset, 1, ENC_NA);
3546     offset += 1;
3547 
3548     proto_tree_add_item(tree, hf_bthci_evt_remote_sam_tx_availability, tvb, offset, 1, ENC_NA);
3549     offset += 1;
3550 
3551     proto_tree_add_item(tree, hf_bthci_evt_remote_sam_rx_availability, tvb, offset, 1, ENC_NA);
3552     offset += 1;
3553     return offset;
3554 }
3555 
3556 static int
dissect_bthci_evt_command_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * main_tree,proto_tree * tree,wmem_list_t * opcode_list,bluetooth_data_t * bluetooth_data,guint32 * out_opcode)3557 dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
3558         packet_info *pinfo,  proto_tree *main_tree, proto_tree *tree,
3559         wmem_list_t *opcode_list, bluetooth_data_t *bluetooth_data, guint32 *out_opcode)
3560 {
3561     proto_item  *ti_opcode;
3562     proto_tree  *opcode_tree;
3563     proto_item  *item;
3564     gint16       timeout;
3565     guint8       num8;
3566     guint        i;
3567     guint8       ogf;
3568     guint32      accuracy;
3569     guint8       bd_addr[6];
3570     gboolean     local_addr = FALSE;
3571     gint         hfx;
3572     guint8       status;
3573     wmem_tree_key_t     key[4];
3574     guint32             interface_id;
3575     guint32             adapter_id;
3576     guint32             frame_number;
3577     guint32             opcode;
3578 
3579     proto_tree_add_item(tree, hf_bthci_evt_num_command_packets, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3580     offset += 1;
3581 
3582     opcode = tvb_get_letohs(tvb, offset);
3583     ogf = opcode >> 10;
3584     if (out_opcode)
3585         *out_opcode = opcode;
3586 
3587     if (have_tap_listener(bluetooth_hci_summary_tap)) {
3588         bluetooth_hci_summary_tap_t  *tap_hci_summary;
3589 
3590         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
3591 
3592         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
3593         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
3594 
3595         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE;
3596         tap_hci_summary->ogf = ogf;
3597         tap_hci_summary->ocf = opcode & 0x03ff;
3598         tap_hci_summary->event = 0x0e; /* Command Complete */
3599         if (try_val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext))
3600             tap_hci_summary->name = val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext, "Unknown 0x%04x");
3601         else
3602             tap_hci_summary->name = NULL;
3603         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
3604     }
3605 
3606     interface_id = bluetooth_data->interface_id;
3607     adapter_id   = bluetooth_data->adapter_id;
3608     frame_number = pinfo->num;
3609 
3610     ti_opcode = proto_tree_add_item(tree, hf_bthci_evt_opcode, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3611     opcode_tree = proto_item_add_subtree(ti_opcode, ett_opcode);
3612     proto_tree_add_item(opcode_tree, hf_bthci_evt_ogf, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3613 
3614     if (ogf == HCI_OGF_LINK_CONTROL)
3615         hfx = hf_bthci_evt_ocf_link_control;
3616     else if (ogf == HCI_OGF_LINK_POLICY)
3617         hfx = hf_bthci_evt_ocf_link_policy;
3618     else if (ogf == HCI_OGF_HOST_CONTROLLER)
3619         hfx = hf_bthci_evt_ocf_host_controller_and_baseband;
3620     else if (ogf == HCI_OGF_INFORMATIONAL)
3621         hfx = hf_bthci_evt_ocf_informational;
3622     else if (ogf == HCI_OGF_STATUS)
3623         hfx = hf_bthci_evt_ocf_status;
3624     else if (ogf == HCI_OGF_TESTING)
3625         hfx = hf_bthci_evt_ocf_testing;
3626     else if (ogf == HCI_OGF_LOW_ENERGY)
3627         hfx = hf_bthci_evt_ocf_low_energy;
3628     else if (ogf == HCI_OGF_LOGO_TESTING)
3629         hfx = hf_bthci_evt_ocf_logo_testing;
3630     else
3631         hfx = hf_bthci_evt_ocf;
3632     proto_tree_add_item(opcode_tree, hfx, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3633     offset += 2;
3634 
3635     if (ogf == HCI_OGF_VENDOR_SPECIFIC) {
3636         col_append_fstr(pinfo->cinfo, COL_INFO, " (Vendor Command 0x%04X [opcode 0x%04X])", opcode & 0x03ff, opcode);
3637 
3638         if (!dissector_try_payload_new(vendor_dissector_table, tvb, pinfo, main_tree, TRUE, bluetooth_data)) {
3639             if (bluetooth_data) {
3640                 hci_vendor_data_t  *hci_vendor_data;
3641 
3642                 interface_id = bluetooth_data->interface_id;
3643                 adapter_id   = bluetooth_data->adapter_id;
3644 
3645                 key[0].length = 1;
3646                 key[0].key    = &interface_id;
3647                 key[1].length = 1;
3648                 key[1].key    = &adapter_id;
3649                 key[2].length = 0;
3650                 key[2].key    = NULL;
3651 
3652                 hci_vendor_data = (hci_vendor_data_t *) wmem_tree_lookup32_array(bluetooth_data->hci_vendors, key);
3653                 if (hci_vendor_data) {
3654                     gint sub_offset;
3655 
3656                     sub_offset = dissector_try_uint_new(hci_vendor_table, hci_vendor_data->manufacturer, tvb, pinfo, main_tree, TRUE, bluetooth_data);
3657 
3658                     if (sub_offset > 0 && sub_offset < tvb_captured_length_remaining(tvb, offset))
3659                         proto_tree_add_expert(tree, pinfo, &ei_parameter_unexpected, tvb, offset + sub_offset, tvb_captured_length_remaining(tvb, sub_offset + offset));
3660                 }
3661             }
3662         }
3663 
3664         proto_tree_add_item(tree, hf_bthci_evt_ret_params, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA);
3665         offset = tvb_captured_length(tvb);
3666     } else {
3667         col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
3668                 val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext, "Unknown 0x%04x"));
3669     }
3670 
3671     if (ogf != HCI_OGF_VENDOR_SPECIFIC) switch(opcode) {
3672         /* This is a list of Commands that all return just the status */
3673         case 0x0402: /* Inquiry Cancel */
3674         case 0x0403: /* Periodic Inquiry Mode */
3675         case 0x0404: /* Exit Periodic Enquiry Mode */
3676         case 0x080f: /* Write Default Link Policy Settings */
3677         case 0x0c01: /* Set Event Mask */
3678         case 0x0c03: /* Reset */
3679         case 0x0c05: /* Set Event Filter */
3680         case 0x0c0a: /* Write PIN Type */
3681         case 0x0c0b: /* Create Unit Key */
3682         case 0x0c13: /* Change Local Name */
3683         case 0x0c16: /* Write Connection Accept Timeout */
3684         case 0x0c18: /* Write Page Timeout */
3685         case 0x0c1a: /* Write Scan Enable */
3686         case 0x0c1c: /* Write Page Scan Activity */
3687         case 0x0c1e: /* Write Inquiry Scan Activity */
3688         case 0x0c20: /* Write Authentication Enable */
3689         case 0x0c22: /* Write Encryption Mode  */
3690         case 0x0c24: /* Write Class of Device */
3691         case 0x0c26: /* Write Voice Setting */
3692         case 0x0c2a: /* Write Num Broadcast Retransmissions */
3693         case 0x0c2c: /* Write Hold Mode Activity */
3694         case 0x0c2f: /* Write SCO Flow Control Enable */
3695         case 0x0c31: /* Set Host Controller To Host Flow Control */
3696         case 0x0c33: /* Host Buffer Size */
3697         case 0x0c3a: /* Write Current IAC LAP */
3698         case 0x0c3c: /* Write Page Scan Period Mode */
3699         case 0x0c3e: /* Write Page Scan Mode */
3700         case 0x0c3f: /* Set AFH Host Channel Classification */
3701         case 0x0c43: /* Write Inquiry Scan Type */
3702         case 0x0c45: /* Write Inquiry Mode */
3703         case 0x0c47: /* Write Page Scan Type */
3704         case 0x0c49: /* Write AFH Channel Assessment Mode */
3705         case 0x0c52: /* Write Extended Inquiry Response */
3706         case 0x0c56: /* Write Simple Pairing Mode */
3707         case 0x0c59: /* Write Inquiry Tx Power Level */
3708         case 0x0c5b: /* Write Default Erroneous Data Reporting */
3709         case 0x0c62: /* Write Logical Link Accept Timeout */
3710         case 0x0c63: /* Set Event Mask Page 2 */
3711         case 0x0c65: /* Write Location Data */
3712         case 0x0c67: /* Write Flow Control Mode */
3713         case 0x0c6a: /* Write Best Effort Timeout */
3714         case 0x0c6d: /* Write LE Host Supported */
3715         case 0x0c6e: /* Set MWS Channel Parameters */
3716         case 0x0c6f: /* Set External Frame Configuration */
3717         case 0x0c71: /* Set MWS Transport Layer */
3718         case 0x0c72: /* Set MWS Scan Frequency Table */
3719         case 0x0c73: /* Set MWS Pattern Configuration */
3720         case 0x0c7a: /* Write Secure Connections Host Support */
3721         case 0x0c7f: /* Write Extended Page Timeout */
3722         case 0x0c81: /* Write Extended Inquiry Length */
3723         case 0x140d: /* Set Triggered Clock Capture */
3724         case 0x1802: /* Write Loopback Mode */
3725         case 0x1803: /* Enable Device Under Test Mode */
3726         case 0x1804: /* Write Simple Pairing Debug Mode */
3727         case 0x1807: /* Enable AMP Receiver Reports */
3728         case 0x1808: /* AMP Test End */
3729         case 0x1809: /* AMP Test */
3730         case 0x2001: /* LE Set Event Mask */
3731         case 0x2005: /* LE Set Random Address */
3732         case 0x2006: /* LE Set Advertising Parameters */
3733         case 0x2008: /* LE Set Advertising Data */
3734         case 0x2009: /* LE Set Scan Response Data */
3735         case 0x200a: /* LE Set Advertise Enable */
3736         case 0x200b: /* LE Set Scan Parameters */
3737         case 0x200c: /* LE Set Scan Enable */
3738         case 0x200e: /* LE Create Connection Cancel */
3739         case 0x2010: /* LE Clear White List */
3740         case 0x2011: /* LE Add Device To White List */
3741         case 0x2012: /* LE Remove Device From White List */
3742         case 0x2014: /* LE Set Host Channel Classification */
3743         case 0x201d: /* LE Receiver Test [v1] */
3744         case 0x201e: /* LE Transmitter Test [v1] */
3745         case 0x2024: /* LE Write Suggested Default Data Length */
3746         case 0x2027: /* LE Add Device to Resolving List */
3747         case 0x2028: /* LE Remove Device From Resolving List */
3748         case 0x2029: /* LE Clear Resolving List */
3749         case 0x202D: /* LE Set Address Resolution Enable */
3750         case 0x202E: /* LE Set Resolvable Private Address Timeout */
3751         case 0x2031: /* LE Set Default PHY */
3752         case 0x2033: /* LE Receiver Test [v2] */
3753         case 0x2034: /* LE Transmitter Test [v2] */
3754         case 0x2035: /* LE Set Advertising Set Random Address */
3755         case 0x2037: /* LE Set Extended Advertising Data */
3756         case 0x2038: /* LE Set Extended Scan Response Data */
3757         case 0x2039: /* LE Set Extended Advertising Enable */
3758         case 0x203C: /* LE Remove Advertising Set */
3759         case 0x203D: /* LE Clear Advertising Sets */
3760         case 0x203E: /* LE Set Periodic Advertising Parameters */
3761         case 0x203F: /* LE Set Periodic Advertising Data */
3762         case 0x2040: /* LE Set Periodic Advertising Enable */
3763         case 0x2041: /* LE Set Extended Scan Parameters */
3764         case 0x2042: /* LE Set Extended Scan Enable */
3765         case 0x2045: /* LE Periodic Advertising Create Sync Cancel */
3766         case 0x2046: /* LE Periodic Advertising Terminate Sync */
3767         case 0x2047: /* LE Add Device To Periodic Advertiser List */
3768         case 0x2048: /* LE Remove Device From Periodic Advertiser List */
3769         case 0x2049: /* LE Clear Periodic Advertiser List */
3770         case 0x204D: /* LE Write RF Path Compensation */
3771         case 0x204E: /* LE Set Privacy Mode */
3772         case 0x204F: /* LE Receiver Test [v3] */
3773         case 0x2050: /* LE Transmitter Test [v3] */
3774         case 0x2051: /* LE Set Connectionless CTE Transmit Parameters */
3775         case 0x2052: /* LE Set Connectionless CTE Transmit Enable */
3776         case 0x2059: /* LE Set Periodic Advertising Receive Enable */
3777         case 0x205D: /* LE Set Default Periodic Advertising Sync Transfer Parameters */
3778         case 0x205F: /* LE Modify Sleep Clock Accuracy */
3779         case 0x2074: /* LE Set Host Feature */
3780         case 0x207C: /* LE Set Data Related Address Changes */
3781         case 0x207D: /* LE Set Default Subrate */
3782             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3783             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3784             offset += 1;
3785             break;
3786 
3787         /* This is a list of Commands that all return status and BD_ADDR */
3788         case 0x1009: /* Read BD_ADDR */
3789             local_addr = TRUE;
3790 
3791             /* FALLTHROUGH */
3792         case 0x0408: /* Create Connection Cancel */
3793         case 0x040b: /* Link Key Request Reply */
3794         case 0x040c: /* Link Key Request Negative Reply */
3795         case 0x040d: /* PIN Code Request Reply */
3796         case 0x040e: /* PIN Code Request Negative Reply */
3797         case 0x041a: /* Remote Name Request Cancel */
3798         case 0x042b: /* IO Capability Request Reply */
3799         case 0x042c: /* User Confirmation Request Reply */
3800         case 0x042d: /* User Confirmation Request Negative Reply */
3801         case 0x042e: /* User Passkey Request Reply */
3802         case 0x042f: /* User Passkey Request Negative Reply */
3803         case 0x0430: /* Remote OOB Data Request Reply */
3804         case 0x0433: /* Remote OOB Data Request Negative Reply */
3805         case 0x0434: /* IO Capability Request Negative Reply */
3806         case 0x0440: /* Truncated Page Cancel */
3807         case 0x0445: /* Remote OOB Extended Data Request Reply */
3808         case 0x0c60: /* Send Keypress Notification */
3809         case 0x202B: /* LE Read Peer Resolvable Address */
3810         case 0x202C: /* LE Read Local Resolvable Address */
3811             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3812             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3813             offset += 1;
3814 
3815             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, local_addr, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
3816             if (!pinfo->fd->visited && local_addr) {
3817                 localhost_bdaddr_entry_t   *localhost_bdaddr_entry;
3818 
3819                 interface_id = bluetooth_data->interface_id;
3820                 adapter_id = bluetooth_data->adapter_id;
3821                 frame_number = pinfo->num;
3822 
3823                 key[0].length = 1;
3824                 key[0].key    = &interface_id;
3825                 key[1].length = 1;
3826                 key[1].key    = &adapter_id;
3827                 key[2].length = 1;
3828                 key[2].key    = &frame_number;
3829                 key[3].length = 0;
3830                 key[3].key    = NULL;
3831 
3832                 localhost_bdaddr_entry = (localhost_bdaddr_entry_t *) wmem_new(wmem_file_scope(), localhost_bdaddr_entry_t);
3833                 localhost_bdaddr_entry->interface_id = interface_id;
3834                 localhost_bdaddr_entry->adapter_id = adapter_id;
3835                 memcpy(localhost_bdaddr_entry->bd_addr, bd_addr, 6);
3836                 wmem_tree_insert32_array(bluetooth_data->localhost_bdaddr, key, localhost_bdaddr_entry);
3837             }
3838 
3839             if (local_addr && have_tap_listener(bluetooth_device_tap)) {
3840                 bluetooth_device_tap_t  *tap_device;
3841 
3842                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
3843                 if (bluetooth_data) {
3844                     tap_device->interface_id  = bluetooth_data->interface_id;
3845                     tap_device->adapter_id    = bluetooth_data->adapter_id;
3846                 } else {
3847                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
3848                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
3849                 }
3850                 memcpy(tap_device->bd_addr, bd_addr, 6);
3851                 tap_device->has_bd_addr = TRUE;
3852                 tap_device->is_local = TRUE;
3853                 tap_device->type = BLUETOOTH_DEVICE_LOCAL_ADAPTER;
3854                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
3855             }
3856 
3857             break;
3858 
3859         /* This is a list of Commands that all return status and connection_handle */
3860         case 0x080d: /* Write Link Policy Settings */
3861         case 0x0811: /* Sniff Subrating */
3862         case 0x0c08: /* Flush */
3863         case 0x0c28: /* Write Automatic Flush Timeout */
3864         case 0x0c37: /* Write Link Supervision Timeout */
3865         case 0x0c7c: /* Write Authenticated Payload Timeout */
3866         case 0x1402: /* Reset Failed Contact Counter */
3867         case 0x180a: /* Write Secure Connections Test Mode */
3868         case 0x201a: /* LE Long Term Key Request Reply */
3869         case 0x201b: /* LE Long Term Key Request Neg Reply */
3870         case 0x2020: /* LE Remote Connection Parameter Request Reply */
3871         case 0x2021: /* LE Remote Connection Parameter Request Negative Reply */
3872         case 0x2022: /* LE Set Data Length */
3873         case 0x2054: /* LE Set Connection CTE Receive Parameters */
3874         case 0x2055: /* LE Set Connection CTE Transmit Parameters */
3875         case 0x2056: /* LE Connection CTE Request Enable */
3876         case 0x2057: /* LE Connection CTE Response Enable */
3877         case 0x205A: /* LE Periodic Advertising Sync Transfer */
3878         case 0x205B: /* LE Periodic Advertising Set Info Transfer */
3879         case 0x205C: /* LE Set Periodic Advertising Sync Transfer Parameters */
3880         case 0x2078: /* LE Set Path Loss Reporting Parameters */
3881         case 0x2079: /* LE Set Path Loss Reporting Enable */
3882         case 0x207a: /* LE Set Transmit Power Reporting Enable */
3883             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3884             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3885             offset += 1;
3886 
3887             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3888             offset += 2;
3889 
3890             break;
3891 
3892         /* This is a list of Commands that all return status and timeout */
3893         case 0x0c15: /* Read Connection Accept Timeout */
3894             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3895             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3896             offset += 1;
3897 
3898             timeout = tvb_get_letohs(tvb, offset);
3899             item = proto_tree_add_item(tree, hf_bthci_evt_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3900             proto_item_append_text(item, " slots (%g msec)", timeout*0.625);
3901             offset += 2;
3902 
3903             break;
3904         case 0x0c17: /* Read Page Timeout */
3905             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3906             status = tvb_get_guint8(tvb, offset);
3907             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
3908             offset += 1;
3909 
3910             timeout = tvb_get_letohs(tvb, offset);
3911             item = proto_tree_add_item(tree, hf_bthci_evt_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3912             proto_item_append_text(item, " slots (%g msec)", timeout*0.625);
3913             offset += 2;
3914 
3915             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
3916                 bluetooth_device_tap_t  *tap_device;
3917 
3918                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
3919                 if (bluetooth_data) {
3920                     tap_device->interface_id  = bluetooth_data->interface_id;
3921                     tap_device->adapter_id    = bluetooth_data->adapter_id;
3922                 } else {
3923                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
3924                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
3925                 }
3926                 tap_device->has_bd_addr = FALSE;
3927                 tap_device->is_local = TRUE;
3928                 tap_device->type = BLUETOOTH_DEVICE_PAGE_TIMEOUT;
3929                 tap_device->data.page_timeout = tvb_get_guint16(tvb, offset - 2, ENC_LITTLE_ENDIAN);
3930                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
3931             }
3932 
3933             break;
3934 
3935         /* This is a list of Commands that all return status, connection handle and timeout */
3936         case 0x0c27: /* Read Automatic Flush Timeout */
3937         case 0x0c36: /* Read Link Supervision Timeout */
3938             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3939             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3940             offset += 1;
3941 
3942             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3943             offset += 2;
3944 
3945             timeout = tvb_get_letohs(tvb, offset);
3946             item = proto_tree_add_item(tree, hf_bthci_evt_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3947             proto_item_append_text(item, " slots (%g msec)", timeout*0.625);
3948             offset += 2;
3949 
3950             break;
3951 
3952         /* This is a list of Commands that all return status, interval and window */
3953         case 0x0c1b: /* Read Page Scan Activity */
3954         case 0x0c1d: /* Read Inquiry Scan Activity */
3955             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3956             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3957             offset += 1;
3958 
3959             proto_tree_add_item(tree, hf_bthci_evt_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3960             offset += 2;
3961 
3962             proto_tree_add_item(tree, hf_bthci_evt_window, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3963             offset += 2;
3964 
3965             break;
3966 
3967         case 0x0420: /* Read LMP Handle */
3968             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3969             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3970             offset += 1;
3971 
3972             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
3973             offset += 2;
3974 
3975             proto_tree_add_item(tree, hf_bthci_evt_lmp_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3976             offset += 1;
3977 
3978             /* 4 reserved bytes */
3979             offset += 4;
3980             break;
3981 
3982         case 0x043b: /* Logical Link Cancel */
3983             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3984             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3985             offset += 1;
3986 
3987             proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3988             offset += 1;
3989 
3990             proto_tree_add_item(tree, hf_bthci_evt_flow_spec_identifier, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3991             offset += 1;
3992 
3993             break;
3994         case 0x0809: /* Role Discovery */
3995             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3996             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
3997             offset += 1;
3998 
3999             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4000             offset += 2;
4001 
4002             proto_tree_add_item(tree, hf_bthci_evt_curr_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4003             offset += 1;
4004 
4005             break;
4006 
4007         case 0x080c: /* Read Link Policy Settings */
4008             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4009             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4010             offset += 1;
4011 
4012             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4013             offset += 2;
4014 
4015             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_switch, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4016             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_hold  , tvb, offset, 2, ENC_LITTLE_ENDIAN);
4017             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_sniff , tvb, offset, 2, ENC_LITTLE_ENDIAN);
4018             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_park  , tvb, offset, 2, ENC_LITTLE_ENDIAN);
4019             offset += 2;
4020 
4021             break;
4022 
4023         case 0x080e: /* Read Default Link Policy Settings */
4024             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4025             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4026             offset += 1;
4027 
4028             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_switch, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4029             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_hold  , tvb, offset, 2, ENC_LITTLE_ENDIAN);
4030             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_sniff , tvb, offset, 2, ENC_LITTLE_ENDIAN);
4031             proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_park  , tvb, offset, 2, ENC_LITTLE_ENDIAN);
4032             offset += 2;
4033 
4034             break;
4035 
4036         case 0x0c09: /* Read PIN Type */
4037             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4038             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4039             offset += 1;
4040 
4041             proto_tree_add_item(tree, hf_bthci_evt_pin_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4042             offset += 1;
4043 
4044             break;
4045 
4046         case 0x0c0d: /* Read Stored Link Key */
4047             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4048             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4049             offset += 1;
4050 
4051             proto_tree_add_item(tree, hf_bthci_evt_max_num_keys, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4052             offset += 2;
4053 
4054             proto_tree_add_item(tree, hf_bthci_evt_num_keys_read, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4055             offset += 2;
4056 
4057             break;
4058 
4059         case 0x0c11: /* Write Stored Link Key */
4060             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4061             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4062             offset += 1;
4063 
4064             proto_tree_add_item(tree, hf_bthci_evt_num_keys_written, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4065             offset += 1;
4066 
4067             break;
4068 
4069         case 0x0c12: /* Delete Stored Link Key */
4070             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4071             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4072             offset += 1;
4073 
4074             proto_tree_add_item(tree, hf_bthci_evt_num_keys_deleted, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4075             offset += 2;
4076 
4077             break;
4078 
4079         case 0x0c14: /* Read Local Name */
4080             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4081             status = tvb_get_guint8(tvb, offset);
4082             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4083             offset += 1;
4084 
4085             proto_tree_add_item(tree, hf_bthci_evt_device_name, tvb, offset, 248, ENC_UTF_8|ENC_NA);
4086             if (status == STATUS_SUCCESS && !pinfo->fd->visited) {
4087                 gchar                   *name;
4088                 localhost_name_entry_t  *localhost_name_entry;
4089 
4090                 name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 248, ENC_UTF_8);
4091 
4092                 key[0].length = 1;
4093                 key[0].key    = &interface_id;
4094                 key[1].length = 1;
4095                 key[1].key    = &adapter_id;
4096                 key[2].length = 1;
4097                 key[2].key    = &frame_number;
4098                 key[3].length = 0;
4099                 key[3].key    = NULL;
4100 
4101                 localhost_name_entry = (localhost_name_entry_t *) wmem_new(wmem_file_scope(), localhost_name_entry_t);
4102                 localhost_name_entry->interface_id = interface_id;
4103                 localhost_name_entry->adapter_id = adapter_id;
4104                 localhost_name_entry->name = wmem_strdup(wmem_file_scope(), name);
4105 
4106                 wmem_tree_insert32_array(bluetooth_data->localhost_name, key, localhost_name_entry);
4107             }
4108 
4109             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4110                 bluetooth_device_tap_t  *tap_device;
4111 
4112                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4113                 if (bluetooth_data) {
4114                     tap_device->interface_id  = bluetooth_data->interface_id;
4115                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4116                 } else {
4117                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4118                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4119                 }
4120                 tap_device->has_bd_addr = FALSE;
4121                 tap_device->is_local = TRUE;
4122                 tap_device->type = BLUETOOTH_DEVICE_NAME;
4123                 tap_device->data.name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 248, ENC_UTF_8);
4124                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4125             }
4126             offset += 248;
4127 
4128             break;
4129 
4130         case 0x0c19: /* Read Scan Enable */
4131             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4132             status = tvb_get_guint8(tvb, offset);
4133             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4134             offset += 1;
4135 
4136             proto_tree_add_item(tree, hf_bthci_evt_scan_enable, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4137             offset += 1;
4138 
4139             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4140                 bluetooth_device_tap_t  *tap_device;
4141 
4142                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4143                 if (bluetooth_data) {
4144                     tap_device->interface_id  = bluetooth_data->interface_id;
4145                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4146                 } else {
4147                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4148                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4149                 }
4150                 tap_device->has_bd_addr = FALSE;
4151                 tap_device->is_local = TRUE;
4152                 tap_device->type = BLUETOOTH_DEVICE_SCAN;
4153                 tap_device->data.scan = tvb_get_guint8(tvb, offset - 1);
4154                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4155             }
4156 
4157             break;
4158 
4159         case 0x0c1f: /* Read Authentication Enable */
4160             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4161             status = tvb_get_guint8(tvb, offset);
4162             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4163             offset += 1;
4164 
4165             proto_tree_add_item(tree, hf_bthci_evt_authentication_enable, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4166             offset += 1;
4167 
4168             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4169                 bluetooth_device_tap_t  *tap_device;
4170 
4171                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4172                 if (bluetooth_data) {
4173                     tap_device->interface_id  = bluetooth_data->interface_id;
4174                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4175                 } else {
4176                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4177                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4178                 }
4179                 tap_device->has_bd_addr = FALSE;
4180                 tap_device->is_local = TRUE;
4181                 tap_device->type = BLUETOOTH_DEVICE_AUTHENTICATION;
4182                 tap_device->data.class_of_device = tvb_get_guint8(tvb, offset - 1);
4183                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4184             }
4185 
4186             break;
4187         case 0x0c21: /* Read Encryption Mode */
4188             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4189             status = tvb_get_guint8(tvb, offset);
4190             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4191             offset += 1;
4192 
4193             proto_tree_add_item(tree, hf_bthci_evt_encryption_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4194             offset += 1;
4195 
4196             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4197                 bluetooth_device_tap_t  *tap_device;
4198 
4199                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4200                 if (bluetooth_data) {
4201                     tap_device->interface_id  = bluetooth_data->interface_id;
4202                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4203                 } else {
4204                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4205                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4206                 }
4207                 tap_device->has_bd_addr = FALSE;
4208                 tap_device->is_local = TRUE;
4209                 tap_device->type = BLUETOOTH_DEVICE_ENCRYPTION;
4210                 tap_device->data.class_of_device = tvb_get_guint8(tvb, offset - 1);
4211                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4212             }
4213 
4214             break;
4215 
4216         case 0x0c23: /* Read Class of Device */
4217             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4218             status = tvb_get_guint8(tvb, offset);
4219             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4220             offset += 1;
4221 
4222             call_dissector(btcommon_cod_handle, tvb_new_subset_length(tvb, offset, 3), pinfo, tree);
4223             offset += 3;
4224 
4225             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4226                 bluetooth_device_tap_t  *tap_device;
4227 
4228                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4229                 if (bluetooth_data) {
4230                     tap_device->interface_id  = bluetooth_data->interface_id;
4231                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4232                 } else {
4233                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4234                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4235                 }
4236                 tap_device->has_bd_addr = FALSE;
4237                 tap_device->is_local = TRUE;
4238                 tap_device->type = BLUETOOTH_DEVICE_CLASS_OF_DEVICE;
4239                 tap_device->data.class_of_device = tvb_get_guint24(tvb, offset - 3, ENC_LITTLE_ENDIAN);
4240                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4241             }
4242 
4243             break;
4244 
4245         case 0x0c25: /* Read Voice Setting */
4246             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4247             status = tvb_get_guint8(tvb, offset);
4248             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4249             offset += 1;
4250 
4251             proto_tree_add_item(tree, hf_bthci_evt_input_unused, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4252             proto_tree_add_item(tree, hf_bthci_evt_input_coding, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4253             proto_tree_add_item(tree, hf_bthci_evt_input_data_format, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4254             proto_tree_add_item(tree, hf_bthci_evt_input_sample_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4255             proto_tree_add_item(tree, hf_bthci_evt_linear_pcm_bit_pos, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4256             proto_tree_add_item(tree, hf_bthci_evt_air_coding_format, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4257             offset += 2;
4258 
4259             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4260                 bluetooth_device_tap_t  *tap_device;
4261 
4262                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4263                 if (bluetooth_data) {
4264                     tap_device->interface_id  = bluetooth_data->interface_id;
4265                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4266                 } else {
4267                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4268                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4269                 }
4270                 tap_device->has_bd_addr = FALSE;
4271                 tap_device->is_local = TRUE;
4272                 tap_device->type = BLUETOOTH_DEVICE_VOICE_SETTING;
4273                 tap_device->data.voice_setting = tvb_get_guint16(tvb, offset - 2, ENC_LITTLE_ENDIAN);
4274                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4275             }
4276 
4277             break;
4278 
4279         case 0x0c29: /* Read Num Broadcast Retransmissions */
4280             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4281             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4282             offset += 1;
4283 
4284             proto_tree_add_item(tree, hf_bthci_evt_num_broadcast_retransm, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4285             offset += 1;
4286 
4287             break;
4288 
4289         case 0x0c2b: /* Read Hold Mode Activity */
4290             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4291             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4292             offset += 1;
4293 
4294             proto_tree_add_item(tree, hf_bthci_evt_hold_mode_act_page, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4295             proto_tree_add_item(tree, hf_bthci_evt_hold_mode_act_inquiry, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4296             proto_tree_add_item(tree, hf_bthci_evt_hold_mode_act_periodic, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4297             offset += 1;
4298 
4299             break;
4300 
4301         case 0x0c2d: /* Read Transmit Power Level */
4302             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4303             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4304             offset += 1;
4305 
4306             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4307             offset += 2;
4308 
4309             proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4310             offset += 1;
4311 
4312             break;
4313 
4314         case 0x0c2e: /* Read SCO Flow Control Enable */
4315             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4316             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4317             offset += 1;
4318 
4319             proto_tree_add_item(tree, hf_bthci_evt_sco_flow_cont_enable, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4320             offset += 1;
4321 
4322             break;
4323 
4324 
4325         case 0x0c38: /* Read Number of Supported IAC */
4326             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4327             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4328             offset += 1;
4329 
4330             proto_tree_add_item(tree, hf_bthci_evt_num_supp_iac, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4331             offset += 1;
4332 
4333             break;
4334 
4335         case 0x0c39: /* Read Current IAC LAP */
4336             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4337             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4338             offset += 1;
4339 
4340             num8 = tvb_get_guint8(tvb, offset);
4341             proto_tree_add_item(tree, hf_bthci_evt_num_curr_iac, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4342             offset += 1;
4343 
4344             for (i = 0; i < num8; i++) {
4345                 proto_tree_add_item(tree, hf_bthci_evt_iac_lap, tvb, offset, 3, ENC_LITTLE_ENDIAN);
4346                 offset += 3;
4347             }
4348             break;
4349 
4350         case 0x0c3b: /* Read Page Scan Period Mode */
4351             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4352             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4353             offset += 1;
4354 
4355             proto_tree_add_item(tree, hf_bthci_evt_page_scan_period_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4356             offset += 1;
4357 
4358             break;
4359 
4360         case 0x0c3d: /* Read Page Scan Mode */
4361             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4362             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4363             offset += 1;
4364 
4365             proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4366             offset += 1;
4367 
4368             break;
4369 
4370         case 0x0c42: /* Read Inquiry Scan Type */
4371         case 0x0c46: /* Read Page Scan Type */
4372             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4373             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4374             offset += 1;
4375 
4376             proto_tree_add_item(tree, hf_bthci_evt_scan_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4377             offset += 1;
4378             break;
4379 
4380         case 0x0c44: /* Read Inquiry Mode */
4381             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4382             status = tvb_get_guint8(tvb, offset);
4383             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4384             offset += 1;
4385 
4386             proto_tree_add_item(tree, hf_bthci_evt_inq_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4387             offset += 1;
4388 
4389             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4390                 bluetooth_device_tap_t  *tap_device;
4391 
4392                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4393                 if (bluetooth_data) {
4394                     tap_device->interface_id  = bluetooth_data->interface_id;
4395                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4396                 } else {
4397                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4398                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4399                 }
4400                 tap_device->has_bd_addr = FALSE;
4401                 tap_device->is_local = TRUE;
4402                 tap_device->type = BLUETOOTH_DEVICE_INQUIRY_MODE;
4403                 tap_device->data.inquiry_mode = tvb_get_guint8(tvb, offset - 1);
4404                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4405             }
4406             break;
4407 
4408         case 0x0c48: /* Read AFH Channel Assessment Mode */
4409             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4410             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4411             offset += 1;
4412             proto_tree_add_item(tree, hf_bthci_evt_afh_ch_assessment_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4413             offset += 1;
4414             break;
4415 
4416         case 0x0c51: /* Read Extended Inquiry Response */
4417             {
4418             bluetooth_eir_ad_data_t *eir_data;
4419 
4420             eir_data = wmem_new0(wmem_packet_scope(), bluetooth_eir_ad_data_t);
4421             eir_data->interface_id = bluetooth_data->interface_id;
4422             eir_data->adapter_id = bluetooth_data->adapter_id;
4423             eir_data->bd_addr = NULL;
4424 
4425             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4426             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4427             offset += 1;
4428 
4429             proto_tree_add_item(tree, hf_bthci_evt_fec_required, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4430             offset += 1;
4431 
4432             call_dissector_with_data(btcommon_eir_handle, tvb_new_subset_length(tvb, offset, 240), pinfo, tree, eir_data);
4433             offset += 240;
4434 
4435             }
4436             break;
4437 
4438         case 0x0c55: /* Read Simple Pairing Mode */
4439             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4440             status = tvb_get_guint8(tvb, offset);
4441             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4442             offset += 1;
4443 
4444             proto_tree_add_item(tree, hf_bthci_evt_simple_pairing_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4445             offset += 1;
4446 
4447             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4448                 bluetooth_device_tap_t  *tap_device;
4449 
4450                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4451                 if (bluetooth_data) {
4452                     tap_device->interface_id  = bluetooth_data->interface_id;
4453                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4454                 } else {
4455                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4456                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4457                 }
4458                 tap_device->has_bd_addr = FALSE;
4459                 tap_device->is_local = TRUE;
4460                 tap_device->type = BLUETOOTH_DEVICE_SIMPLE_PAIRING_MODE;
4461                 tap_device->data.simple_pairing_mode = tvb_get_guint8(tvb, offset - 1);
4462                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4463             }
4464 
4465             break;
4466 
4467         case 0x0c57: /* Read Local OOB Data */
4468             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4469             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4470             offset += 1;
4471 
4472             proto_tree_add_item(tree, hf_bthci_evt_hash_c, tvb, offset, 16, ENC_NA);
4473             offset += 16;
4474             proto_tree_add_item(tree, hf_bthci_evt_randomizer_r, tvb, offset, 16, ENC_NA);
4475             offset += 16;
4476             break;
4477 
4478         case 0x0c58: /* Read Inquiry Response Tx Power Level */
4479             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4480             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4481             offset += 1;
4482 
4483             proto_tree_add_item(tree, hf_bthci_evt_power_level_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4484             offset += 1;
4485             break;
4486 
4487 
4488         case 0x0c5a: /* Read Default Erroneous Data Reporting */
4489             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4490             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4491             offset += 1;
4492 
4493             proto_tree_add_item(tree, hf_bthci_evt_err_data_reporting, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4494             offset += 1;
4495 
4496             break;
4497 
4498         case 0x0c61: /* Read Logical Link Accept Timeout */
4499             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4500             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4501             offset += 1;
4502             item = proto_tree_add_item(tree, hf_bthci_evt_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4503             proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
4504             offset += 2;
4505             break;
4506 
4507         case 0x0c64: /* Read Location Data */
4508             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4509             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4510             offset += 1;
4511             proto_tree_add_item(tree, hf_bthci_evt_location_domain_aware, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4512             offset += 1;
4513             proto_tree_add_item(tree, hf_bthci_evt_location_domain, tvb, offset, 2, ENC_ASCII | ENC_NA);
4514             offset += 2;
4515             proto_tree_add_item(tree, hf_bthci_evt_location_domain_options, tvb, offset, 1, ENC_ASCII | ENC_NA);
4516             offset += 1;
4517             proto_tree_add_item(tree, hf_bthci_evt_location_options, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4518             offset += 1;
4519             break;
4520 
4521         case 0x0c66: /* Read Flow Control Mode */
4522             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4523             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4524             offset += 1;
4525             proto_tree_add_item(tree, hf_bthci_evt_flow_control_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4526             offset += 1;
4527             break;
4528 
4529         case 0x0c68: /* Read Enhanced Tx Power Level */
4530             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4531             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4532             offset += 1;
4533             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4534             offset += 2;
4535             proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level_gfsk, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4536             offset += 1;
4537             proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level_dqpsk, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4538             offset += 1;
4539             proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level_8dpsk, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4540             offset += 1;
4541             break;
4542 
4543         case 0x0c69: /* Read Best Effort Timeout */
4544             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4545             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4546             offset += 1;
4547             proto_tree_add_item(tree, hf_bthci_evt_flush_to_us, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4548             offset += 4;
4549             break;
4550 
4551         case 0x0c6c: /* Read LE Host Supported */
4552             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4553             status = tvb_get_guint8(tvb, offset);
4554             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4555             offset += 1;
4556             proto_tree_add_item(tree, hf_bthci_evt_le_supported_host, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4557             offset += 1;
4558             proto_tree_add_item(tree, hf_bthci_evt_le_simultaneous_host, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4559             offset += 1;
4560             break;
4561 
4562         case 0x0c74: /* Set Reserved LT_ADDR */
4563         case 0x0c75: /* Delete Reserved LT_ADDR */
4564         case 0x0c76: /*  Set Connectionless Slave Broadcast Data */
4565             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4566             status = tvb_get_guint8(tvb, offset);
4567             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4568             offset += 1;
4569 
4570             proto_tree_add_item(tree, hf_bthci_evt_lt_addr, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4571             offset += 1;
4572 
4573             break;
4574 
4575         case 0x1001: /* Read Local Version Information */ {
4576             proto_item  *hci_revision_item;
4577             proto_item  *manufacturer_item;
4578             proto_item  *lmp_subversion_item;
4579 
4580             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4581             status = tvb_get_guint8(tvb, offset);
4582             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4583             offset += 1;
4584 
4585             proto_tree_add_item(tree, hf_bthci_bthci_evt_hci_version, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4586             offset += 1;
4587 
4588             hci_revision_item = proto_tree_add_item(tree, hf_bthci_evt_hci_revision, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4589             offset += 2;
4590 
4591             proto_tree_add_item(tree, hf_bthci_evt_vers_nr, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4592             offset += 1;
4593 
4594             manufacturer_item = proto_tree_add_item(tree, hf_bthci_evt_comp_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4595             offset += 2;
4596 
4597             lmp_subversion_item = proto_tree_add_item(tree, hf_bthci_evt_sub_vers_nr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4598             offset += 2;
4599 
4600             if (status == STATUS_SUCCESS) {
4601                 hci_vendor_data_t  *hci_vendor_data;
4602                 guint16             hci_revision;
4603                 guint16             manufacturer;
4604                 guint16             lmp_subversion;
4605 
4606                 key[0].length = 1;
4607                 key[0].key    = &interface_id;
4608                 key[1].length = 1;
4609                 key[1].key    = &adapter_id;
4610                 key[2].length = 0;
4611                 key[2].key    = NULL;
4612 
4613                 hci_vendor_data = (hci_vendor_data_t *) wmem_tree_lookup32_array(bluetooth_data->hci_vendors, key);
4614                 hci_revision   = tvb_get_letohs(tvb, offset - 7);
4615                 manufacturer   = tvb_get_letohs(tvb, offset - 4);
4616                 lmp_subversion = tvb_get_letohs(tvb, offset - 2);
4617 
4618                 if (have_tap_listener(bluetooth_device_tap)) {
4619                     bluetooth_device_tap_t  *tap_device;
4620                     guint8                   hci_version;
4621                     guint8                   lmp_version;
4622 
4623                     hci_version = tvb_get_guint8(tvb, offset - 8);
4624                     lmp_version = tvb_get_guint8(tvb, offset - 5);
4625 
4626                     tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4627                     tap_device->type = BLUETOOTH_DEVICE_LOCAL_VERSION;
4628                     tap_device->interface_id  = interface_id;
4629                     tap_device->adapter_id    = adapter_id;
4630                     tap_device->has_bd_addr = FALSE;
4631                     tap_device->is_local = TRUE;
4632                     tap_device->data.local_version.hci_version     = hci_version;
4633                     tap_device->data.local_version.hci_revision    = hci_revision;
4634                     tap_device->data.local_version.lmp_version     = lmp_version;
4635                     tap_device->data.local_version.lmp_subversion  = lmp_subversion;
4636                     tap_device->data.local_version.manufacturer    = manufacturer;
4637                     tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4638                 }
4639 
4640                 if (hci_vendor_data) {
4641                     proto_tree  *sub_tree;
4642                     proto_item  *sub_item;
4643 
4644                     if (manufacturer != hci_vendor_data->manufacturer) {
4645                         expert_add_info(pinfo, manufacturer_item, &ei_manufacturer_data_changed);
4646                         sub_tree = proto_item_add_subtree(manufacturer_item, ett_expert);
4647                         sub_item = proto_tree_add_uint(sub_tree, hf_changed_in_frame, tvb, 0, 0, hci_vendor_data->change_in_frame);
4648                         proto_item_set_generated(sub_item);
4649                     }
4650 
4651                     if (hci_revision != hci_vendor_data->hci_revision) {
4652                         expert_add_info(pinfo, hci_revision_item, &ei_hci_revision_changed);
4653                         sub_tree = proto_item_add_subtree(hci_revision_item, ett_expert);
4654                         sub_item = proto_tree_add_uint(sub_tree, hf_changed_in_frame, tvb, 0, 0, hci_vendor_data->change_in_frame);
4655                         proto_item_set_generated(sub_item);
4656                     }
4657 
4658                     if (lmp_subversion != hci_vendor_data->lmp_subversion) {
4659                         expert_add_info(pinfo, lmp_subversion_item, &ei_lmp_subversion_changed);
4660                         sub_tree = proto_item_add_subtree(lmp_subversion_item, ett_expert);
4661                         sub_item = proto_tree_add_uint(sub_tree, hf_changed_in_frame, tvb, 0, 0, hci_vendor_data->change_in_frame);
4662                         proto_item_set_generated(sub_item);
4663                     }
4664                 }
4665 
4666                 if (!pinfo->fd->visited) {
4667 
4668                     hci_vendor_data_t  *new_hci_vendor_data;
4669 
4670                     new_hci_vendor_data = wmem_new(wmem_file_scope(), hci_vendor_data_t);
4671                     new_hci_vendor_data->hci_revision = hci_revision;
4672                     new_hci_vendor_data->manufacturer = manufacturer;
4673                     new_hci_vendor_data->lmp_subversion = lmp_subversion;
4674                     new_hci_vendor_data->change_in_frame = pinfo->num;
4675 
4676                     if (hci_vendor_data && hci_vendor_data->change_in_frame < pinfo->num)
4677                         new_hci_vendor_data->previous = hci_vendor_data;
4678                     else
4679                         new_hci_vendor_data->previous = NULL;
4680 
4681                     wmem_tree_insert32_array(bluetooth_data->hci_vendors, key, new_hci_vendor_data);
4682                 }
4683             }}
4684 
4685             break;
4686 
4687         case 0x1002: /* Read Local Supported Commands */
4688             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
4689             status = tvb_get_guint8(tvb, offset);
4690             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4691             offset += 1;
4692 
4693             proto_tree_add_item(tree, hf_bthci_evt_local_supported_cmds, tvb, offset, 64, ENC_NA);
4694             offset += 64;
4695 
4696             break;
4697 
4698         case 0x1003: /* Read Local Supported Features */
4699             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
4700             status = tvb_get_guint8(tvb, offset);
4701             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4702             offset += 1;
4703 
4704             offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, 0);
4705 
4706             break;
4707 
4708         case 0x1004: /* Read Local Extended Features */
4709             {
4710                 guint8 page_number;
4711 
4712                 proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
4713                 status = tvb_get_guint8(tvb, offset);
4714                 send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4715                 offset += 1;
4716 
4717                 page_number = tvb_get_guint8(tvb, offset);
4718                 proto_tree_add_item(tree, hf_bthci_evt_page_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4719                 offset += 1;
4720 
4721                 proto_tree_add_item(tree, hf_bthci_evt_max_page_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4722                 offset += 1;
4723 
4724                 offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, page_number);
4725             }
4726 
4727             break;
4728 
4729         case 0x1005: /* Read Buffer Size */
4730             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4731             status = tvb_get_guint8(tvb, offset);
4732             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4733             offset += 1;
4734 
4735             proto_tree_add_item(tree, hf_bthci_evt_host_data_packet_length_acl, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4736             offset += 2;
4737 
4738             proto_tree_add_item(tree, hf_bthci_evt_host_data_packet_length_sco, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4739             offset += 1;
4740 
4741             proto_tree_add_item(tree, hf_bthci_evt_host_total_num_acl_data_packets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4742             offset += 2;
4743 
4744             proto_tree_add_item(tree, hf_bthci_evt_host_total_num_sco_data_packets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4745             offset += 2;
4746 
4747             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
4748                 bluetooth_device_tap_t  *tap_device;
4749 
4750                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
4751                 if (bluetooth_data) {
4752                     tap_device->interface_id  = bluetooth_data->interface_id;
4753                     tap_device->adapter_id    = bluetooth_data->adapter_id;
4754                 } else {
4755                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
4756                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
4757                 }
4758                 tap_device->has_bd_addr = FALSE;
4759                 tap_device->is_local = TRUE;
4760                 tap_device->type = BLUETOOTH_DEVICE_MTUS;
4761                 tap_device->data.mtus.acl_mtu     = tvb_get_guint16(tvb, offset - 7, ENC_LITTLE_ENDIAN);
4762                 tap_device->data.mtus.sco_mtu     = tvb_get_guint8(tvb,  offset - 5);
4763                 tap_device->data.mtus.acl_packets = tvb_get_guint16(tvb, offset - 4, ENC_LITTLE_ENDIAN);
4764                 tap_device->data.mtus.sco_packets = tvb_get_guint16(tvb, offset - 2, ENC_LITTLE_ENDIAN);
4765                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
4766             }
4767 
4768             break;
4769 
4770         case 0x100a: /* Read Data Block Size */
4771             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
4772             status = tvb_get_guint8(tvb, offset);
4773             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4774             offset += 1;
4775             proto_tree_add_item(tree, hf_bthci_evt_max_acl_data_packet_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4776             offset += 2;
4777             proto_tree_add_item(tree, hf_bthci_evt_data_block_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4778             offset += 2;
4779             proto_tree_add_item(tree, hf_bthci_evt_total_num_data_blocks, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4780             offset += 2;
4781 
4782             break;
4783         case 0x100b: /* Read Local Supported Codecs */
4784             {
4785             guint8       count;
4786             guint8       i_count;
4787             proto_tree  *sub_tree;
4788             proto_item  *sub_item;
4789 
4790             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
4791             status = tvb_get_guint8(tvb, offset);
4792             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4793             offset += 1;
4794 
4795             proto_tree_add_item(tree, hf_bthci_evt_number_of_supported_codecs, tvb, offset, 1, ENC_NA);
4796             count = tvb_get_guint8(tvb, offset);
4797             offset += 1;
4798 
4799             sub_item = proto_tree_add_item(tree, hf_bthci_evt_codecs, tvb, offset, count, ENC_NA);
4800             sub_tree = proto_item_add_subtree(sub_item, ett_codecs);
4801 
4802             for (i_count = 0; i_count < count; i_count+= 1) {
4803                 proto_tree_add_item(sub_tree, hf_bthci_evt_codec_id, tvb, offset, 1, ENC_NA);
4804                 offset += 1;
4805             }
4806 
4807             proto_tree_add_item(tree, hf_bthci_evt_number_of_supported_vendor_codecs, tvb, offset, 1, ENC_NA);
4808             count = tvb_get_guint8(tvb, offset);
4809             offset += 1;
4810 
4811             sub_item = proto_tree_add_item(tree, hf_bthci_evt_vendor_codecs, tvb, offset, count, ENC_NA);
4812             sub_tree = proto_item_add_subtree(sub_item, ett_codecs);
4813 
4814             for (i_count = 0; i_count < count; i_count+= 1) {
4815                 proto_tree  *codec_tree;
4816                 proto_item  *codec_item;
4817 
4818                 codec_item = proto_tree_add_string_format(sub_tree, hf_bthci_evt_vendor_codecs_item, tvb, offset, 4, "", "Item %u", i_count + 1);
4819                 codec_tree = proto_item_add_subtree(codec_item, ett_codecs);
4820 
4821                 proto_tree_add_item(codec_tree, hf_bthci_evt_comp_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4822                 offset += 2;
4823 
4824                 proto_tree_add_item(codec_tree, hf_bthci_evt_vendor_codec_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4825                 offset += 2;
4826             }
4827 
4828             }
4829             break;
4830 
4831         case 0x100c: /* Read Local Simple Pairing Options */
4832             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
4833             status = tvb_get_guint8(tvb, offset);
4834             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4835             offset += 1;
4836             proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_evt_simple_pairing_options, ett_simple_pairing_options, hfx_bthci_evt_simple_pairing_options, ENC_NA);
4837             offset += 1;
4838             proto_tree_add_item(tree, hf_bthci_evt_max_encryption_key_size, tvb, offset, 1, ENC_NA);
4839             offset += 1;
4840             break;
4841 
4842         case 0x1007: /* Read Country Code */
4843             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4844             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4845             offset += 1;
4846 
4847             proto_tree_add_item(tree, hf_bthci_evt_country_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4848             offset += 1;
4849 
4850             break;
4851 
4852         case 0x1401: /* Read Failed Contact Counter */
4853             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4854             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4855             offset += 1;
4856 
4857             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4858             offset += 2;
4859 
4860             proto_tree_add_item(tree, hf_bthci_evt_failed_contact_counter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4861             offset += 2;
4862 
4863             break;
4864 
4865         case 0x1403: /* Get Link Quality */
4866             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4867             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4868             offset += 1;
4869 
4870             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4871             offset += 2;
4872 
4873             proto_tree_add_item(tree, hf_bthci_evt_link_quality, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4874             offset += 1;
4875 
4876             break;
4877 
4878         case 0x1405: /* Read RSSI */
4879             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4880             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4881             offset += 1;
4882 
4883             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4884             offset += 2;
4885 
4886             proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4887             offset += 1;
4888 
4889             break;
4890 
4891         case 0x1406: /* Read AFH Channel Map */
4892             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4893             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4894             offset += 1;
4895 
4896             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4897             offset += 2;
4898 
4899             proto_tree_add_item(tree, hf_bthci_evt_afh_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4900             offset += 1;
4901 
4902             proto_tree_add_item(tree, hf_bthci_evt_afh_channel_map, tvb, offset, 10, ENC_NA);
4903             offset += 10;
4904 
4905             break;
4906 
4907         case 0x1407: /* Read Clock */
4908             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4909             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4910             offset += 1;
4911 
4912             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4913             offset += 2;
4914 
4915             proto_tree_add_item(tree, hf_bthci_evt_clock, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4916             offset += 4;
4917 
4918             accuracy = tvb_get_letohl(tvb, offset);
4919             item = proto_tree_add_item(tree, hf_bthci_evt_clock_accuracy, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4920             proto_item_append_text(item, " %g msec", accuracy*0.3125);
4921             offset += 2;
4922             break;
4923 
4924         case 0x1408: /* Read Encryption Key Size */
4925             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4926             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4927             offset += 1;
4928             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4929             offset += 2;
4930             proto_tree_add_item(tree, hf_bthci_evt_enc_key_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4931             offset += 1;
4932             break;
4933 
4934         case 0x1409: /* Read Local AMP Info */
4935             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4936             status = tvb_get_guint8(tvb, offset);
4937             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4938             offset += 1;
4939 
4940             proto_tree_add_item(tree, hf_bthci_evt_amp_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4941             offset += 1;
4942             proto_tree_add_item(tree, hf_bthci_evt_total_bandwidth, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4943             offset += 4;
4944             proto_tree_add_item(tree, hf_bthci_evt_max_guaranteed_bandwidth, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4945             offset += 4;
4946             proto_tree_add_item(tree, hf_bthci_evt_min_latency, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4947             offset += 4;
4948             proto_tree_add_item(tree, hf_bthci_evt_max_pdu_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4949             offset += 4;
4950             proto_tree_add_item(tree, hf_bthci_evt_amp_controller_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4951             offset += 1;
4952             proto_tree_add_item(tree, hf_bthci_evt_pal_capabilities_00, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4953             offset += 2;
4954             proto_tree_add_item(tree, hf_bthci_evt_max_amp_assoc_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4955             offset += 2;
4956             proto_tree_add_item(tree, hf_bthci_evt_max_flush_to_us, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4957             offset += 4;
4958             proto_tree_add_item(tree, hf_bthci_evt_best_effort_flush_to_us, tvb, offset, 4, ENC_LITTLE_ENDIAN);
4959             offset += 4;
4960             break;
4961 
4962         case 0x140a: /* Read Local AMP Assoc */
4963             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4964             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4965             offset += 1;
4966             proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4967             offset += 1;
4968             proto_tree_add_item(tree, hf_bthci_evt_amp_remaining_assoc_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
4969             offset += 2;
4970             proto_tree_add_item(tree, hf_bthci_evt_amp_assoc_fragment, tvb, offset, -1, ENC_NA);
4971             offset += tvb_reported_length_remaining(tvb, offset);
4972             break;
4973 
4974         case 0x140b: /* Write Remote AMP Assoc */
4975             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4976             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
4977             offset += 1;
4978             proto_tree_add_item(tree, hf_bthci_evt_physical_link_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4979             offset += 1;
4980             break;
4981 
4982         case 0x140C: /* Get MWS Transport Layer Configuration */ {
4983             guint8       transports;
4984             guint8       i_transport;
4985             guint16      baud_rates = 0;
4986             guint16      i_baud_rate;
4987             gint32       baud_rate_to;
4988             proto_item  *sub_item;
4989             proto_tree  *sub_tree;
4990             proto_item  *sub2_item;
4991             proto_tree  *sub2_tree;
4992             gint         offset_baud_rates;
4993 
4994             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
4995             status = tvb_get_guint8(tvb, offset);
4996             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
4997             offset += 1;
4998 
4999             proto_tree_add_item(tree, hf_bthci_evt_mws_number_of_transports, tvb, offset, 1, ENC_NA);
5000             transports = tvb_get_guint8(tvb, offset);
5001             offset += 1;
5002 
5003             sub_item = proto_tree_add_item(tree, hf_bthci_evt_mws_transport_layers, tvb, offset, transports * 2, ENC_NA);
5004             sub_tree = proto_item_add_subtree(sub_item, ett_mws_transport_layers);
5005 
5006             offset_baud_rates = offset = 1;
5007 
5008             for (i_transport = 0; i_transport < transports; i_transport += 1) {
5009                 sub2_item = proto_tree_add_item(sub_tree, hf_bthci_evt_mws_transport_layers_item, tvb, offset, transports * 2, ENC_NA);
5010                 sub2_tree = proto_item_add_subtree(sub2_item, ett_mws_transport_layers_item);
5011                 proto_item_append_text(sub2_item, " #%u", i_transport + 1);
5012 
5013                 proto_tree_add_item(sub2_tree, hf_bthci_evt_mws_transport_layer, tvb, offset, 1, ENC_NA);
5014                 offset += 1;
5015 
5016                 proto_tree_add_item(sub2_tree, hf_bthci_evt_mws_number_of_baud_rates, tvb, offset, 1, ENC_NA);
5017                 baud_rates += tvb_get_guint8(tvb, offset);
5018                 offset += 1;
5019             }
5020 
5021             sub_item = proto_tree_add_item(tree, hf_bthci_evt_mws_to_mws_baud_rates, tvb, offset, baud_rates * 4, ENC_NA);
5022             sub_tree = proto_item_add_subtree(sub_item, ett_mws_to_mws_baud_rates);
5023 
5024             baud_rate_to = -1;
5025             i_transport = 1;
5026             sub2_tree = sub_tree;
5027             for (i_baud_rate = 0; i_baud_rate < baud_rates; i_baud_rate += 1) {
5028                 if (baud_rate_to == -1 || baud_rate_to == i_baud_rate) {
5029                     baud_rate_to = tvb_get_guint8(tvb, offset_baud_rates + (i_transport - 1) * 2);
5030                     sub2_item = proto_tree_add_item(sub_tree, hf_bthci_evt_mws_to_mws_baud_rates_tranport_item, tvb, offset, (baud_rate_to -  i_baud_rate) * 4, ENC_NA);
5031                     proto_item_append_text(sub2_item, " #%u", i_transport);
5032                     sub2_tree = proto_item_add_subtree(sub2_item, ett_mws_to_mws_baud_rates_transport_item);
5033                     i_transport += 1;
5034                 }
5035 
5036                 proto_tree_add_item(sub2_tree, hf_bthci_evt_mws_to_mws_baud_rate, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5037                 offset += 4;
5038             }
5039 
5040             sub_item = proto_tree_add_item(tree, hf_bthci_evt_mws_from_mws_baud_rates, tvb, offset, baud_rates * 4, ENC_NA);
5041             sub_tree = proto_item_add_subtree(sub_item, ett_mws_from_mws_baud_rates);
5042 
5043             baud_rate_to = -1;
5044             i_transport = 1;
5045             sub2_tree = sub_tree;
5046             for (i_baud_rate = 0; i_baud_rate < baud_rates; i_baud_rate += 1) {
5047                 if (baud_rate_to == -1 || baud_rate_to == i_baud_rate) {
5048                     baud_rate_to = tvb_get_guint8(tvb, offset_baud_rates + (i_transport - 1) * 2);
5049                     sub2_item = proto_tree_add_item(sub_tree, hf_bthci_evt_mws_from_mws_baud_rates_tranport_item, tvb, offset, (baud_rate_to -  i_baud_rate) * 4, ENC_NA);
5050                     proto_item_append_text(sub2_item, " #%u", i_transport);
5051                     sub2_tree = proto_item_add_subtree(sub2_item, ett_mws_from_mws_baud_rates_transport_item);
5052                     i_transport += 1;
5053                 }
5054 
5055                 proto_tree_add_item(sub2_tree, hf_bthci_evt_mws_from_mws_baud_rate, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5056                 offset += 4;
5057             }
5058             break; }
5059 
5060         case 0x1801: /* Read Loopback Mode */
5061             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5062             status = tvb_get_guint8(tvb, offset);
5063             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
5064             offset += 1;
5065             proto_tree_add_item(tree, hf_bthci_evt_loopback_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5066             offset += 1;
5067             break;
5068 
5069         case 0x2002: /* LE Read Buffer Size [v1] */
5070         case 0x2060: /* LE Read Buffer Size [v2] */
5071             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5072             status = tvb_get_guint8(tvb, offset);
5073             send_hci_summary_status_tap(status, pinfo, bluetooth_data);
5074             offset += 1;
5075 
5076             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
5077                 bluetooth_device_tap_t  *tap_device;
5078 
5079                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
5080                 if (bluetooth_data) {
5081                     tap_device->interface_id  = bluetooth_data->interface_id;
5082                     tap_device->adapter_id    = bluetooth_data->adapter_id;
5083                 } else {
5084                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
5085                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
5086                 }
5087                 tap_device->has_bd_addr = FALSE;
5088                 tap_device->is_local = TRUE;
5089                 tap_device->type = BLUETOOTH_DEVICE_LE_MTU;
5090                 tap_device->data.le_mtus.acl_mtu     = tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN);
5091                 tap_device->data.le_mtus.acl_packets = tvb_get_guint8(tvb,  offset + 2);
5092                 if (opcode == 0x2060) { /* LE Read Buffer Size [v2] */
5093                     tap_device->data.le_mtus.iso_mtu     = tvb_get_guint16(tvb, offset + 3, ENC_LITTLE_ENDIAN);
5094                     tap_device->data.le_mtus.iso_packets = tvb_get_guint8(tvb,  offset + 5);
5095                 }
5096                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
5097             }
5098 
5099             item = proto_tree_add_item(tree, hf_bthci_evt_le_acl_data_pkt_len, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5100             if ( (tvb_get_letohs(tvb, offset) == 0) && (tvb_get_guint8(tvb, offset+2) == 0) )
5101                 proto_item_append_text(item, " (buffers shared between BR/EDR and LE) ");
5102             offset += 2;
5103 
5104             proto_tree_add_item(tree, hf_bthci_evt_total_num_le_acl_data_pkts, tvb, offset, 1, ENC_NA);
5105             offset += 1;
5106 
5107             if (opcode == 0x2060) { /* LE Read Buffer Size [v2] */
5108                 proto_tree_add_item(tree, hf_bthci_evt_iso_data_pkt_len, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5109                 offset += 2;
5110                 proto_tree_add_item(tree, hf_bthci_evt_total_num_iso_data_pkts, tvb, offset, 1, ENC_NA);
5111                 offset += 1;
5112             }
5113 
5114             break;
5115 
5116         case 0x2003: /* LE Read Local Supported Features */
5117             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5118             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5119             offset += 1;
5120 
5121             proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_evt_le_features, ett_le_features, hfx_bthci_evt_le_features, ENC_LITTLE_ENDIAN);
5122             offset += 8;
5123 
5124             break;
5125         case 0x2007: /* LE Read Advertising Channel Tx Power */
5126         {
5127             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5128             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5129             offset += 1;
5130             proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5131             offset += 1;
5132             break;
5133         }
5134 
5135         case 0x200f: /* LE Read White List Size */
5136         {
5137             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5138             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5139             offset += 1;
5140             proto_tree_add_item(tree, hf_bthci_evt_white_list_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5141             offset += 1;
5142             break;
5143         }
5144 
5145         case 0x2015: /* LE Read Channel Map */
5146         {
5147             proto_tree  *sub_tree;
5148             proto_item  *sub_item;
5149 
5150             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5151             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5152             offset += 1;
5153             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5154             offset += 2;
5155 
5156             sub_item = proto_tree_add_item(tree, hf_bthci_evt_le_channel_map, tvb, offset, 5, ENC_NA);
5157             sub_tree = proto_item_add_subtree(sub_item, ett_le_channel_map);
5158 
5159             call_dissector(btcommon_le_channel_map_handle, tvb_new_subset_length(tvb, offset, 5), pinfo, sub_tree);
5160             offset += 5;
5161             break;
5162         }
5163 
5164         case 0x2017: /* LE Encrypt */
5165         {
5166             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5167             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5168             offset += 1;
5169             proto_tree_add_item(tree, hf_bthci_evt_encrypted_data, tvb, offset, 16, ENC_NA);
5170             offset += 16;
5171             break;
5172         }
5173 
5174         case 0x2018: /* LE Rand */
5175         {
5176             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5177             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5178             offset += 1;
5179             proto_tree_add_item(tree, hf_bthci_evt_random_number, tvb, offset, 8, ENC_NA);
5180             offset += 8;
5181             break;
5182         }
5183 
5184         case 0x201c: /* LE Read Supported States */
5185         {
5186             proto_item *ti_le_states;
5187             proto_item *ti_le_states_subtree;
5188 
5189             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5190             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5191             offset += 1;
5192 
5193             ti_le_states = proto_tree_add_item(tree, hf_bthci_evt_le_states, tvb, offset, 8, ENC_NA);
5194             ti_le_states_subtree = proto_item_add_subtree(ti_le_states, ett_le_state_subtree);
5195 
5196             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_00, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5197             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_01, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5198             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_02, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5199             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_03, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5200             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_04, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5201             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_05, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5202             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_06, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5203             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_07, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5204             offset += 1;
5205             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_10, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5206             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_11, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5207             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_12, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5208             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_13, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5209             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_14, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5210             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_15, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5211             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_16, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5212             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_17, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5213             offset += 1;
5214             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_20, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5215             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_21, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5216             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_22, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5217             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_23, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5218             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_24, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5219             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_25, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5220             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_26, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5221             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_27, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5222             offset += 1;
5223             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_30, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5224             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_31, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5225             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_32, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5226             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_33, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5227             proto_tree_add_item(ti_le_states_subtree,hf_bthci_evt_le_states_34, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5228             offset += 5;
5229             break;
5230         }
5231 
5232         case 0x201f: /* LE Test End */
5233         {
5234             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5235             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5236             offset += 1;
5237             proto_tree_add_item(tree, hf_bthci_evt_le_num_packets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5238             offset += 2;
5239             break;
5240         }
5241 
5242         case 0x2030: /* LE Read PHY */
5243         {
5244             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5245             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5246             offset += 1;
5247             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5248             offset += 2;
5249             proto_tree_add_item(tree, hf_bthci_evt_le_tx_phy, tvb, offset, 1, ENC_NA);
5250             offset += 1;
5251             proto_tree_add_item(tree, hf_bthci_evt_le_rx_phy, tvb, offset, 1, ENC_NA);
5252             offset += 1;
5253             break;
5254         }
5255 
5256         case 0x2036: /* LE Set Extended Advertising Parameters */
5257         {
5258             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5259             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5260             offset += 1;
5261             proto_tree_add_item(tree, hf_bthci_evt_selected_tx_power, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5262             offset += 1;
5263             break;
5264         }
5265 
5266         case 0x203A: /* LE Read Maximum Advertising Data Length */
5267         {
5268             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5269             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5270             offset += 1;
5271             proto_tree_add_item(tree, hf_bthci_evt_max_adv_data_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5272             offset += 2;
5273             break;
5274         }
5275 
5276         case 0x203B: /* LE Read Number of Supported Advertising Sets */
5277         {
5278             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5279             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5280             offset += 1;
5281             proto_tree_add_item(tree, hf_bthci_evt_num_supported_adv_sets, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5282             offset += 1;
5283             break;
5284         }
5285 
5286         case 0x2053: /* LE Set Connectionless IQ Sampling Enable */
5287         {
5288             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5289             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5290             offset += 1;
5291             proto_tree_add_item(tree, hf_bthci_evt_sync_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5292             offset += 2;
5293             break;
5294         }
5295 
5296         case 0x0441: /* Set Connectionless Slave Broadcast */
5297             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5298             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5299             offset += 1;
5300 
5301             proto_tree_add_item(tree, hf_bthci_evt_lt_addr, tvb, offset, 1, ENC_NA);
5302             offset += 1;
5303 
5304             proto_tree_add_item(tree, hf_bthci_evt_connectionless_slave_broadcast_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5305             offset += 2;
5306 
5307             break;
5308         case 0x0442: /* Set Connectionless Slave Broadcast Receive */
5309             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5310             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5311             offset += 1;
5312 
5313             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
5314 
5315             proto_tree_add_item(tree, hf_bthci_evt_lt_addr, tvb, offset, 1, ENC_NA);
5316             offset += 1;
5317 
5318             break;
5319         case 0x0C70: /* Set MWS Signaling */
5320             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_rx_priority_assert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5321             offset += 2;
5322 
5323             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_rx_priority_assert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5324             offset += 2;
5325 
5326             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_rx_priority_deassert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5327             offset += 2;
5328 
5329             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_rx_priority_deassert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5330             offset += 2;
5331 
5332 
5333             proto_tree_add_item(tree, hf_bthci_evt_mws_802_rx_priority_assert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5334             offset += 2;
5335 
5336             proto_tree_add_item(tree, hf_bthci_evt_mws_802_rx_priority_assert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5337             offset += 2;
5338 
5339             proto_tree_add_item(tree, hf_bthci_evt_mws_802_rx_priority_deassert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5340             offset += 2;
5341 
5342             proto_tree_add_item(tree, hf_bthci_evt_mws_802_rx_priority_deassert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5343             offset += 2;
5344 
5345 
5346             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_tx_priority_assert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5347             offset += 2;
5348 
5349             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_tx_priority_assert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5350             offset += 2;
5351 
5352             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_tx_priority_deassert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5353             offset += 2;
5354 
5355             proto_tree_add_item(tree, hf_bthci_evt_mws_bt_tx_priority_deassert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5356             offset += 2;
5357 
5358 
5359             proto_tree_add_item(tree, hf_bthci_evt_mws_802_tx_priority_assert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5360             offset += 2;
5361 
5362             proto_tree_add_item(tree, hf_bthci_evt_mws_802_tx_priority_assert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5363             offset += 2;
5364 
5365             proto_tree_add_item(tree, hf_bthci_evt_mws_802_tx_priority_deassert_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5366             offset += 2;
5367 
5368             proto_tree_add_item(tree, hf_bthci_evt_mws_802_tx_priority_deassert_jitter, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5369             offset += 2;
5370 
5371             break;
5372         case 0x0C77: /* Read Synchronization Train Parameters */
5373             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5374             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5375             offset += 1;
5376 
5377             proto_tree_add_item(tree, hf_bthci_evt_sync_train_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5378             offset += 2;
5379 
5380             proto_tree_add_item(tree, hf_bthci_evt_sync_train_to, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5381             offset += 4;
5382 
5383             proto_tree_add_item(tree, hf_bthci_evt_service_data, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5384             offset += 1;
5385 
5386             break;
5387         case 0x0C78: /* Write Synchronization Train Parameters */
5388             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5389             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5390             offset += 1;
5391 
5392             proto_tree_add_item(tree, hf_bthci_evt_sync_train_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5393             offset += 2;
5394 
5395             break;
5396         case 0x0C79: /* Read Secure Connections Host Support */
5397             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5398             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5399             offset += 1;
5400 
5401             proto_tree_add_item(tree, hf_bthci_evt_secure_connection_host_support, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5402             offset += 1;
5403 
5404             break;
5405         case 0x0C7B: /* Read Authenticated Payload Timeout */
5406             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5407             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5408             offset += 1;
5409 
5410             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5411             offset += 2;
5412 
5413             item = proto_tree_add_item(tree, hf_bthci_evt_authenticated_payload_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5414             proto_item_append_text(item, " (%g sec)", tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) * 0.01);
5415             offset += 2;
5416 
5417             break;
5418         case 0x0C7D: /* Read Local OOB Extended Data */
5419             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5420             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5421             offset += 1;
5422 
5423             proto_tree_add_item(tree, hf_bthci_evt_c192, tvb, offset, 16, ENC_NA);
5424             offset += 16;
5425 
5426             proto_tree_add_item(tree, hf_bthci_evt_r192, tvb, offset, 16, ENC_NA);
5427             offset += 16;
5428 
5429             proto_tree_add_item(tree, hf_bthci_evt_c256, tvb, offset, 16, ENC_NA);
5430             offset += 16;
5431 
5432             proto_tree_add_item(tree, hf_bthci_evt_r256, tvb, offset, 16, ENC_NA);
5433             offset += 16;
5434 
5435             break;
5436         case 0x0C7E: /* Read Extended Page Timeout */
5437             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5438             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5439             offset += 1;
5440 
5441             item = proto_tree_add_item(tree, hf_bthci_evt_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5442             proto_item_append_text(item, " slots (%g msec)", tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) * 0.625);
5443 
5444             break;
5445         case 0x0C80: /* Read Extended Inquiry Length */
5446             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5447             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5448             offset += 1;
5449 
5450             item = proto_tree_add_item(tree, hf_bthci_evt_extended_inquiry_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5451             proto_item_append_text(item, " slots (%g msec)", tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN) * 0.625);
5452 
5453             break;
5454         case 0x2023: /* LE Read Suggested Default Data Length */
5455             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5456             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5457             offset += 1;
5458 
5459             proto_tree_add_item(tree, hf_bthci_evt_suggested_max_tx_octets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5460             offset += 2;
5461 
5462             proto_tree_add_item(tree, hf_bthci_evt_suggested_max_tx_time, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5463             offset += 2;
5464 
5465             break;
5466         case 0x202A: /* LE Read Resolving List Size */
5467             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5468             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5469             offset += 1;
5470 
5471             proto_tree_add_item(tree, hf_bthci_evt_resolving_list_size, tvb, offset, 1, ENC_NA);
5472             offset += 1;
5473 
5474             break;
5475         case 0x202F: /* LE Read Maximum Data Length */
5476             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5477             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5478             offset += 1;
5479 
5480             proto_tree_add_item(tree, hf_bthci_evt_suggested_max_tx_octets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5481             offset += 2;
5482 
5483             proto_tree_add_item(tree, hf_bthci_evt_suggested_max_tx_time, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5484             offset += 2;
5485 
5486             proto_tree_add_item(tree, hf_bthci_evt_suggested_max_rx_octets, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5487             offset += 2;
5488 
5489             proto_tree_add_item(tree, hf_bthci_evt_suggested_max_rx_time, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5490             offset += 2;
5491 
5492             break;
5493 
5494         case 0x204A: /* LE Read Periodic Advertiser List Size */
5495             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5496             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5497             offset += 1;
5498 
5499             proto_tree_add_item(tree, hf_bthci_evt_periodic_adv_list_size, tvb, offset, 1, ENC_NA);
5500             offset += 1;
5501 
5502             break;
5503         case 0x204B: /* LE Read Transmit Power */
5504             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5505             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5506             offset += 1;
5507 
5508             proto_tree_add_item(tree, hf_bthci_evt_min_tx_power, tvb, offset, 1, ENC_NA);
5509             offset += 1;
5510 
5511             proto_tree_add_item(tree, hf_bthci_evt_max_tx_power, tvb, offset, 1, ENC_NA);
5512             offset += 1;
5513 
5514             break;
5515         case 0x204C: /* LE Read RF Path Compensation */
5516             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5517             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5518             offset += 1;
5519 
5520             item = proto_tree_add_item(tree, hf_bthci_evt_rf_tx_path_compensation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5521             proto_item_append_text(item, " (%g dB)", tvb_get_letohis(tvb, offset)*0.1);
5522             offset += 2;
5523 
5524             item = proto_tree_add_item(tree, hf_bthci_evt_rf_rx_path_compensation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5525             proto_item_append_text(item, " (%g dB)", tvb_get_letohis(tvb, offset)*0.1);
5526             offset += 2;
5527 
5528             break;
5529         case 0x2058: /* LE Read Antenna Information */
5530             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5531             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5532             offset += 1;
5533             proto_tree_add_bitmask(tree, tvb, offset, hf_bthci_evt_supported_switching_sample_rates,
5534                                    ett_supported_switching_sample_rates, hfx_bthci_evt_supported_switching_sample_rates, ENC_NA);
5535             offset += 1;
5536             proto_tree_add_item(tree, hf_bthci_evt_number_antennae, tvb, offset, 1, ENC_NA);
5537             offset += 1;
5538             proto_tree_add_item(tree, hf_bthci_evt_max_length_antenna_switching_pattern, tvb, offset, 1, ENC_NA);
5539             offset += 1;
5540             proto_tree_add_item(tree, hf_bthci_evt_max_cte_length, tvb, offset, 1, ENC_NA);
5541             offset += 1;
5542             break;
5543 
5544         case 0x2061: /* LE Read ISO Tx Sync */
5545             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5546             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5547             offset += 1;
5548             proto_tree_add_item(tree, hf_bthci_evt_cis_bis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5549             offset += 2;
5550             proto_tree_add_item(tree, hf_bthci_evt_sdu_packet_seq_num, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5551             offset += 2;
5552             proto_tree_add_item(tree, hf_bthci_evt_sdu_packet_timestamp, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5553             offset += 4;
5554             proto_tree_add_item(tree, hf_bthci_evt_sdu_packet_offset, tvb, offset, 3, ENC_LITTLE_ENDIAN);
5555             offset += 3;
5556             break;
5557 
5558         case 0x2062: /* LE Set CIG Parameters */
5559         case 0x2063: /* LE Set CIG Parameters Test */
5560             {
5561             guint8 cis_count;
5562             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5563             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5564             offset += 1;
5565             proto_tree_add_item(tree, hf_bthci_evt_cig_id, tvb, offset, 1, ENC_NA);
5566             offset += 1;
5567             proto_tree_add_item(tree, hf_bthci_evt_cis_count, tvb, offset, 1, ENC_NA);
5568             cis_count = tvb_get_guint8(tvb, offset);
5569             offset += 1;
5570             for (i = 0; i < cis_count; i++) {
5571                 proto_tree_add_item(tree, hf_bthci_evt_cis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5572                 offset += 2;
5573             }
5574             }
5575             break;
5576 
5577         case 0x2065: /* LE Remove CIG */
5578             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5579             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5580             offset += 1;
5581             proto_tree_add_item(tree, hf_bthci_evt_cig_id, tvb, offset, 1, ENC_NA);
5582             offset += 1;
5583             break;
5584 
5585         case 0x2067: /* LE Reject CIS Request */
5586             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5587             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5588             offset += 1;
5589             proto_tree_add_item(tree, hf_bthci_evt_cis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5590             offset += 2;
5591             break;
5592 
5593         case 0x206C: /* LE BIG Terminate Sync */
5594             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5595             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5596             offset += 1;
5597             proto_tree_add_item(tree, hf_bthci_evt_big_handle, tvb, offset, 1, ENC_NA);
5598             offset += 1;
5599             break;
5600 
5601         case 0x206E: /* LE Setup ISO Data Path */
5602         case 0x206F: /* LE Remove ISO Data Path */
5603         case 0x2070: /* LE ISO Transmit Test */
5604         case 0x2071: /* LE ISO Receive Test */
5605             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5606             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5607             offset += 1;
5608             proto_tree_add_item(tree, hf_bthci_evt_cis_bis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5609             offset += 2;
5610             break;
5611 
5612         case 0x2072: /* LE ISO Read Test Counters */
5613         case 0x2073: /* LE ISO Test End */
5614             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5615             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5616             offset += 1;
5617             proto_tree_add_item(tree, hf_bthci_evt_cis_bis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5618             offset += 2;
5619             proto_tree_add_item(tree, hf_bthci_evt_received_packet_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5620             offset += 4;
5621             proto_tree_add_item(tree, hf_bthci_evt_missed_packet_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5622             offset += 4;
5623             proto_tree_add_item(tree, hf_bthci_evt_failed_packet_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5624             offset += 4;
5625             break;
5626 
5627         case 0x2075: /* LE Read ISO Link Quality */
5628             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5629             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5630             offset += 1;
5631             proto_tree_add_item(tree, hf_bthci_evt_cis_bis_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5632             offset += 2;
5633             proto_tree_add_item(tree, hf_bthci_evt_pkt_count_tx_unacked, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5634             offset += 4;
5635             proto_tree_add_item(tree, hf_bthci_evt_pkt_count_tx_flushed, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5636             offset += 4;
5637             proto_tree_add_item(tree, hf_bthci_evt_pkt_count_tx_last_subevent, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5638             offset += 4;
5639             proto_tree_add_item(tree, hf_bthci_evt_pkt_count_tx_retransmitted, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5640             offset += 4;
5641             proto_tree_add_item(tree, hf_bthci_evt_pkt_count_rx_crc_error, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5642             offset += 4;
5643             proto_tree_add_item(tree, hf_bthci_evt_pkt_count_rx_unreceived, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5644             offset += 4;
5645             proto_tree_add_item(tree, hf_bthci_evt_pkt_count_rx_duplicate, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5646             offset += 4;
5647             break;
5648 
5649         case 0x2076: /* LE Enhanced Read Transmit Power Level */
5650             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_NA);
5651             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5652             offset += 1;
5653             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5654             offset += 2;
5655             proto_tree_add_item(tree, hf_bthci_evt_phy_and_coding, tvb, offset, 1, ENC_NA);
5656             offset += 1;
5657             proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level, tvb, offset, 1, ENC_NA);
5658             offset += 1;
5659             proto_tree_add_item(tree, hf_bthci_evt_max_transmit_power_level, tvb, offset, 1, ENC_NA);
5660             offset += 1;
5661             break;
5662 
5663         case 0x0401: /* Inquiry */
5664         case 0x0405: /* Create Connection */
5665         case 0x0406: /* Disconnect */
5666         case 0x0407: /* Add SCO Connection */
5667         case 0x0409: /* Accept Connection Request */
5668         case 0x040A: /* Reject Connection Request */
5669         case 0x040F: /* Change Connection Packet Type */
5670         case 0x0411: /* Authentication Requested */
5671         case 0x0413: /* Set Connection Encryption */
5672         case 0x0415: /* Change Connection Link Key */
5673         case 0x0417: /* Master Link Key */
5674         case 0x0419: /* Remote Name Request */
5675         case 0x041B: /* Read Remote Supported Features */
5676         case 0x041C: /* Read Remote Extended Features */
5677         case 0x041D: /* Read Remote Version Information */
5678         case 0x041F: /* Read Clock Offset */
5679         case 0x0428: /* Setup Synchronous Connection */
5680         case 0x0429: /* Accept Synchronous Connection Request */
5681         case 0x042A: /* Reject Synchronous Connection Request */
5682         case 0x0435: /* Create Physical Link */
5683         case 0x0436: /* Accept Physical Link */
5684         case 0x0437: /* Disconnect Physical Link */
5685         case 0x0438: /* Create Logical Link */
5686         case 0x0439: /* Accept Logical Link */
5687         case 0x043A: /* Disconnect Logical Link */
5688         case 0x043C: /* Flow Spec Modify */
5689         case 0x043D: /* Enhanced Setup Synchronous Connection */
5690         case 0x043E: /* Enhanced Accept Synchronous Connection Request */
5691         case 0x043F: /* Truncated Page */
5692         case 0x0443: /* Start Synchronization Train */
5693         case 0x0444: /* Receive Synchronization Train */
5694         case 0x0801: /* Hold Mode */
5695         case 0x0803: /* Sniff Mode */
5696         case 0x0804: /* Exit Sniff Mode */
5697         case 0x0805: /* Park State */
5698         case 0x0806: /* Exit Park State */
5699         case 0x0807: /* QoS Setup*/
5700         case 0x080B: /* Switch Role*/
5701         case 0x0810: /* Flow Specification */
5702         case 0x0C53: /* Refresh Encryption Key */
5703         case 0x0C5F: /* Enhanced Flush */
5704         case 0x0C6B: /* Short Range Mode */
5705         case 0x200D: /* LE Create Connection */
5706         case 0x2013: /* LE Connection Update */
5707         case 0x2016: /* LE Read Remote Features */
5708         case 0x2019: /* LE Start Encryption */
5709         case 0x2025: /* LE Read Local P-256 Public Key */
5710         case 0x2026: /* LE Generate DHKey [v1] */
5711         case 0x205E: /* LE Generate DHKey [v2] */
5712         case 0x2064: /* LE Create CIS */
5713         case 0x2066: /* LE Accept CIS Request */
5714         case 0x2068: /* LE Create BIG */
5715         case 0x2069: /* LE Create BIG Test */
5716         case 0x206A: /* LE Terminate BIG */
5717         case 0x206B: /* LE BIG Create Sync */
5718         case 0x206D: /* LE Request Peer SCA */
5719         case 0x2077: /* LE Read Remote Transmit Power Level */
5720         case 0x207E: /* LE Subrate Request */
5721             proto_tree_add_expert(tree, pinfo, &ei_event_unexpected_event, tvb, offset, tvb_captured_length_remaining(tvb, offset));
5722             offset += tvb_reported_length_remaining(tvb, offset);
5723 
5724             break;
5725 
5726         case 0x0C35: /* Host Number Of Completed Packets */
5727             if (tvb_captured_length_remaining(tvb, offset) > 0) {
5728                 proto_tree_add_expert(tree, pinfo, &ei_event_unexpected_parameter, tvb, offset, tvb_captured_length_remaining(tvb, offset));
5729                 offset += tvb_reported_length_remaining(tvb, offset);
5730             }
5731 
5732             break;
5733 
5734         default:
5735             proto_tree_add_expert(tree, pinfo, &ei_event_unknown_command, tvb, offset, tvb_captured_length_remaining(tvb, offset));
5736             offset += tvb_reported_length_remaining(tvb, offset);
5737 
5738             break;
5739     }
5740 
5741     add_opcode(opcode_list, opcode, COMMAND_STATUS_NORMAL);
5742 
5743     return offset;
5744 }
5745 
5746 static int
dissect_bthci_evt_qos_setup_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5747 dissect_bthci_evt_qos_setup_complete(tvbuff_t *tvb, int offset,
5748         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
5749 {
5750     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5751     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5752     offset += 1;
5753 
5754     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5755     offset += 2;
5756 
5757     proto_tree_add_item(tree, hf_bthci_evt_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5758     offset += 1;
5759 
5760     proto_tree_add_item(tree, hf_bthci_evt_service_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5761     offset += 1;
5762 
5763     proto_tree_add_item(tree, hf_bthci_evt_token_rate, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5764     offset += 4;
5765 
5766     proto_tree_add_item(tree, hf_bthci_evt_peak_bandwidth, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5767     offset += 4;
5768 
5769     proto_tree_add_item(tree, hf_bthci_evt_latency, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5770     offset += 4;
5771 
5772 
5773     proto_tree_add_item(tree, hf_bthci_evt_delay_variation, tvb, offset, 4, ENC_LITTLE_ENDIAN);
5774     offset += 4;
5775 
5776     return offset;
5777 }
5778 
5779 static int
dissect_bthci_evt_change_conn_link_key_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5780 dissect_bthci_evt_change_conn_link_key_complete(tvbuff_t *tvb, int offset,
5781         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
5782 {
5783     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5784     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5785     offset += 1;
5786 
5787     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5788     offset += 2;
5789 
5790     return offset;
5791 }
5792 
5793 static int
dissect_bthci_evt_master_link_key_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5794 dissect_bthci_evt_master_link_key_complete(tvbuff_t *tvb, int offset,
5795         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
5796 {
5797     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5798     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5799     offset += 1;
5800 
5801     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5802     offset += 2;
5803 
5804     proto_tree_add_item(tree, hf_bthci_evt_key_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5805     offset += 1;
5806 
5807     return offset;
5808 }
5809 
5810 static int
dissect_bthci_evt_encryption_change(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5811 dissect_bthci_evt_encryption_change(tvbuff_t *tvb, int offset,
5812         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
5813 {
5814     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5815     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5816     offset += 1;
5817 
5818     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5819     offset += 2;
5820 
5821     proto_tree_add_item(tree, hf_bthci_evt_encryption_enable, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5822     offset += 1;
5823 
5824     return offset;
5825 }
5826 
5827 static int
dissect_bthci_evt_read_remote_ext_features_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5828 dissect_bthci_evt_read_remote_ext_features_complete(tvbuff_t *tvb, int offset,
5829         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
5830 {
5831     guint8 page_number;
5832 
5833     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5834     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5835     offset += 1;
5836 
5837     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5838     offset += 2;
5839 
5840     page_number = tvb_get_guint8(tvb, offset);
5841     proto_tree_add_item(tree, hf_bthci_evt_page_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5842     offset += 1;
5843 
5844     proto_tree_add_item(tree, hf_bthci_evt_max_page_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5845     offset += 1;
5846 
5847     offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, page_number);
5848 
5849     return offset;
5850 }
5851 
5852 static int
dissect_bthci_evt_sync_connection_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5853 dissect_bthci_evt_sync_connection_complete(tvbuff_t *tvb, int offset,
5854         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
5855 {
5856     proto_item *item;
5857     guint32     connection_handle;
5858     guint8      bd_addr[6];
5859     guint8      status;
5860     wmem_tree_key_t     key[5];
5861     guint32             interface_id;
5862     guint32             adapter_id;
5863     guint32             frame_number;
5864     wmem_tree_t        *subtree;
5865 
5866     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5867     status = tvb_get_guint8(tvb, offset);
5868     send_hci_summary_status_tap(status, pinfo, bluetooth_data);
5869     offset += 1;
5870 
5871     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5872     connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
5873     offset += 2;
5874 
5875     offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
5876 
5877     proto_tree_add_item(tree, hf_bthci_evt_sync_link_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5878     offset += 1;
5879 
5880     item = proto_tree_add_item(tree, hf_bthci_evt_sync_tx_interval, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5881     proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
5882     offset += 1;
5883 
5884     item = proto_tree_add_item(tree, hf_bthci_evt_sync_rtx_window, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5885     proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
5886     offset += 1;
5887 
5888     proto_tree_add_item(tree, hf_bthci_evt_sync_rx_packet_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5889     offset += 2;
5890 
5891     proto_tree_add_item(tree, hf_bthci_evt_sync_tx_packet_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5892     offset += 2;
5893 
5894     proto_tree_add_item(tree, hf_bthci_evt_air_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5895     offset += 1;
5896 
5897     interface_id = bluetooth_data->interface_id;
5898     adapter_id = bluetooth_data->adapter_id;
5899     frame_number = pinfo->num;
5900 
5901     if (!pinfo->fd->visited && status == STATUS_SUCCESS) {
5902         remote_bdaddr_t            *remote_bdaddr;
5903         chandle_session_t          *chandle_session;
5904         bthci_sco_stream_number_t  *sco_stream_number;
5905         guint32                     stream_number;
5906 
5907         /* chandle to bdaddr */
5908         key[0].length = 1;
5909         key[0].key    = &interface_id;
5910         key[1].length = 1;
5911         key[1].key    = &adapter_id;
5912         key[2].length = 1;
5913         key[2].key    = &connection_handle;
5914         key[3].length = 1;
5915         key[3].key    = &frame_number;
5916         key[4].length = 0;
5917         key[4].key    = NULL;
5918 
5919         remote_bdaddr = (remote_bdaddr_t *) wmem_new(wmem_file_scope(), remote_bdaddr_t);
5920         remote_bdaddr->interface_id = bluetooth_data->interface_id;
5921         remote_bdaddr->adapter_id = bluetooth_data->adapter_id;
5922         remote_bdaddr->chandle = connection_handle;
5923         memcpy(remote_bdaddr->bd_addr, bd_addr, 6);
5924 
5925         wmem_tree_insert32_array(bluetooth_data->chandle_to_bdaddr, key, remote_bdaddr);
5926 
5927         /* chandle session */
5928         chandle_session = (chandle_session_t *) wmem_new(wmem_file_scope(), chandle_session_t);
5929         chandle_session->connect_in_frame = frame_number;
5930         chandle_session->disconnect_in_frame = max_disconnect_in_frame;
5931         chandle_session->link_type = BT_LINK_TYPE_SCO;
5932         wmem_tree_insert32_array(bluetooth_data->chandle_sessions, key, chandle_session);
5933 
5934         /* stream number */
5935         key[2].length = 0;
5936         key[2].key    = NULL;
5937 
5938         subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bthci_sco_stream_numbers, key);
5939         sco_stream_number = (subtree) ? (bthci_sco_stream_number_t *) wmem_tree_lookup32_le(subtree, pinfo->num) : NULL;
5940         if (!sco_stream_number) {
5941             stream_number = 1;
5942         } else {
5943             stream_number = sco_stream_number->stream_number + 1;
5944         }
5945 
5946         key[2].length = 1;
5947         key[2].key    = &frame_number;
5948         key[3].length = 0;
5949         key[3].key    = NULL;
5950 
5951         sco_stream_number = (bthci_sco_stream_number_t *) wmem_new(wmem_file_scope(), bthci_sco_stream_number_t);
5952         sco_stream_number->stream_number = stream_number;
5953         wmem_tree_insert32_array(bthci_sco_stream_numbers, key, sco_stream_number);
5954     }
5955 
5956     return offset;
5957 }
5958 
5959 static int
dissect_bthci_evt_sync_connection_changed(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5960 dissect_bthci_evt_sync_connection_changed(tvbuff_t *tvb, int offset,
5961         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
5962 {
5963     proto_item *item;
5964 
5965     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5966     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5967     offset += 1;
5968 
5969     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5970     offset += 2;
5971 
5972     item = proto_tree_add_item(tree, hf_bthci_evt_sync_tx_interval, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5973     proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
5974     offset += 1;
5975 
5976     item = proto_tree_add_item(tree, hf_bthci_evt_sync_rtx_window, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5977     proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
5978     offset += 1;
5979 
5980     proto_tree_add_item(tree, hf_bthci_evt_sync_rx_packet_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5981     offset += 2;
5982 
5983     proto_tree_add_item(tree, hf_bthci_evt_sync_tx_packet_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
5984     offset += 2;
5985 
5986     return offset;
5987 }
5988 
5989 static int
dissect_bthci_evt_sniff_subrating(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)5990 dissect_bthci_evt_sniff_subrating(tvbuff_t *tvb, int offset, packet_info *pinfo,
5991         proto_tree *tree, bluetooth_data_t *bluetooth_data)
5992 {
5993     proto_item *item;
5994 
5995     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5996     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
5997     offset += 1;
5998 
5999     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6000     offset += 2;
6001 
6002     item = proto_tree_add_item(tree, hf_bthci_evt_max_tx_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6003     proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
6004     offset += 2;
6005 
6006     item = proto_tree_add_item(tree, hf_bthci_evt_max_rx_latency, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6007     proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
6008     offset += 2;
6009 
6010     item = proto_tree_add_item(tree, hf_bthci_evt_min_remote_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6011     proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
6012     offset += 2;
6013 
6014     item = proto_tree_add_item(tree, hf_bthci_evt_min_local_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6015     proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
6016     offset += 2;
6017 
6018     return offset;
6019 }
6020 
6021 static int
dissect_bthci_evt_flow_specification_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)6022 dissect_bthci_evt_flow_specification_complete(tvbuff_t *tvb, int offset,
6023         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
6024 {
6025     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6026     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
6027     offset += 1;
6028 
6029     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6030     offset += 2;
6031 
6032     proto_tree_add_item(tree, hf_bthci_evt_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6033     offset += 1;
6034 
6035     proto_tree_add_item(tree, hf_bthci_evt_flow_direction, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6036     offset += 1;
6037 
6038     proto_tree_add_item(tree, hf_bthci_evt_service_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6039     offset += 1;
6040 
6041     proto_tree_add_item(tree, hf_bthci_evt_token_rate, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6042     offset += 4;
6043 
6044     proto_tree_add_item(tree, hf_bthci_evt_token_bucket_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6045     offset += 4;
6046 
6047     proto_tree_add_item(tree, hf_bthci_evt_peak_bandwidth, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6048     offset += 4;
6049 
6050     proto_tree_add_item(tree, hf_bthci_evt_latency, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6051     offset += 4;
6052 
6053     return offset;
6054 }
6055 
6056 static int
dissect_bthci_evt_enhanced_flush_complete(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)6057 dissect_bthci_evt_enhanced_flush_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
6058 {
6059     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6060     offset += 2;
6061 
6062     return offset;
6063 }
6064 
6065 static int
dissect_bthci_evt_encryption_key_refresh_complete(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)6066 dissect_bthci_evt_encryption_key_refresh_complete(tvbuff_t *tvb, int offset,
6067         packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
6068 {
6069     proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6070     send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
6071     offset += 1;
6072 
6073     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6074     offset += 2;
6075 
6076     return offset;
6077 }
6078 
6079 static int
dissect_bthci_evt_link_supervision_timeout_changed(tvbuff_t * tvb,int offset,packet_info * pinfo _U_,proto_tree * tree)6080 dissect_bthci_evt_link_supervision_timeout_changed(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
6081 {
6082     proto_item *item;
6083 
6084     proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6085     offset += 2;
6086 
6087     item = proto_tree_add_item(tree, hf_bthci_evt_link_supervision_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6088     proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
6089     offset += 2;
6090 
6091     return offset;
6092 }
6093 
6094 static int
dissect_bthci_evt_inquire_result(tvbuff_t * tvb,int offset,packet_info * pinfo,proto_tree * tree,bluetooth_data_t * bluetooth_data)6095 dissect_bthci_evt_inquire_result(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
6096 {
6097     guint8 num, evt_num_responses;
6098 
6099     evt_num_responses = tvb_get_guint8(tvb, offset);
6100     proto_tree_add_item(tree, hf_bthci_evt_num_responses, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6101     offset += 1;
6102 
6103     for (num = 0; num < evt_num_responses; num++) {
6104         offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
6105 
6106         proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6107         offset += 1;
6108 
6109         proto_tree_add_item(tree, hf_bthci_evt_page_scan_period_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6110         offset += 1;
6111 
6112         proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6113         offset += 1;
6114 
6115         call_dissector(btcommon_cod_handle, tvb_new_subset_length(tvb, offset, 3), pinfo, tree);
6116         offset += 3;
6117 
6118         proto_tree_add_item(tree, hf_bthci_evt_clock_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6119         offset += 2;
6120     }
6121 
6122     return offset;
6123 }
6124 
6125 
6126 /* Code to actually dissect the packets */
6127 static gint
dissect_bthci_evt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)6128 dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
6129 {
6130     proto_item          *ti;
6131     proto_tree          *bthci_evt_tree;
6132     guint8               param_length, evt_code;
6133     guint8               bd_addr[6];
6134     gint                 offset = 0;
6135     gint                 previous_offset = 0;
6136     bluetooth_data_t    *bluetooth_data;
6137     wmem_list_t         *opcode_list;
6138     wmem_list_frame_t   *opcode_list_frame;
6139     bthci_cmd_data_t    *lastest_bthci_cmd_data = NULL;
6140     opcode_list_data_t  *opcode_list_data = NULL;
6141     guint32              opcode = G_MAXUINT32;
6142 
6143     /* Reject the packet if data is NULL */
6144     if (data == NULL)
6145         return 0;
6146     bluetooth_data = (bluetooth_data_t *) data;
6147 
6148     opcode_list = wmem_list_new(wmem_packet_scope());
6149 
6150     ti = proto_tree_add_item(tree, proto_bthci_evt, tvb, offset, -1, ENC_NA);
6151     bthci_evt_tree = proto_item_add_subtree(ti, ett_bthci_evt);
6152 
6153     switch (pinfo->p2p_dir) {
6154         case P2P_DIR_SENT:
6155             col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
6156             break;
6157         case P2P_DIR_RECV:
6158             col_set_str(pinfo->cinfo, COL_INFO, "Rcvd ");
6159             break;
6160         default:
6161             col_set_str(pinfo->cinfo, COL_INFO, "UnknownDirection ");
6162             break;
6163     }
6164 
6165     set_address(&pinfo->src, AT_STRINGZ,     11, "controller");
6166     set_address(&pinfo->dst, AT_STRINGZ,      5, "host");
6167     set_address(&pinfo->net_src, AT_STRINGZ, 11, "controller");
6168     set_address(&pinfo->net_dst, AT_STRINGZ,  5, "host");
6169     set_address(&pinfo->dl_src,  AT_STRINGZ, 11, "controller");
6170     set_address(&pinfo->dl_dst,  AT_STRINGZ,  5, "host");
6171     if (!pinfo->fd->visited) {
6172         address *addr;
6173 
6174         addr = (address *) wmem_memdup(wmem_file_scope(), &pinfo->dl_src, sizeof(address));
6175         addr->data =  wmem_memdup(wmem_file_scope(), pinfo->dl_src.data, pinfo->dl_src.len);
6176         p_add_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_SRC, addr);
6177 
6178         addr = (address *) wmem_memdup(wmem_file_scope(), &pinfo->dl_dst, sizeof(address));
6179         addr->data =  wmem_memdup(wmem_file_scope(), pinfo->dl_dst.data, pinfo->dl_dst.len);
6180         p_add_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_DST, addr);
6181     }
6182 
6183     evt_code = tvb_get_guint8(tvb, offset);
6184     proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6185     proto_item_append_text(bthci_evt_tree, " - %s", val_to_str_ext_const(evt_code, &bthci_evt_evt_code_vals_ext, "Unknown 0x%08x"));
6186     offset += 1;
6187 
6188     if (have_tap_listener(bluetooth_hci_summary_tap)) {
6189         bluetooth_hci_summary_tap_t  *tap_hci_summary;
6190 
6191         tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
6192 
6193         tap_hci_summary->interface_id  = bluetooth_data->interface_id;
6194         tap_hci_summary->adapter_id    = bluetooth_data->adapter_id;
6195 
6196         tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT;
6197         tap_hci_summary->event = evt_code;
6198         if (try_val_to_str_ext(evt_code, &bthci_evt_evt_code_vals_ext))
6199             tap_hci_summary->name = val_to_str_ext(evt_code, &bthci_evt_evt_code_vals_ext, "Unknown 0x%04x");
6200         else
6201             tap_hci_summary->name = NULL;
6202         tap_queue_packet(bluetooth_hci_summary_tap, pinfo, tap_hci_summary);
6203     }
6204 
6205     param_length = tvb_get_guint8(tvb, offset);
6206     proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_param_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6207     offset += 1;
6208 
6209 
6210     col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_EVT");
6211 
6212     col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(evt_code, &bthci_evt_evt_code_vals_ext, "Unknown 0x%08x"));
6213 
6214     if (param_length > 0) {
6215         switch(evt_code) {
6216         case 0x01: /* Inquiry Complete */
6217             offset = dissect_bthci_evt_inquire_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6218             add_opcode(opcode_list, 0x0401, COMMAND_STATUS_NORMAL); /* Inquiry */
6219             add_opcode(opcode_list, 0x0403, COMMAND_STATUS_NORMAL); /* Periodic Inquiry Mode */
6220             break;
6221 
6222         case 0x02: /* Inquiry result event  */
6223             offset = dissect_bthci_evt_inquire_result(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6224             break;
6225 
6226         case 0x03: /* Connection Complete */
6227             offset = dissect_bthci_evt_connect_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6228             add_opcode(opcode_list, 0x0405, COMMAND_STATUS_NORMAL); /* Create Connection */
6229             add_opcode(opcode_list, 0x0409, COMMAND_STATUS_NORMAL); /* Accept Connection Request */
6230             add_opcode(opcode_list, 0x040A, COMMAND_STATUS_NORMAL); /* Reject Connection Request */
6231             add_opcode(opcode_list, 0x043E, COMMAND_STATUS_NORMAL); /* Enhanced Accept Synchronous Connection Request */
6232             break;
6233 
6234         case 0x04: /* Connection Request */
6235             offset = dissect_bthci_evt_connect_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6236             break;
6237 
6238         case 0x05: /* Disconnection Complete */
6239             offset = dissect_bthci_evt_disconnect_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6240             add_opcode(opcode_list, 0x0406, COMMAND_STATUS_NORMAL); /* Disconnection Connection */
6241             break;
6242 
6243         case 0x06: /* Authentication Complete */
6244             offset = dissect_bthci_evt_auth_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6245             add_opcode(opcode_list, 0x0411, COMMAND_STATUS_NORMAL); /* Authentication Requested */
6246             break;
6247 
6248         case 0x07: /* Remote Name Request Complete */
6249             offset = dissect_bthci_evt_remote_name_req_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6250             add_opcode(opcode_list, 0x0419, COMMAND_STATUS_NORMAL); /* Remote Name Request */
6251             break;
6252 
6253         case 0x08: /* Encryption Change */
6254             offset = dissect_bthci_evt_encryption_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6255             add_opcode(opcode_list, 0x0413, COMMAND_STATUS_NORMAL); /* Encryption Requested */
6256             add_opcode(opcode_list, 0x2019, COMMAND_STATUS_NORMAL); /* LE Start Encryption */
6257             break;
6258 
6259         case 0x09: /* Change Connection Link Key Complete */
6260             offset = dissect_bthci_evt_change_conn_link_key_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6261             break;
6262 
6263         case 0x0a: /* Master Link Key Complete */
6264             offset = dissect_bthci_evt_master_link_key_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6265             break;
6266 
6267         case 0x0b: /* Read Remote Support Features Complete */
6268             offset = dissect_bthci_evt_read_remote_support_features_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6269             add_opcode(opcode_list, 0x41B, COMMAND_STATUS_NORMAL); /* Read Remote Supported Features */
6270             break;
6271 
6272         case 0x0c: /* Read Remote Version Information Complete */
6273             offset = dissect_bthci_evt_read_remote_version_information_complete(tvb, offset, pinfo, bluetooth_data, bthci_evt_tree);
6274             add_opcode(opcode_list, 0x41D, COMMAND_STATUS_NORMAL); /* Read Remote Version Information */
6275             break;
6276 
6277         case 0x0d: /* QoS Setup Complete */
6278             offset = dissect_bthci_evt_qos_setup_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6279             break;
6280 
6281         case 0x0e: /* Command Complete */
6282             offset = dissect_bthci_evt_command_complete(tvb, offset, pinfo, tree, bthci_evt_tree, opcode_list, bluetooth_data, &opcode);
6283             break;
6284 
6285         case 0x0f: /* Command Status */
6286             offset = dissect_bthci_evt_command_status(tvb, offset, pinfo, tree, bthci_evt_tree, opcode_list, bluetooth_data);
6287             break;
6288 
6289         case 0x10: /* Hardware Error */
6290             offset = dissect_bthci_evt_hardware_error(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6291             break;
6292 
6293         case 0x11: /* Flush Occurred */
6294             offset = dissect_bthci_evt_flush_occurred(tvb, offset, pinfo, bthci_evt_tree);
6295             break;
6296 
6297         case 0x12: /* Role Change */
6298             offset = dissect_bthci_evt_role_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6299             add_opcode(opcode_list, 0x080B, COMMAND_STATUS_NORMAL); /* Switch Role */
6300             break;
6301 
6302         case 0x13: /* Number Of Completed Packets */
6303             offset = dissect_bthci_evt_number_of_completed_packets(tvb, offset, pinfo, bthci_evt_tree);
6304             break;
6305 
6306         case 0x14: /* Mode Change */
6307             offset = dissect_bthci_evt_mode_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6308             add_opcode(opcode_list, 0x0803, COMMAND_STATUS_NORMAL); /* Sniff Mode */
6309             add_opcode(opcode_list, 0x0804, COMMAND_STATUS_NORMAL); /* Exit Sniff Mode */
6310             break;
6311 
6312         case 0x15: /* Return Link Keys */
6313             offset = dissect_bthci_evt_return_link_keys(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6314             break;
6315 
6316         case 0x16: /* PIN Code Request */
6317             offset = dissect_bthci_evt_pin_code_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6318             break;
6319 
6320         case 0x17: /* Link Key Request */
6321             offset = dissect_bthci_evt_link_key_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6322             break;
6323 
6324         case 0x18: /* Link Key Notification */
6325             offset = dissect_bthci_evt_link_key_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6326             break;
6327 
6328         case 0x19: /* Loopback Command */
6329             offset = dissect_bthci_evt_loopback_command(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6330             break;
6331 
6332         case 0x1a: /* Data Buffer Overflow */
6333             offset = dissect_bthci_evt_data_buffer_overflow(tvb, offset, pinfo, bthci_evt_tree);
6334             break;
6335 
6336         case 0x1b: /* Max Slots Change */
6337             offset = dissect_bthci_evt_max_slots_change(tvb, offset, pinfo, bthci_evt_tree);
6338             break;
6339 
6340         case 0x1c: /* Read Clock Offset Complete */
6341             offset = dissect_bthci_evt_read_clock_offset_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6342             add_opcode(opcode_list, 0x041F, COMMAND_STATUS_NORMAL); /* Read Clock Offset */
6343             break;
6344 
6345         case 0x1d: /* Connection Packet Type Changed */
6346             offset = dissect_bthci_evt_conn_packet_type_changed(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6347             add_opcode(opcode_list, 0x040F, COMMAND_STATUS_NORMAL); /* Change Connection Packet Type */
6348             break;
6349 
6350         case 0x1e: /* QoS Violation */
6351             offset = dissect_bthci_evt_qos_violation(tvb, offset, pinfo, bthci_evt_tree);
6352             break;
6353 
6354         case 0x1f: /* Page Scan Mode Change */
6355             offset = dissect_bthci_evt_page_scan_mode_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6356             break;
6357 
6358         case 0x20: /* Page Scan Repetition Mode Change */
6359             offset = dissect_bthci_evt_page_scan_repetition_mode_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6360             break;
6361 
6362         case 0x21: /* Flow Specification Complete */
6363             offset = dissect_bthci_evt_flow_specification_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6364             break;
6365 
6366         case 0x22: /* Inquiry Result with RSSI */
6367             offset = dissect_bthci_evt_inquire_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data, NULL);
6368             break;
6369 
6370         case 0x23: /* Read Remote Extended Features Complete */
6371             offset = dissect_bthci_evt_read_remote_ext_features_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6372             add_opcode(opcode_list, 0x41C, COMMAND_STATUS_NORMAL); /* Read Remote Supported Features */
6373             break;
6374 
6375         case 0x2c: /* Synchronous Connection Complete */
6376             offset = dissect_bthci_evt_sync_connection_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6377             add_opcode(opcode_list, 0x0429, COMMAND_STATUS_NORMAL); /* Accept Synchronous Connection Request */
6378             add_opcode(opcode_list, 0x0428, COMMAND_STATUS_NORMAL); /* Setup Synchronous Connection */
6379             add_opcode(opcode_list, 0x043D, COMMAND_STATUS_NORMAL); /* Enhanced Setup Synchronous Connection */
6380             add_opcode(opcode_list, 0x043E, COMMAND_STATUS_NORMAL); /* Enhanced Accept Synchronous Connection Request */
6381             break;
6382 
6383         case 0x2d: /* Synchronous Connection Changed */
6384             offset = dissect_bthci_evt_sync_connection_changed(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6385             add_opcode(opcode_list, 0x043D, COMMAND_STATUS_NORMAL); /* Enhanced Setup Synchronous Connection */
6386             break;
6387 
6388         case 0x2e: /* Sniff Subrating */
6389             offset = dissect_bthci_evt_sniff_subrating(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6390             break;
6391 
6392         case 0x2f: /* Extended Inquiry Result */
6393             {
6394             bluetooth_eir_ad_data_t *eir_data;
6395 
6396             previous_offset = offset;
6397             offset = dissect_bthci_evt_inquire_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data, bd_addr);
6398 
6399             eir_data = wmem_new0(wmem_packet_scope(), bluetooth_eir_ad_data_t);
6400             eir_data->interface_id = bluetooth_data->interface_id;
6401             eir_data->adapter_id = bluetooth_data->adapter_id;
6402             eir_data->bd_addr = bd_addr;
6403 
6404 
6405             call_dissector_with_data(btcommon_eir_handle, tvb_new_subset_length(tvb, offset, 240), pinfo, bthci_evt_tree, eir_data);
6406             save_remote_device_name(tvb, offset, pinfo, 240, (offset - previous_offset <= 1) ? NULL : bd_addr, bluetooth_data);
6407             offset += 240;
6408             }
6409 
6410             break;
6411 
6412         case 0x30: /* Encryption Key Refresh Complete */
6413             offset = dissect_bthci_evt_encryption_key_refresh_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6414             add_opcode(opcode_list, 0x2019, COMMAND_STATUS_NORMAL); /* LE Start Encryption */
6415             break;
6416 
6417         case 0x31: /* IO Capability Request */
6418             offset = dissect_bthci_evt_io_capability_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6419             break;
6420 
6421         case 0x32: /* IO Capability Response */
6422             offset = dissect_bthci_evt_io_capability_response(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6423             break;
6424 
6425         case 0x33: /* User Confirmation Request */
6426             offset = dissect_bthci_evt_user_confirmation_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6427             break;
6428 
6429         case 0x34: /* User Passkey Request */
6430             offset = dissect_bthci_evt_user_passkey_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6431             break;
6432 
6433         case 0x35: /* Remote OOB Data Request */
6434             offset = dissect_bthci_evt_remote_oob_data_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6435             break;
6436 
6437         case 0x36: /* Simple Pairing Complete */
6438             offset = dissect_bthci_evt_simple_pairing_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6439             break;
6440 
6441         case 0x38: /* Link Supervision Timeout Changed */
6442             offset = dissect_bthci_evt_link_supervision_timeout_changed(tvb, offset, pinfo, bthci_evt_tree);
6443             break;
6444 
6445         case 0x39: /* Enhanced Flush Complete */
6446             offset = dissect_bthci_evt_enhanced_flush_complete(tvb, offset, pinfo, bthci_evt_tree);
6447             break;
6448 
6449         case 0x3b: /* Enhanced Flush Complete */
6450             offset = dissect_bthci_evt_user_passkey_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6451             break;
6452 
6453         case 0x3c: /* Enhanced Flush Complete */
6454             offset = dissect_bthci_evt_keypress_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6455             break;
6456 
6457         case 0x3d: /* Remote Host Supported Features Notification */
6458             offset = dissect_bthci_evt_remote_host_sup_feat_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6459             break;
6460 
6461         case 0x3e: /* LE Meta */
6462             offset = dissect_bthci_evt_le_meta(tvb, offset, pinfo, bthci_evt_tree, opcode_list, bluetooth_data);
6463             break;
6464 
6465         case 0x40: /* Physical Link Complete */
6466             offset = dissect_bthci_evt_physical_link_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6467             break;
6468 
6469         case 0x41: /* Channel Selected */
6470         case 0x44: /* Physical Link Recovery */
6471             offset = dissect_bthci_evt_channel_select_physical_link_recovery(tvb, offset, pinfo, bthci_evt_tree);
6472             break;
6473 
6474         case 0x42: /* Disconnect Physical Link Complete */
6475             offset = dissect_bthci_evt_disconnect_physical_link_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6476             break;
6477 
6478         case 0x43: /* Physical Link Loss Early Warning */
6479             offset = dissect_bthci_evt_physical_link_loss_early_warning(tvb, offset, pinfo, bthci_evt_tree);
6480             break;
6481 
6482         case 0x45: /* Logical Link Complete */
6483             offset = dissect_bthci_evt_logical_link_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6484             break;
6485 
6486         case 0x46: /* Disconnect Logical Link Complete */
6487             offset = dissect_bthci_evt_disconnect_logical_link_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6488             break;
6489 
6490         case 0x47: /* Flow Spec Modify Complete */
6491             offset = dissect_bthci_evt_flow_spec_modify_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6492             break;
6493 
6494         case 0x48: /* Number Of Completed Data Blocks */
6495             offset = dissect_bthci_evt_number_of_completed_data_blocks(tvb, offset, pinfo, bthci_evt_tree);
6496             break;
6497 
6498         case 0x49: /* AMP Start Test */
6499             offset = dissect_bthci_evt_amp_start_stop_test(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6500             add_opcode(opcode_list, 0x1809, COMMAND_STATUS_NORMAL); /* AMP Test */
6501             break;
6502 
6503         case 0x4a: /* AMP Test End */
6504             offset = dissect_bthci_evt_amp_start_stop_test(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6505             add_opcode(opcode_list, 0x1808, COMMAND_STATUS_NORMAL); /* AMP Test End */
6506             break;
6507 
6508         case 0x4b: /* AMP Receiver Test */
6509             offset = dissect_bthci_evt_amp_receiver_test(tvb, offset, pinfo, bthci_evt_tree);
6510             break;
6511 
6512         case 0x4c: /* Short Range Mode Change Complete */
6513             offset = dissect_bthci_evt_short_range_mode_change_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6514             break;
6515 
6516         case 0x4d: /* AMP Status Change */
6517             offset = dissect_bthci_evt_amp_status_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
6518             break;
6519 
6520         case 0x4e: /* Triggered Clock Capture */
6521             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6522             offset += 2;
6523 
6524             proto_tree_add_item(tree, hf_bthci_evt_which_clock, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6525             offset += 1;
6526 
6527             proto_tree_add_item(tree, hf_bthci_evt_clock, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6528             offset += 4;
6529 
6530             proto_tree_add_item(tree, hf_bthci_evt_slot_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6531             offset += 2;
6532 
6533             break;
6534         case 0x4f: /* Synchronization Train Complete */
6535             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6536             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
6537             offset += 1;
6538 
6539             break;
6540         case 0x50: /* Synchronization Train Received */
6541             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6542             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
6543             offset += 1;
6544 
6545             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
6546 
6547             proto_tree_add_item(tree, hf_bthci_evt_clock_offset_32, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6548             offset += 4;
6549 
6550             proto_tree_add_item(tree, hf_bthci_evt_afh_channel_map, tvb, offset, 10, ENC_NA);
6551             offset += 10;
6552 
6553             proto_tree_add_item(tree, hf_bthci_evt_lt_addr, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6554             offset += 1;
6555 
6556             proto_tree_add_item(tree, hf_bthci_evt_next_broadcast_instant, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6557             offset += 4;
6558 
6559             proto_tree_add_item(tree, hf_bthci_evt_connectionless_slave_broadcast_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6560             offset += 2;
6561 
6562             proto_tree_add_item(tree, hf_bthci_evt_service_data, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6563             offset += 1;
6564 
6565             break;
6566         case 0x51: /* Connectionless Slave Broadcast Receive */
6567             {
6568             guint8 length;
6569 
6570             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
6571 
6572             proto_tree_add_item(tree, hf_bthci_evt_lt_addr, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6573             offset += 1;
6574 
6575             proto_tree_add_item(tree, hf_bthci_evt_clock, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6576             offset += 4;
6577 
6578             proto_tree_add_item(tree, hf_bthci_evt_clock_offset_32, tvb, offset, 4, ENC_LITTLE_ENDIAN);
6579             offset += 4;
6580 
6581             proto_tree_add_item(tree, hf_bthci_evt_receive_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6582             offset += 1;
6583 
6584             proto_tree_add_item(tree, hf_bthci_evt_fragment, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6585             offset += 1;
6586 
6587             proto_tree_add_item(tree, hf_bthci_evt_data_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6588             length = tvb_get_guint8(tvb, offset);
6589             offset += 1;
6590 
6591             proto_tree_add_item(tree, hf_bthci_evt_data, tvb, offset, length, ENC_NA);
6592             offset += 1;
6593 
6594             }
6595             break;
6596         case 0x52: /* Connectionless Slave Broadcast Timeout */
6597             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
6598 
6599             proto_tree_add_item(tree, hf_bthci_evt_lt_addr, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6600             offset += 1;
6601 
6602             break;
6603         case 0x53: /* Truncated Page Complete */
6604             proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6605             send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
6606             offset += 1;
6607 
6608             offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
6609 
6610             break;
6611         case 0x54: /* Slave Page Response Timeout */
6612             /* NOTE: no parameters */
6613             break;
6614         case 0x55: /* Connectionless Slave Broadcast Channel Map Change */
6615             proto_tree_add_item(tree, hf_bthci_evt_afh_channel_map, tvb, offset, 10, ENC_NA);
6616             offset += 10;
6617 
6618             break;
6619         case 0x56: /* Inquiry Response Notification */
6620             proto_tree_add_item(tree, hf_bthci_evt_iac_lap, tvb, offset, 3, ENC_LITTLE_ENDIAN);
6621             offset += 3;
6622 
6623             proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, ENC_LITTLE_ENDIAN);
6624             offset += 1;
6625 
6626             break;
6627         case 0x57: /* Authenticated Payload Timeout Expired */
6628             proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
6629             offset += 2;
6630 
6631             break;
6632         case 0x58: /* SAM Status Change */
6633             offset = dissect_bthci_evt_sam_status_change(tvb, offset, pinfo, bthci_evt_tree);
6634             break;
6635 
6636         case 0xff: /* Vendor-Specific */
6637             if (!dissector_try_payload_new(vendor_dissector_table, tvb, pinfo, tree, TRUE, bluetooth_data)) {
6638                 if (bluetooth_data) {
6639                     hci_vendor_data_t  *hci_vendor_data;
6640                     wmem_tree_key_t     key[3];
6641                     guint32             interface_id;
6642                     guint32             adapter_id;
6643 
6644                     interface_id = bluetooth_data->interface_id;
6645                     adapter_id   = bluetooth_data->adapter_id;
6646 
6647                     key[0].length = 1;
6648                     key[0].key    = &interface_id;
6649                     key[1].length = 1;
6650                     key[1].key    = &adapter_id;
6651                     key[2].length = 0;
6652                     key[2].key    = NULL;
6653 
6654                     hci_vendor_data = (hci_vendor_data_t *) wmem_tree_lookup32_array(bluetooth_data->hci_vendors, key);
6655                     if (hci_vendor_data) {
6656                         gint sub_offset;
6657 
6658                         sub_offset = dissector_try_uint_new(hci_vendor_table, hci_vendor_data->manufacturer, tvb, pinfo, tree, TRUE, bluetooth_data);
6659 
6660                         if (sub_offset > 0 && sub_offset < tvb_captured_length_remaining(tvb, offset))
6661                             proto_tree_add_expert(bthci_evt_tree, pinfo, &ei_parameter_unexpected, tvb, offset + sub_offset, tvb_captured_length_remaining(tvb, sub_offset + offset));
6662                     }
6663                 }
6664             }
6665 
6666             proto_tree_add_expert(bthci_evt_tree, pinfo, &ei_event_undecoded, tvb, offset, tvb_captured_length_remaining(tvb, offset));
6667 
6668             return tvb_captured_length(tvb);
6669 
6670         default:
6671             proto_tree_add_expert(bthci_evt_tree, pinfo, &ei_event_unknown_event, tvb, offset, tvb_captured_length_remaining(tvb, offset));
6672             offset += tvb_reported_length_remaining(tvb, offset);
6673             break;
6674         }
6675     }
6676 
6677     opcode_list_frame = wmem_list_head(opcode_list);
6678 
6679     while (opcode_list_frame) {
6680         wmem_tree_key_t      key[4];
6681         guint32              interface_id;
6682         guint32              adapter_id;
6683         guint32              frame_number;
6684         bthci_cmd_data_t     *bthci_cmd_data;
6685         wmem_tree_t          *subtree;
6686         gint                  i_frame_number;
6687 
6688         interface_id = bluetooth_data->interface_id;
6689         adapter_id   = bluetooth_data->adapter_id;
6690         frame_number = pinfo->num;
6691 
6692         opcode_list_data = (opcode_list_data_t *) wmem_list_frame_data(opcode_list_frame);
6693         opcode = opcode_list_data->opcode;
6694 
6695         key[0].length = 1;
6696         key[0].key    = &interface_id;
6697         key[1].length = 1;
6698         key[1].key    = &adapter_id;
6699         key[2].length = 1;
6700         key[2].key    = &opcode;
6701         key[3].length = 0;
6702         key[3].key    = NULL;
6703 
6704         subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bthci_cmds, key);
6705 
6706         i_frame_number = frame_number;
6707 
6708         do {
6709             bthci_cmd_data = (subtree) ? (bthci_cmd_data_t *) wmem_tree_lookup32_le(subtree, i_frame_number) : NULL;
6710             if (bthci_cmd_data && bthci_cmd_data->command_in_frame < frame_number && (
6711                         (opcode_list_data->command_status == COMMAND_STATUS_NORMAL &&
6712                     (bthci_cmd_data->response_in_frame == frame_number ||
6713                     bthci_cmd_data->response_in_frame == max_disconnect_in_frame)) ||
6714                         (opcode_list_data->command_status == COMMAND_STATUS_PENDING &&
6715                     (bthci_cmd_data->pending_in_frame == frame_number ||
6716                     ((bthci_cmd_data->response_in_frame == max_disconnect_in_frame ||
6717                     bthci_cmd_data->response_in_frame > frame_number) &&
6718                     bthci_cmd_data->pending_in_frame == max_disconnect_in_frame))) ||
6719                         (opcode_list_data->command_status == COMMAND_STATUS_RESULT &&
6720                     (bthci_cmd_data->response_in_frame == frame_number ||
6721                     ((bthci_cmd_data->response_in_frame == max_disconnect_in_frame &&
6722                     bthci_cmd_data->pending_in_frame == max_disconnect_in_frame))))
6723                     )) {
6724                 lastest_bthci_cmd_data = bthci_cmd_data;
6725                 if (((opcode_list_data->command_status == COMMAND_STATUS_RESULT ||
6726                         opcode_list_data->command_status == COMMAND_STATUS_NORMAL) &&
6727                         bthci_cmd_data->response_in_frame == frame_number) ||
6728                         (opcode_list_data->command_status == COMMAND_STATUS_PENDING &&
6729                         bthci_cmd_data->pending_in_frame == frame_number)) {
6730                     opcode_list_frame = NULL;
6731                     break;
6732                 }
6733             }
6734 
6735             if (bthci_cmd_data && bthci_cmd_data->command_in_frame < frame_number) {
6736                 i_frame_number = bthci_cmd_data->command_in_frame - 1;
6737                 if (i_frame_number < 1)
6738                     bthci_cmd_data = NULL;
6739             } else {
6740                 bthci_cmd_data = NULL;
6741             }
6742         } while (bthci_cmd_data);
6743 
6744         if (opcode_list_frame)
6745             opcode_list_frame = wmem_list_frame_next(opcode_list_frame);
6746     }
6747 
6748     if (lastest_bthci_cmd_data) {
6749         proto_item  *sub_item;
6750         guint32      frame_number;
6751         nstime_t     delta;
6752 
6753         frame_number = pinfo->num;
6754 
6755         if (evt_code == 0x0e /* Command Complete */ && opcode != G_MAXUINT32 && opcode >> 10 != HCI_OGF_VENDOR_SPECIFIC) {
6756             bluetooth_device_tap_t  *tap_device;
6757             guint8  status;
6758 
6759             status = tvb_get_guint8(tvb, 5);
6760 
6761             if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) switch(opcode) {
6762             case 0x0c03: /* Reset */
6763 
6764                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6765                 if (bluetooth_data) {
6766                     tap_device->interface_id  = bluetooth_data->interface_id;
6767                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6768                 } else {
6769                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6770                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6771                 }
6772                 tap_device->has_bd_addr = FALSE;
6773                 tap_device->is_local = TRUE;
6774                 tap_device->type = BLUETOOTH_DEVICE_RESET;
6775                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6776 
6777                 break;
6778             case 0x0c13: /* Change Local Name */
6779 
6780                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6781                 if (bluetooth_data) {
6782                     tap_device->interface_id  = bluetooth_data->interface_id;
6783                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6784                 } else {
6785                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6786                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6787                 }
6788 
6789                 tap_device->has_bd_addr = FALSE;
6790                 tap_device->is_local = TRUE;
6791                 tap_device->type = BLUETOOTH_DEVICE_NAME;
6792                 tap_device->data.name = lastest_bthci_cmd_data->data.name;
6793                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6794 
6795                 if (!pinfo->fd->visited) {
6796                     localhost_name_entry_t  *localhost_name_entry;
6797                     wmem_tree_key_t      key[4];
6798                     guint32              interface_id;
6799                     guint32              adapter_id;
6800 
6801                     interface_id = bluetooth_data->interface_id;
6802                     adapter_id   = bluetooth_data->adapter_id;
6803 
6804                     key[0].length = 1;
6805                     key[0].key    = &interface_id;
6806                     key[1].length = 1;
6807                     key[1].key    = &adapter_id;
6808                     key[2].length = 1;
6809                     key[2].key    = &frame_number;
6810                     key[3].length = 0;
6811                     key[3].key    = NULL;
6812 
6813                     localhost_name_entry = (localhost_name_entry_t *) wmem_new(wmem_file_scope(), localhost_name_entry_t);
6814                     localhost_name_entry->interface_id = interface_id;
6815                     localhost_name_entry->adapter_id = adapter_id;
6816                     localhost_name_entry->name = lastest_bthci_cmd_data->data.name;
6817 
6818                     wmem_tree_insert32_array(bluetooth_data->localhost_name, key, localhost_name_entry);
6819                 }
6820                 break;
6821             case 0x0c18: /* Write Page Timeout */
6822 
6823                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6824                 if (bluetooth_data) {
6825                     tap_device->interface_id  = bluetooth_data->interface_id;
6826                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6827                 } else {
6828                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6829                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6830                 }
6831                 tap_device->has_bd_addr = FALSE;
6832                 tap_device->is_local = TRUE;
6833                 tap_device->type = BLUETOOTH_DEVICE_PAGE_TIMEOUT;
6834                 tap_device->data.page_timeout = lastest_bthci_cmd_data->data.page_timeout;
6835                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6836 
6837                 break;
6838             case 0x0c1a: /* Write Scan Enable */
6839 
6840                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6841                 if (bluetooth_data) {
6842                     tap_device->interface_id  = bluetooth_data->interface_id;
6843                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6844                 } else {
6845                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6846                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6847                 }
6848                 tap_device->has_bd_addr = FALSE;
6849                 tap_device->is_local = TRUE;
6850                 tap_device->type = BLUETOOTH_DEVICE_SCAN;
6851                 tap_device->data.scan = lastest_bthci_cmd_data->data.scan;
6852                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6853 
6854                 break;
6855             case 0x0c20: /* Write Authentication Enable */
6856 
6857                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6858                 if (bluetooth_data) {
6859                     tap_device->interface_id  = bluetooth_data->interface_id;
6860                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6861                 } else {
6862                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6863                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6864                 }
6865                 tap_device->has_bd_addr = FALSE;
6866                 tap_device->is_local = TRUE;
6867                 tap_device->type = BLUETOOTH_DEVICE_AUTHENTICATION;
6868                 tap_device->data.authentication = lastest_bthci_cmd_data->data.authentication;
6869                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6870 
6871                 break;
6872             case 0x0c22: /* Write Encryption Mode */
6873 
6874                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6875                 if (bluetooth_data) {
6876                     tap_device->interface_id  = bluetooth_data->interface_id;
6877                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6878                 } else {
6879                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6880                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6881                 }
6882                 tap_device->has_bd_addr = FALSE;
6883                 tap_device->is_local = TRUE;
6884                 tap_device->type = BLUETOOTH_DEVICE_ENCRYPTION;
6885                 tap_device->data.encryption = lastest_bthci_cmd_data->data.encryption;
6886                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6887 
6888                 break;
6889             case 0x0c24: /* Write Class Of Device */
6890 
6891                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6892                 if (bluetooth_data) {
6893                     tap_device->interface_id  = bluetooth_data->interface_id;
6894                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6895                 } else {
6896                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6897                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6898                 }
6899                 tap_device->has_bd_addr = FALSE;
6900                 tap_device->is_local = TRUE;
6901                 tap_device->type = BLUETOOTH_DEVICE_CLASS_OF_DEVICE;
6902                 tap_device->data.class_of_device = lastest_bthci_cmd_data->data.class_of_device;
6903                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6904 
6905                 break;
6906             case 0x0c26: /* Write Voice Setting */
6907 
6908                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6909                 if (bluetooth_data) {
6910                     tap_device->interface_id  = bluetooth_data->interface_id;
6911                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6912                 } else {
6913                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6914                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6915                 }
6916                 tap_device->has_bd_addr = FALSE;
6917                 tap_device->is_local = TRUE;
6918                 tap_device->type = BLUETOOTH_DEVICE_VOICE_SETTING;
6919                 tap_device->data.voice_setting = lastest_bthci_cmd_data->data.voice_setting;
6920                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6921 
6922                 break;
6923             case 0x0c33: /* Host Buffer Size */
6924 
6925                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6926                 if (bluetooth_data) {
6927                     tap_device->interface_id  = bluetooth_data->interface_id;
6928                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6929                 } else {
6930                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6931                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6932                 }
6933                 tap_device->has_bd_addr = FALSE;
6934                 tap_device->is_local = TRUE;
6935                 tap_device->type = BLUETOOTH_DEVICE_MTUS;
6936                 tap_device->data.mtus.acl_mtu     = lastest_bthci_cmd_data->data.mtus.acl_mtu;
6937                 tap_device->data.mtus.sco_mtu     = lastest_bthci_cmd_data->data.mtus.sco_mtu;
6938                 tap_device->data.mtus.acl_packets = lastest_bthci_cmd_data->data.mtus.acl_packets;
6939                 tap_device->data.mtus.sco_packets = lastest_bthci_cmd_data->data.mtus.sco_packets;
6940                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6941 
6942                 break;
6943             case 0x0c45: /* Write Inquiry Mode */
6944 
6945                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6946                 if (bluetooth_data) {
6947                     tap_device->interface_id  = bluetooth_data->interface_id;
6948                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6949                 } else {
6950                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6951                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6952                 }
6953                 tap_device->has_bd_addr = FALSE;
6954                 tap_device->is_local = TRUE;
6955                 tap_device->type = BLUETOOTH_DEVICE_INQUIRY_MODE;
6956                 tap_device->data.inquiry_mode = lastest_bthci_cmd_data->data.inquiry_mode;
6957                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6958 
6959                 break;
6960             case 0x0c56: /* Write Simple Pairing */
6961 
6962                 tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
6963                 if (bluetooth_data) {
6964                     tap_device->interface_id  = bluetooth_data->interface_id;
6965                     tap_device->adapter_id    = bluetooth_data->adapter_id;
6966                 } else {
6967                     tap_device->interface_id  = HCI_INTERFACE_DEFAULT;
6968                     tap_device->adapter_id    = HCI_ADAPTER_DEFAULT;
6969                 }
6970                 tap_device->has_bd_addr = FALSE;
6971                 tap_device->is_local = TRUE;
6972                 tap_device->type = BLUETOOTH_DEVICE_SIMPLE_PAIRING_MODE;
6973                 tap_device->data.simple_pairing_mode = lastest_bthci_cmd_data->data.simple_pairing_mode;
6974                 tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
6975 
6976                 break;
6977             }
6978         }
6979 
6980         if (!pinfo->fd->visited && opcode_list_data->command_status == COMMAND_STATUS_PENDING &&
6981                 lastest_bthci_cmd_data->pending_in_frame == max_disconnect_in_frame) {
6982             lastest_bthci_cmd_data->pending_in_frame = frame_number;
6983             lastest_bthci_cmd_data->pending_abs_ts = pinfo->abs_ts;
6984         }
6985 
6986         if (!pinfo->fd->visited && opcode_list_data->command_status == COMMAND_STATUS_NORMAL &&
6987                 lastest_bthci_cmd_data->response_in_frame == max_disconnect_in_frame) {
6988             lastest_bthci_cmd_data->response_in_frame = frame_number;
6989             lastest_bthci_cmd_data->response_abs_ts = pinfo->abs_ts;
6990         }
6991 
6992         if (!pinfo->fd->visited && opcode_list_data->command_status == COMMAND_STATUS_RESULT &&
6993                 lastest_bthci_cmd_data->response_in_frame == max_disconnect_in_frame &&
6994                 lastest_bthci_cmd_data->pending_in_frame == max_disconnect_in_frame) {
6995             lastest_bthci_cmd_data->response_in_frame = frame_number;
6996             lastest_bthci_cmd_data->response_abs_ts = pinfo->abs_ts;
6997         }
6998 
6999         if (lastest_bthci_cmd_data->pending_in_frame == frame_number) {
7000             sub_item = proto_tree_add_uint(bthci_evt_tree, hf_command_in_frame, tvb, 0, 0, lastest_bthci_cmd_data->command_in_frame);
7001             proto_item_set_generated(sub_item);
7002 
7003             if (lastest_bthci_cmd_data->response_in_frame < max_disconnect_in_frame) {
7004                 sub_item = proto_tree_add_uint(bthci_evt_tree, hf_response_in_frame, tvb, 0, 0, lastest_bthci_cmd_data->response_in_frame);
7005                 proto_item_set_generated(sub_item);
7006             }
7007 
7008             nstime_delta(&delta, &lastest_bthci_cmd_data->pending_abs_ts, &lastest_bthci_cmd_data->command_abs_ts);
7009             sub_item = proto_tree_add_double(bthci_evt_tree, hf_command_pending_time_delta, tvb, 0, 0, nstime_to_msec(&delta));
7010             proto_item_set_generated(sub_item);
7011 
7012             if (lastest_bthci_cmd_data->response_in_frame < max_disconnect_in_frame) {
7013                 nstime_delta(&delta, &lastest_bthci_cmd_data->response_abs_ts, &lastest_bthci_cmd_data->pending_abs_ts);
7014                 sub_item = proto_tree_add_double(bthci_evt_tree, hf_pending_response_time_delta, tvb, 0, 0, nstime_to_msec(&delta));
7015                 proto_item_set_generated(sub_item);
7016             }
7017         }
7018 
7019         if (lastest_bthci_cmd_data->response_in_frame == frame_number) {
7020             sub_item = proto_tree_add_uint(bthci_evt_tree, hf_command_in_frame, tvb, 0, 0, lastest_bthci_cmd_data->command_in_frame);
7021             proto_item_set_generated(sub_item);
7022 
7023             if (lastest_bthci_cmd_data->pending_in_frame < max_disconnect_in_frame) {
7024                 sub_item = proto_tree_add_uint(bthci_evt_tree, hf_pending_in_frame, tvb, 0, 0, lastest_bthci_cmd_data->pending_in_frame);
7025                 proto_item_set_generated(sub_item);
7026 
7027                 nstime_delta(&delta, &lastest_bthci_cmd_data->response_abs_ts, &lastest_bthci_cmd_data->pending_abs_ts);
7028                 sub_item = proto_tree_add_double(bthci_evt_tree, hf_pending_response_time_delta, tvb, 0, 0, nstime_to_msec(&delta));
7029                 proto_item_set_generated(sub_item);
7030             }
7031 
7032             nstime_delta(&delta, &lastest_bthci_cmd_data->response_abs_ts, &lastest_bthci_cmd_data->command_abs_ts);
7033             sub_item = proto_tree_add_double(bthci_evt_tree, hf_command_response_time_delta, tvb, 0, 0, nstime_to_msec(&delta));
7034             proto_item_set_generated(sub_item);
7035         }
7036     }
7037 
7038     return offset;
7039 }
7040 
7041 
7042 /* Register the protocol with Wireshark */
7043 
7044 void
proto_register_bthci_evt(void)7045 proto_register_bthci_evt(void)
7046 {
7047     module_t         *module;
7048     expert_module_t  *expert_bthci_evt;
7049 
7050     /* Setup list of header fields  See Section 1.6.1 for details*/
7051     static hf_register_info hf[] = {
7052         { &hf_bthci_evt_code,
7053           { "Event Code",            "bthci_evt.code",
7054             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &bthci_evt_evt_code_vals_ext, 0x0,
7055             NULL, HFILL }
7056         },
7057         { &hf_bthci_evt_param_length,
7058           { "Parameter Total Length", "bthci_evt.param_length",
7059             FT_UINT8, BASE_DEC, NULL, 0x0,
7060             NULL, HFILL }
7061         },
7062         { &hf_bthci_evt_num_command_packets,
7063           { "Number of Allowed Command Packets", "bthci_evt.num_command_packets",
7064             FT_UINT8, BASE_DEC, NULL, 0x0,
7065             NULL, HFILL }
7066         },
7067         { &hf_bthci_evt_num_handles,
7068           { "Number of Connection Handles", "bthci_evt.num_handles",
7069             FT_UINT8, BASE_DEC, NULL, 0x0,
7070             "Number of Connection Handles and Num_HCI_Data_Packets parameter pairs", HFILL }
7071         },
7072         { &hf_bthci_evt_connection_handle,
7073           { "Connection Handle",            "bthci_evt.connection_handle",
7074             FT_UINT16, BASE_HEX, NULL, 0x0,
7075             NULL, HFILL }
7076         },
7077 
7078         { &hf_bthci_evt_num_compl_packets,
7079           { "Number of Completed Packets", "bthci_evt.num_compl_packets",
7080             FT_UINT16, BASE_DEC, NULL, 0x0,
7081             "The number of HCI Data Packets that have been completed", HFILL }
7082         },
7083 
7084         { &hf_bthci_evt_opcode,
7085           { "Command Opcode",               "bthci_evt.opcode",
7086             FT_UINT16, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_opcode_vals_ext, 0x0,
7087             "HCI Command Opcode", HFILL }
7088         },
7089         { &hf_bthci_evt_ogf,
7090           { "Opcode Group Field",           "bthci_evt.opcode.ogf",
7091             FT_UINT16, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_ogf_vals_ext, 0xfc00,
7092             NULL, HFILL }
7093         },
7094         { &hf_bthci_evt_ocf_link_control,
7095           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7096             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bthci_cmd_ocf_link_control_vals_ext, 0x03ff,
7097             NULL, HFILL }
7098         },
7099         { &hf_bthci_evt_ocf_link_policy,
7100           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7101             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bthci_cmd_ocf_link_policy_vals_ext, 0x03ff,
7102             NULL, HFILL }
7103         },
7104         { &hf_bthci_evt_ocf_host_controller_and_baseband,
7105           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7106             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bthci_cmd_ocf_host_controller_and_baseband_vals_ext, 0x03ff,
7107             NULL, HFILL }
7108         },
7109         { &hf_bthci_evt_ocf_informational,
7110           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7111             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bthci_cmd_ocf_informational_vals_ext, 0x03ff,
7112             NULL, HFILL }
7113         },
7114         { &hf_bthci_evt_ocf_status,
7115           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7116             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bthci_cmd_ocf_status_vals_ext, 0x03ff,
7117             NULL, HFILL }
7118         },
7119         { &hf_bthci_evt_ocf_testing,
7120           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7121             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bthci_cmd_ocf_testing_vals_ext, 0x03ff,
7122             NULL, HFILL }
7123         },
7124         { &hf_bthci_evt_ocf_low_energy,
7125           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7126             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bthci_cmd_ocf_low_energy_vals_ext, 0x03ff,
7127             NULL, HFILL }
7128         },
7129         { &hf_bthci_evt_ocf_logo_testing,
7130           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7131             FT_UINT16, BASE_HEX, NULL, 0x03ff,
7132             NULL, HFILL }
7133         },
7134         { &hf_bthci_evt_ocf,
7135           { "Opcode Command Field",           "bthci_evt.opcode.ocf",
7136             FT_UINT16, BASE_HEX, NULL, 0x03ff,
7137             NULL, HFILL }
7138         },
7139         { &hf_bthci_evt_ret_params,
7140           { "Return Parameter",       "bthci_evt.ret_params",
7141             FT_NONE, BASE_NONE, NULL, 0x0,
7142             NULL, HFILL }
7143         },
7144         { &hf_bthci_evt_status,
7145           { "Status",           "bthci_evt.status",
7146             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_status_vals_ext, 0x0,
7147             NULL, HFILL }
7148         },
7149         { &hf_bthci_evt_status_pending,
7150           { "Status", "bthci_evt.status",
7151             FT_UINT8, BASE_HEX, VALS(bthci_cmd_status_pending_vals), 0x0,
7152             NULL, HFILL }
7153         },
7154         { &hf_bthci_evt_bd_addr,
7155           { "BD_ADDR",          "bthci_evt.bd_addr",
7156             FT_ETHER, BASE_NONE, NULL, 0x0,
7157             "Bluetooth Device Address", HFILL}
7158         },
7159         { &hf_bthci_evt_link_type,
7160           { "Link Type", "bthci_evt.link_type",
7161             FT_UINT8, BASE_HEX, VALS(evt_link_types), 0x0,
7162             NULL, HFILL }
7163         },
7164         { &hf_bthci_evt_encryption_mode,
7165           { "Encryption Mode",  "bthci_evt.encryption_mode",
7166             FT_UINT8, BASE_HEX, VALS(evt_encryption_modes), 0x0,
7167             NULL, HFILL }
7168         },
7169         { &hf_bthci_evt_reason,
7170           { "Reason",           "bthci_evt.reason",
7171             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_status_vals_ext, 0x0,
7172             NULL, HFILL }
7173         },
7174         { &hf_bthci_evt_remote_name,
7175           { "Remote Name",           "bthci_evt.remote_name",
7176             FT_STRINGZ, BASE_NONE, NULL, 0x0,
7177             "Userfriendly descriptive name for the remote device", HFILL }
7178         },
7179         { &hf_bthci_evt_encryption_enable,
7180           { "Encryption Enable",        "bthci_evt.encryption_enable",
7181             FT_UINT8, BASE_HEX, VALS(evt_encryption_enable), 0x0,
7182             NULL, HFILL }
7183         },
7184         { &hf_bthci_evt_key_flag,
7185           { "Key Flag",        "bthci_evt.key_flag",
7186             FT_UINT8, BASE_HEX, VALS(evt_key_flag), 0x0,
7187             NULL, HFILL }
7188         },
7189         { &hf_bthci_evt_vers_nr,
7190           { "LMP Version",        "bthci_evt.lmp_vers_nr",
7191             FT_UINT8, BASE_HEX, VALS(bthci_evt_lmp_version), 0x0,
7192             "Version of the Current LMP", HFILL }
7193         },
7194         { &hf_bthci_bthci_evt_hci_version,
7195           { "HCI Version",        "bthci_evt.hci_vers_nr",
7196             FT_UINT8, BASE_HEX, VALS(bthci_evt_hci_version), 0x0,
7197             "Version of the Current HCI", HFILL }
7198         },
7199         { &hf_bthci_evt_hci_revision,
7200           { "HCI Revision",        "bthci_evt.hci_vers_nr",
7201             FT_UINT16, BASE_DEC, NULL, 0x0,
7202             "Revision of the Current HCI", HFILL }
7203         },
7204         { &hf_bthci_evt_comp_id,
7205           { "Manufacturer Name",        "bthci_evt.comp_id",
7206             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &bluetooth_company_id_vals_ext, 0x0,
7207             "Manufacturer Name of Bluetooth Hardware", HFILL }
7208         },
7209         { &hf_bthci_evt_sub_vers_nr,
7210           { "LMP Subversion",        "bthci_evt.lmp_sub_vers_nr",
7211             FT_UINT16, BASE_DEC, NULL, 0x0,
7212             "Subversion of the Current LMP", HFILL }
7213         },
7214         { &hf_bthci_evt_flags,
7215           { "Flags",        "bthci_evt.flags",
7216             FT_UINT8, BASE_HEX, NULL, 0x0,
7217             NULL, HFILL }
7218         },
7219         { &hf_bthci_evt_service_type,
7220           { "Service Type",        "bthci_evt.service_type",
7221             FT_UINT8, BASE_HEX, VALS(evt_service_types), 0x0,
7222             NULL, HFILL }
7223         },
7224         { &hf_bthci_evt_token_rate,
7225           { "Available Token Rate",        "bthci_evt.token_rate",
7226             FT_UINT32, BASE_DEC, NULL, 0x0,
7227             "Available Token Rate, in bytes per second", HFILL }
7228         },
7229         { &hf_bthci_evt_peak_bandwidth,
7230           { "Available Peak Bandwidth",        "bthci_evt.peak_bandwidth",
7231             FT_UINT32, BASE_DEC, NULL, 0x0,
7232             "Available Peak Bandwidth, in bytes per second", HFILL }
7233         },
7234         { &hf_bthci_evt_latency,
7235           { "Available Latency",        "bthci_evt.latency",
7236             FT_UINT32, BASE_DEC, NULL, 0x0,
7237             "Available Latency, in microseconds", HFILL }
7238         },
7239         { &hf_bthci_evt_delay_variation,
7240           { "Available Delay Variation",        "bthci_evt.delay_variation",
7241             FT_UINT32, BASE_DEC, NULL, 0x0,
7242             "Available Delay Variation, in microseconds", HFILL }
7243         },
7244         { &hf_bthci_evt_hardware_code,
7245           { "Hardware Code",        "bthci_evt.hardware_code",
7246             FT_UINT8, BASE_HEX, NULL, 0x0,
7247             "Hardware Code (implementation specific)", HFILL }
7248         },
7249         { &hf_bthci_evt_role,
7250           { "Role",        "bthci_evt.role",
7251             FT_UINT8, BASE_HEX, VALS(evt_role_vals), 0x0,
7252             NULL, HFILL }
7253         },
7254         { &hf_bthci_evt_curr_mode,
7255           { "Current Mode",        "bthci_evt.current_mode",
7256             FT_UINT8, BASE_HEX, VALS(evt_modes), 0x0,
7257             NULL, HFILL }
7258         },
7259         { &hf_bthci_evt_interval,
7260           { "Interval",        "bthci_evt.interval",
7261             FT_UINT16, BASE_DEC, NULL, 0x0,
7262             "Interval - Number of Baseband slots", HFILL }
7263         },
7264         { &hf_bthci_evt_link_key,
7265           { "Link Key",        "bthci_evt.link_key",
7266             FT_BYTES, BASE_NONE, NULL, 0x0,
7267             "Link Key for the associated BD_ADDR", HFILL }
7268         },
7269         { &hf_bthci_evt_key_type,
7270           { "Key Type",        "bthci_evt.key_type",
7271             FT_UINT8, BASE_HEX, VALS(evt_key_types), 0x0,
7272             NULL, HFILL }
7273         },
7274         { &hf_bthci_evt_max_slots,
7275           { "Maximum Number of Slots",        "bthci_evt.max_slots",
7276             FT_UINT8, BASE_DEC, NULL, 0x0,
7277             "Maximum Number of slots allowed for baseband packets", HFILL }
7278         },
7279         { &hf_bthci_evt_clock_offset,
7280           { "Clock Offset",        "bthci_evt.clock_offset",
7281             FT_UINT16, BASE_HEX, NULL, 0x7FFF,
7282             "Bit 2-16 of the Clock Offset between CLKmaster-CLKslave", HFILL }
7283         },
7284         { &hf_bthci_evt_page_scan_mode,
7285           { "Page Scan Mode",        "bthci_evt.page_scan_mode",
7286             FT_UINT8, BASE_HEX, VALS(bthci_cmd_page_scan_modes), 0x0,
7287             NULL, HFILL }
7288         },
7289         { &hf_bthci_evt_page_scan_repetition_mode,
7290           { "Page Scan Repetition Mode",        "bthci_evt.page_scan_repetition_mode",
7291             FT_UINT8, BASE_HEX, VALS(bthci_cmd_page_scan_repetition_modes), 0x0,
7292             NULL, HFILL }
7293         },
7294         { &hf_bthci_evt_reserved,
7295           { "Reserved",        "bthci_evt.reserved",
7296             FT_UINT8, BASE_HEX, NULL, 0x0,
7297             NULL, HFILL }
7298         },
7299         { &hf_bthci_evt_page_scan_period_mode,
7300           { "Page Scan Period Mode",        "bthci_evt.page_scan_period_mode",
7301             FT_UINT8, BASE_HEX, VALS(bthci_cmd_page_scan_period_modes), 0x0,
7302             NULL, HFILL }
7303         },
7304         { &hf_packet_type_acl,
7305           { "Packet Type for ACL",               "bthci_evt.packet_type",
7306             FT_UINT16, BASE_HEX, NULL, 0,
7307             NULL, HFILL }
7308         },
7309         { &hf_packet_type_acl_dh5,
7310           { "DH5 may be used",                   "bthci_evt.packet_type.dh5",
7311             FT_BOOLEAN, 16, NULL, 0x8000,
7312             NULL, HFILL }
7313         },
7314         { &hf_packet_type_acl_dm5,
7315           { "DM5 may be used",                   "bthci_evt.packet_type.dm5",
7316             FT_BOOLEAN, 16, NULL, 0x4000,
7317             NULL, HFILL }
7318         },
7319         { &hf_packet_type_acl_3dh5,
7320           { "3-DH5 shall NOT be used",           "bthci_evt.packet_type.3dh5",
7321             FT_BOOLEAN, 16, NULL, 0x2000,
7322             NULL, HFILL }
7323         },
7324         { &hf_packet_type_acl_2dh5,
7325           { "2-DH5 shall NOT be used",           "bthci_evt.packet_type.2dh5",
7326             FT_BOOLEAN, 16, NULL, 0x1000,
7327             NULL, HFILL }
7328         },
7329         { &hf_packet_type_acl_dh3,
7330           { "DH3 may be used",                   "bthci_evt.packet_type.dh3",
7331             FT_BOOLEAN, 16, NULL, 0x0800,
7332             NULL, HFILL }
7333         },
7334         { &hf_packet_type_acl_dm3,
7335           { "DM3 may be used",                   "bthci_evt.packet_type.dm3",
7336             FT_BOOLEAN, 16, NULL, 0x0400,
7337             NULL, HFILL }
7338         },
7339         { &hf_packet_type_acl_3dh3,
7340           { "3-DH3 shall NOT be used",           "bthci_evt.packet_type.3dh3",
7341             FT_BOOLEAN, 16, NULL, 0x0200,
7342             NULL, HFILL }
7343         },
7344         { &hf_packet_type_acl_2dh3,
7345           { "2-DH3 shall NOT be used",           "bthci_evt.packet_type.2dh3",
7346             FT_BOOLEAN, 16, NULL, 0x0100,
7347             NULL, HFILL }
7348         },
7349         { &hf_packet_type_acl_reserved_5_7,
7350           { "Reserved",                          "bthci_evt.packet_type.reserved_5_7",
7351             FT_UINT16, BASE_HEX, NULL, 0x00E0,
7352             NULL, HFILL }
7353         },
7354         { &hf_packet_type_acl_dh1,
7355           { "DH1 may be used",                   "bthci_evt.packet_type.dh1",
7356             FT_BOOLEAN, 16, NULL, 0x0010,
7357             NULL, HFILL }
7358         },
7359         { &hf_packet_type_acl_dm1,
7360           { "DM1 may be used",                   "bthci_evt.packet_type.dm1",
7361             FT_BOOLEAN, 16, NULL, 0x0008,
7362             NULL, HFILL }
7363         },
7364         { &hf_packet_type_acl_3dh1,
7365           { "3-DH1 shall NOT be used",           "bthci_evt.packet_type.3dh1",
7366             FT_BOOLEAN, 16, NULL, 0x0004,
7367             NULL, HFILL }
7368         },
7369         { &hf_packet_type_acl_2dh1,
7370           { "2-DH1 shall NOT be used",           "bthci_evt.packet_type.2dh1",
7371             FT_BOOLEAN, 16, NULL, 0x0002,
7372             NULL, HFILL }
7373         },
7374         { &hf_packet_type_acl_reserved_0,
7375           { "Reserved",                          "bthci_evt.packet_type.reserved_0",
7376             FT_BOOLEAN, 16, NULL, 0x0001,
7377             NULL, HFILL }
7378         },
7379         { &hf_packet_type_sco,
7380           { "Packet Type for SCO",               "bthci_evt.packet_type",
7381             FT_UINT16, BASE_HEX, NULL, 0,
7382             NULL, HFILL }
7383         },
7384         { &hf_packet_type_sco_reserved_15_8,
7385           { "Reserved",                          "bthci_evt.packet_type.reserved_15_8",
7386             FT_UINT16, BASE_HEX, NULL, 0xFF00,
7387             NULL, HFILL }
7388         },
7389         { &hf_packet_type_sco_hv3,
7390           { "HV3",                               "bthci_evt.packet_type.hv3",
7391             FT_BOOLEAN, 16, NULL, 0x0080,
7392             NULL, HFILL }
7393         },
7394         { &hf_packet_type_sco_hv2,
7395           { "HV2",                               "bthci_evt.packet_type.hv2",
7396             FT_BOOLEAN, 16, NULL, 0x0040,
7397             NULL, HFILL }
7398         },
7399         { &hf_packet_type_sco_hv1,
7400           { "HV1",                               "bthci_evt.packet_type.hv1",
7401             FT_BOOLEAN, 16, NULL, 0x0020,
7402             NULL, HFILL }
7403         },
7404         { &hf_packet_type_sco_reserved_4_0,
7405           { "Reserved",                          "bthci_evt.packet_type.reserved_4_0",
7406             FT_UINT16, BASE_HEX, NULL, 0x001F,
7407             NULL, HFILL }
7408         },
7409         { &hf_lmp_features,
7410           { "LMP Features",        "bthci_evt.lmp_features",
7411             FT_NONE, BASE_NONE, NULL, 0x00,
7412             NULL, HFILL }
7413         },
7414         { &hf_lmp_feature_3slot_packets,
7415           { "3-slot packets",                         "bthci_evt.lmp_features.3slot_packets",
7416             FT_BOOLEAN, 8, NULL, 0x01,
7417             NULL, HFILL }
7418         },
7419         { &hf_lmp_feature_5slot_packets,
7420           { "5-slot packets",                         "bthci_evt.lmp_features.5slot_packets",
7421             FT_BOOLEAN, 8, NULL, 0x02,
7422             NULL, HFILL }
7423         },
7424         { &hf_lmp_feature_encryption,
7425           { "Encryption",                             "bthci_evt.lmp_features.encryption",
7426             FT_BOOLEAN, 8, NULL, 0x04,
7427             NULL, HFILL }
7428         },
7429         { &hf_lmp_feature_slot_offset,
7430           { "Slot Offset",                            "bthci_evt.lmp_features.slot_offset",
7431             FT_BOOLEAN, 8, NULL, 0x08,
7432             NULL, HFILL }
7433         },
7434         { &hf_lmp_feature_timing_accuracy,
7435           { "Timing Accuracy",                        "bthci_evt.lmp_features.timing_accuracy",
7436             FT_BOOLEAN, 8, NULL, 0x10,
7437             NULL, HFILL }
7438         },
7439         { &hf_lmp_feature_role_switch,
7440           { "Role Switch",                            "bthci_evt.lmp_features.role_switch",
7441             FT_BOOLEAN, 8, NULL, 0x20,
7442             NULL, HFILL }
7443         },
7444         { &hf_lmp_feature_hold_mode,
7445           { "Hold Mode",                              "bthci_evt.lmp_features.hold_mode",
7446             FT_BOOLEAN, 8, NULL, 0x40,
7447             NULL, HFILL }
7448         },
7449         { &hf_lmp_feature_sniff_mode,
7450           { "Sniff Mode",                             "bthci_evt.lmp_features.sniff_mode",
7451             FT_BOOLEAN, 8, NULL, 0x80,
7452             NULL, HFILL }
7453         },
7454         { &hf_lmp_feature_park_state,
7455           { "Park Mode",                              "bthci_evt.lmp_features.park_state",
7456             FT_BOOLEAN, 8, NULL, 0x01,
7457             NULL, HFILL }
7458         },
7459         { &hf_lmp_feature_power_control_requests,
7460           { "Power Control Requests",                 "bthci_evt.lmp_features.power_control_requests",
7461             FT_BOOLEAN, 8, NULL, 0x02,
7462             NULL, HFILL }
7463         },
7464         { &hf_lmp_feature_channel_quality_driven_data_rate,
7465           { "Channel Quality Driven Data Rate",       "bthci_evt.lmp_features.channel_quality_driven_data_rate",
7466             FT_BOOLEAN, 8, NULL, 0x04,
7467             NULL, HFILL }
7468         },
7469         { &hf_lmp_feature_sco_link,
7470           { "SCO Link",                               "bthci_evt.lmp_features.sco_link",
7471             FT_BOOLEAN, 8, NULL, 0x08,
7472             NULL, HFILL }
7473         },
7474         { &hf_lmp_feature_hv2_packets,
7475           { "HV2 packets",                            "bthci_evt.lmp_features.hv2_packets",
7476             FT_BOOLEAN, 8, NULL, 0x10,
7477             NULL, HFILL }
7478         },
7479         { &hf_lmp_feature_hv3_packets,
7480           { "HV3 packets",                            "bthci_evt.lmp_features.hv3_packets",
7481             FT_BOOLEAN, 8, NULL, 0x20,
7482             NULL, HFILL }
7483         },
7484         { &hf_lmp_feature_u_law_log_synchronous_data,
7485           { "u-law Log Synchronous Data",             "bthci_evt.lmp_features.u_law_log_synchronous_data",
7486             FT_BOOLEAN, 8, NULL, 0x40,
7487             NULL, HFILL }
7488         },
7489         { &hf_lmp_feature_a_law_log_synchronous_data,
7490           { "A-law Log Synchronous Data",             "bthci_evt.lmp_features.a_law_log_synchronous_data",
7491             FT_BOOLEAN, 8, NULL, 0x80,
7492             NULL, HFILL }
7493         },
7494         { &hf_lmp_feature_cvsd_synchronous_data,
7495           { "CVSD Synchronous Data",                  "bthci_evt.lmp_features.cvsd_synchronous_data",
7496             FT_BOOLEAN, 8, NULL, 0x01,
7497             NULL, HFILL }
7498         },
7499         { &hf_lmp_feature_paging_parameter_negotiation,
7500           { "Paging Parameter Negotiation",           "bthci_evt.lmp_features.paging_parameter_negotiation",
7501             FT_BOOLEAN, 8, NULL, 0x02,
7502             NULL, HFILL }
7503         },
7504         { &hf_lmp_feature_power_control,
7505           { "Power Control",                          "bthci_evt.lmp_features.power_control",
7506             FT_BOOLEAN, 8, NULL, 0x04,
7507             NULL, HFILL }
7508         },
7509         { &hf_lmp_feature_transparent_synchronous_data,
7510           { "Transparent Synchronous Data",           "bthci_evt.lmp_features.transparent_synchronous_data",
7511             FT_BOOLEAN, 8, NULL, 0x08,
7512             NULL, HFILL }
7513         },
7514         { &hf_lmp_feature_flow_control_lag,
7515           { "Flow Control Lag",                       "bthci_evt.lmp_features.flow_control_lag",
7516             FT_UINT8, BASE_DEC, NULL, 0x70,
7517             NULL, HFILL }
7518         },
7519         { &hf_lmp_feature_broadcast_encryption,
7520           { "Broadband Encryption",                   "bthci_evt.lmp_features.broadcast_encryption",
7521             FT_BOOLEAN, 8, NULL, 0x80,
7522             NULL, HFILL }
7523         },
7524         { &hf_lmp_feature_reserved_24,
7525           { "Reserved",                               "bthci_evt.lmp_features.reserved.24",
7526             FT_BOOLEAN, 8, NULL, 0x01,
7527             NULL, HFILL }
7528         },
7529         { &hf_lmp_feature_edr_acl_2mbps_mode,
7530           { "EDR ACL 2 Mbps Mode",                    "bthci_evt.lmp_features.edr_acl_2mbps_mode",
7531             FT_BOOLEAN, 8, NULL, 0x02,
7532             NULL, HFILL }
7533         },
7534         { &hf_lmp_feature_edr_acl_3mbps_mode,
7535           { "EDR ACL 3 Mbps Mode",                    "bthci_evt.lmp_features.edr_acl_3mbps_mode",
7536             FT_BOOLEAN, 8, NULL, 0x04,
7537             NULL, HFILL }
7538         },
7539         { &hf_lmp_feature_enhanced_inquiry_scan,
7540           { "Enhanced Inquiry Scan",                  "bthci_evt.lmp_features.enhanced_inquiry_scan",
7541             FT_BOOLEAN, 8, NULL, 0x08,
7542             NULL, HFILL }
7543         },
7544         { &hf_lmp_feature_interlaced_inquiry_scan,
7545           { "Interlaced Inquiry Scan",                "bthci_evt.lmp_features.interlaced_inquiry_scan",
7546             FT_BOOLEAN, 8, NULL, 0x10,
7547             NULL, HFILL }
7548         },
7549         { &hf_lmp_feature_interlaced_page_scan,
7550           { "Interlaced Page Scan",                   "bthci_evt.lmp_features.interlaced_page_scan",
7551             FT_BOOLEAN, 8, NULL, 0x20,
7552             NULL, HFILL }
7553         },
7554         { &hf_lmp_feature_rssi_with_inquiry_results,
7555           { "RSSI with Inquiry Results",              "bthci_evt.lmp_features.rssi_with_inquiry_results",
7556             FT_BOOLEAN, 8, NULL, 0x40,
7557             NULL, HFILL }
7558         },
7559         { &hf_lmp_feature_ev3_packets,
7560           { "EV3 Packets",                            "bthci_evt.lmp_features.ev3_packets",
7561             FT_BOOLEAN, 8, NULL, 0x80,
7562             NULL, HFILL }
7563         },
7564         { &hf_lmp_feature_ev4_packets,
7565           { "EV4 Packets",                            "bthci_evt.lmp_features.ev4_packets",
7566             FT_BOOLEAN, 8, NULL, 0x01,
7567             NULL, HFILL }
7568         },
7569         { &hf_lmp_feature_ev5_packets,
7570           { "EV5 Packets",                            "bthci_evt.lmp_features.ev5_packets",
7571             FT_BOOLEAN, 8, NULL, 0x02,
7572             NULL, HFILL }
7573         },
7574         { &hf_lmp_feature_reserved_34,
7575           { "Reserved",                               "bthci_evt.lmp_features.reserved.34",
7576             FT_BOOLEAN, 8, NULL, 0x04,
7577             NULL, HFILL }
7578         },
7579         { &hf_lmp_feature_afh_capable_slave,
7580           { "AFH Capable Slave",                      "bthci_evt.lmp_features.afh_capable_slave",
7581             FT_BOOLEAN, 8, NULL, 0x08,
7582             NULL, HFILL }
7583         },
7584         { &hf_lmp_feature_afh_classification_slave,
7585           { "AFH Classification Slave",               "bthci_evt.lmp_features.afh_classification_slave",
7586             FT_BOOLEAN, 8, NULL, 0x10,
7587             NULL, HFILL }
7588         },
7589         { &hf_lmp_feature_br_edr_not_supported,
7590           { "BR/EDR Not Supported",                   "bthci_evt.lmp_features.br_edr_not_supported",
7591             FT_BOOLEAN, 8, NULL, 0x20,
7592             NULL, HFILL }
7593         },
7594         { &hf_lmp_feature_le_supported_controller,
7595           { "LE Supported Controller",                "bthci_evt.lmp_features.le_supported_controller",
7596             FT_BOOLEAN, 8, NULL, 0x40,
7597             NULL, HFILL }
7598         },
7599         { &hf_lmp_feature_3slot_edr_acl_packets,
7600           { "3-slot EDR ACL packets",                 "bthci_evt.lmp_features.3slot_edr_acl_packets",
7601             FT_BOOLEAN, 8, NULL, 0x80,
7602             NULL, HFILL }
7603         },
7604         { &hf_lmp_feature_5slot_edr_acl_packets,
7605           { "5-slot EDR ACL packets",                 "bthci_evt.lmp_features.5slot_edr_acl_packets",
7606             FT_BOOLEAN, 8, NULL, 0x01,
7607             NULL, HFILL }
7608         },
7609         { &hf_lmp_feature_sniff_subrating,
7610           { "Sniff Subrating",                        "bthci_evt.lmp_features.sniff_subrating",
7611             FT_BOOLEAN, 8, NULL, 0x02,
7612             NULL, HFILL }
7613         },
7614         { &hf_lmp_feature_pause_encryption,
7615           { "Pause Encryption",                       "bthci_evt.lmp_features.pause_encryption",
7616             FT_BOOLEAN, 8, NULL, 0x04,
7617             NULL, HFILL }
7618         },
7619         { &hf_lmp_feature_afh_capable_master,
7620           { "AFH Capable Master",                     "bthci_evt.lmp_features.afh_capable_master",
7621             FT_BOOLEAN, 8, NULL, 0x08,
7622             NULL, HFILL }
7623         },
7624         { &hf_lmp_feature_afh_classification_master,
7625           { "AFH Classification Master",              "bthci_evt.lmp_features.afh_classification_master",
7626             FT_BOOLEAN, 8, NULL, 0x10,
7627             NULL, HFILL }
7628         },
7629         { &hf_lmp_feature_edr_esco_2mbps_mode,
7630           { "EDR eSCO 2 Mbps Mode",                   "bthci_evt.lmp_features.edr_esco_2mbps_mode",
7631             FT_BOOLEAN, 8, NULL, 0x20,
7632             NULL, HFILL }
7633         },
7634         { &hf_lmp_feature_edr_esco_3mbps_mode,
7635           { "EDR eSCO 3 Mbps Mode",                   "bthci_evt.lmp_features.edr_esco_3mbps_mode",
7636             FT_BOOLEAN, 8, NULL, 0x40,
7637             NULL, HFILL }
7638         },
7639         { &hf_lmp_feature_3slot_edr_esco_packets,
7640           { "3-slot EDR eSCO Packets",                "bthci_evt.lmp_features.3slot_edr_esco_packets",
7641             FT_BOOLEAN, 8, NULL, 0x80,
7642             NULL, HFILL }
7643         },
7644         { &hf_lmp_feature_extended_inquiry_response,
7645           { "Extended Inquiry Response",              "bthci_evt.lmp_features.extended_inquiry_response",
7646             FT_BOOLEAN, 8, NULL, 0x01,
7647             NULL, HFILL }
7648         },
7649         { &hf_lmp_feature_simultaneous_le_and_br_edr_controller,
7650           {"Simultaneous LE and BR/EDR to Same Device Capable Controller", "bthci_evt.lmp_features.simultaneous_le_and_br_edr.controller",
7651            FT_BOOLEAN, 8, NULL, 0x02,
7652            NULL, HFILL}
7653         },
7654         { &hf_lmp_feature_reserved_50,
7655           { "Reserved",                               "bthci_evt.lmp_features.reserved.50",
7656             FT_BOOLEAN, 8, NULL, 0x04,
7657             NULL, HFILL }
7658         },
7659         { &hf_lmp_feature_secure_simple_pairing,
7660           { "Secure Simple Pairing",                  "bthci_evt.lmp_features.secure_simple_pairing",
7661             FT_BOOLEAN, 8, NULL, 0x08,
7662             NULL, HFILL }
7663         },
7664         { &hf_lmp_feature_encapsulated_pdu,
7665           { "Encapsulated PDU",                       "bthci_evt.lmp_features.encapsulated_pdu",
7666             FT_BOOLEAN, 8, NULL, 0x10,
7667             NULL, HFILL }
7668         },
7669         { &hf_lmp_feature_erroneous_data_reporting,
7670           { "Erroneous Data Reporting",               "bthci_evt.lmp_features.erroneous_data_reporting",
7671             FT_BOOLEAN, 8, NULL, 0x20,
7672             NULL, HFILL }
7673         },
7674         { &hf_lmp_feature_non_flushable_packet_boundary_flag,
7675           { "Non-flushable Packet Boundary Flag",     "bthci_evt.lmp_features.non_flushable_packet_boundary_flag",
7676             FT_BOOLEAN, 8, NULL, 0x40,
7677             NULL, HFILL }
7678         },
7679         { &hf_lmp_feature_reserved_55,
7680           { "Reserved",                               "bthci_evt.lmp_features.reserved.55",
7681             FT_BOOLEAN, 8, NULL, 0x80,
7682             NULL, HFILL }
7683         },
7684         { &hf_lmp_feature_link_supervision_timeout_changed_event,
7685           { "Link Supervision Timeout Changed Event", "bthci_evt.lmp_features.supervision_timeout_changed_event",
7686             FT_BOOLEAN, 8, NULL, 0x01,
7687             NULL, HFILL }
7688         },
7689         { &hf_lmp_feature_inquiry_tx_power_level,
7690           { "Inquiry TX Power Level",                 "bthci_evt.lmp_features.inquiry_tx_power_level",
7691             FT_BOOLEAN, 8, NULL, 0x02,
7692             NULL, HFILL }
7693         },
7694         { &hf_lmp_feature_enhanced_power_control,
7695           { "Enhanced Power Control",                 "bthci_evt.lmp_features.enhanced_power_control",
7696             FT_BOOLEAN, 8, NULL, 0x04,
7697             NULL, HFILL }
7698         },
7699         { &hf_lmp_feature_reserved_59_62,
7700           { "Reserved",                               "bthci_evt.lmp_features.reserved.59_62",
7701             FT_BOOLEAN, 8, NULL, 0x78,
7702             NULL, HFILL }
7703         },
7704         { &hf_lmp_feature_extended_features,
7705           { "Extended Features",                      "bthci_evt.lmp_features.extended_features",
7706             FT_BOOLEAN, 8, NULL, 0x80,
7707             NULL, HFILL }
7708         },
7709         { &hf_lmp_feature_secure_simple_pairing_host,
7710           {"Secure Simple Pairing Host",              "bthci_evt.lmp_features.secure_simple_pairing_host",
7711            FT_BOOLEAN, 8, NULL, 0x01,
7712            NULL, HFILL}
7713         },
7714         { &hf_lmp_feature_le_supported_host,
7715           {"LE Supported Host",                            "bthci_evt.lmp_features.le_supported.host",
7716            FT_BOOLEAN, 8, NULL, 0x02,
7717            NULL, HFILL}
7718         },
7719         { &hf_lmp_feature_simultaneous_le_and_br_edr_host,
7720           {"Simultaneous LE and BR/EDR to Same Device Capable Host", "bthci_evt.lmp_features.simultaneous_le_and_br_edr.host",
7721            FT_BOOLEAN, 8, NULL, 0x04,
7722            NULL, HFILL}
7723         },
7724         { &hf_lmp_feature_secure_connections_host,
7725           {"Secure Connections Host", "bthci_evt.lmp_features.secure_connections_host",
7726            FT_BOOLEAN, 8, NULL, 0x08,
7727            NULL, HFILL}
7728         },
7729         { &hf_lmp_feature_reserved_68_71,
7730           {"Reserved",                                "bthci_evt.lmp_features.reserved.68_71",
7731            FT_UINT8, BASE_HEX, NULL, 0xF0,
7732            NULL, HFILL}
7733         },
7734         { &hf_lmp_feature_csb_master_operation,
7735           {"Connectionless Slave Broadcast Master Operation",   "bthci_evt.lmp_features.csb_master_operation",
7736            FT_BOOLEAN, 8, NULL, 0x01,
7737            NULL, HFILL}
7738         },
7739         { &hf_lmp_feature_csb_slave_operation,
7740           {"Connectionless Slave Broadcast Slave Operation",    "bthci_evt.lmp_features.csb_slave_operation",
7741            FT_BOOLEAN, 8, NULL, 0x02,
7742            NULL, HFILL}
7743         },
7744         { &hf_lmp_feature_synchronization_train,
7745           {"Synchronization Train",             "bthci_evt.lmp_features.synchronization_train",
7746            FT_BOOLEAN, 8, NULL, 0x04,
7747            NULL, HFILL}
7748         },
7749         { &hf_lmp_feature_synchronization_scan,
7750           {"Synchronization Scan",              "bthci_evt.lmp_features.synchronization_scan",
7751            FT_BOOLEAN, 8, NULL, 0x08,
7752            NULL, HFILL}
7753         },
7754         { &hf_lmp_feature_inquiry_response_notification_event,
7755           {"Inquiry Response Notification Event", "bthci_evt.lmp_features.inquiry_response_notification_event",
7756            FT_BOOLEAN, 8, NULL, 0x10,
7757            NULL, HFILL}
7758         },
7759         { &hf_lmp_feature_generalized_interlaced_scan,
7760           {"Generalized Interlaced Scan",       "bthci_evt.lmp_features.generalized_interlaced_scan",
7761            FT_BOOLEAN, 8, NULL, 0x20,
7762            NULL, HFILL}
7763         },
7764         { &hf_lmp_feature_coarse_clock_adjustment,
7765           {"Coarse Clock Adjustment",           "bthci_evt.lmp_features.coarse_clock_adjustment",
7766            FT_BOOLEAN, 8, NULL, 0x40,
7767            NULL, HFILL}
7768         },
7769         { &hf_lmp_feature_reserved_135,
7770           {"Reserved",                          "bthci_evt.lmp_features.reserved_135",
7771            FT_BOOLEAN, 8, NULL, 0x80,
7772            NULL, HFILL}
7773         },
7774         { &hf_lmp_feature_secure_connections_controller,
7775           {"Secure Connections Controller",     "bthci_evt.lmp_features.secure_connections_controller",
7776            FT_BOOLEAN, 8, NULL, 0x01,
7777            NULL, HFILL}
7778         },
7779         { &hf_lmp_feature_ping,
7780           {"Ping",                              "bthci_evt.lmp_features.ping",
7781            FT_BOOLEAN, 8, NULL, 0x02,
7782            NULL, HFILL}
7783         },
7784         { &hf_lmp_feature_reserved_138,
7785           {"Reserved",                          "bthci_evt.lmp_features.reserved_138",
7786            FT_BOOLEAN, 8, NULL, 0x04,
7787            NULL, HFILL}
7788         },
7789         { &hf_lmp_feature_train_nudging,
7790           {"Train Nudging",                     "bthci_evt.lmp_features.train_nudging",
7791            FT_BOOLEAN, 8, NULL, 0x08,
7792            NULL, HFILL}
7793         },
7794         { &hf_lmp_feature_slot_availability_mask,
7795           {"Slot Availability Mask",            "bthci_evt.lmp_features.slot_availability_mask",
7796            FT_BOOLEAN, 8, NULL, 0x10,
7797            NULL, HFILL}
7798         },
7799         { &hf_lmp_feature_reserved,
7800           {"Reserved",                          "bthci_evt.lmp_features.reserved",
7801            FT_BYTES, BASE_NONE, NULL, 0x0,
7802            NULL, HFILL}
7803         },
7804         { &hf_bthci_evt_num_keys,
7805           { "Number of Link Keys",        "bthci_evt.num_keys",
7806             FT_UINT8, BASE_DEC, NULL, 0x0,
7807             "Number of Link Keys contained", HFILL }
7808         },
7809         { &hf_bthci_evt_num_keys_read,
7810           { "Number of Link Keys Read",        "bthci_evt.num_keys_read",
7811             FT_UINT16, BASE_DEC, NULL, 0x0,
7812             NULL, HFILL }
7813         },
7814         { &hf_bthci_evt_num_keys_deleted,
7815           { "Number of Link Keys Deleted",        "bthci_evt.num_keys_deleted",
7816             FT_UINT16, BASE_DEC, NULL, 0x0,
7817             NULL, HFILL }
7818         },
7819         { &hf_bthci_evt_num_keys_written,
7820           { "Number of Link Keys Written",        "bthci_evt.num_keys_written",
7821             FT_UINT8, BASE_DEC, NULL, 0x0,
7822             NULL, HFILL }
7823         },
7824         { &hf_bthci_evt_max_num_keys,
7825           { "Max Num Keys",        "bthci_evt.max_num_keys",
7826             FT_UINT16, BASE_DEC, NULL, 0x0,
7827             "Total Number of Link Keys that the Host Controller can store", HFILL }
7828         },
7829         { &hf_bthci_evt_num_responses,
7830           { "Number of responses",        "bthci_evt.num_responses",
7831             FT_UINT8, BASE_DEC, NULL, 0x0,
7832             "Number of Responses from Inquiry", HFILL }
7833         },
7834         { &hf_bthci_evt_link_policy_setting_switch,
7835           { "Enable Master Slave Switch", "bthci_evt.link_policy_switch",
7836             FT_BOOLEAN, 16, NULL, 0x0001,
7837             NULL, HFILL }
7838         },
7839         { &hf_bthci_evt_link_policy_setting_hold,
7840           { "Enable Hold Mode", "bthci_evt.link_policy_hold",
7841             FT_BOOLEAN, 16, NULL, 0x0002,
7842             NULL, HFILL }
7843         },
7844         { &hf_bthci_evt_link_policy_setting_sniff,
7845           { "Enable Sniff Mode", "bthci_evt.link_policy_sniff",
7846             FT_BOOLEAN, 16, NULL, 0x0004,
7847             NULL, HFILL }
7848         },
7849         { &hf_bthci_evt_link_policy_setting_park,
7850           { "Enable Park Mode", "bthci_evt.link_policy_park",
7851             FT_BOOLEAN, 16, NULL, 0x0008,
7852             NULL, HFILL }
7853         },
7854         { &hf_bthci_evt_curr_role,
7855           { "Current Role", "bthci_evt.curr_role",
7856             FT_UINT8, BASE_HEX, VALS(evt_role_vals_handle), 0x0,
7857             "Current role for this connection handle", HFILL }
7858         },
7859         { &hf_bthci_evt_pin_type,
7860           { "PIN Type", "bthci_evt.pin_type",
7861             FT_UINT8, BASE_HEX, VALS(evt_pin_types), 0x0,
7862             "PIN Types", HFILL }
7863         },
7864         { &hf_bthci_evt_device_name,
7865           { "Device Name",           "bthci_evt.device_name",
7866             FT_STRINGZ, BASE_NONE, NULL, 0x0,
7867             "Userfriendly descriptive name for the device", HFILL }
7868         },
7869         { &hf_bthci_evt_timeout,
7870           { "Timeout",        "bthci_evt.timeout",
7871             FT_UINT16, BASE_DEC, NULL, 0x0,
7872             "Number of Baseband slots for timeout.", HFILL }
7873         },
7874         { &hf_bthci_evt_scan_enable,
7875           { "Scan", "bthci_evt.scan_enable",
7876             FT_UINT8, BASE_HEX, VALS(bthci_cmd_scan_enable_values), 0x0,
7877             "Scan Enable", HFILL }
7878         },
7879         { &hf_bthci_evt_authentication_enable,
7880           { "Authentication", "bthci_evt.auth_enable",
7881             FT_UINT8, BASE_HEX, VALS(evt_auth_enable_values), 0x0,
7882             "Authentication Enable", HFILL }
7883         },
7884         { &hf_bthci_evt_sco_flow_cont_enable,
7885           { "SCO Flow Control", "bthci_evt.sco_flow_cont_enable",
7886             FT_UINT8, BASE_HEX, VALS(evt_enable_values), 0x0,
7887             "SCO Flow Control Enable", HFILL }
7888         },
7889         { &hf_bthci_evt_window,
7890           { "Window", "bthci_evt.window",
7891             FT_UINT16, BASE_DEC, NULL, 0x0,
7892             NULL, HFILL }
7893         },
7894         { &hf_bthci_evt_input_unused,
7895           { "Unused bits", "bthci_evt.voice.unused",
7896             FT_UINT16, BASE_HEX, NULL, 0xfc00,
7897             NULL, HFILL }
7898         },
7899         { &hf_bthci_evt_input_coding,
7900           { "Input Coding", "bthci_evt.voice.input_coding",
7901             FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_input_coding_vals_ext, 0x0300,
7902             NULL, HFILL }
7903         },
7904         { &hf_bthci_evt_input_data_format,
7905           { "Input Data Format", "bthci_evt.voice.input_data_format",
7906             FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_input_data_format_vals_ext, 0x00c0,
7907             NULL, HFILL }
7908         },
7909         { &hf_bthci_evt_input_sample_size,
7910           { "Input Sample Size", "bthci_evt.voice.input_sample_size",
7911             FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_input_sample_size_vals_ext, 0x0020,
7912             NULL, HFILL }
7913         },
7914         { &hf_bthci_evt_linear_pcm_bit_pos,
7915           { "Linear PCM Bit Position", "bthci_evt.voice.linear_pcm_bit_pos",
7916             FT_UINT16, BASE_DEC, NULL, 0x001c,
7917             "# bit pos. that MSB of sample is away from starting at MSB", HFILL }
7918         },
7919         { &hf_bthci_evt_air_coding_format,
7920           { "Air Coding Format", "bthci_evt.voice.air_coding_format",
7921             FT_UINT16, BASE_DEC | BASE_EXT_STRING, &bthci_cmd_air_coding_format_vals_ext, 0x0003,
7922             NULL, HFILL }
7923         },
7924         { &hf_bthci_evt_num_broadcast_retransm,
7925           { "Num Broadcast Retran", "bthci_evt.num_broad_retran",
7926             FT_UINT8, BASE_DEC, NULL, 0x0,
7927             "Number of Broadcast Retransmissions", HFILL }
7928         },
7929         { &hf_bthci_evt_hold_mode_act_page,
7930           { "Suspend Page Scan", "bthci_evt.hold_mode_page",
7931             FT_BOOLEAN, 8, NULL, 0x1,
7932             "Device can enter low power state", HFILL }
7933         },
7934         { &hf_bthci_evt_hold_mode_act_inquiry,
7935           { "Suspend Inquiry Scan", "bthci_evt.hold_mode_inquiry",
7936             FT_BOOLEAN, 8, NULL, 0x2,
7937             "Device can enter low power state", HFILL }
7938         },
7939         { &hf_bthci_evt_hold_mode_act_periodic,
7940           { "Suspend Periodic Inquiries", "bthci_evt.hold_mode_periodic",
7941             FT_BOOLEAN, 8, NULL, 0x4,
7942             "Device can enter low power state", HFILL }
7943         },
7944         { &hf_bthci_evt_transmit_power_level,
7945           { "Transmit Power Level", "bthci_evt.transmit_power_level",
7946             FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0,
7947             NULL, HFILL }
7948         },
7949         { &hf_bthci_evt_max_transmit_power_level,
7950           { "Maximum Transmit Power Level", "bthci_evt.max_transmit_power_level",
7951             FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0,
7952             NULL, HFILL }
7953         },
7954         { &hf_bthci_evt_num_supp_iac,
7955           {"Num Support IAC", "bthci_evt.num_supp_iac",
7956            FT_UINT8, BASE_DEC, NULL, 0x0,
7957            "Num of supported IAC the device can simultaneously listen", HFILL }
7958         },
7959         { &hf_bthci_evt_num_curr_iac,
7960           {"Num Current IAC", "bthci_evt.num_curr_iac",
7961            FT_UINT8, BASE_DEC, NULL, 0x0,
7962            "Num of IACs currently in use to simultaneously listen", HFILL }
7963         },
7964         { &hf_bthci_evt_iac_lap,
7965           { "IAC LAP", "bthci_evt.iac_lap",
7966             FT_UINT24, BASE_HEX, NULL, 0x0,
7967             "LAP(s)used to create IAC", HFILL }
7968         },
7969         { &hf_bthci_evt_loopback_mode,
7970           {"Loopback Mode", "bthci_evt.loopback_mode",
7971            FT_UINT8, BASE_HEX, VALS(evt_loopback_modes), 0x0,
7972            NULL, HFILL }
7973         },
7974         { &hf_bthci_evt_country_code,
7975           {"Country Code", "bthci_evt.country_code",
7976            FT_UINT8, BASE_HEX, VALS(evt_country_code_values), 0x0,
7977            NULL, HFILL }
7978         },
7979         { &hf_bthci_evt_failed_contact_counter,
7980           {"Failed Contact Counter", "bthci_evt.failed_contact_counter",
7981            FT_UINT16, BASE_DEC, NULL, 0x0,
7982            NULL, HFILL }
7983         },
7984         { &hf_bthci_evt_link_quality,
7985           {"Link Quality", "bthci_evt.link_quality",
7986            FT_UINT8, BASE_DEC, NULL, 0x0,
7987            "Link Quality (0x00 - 0xFF Higher Value = Better Link)", HFILL }
7988         },
7989         { &hf_bthci_evt_rssi,
7990           { "RSSI", "bthci_evt.rssi",
7991             FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0,
7992             NULL, HFILL }
7993         },
7994         { &hf_bthci_evt_host_data_packet_length_acl,
7995           {"Host ACL Data Packet Length (bytes)", "bthci_evt.max_data_length_acl",
7996            FT_UINT16, BASE_DEC, NULL, 0x0,
7997            "Max Host ACL Data Packet length of data portion host is able to accept", HFILL }
7998         },
7999         { &hf_bthci_evt_host_data_packet_length_sco,
8000           {"Host SCO Data Packet Length (bytes)", "bthci_evt.max_data_length_sco",
8001            FT_UINT8, BASE_DEC, NULL, 0x0,
8002            "Max Host SCO Data Packet length of data portion host is able to accept", HFILL }
8003         },
8004         { &hf_bthci_evt_host_total_num_acl_data_packets,
8005           {"Host Total Num ACL Data Packets", "bthci_evt.max_data_num_acl",
8006            FT_UINT16, BASE_DEC, NULL, 0x0,
8007            "Total Number of HCI ACL Data Packets that can be stored in the data buffers of the Host", HFILL }
8008         },
8009         { &hf_bthci_evt_host_total_num_sco_data_packets,
8010           {"Host Total Num SCO Data Packets", "bthci_evt.max_data_num_sco",
8011            FT_UINT16, BASE_DEC, NULL, 0x0,
8012            "Total Number of HCI SCO Data Packets that can be stored in the data buffers of the Host", HFILL }
8013         },
8014         { &hf_bthci_evt_page_number,
8015           {"Page Number", "bthci_evt.page_number",
8016            FT_UINT8, BASE_DEC, NULL, 0x0,
8017            NULL, HFILL}
8018         },
8019         { &hf_bthci_evt_max_page_number,
8020           {"Max. Page Number", "bthci_evt.max_page_number",
8021            FT_UINT8, BASE_DEC, NULL, 0x0,
8022            NULL, HFILL}
8023         },
8024         { &hf_bthci_evt_local_supported_cmds,
8025           { "Local Supported Commands",        "bthci_evt.local_supported_cmds",
8026             FT_BYTES, BASE_NONE, NULL, 0x0,
8027             NULL, HFILL }
8028         },
8029         { &hf_bthci_evt_fec_required,
8030           {"FEC Required", "bthci_evt.fec_required",
8031            FT_BOOLEAN, 8, NULL, 0x0,
8032            NULL, HFILL}
8033         },
8034         { &hf_bthci_evt_err_data_reporting,
8035           {"Erroneous Data Reporting", "bthci_evt.err_data_reporting",
8036            FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
8037            NULL, HFILL}
8038         },
8039         { &hf_bthci_evt_scan_type,
8040           {"Scan Type", "bthci_evt.inq_scan_type",
8041            FT_UINT8, BASE_DEC, VALS(evt_scan_types), 0x0,
8042            NULL, HFILL}
8043         },
8044         { &hf_bthci_evt_inq_mode,
8045           {"Inquiry Mode", "bthci_evt.inq_mode",
8046            FT_UINT8, BASE_DEC, VALS(bthci_cmd_inq_modes), 0x0,
8047            NULL, HFILL}
8048         },
8049         { &hf_bthci_evt_power_level_type,
8050           {"Type", "bthci_evt.power_level_type",
8051            FT_UINT8, BASE_HEX, VALS(evt_power_level_types), 0x0,
8052            NULL, HFILL}
8053         },
8054         { &hf_bthci_evt_sync_link_type,
8055           {"Link Type", "bthci_evt.sync_link_type",
8056            FT_UINT8, BASE_HEX, VALS(evt_sync_link_types), 0x0,
8057            NULL, HFILL}
8058         },
8059         { &hf_bthci_evt_sync_tx_interval,
8060           {"Transmit Interval", "bthci_evt.sync_tx_interval",
8061            FT_UINT8, BASE_DEC, NULL, 0x0,
8062            NULL, HFILL}
8063         },
8064         { &hf_bthci_evt_le_local_p_256_public_key,
8065           { "Local-256_Public_Key", "bthci_evt.le_local_p_256_public_key",
8066             FT_BYTES, BASE_NONE, NULL, 0x0,
8067             NULL, HFILL }
8068         },
8069         { &hf_bthci_evt_le_dhkey,
8070           { "DHKey", "bthci_evt.dhkey",
8071             FT_BYTES, BASE_NONE, NULL, 0x0,
8072             NULL, HFILL }
8073         },
8074         { &hf_bthci_evt_sync_rtx_window,
8075           {"Retransmit Window", "bthci_evt.sync_rtx_window",
8076            FT_UINT8, BASE_DEC, NULL, 0x0,
8077            NULL, HFILL}
8078         },
8079         { &hf_bthci_evt_sync_rx_packet_length,
8080           {"Rx Packet Length", "bthci_evt.sync_rx_pkt_len",
8081            FT_UINT16, BASE_DEC, NULL, 0x0,
8082            NULL, HFILL}
8083         },
8084         { &hf_bthci_evt_sync_tx_packet_length,
8085           {"Tx Packet Length", "bthci_evt.sync_tx_pkt_len",
8086            FT_UINT16, BASE_DEC, NULL, 0x0,
8087            NULL, HFILL}
8088         },
8089         { &hf_bthci_evt_air_mode,
8090           {"Air Mode", "bthci_evt.air_mode",
8091            FT_UINT8, BASE_DEC, VALS(evt_air_mode_vals), 0x0,
8092            NULL, HFILL}
8093         },
8094         { &hf_bthci_evt_max_tx_latency,
8095           {"Max. Tx Latency", "bthci_evt.max_tx_latency",
8096            FT_UINT16, BASE_DEC, NULL, 0x0,
8097            NULL, HFILL}
8098         },
8099         { &hf_bthci_evt_max_rx_latency,
8100           {"Max. Rx Latency", "bthci_evt.max_rx_latency",
8101            FT_UINT16, BASE_DEC, NULL, 0x0,
8102            NULL, HFILL}
8103         },
8104         { &hf_bthci_evt_min_remote_timeout,
8105           {"Min. Remote Timeout", "bthci_evt.min_remote_timeout",
8106            FT_UINT16, BASE_DEC, NULL, 0x0,
8107            NULL, HFILL}
8108         },
8109         { &hf_bthci_evt_min_local_timeout,
8110           {"Min. Local Timeout", "bthci_evt.min_local_timeout",
8111            FT_UINT16, BASE_DEC, NULL, 0x0,
8112            NULL, HFILL}
8113         },
8114         { &hf_bthci_evt_link_supervision_timeout,
8115           {"Link Supervision Timeout", "bthci_evt.link_supervision_timeout",
8116            FT_UINT16, BASE_DEC, NULL, 0x0,
8117            NULL, HFILL}
8118         },
8119         { &hf_bthci_evt_token_bucket_size,
8120           { "Token Bucket Size",        "bthci_evt.token_bucket_size",
8121             FT_UINT32, BASE_DEC, NULL, 0x0,
8122             "Token Bucket Size (bytes)", HFILL }
8123         },
8124         { &hf_bthci_evt_flow_direction,
8125           {"Flow Direction", "bthci_evt.flow_direction",
8126            FT_UINT8, BASE_DEC, VALS(evt_flow_direction_values), 0x0,
8127            NULL, HFILL}
8128         },
8129         { &hf_bthci_evt_afh_ch_assessment_mode,
8130           {"AFH Channel Assessment Mode", "bthci_evt.afh_ch_assessment_mode",
8131            FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
8132            NULL, HFILL}
8133         },
8134         { &hf_bthci_evt_lmp_handle,
8135           { "LMP Handle",             "bthci_evt.lmp_handle",
8136             FT_UINT16, BASE_HEX, NULL, 0x0,
8137             NULL, HFILL }
8138         },
8139         { &hf_bthci_evt_clock,
8140           { "Clock",        "bthci_evt.clock",
8141             FT_UINT32, BASE_HEX, NULL, 0x0,
8142             NULL, HFILL }
8143         },
8144         { &hf_bthci_evt_clock_accuracy,
8145           { "Clock",        "bthci_evt.clock_accuracy",
8146             FT_UINT16, BASE_HEX, NULL, 0x0,
8147             NULL, HFILL }
8148         },
8149         { &hf_bthci_evt_afh_mode,
8150           {"AFH Mode", "bthci_evt.afh_mode",
8151            FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
8152            NULL, HFILL}
8153         },
8154 /* TODO: More detailed dissection */
8155         { &hf_bthci_evt_afh_channel_map,
8156           {"AFH Channel Map", "bthci_evt.afh_channel_map",
8157            FT_BYTES, BASE_NONE, NULL, 0x0,
8158            NULL, HFILL}
8159         },
8160         { &hf_bthci_evt_simple_pairing_mode,
8161           {"Simple Pairing Mode", "bthci_evt.simple_pairing_mode",
8162            FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
8163            NULL, HFILL}
8164         },
8165         { &hf_bthci_evt_hash_c,
8166           {"Hash C", "bthci_evt.hash_c",
8167            FT_BYTES, BASE_NONE, NULL, 0x0,
8168            NULL, HFILL}
8169         },
8170         { &hf_bthci_evt_randomizer_r,
8171           {"Randomizer R", "bthci_evt.randomizer_r",
8172            FT_BYTES, BASE_NONE, NULL, 0x0,
8173            NULL, HFILL}
8174         },
8175         { &hf_bthci_evt_io_capability,
8176           {"IO Capability", "bthci_evt.io_capability",
8177            FT_UINT8, BASE_HEX, VALS(bthci_cmd_io_capability_vals), 0x0,
8178            NULL, HFILL}
8179         },
8180         { &hf_bthci_evt_oob_data_present,
8181           {"OOB Data Present", "bthci_evt.oob_data_present",
8182            FT_UINT8, BASE_DEC, VALS(bthci_cmd_oob_data_present_vals), 0x0,
8183            NULL, HFILL}
8184         },
8185         { &hf_bthci_evt_auth_requirements,
8186           {"Authentication Requirements", "bthci_evt.auth_requirements",
8187            FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bthci_cmd_auth_req_vals_ext, 0x0,
8188            NULL, HFILL}
8189         },
8190         { &hf_bthci_evt_numeric_value,
8191           {"Numeric Value", "bthci_evt.numeric_value",
8192            FT_UINT32, BASE_DEC, NULL, 0x0,
8193            NULL, HFILL}
8194         },
8195         { &hf_bthci_evt_passkey,
8196           {"Passkey", "bthci_evt.passkey",
8197            FT_UINT32, BASE_DEC, NULL, 0x0,
8198            NULL, HFILL}
8199         },
8200         { &hf_bthci_evt_notification_type,
8201           {"Notification Type", "bthci_evt.notification_type",
8202            FT_UINT8, BASE_DEC, VALS(bthci_cmd_notification_types), 0x0,
8203            NULL, HFILL}
8204         },
8205         { &hf_bthci_evt_data_length,
8206           { "Data Length",           "bthci_evt.data_length",
8207             FT_UINT8, BASE_DEC, NULL, 0x0,
8208             NULL, HFILL }
8209         },
8210         { &hf_bthci_evt_location_domain_aware,
8211           { "Location Domain Aware", "bthci_evt.location_domain_aware",
8212             FT_BOOLEAN, 8, NULL, 0x0,
8213             NULL, HFILL }
8214         },
8215         { &hf_bthci_evt_location_domain,
8216           { "Location Domain", "bthci_evt.location_domain",
8217             FT_STRING, BASE_NONE, NULL, 0x0,
8218             "ISO 3166-1 Country Code", HFILL }
8219         },
8220         { &hf_bthci_evt_location_domain_options,
8221           { "Location Domain Options", "bthci_evt.location_domain_options",
8222             FT_STRING, BASE_NONE, NULL, 0x0,
8223             NULL, HFILL }
8224         },
8225         { &hf_bthci_evt_location_options,
8226           { "Location Options", "bthci_evt.location_options",
8227             FT_UINT8, BASE_HEX, NULL, 0x0,
8228             NULL, HFILL }
8229         },
8230         { &hf_bthci_evt_flow_control_mode,
8231           { "Flow Control Mode", "bthci_evt.flow_control_mode",
8232             FT_UINT8, BASE_HEX, VALS(evt_flow_ctrl_mode), 0x0,
8233             NULL, HFILL }
8234         },
8235         { &hf_bthci_evt_physical_link_handle,
8236           { "Physical Link Handle", "bthci_evt.physical_link_handle",
8237             FT_UINT8, BASE_HEX, NULL, 0x0,
8238             NULL, HFILL }
8239         },
8240         { &hf_bthci_evt_flow_spec_identifier,
8241           { "Flow Spec Identifier", "bthci_evt.flow_spec_id",
8242             FT_UINT8, BASE_HEX, NULL, 0x0,
8243             NULL, HFILL }
8244         },
8245         { &hf_bthci_evt_logical_link_handle,
8246           { "Logical Link Handle", "bthci_evt.logical_link_handle",
8247             FT_UINT16, BASE_HEX, NULL, 0x0,
8248             NULL, HFILL}
8249         },
8250         { &hf_bthci_evt_max_acl_data_packet_length,
8251           { "Max. ACL Data Packet Length", "bthci_evt.max_acl_data_packet_length",
8252             FT_UINT16, BASE_HEX, NULL, 0x0,
8253             NULL, HFILL}
8254         },
8255         { &hf_bthci_evt_data_block_length,
8256           { "Max. Data Block Length", "bthci_evt.data_block_length",
8257             FT_UINT16, BASE_HEX, NULL, 0x0,
8258             NULL, HFILL}
8259         },
8260         { &hf_bthci_evt_total_num_data_blocks,
8261           { "Total Number of Data Blocks", "bthci_evt.total_num_data_blocks",
8262             FT_UINT16, BASE_HEX, NULL, 0x0,
8263             NULL, HFILL}
8264         },
8265         { &hf_bthci_evt_enc_key_size,
8266           { "Encryption Key Size", "bthci_evt.enc_key_size",
8267             FT_INT8, BASE_DEC, NULL, 0x0,
8268             NULL, HFILL }
8269         },
8270         { &hf_bthci_evt_amp_remaining_assoc_length,
8271           { "AMP Remaining Assoc Length", "bthci_evt.amp_remaining_assoc_length",
8272             FT_UINT16, BASE_DEC, 0x0, 0x0,
8273             NULL, HFILL }
8274         },
8275         { &hf_bthci_evt_amp_assoc_fragment,
8276           { "AMP Assoc Fragment", "bthci_evt.amp_assoc_fragment",
8277             FT_BYTES, BASE_NONE, 0x0, 0x0,
8278             NULL, HFILL }
8279         },
8280         { &hf_bthci_evt_amp_status,
8281           { "AMP Status", "bthci_evt.amp_status",
8282             FT_UINT8, BASE_HEX, VALS(evt_amp_status), 0x0,
8283             NULL, HFILL }
8284         },
8285         { &hf_bthci_evt_total_bandwidth,
8286           { "Total Bandwidth (kbps)", "bthci_evt.total_bandwidth",
8287             FT_UINT32, BASE_DEC, 0x0, 0x0,
8288             NULL, HFILL }
8289         },
8290         { &hf_bthci_evt_max_guaranteed_bandwidth,
8291           { "Max Guaranteed Bandwidth (kbps)", "bthci_evt.max_guaranteed_bandwidth",
8292             FT_UINT32, BASE_DEC, 0x0, 0x0,
8293             NULL, HFILL }
8294         },
8295         { &hf_bthci_evt_min_latency,
8296           { "Min Latency (us)", "bthci_evt.min_latency",
8297             FT_UINT32, BASE_DEC, 0x0, 0x0,
8298             NULL, HFILL }
8299         },
8300         { &hf_bthci_evt_max_pdu_size,
8301           { "Max PDU Size", "bthci_evt.max_pdu_size",
8302             FT_UINT32, BASE_DEC, 0x0, 0x0,
8303             NULL, HFILL }
8304         },
8305         { &hf_bthci_evt_amp_controller_type,
8306           { "Controller Type", "bthci_evt.controller_type",
8307             FT_UINT8, BASE_HEX, VALS(bthci_evt_controller_types), 0x0,
8308             NULL, HFILL }
8309         },
8310         { &hf_bthci_evt_pal_capabilities_00,
8311           { "Guaranteed Service",        "bthci_evt.pal_capabilities",
8312             FT_BOOLEAN, 16, NULL, 0x0001,
8313             NULL, HFILL }
8314         },
8315         { &hf_bthci_evt_max_amp_assoc_length,
8316           { "Max AMP Assoc Length", "bthci_evt.max_amp_assoc_length",
8317             FT_UINT32, BASE_DEC, 0x0, 0x0,
8318             NULL, HFILL }
8319         },
8320         { &hf_bthci_evt_max_flush_to_us,
8321           { "Max Flush Timeout (us)", "bthci_evt.max_flush_to",
8322             FT_UINT32, BASE_DEC, 0x0, 0x0,
8323             NULL, HFILL }
8324         },
8325         { &hf_bthci_evt_best_effort_flush_to_us,
8326           { "Best Effort Flush Timeout (us)", "bthci_evt.best_effort_flush_to",
8327             FT_UINT32, BASE_DEC, 0x0, 0x0,
8328             NULL, HFILL }
8329         },
8330         { &hf_bthci_evt_link_loss_reason,
8331           { "Reason", "bthci_evt.link_loss_reason",
8332             FT_UINT8, BASE_HEX, VALS(evt_link_loss_reasons), 0x0,
8333             NULL, HFILL }
8334         },
8335         { &hf_bthci_evt_num_compl_blocks,
8336           { "Number Of Completed Blocks", "bthci_evt.num_compl_blocks",
8337             FT_UINT16, BASE_DEC, NULL, 0x0,
8338             NULL, HFILL }
8339         },
8340         { &hf_bthci_evt_test_scenario,
8341           { "Test Scenario", "bthci_evt.test_scenario",
8342             FT_UINT8, BASE_HEX, NULL, 0x0,
8343             NULL, HFILL }
8344         },
8345         { &hf_bthci_evt_report_reason,
8346           { "Reason", "bthci_evt.report_reason",
8347             FT_UINT8, BASE_HEX, VALS(evt_report_reasons), 0x0,
8348             NULL, HFILL }
8349         },
8350         { &hf_bthci_evt_report_event_type,
8351           { "Report Event Type", "bthci_evt.report_event_type",
8352             FT_UINT8, BASE_HEX, VALS(evt_report_event_types), 0x0,
8353             NULL, HFILL }
8354         },
8355         { &hf_bthci_evt_num_frames,
8356           { "Number Of Frames", "bthci_evt.num_frames",
8357             FT_UINT16, BASE_DEC, NULL, 0x0,
8358             NULL, HFILL }
8359         },
8360         { &hf_bthci_evt_num_error_frames,
8361           { "Number Of Error Frames", "bthci_evt.num_error_frames",
8362             FT_UINT16, BASE_DEC, NULL, 0x0,
8363             NULL, HFILL }
8364         },
8365         { &hf_bthci_evt_num_bits,
8366           { "Number Of Bits", "bthci_evt.num_bits",
8367             FT_UINT32, BASE_DEC, NULL, 0x0,
8368             NULL, HFILL }
8369         },
8370         { &hf_bthci_evt_num_error_bits,
8371           { "Number Of Error Bits", "bthci_evt.num_error_bits",
8372             FT_UINT32, BASE_DEC, NULL, 0x0,
8373             NULL, HFILL }
8374         },
8375         { &hf_bthci_evt_short_range_mode_state,
8376           { "Short Range Mode State",        "bthci_evt.short_range_mode_state",
8377             FT_BOOLEAN, 8, NULL, 0x0,
8378             NULL, HFILL }
8379         },
8380         { &hf_bthci_evt_transmit_power_level_gfsk,
8381           { "Transmit Power Level GFSK (dBm)", "bthci_evt.transmit_power_level_gfsk",
8382             FT_INT8, BASE_DEC, NULL, 0x0,
8383             NULL, HFILL }
8384         },
8385         { &hf_bthci_evt_transmit_power_level_dqpsk,
8386           { "Transmit Power Level DQPSK (dBm)", "bthci_evt.transmit_power_level_dqpsk",
8387             FT_INT8, BASE_DEC, NULL, 0x0,
8388             NULL, HFILL }
8389         },
8390         { &hf_bthci_evt_transmit_power_level_8dpsk,
8391           { "Transmit Power Level 8DPSK (dBm)", "bthci_evt.transmit_power_level_8dpsk",
8392             FT_INT8, BASE_DEC, NULL, 0x0,
8393             NULL, HFILL }
8394         },
8395         { &hf_bthci_evt_flush_to_us,
8396           { "Flush Timeout (us)",  "bthci_evt.flushto",
8397             FT_UINT32, BASE_DEC, NULL, 0x0,
8398             NULL, HFILL }
8399         },
8400         { &hf_bthci_evt_le_supported_host,
8401           { "LE Supported Host", "bthci_evt.le_supported_host",
8402             FT_BOOLEAN, 8, NULL, 0x0,
8403             NULL, HFILL }
8404         },
8405         { &hf_bthci_evt_le_simultaneous_host,
8406           { "Simultaneous LE Host", "bthci_evt.le_simultaneous_host",
8407             FT_BOOLEAN, 8, NULL, 0x0,
8408             "Support for both LE and BR/EDR to same device", HFILL }
8409         },
8410         { &hf_bthci_evt_le_acl_data_pkt_len,
8411           { "LE ACL Data Packet Length", "bthci_evt.le_acl_data_pkt_len",
8412             FT_UINT16, BASE_DEC, NULL, 0x0,
8413             NULL, HFILL }
8414         },
8415         { &hf_bthci_evt_total_num_le_acl_data_pkts,
8416           { "Total Number LE ACL Data Packets", "bthci_evt.le_total_num_acl_data_pkts",
8417             FT_UINT8, BASE_DEC, NULL, 0x0,
8418             NULL, HFILL }
8419         },
8420         { &hf_bthci_evt_iso_data_pkt_len,
8421           { "ISO Data Packet Length", "bthci_evt.iso_data_pkt_len",
8422             FT_UINT16, BASE_DEC, NULL, 0x0,
8423             NULL, HFILL }
8424         },
8425         { &hf_bthci_evt_total_num_iso_data_pkts,
8426           { "Total Number ISO Data Packets", "bthci_evt.total_num_iso_data_pkts",
8427             FT_UINT8, BASE_DEC, NULL, 0x0,
8428             NULL, HFILL }
8429         },
8430         { &hf_bthci_evt_white_list_size,
8431           { "White List Size",        "bthci_evt.le_white_list_size",
8432             FT_UINT8, BASE_DEC, NULL, 0x0,
8433             "Max. total whitelist entries storable in controller", HFILL }
8434         },
8435         { &hf_bthci_evt_le_channel_map,
8436           { "Channel Map", "bthci_evt.le_channel_map",
8437             FT_BYTES, BASE_NONE, NULL, 0x0,
8438             NULL, HFILL }
8439         },
8440         { &hf_bthci_evt_encrypted_data,
8441           { "Plaintext",        "bthci_evt.le_encrypted_data",
8442             FT_BYTES, BASE_NONE, NULL, 0x0,
8443             NULL, HFILL }
8444         },
8445         { &hf_bthci_evt_random_number,
8446           { "Random Number",        "bthci_evt.le_random_number",
8447             FT_BYTES, BASE_NONE, NULL, 0x0,
8448             NULL, HFILL }
8449         },
8450         { &hf_bthci_evt_le_num_packets,
8451           { "Number of Packets",        "bthci_evt.le_num_packets",
8452             FT_UINT16, BASE_DEC, NULL, 0x0,
8453             NULL, HFILL }
8454         },
8455         { &hf_bthci_evt_le_meta_subevent,
8456           { "Sub Event",        "bthci_evt.le_meta_subevent",
8457             FT_UINT8, BASE_HEX, VALS(evt_le_meta_subevent), 0x00,
8458             NULL, HFILL }
8459         },
8460         { &hf_bthci_evt_le_peer_address_type,
8461           { "Peer Address Type", "bthci_evt.le_peer_address_type",
8462             FT_UINT8, BASE_HEX, VALS(bthci_cmd_address_types_vals), 0x0,
8463             NULL, HFILL }
8464         },
8465         { &hf_bthci_evt_le_local_rpa,
8466           { "Local Resolvable Private Address",          "bthci_evt.le_local_rpa",
8467             FT_ETHER, BASE_NONE, NULL, 0x0,
8468             NULL, HFILL}
8469         },
8470         { &hf_bthci_evt_le_peer_rpa,
8471           { "Peer Resolvable Private Address",          "bthci_evt.le_peer_rpa",
8472             FT_ETHER, BASE_NONE, NULL, 0x0,
8473             NULL, HFILL}
8474         },
8475         { &hf_bthci_evt_le_con_interval,
8476           { "Connection Interval", "bthci_evt.le_con_interval",
8477             FT_UINT16, BASE_DEC, NULL, 0x0,
8478             NULL, HFILL }
8479         },
8480         { &hf_bthci_evt_le_min_interval,
8481           { "Min Connection Interval", "bthci_evt.le_min_interval",
8482             FT_UINT16, BASE_DEC, NULL, 0x0,
8483             NULL, HFILL }
8484         },
8485         { &hf_bthci_evt_le_max_interval,
8486           { "Min Connection Interval", "bthci_evt.le_max_interval",
8487             FT_UINT16, BASE_DEC, NULL, 0x0,
8488             NULL, HFILL }
8489         },
8490         { &hf_bthci_evt_le_con_latency,
8491           { "Connection Latency", "bthci_evt.le_con_latency",
8492             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_number_events, 0x0,
8493             NULL, HFILL }
8494         },
8495         { &hf_bthci_evt_le_supervision_timeout,
8496           { "Supervision Timeout", "bthci_evt.le_supv_timeout",
8497             FT_UINT16, BASE_DEC, NULL, 0x0,
8498             NULL, HFILL }
8499         },
8500         { &hf_bthci_evt_le_max_tx_octets,
8501           { "Max TX Octets", "bthci_evt.max_tx_octets",
8502             FT_UINT16, BASE_DEC, NULL, 0x0,
8503             NULL, HFILL }
8504         },
8505         { &hf_bthci_evt_le_max_tx_time,
8506           { "Max TX Time", "bthci_evt.max_tx_time",
8507             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
8508             NULL, HFILL }
8509         },
8510         { &hf_bthci_evt_le_max_rx_octets,
8511           { "Max RX Octets", "bthci_evt.max_rx_octets",
8512             FT_UINT16, BASE_DEC, NULL, 0x0,
8513             NULL, HFILL }
8514         },
8515         { &hf_bthci_evt_le_max_rx_time,
8516           { "Max RX Time", "bthci_evt.max_rx_time",
8517             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
8518             NULL, HFILL }
8519         },
8520         { &hf_bthci_evt_encrypted_diversifier,
8521           { "Encrypted Diversifier", "bthci_evt.le_encrypted_diversifier",
8522             FT_UINT16, BASE_HEX, NULL, 0x0,
8523             NULL, HFILL }
8524         },
8525         { &hf_bthci_evt_le_master_clock_accuracy,
8526           { "Master Clock Accuracy", "bthci_evt.le_master_clock_accuracy",
8527             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_clock_accuray_vals_ext, 0x0,
8528             NULL, HFILL }
8529         },
8530         { &hf_bthci_evt_num_reports,
8531           { "Num Reports", "bthci_evt.le_num_reports",
8532             FT_UINT8, BASE_DEC, NULL, 0x0,
8533             NULL, HFILL }
8534         },
8535         { &hf_bthci_evt_advts_event_type,
8536           { "Event Type", "bthci_evt.le_advts_event_type",
8537             FT_UINT8, BASE_HEX, VALS(evt_le_advertising_evt_types), 0x0,
8538             NULL, HFILL }
8539         },
8540         { &hf_bthci_evt_ext_advts_event_type,
8541           { "Event Type", "bthci_evt.le_ext_advts_event_type",
8542             FT_UINT16, BASE_HEX, NULL, 0x0,
8543             NULL, HFILL }
8544         },
8545         { &hf_bthci_evt_le_states,
8546           { "Supported LE States", "bthci_evt.le_states",
8547             FT_NONE, BASE_NONE, NULL, 0x00,
8548             NULL, HFILL }
8549         },
8550         { &hf_bthci_evt_le_states_00,
8551           { "Non-connectable Advertising State", "bthci_evt.le_states_00",
8552             FT_BOOLEAN, 8, NULL, 0x01,
8553             NULL, HFILL }
8554         },
8555         { &hf_bthci_evt_le_states_01,
8556           { "Scannable Advertising State", "bthci_evt.le_states_01",
8557             FT_BOOLEAN, 8, NULL, 0x02,
8558             NULL, HFILL }
8559         },
8560         { &hf_bthci_evt_le_states_02,
8561           { "Connectable Advertising State", "bthci_evt.le_states_02",
8562             FT_BOOLEAN, 8, NULL, 0x04,
8563             NULL, HFILL }
8564         },
8565         { &hf_bthci_evt_le_states_03,
8566           { "Directed Advertising State", "bthci_evt.le_states_03",
8567             FT_BOOLEAN, 8, NULL, 0x08,
8568             NULL, HFILL }
8569         },
8570         { &hf_bthci_evt_le_states_04,
8571           { "Passive Scanning State", "bthci_evt.le_states_04",
8572             FT_BOOLEAN, 8, NULL, 0x10,
8573             NULL, HFILL }
8574         },
8575         { &hf_bthci_evt_le_states_05,
8576           { "Active Scanning State", "bthci_evt.le_states_05",
8577             FT_BOOLEAN, 8, NULL, 0x20,
8578             NULL, HFILL }
8579         },
8580         { &hf_bthci_evt_le_states_06,
8581           { "Initiating State. Connection State in Master Role", "bthci_evt.le_states_06",
8582             FT_BOOLEAN, 8, NULL, 0x40,
8583             NULL, HFILL }
8584         },
8585         { &hf_bthci_evt_le_states_07,
8586           { "Connection State in Slave Role", "bthci_evt.le_states_07",
8587             FT_BOOLEAN, 8, NULL, 0x80,
8588             NULL, HFILL }
8589         },
8590         { &hf_bthci_evt_le_states_10,
8591           { "Non-connectable Advertising State and Passive Scanning State combination", "bthci_evt.le_states_10",
8592             FT_BOOLEAN, 8, NULL, 0x01,
8593             NULL, HFILL }
8594         },
8595         { &hf_bthci_evt_le_states_11,
8596           { "Scannable Advertising State and Passive Scanning State combination", "bthci_evt.le_states_11",
8597             FT_BOOLEAN, 8, NULL, 0x02,
8598             NULL, HFILL }
8599         },
8600         { &hf_bthci_evt_le_states_12,
8601           { "Connectable Advertising State and Passive Scanning State combination", "bthci_evt.le_states_12",
8602             FT_BOOLEAN, 8, NULL, 0x04,
8603             NULL, HFILL }
8604         },
8605         { &hf_bthci_evt_le_states_13,
8606           { "Directed Advertising State and Passive Scanning State combination", "bthci_evt.le_states_13",
8607             FT_BOOLEAN, 8, NULL, 0x08,
8608             NULL, HFILL }
8609         },
8610         { &hf_bthci_evt_le_states_14,
8611           { "Non-connectable Advertising State and Active Scanning State combination", "bthci_evt.le_states_14",
8612             FT_BOOLEAN, 8, NULL, 0x10,
8613             NULL, HFILL }
8614         },
8615         { &hf_bthci_evt_le_states_15,
8616           { "Scannable Advertising State and Active Scanning State combination", "bthci_evt.le_states_15",
8617             FT_BOOLEAN, 8, NULL, 0x20,
8618             NULL, HFILL }
8619         },
8620         { &hf_bthci_evt_le_states_16,
8621           { "Connectable Advertising State and Active Scanning State combination", "bthci_evt.le_states_16",
8622             FT_BOOLEAN, 8, NULL, 0x40,
8623             NULL, HFILL }
8624         },
8625         { &hf_bthci_evt_le_states_17,
8626           { "Directed Advertising State and Active Scanning State combination", "bthci_evt.le_states_17",
8627             FT_BOOLEAN, 8, NULL, 0x80,
8628             NULL, HFILL }
8629         },
8630         { &hf_bthci_evt_le_states_20,
8631           { "Non-connectable Advertising State and Initiating State combination", "bthci_evt.le_states_20",
8632             FT_BOOLEAN, 8, NULL, 0x01,
8633             NULL, HFILL }
8634         },
8635         { &hf_bthci_evt_le_states_21,
8636           { "Scannable Advertising State and Initiating State combination", "bthci_evt.le_states_21",
8637             FT_BOOLEAN, 8, NULL, 0x02,
8638             NULL, HFILL }
8639         },
8640         { &hf_bthci_evt_le_states_22,
8641           { "Non-connectable Advertising State and Master Role combination", "bthci_evt.le_states_22",
8642             FT_BOOLEAN, 8, NULL, 0x04,
8643             NULL, HFILL }
8644         },
8645         { &hf_bthci_evt_le_states_23,
8646           { "Scannable Advertising State and Master Role combination", "bthci_evt.le_states_23",
8647             FT_BOOLEAN, 8, NULL, 0x08,
8648             NULL, HFILL }
8649         },
8650         { &hf_bthci_evt_le_states_24,
8651           { "Non-connectable Advertising State and Slave Role combination", "bthci_evt.le_states_24",
8652             FT_BOOLEAN, 8, NULL, 0x10,
8653             NULL, HFILL }
8654         },
8655         { &hf_bthci_evt_le_states_25,
8656           { "Scannable Advertising State and Slave Role combination", "bthci_evt.le_states_25",
8657             FT_BOOLEAN, 8, NULL, 0x20,
8658             NULL, HFILL }
8659         },
8660         { &hf_bthci_evt_le_states_26,
8661           { "Passive Scanning State and Initiating State combination", "bthci_evt.le_states_26",
8662             FT_BOOLEAN, 8, NULL, 0x40,
8663             NULL, HFILL }
8664         },
8665         { &hf_bthci_evt_le_states_27,
8666           { "Active Scanning State and Initiating State combination", "bthci_evt.le_states_27",
8667             FT_BOOLEAN, 8, NULL, 0x80,
8668             NULL, HFILL }
8669         },
8670         { &hf_bthci_evt_le_states_30,
8671           { "Passive Scanning State and Master Role combination", "bthci_evt.le_states_30",
8672             FT_BOOLEAN, 8, NULL, 0x01,
8673             NULL, HFILL }
8674         },
8675         { &hf_bthci_evt_le_states_31,
8676           { "Active Scanning State and Master Role combination", "bthci_evt.le_states_31",
8677             FT_BOOLEAN, 8, NULL, 0x02,
8678             NULL, HFILL }
8679         },
8680         { &hf_bthci_evt_le_states_32,
8681           { "Passive Scanning state and Slave Role combination", "bthci_evt.le_states_32",
8682             FT_BOOLEAN, 8, NULL, 0x04,
8683             NULL, HFILL }
8684         },
8685         { &hf_bthci_evt_le_states_33,
8686           { "Active Scanning state and Slave Role combination", "bthci_evt.le_states_33",
8687             FT_BOOLEAN, 8, NULL, 0x08,
8688             NULL, HFILL }
8689         },
8690         { &hf_bthci_evt_le_states_34,
8691           { "Initiating State and Master Role combination. Master Role and Master Role combination", "bthci_evt.le_states_34",
8692             FT_BOOLEAN, 8, NULL, 0x10,
8693             NULL, HFILL }
8694         },
8695         { &hf_changed_in_frame,
8696             { "Change in Frame",                              "bthci_evt.change_in_frame",
8697             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
8698             NULL, HFILL }
8699         },
8700         { &hf_command_in_frame,
8701             { "Command in frame",                "bthci_evt.command_in_frame",
8702             FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
8703             NULL, HFILL }
8704         },
8705         { &hf_pending_in_frame,
8706             { "Pending in frame",                "bthci_evt.pending_in_frame",
8707             FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
8708             NULL, HFILL }
8709         },
8710         { &hf_response_in_frame,
8711             { "Response in frame",               "bthci_evt.response_in_frame",
8712             FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
8713             NULL, HFILL }
8714         },
8715         { &hf_command_response_time_delta,
8716             { "Command-Response Delta",          "bthci_evt.command_response_delta",
8717             FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00,
8718             NULL, HFILL }
8719         },
8720         { &hf_command_pending_time_delta,
8721             { "Command-Pending Delta",          "bthci_evt.command_pending_delta",
8722             FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00,
8723             NULL, HFILL }
8724         },
8725         { &hf_pending_response_time_delta,
8726             { "Pending-Response Delta",          "bthci_evt.pending_response_delta",
8727             FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_milliseconds, 0x00,
8728             NULL, HFILL }
8729         },
8730         { &hf_bthci_evt_le_features,
8731           { "Supported LE Features",                       "bthci_evt.le_features",
8732             FT_UINT64, BASE_HEX, NULL, 0x00,
8733             NULL, HFILL }
8734         },
8735         { &hf_bthci_evt_le_features_encryption,
8736           { "LE Encryption",                               "bthci_evt.le_features.encryption",
8737             FT_BOOLEAN, 64, NULL, 0x01,
8738             NULL, HFILL }
8739         },
8740         { &hf_bthci_evt_le_features_connection_parameters_request_procedure,
8741           { "Connection Parameters Request Procedure",     "bthci_evt.le_features.connection_parameters_request_procedure",
8742             FT_BOOLEAN, 64, NULL, 0x02,
8743             NULL, HFILL }
8744         },
8745         { &hf_bthci_evt_le_features_extended_reject_indication,
8746           { "Extended Reject Indication",                  "bthci_evt.le_features.extended_reject_indication",
8747             FT_BOOLEAN, 64, NULL, 0x04,
8748             NULL, HFILL }
8749         },
8750         { &hf_bthci_evt_le_features_slave_initiated_features_exchange,
8751           { "Slave-Initiated Features Exchange",           "bthci_evt.le_features.slave_initiated_features_exchange",
8752             FT_BOOLEAN, 64, NULL, 0x08,
8753             NULL, HFILL }
8754         },
8755         { &hf_bthci_evt_le_features_ping,
8756           { "Ping",                                        "bthci_evt.le_features.ping",
8757             FT_BOOLEAN, 64, NULL, 0x10,
8758             NULL, HFILL }
8759         },
8760         { &hf_bthci_evt_le_features_data_packet_length_extension,
8761           { "Data Packet Length Extension",                "bthci_evt.le_features.data_packet_length_extension",
8762             FT_BOOLEAN, 64, NULL, 0x20,
8763             NULL, HFILL }
8764         },
8765         { &hf_bthci_evt_le_features_ll_privacy,
8766           { "LL Privacy",                                  "bthci_evt.le_features.ll_privacy",
8767             FT_BOOLEAN, 64, NULL, 0x40,
8768             NULL, HFILL }
8769         },
8770         { &hf_bthci_evt_le_features_extended_scanner_filter_policies,
8771           { "Extended Scanner Filter Policies",            "bthci_evt.le_features.extended_scanner_filter_policies",
8772             FT_BOOLEAN, 64, NULL, 0x80,
8773             NULL, HFILL }
8774         },
8775         { &hf_bthci_evt_le_features_2m_phy,
8776           { "LE 2M PHY",            "bthci_evt.le_features.2m_phy",
8777             FT_BOOLEAN, 64, NULL, 0x0100,
8778             NULL, HFILL }
8779         },
8780         { &hf_bthci_evt_le_features_stable_modulation_index_tx,
8781           { "Stable Modulation Index - Tx",            "bthci_evt.le_features.stable_modulation_index_tx",
8782             FT_BOOLEAN, 64, NULL, 0x0200,
8783             NULL, HFILL }
8784         },
8785         { &hf_bthci_evt_le_features_stable_modulation_index_rx,
8786           { "Stable Modulation Index - Rx",            "bthci_evt.le_features.stable_modulation_index_rx",
8787             FT_BOOLEAN, 64, NULL, 0x0400,
8788             NULL, HFILL }
8789         },
8790         { &hf_bthci_evt_le_features_coded_phy,
8791           { "LE Coded PHY",            "bthci_evt.le_features.coded_phy",
8792             FT_BOOLEAN, 64, NULL, 0x0800,
8793             NULL, HFILL }
8794         },
8795         { &hf_bthci_evt_le_features_extended_advertising,
8796           { "LE Extended Advertising",           "bthci_evt.le_features.extended_advertising",
8797             FT_BOOLEAN, 64, NULL, 0x1000,
8798             NULL, HFILL }
8799         },
8800         { &hf_bthci_evt_le_features_periodic_advertising,
8801           { "LE Periodic Advertising",           "bthci_evt.le_features.periodic_advertising",
8802             FT_BOOLEAN, 64, NULL, 0x2000,
8803             NULL, HFILL }
8804         },
8805         { &hf_bthci_evt_le_features_channel_selection_algorithm_2,
8806           { "Channel Selection Algorithm #2",    "bthci_evt.le_features.channel_selection_algorithm_2",
8807             FT_BOOLEAN, 64, NULL, 0x4000,
8808             NULL, HFILL }
8809         },
8810         { &hf_bthci_evt_le_features_power_class_1,
8811           { "Power Class 1",                     "bthci_evt.le_features.power_class_1",
8812             FT_BOOLEAN, 64, NULL, 0x8000,
8813             NULL, HFILL }
8814         },
8815         { &hf_bthci_evt_le_features_minimum_number_of_used_channels_procedure,
8816           { "Minimum Number of Used Channels Procedure", "bthci_evt.le_features.minimum_number_of_used_channels_procedure",
8817             FT_BOOLEAN, 64, NULL, 0x010000,
8818             NULL, HFILL }
8819         },
8820         { &hf_bthci_evt_le_features_connection_cte_request,
8821           { "Connection CTE Request", "bthci_evt.le_features.connection_cte_request",
8822             FT_BOOLEAN, 64, NULL, 0x020000,
8823             NULL, HFILL }
8824         },
8825         { &hf_bthci_evt_le_features_connection_cte_response,
8826           { "Connection CTE Response", "bthci_evt.le_features.connection_cte_response",
8827             FT_BOOLEAN, 64, NULL, 0x040000,
8828             NULL, HFILL }
8829         },
8830         { &hf_bthci_evt_le_features_connectionless_cte_tx,
8831           { "Connectionless CTE Tx", "bthci_evt.le_features.connectionless_cte_tx",
8832             FT_BOOLEAN, 64, NULL, 0x080000,
8833             NULL, HFILL }
8834         },
8835         { &hf_bthci_evt_le_features_connectionless_cte_rx,
8836           { "Connectionless CTE Rx", "bthci_evt.le_features.connectionless_cte_rx",
8837             FT_BOOLEAN, 64, NULL, 0x100000,
8838             NULL, HFILL }
8839         },
8840         { &hf_bthci_evt_le_features_antenna_switching_during_cte_tx_aod,
8841           { "Antenna Switching During CTE Tx (AoD)", "bthci_evt.le_features.antenna_switching_during_cte_tx_aod",
8842             FT_BOOLEAN, 64, NULL, 0x200000,
8843             NULL, HFILL }
8844         },
8845         { &hf_bthci_evt_le_features_antenna_switching_during_cte_rx_aoa,
8846           { "Antenna Switching During CTE Rx (AoA)", "bthci_evt.le_features.antenna_switching_during_cte_rx_aoa",
8847             FT_BOOLEAN, 64, NULL, 0x400000,
8848             NULL, HFILL }
8849         },
8850         { &hf_bthci_evt_le_features_receiving_cte,
8851           { "Receiving CTE", "bthci_evt.le_features.receiving_cte",
8852             FT_BOOLEAN, 64, NULL, 0x800000,
8853             NULL, HFILL }
8854         },
8855         { &hf_bthci_evt_le_features_periodic_advertising_sync_transfer_sender,
8856           { "Periodic Advertising Sync Transfer - Sender", "bthci_evt.le_features.periodic_advertising_sync_transfer_sender",
8857             FT_BOOLEAN, 64, NULL, 0x01000000,
8858             NULL, HFILL }
8859         },
8860         { &hf_bthci_evt_le_features_periodic_advertising_sync_transfer_receiver,
8861           { "Periodic Advertising Sync Transfer - Receiver", "bthci_evt.le_features.periodic_advertising_sync_transfer_receiver",
8862             FT_BOOLEAN, 64, NULL, 0x02000000,
8863             NULL, HFILL }
8864         },
8865         { &hf_bthci_evt_le_features_sleep_clock_accuracy_updates,
8866           { "Sleep Clock Accuracy Updates", "bthci_evt.le_features.sleep_clock_accuracy_updates",
8867             FT_BOOLEAN, 64, NULL, 0x04000000,
8868             NULL, HFILL }
8869         },
8870         { &hf_bthci_evt_le_features_remote_public_key_validation,
8871           { "Remote Public Key Validation", "bthci_evt.le_features.remote_public_key_validation",
8872             FT_BOOLEAN, 64, NULL, 0x08000000,
8873             NULL, HFILL }
8874         },
8875         { &hf_bthci_evt_le_features_cis_master,
8876           { "Connected Isochronous Stream - Master", "bthci_evt.le_features.cis_master",
8877             FT_BOOLEAN, 64, NULL, 0x10000000,
8878             NULL, HFILL }
8879         },
8880         { &hf_bthci_evt_le_features_cis_slave,
8881           { "Connected Isochronous Stream - Slave", "bthci_evt.le_features.cis_slave",
8882             FT_BOOLEAN, 64, NULL, 0x20000000,
8883             NULL, HFILL }
8884         },
8885         { &hf_bthci_evt_le_features_isochronous_broadcaster,
8886           { "Isochronous Broadcaster", "bthci_evt.le_features.isochronous_broadcaster",
8887             FT_BOOLEAN, 64, NULL, 0x40000000,
8888             NULL, HFILL }
8889         },
8890         { &hf_bthci_evt_le_features_synchronized_receiver,
8891           { "Synchronized Receiver", "bthci_evt.le_features.synchronized_receiver",
8892             FT_BOOLEAN, 64, NULL, 0x80000000,
8893             NULL, HFILL }
8894         },
8895         { &hf_bthci_evt_le_features_isochronous_channels_host_support,
8896           { "Isochronous Channels (Host_support)", "bthci_evt.le_features.isochronous_channels_host_support",
8897             FT_BOOLEAN, 64, NULL, 0x0100000000,
8898             NULL, HFILL }
8899         },
8900         { &hf_bthci_evt_le_features_power_control_request,
8901           { "Power Control Request", "bthci_evt.le_features.power_control_request",
8902             FT_BOOLEAN, 64, NULL, 0x0200000000,
8903             NULL, HFILL }
8904         },
8905         { &hf_bthci_evt_le_features_power_change_indication,
8906           { "Power Change Indication", "bthci_evt.le_features.power_change_indication",
8907             FT_BOOLEAN, 64, NULL, 0x0400000000,
8908             NULL, HFILL }
8909         },
8910         { &hf_bthci_evt_le_features_path_loss_monitoring,
8911           { "Path Loss Monitoring", "bthci_evt.le_features.path_loss_monitoring",
8912             FT_BOOLEAN, 64, NULL, 0x0800000000,
8913             NULL, HFILL }
8914         },
8915         { &hf_bthci_evt_le_features_periodic_advertising_adi,
8916           { "Periodic Advertising ADI", "bthci_evt.le_features.periodic_advertising_adi",
8917             FT_BOOLEAN, 64, NULL, 0x1000000000,
8918             NULL, HFILL }
8919         },
8920         { &hf_bthci_evt_le_features_connection_subrating,
8921           { "Connection Subrating", "bthci_evt.le_features.connection_subrating",
8922             FT_BOOLEAN, 64, NULL, 0x2000000000,
8923             NULL, HFILL }
8924         },
8925         { &hf_bthci_evt_le_features_connection_subrating_host_support,
8926           { "Connection Subrating (Host support)", "bthci_evt.le_features.connection_subrating_host_support",
8927             FT_BOOLEAN, 64, NULL, 0x4000000000,
8928             NULL, HFILL }
8929         },
8930         { &hf_bthci_evt_le_features_channel_classification,
8931           { "Channel Classification", "bthci_evt.le_features.channel_classification",
8932             FT_BOOLEAN, 64, NULL, 0x8000000000,
8933             NULL, HFILL }
8934         },
8935         { &hf_bthci_evt_le_features_reserved,
8936             { "Reserved",                                  "bthci_evt.le_features.reserved",
8937             FT_UINT64, BASE_HEX, NULL, G_GUINT64_CONSTANT(0xFFFFFF0000000000),
8938             NULL, HFILL }
8939         },
8940         { &hf_bthci_evt_mws_number_of_transports,
8941           { "Number of Transports",                        "bthci_evt.mws.number_of_transports",
8942             FT_UINT8, BASE_DEC, NULL, 0x0,
8943             NULL, HFILL }
8944         },
8945         { &hf_bthci_evt_mws_transport_layers,
8946           { "Transport Layers",                            "bthci_evt.mws.transport_layers",
8947             FT_NONE, BASE_NONE, NULL, 0x0,
8948             NULL, HFILL }
8949         },
8950         { &hf_bthci_evt_mws_transport_layers_item,
8951           { "Transport Layer Item",                        "bthci_evt.mws.transport_layers.item",
8952             FT_NONE, BASE_NONE, NULL, 0x0,
8953             NULL, HFILL }
8954         },
8955         { &hf_bthci_evt_mws_transport_layer,
8956           { "Transport Layer",                             "bthci_evt.mws.transport_layers.item.transport_layer",
8957             FT_UINT8, BASE_HEX, VALS(bthci_evt_mws_transport_layer_vals), 0x0,
8958             NULL, HFILL }
8959         },
8960         { &hf_bthci_evt_mws_number_of_baud_rates,
8961           { "Number of Baud Rates",                        "bthci_evt.mws.number_of_baud_rates",
8962             FT_UINT8, BASE_DEC, NULL, 0x0,
8963             NULL, HFILL }
8964         },
8965         { &hf_bthci_evt_mws_to_mws_baud_rates,
8966           { "To MWS Baud Rates",                           "bthci_evt.mws.to_mws_baud_rates",
8967             FT_NONE, BASE_NONE, NULL, 0x0,
8968             NULL, HFILL }
8969         },
8970         { &hf_bthci_evt_mws_to_mws_baud_rates_tranport_item,
8971           { "To MWS Baud Rates Item",                      "bthci_evt.mws.to_mws_baud_rates.item",
8972             FT_NONE, BASE_NONE, NULL, 0x0,
8973             NULL, HFILL }
8974         },
8975         { &hf_bthci_evt_mws_to_mws_baud_rate,
8976           { "To MWS Baud Rate",                            "bthci_evt.mws.to_mws_baud_rates.item.baud_rate",
8977             FT_UINT32, BASE_DEC, NULL, 0x0,
8978             NULL, HFILL }
8979         },
8980         { &hf_bthci_evt_mws_from_mws_baud_rates,
8981           { "From MWS Baud Rates",                         "bthci_evt.mws.from_mws_baud_rates",
8982             FT_NONE, BASE_NONE, NULL, 0x0,
8983             NULL, HFILL }
8984         },
8985         { &hf_bthci_evt_mws_from_mws_baud_rates_tranport_item,
8986           { "From MWS Baud Rates Item",                    "bthci_evt.mws.from_mws_baud_rates.item",
8987             FT_NONE, BASE_NONE, NULL, 0x0,
8988             NULL, HFILL }
8989         },
8990         { &hf_bthci_evt_mws_from_mws_baud_rate,
8991           { "From MWS Baud Rate",                          "bthci_evt.mws.from_mws_baud_rates.item.baud_rate",
8992             FT_UINT32, BASE_DEC, NULL, 0x0,
8993             NULL, HFILL }
8994         },
8995         { &hf_bthci_evt_selected_tx_power,
8996           { "Selected TX Power (dBm)",                     "bthci_evt.transmit_power_level",
8997             FT_INT8, BASE_DEC, NULL, 0x0,
8998             NULL, HFILL }
8999         },
9000         { &hf_bthci_evt_which_clock,
9001           { "Which Clock",                                 "bthci_evt.which_clock",
9002             FT_UINT8, BASE_HEX, VALS(which_clock_vals), 0x0,
9003             NULL, HFILL }
9004         },
9005         { &hf_bthci_evt_slot_offset,
9006           { "Slot Offset",                                 "bthci_evt.slot_offset",
9007             FT_UINT16, BASE_DEC, NULL, 0x0,
9008             NULL, HFILL }
9009         },
9010         { &hf_bthci_evt_clock_offset_32,
9011           { "Clock Offset",                                "bthci_evt.clock_offset_32",
9012             FT_UINT32, BASE_HEX, NULL, 0x0FFFFFFF,
9013             "Bits 0-27 of the Clock Offset between CLKslave-CLK", HFILL }
9014         },
9015         { &hf_bthci_evt_next_broadcast_instant,
9016           { "Next Broadcast Instant",                      "bthci_evt.next_broadcast_instant",
9017             FT_UINT32, BASE_HEX, NULL, 0x0FFFFFFF,
9018             "CLK of a future broadcast on this channel", HFILL }
9019         },
9020         { &hf_bthci_evt_lt_addr,
9021           { "LT_ADDR",                                     "bthci_evt.lt_addr",
9022             FT_UINT8, BASE_HEX, NULL, 0x0,
9023             NULL, HFILL }
9024         },
9025         { &hf_bthci_evt_connectionless_slave_broadcast_interval,
9026           { "Connectionless Slave Broadcast Interval",     "bthci_evt.connectionless_slave_broadcast_interval",
9027             FT_UINT16, BASE_DEC, NULL, 0x0,
9028             NULL, HFILL }
9029         },
9030         { &hf_bthci_evt_service_data,
9031           { "Service Data",                                "bthci_evt.service_data",
9032             FT_UINT8, BASE_HEX, NULL, 0x0,
9033             NULL, HFILL }
9034         },
9035         { &hf_bthci_evt_local_sam_index,
9036           { "Local SAM Index",                  "bthci_evt.local_sam_index",
9037             FT_UINT8, BASE_HEX|BASE_SPECIAL_VALS, VALS(unique_sam_disabled), 0x0,
9038             NULL, HFILL }
9039         },
9040         { &hf_bthci_evt_local_sam_tx_availability,
9041           { "Local SAM Tx Availability",        "bthci_evt.local_sam_tx_availability",
9042             FT_UINT8, BASE_DEC, NULL, 0x0,
9043             NULL, HFILL }
9044         },
9045         { &hf_bthci_evt_local_sam_rx_availability,
9046           { "Local SAM Rx Availability",        "bthci_evt.local_sam_rx_availability",
9047             FT_UINT8, BASE_DEC, NULL, 0x0,
9048             NULL, HFILL }
9049         },
9050         { &hf_bthci_evt_remote_sam_index,
9051           { "Remote SAM Index",                 "bthci_evt.remote_sam_index",
9052             FT_UINT8, BASE_HEX|BASE_SPECIAL_VALS, VALS(unique_sam_disabled), 0x0,
9053             NULL, HFILL }
9054         },
9055         { &hf_bthci_evt_remote_sam_tx_availability,
9056           { "Remote SAM Tx Availability",       "bthci_evt.remote_sam_tx_availability",
9057             FT_UINT8, BASE_DEC, NULL, 0x0,
9058             NULL, HFILL }
9059         },
9060         { &hf_bthci_evt_remote_sam_rx_availability,
9061           { "Remote SAM Rx Availability",       "bthci_evt.remote_sam_rx_availability",
9062             FT_UINT8, BASE_DEC, NULL, 0x0,
9063             NULL, HFILL }
9064         },
9065         { &hf_bthci_evt_receive_status,
9066           { "Receive Status",                              "bthci_evt.receive_status",
9067             FT_UINT8, BASE_HEX, VALS(receive_status_vals), 0x0,
9068             NULL, HFILL }
9069         },
9070         { &hf_bthci_evt_fragment,
9071           { "Fragment",                                    "bthci_evt.fragment",
9072             FT_UINT8, BASE_HEX, VALS(fragment_vals), 0x0,
9073             NULL, HFILL }
9074         },
9075         { &hf_bthci_evt_data,
9076           { "Data",                                        "bthci_evt.data",
9077             FT_BYTES, BASE_NONE, NULL, 0x0,
9078             NULL, HFILL }
9079         },
9080         { &hf_bthci_evt_le_number_of_reports,
9081           { "Number of Reports",                           "bthci_evt.number_of_reports",
9082             FT_UINT8, BASE_DEC, NULL, 0x0,
9083             NULL, HFILL }
9084         },
9085         { &hf_bthci_evt_le_report,
9086           { "Report",                                      "bthci_evt.report",
9087             FT_NONE, BASE_NONE, NULL, 0x0,
9088             NULL, HFILL }
9089         },
9090         { &hf_bthci_evt_le_event_type,
9091           { "Event Type",                           "bthci_evt.event_type",
9092             FT_UINT8, BASE_HEX, VALS(event_type_vals), 0x0,
9093             NULL, HFILL }
9094         },
9095         { &hf_bthci_evt_le_direct_bd_addr,
9096           { "Direct BD_ADDR",          "bthci_evt.direct_bd_addr",
9097             FT_ETHER, BASE_NONE, NULL, 0x0,
9098             NULL, HFILL}
9099         },
9100         { &hf_bthci_evt_le_direct_address_type,
9101           { "Direct Address Type", "bthci_evt.le_direct_address_type",
9102             FT_UINT8, BASE_HEX, VALS(bthci_cmd_address_types_vals), 0x0,
9103             NULL, HFILL }
9104         },
9105         { &hf_bthci_evt_le_address_type,
9106           { "Address Type", "bthci_evt.le_address_type",
9107             FT_UINT8, BASE_HEX, VALS(bthci_cmd_address_types_vals), 0x0,
9108             NULL, HFILL }
9109         },
9110         { &hf_bthci_evt_le_rssi,
9111           { "RSSI (dBm)", "bthci_evt.le_rssi",
9112             FT_INT8, BASE_DEC, NULL, 0x0,
9113             NULL, HFILL }
9114         },
9115         { &hf_bthci_evt_le_tx_phy,
9116           { "Tx PHY", "bthci_evt.le_tx_phy",
9117             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
9118             NULL, HFILL }
9119         },
9120         { &hf_bthci_evt_le_rx_phy,
9121           { "Rx PHY", "bthci_evt.le_rx_phy",
9122             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
9123             NULL, HFILL }
9124         },
9125         { &hf_bthci_evt_max_adv_data_length,
9126           { "Maximum Advertising Data Length", "bthci_evt.max_adv_data_length",
9127             FT_UINT16, BASE_DEC, NULL, 0x0,
9128             NULL, HFILL }
9129         },
9130         { &hf_bthci_evt_num_supported_adv_sets,
9131           { "Number of Supported Advertising Sets", "bthci_evt.num_supported_adv_sets",
9132             FT_UINT8, BASE_DEC, NULL, 0x0,
9133             NULL, HFILL }
9134         },
9135         { &hf_bthci_evt_number_of_supported_codecs,
9136           { "Number of Supported Codecs", "bthci_evt.number_of_supported_codecs",
9137             FT_UINT8, BASE_DEC, NULL, 0x0,
9138             NULL, HFILL }
9139         },
9140         { &hf_bthci_evt_number_of_supported_vendor_codecs,
9141           { "Number of Supported Vendor Codecs", "bthci_evt.number_of_supported_vendor_codecs",
9142             FT_UINT8, BASE_DEC, NULL, 0x0,
9143             NULL, HFILL }
9144         },
9145         { &hf_bthci_evt_codecs,
9146           { "Codecs", "bthci_evt.codecs",
9147             FT_NONE, BASE_NONE, NULL, 0x0,
9148             NULL, HFILL }
9149         },
9150         { &hf_bthci_evt_vendor_codecs,
9151           { "Vendor Codecs", "bthci_evt.vendor_codecs",
9152             FT_NONE, BASE_NONE, NULL, 0x0,
9153             NULL, HFILL }
9154         },
9155         { &hf_bthci_evt_vendor_codecs_item,
9156           { "Item", "bthci_evt.vendor_codecs.item",
9157             FT_STRING, BASE_NONE, NULL, 0x0,
9158             NULL, HFILL }
9159         },
9160         { &hf_bthci_evt_codec_id,
9161           { "Codec", "bthci_evt.codec_id",
9162             FT_UINT8, BASE_HEX, VALS(bthci_evt_codec_id_vals), 0x0,
9163             NULL, HFILL }
9164         },
9165         { &hf_bthci_evt_vendor_codec_id,
9166           { "Vendor Codec ID", "bthci_evt.vendor_codecs.item.codec_id",
9167             FT_UINT16, BASE_HEX, NULL, 0x0,
9168             NULL, HFILL }
9169         },
9170         { &hf_bthci_evt_mws_bt_rx_priority_assert_offset,
9171           { "Bluetooth Rx Priority Assert Offset", "bthci_evt.mws.bt.rx_priority.assert.offset",
9172             FT_INT16, BASE_DEC, NULL, 0x0,
9173             NULL, HFILL }
9174         },
9175         { &hf_bthci_evt_mws_bt_rx_priority_assert_jitter,
9176           { "Bluetooth Rx Priority Assert Jitter", "bthci_evt.mws.bt.rx_priority.assert.jitter",
9177             FT_UINT16, BASE_DEC, NULL, 0x0,
9178             NULL, HFILL }
9179         },
9180         { &hf_bthci_evt_mws_bt_rx_priority_deassert_offset,
9181           { "Bluetooth Rx Priority Deassert Offset", "bthci_evt.mws.bt.rx_priority.deassert.offset",
9182             FT_INT16, BASE_DEC, NULL, 0x0,
9183             NULL, HFILL }
9184         },
9185         { &hf_bthci_evt_mws_bt_rx_priority_deassert_jitter,
9186           { "Bluetooth Rx Priority Deassert Jitter", "bthci_evt.mws.bt.rx_priority.deassert.jitter",
9187             FT_UINT16, BASE_DEC, NULL, 0x0,
9188             NULL, HFILL }
9189         },
9190         { &hf_bthci_evt_mws_bt_tx_priority_assert_offset,
9191           { "Bluetooth Tx Priority Assert Offset", "bthci_evt.mws.bt.tx_priority.assert.offset",
9192             FT_INT16, BASE_DEC, NULL, 0x0,
9193             NULL, HFILL }
9194         },
9195         { &hf_bthci_evt_mws_bt_tx_priority_assert_jitter,
9196           { "Bluetooth Tx Priority Assert Jitter", "bthci_evt.mws.bt.tx_priority.assert.jitter",
9197             FT_UINT16, BASE_DEC, NULL, 0x0,
9198             NULL, HFILL }
9199         },
9200         { &hf_bthci_evt_mws_bt_tx_priority_deassert_offset,
9201           { "Bluetooth Tx Priority Deassert Offset", "bthci_evt.mws.bt.tx_priority.deassert.offset",
9202             FT_INT16, BASE_DEC, NULL, 0x0,
9203             NULL, HFILL }
9204         },
9205         { &hf_bthci_evt_mws_bt_tx_priority_deassert_jitter,
9206           { "Bluetooth Tx Priority Deassert Jitter", "bthci_evt.mws.bt.tx_priority.deassert.jitter",
9207             FT_UINT16, BASE_DEC, NULL, 0x0,
9208             NULL, HFILL }
9209         },
9210         { &hf_bthci_evt_mws_802_rx_priority_assert_offset,
9211           { "802 Rx Priority Assert Offset", "bthci_evt.mws.802.rx_priority.assert.offset",
9212             FT_INT16, BASE_DEC, NULL, 0x0,
9213             NULL, HFILL }
9214         },
9215         { &hf_bthci_evt_mws_802_rx_priority_assert_jitter,
9216           { "802 Rx Priority Assert Jitter", "bthci_evt.mws.802.rx_priority.assert.jitter",
9217             FT_UINT16, BASE_DEC, NULL, 0x0,
9218             NULL, HFILL }
9219         },
9220         { &hf_bthci_evt_mws_802_rx_priority_deassert_offset,
9221           { "802 Rx Priority Deassert Offset", "bthci_evt.mws.802.rx_priority.deassert.offset",
9222             FT_INT16, BASE_DEC, NULL, 0x0,
9223             NULL, HFILL }
9224         },
9225         { &hf_bthci_evt_mws_802_rx_priority_deassert_jitter,
9226           { "802 Rx Priority Deassert Jitter", "bthci_evt.mws.802.rx_priority.deassert.jitter",
9227             FT_UINT16, BASE_DEC, NULL, 0x0,
9228             NULL, HFILL }
9229         },
9230         { &hf_bthci_evt_mws_802_tx_priority_assert_offset,
9231           { "802 Tx Priority Assert Offset", "bthci_evt.mws.802.tx_priority.assert.offset",
9232             FT_INT16, BASE_DEC, NULL, 0x0,
9233             NULL, HFILL }
9234         },
9235         { &hf_bthci_evt_mws_802_tx_priority_assert_jitter,
9236           { "802 Tx Priority Assert Jitter", "bthci_evt.mws.802.tx_priority.assert.jitter",
9237             FT_UINT16, BASE_DEC, NULL, 0x0,
9238             NULL, HFILL }
9239         },
9240         { &hf_bthci_evt_mws_802_tx_priority_deassert_offset,
9241           { "802 Tx Priority Deassert Offset", "bthci_evt.mws.802.tx_priority.deassert.offset",
9242             FT_INT16, BASE_DEC, NULL, 0x0,
9243             NULL, HFILL }
9244         },
9245         { &hf_bthci_evt_mws_802_tx_priority_deassert_jitter,
9246           { "802 Tx Priority Deassert Jitter", "bthci_evt.mws.802.tx_priority.deassert.jitter",
9247             FT_UINT16, BASE_DEC, NULL, 0x0,
9248             NULL, HFILL }
9249         },
9250         { &hf_bthci_evt_sync_train_interval,
9251           { "Synchronization Train Interval", "bthci_evt.sync_train_interval",
9252             FT_UINT16, BASE_DEC, NULL, 0x0,
9253             NULL, HFILL }
9254         },
9255         { &hf_bthci_evt_sync_train_to,
9256           { "Synchronization Train To", "bthci_evt.sync_train_to",
9257             FT_UINT32, BASE_DEC, NULL, 0x0,
9258             NULL, HFILL }
9259         },
9260         { &hf_bthci_evt_secure_connection_host_support,
9261           { "Secure Connection Host Support", "bthci_evt.secure_connection_host_support",
9262             FT_UINT8, BASE_HEX, VALS(evt_enable_values), 0x0,
9263             NULL, HFILL }
9264         },
9265         { &hf_bthci_evt_authenticated_payload_timeout,
9266           { "Authenticated Payload Timeout", "bthci_evt.authenticated_payload_timeout",
9267             FT_UINT16, BASE_DEC, NULL, 0x0,
9268             NULL, HFILL }
9269         },
9270         { &hf_bthci_evt_c192,
9271           { "C 192", "bthci_evt.c192",
9272             FT_BYTES, BASE_NONE, NULL, 0x0,
9273             NULL, HFILL }
9274         },
9275         { &hf_bthci_evt_r192,
9276           { "R 192", "bthci_evt.r192",
9277             FT_BYTES, BASE_NONE, NULL, 0x0,
9278             NULL, HFILL }
9279         },
9280         { &hf_bthci_evt_c256,
9281           { "C 256", "bthci_evt.c256",
9282             FT_BYTES, BASE_NONE, NULL, 0x0,
9283             NULL, HFILL }
9284         },
9285         { &hf_bthci_evt_r256,
9286           { "R 256", "bthci_evt.r256",
9287             FT_BYTES, BASE_NONE, NULL, 0x0,
9288             NULL, HFILL }
9289         },
9290         { &hf_bthci_evt_extended_inquiry_length,
9291           { "Extended Inquiry Length",        "bthci_evt.extended_inquiry_length",
9292             FT_UINT16, BASE_DEC, NULL, 0x0,
9293             NULL, HFILL }
9294         },
9295         { &hf_bthci_evt_suggested_max_tx_octets,
9296           { "Suggested Max Tx Octets",        "bthci_evt.suggested_max_tx_octets",
9297             FT_UINT16, BASE_DEC, NULL, 0x0,
9298             NULL, HFILL }
9299         },
9300         { &hf_bthci_evt_suggested_max_tx_time,
9301           { "Suggested Max Tx Time",        "bthci_evt.suggested_max_tx_time",
9302             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9303             NULL, HFILL }
9304         },
9305         { &hf_bthci_evt_suggested_max_rx_octets,
9306           { "Suggested Max Rx Octets",        "bthci_evt.suggested_max_rx_octets",
9307             FT_UINT16, BASE_DEC, NULL, 0x0,
9308             NULL, HFILL }
9309         },
9310         { &hf_bthci_evt_suggested_max_rx_time,
9311           { "Suggested Max Rx Time",        "bthci_evt.suggested_max_rx_time",
9312             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9313             NULL, HFILL }
9314         },
9315         { &hf_bthci_evt_resolving_list_size,
9316           { "Resolving List Size",        "bthci_evt.resolving_list_size",
9317             FT_UINT8, BASE_DEC, NULL, 0x0,
9318             NULL, HFILL }
9319         },
9320         { &hf_bthci_evt_ext_advts_event_type_connectable,
9321           { "Connectable",     "bthci_evt.le_ext_advts_event_type.connectable",
9322             FT_BOOLEAN, 16, NULL, 0x01,
9323             NULL, HFILL }
9324         },
9325         { &hf_bthci_evt_ext_advts_event_type_scannable,
9326           { "Scannable",     "bthci_evt.le_ext_advts_event_type.scannable",
9327             FT_BOOLEAN, 16, NULL, 0x02,
9328             NULL, HFILL }
9329         },
9330         { &hf_bthci_evt_ext_advts_event_type_directed,
9331           { "Directed",     "bthci_evt.le_ext_advts_event_type.directed",
9332             FT_BOOLEAN, 16, NULL, 0x04,
9333             NULL, HFILL }
9334         },
9335         { &hf_bthci_evt_ext_advts_event_type_scan_response,
9336           { "Scan Response",     "bthci_evt.le_ext_advts_event_type.scan_response",
9337             FT_BOOLEAN, 16, NULL, 0x08,
9338             NULL, HFILL }
9339         },
9340         { &hf_bthci_evt_ext_advts_event_type_legacy,
9341           { "Legacy",     "bthci_evt.le_ext_advts_event_type.legacy",
9342             FT_BOOLEAN, 16, NULL, 0x10,
9343             NULL, HFILL }
9344         },
9345         { &hf_bthci_evt_ext_advts_event_type_data_status,
9346           { "Data Status",     "bthci_evt.le_ext_advts_event_type.data_status",
9347             FT_UINT16, BASE_HEX, VALS(ext_adv_data_status_vals), 0x60,
9348             NULL, HFILL }
9349         },
9350         { &hf_bthci_evt_ext_advts_event_type_reserved,
9351           { "Reserved",     "bthci_evt.le_ext_advts_event_type.reserved",
9352             FT_UINT16, BASE_HEX, NULL, 0xFF80,
9353             NULL, HFILL }
9354         },
9355         { &hf_bthci_evt_primary_phy,
9356           { "Primary PHY", "bthci_evt.primary_phy",
9357             FT_UINT8, BASE_HEX, VALS(bthci_evt_primary_phy_vals), 0x0,
9358             NULL, HFILL }
9359         },
9360         { &hf_bthci_evt_secondary_phy,
9361           { "Secondary PHY", "bthci_evt.secondary_phy",
9362             FT_UINT8, BASE_HEX, VALS(bthci_evt_secondary_phy_vals), 0x0,
9363             NULL, HFILL }
9364         },
9365         { &hf_bthci_evt_advertising_sid,
9366           { "Advertising SID", "bthci_evt.advertising_sid",
9367             FT_UINT8, BASE_HEX, NULL, 0x0,
9368             NULL, HFILL }
9369         },
9370         { &hf_bthci_evt_tx_power,
9371           { "TX Power", "bthci_evt.tx_power",
9372             FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0,
9373             NULL, HFILL }
9374         },
9375         { &hf_bthci_evt_periodic_advertising_interval,
9376           { "Periodic Advertising Interval", "bthci_evt.periodic_advertising_interval",
9377             FT_UINT16, BASE_HEX, NULL, 0x0,
9378             NULL, HFILL }
9379         },
9380         { &hf_bthci_evt_sync_handle,
9381           { "Sync Handle", "bthci_evt.sync_handle",
9382             FT_UINT16, BASE_HEX, NULL, 0x0,
9383             NULL, HFILL }
9384         },
9385         { &hf_bthci_evt_data_status,
9386           { "Data Status", "bthci_evt.data_status",
9387             FT_UINT8, BASE_HEX, VALS(ext_adv_data_status_vals), 0x0,
9388             NULL, HFILL }
9389         },
9390         { &hf_bthci_evt_advertising_handle,
9391           { "Advertising Handle", "bthci_evt.adv_handle",
9392             FT_UINT8, BASE_HEX, NULL, 0x0,
9393             NULL, HFILL }
9394         },
9395         { &hf_bthci_evt_num_compl_ext_advertising_events,
9396           { "Number Completed Extended Advertising Events", "bthci_evt.num_compl_ext_adv_events",
9397             FT_UINT8, BASE_DEC, NULL, 0x0,
9398             NULL, HFILL }
9399         },
9400         { &hf_bthci_evt_channel_selection_algorithm,
9401           { "Channel Selection Algorithm", "bthci_evt.channel_selection_algorithm",
9402             FT_UINT8, BASE_HEX, VALS(channel_selection_algo_vals), 0x0,
9403             NULL, HFILL }
9404         },
9405         { &hf_bthci_evt_advertiser_clock_accuracy,
9406           { "Advertiser Clock Accuracy", "bthci_evt.adv_clock_accuracy",
9407             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_clock_accuray_vals_ext, 0x0,
9408             NULL, HFILL }
9409         },
9410         { &hf_bthci_evt_advertiser_phy,
9411           { "Advertiser PHY", "bthci_evt.adv_phy",
9412             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
9413             NULL, HFILL }
9414         },
9415         { &hf_bthci_evt_periodic_adv_list_size,
9416           { "Periodic Advertiser List Size",        "bthci_evt.le_periodic_adv_list_size",
9417             FT_UINT8, BASE_DEC, NULL, 0x0,
9418             NULL, HFILL }
9419         },
9420         { &hf_bthci_evt_min_tx_power,
9421           { "Minimum TX Power", "bthci_evt.min_tx_power",
9422             FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0,
9423             NULL, HFILL }
9424         },
9425         { &hf_bthci_evt_max_tx_power,
9426           { "Maximum TX Power", "bthci_evt.max_tx_power",
9427             FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0x0,
9428             NULL, HFILL }
9429         },
9430         { &hf_bthci_evt_rf_tx_path_compensation,
9431           { "RF Tx Path Compensation Value",   "bthci_evt.rf_tx_path_compensation_value",
9432             FT_INT16, BASE_DEC, NULL, 0x0,
9433             NULL, HFILL }
9434         },
9435         { &hf_bthci_evt_rf_rx_path_compensation,
9436           { "RF Rx Path Compensation Value",   "bthci_evt.rf_rx_path_compensation_value",
9437             FT_INT16, BASE_DEC, NULL, 0x0,
9438             NULL, HFILL }
9439         },
9440         { &hf_bthci_evt_channel_index,
9441           { "Channel Index",        "bthci_evt.channel_index",
9442             FT_UINT8, BASE_DEC, NULL, 0x0,
9443             NULL, HFILL }
9444         },
9445         { &hf_bthci_evt_cte_rssi,
9446           { "RSSI",   "bthci_evt.cte_rssi",
9447             FT_INT16, BASE_DEC, NULL, 0x0,
9448             NULL, HFILL }
9449         },
9450         { &hf_bthci_evt_antenna_id,
9451           { "Antenna Id",        "bthci_evt.antenna_id",
9452             FT_UINT8, BASE_DEC, NULL, 0x0,
9453             NULL, HFILL }
9454         },
9455         { &hf_bthci_evt_cte_type,
9456           { "CTE Type",        "bthci_evt.cte_type",
9457             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_cte_type_vals_ext, 0x0,
9458             NULL, HFILL }
9459         },
9460         { &hf_bthci_evt_slot_durations,
9461           { "Slot Durations",        "bthci_evt.slot_durations",
9462             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_slot_durations_vals_ext, 0x0,
9463             NULL, HFILL }
9464         },
9465         { &hf_bthci_evt_packet_status,
9466           { "Packet Status",        "bthci_evt.packet_status",
9467             FT_UINT8, BASE_HEX, VALS(packet_status_vals), 0x0,
9468             NULL, HFILL }
9469         },
9470         { &hf_bthci_evt_event_counter,
9471           { "Event Counter",        "bthci_evt.event_counter",
9472             FT_UINT16, BASE_HEX, NULL, 0x0,
9473             NULL, HFILL }
9474         },
9475         { &hf_bthci_evt_sample_count,
9476           { "Sample Count",        "bthci_evt.sample_count",
9477             FT_UINT8, BASE_DEC, NULL, 0x0,
9478             NULL, HFILL }
9479         },
9480         { &hf_bthci_evt_i_sample,
9481           { "I",        "bthci_evt.i_sample",
9482             FT_INT8, BASE_DEC, NULL, 0x0,
9483             NULL, HFILL }
9484         },
9485         { &hf_bthci_evt_q_sample,
9486           { "Q",        "bthci_evt.q_sample",
9487             FT_INT8, BASE_DEC, NULL, 0x0,
9488             NULL, HFILL }
9489         },
9490         { &hf_bthci_evt_service_data_past,
9491           { "Service Data",        "bthci_evt.service_data_past",
9492             FT_UINT16, BASE_HEX, NULL, 0x0,
9493             NULL, HFILL }
9494         },
9495         { &hf_bthci_evt_number_antennae,
9496           { "Number of Antennae",        "bthci_evt.number_antennae",
9497             FT_UINT8, BASE_DEC, NULL, 0x0,
9498             NULL, HFILL }
9499         },
9500         { &hf_bthci_evt_max_cte_length,
9501           { "Max CTE Length",        "bthci_evt.max_cte_length",
9502             FT_UINT8, BASE_DEC, NULL, 0x0,
9503             NULL, HFILL }
9504         },
9505         { &hf_bthci_evt_max_length_antenna_switching_pattern,
9506           { "Max Length Antenna Switching Pattern", "bthci_evt.max_length_antenna_switching_pattern",
9507             FT_UINT8, BASE_DEC, NULL, 0x0,
9508             NULL, HFILL }
9509         },
9510         { &hf_bthci_evt_supported_switching_sample_rates,
9511           { "Supported Switching Sampling Rates", "bthci_evt.supported_switching_sample_rates",
9512             FT_UINT8, BASE_HEX, NULL, 0x0,
9513             NULL, HFILL }
9514         },
9515         { &hf_bthci_evt_supported_switching_sample_rates_1us_switching_aod_tx,
9516           { "1 usec switching for AoD Tx",  "bthci_evt.supported_switching_sample_rates.1us_switching_aod_tx",
9517             FT_BOOLEAN, 8, NULL, 0x01,
9518             NULL, HFILL }
9519         },
9520         { &hf_bthci_evt_supported_switching_sample_rates_1us_sampling_aod_rx,
9521           { "1 usec sampling for AoD Rx",   "bthci_evt.supported_switching_sample_rates.1us_sampling_aod_rx",
9522             FT_BOOLEAN, 8, NULL, 0x02,
9523             NULL, HFILL }
9524         },
9525         { &hf_bthci_evt_supported_switching_sample_rates_1us_switching_and_sampling_aoa_rx,
9526           { "1 usec switching and sampling for AoA Rx", "bthci_evt.supported_switching_sample_rates.1us_switching_and_sampling_aoa_rx",
9527             FT_BOOLEAN, 8, NULL, 0x04,
9528             NULL, HFILL }
9529         },
9530         { &hf_bthci_evt_supported_switching_sample_rates_reserved,
9531           { "Reserved",     "bthci_evt.supported_switching_sample_rates.reserved",
9532             FT_UINT8, BASE_HEX, NULL, 0xF8,
9533             NULL, HFILL }
9534         },
9535         { &hf_bthci_evt_simple_pairing_options,
9536           { "Simple Pairing Options", "bthci_evt.simple_pairing_options",
9537             FT_UINT8, BASE_HEX, NULL, 0x0,
9538             NULL, HFILL }
9539         },
9540         { &hf_bthci_evt_simple_pairing_options_remote_public_key_validation,
9541           { "Remote Public Key Validation",     "bthci_evt.simple_pairing_options.remote_public_key_validation",
9542             FT_BOOLEAN, 8, NULL, 0x01,
9543             NULL, HFILL }
9544         },
9545         { &hf_bthci_evt_simple_pairing_options_reserved,
9546           { "Reserved",     "bthci_evt.simple_pairing_options.reserved",
9547             FT_UINT8, BASE_HEX, NULL, 0xFE,
9548             NULL, HFILL }
9549         },
9550         { &hf_bthci_evt_max_encryption_key_size,
9551           { "Max Encryption Key Size",        "bthci_evt.max_encryption_key_size",
9552             FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0,
9553             NULL, HFILL }
9554         },
9555         { &hf_bthci_evt_sdu_packet_seq_num,
9556           { "SDU Packet Sequence Number",     "bthci_evt.sdu_packet_seq_num",
9557             FT_UINT16, BASE_DEC, NULL, 0x0,
9558             NULL, HFILL }
9559         },
9560         { &hf_bthci_evt_sdu_packet_timestamp,
9561           { "SDU Packet Timestamp",     "bthci_evt.sdu_packet_timestamp",
9562             FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9563             NULL, HFILL }
9564         },
9565         { &hf_bthci_evt_sdu_packet_offset,
9566           { "SDU Packet Offset",     "bthci_evt.sdu_packet_offset",
9567             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9568             NULL, HFILL }
9569         },
9570         { &hf_bthci_evt_cig_id,
9571           { "CIG Id",     "bthci_evt.cig_id",
9572             FT_UINT8, BASE_HEX, NULL, 0x0,
9573             NULL, HFILL }
9574         },
9575         { &hf_bthci_evt_cis_id,
9576           { "CIS Id",     "bthci_evt.cis_id",
9577             FT_UINT8, BASE_HEX, NULL, 0x0,
9578             NULL, HFILL }
9579         },
9580         { &hf_bthci_evt_cis_count,
9581           { "CIS Count",     "bthci_evt.cis_count",
9582             FT_UINT8, BASE_DEC, NULL, 0x0,
9583             NULL, HFILL }
9584         },
9585         { &hf_bthci_evt_cis_handle,
9586           { "CIS Handle",     "bthci_evt.cis_handle",
9587             FT_UINT16, BASE_HEX, NULL, 0x0,
9588             NULL, HFILL }
9589         },
9590         { &hf_bthci_evt_cis_bis_handle,
9591           { "CIS/BIS Handle",     "bthci_evt.cis_bis_handle",
9592             FT_UINT16, BASE_HEX, NULL, 0x0,
9593             NULL, HFILL }
9594         },
9595         { &hf_bthci_evt_big_handle,
9596           { "BIG Handle",     "bthci_evt.big_handle",
9597             FT_UINT8, BASE_HEX, NULL, 0x0,
9598             NULL, HFILL }
9599         },
9600         { &hf_bthci_evt_received_packet_counter,
9601           { "Received Packet Counter",     "bthci_evt.received_packet_counter",
9602             FT_UINT32, BASE_DEC, NULL, 0x0,
9603             NULL, HFILL }
9604         },
9605         { &hf_bthci_evt_missed_packet_counter,
9606           { "Missed Packet Counter",     "bthci_evt.missed_packet_counter",
9607             FT_UINT32, BASE_DEC, NULL, 0x0,
9608             NULL, HFILL }
9609         },
9610         { &hf_bthci_evt_failed_packet_counter,
9611           { "Failed Packet Counter",     "bthci_evt.failed_packet_counter",
9612             FT_UINT32, BASE_DEC, NULL, 0x0,
9613             NULL, HFILL }
9614         },
9615         { &hf_bthci_evt_pkt_count_tx_unacked,
9616           { "Tx UnACKed Packets",     "bthci_evt.pkt_count_tx_unacked",
9617             FT_UINT32, BASE_DEC, NULL, 0x0,
9618             NULL, HFILL }
9619         },
9620         { &hf_bthci_evt_pkt_count_tx_flushed,
9621           { "Tx Flushed Packets",     "bthci_evt.pkt_count_tx_flushed",
9622             FT_UINT32, BASE_DEC, NULL, 0x0,
9623             NULL, HFILL }
9624         },
9625         { &hf_bthci_evt_pkt_count_tx_last_subevent,
9626           { "Tx Last Subevent Packets",     "bthci_evt.pkt_count_tx_last_subevent",
9627             FT_UINT32, BASE_DEC, NULL, 0x0,
9628             NULL, HFILL }
9629         },
9630         { &hf_bthci_evt_pkt_count_tx_retransmitted,
9631           { "Tx Retransmitted Packets",     "bthci_evt.pkt_count_tx_retransmitted",
9632             FT_UINT32, BASE_DEC, NULL, 0x0,
9633             NULL, HFILL }
9634         },
9635         { &hf_bthci_evt_pkt_count_rx_crc_error,
9636           { "Rx CRC Error Packets",     "bthci_evt.pkt_count_rx_crc_error",
9637             FT_UINT32, BASE_DEC, NULL, 0x0,
9638             NULL, HFILL }
9639         },
9640         { &hf_bthci_evt_pkt_count_rx_unreceived,
9641           { "Rx Unreceived Packets",     "bthci_evt.pkt_count_rx_unreceived",
9642             FT_UINT32, BASE_DEC, NULL, 0x0,
9643             NULL, HFILL }
9644         },
9645         { &hf_bthci_evt_pkt_count_rx_duplicate,
9646           { "Rx Duplicate Packets",     "bthci_evt.pkt_count_rx_duplicate",
9647             FT_UINT32, BASE_DEC, NULL, 0x0,
9648             NULL, HFILL }
9649         },
9650         { &hf_bthci_evt_phy_and_coding,
9651           { "PHY", "bthci_evt.phy_and_coding",
9652             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_phy_and_coding_vals_ext, 0x0,
9653             NULL, HFILL }
9654         },
9655         { &hf_bthci_evt_cig_sync_delay,
9656           { "CIG Sync Delay",     "bthci_evt.cig_sync_delay",
9657             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9658             NULL, HFILL }
9659         },
9660         { &hf_bthci_evt_big_sync_delay,
9661           { "BIG Sync Delay",     "bthci_evt.big_sync_delay",
9662             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9663             NULL, HFILL }
9664         },
9665         { &hf_bthci_evt_cis_sync_delay,
9666           { "CIS Sync Delay",     "bthci_evt.cis_sync_delay",
9667             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9668             NULL, HFILL }
9669         },
9670         { &hf_bthci_evt_transport_latency_m_to_s,
9671           { "Transport Latency Master to Slave",     "bthci_evt.transport_latency_m_to_s",
9672             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9673             NULL, HFILL }
9674         },
9675         { &hf_bthci_evt_transport_latency_s_to_m,
9676           { "Transport Latency Slave to Master",     "bthci_evt.transport_latency_s_to_m",
9677             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9678             NULL, HFILL }
9679         },
9680         { &hf_bthci_evt_big_transport_latency,
9681           { "BIG Transport Latency",     "bthci_evt.big_transport_latency",
9682             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9683             NULL, HFILL }
9684         },
9685         { &hf_bthci_evt_phy_m_to_s,
9686           { "PHY Master to Slave", "bthci_evt.phy_m_to_s",
9687             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
9688             NULL, HFILL }
9689         },
9690         { &hf_bthci_evt_phy_s_to_m,
9691           { "PHY Slave to Master", "bthci_evt.phy_s_to_m",
9692             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
9693             NULL, HFILL }
9694         },
9695         { &hf_bthci_evt_bn_m_to_s,
9696           { "Burst Number Master to Slave", "bthci_evt.bn_m_to_s",
9697             FT_UINT8, BASE_DEC, NULL, 0x0,
9698             NULL, HFILL }
9699         },
9700         { &hf_bthci_evt_bn_s_to_m,
9701           { "Burst Number Slave to Master", "bthci_evt.bn_s_to_m",
9702             FT_UINT8, BASE_DEC, NULL, 0x0,
9703             NULL, HFILL }
9704         },
9705         { &hf_bthci_evt_ft_m_to_s,
9706           { "Flush Timeout Master to Slave", "bthci_evt.ft_m_to_s",
9707             FT_UINT8, BASE_DEC, NULL, 0x0,
9708             NULL, HFILL }
9709         },
9710         { &hf_bthci_evt_ft_s_to_m,
9711           { "Flush Timeout Slave to Master", "bthci_evt.ft_s_to_m",
9712             FT_UINT8, BASE_DEC, NULL, 0x0,
9713             NULL, HFILL }
9714         },
9715         { &hf_bthci_evt_max_pdu_m_to_s,
9716           { "Max PDU Master to Slave", "bthci_evt.max_pdu_m_to_s",
9717             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0,
9718             NULL, HFILL }
9719         },
9720         { &hf_bthci_evt_max_pdu_s_to_m,
9721           { "Max PDU Slave to Master", "bthci_evt.max_pdu_s_to_m",
9722             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0,
9723             NULL, HFILL }
9724         },
9725         { &hf_bthci_evt_phy,
9726           { "PHY", "bthci_evt.phy",
9727             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_le_phy_vals_ext, 0x0,
9728             NULL, HFILL }
9729         },
9730         { &hf_bthci_evt_nse,
9731           { "Number of Sub-Events", "bthci_evt.nse",
9732             FT_UINT8, BASE_DEC, NULL, 0x0,
9733             NULL, HFILL }
9734         },
9735         { &hf_bthci_evt_bn,
9736           { "Burst Number", "bthci_evt.bn",
9737             FT_UINT8, BASE_DEC, NULL, 0x0,
9738             NULL, HFILL }
9739         },
9740         { &hf_bthci_evt_pto,
9741           { "Pre-Transmission Offset", "bthci_evt.pto",
9742             FT_UINT8, BASE_DEC, NULL, 0x0,
9743             NULL, HFILL }
9744         },
9745         { &hf_bthci_evt_irc,
9746           { "Scheduled Payload Retransmissions", "bthci_evt.irc",
9747             FT_UINT8, BASE_DEC, NULL, 0x0,
9748             NULL, HFILL }
9749         },
9750         { &hf_bthci_evt_max_pdu,
9751           { "Max PDU", "bthci_evt.max_pdu",
9752             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0,
9753             NULL, HFILL }
9754         },
9755         { &hf_bthci_evt_iso_interval,
9756           { "ISO Interval", "bthci_evt.iso_interval",
9757             FT_UINT16, BASE_DEC, NULL, 0x0,
9758             NULL, HFILL }
9759         },
9760         { &hf_bthci_evt_num_bis,
9761           { "Number of BISes", "bthci_evt.num_bis",
9762             FT_UINT8, BASE_DEC, NULL, 0x0,
9763             NULL, HFILL }
9764         },
9765         { &hf_bthci_evt_bis_handle,
9766           { "BIS Handle", "bthci_evt.bis_handle",
9767             FT_UINT16, BASE_HEX, NULL, 0x0,
9768             NULL, HFILL }
9769         },
9770         { &hf_bthci_evt_current_path_loss,
9771           { "Current Path Loss", "bthci_evt.current_path_loss",
9772             FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_decibels, 0x0,
9773             NULL, HFILL }
9774         },
9775         { &hf_bthci_evt_zone_entered,
9776           { "Zone Entered", "bthci_evt.zone_entered",
9777             FT_UINT8, BASE_HEX, VALS(zone_entered_vals), 0x0,
9778             NULL, HFILL }
9779         },
9780         { &hf_bthci_evt_power_report_reason,
9781           { "Reason", "bthci_evt.power_report_reason",
9782             FT_UINT8, BASE_HEX, VALS(power_report_reason_vals), 0x0,
9783             NULL, HFILL }
9784         },
9785         { &hf_bthci_evt_transmit_power_level_flags,
9786           { "Transmit Power Level Flags", "bthci_evt.power_level_flags",
9787             FT_UINT8, BASE_HEX, NULL, 0x0,
9788             NULL, HFILL }
9789         },
9790         { &hf_bthci_evt_transmit_power_level_flags_minimum_power,
9791           { "At Minimum Power Level",     "bthci_evt.transmit_power_level_flags.minimum_power",
9792             FT_BOOLEAN, 8, NULL, 0x01,
9793             NULL, HFILL }
9794         },
9795         { &hf_bthci_evt_transmit_power_level_flags_maximum_power,
9796           { "At Maximum Power Level",     "bthci_evt.transmit_power_level_flags.maximum_power",
9797             FT_BOOLEAN, 8, NULL, 0x02,
9798             NULL, HFILL }
9799         },
9800         { &hf_bthci_evt_transmit_power_level_flags_reserved,
9801           { "Reserved",     "bthci_evt.transmit_power_level_flags.reserved",
9802             FT_UINT8, BASE_HEX, NULL, 0xFC,
9803             NULL, HFILL }
9804         },
9805         { &hf_bthci_evt_power_level_delta,
9806           { "Transmit Power Delta", "bthci_evt.power_level_delta",
9807             FT_INT8, BASE_DEC|BASE_UNIT_STRING, &units_decibels, 0x0,
9808             NULL, HFILL }
9809         },
9810         { &hf_bthci_evt_sdu_interval,
9811           { "SDU Interval",   "bthci_evt.sdu_interval",
9812             FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_microseconds, 0x0,
9813             NULL, HFILL }
9814         },
9815         { &hf_bthci_evt_max_sdu,
9816           { "Max SDU", "bthci_evt.max_sdu",
9817             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0,
9818             NULL, HFILL }
9819         },
9820         { &hf_bthci_evt_framing,
9821           { "Framing", "bthci_evt.framing",
9822             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_framing_vals_ext, 0x0,
9823             NULL, HFILL }
9824         },
9825         { &hf_bthci_evt_peer_clock_accuracy,
9826           { "Peer Clock Accuracy", "bthci_evt.peer_clock_accuracy",
9827             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bthci_cmd_clock_accuray_vals_ext, 0x0,
9828             NULL, HFILL }
9829         },
9830         { &hf_bthci_evt_subrate_factor,
9831           { "Subrate Factor", "bthci_evt.subrate_factor",
9832             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_number_events, 0x0,
9833             NULL, HFILL }
9834         },
9835         { &hf_bthci_evt_continuation_number,
9836           { "Continuation Number", "bthci_evt.continuation_number",
9837             FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_number_events, 0x0,
9838             NULL, HFILL }
9839         },
9840 
9841     };
9842 
9843     static ei_register_info ei[] = {
9844         { &ei_event_undecoded,            { "bthci_evt.expert.event.undecoded",                 PI_UNDECODED, PI_NOTE,     "Event undecoded", EXPFILL }},
9845         { &ei_event_unknown_event,        { "bthci_evt.expert.event.unknown_event",             PI_PROTOCOL, PI_WARN,      "Unknown event", EXPFILL }},
9846         { &ei_event_unexpected_event,     { "bthci_evt.expert.event.unexpected_event",          PI_PROTOCOL, PI_WARN,      "Unexpected event", EXPFILL }},
9847         { &ei_event_unexpected_parameter, { "bthci_evt.expert.event.unexpected_parameter",      PI_PROTOCOL, PI_WARN,      "Unexpected parameter", EXPFILL }},
9848         { &ei_event_unknown_command,      { "bthci_evt.expert.event.unknown_command",           PI_PROTOCOL, PI_WARN,      "Unknown command", EXPFILL }},
9849         { &ei_parameter_unexpected,       { "bthci_evt.expert.parameter.unexpected",            PI_PROTOCOL, PI_WARN,      "Unexpected command parameter", EXPFILL }},
9850         { &ei_manufacturer_data_changed,  { "bthci_evt.expert.event.manufacturer_data_changed", PI_PROTOCOL, PI_WARN,      "Manufacturer data changed", EXPFILL }},
9851         { &ei_hci_revision_changed,       { "bthci_evt.expert.event.hci_revision_changed",      PI_PROTOCOL, PI_WARN,      "HCI Revision changed", EXPFILL }},
9852         { &ei_lmp_subversion_changed,     { "bthci_evt.expert.event.lmp_subversion_changed",    PI_PROTOCOL, PI_WARN,      "LMP Subversion changed", EXPFILL }},
9853         { &ei_bad_link_type,              { "bthci_evt.expert.bad_link_type",                   PI_PROTOCOL, PI_WARN,      "Bad Link type, should be ACL or SCO", EXPFILL }},
9854     };
9855 
9856     /* Setup protocol subtree array */
9857     static gint *ett[] = {
9858         &ett_bthci_evt,
9859         &ett_opcode,
9860         &ett_lmp_subtree,
9861         &ett_ptype_subtree,
9862         &ett_le_state_subtree,
9863         &ett_le_channel_map,
9864         &ett_le_features,
9865         &ett_le_report,
9866         &ett_codecs,
9867         &ett_mws_transport_layers,
9868         &ett_mws_transport_layers_item,
9869         &ett_mws_to_mws_baud_rates,
9870         &ett_mws_to_mws_baud_rates_transport_item,
9871         &ett_mws_from_mws_baud_rates,
9872         &ett_mws_from_mws_baud_rates_transport_item,
9873         &ett_expert,
9874         &ett_le_ext_advts_event_type,
9875         &ett_iq_sample_list,
9876         &ett_iq_samples,
9877         &ett_simple_pairing_options,
9878         &ett_supported_switching_sample_rates,
9879         &ett_transmit_power_level_flags
9880     };
9881 
9882     /* Decode As handling
9883        This doesn't use register_decode_as_next_proto because it shares a dissector table
9884        with "bthci_cmd.vendor" */
9885     static build_valid_func bthci_evt_vendor_da_build_value[1] = {bthci_evt_vendor_value};
9886     static decode_as_value_t bthci_evt_vendor_da_values = {bthci_evt_vendor_prompt, 1, bthci_evt_vendor_da_build_value};
9887     static decode_as_t bthci_evt_vendor_da = {"bthci_cmd", "bthci_cmd.vendor", 1, 0, &bthci_evt_vendor_da_values, NULL, NULL,
9888             decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL};
9889 
9890 
9891     /* Register the protocol name and description */
9892     proto_bthci_evt = proto_register_protocol("Bluetooth HCI Event",
9893             "HCI_EVT", "bthci_evt");
9894     bthci_evt_handle = register_dissector("bthci_evt", dissect_bthci_evt, proto_bthci_evt);
9895 
9896     /* Required function calls to register the header fields and subtrees used */
9897     proto_register_field_array(proto_bthci_evt, hf, array_length(hf));
9898     proto_register_subtree_array(ett, array_length(ett));
9899 
9900     expert_bthci_evt = expert_register_protocol(proto_bthci_evt);
9901     expert_register_field_array(expert_bthci_evt, ei, array_length(ei));
9902 
9903     module = prefs_register_protocol_subtree("Bluetooth", proto_bthci_evt, NULL);
9904     prefs_register_static_text_preference(module, "hci_evt.version",
9905             "Bluetooth HCI version: 4.0 (Core) + Addendum 4",
9906             "Version of protocol supported by this dissector.");
9907 
9908     register_decode_as(&bthci_evt_vendor_da);
9909 }
9910 
9911 
9912 void
proto_reg_handoff_bthci_evt(void)9913 proto_reg_handoff_bthci_evt(void)
9914 {
9915     vendor_dissector_table = find_dissector_table("bthci_cmd.vendor");
9916     hci_vendor_table = find_dissector_table("bluetooth.vendor");
9917 
9918     dissector_add_uint("hci_h4.type", HCI_H4_TYPE_EVT, bthci_evt_handle);
9919     dissector_add_uint("hci_h1.type", BTHCI_CHANNEL_EVENT, bthci_evt_handle);
9920 
9921     bthci_cmd_handle    = find_dissector_add_dependency("bthci_cmd", proto_bthci_evt);
9922     btcommon_cod_handle = find_dissector_add_dependency("btcommon.cod", proto_bthci_evt);
9923     btcommon_eir_handle = find_dissector_add_dependency("btcommon.eir_ad.eir", proto_bthci_evt);
9924     btcommon_ad_handle  = find_dissector_add_dependency("btcommon.eir_ad.ad", proto_bthci_evt);
9925     btcommon_le_channel_map_handle = find_dissector_add_dependency("btcommon.le_channel_map", proto_bthci_evt);
9926 }
9927 
9928 /*
9929  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
9930  *
9931  * Local variables:
9932  * c-basic-offset: 4
9933  * tab-width: 8
9934  * indent-tabs-mode: nil
9935  * End:
9936  *
9937  * vi: set shiftwidth=4 tabstop=8 expandtab:
9938  * :indentSize=4:tabSize=8:noTabs=true:
9939  */
9940