From Kovarththanan Rajaratnam:
[obnox/wireshark/wip.git] / epan / dissectors / packet-bthci_evt.c
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  *
12  * $Id$
13  *
14  * Wireshark - Network traffic analyzer
15  * By Gerald Combs <gerald@wireshark.org>
16  * Copyright 1998 Gerald Combs
17  *
18  * This program is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU General Public License
20  * as published by the Free Software Foundation; either version 2
21  * of the License, or (at your option) any later version.
22  * 
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU General Public License for more details.
27  * 
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31  */
32
33 #ifdef HAVE_CONFIG_H
34 # include "config.h"
35 #endif
36
37 #include <glib.h>
38 #include <string.h>
39
40 #include <epan/packet.h>
41 #include <epan/strutil.h>
42 #include <etypes.h>
43 #include <packet-hci_h4.h>
44 #include <addr_resolv.h>
45
46 static dissector_handle_t bthci_com_handle;
47
48 /* Initialize the protocol and registered fields */
49 static int proto_bthci_evt = -1;
50 static int hf_bthci_evt_code = -1;
51 static int hf_bthci_evt_param_length = -1;
52 static int hf_bthci_evt_params = -1;
53 static int hf_bthci_evt_num_command_packets = -1;
54 static int hf_bthci_evt_num_handles = -1;
55 static int hf_bthci_evt_connection_handle = -1;
56 static int hf_bthci_evt_num_compl_packets = -1;
57 static int hf_bthci_evt_com_opcode = -1;
58 static int hf_bthci_evt_ret_params = -1;
59 static int hf_bthci_evt_status = -1;
60 static int hf_bthci_evt_status_pending = -1;
61 static int hf_bthci_evt_ocf = -1;
62 static int hf_bthci_evt_ogf = -1;
63 static int hf_bthci_evt_bd_addr = -1;
64 static int hf_bthci_evt_class_of_device = -1;
65 static int hf_bthci_evt_link_type = -1;
66 static int hf_bthci_evt_encryption_mode = -1;
67 static int hf_bthci_evt_reason = -1;
68 static int hf_bthci_evt_remote_name = -1;
69 static int hf_bthci_evt_encryption_enable = -1;
70 static int hf_bthci_evt_key_flag = -1;
71 static int hf_bthci_evt_vers_nr = -1;
72 static int hf_bthci_evt_hci_vers_nr = -1;
73 static int hf_bthci_evt_hci_revision = -1;
74 static int hf_bthci_evt_comp_id = -1;
75 static int hf_bthci_evt_sub_vers_nr = -1;
76 static int hf_bthci_evt_flags = -1;
77 static int hf_bthci_evt_service_type = -1;
78 static int hf_bthci_evt_token_rate = -1;
79 static int hf_bthci_evt_peak_bandwidth = -1;
80 static int hf_bthci_evt_latency = -1;
81 static int hf_bthci_evt_delay_variation = -1;
82 static int hf_bthci_evt_hardware_code = -1;
83 static int hf_bthci_evt_role = -1;
84 static int hf_bthci_evt_curr_role = -1;
85 static int hf_bthci_evt_curr_mode = -1;
86 static int hf_bthci_evt_interval = -1;
87 static int hf_bthci_evt_link_key = -1;
88 static int hf_bthci_evt_key_type = -1;
89 static int hf_bthci_evt_max_slots = -1;
90 static int hf_bthci_evt_clock_offset = -1;
91 static int hf_bthci_evt_link_type_2dh1 = -1;
92 static int hf_bthci_evt_link_type_3dh1 = -1;
93 static int hf_bthci_evt_link_type_dm1 = -1;
94 static int hf_bthci_evt_link_type_dh1 = -1;
95 static int hf_bthci_evt_link_type_2dh3 = -1;
96 static int hf_bthci_evt_link_type_3dh3 = -1;
97 static int hf_bthci_evt_link_type_dm3 = -1;
98 static int hf_bthci_evt_link_type_dh3 = -1;
99 static int hf_bthci_evt_link_type_2dh5 = -1;
100 static int hf_bthci_evt_link_type_3dh5 = -1;
101 static int hf_bthci_evt_link_type_dm5 = -1;
102 static int hf_bthci_evt_link_type_dh5 = -1;
103 static int hf_bthci_evt_link_type_hv1 = -1;
104 static int hf_bthci_evt_link_type_hv2 = -1;
105 static int hf_bthci_evt_link_type_hv3 = -1;
106 static int hf_bthci_evt_page_scan_mode = -1;
107 static int hf_bthci_evt_page_scan_repetition_mode = -1;
108 static int hf_bthci_evt_page_scan_period_mode = -1;
109 static int hf_bthci_evt_lmp_feature_00 = -1;
110 static int hf_bthci_evt_lmp_feature_01 = -1;
111 static int hf_bthci_evt_lmp_feature_02 = -1;
112 static int hf_bthci_evt_lmp_feature_03 = -1;
113 static int hf_bthci_evt_lmp_feature_04 = -1;
114 static int hf_bthci_evt_lmp_feature_05 = -1;
115 static int hf_bthci_evt_lmp_feature_06 = -1;
116 static int hf_bthci_evt_lmp_feature_07 = -1;
117 static int hf_bthci_evt_lmp_feature_10 = -1;
118 static int hf_bthci_evt_lmp_feature_11 = -1;
119 static int hf_bthci_evt_lmp_feature_12 = -1;
120 static int hf_bthci_evt_lmp_feature_13 = -1;
121 static int hf_bthci_evt_lmp_feature_14 = -1;
122 static int hf_bthci_evt_lmp_feature_15 = -1;
123 static int hf_bthci_evt_lmp_feature_16 = -1;
124 static int hf_bthci_evt_lmp_feature_17 = -1;
125 static int hf_bthci_evt_lmp_feature_20 = -1;
126 static int hf_bthci_evt_lmp_feature_21 = -1;
127 static int hf_bthci_evt_lmp_feature_22 = -1;
128 static int hf_bthci_evt_lmp_feature_23 = -1;
129 static int hf_bthci_evt_lmp_feature_24 = -1;
130 static int hf_bthci_evt_lmp_feature_27 = -1;
131 static int hf_bthci_evt_lmp_feature_31 = -1;
132 static int hf_bthci_evt_lmp_feature_32 = -1;
133 static int hf_bthci_evt_lmp_feature_33 = -1;
134 static int hf_bthci_evt_lmp_feature_34 = -1;
135 static int hf_bthci_evt_lmp_feature_35 = -1;
136 static int hf_bthci_evt_lmp_feature_36 = -1;
137 static int hf_bthci_evt_lmp_feature_37 = -1;
138 static int hf_bthci_evt_lmp_feature_40 = -1;
139 static int hf_bthci_evt_lmp_feature_41 = -1;
140 static int hf_bthci_evt_lmp_feature_43 = -1;
141 static int hf_bthci_evt_lmp_feature_44 = -1;
142 static int hf_bthci_evt_lmp_feature_47 = -1;
143 static int hf_bthci_evt_lmp_feature_50 = -1;
144 static int hf_bthci_evt_lmp_feature_51 = -1;
145 static int hf_bthci_evt_lmp_feature_52 = -1;
146 static int hf_bthci_evt_lmp_feature_53 = -1;
147 static int hf_bthci_evt_lmp_feature_54 = -1;
148 static int hf_bthci_evt_lmp_feature_55 = -1;
149 static int hf_bthci_evt_lmp_feature_56 = -1;
150 static int hf_bthci_evt_lmp_feature_57 = -1;
151 static int hf_bthci_evt_lmp_feature_60 = -1;
152 static int hf_bthci_evt_lmp_feature_63 = -1;
153 static int hf_bthci_evt_lmp_feature_64 = -1;
154 static int hf_bthci_evt_lmp_feature_65 = -1;
155 static int hf_bthci_evt_lmp_feature_66 = -1;
156 static int hf_bthci_evt_lmp_feature_70 = -1;
157 static int hf_bthci_evt_lmp_feature_71 = -1;
158 static int hf_bthci_evt_lmp_feature_77 = -1;
159 static int hf_bthci_evt_num_keys = -1;
160 static int hf_bthci_evt_num_keys_read = -1;
161 static int hf_bthci_evt_max_num_keys = -1;
162 static int hf_bthci_evt_num_responses = -1;
163 static int hf_bthci_evt_num_keys_written = -1;
164 static int hf_bthci_evt_num_keys_deleted = -1;
165 static int hf_bthci_evt_link_policy_setting_switch = -1;
166 static int hf_bthci_evt_link_policy_setting_hold = -1;
167 static int hf_bthci_evt_link_policy_setting_sniff = -1;
168 static int hf_bthci_evt_link_policy_setting_park = -1;
169 static int hf_bthci_evt_pin_type = -1;
170 static int hf_bthci_evt_device_name = -1;
171 static int hf_bthci_evt_timeout = -1;
172 static int hf_bthci_evt_scan_enable = -1;
173 static int hf_bthci_evt_authentication_enable = -1;
174 static int hf_bthci_evt_sco_flow_cont_enable = -1;
175 static int hf_bthci_evt_window = -1;
176 static int hf_bthci_evt_input_coding = -1;
177 static int hf_bthci_evt_input_data_format = -1;
178 static int hf_bthci_evt_input_sample_size = -1;
179 static int hf_bthci_evt_num_broadcast_retransm = -1;
180 static int hf_bthci_evt_hold_mode_act_page = -1;
181 static int hf_bthci_evt_hold_mode_act_inquiry = -1;
182 static int hf_bthci_evt_hold_mode_act_periodic = -1;
183 static int hf_bthci_evt_transmit_power_level = -1;
184 static int hf_bthci_evt_num_supp_iac = -1;
185 static int hf_bthci_evt_num_curr_iac = -1;
186 static int hf_bthci_evt_iac_lap = -1;
187 static int hf_bthci_evt_loopback_mode = -1;
188 static int hf_bthci_evt_country_code = -1;
189 static int hf_bthci_evt_failed_contact_counter = -1;
190 static int hf_bthci_evt_link_quality = -1;
191 static int hf_bthci_evt_rssi = -1;
192 static int hf_bthci_evt_host_data_packet_length_acl = -1;
193 static int hf_bthci_evt_host_data_packet_length_sco = -1;
194 static int hf_bthci_evt_host_total_num_acl_data_packets = -1;
195 static int hf_bthci_evt_host_total_num_sco_data_packets = -1;
196 static int hf_bthci_evt_page_number = -1;
197 static int hf_bthci_evt_max_page_number = -1;
198 static int hf_bthci_evt_local_supported_cmds = -1;
199 static int hf_bthci_evt_fec_required = -1;
200 static int hf_bthci_evt_err_data_reporting = -1;
201 static int hf_bthci_evt_scan_type = -1;
202 static int hf_bthci_evt_inq_mode = -1;
203 static int hf_bthci_evt_power_level_type = -1;
204 static int hf_bthci_evt_ext_lmp_features = -1;
205 static int hf_bthci_evt_sync_link_type = -1;
206 static int hf_bthci_evt_sync_tx_interval = -1;
207 static int hf_bthci_evt_sync_rtx_window = -1;
208 static int hf_bthci_evt_sync_rx_packet_length = -1;
209 static int hf_bthci_evt_sync_tx_packet_length = -1;
210 static int hf_bthci_evt_air_mode = -1;
211 static int hf_bthci_evt_max_tx_latency = -1;
212 static int hf_bthci_evt_max_rx_latency = -1;
213 static int hf_bthci_evt_min_remote_timeout = -1;
214 static int hf_bthci_evt_min_local_timeout = -1;
215 static int hf_bthci_evt_link_supervision_timeout = -1;
216 static int hf_bthci_evt_token_bucket_size = -1;
217 static int hf_bthci_evt_flow_direction = -1;
218 static int hf_bthci_evt_afh_ch_assessment_mode = -1;
219 static int hf_bthci_evt_lmp_handle = -1;
220 static int hf_bthci_evt_clock = -1;
221 static int hf_bthci_evt_clock_accuracy = -1;
222 static int hf_bthci_evt_afh_mode = -1;
223 static int hf_bthci_evt_afh_channel_map = -1;
224 static int hf_bthci_evt_simple_pairing_mode = -1;
225 static int hf_bthci_evt_randomizer_r = -1;
226 static int hf_bthci_evt_hash_c = -1;
227 static int hf_bthci_evt_io_capability = -1;
228 static int hf_bthci_evt_oob_data_present = -1;
229 static int hf_bthci_evt_auth_requirements = -1;
230 static int hf_bthci_evt_numeric_value = -1;
231 static int hf_bthci_evt_passkey = -1;
232 static int hf_bthci_evt_notification_type = -1;
233 static int hf_bthci_evt_eir_data = -1;
234 static int hf_bthci_evt_eir_struct_length = -1;
235 static int hf_bthci_evt_eir_struct_type = -1;
236 static int hf_bthci_evt_sc_uuid16 = -1;
237 static int hf_bthci_evt_sc_uuid32 = -1;
238 static int hf_bthci_evt_sc_uuid128 = -1;
239
240
241 /* Initialize the subtree pointers */
242 static gint ett_bthci_evt = -1;
243 static gint ett_opcode = -1;
244 static gint ett_lmp_subtree = -1;
245 static gint ett_ptype_subtree = -1;
246 static gint ett_eir_subtree = -1;
247 static gint ett_eir_struct_subtree = -1;
248
249 static const value_string evt_code_vals[] = {
250         {0x01, "Inquiry Complete"},
251         {0x02, "Inquiry Result"},
252         {0x03, "Connect Complete"},
253         {0x04, "Connect Request"},
254         {0x05, "Disconnect Complete"},
255         {0x06, "Auth Complete"},
256         {0x07, "Remote Name Req Complete"},
257         {0x08, "Encrypt Change"},
258         {0x09, "Change Connection Link Key Complete"},
259         {0x0a, "Master Link Key Complete"},
260         {0x0b, "Read Remote Supported Features"},
261         {0x0c, "Read Remote Ver Info Complete"},
262         {0x0d, "QoS Setup Complete"},
263         {0x0e, "Command Complete"},
264         {0x0f, "Command Status"},
265         {0x10, "Hardware Error"},
266         {0x11, "Flush Occurred"},
267         {0x12, "Role Change"},
268         {0x13, "Number of Completed Packets"},
269         {0x14, "Mode Change"},
270         {0x15, "Return Link Keys"},
271         {0x16, "PIN Code Request"},
272         {0x17, "Link Key Request"},
273         {0x18, "Link Key Notification"},
274         {0x19, "Loopback Command"},
275         {0x1a, "Data Buffer Overflow"},
276         {0x1b, "Max Slots Change"},
277         {0x1c, "Read Clock Offset Complete"},
278         {0x1d, "Connection Packet Type Changed"},
279         {0x1e, "QoS Violation"},
280         {0x1f, "Page Scan Mode Change"},
281         {0x20, "Page Scan Repetition Mode Change"},
282         {0x21, "Flow Specification Complete"},
283         {0x22, "Inquiry Result With RSSI"},
284         {0x23, "Read Remote Extended Features Complete"},
285         {0x2c, "Synchronous Connection Complete"},
286         {0x2d, "Synchronous Connection Changed"},
287         {0x2e, "Sniff Subrate"},
288         {0x2f, "Extended Inquiry Result"},
289         {0x30, "Encryption Key Refresh Complete"},
290         {0x31, "IO Capability Request"},
291         {0x32, "IO Capability Response"},
292         {0x33, "User Confirmation Request"},
293         {0x34, "User Passkey Request"},
294         {0x35, "Remote OOB Data Request"},
295         {0x36, "Simple Pairing Complete"},
296         {0x38, "Link Supervision Timeout Changed"},
297         {0x39, "Enhanced Flush Complete"},
298         {0x3b, "User Passkey Notification"},
299         {0x3c, "Keypress Notification"},
300         {0x3d, "Remote Host Supported Features Notification"},
301         {0xfe, "Bluetooth Logo Testing"},
302         {0xff, "Vendor-Specific"},
303         {0, NULL}
304 };
305
306 static const value_string bthci_cmd_status_pending_vals[] = {
307         {0x00, "Pending"},
308         {0, NULL }
309 };
310
311 static const value_string evt_link_types[]  = {
312         {0x00, "SCO connection (Voice Channels)"},
313         {0x01, "ACL connection (Data Channels)"},
314         {0, NULL }
315 };
316
317 static const value_string evt_sync_link_types[]  = {
318         {0x00, "SCO connection"},
319         {0x02, "eSCO connection"},
320         {0, NULL }
321 };
322
323 static const value_string evt_encryption_modes[] = {
324         {0x00, "Encryption Disabled"},
325         {0x01, "Encryption only for point-to-point packets"},
326         {0x02, "Encryption for both point-to-point and broadcast packets"},
327         {0, NULL }
328 };
329
330 static const value_string evt_encryption_enable[] = {
331         {0x00, "Link Level Encryption is OFF"},
332         {0x01, "Link Level Encryption is ON"},
333         {0, NULL }
334 };
335
336 static const value_string evt_key_flag[] = {
337         {0x00, "Using Semi-permanent Link Key"},
338         {0x01, "Using Temporary Link Key"},
339         {0, NULL }
340 };
341
342 static const value_string evt_lmp_vers_nr[] = {
343         {0x00, "Bluetooth LMP 1.0"},
344         {0x01, "Bluetooth LMP 1.1"},
345         {0x02, "Bluetooth LMP 1.2"},
346         {0x03, "Bluetooth LMP 2.0"},
347         {0x04, "Bluetooth LMP 2.1"},
348         {0, NULL }
349 };
350
351 static const value_string evt_hci_vers_nr[] = {
352         {0x00, "Bluetooth HCI Specification 1.0B"},
353         {0x01, "Bluetooth HCI Specification 1.1"},
354         {0x02, "Bluetooth HCI Specification 1.2"},
355         {0x03, "Bluetooth HCI Specification 2.0"},
356         {0x04, "Bluetooth HCI Specification 2.1"},
357         {0, NULL }
358 };
359
360 static const value_string evt_comp_id[] = {
361         {0x0000, "Ericsson Mobile Communications"},
362         {0x0001, "Nokia Mobile Phones"},
363         {0x0002, "Intel Corp."},
364         {0x0003, "IBM Corp."},
365         {0x0004, "Toshiba Corp."},
366         {0x0005, "3Com"},
367         {0x0006, "Microsoft"},
368         {0x0007, "Lucent"},
369         {0x0008, "Motorola"},
370         {0x0009, "Infineon Technologies AG"},
371         {0x000a, "Cambridge Silicon Radio"},
372         {0x000b, "Silicon Wave"},
373         {0x000c, "Digianswer"},
374         {0x000d, "Texas Instruments Inc."},
375         {0x000e, "Parthus Technologies Inc."},
376         {0x000f, "Broadcom Corporation"},
377         {0x0010, "Mitel Semiconductor"},
378         {0x0011, "Widcomm, Inc."},
379         {0x0012, "Zeevo, Inc."},
380         {0x0013, "Atmel Corporation"},
381         {0x0014, "Mitsubishi Electric Corporation"},
382         {0x0015, "RTX Telecom A/S"},
383         {0x0016, "KC Technology Inc."},
384         {0x0017, "Newlogic"},
385         {0x0018, "Transilica, Inc."},
386         {0x0019, "Rohde & Schwarz GmbH & Co. KG"},
387         {0x001a, "TTPCom Limited"},
388         {0x001b, "Signia Technologies, Inc."},
389         {0x001c, "Conexant Systems Inc."},
390         {0x001d, "Qualcomm"},
391         {0x001e, "Inventel"},
392         {0x001f, "AVM Berlin"},
393         {0x0020, "BandSpeed, Inc."},
394         {0x0021, "Mansella Ltd"},
395         {0x0022, "NEC Corporation"},
396         {0x0023, "WavePlus Technology Co., Ltd"},
397         {0x0024, "Alcatel"},
398         {0x0025, "Philips Semiconductors"},
399         {0x0026, "C Technologies"},
400         {0x0027, "Open Interface"},
401         {0x0028, "RF Micro Devices"},
402         {0x0029, "Hitachi Ltd"},
403         {0x002a, "Symbol Technologies, Inc."},
404         {0x002b, "Tenovis"},
405         {0x002c, "Macronix International Co. Ltd."},
406         {0x002d, "GCT Semiconductor"},
407         {0x002e, "Norwood Systems"},
408         {0x002f, "MewTel Technology Inc."},
409         {0x0030, "ST Microelectronics"},
410         {0x0031, "Synopsys"},
411         {0x0032, "Red-M (Communications) Ltd"},
412         {0x0033, "Commil Ltd"},
413         {0x0034, "Computer Access Technology Corporation (CATC)"},
414         {0x0035, "Eclipse (HQ Espana) S.L."},
415         {0x0036, "Renesas Technology Corp."},
416         {0x0037, "Mobilian Corporation"},
417         {0x0038, "Terax"},
418         {0x0039, "Integrated System Solution Corp."},
419         {0x003a, "Matsushita Electric Industrial Co. Ltd."},
420         {0x003b, "Gennum Corporation"},
421         {0x003c, "Research In Motion"},
422         {0x003d, "IPextreme, Inc."},
423         {0x003e, "Systems and Chips, Inc"},
424         {0x003f, "Bluetooth SIG, Inc"},
425         {0x0040, "Seiko Epson Corporation"},
426         {0x0041, "Integrated Silicon Solution Taiwan, Inc."},
427         {0x0042, "CONWISE Technology Corporation Ltd"},
428         {0x0043, "PARROT SA"},
429         {0x0044, "Socket Communications"},
430         {0x0045, "Atheros Communications Inc."},
431         {0x0046, "MediaTek, Inc."},
432         {0x0047, "Bluegiga"},
433         {0x0048, "Marvell Technology Group Ltd."},
434         {0x0049, "3DSP Corporation"},
435         {0x004a, "Accel Semiconductor Ltd."},
436         {0xFFFF, "For use in internal and interoperability tests."},
437         {0, NULL }
438 };
439
440 static const value_string evt_service_types[] = {
441         {0x00, "No Traffic Available"},
442         {0x01, "Best Effort Available"},
443         {0x02, "Guaranteed Available"},
444         {0, NULL }
445 };
446
447 static const value_string evt_role_vals[] = {
448         {0x00, "Currently the Master for specified BD_ADDR"},
449         {0x01, "Currently the Slave for specified BD_ADDR"},
450         {0, NULL }
451 };
452
453 static const value_string evt_role_vals_handle[] = {
454         {0x00, "Currently the Master for this connection handle"},
455         {0x01, "Currently the Slave for this connection handle"},
456         {0, NULL }
457 };
458
459 static const value_string evt_modes[] = {
460         {0x00, "Active Mode"},
461         {0x01, "Hold Mode"},
462         {0x02, "Sniff Mode"},
463         {0x03, "Park Mode"},
464         {0, NULL }
465 };
466
467 static const value_string evt_key_types[] = {
468         {0x00, "Combination Key"},
469         {0x01, "Local Unit Key"},
470         {0x02, "Remote Unit Key"},
471         {0x03, "Debug Combination Key"},
472         {0x04, "Unauthenticated Combination Key"},
473         {0x05, "Authenticated Combination Key"},
474         {0x06, "Changed Combination Key"},
475         {0, NULL }
476 };
477
478 static const value_string evt_page_scan_modes[] = {
479         {0x00, "Mandatory Page Scan Mode"},
480         {0x01, "Optional Page Scan Mode I"},
481         {0x02, "Optional Page Scan Mode II"},
482         {0x03, "Optional Page Scan Mode III"},
483         {0, NULL }
484 };
485
486 static const value_string evt_page_scan_repetition_modes[] = {
487         {0x00, "R0"},
488         {0x01, "R1"},
489         {0x02, "R2"},
490         {0, NULL }
491 };
492
493 static const value_string evt_page_scan_period_modes[] = {
494         {0x00, "P0"},
495         {0x01, "P1"},
496         {0x02, "P2"},
497         {0, NULL }
498 };
499
500 static const value_string evt_scan_types[] = {
501         {0x00, "Standard Scan" },
502         {0x01, "Interlaced Scan" },
503         {0, NULL }
504 };
505
506 static const value_string evt_inq_modes[] = {
507         {0x00, "Standard Results" },
508         {0x01, "Results With RSSI" },
509         {0x02, "Results With RSSI or Extended Results" },
510         {0, NULL }
511 };
512
513 static const value_string evt_power_level_types[] = {
514         {0x00, "Read Current Transmission Power Level" },
515         {0x01, "Read Maximum Transmission Power Level" },
516         {0, NULL }
517 };
518
519 static const value_string evt_boolean[] = {
520         {0x0 , "False" },
521         {0x1 , "True" },
522         {0, NULL }
523 };
524
525 static const value_string evt_pin_types[] = {
526         {0x00, "Variable PIN" },
527         {0x01, "Fixed PIN" },
528         {0, NULL }
529 };
530
531 static const value_string evt_scan_enable_values[] = {
532         {0x00, "No Scans enabled" },
533         {0x01, "Inquiry Scan enabled/Page Scan disable" },
534         {0x02, "Inquiry Scan disabled/Page Scan enabled" },
535         {0x03, "Inquiry Scan enabled/Page Scan enabled" },
536         {0, NULL }
537 };
538
539 static const value_string evt_auth_enable_values[] = {
540         {0x00, "Disabled" },
541         {0x01, "Enabled for all connections "},
542         {0, NULL }
543 };
544
545 static const value_string evt_enable_values[] = {
546         {0x00, "Disabled" },
547         {0x01, "Enabled"},
548         {0, NULL }
549 };
550
551 static const value_string evt_input_coding_values[] = {
552         {0x0, "Linear" },
553         {0x1, "\xb5-law" },
554         {0x2, "A-law" },
555         {0, NULL }
556 };
557
558 static const value_string evt_input_data_format_values[] = {
559         {0x0, "1's complement" },
560         {0x1, "2's complement" },
561         {0x2, "Sign-Magnitude" },
562         {0, NULL }
563 };
564
565 static const value_string evt_input_sample_size_values[] = {
566         {0x0, "8 bit (only for Linear PCM)" },
567         {0x1, "16 bit (only for Linear PCM)" },
568         {0, NULL }
569 };
570
571 static const value_string evt_loopback_modes[] = {
572         {0x00, "No Loopback mode enabled" },
573         {0x01, "Enable Local Loopback" },
574         {0x02, "Enable Remote Loopback" },
575         {0, NULL }
576 };
577
578 static const value_string evt_country_code_values[] = {
579         {0x0, "North America & Europe (except France) and Japan" },
580         {0x1, "France" },
581         {0, NULL }
582 };
583
584 static const value_string evt_air_mode_values[] = {
585         {0x0, "\xb5-law" },
586         {0x1, "A-law" },
587         {0x2, "CVSD" },
588         {0x3, "Transparent" },
589         {0, NULL }
590 };
591
592 static const value_string evt_flow_direction_values[] = {
593         {0x0, "Outgoing Traffic" },
594         {0x1, "Incoming Traffic" },
595         {0, NULL }
596 };
597
598 static const value_string evt_notification_type_vals[] = {
599         {0x0, "Passkey Entry Started" },
600         {0x1, "Passkey Digit Entered" },
601         {0x2, "Passkey Digit Erased" },
602         {0x3, "Passkey Cleared" },
603         {0x4, "Passkey Entry Completed" },
604         {0, NULL }
605 };
606
607 static int 
608 dissect_bthci_evt_bd_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
609 {
610         guint8 i, bd_addr[6];
611         proto_item *handle_item;
612
613         for(i=6; i; i--)
614                 bd_addr[6-i] = tvb_get_guint8(tvb, offset+i-1);
615
616         handle_item = proto_tree_add_item(tree, hf_bthci_evt_bd_addr, tvb, offset, 6, TRUE);
617         proto_item_append_text(handle_item, "%02x%02x:%02x:%02x%02x%02x (%s)",
618                                                         bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5],
619                                                         get_ether_name(bd_addr));
620         
621         offset+=6;
622
623         return offset;
624 }
625
626 static int 
627 dissect_bthci_evt_cod(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
628 {
629         guint8 cod1, cod2;
630         proto_item *item;
631
632         item = proto_tree_add_item(tree, hf_bthci_evt_class_of_device, tvb, offset, 3, TRUE);
633
634         cod1 = tvb_get_guint8(tvb, offset+1);
635         cod2 = tvb_get_guint8(tvb, offset+2);
636
637         if( (cod2 != 0) || (cod1 & 0x20) )
638         {
639                 char buf[128];
640
641                 buf[0] = 0;
642
643                 proto_item_append_text(item, " (%s - services:", val_to_str(cod1 & 0x1f, bthci_cmd_major_dev_class_vals, "???"));
644                 if (cod2 & 0x80) g_strlcat(buf, " Information,", sizeof(buf));
645                 if (cod2 & 0x40) g_strlcat(buf, " Telephony,", sizeof(buf));
646                 if (cod2 & 0x20) g_strlcat(buf, " Audio,", sizeof(buf));
647                 if (cod2 & 0x10) g_strlcat(buf, " Object transfer,", sizeof(buf));
648                 if (cod2 & 0x08) g_strlcat(buf, " Capturing,", sizeof(buf));
649                 if (cod2 & 0x04) g_strlcat(buf, " Rendering,", sizeof(buf));
650                 if (cod2 & 0x02) g_strlcat(buf, " Networking,", sizeof(buf));
651                 if (cod2 & 0x01) g_strlcat(buf, " Positioning,", sizeof(buf));
652                 if (cod1 & 0x20) g_strlcat(buf, " Limited discoverable mode,", sizeof(buf));
653
654                 buf[strlen(buf)-1] = 0; /* skip last comma */
655
656                 g_strlcat(buf, ")", sizeof(buf));
657                 proto_item_append_text(item, "%s", buf);
658         }
659         else
660         {
661                 proto_item_append_text(item, " (%s - no major services)", val_to_str(cod1 & 0x1f, bthci_cmd_major_dev_class_vals, "???"));
662         }
663
664         return offset+3;
665 }
666
667 static int 
668 dissect_bthci_evt_inq_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
669 {
670         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE); 
671         offset++;
672
673         return offset;
674 }
675
676 static int 
677 dissect_bthci_evt_conn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
678 {
679         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
680         offset++;
681
682         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
683         offset+=2;
684
685         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
686
687         proto_tree_add_item(tree, hf_bthci_evt_link_type, tvb, offset, 1, TRUE);
688         offset++;
689
690         proto_tree_add_item(tree, hf_bthci_evt_encryption_mode, tvb, offset, 1, TRUE);
691         offset++;
692
693         return offset;
694 }
695
696 static int 
697 dissect_bthci_evt_conn_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
698 {
699         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
700         
701         offset = dissect_bthci_evt_cod(tvb, offset, pinfo, tree);
702         
703         proto_tree_add_item(tree, hf_bthci_evt_link_type, tvb, offset, 1, TRUE);
704         offset++;
705
706         return offset;
707 }
708
709 static int 
710 dissect_bthci_evt_disconn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
711 {
712         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
713         offset++;
714
715         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
716         offset+=2;
717
718         proto_tree_add_item(tree, hf_bthci_evt_reason, tvb, offset, 1, TRUE);
719         offset++;
720
721         return offset;
722 }
723
724 static int 
725 dissect_bthci_evt_auth_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
726 {
727         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
728         offset++;
729
730         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
731         offset+=2;
732
733         return offset;
734 }
735
736 static int 
737 dissect_bthci_evt_lmp_features(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
738 {
739         guint8 fc_lag;
740         proto_item *item;
741         proto_item *ti_lmp_features=NULL;
742         proto_item *ti_lmp_subtree=NULL;
743
744         if(tree){
745                 ti_lmp_features=proto_tree_add_text(tree, tvb, offset, 8, "LMP_Features");
746                 ti_lmp_subtree=proto_item_add_subtree(ti_lmp_features, ett_lmp_subtree);
747         }
748         
749         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_00, tvb, offset, 1, TRUE);
750         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_01, tvb, offset, 1, TRUE);
751         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_02, tvb, offset, 1, TRUE);
752         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_03, tvb, offset, 1, TRUE);
753         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_04, tvb, offset, 1, TRUE);
754         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_05, tvb, offset, 1, TRUE);
755         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_06, tvb, offset, 1, TRUE);
756         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_07, tvb, offset, 1, TRUE);
757         offset++;
758
759         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_10, tvb, offset, 1, TRUE);
760         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_11, tvb, offset, 1, TRUE);
761         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_12, tvb, offset, 1, TRUE);
762         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_13, tvb, offset, 1, TRUE);
763         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_14, tvb, offset, 1, TRUE);
764         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_15, tvb, offset, 1, TRUE);
765         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_16, tvb, offset, 1, TRUE);
766         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_17, tvb, offset, 1, TRUE);
767         offset++;
768
769         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_20, tvb, offset, 1, TRUE);
770         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_21, tvb, offset, 1, TRUE);
771         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_22, tvb, offset, 1, TRUE);
772         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_23, tvb, offset, 1, TRUE);
773         item = proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_24, tvb, offset, 1, TRUE);
774         fc_lag = (tvb_get_guint8(tvb, offset) & 0x70)>>4;
775         proto_item_append_text(item, " (%i bytes)", 256*fc_lag);
776
777         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_27, tvb, offset, 1, TRUE);
778         offset++;
779
780         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_31, tvb, offset, 1, TRUE);
781         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_32, tvb, offset, 1, TRUE);
782         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_33, tvb, offset, 1, TRUE);
783         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_34, tvb, offset, 1, TRUE);
784         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_35, tvb, offset, 1, TRUE);
785         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_36, tvb, offset, 1, TRUE);
786         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_37, tvb, offset, 1, TRUE);
787         offset++;
788
789         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_40, tvb, offset, 1, TRUE);
790         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_41, tvb, offset, 1, TRUE);
791         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_43, tvb, offset, 1, TRUE);
792         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_44, tvb, offset, 1, TRUE);
793         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_47, tvb, offset, 1, TRUE);
794         offset++;
795
796         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_50, tvb, offset, 1, TRUE);
797         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_51, tvb, offset, 1, TRUE);
798         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_52, tvb, offset, 1, TRUE);
799         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_53, tvb, offset, 1, TRUE);
800         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_54, tvb, offset, 1, TRUE);
801         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_55, tvb, offset, 1, TRUE);
802         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_56, tvb, offset, 1, TRUE);
803         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_57, tvb, offset, 1, TRUE);
804         offset++;
805
806         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_60, tvb, offset, 1, TRUE);
807         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_63, tvb, offset, 1, TRUE);
808         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_64, tvb, offset, 1, TRUE);
809         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_65, tvb, offset, 1, TRUE);
810         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_66, tvb, offset, 1, TRUE);
811         offset++;
812
813         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_70, tvb, offset, 1, TRUE);
814         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_71, tvb, offset, 1, TRUE);
815         proto_tree_add_item(ti_lmp_subtree,hf_bthci_evt_lmp_feature_77, tvb, offset, 1, TRUE);
816         offset++;
817
818         return offset;
819 }
820
821 static int 
822 dissect_bthci_evt_pin_code_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
823 {
824         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
825
826         return offset;
827 }
828
829 static int 
830 dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
831 {
832         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
833
834         return offset;
835 }
836
837 static int 
838 dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
839 {
840         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
841
842         proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, TRUE);
843         offset+=16;
844
845         proto_tree_add_item(tree, hf_bthci_evt_key_type, tvb, offset, 1, TRUE);
846         offset+=1;
847
848         return offset;
849 }
850
851 static int 
852 dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
853 {
854         guint8 evt_num_keys;
855
856         evt_num_keys = tvb_get_guint8(tvb, offset);
857         proto_tree_add_item(tree, hf_bthci_evt_num_keys, tvb, offset, 1, TRUE);
858         offset++;
859
860         while(evt_num_keys--){
861                 offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
862
863                 proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, TRUE);
864                 offset+=16;
865
866         } 
867
868         return offset;
869 }
870
871 static int 
872 dissect_bthci_evt_read_remote_support_features_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
873 {
874         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
875         offset++;
876
877         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
878         offset+=2;
879
880         offset=dissect_bthci_evt_lmp_features(tvb, offset, pinfo,tree);
881
882         return offset;
883 }
884
885 static int 
886 dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
887 {
888         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
889         offset++;
890
891         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
892
893         proto_tree_add_item(tree, hf_bthci_evt_remote_name, tvb, offset, 248, FALSE);
894         offset+=248;
895
896         return offset;
897 }
898
899 static int 
900 dissect_bthci_evt_read_remote_version_information_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
901 {
902         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
903         offset++;
904
905         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
906         offset+=2;
907
908         proto_tree_add_item(tree, hf_bthci_evt_vers_nr, tvb, offset, 1, TRUE);
909         offset++;
910
911         proto_tree_add_item(tree, hf_bthci_evt_comp_id, tvb, offset, 2, TRUE);
912         offset+=2;
913
914         proto_tree_add_item(tree, hf_bthci_evt_sub_vers_nr, tvb, offset, 2, TRUE);
915         offset+=2;
916
917         return offset;
918 }
919
920 static int 
921 dissect_bthci_evt_flush_occured(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
922 {
923         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
924         offset+=2;
925
926         return offset;
927 }
928
929 static int 
930 dissect_bthci_evt_number_of_completed_packets(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
931 {
932         guint8 evt_num_handles;
933
934         evt_num_handles = tvb_get_guint8(tvb, offset);
935         proto_tree_add_item(tree, hf_bthci_evt_num_handles, tvb, offset, 1, TRUE);
936         offset++;
937
938         while(evt_num_handles--){
939                 proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
940                 offset+=2;
941
942                 proto_tree_add_item(tree, hf_bthci_evt_num_compl_packets, tvb, offset, 2, TRUE);
943                 offset+=2;
944
945         }  
946
947         return offset;
948 }
949
950 static int 
951 dissect_bthci_evt_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
952 {
953         proto_item *handle_item;
954
955         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
956         offset++;
957
958         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
959         offset+=2;
960
961         proto_tree_add_item(tree, hf_bthci_evt_curr_mode, tvb, offset, 1, TRUE);
962         offset++;
963
964         handle_item = proto_tree_add_item(tree, hf_bthci_evt_interval, tvb, offset, 2, TRUE);
965         proto_item_append_text(handle_item, " Baseband slots (%f msec)", tvb_get_letohs(tvb, offset)*0.625); 
966         offset+=2;
967
968         return offset;
969 }
970
971 static int 
972 dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
973 {
974         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
975         offset++;
976
977         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
978
979         proto_tree_add_item(tree, hf_bthci_evt_role, tvb, offset, 1, TRUE);
980         offset++;
981
982         return offset;
983 }
984
985 static int 
986 dissect_bthci_evt_hardware_error(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
987 {
988         proto_tree_add_item(tree, hf_bthci_evt_hardware_code, tvb, offset, 1, TRUE);
989         offset++;
990
991         return offset;
992 }
993
994 static int 
995 dissect_bthci_evt_loopback_command(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
996 {
997         tvbuff_t *next_tvb;
998
999         next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), -1);
1000         if(bthci_com_handle){
1001                 call_dissector(bthci_com_handle, next_tvb, pinfo, tree);
1002         }
1003         offset+=tvb_length_remaining(tvb, offset);
1004
1005         return offset;
1006 }
1007
1008 static int 
1009 dissect_bthci_evt_data_buffer_overflow(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1010 {
1011         proto_tree_add_item(tree, hf_bthci_evt_link_type, tvb, offset, 1, TRUE);
1012         offset++;
1013
1014         return offset;
1015 }
1016
1017 static int 
1018 dissect_bthci_evt_read_clock_offset_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1019 {
1020         proto_item *handle_item;
1021         gint16 clk;
1022
1023         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1024         offset++;
1025
1026         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1027         offset+=2;
1028
1029         handle_item = proto_tree_add_item(tree, hf_bthci_evt_clock_offset, tvb, offset, 2, TRUE);
1030         clk=tvb_get_letohs(tvb, offset) & 32767; /* only bit0-14 are valid  */
1031         proto_item_append_text(handle_item, " (%g ms)", 1.25*clk);
1032         offset+=2;
1033
1034         return offset;
1035 }
1036
1037 static int 
1038 dissect_bthci_evt_max_slots_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1039 {
1040         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1041         offset+=2;
1042
1043         proto_tree_add_item(tree, hf_bthci_evt_max_slots, tvb, offset, 1, TRUE);
1044         offset++;
1045
1046         return offset;
1047 }
1048
1049 static int 
1050 dissect_bthci_evt_qos_violation(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1051 {
1052         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1053         offset+=2;
1054
1055         return offset;
1056 }
1057
1058 static int 
1059 dissect_bthci_evt_conn_packet_type_changed(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1060 {
1061         guint16 flags;
1062         proto_tree *handle_tree=NULL;
1063         proto_item *ti_ptype_subtree=NULL;
1064
1065         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1066         offset++;
1067
1068         flags=tvb_get_letohs(tvb, offset);
1069         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1070         offset+=2;
1071
1072         handle_tree = proto_tree_add_text(tree, tvb, offset, 2, "Usable packet types: ");
1073         ti_ptype_subtree = proto_item_add_subtree(handle_tree, ett_ptype_subtree);
1074
1075         if (flags & 0x0008)
1076                 proto_item_append_text(handle_tree, "DM1 ");
1077         if (flags & 0x0010)
1078                 proto_item_append_text(handle_tree, "DH1 ");
1079         if (flags & 0x0400)
1080                 proto_item_append_text(handle_tree, "DM3 ");
1081         if (flags & 0x0800)
1082                 proto_item_append_text(handle_tree, "DH3 ");
1083         if (flags & 0x4000)
1084                 proto_item_append_text(handle_tree, "DM5 ");
1085         if (flags & 0x8000)
1086                 proto_item_append_text(handle_tree, "DH5 ");
1087         if (flags & 0x0020)
1088                 proto_item_append_text(handle_tree, "HV1 ");
1089         if (flags & 0x0040)
1090                 proto_item_append_text(handle_tree, "HV2 ");
1091         if (flags & 0x0080)
1092                 proto_item_append_text(handle_tree, "HV3 ");
1093         if (flags & 0x0002)
1094                 proto_item_append_text(handle_tree, "2-DH1 ");
1095         if (flags & 0x0004)
1096                 proto_item_append_text(handle_tree, "3-DH1 ");
1097         if (flags & 0x0100)
1098                 proto_item_append_text(handle_tree, "2-DH3 ");
1099         if (flags & 0x0200)
1100                 proto_item_append_text(handle_tree, "3-DH3 ");
1101         if (flags & 0x1000)
1102                 proto_item_append_text(handle_tree, "2-DH5 ");
1103         if (flags & 0x2000)
1104                 proto_item_append_text(handle_tree, "3-DH5 ");
1105
1106         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_2dh1, tvb, offset, 2, TRUE);
1107         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_3dh1, tvb, offset, 2, TRUE);
1108         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_dm1, tvb, offset, 2, TRUE);
1109         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_dh1, tvb, offset, 2, TRUE); 
1110         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_2dh3, tvb, offset, 2, TRUE);
1111         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_3dh3, tvb, offset, 2, TRUE);
1112         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_dm3, tvb, offset, 2, TRUE); 
1113         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_dh3, tvb, offset, 2, TRUE); 
1114         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_2dh5, tvb, offset, 2, TRUE);
1115         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_3dh5, tvb, offset, 2, TRUE);
1116         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_dm5, tvb, offset, 2, TRUE); 
1117         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_dh5, tvb, offset, 2, TRUE); 
1118         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_hv1, tvb, offset, 2, TRUE); 
1119         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_hv2, tvb, offset, 2, TRUE); 
1120         proto_tree_add_item(ti_ptype_subtree, hf_bthci_evt_link_type_hv3, tvb, offset, 2, TRUE); 
1121         offset+=2;
1122
1123         return offset;
1124 }
1125
1126 static int 
1127 dissect_bthci_evt_command_status(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1128 {
1129         guint8 status_code;
1130         
1131         status_code = tvb_get_guint8(tvb, offset);
1132
1133         if( status_code != 0) {
1134                 proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1135         }
1136         else {
1137                 proto_tree_add_item(tree, hf_bthci_evt_status_pending, tvb, offset, 1, TRUE);
1138         }
1139         offset++;
1140
1141         proto_tree_add_item(tree, hf_bthci_evt_num_command_packets, tvb, offset, 1, TRUE);
1142         offset++;
1143
1144         proto_tree_add_item(tree, hf_bthci_evt_com_opcode, tvb, offset, 2, TRUE);
1145         offset+=2;
1146
1147         return offset;
1148 }
1149
1150 static int 
1151 dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1152 {
1153         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1154
1155         proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, TRUE);
1156         offset++;
1157
1158         return offset;
1159 }
1160
1161 static int 
1162 dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1163 {
1164         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1165
1166         proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, TRUE);
1167         offset++;
1168
1169         return offset;
1170 }
1171
1172 static int 
1173 dissect_bthci_evt_inq_result_with_rssi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1174 {
1175         guint8 num, evt_num_responses;
1176
1177         evt_num_responses = tvb_get_guint8(tvb, offset);
1178         proto_tree_add_item(tree, hf_bthci_evt_num_responses, tvb, offset, 1, TRUE);
1179         offset++;
1180
1181         for(num=0;num<evt_num_responses;num++){
1182                 offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1183
1184                 proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, TRUE);
1185                 offset++;
1186
1187                 /* reserved byte */
1188                 offset++;
1189
1190                 offset = dissect_bthci_evt_cod(tvb, offset, pinfo, tree);
1191
1192                 proto_tree_add_item(tree, hf_bthci_evt_clock_offset, tvb, offset, 2, TRUE);
1193                 offset+=2;
1194
1195                 proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, TRUE);
1196                 offset++;
1197
1198         }
1199
1200         return offset;
1201 }
1202
1203 static int 
1204 dissect_bthci_evt_ext_inquiry_response(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1205 {
1206         guint8 i, j, length, type;
1207         proto_item *ti_eir=NULL;
1208         proto_item *ti_eir_subtree=NULL;
1209
1210         if(tree){
1211                 ti_eir=proto_tree_add_text(tree, tvb, offset, 240, "Extended Inquiry Response Data");
1212                 ti_eir_subtree=proto_item_add_subtree(ti_eir, ett_eir_subtree);
1213         }
1214         
1215         i=0;
1216         while(i<240){
1217                 length = tvb_get_guint8(tvb, offset+i);
1218                 if( length != 0 ){
1219
1220                         proto_item *ti_eir_struct=NULL;
1221                         proto_tree *ti_eir_struct_subtree=NULL;
1222
1223                         ti_eir_struct = proto_tree_add_text(ti_eir_subtree, tvb, offset+i, length+1, "%s", "");
1224                         ti_eir_struct_subtree = proto_item_add_subtree(ti_eir_struct, ett_eir_struct_subtree);
1225
1226                         type = tvb_get_guint8(tvb, offset+i+1);
1227                         
1228                         proto_item_append_text(ti_eir_struct,"%s", val_to_str(type, bthci_cmd_eir_data_type_vals, "Unknown"));
1229
1230                         proto_tree_add_item(ti_eir_struct_subtree,hf_bthci_evt_eir_struct_length, tvb, offset+i, 1, TRUE);
1231                         proto_tree_add_item(ti_eir_struct_subtree,hf_bthci_evt_eir_struct_type, tvb, offset+i+1, 1, TRUE);
1232
1233                         switch(type) {
1234                                 case 0x02: /* 16-bit Service Class UUIDs, incomplete list */
1235                                 case 0x03: /* 16-bit Service Class UUIDs, complete list */
1236                                         j=0;
1237                                         while(j<(length-1))
1238                                         {
1239                                                 proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_sc_uuid16, tvb, offset+i+j+2, 2, TRUE);
1240                                                 j+=2;
1241                                         }
1242                                         break;
1243                                 case 0x04: /* 32-bit Service Class UUIDs, incomplete list */
1244                                 case 0x05: /* 32-bit Service Class UUIDs, complete list */
1245                                         j=0;
1246                                         while(j<(length-1))
1247                                         {
1248                                                 proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_sc_uuid32, tvb, offset+i+j+2, 4, TRUE);
1249                                                 j+=4;
1250                                         }
1251                                         break;
1252                                 case 0x06: /* 128-bit Service Class UUIDs, incomplete list */
1253                                 case 0x07: /* 128-bit Service Class UUIDs, complete list */
1254                                         j=0;
1255                                         while(j<(length-1))
1256                                         {
1257                                                 proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_sc_uuid128, tvb, offset+i+j+2, 16, TRUE);
1258                                                 j+=16;
1259                                         }
1260                                         break;
1261                                 case 0x08: /* Device Name, shortened */
1262                                 case 0x09: /* Device Name, full */
1263                                         proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_device_name, tvb, offset+i+2, length-1, TRUE);
1264                                         proto_item_append_text(ti_eir_struct,": %s", tvb_format_text(tvb,offset+i+2,length-1));
1265                                         break;
1266                                 case 0x0A: /* Tx Power Level */
1267                                         proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_transmit_power_level, tvb, offset+i+2, 1, TRUE);
1268
1269                                 default:
1270                                         proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_eir_data, tvb, offset+i+2, length-1, TRUE);
1271                                         break;
1272                         }
1273                         i += length+1;
1274                 }
1275                 else {
1276                         break;
1277                 }
1278         }
1279
1280         return offset+240;
1281 }
1282
1283 static int 
1284 dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1285 {
1286         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1287
1288         return offset;
1289 }
1290
1291 static int
1292 dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1293 {
1294         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1295
1296         proto_tree_add_item(tree, hf_bthci_evt_io_capability, tvb, offset, 1, TRUE);
1297         offset++;
1298
1299         proto_tree_add_item(tree, hf_bthci_evt_oob_data_present, tvb, offset, 1, TRUE);
1300         offset++;
1301         
1302         proto_tree_add_item(tree, hf_bthci_evt_auth_requirements, tvb, offset, 1, TRUE);
1303         offset++;
1304
1305         return offset;
1306 }
1307
1308 static int 
1309 dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1310 {
1311         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1312
1313         proto_tree_add_item(tree, hf_bthci_evt_numeric_value, tvb, offset, 4, TRUE);
1314         offset+=4;
1315
1316         return offset;
1317 }
1318
1319 static int
1320 dissect_bthci_evt_user_passkey_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1321 {
1322         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1323
1324         return offset;
1325 }
1326
1327 static int
1328 dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1329 {
1330         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1331
1332         return offset;
1333 }
1334
1335 static int 
1336 dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1337 {
1338         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1339         offset++;
1340
1341         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1342
1343         return offset;
1344 }
1345
1346 static int
1347 dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1348 {
1349         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1350
1351         proto_tree_add_item(tree, hf_bthci_evt_passkey, tvb, offset, 4, TRUE);
1352         offset+=4;
1353
1354         return offset;
1355 }
1356
1357 static int
1358 dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1359 {
1360         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1361
1362         proto_tree_add_item(tree, hf_bthci_evt_notification_type, tvb, offset, 1, TRUE);
1363         offset++;
1364
1365         return offset;
1366 }
1367
1368 static int
1369 dissect_bthci_evt_remote_host_sup_feat_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1370 {
1371         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1372
1373         proto_tree_add_item(tree, hf_bthci_evt_ext_lmp_features, tvb, offset, 8, TRUE);
1374         offset+=8;
1375
1376         return offset;
1377 }
1378
1379 static int 
1380 dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1381 {
1382         proto_item *ti_opcode=NULL;
1383         proto_tree *opcode_tree=NULL;
1384         proto_item *item;
1385         gint16 timeout;
1386         guint8 num8, i;
1387         guint16 com_opcode;
1388         guint32 accuracy;
1389
1390         proto_tree_add_item(tree, hf_bthci_evt_num_command_packets, tvb, offset, 1, TRUE);
1391         offset++;
1392
1393         com_opcode = tvb_get_letohs(tvb, offset);
1394         ti_opcode = proto_tree_add_item(tree, hf_bthci_evt_com_opcode, tvb, offset, 2, TRUE);
1395         opcode_tree = proto_item_add_subtree(ti_opcode, ett_opcode);
1396         proto_tree_add_item(opcode_tree, hf_bthci_evt_ogf, tvb, offset, 2, TRUE);
1397         proto_tree_add_item(opcode_tree, hf_bthci_evt_ocf, tvb, offset, 2, TRUE);
1398         offset+=2;
1399
1400
1401         switch(com_opcode) {
1402                 /* This is a list of Commands that all return just the status */
1403                 case 0x0402: /* Inquiry Cancel */
1404                 case 0x0403: /* Periodic Inquiry Mode */
1405                 case 0x0404: /* Exit Periodic Enquiry Mode */
1406                 case 0x080f: /* Write Default Link Policy Settings */
1407                 case 0x0c01: /* Set Event Mask */
1408                 case 0x0c03: /* Reset */
1409                 case 0x0c05: /* Set Event Filter */
1410                 case 0x0c0a: /* Write PIN Type */
1411                 case 0x0c0b: /* Create Unit Key */
1412                 case 0x0c13: /* Change Local Name */
1413                 case 0x0c16: /* Write Connection Accept Timeout */
1414                 case 0x0c18: /* Write Page Timeout */
1415                 case 0x0c1a: /* Write Scan Enable */
1416                 case 0x0c1c: /* Write Page Scan Activity */
1417                 case 0x0c1e: /* Write Inquiry Scan Activity */
1418                 case 0x0c20: /* Write Authentication Enable */
1419                 case 0x0c22: /* Write Encryption Mode  */
1420                 case 0x0c24: /* Write Class of Device */
1421                 case 0x0c26: /* Write Voice Setting */
1422                 case 0x0c2a: /* Write Num Broadcast Retransmissions */
1423                 case 0x0c2c: /* Write Hold Mode Activity */
1424                 case 0x0c2f: /* Write SCO Flow Control Enable */
1425                 case 0x0c31: /* Set Host Controller To Host Flow Control */
1426                 case 0x0c33: /* Host Buffer Size */
1427                 case 0x0c3a: /* Write Current IAC LAP */            
1428                 case 0x0c3c: /* Write Page Scan Period Mode */
1429                 case 0x0c3e: /* Write Page Scan Mode */
1430                 case 0x0c3f: /* Set AFH Host Channel Classification */
1431                 case 0x0c43: /* Write Inquiry Scan Type */
1432                 case 0x0c45: /* Write Inquiry Mode */
1433                 case 0x0c47: /* Write Page Scan Type */
1434                 case 0x0c49: /* Write AFH Channel Assessment Mode */
1435                 case 0x0c52: /* Write Extended Inquiry Response */
1436                 case 0x0c53: /* Refresh Encryption Key */
1437                 case 0x0c56: /* Write Simple Pairing Mode */
1438                 case 0x0c59: /* Write Inquiry Tx Power Level */
1439                 case 0x0c5b: /* Write Default Erroneous Data Reporting */
1440                 case 0x0c60: /* Send Keypress Notification */
1441                 case 0x1802: /* Write Loopback Mode */
1442                 case 0x1803: /* Enable Device Under Test Mode */
1443                 case 0x1804: /* Write Simple Pairing Debug Mode */
1444                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1445                         offset++;
1446                         break;
1447
1448                 /* This is a list of Commands that all return status and BD_ADDR */
1449                 case 0x0408: /* Create Connection Cancel */
1450                 case 0x040b: /* Link Key Request Reply */
1451                 case 0x040c: /* Link Key Request Negative Reply */
1452                 case 0x040d: /* PIN Code Request Reply */
1453                 case 0x040e: /* PIN Code Request Negative Reply */
1454                 case 0x041a: /* Remote Name Request Cancel */
1455                 case 0x042b: /* IO Capability Response */
1456                 case 0x042c: /* User Confirmation Request Reply */
1457                 case 0x042d: /* User Confirmation Request Negative Reply */
1458                 case 0x042e: /* User Passkey Request Reply */
1459                 case 0x042f: /* User Passkey Request Negative Reply */
1460                 case 0x0430: /* Remote OOB Data Request Reply */
1461                 case 0x0433: /* Remote OOB Data Request Negative Reply */
1462                 case 0x1009: /* Read BD_ADDR */
1463                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1464                         offset++;
1465
1466                         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
1467
1468                         break;
1469
1470                 /* This is a list of Commands that all return status and connection_handle */
1471                 case 0x080d: /* Write Link Policy Settings */
1472                 case 0x0811: /* Sniff Subrating */
1473                 case 0x0c08: /* Flush */
1474                 case 0x0c28: /* Write Automatic Flush Timeout */
1475                 case 0x0c37: /* Write Link Supervision Timeout */
1476                 case 0x0c5f: /* Enhanced Flush */
1477                 case 0x1402: /* Reset Failed Contact Counter */
1478                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1479                         offset++;
1480
1481                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1482                         offset+=2;
1483
1484                         break;
1485
1486                 /* This is a list of Commands that all return status and timeout */
1487                 case 0x0c15: /* Read Connection Accept Timeout */
1488                 case 0x0c17: /* Read Page Timeout */
1489                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1490                         offset++;
1491
1492                         timeout = tvb_get_letohs(tvb, offset);
1493                         item = proto_tree_add_item(tree, hf_bthci_evt_timeout, tvb, offset, 2, TRUE);
1494                         proto_item_append_text(item, " slots (%g msec)", timeout*0.625);
1495                         offset+=2;
1496
1497                         break;
1498
1499                 /* This is a list of Commands that all return status, connection handle and timeout */
1500                 case 0x0c27: /* Read Automatic Flush Timeout */
1501                 case 0x0c36: /* Read Link Supervision Timeout */
1502                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1503                         offset++;
1504
1505                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1506                         offset+=2;
1507
1508                         timeout = tvb_get_letohs(tvb, offset);
1509                         item = proto_tree_add_item(tree, hf_bthci_evt_timeout, tvb, offset, 2, TRUE);
1510                         proto_item_append_text(item, " slots (%g msec)", timeout*0.625);
1511                         offset+=2;
1512
1513                         break;
1514
1515                 /* This is a list of Commands that all return status, interval and window */
1516                 case 0x0c1b: /* Read Page Scan Activity */
1517                 case 0x0c1d: /* Read Inquiry Scan Activity */
1518                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1519                         offset++;
1520
1521                         proto_tree_add_item(tree, hf_bthci_evt_interval, tvb, offset, 2, TRUE);
1522                         offset+=2;
1523
1524                         proto_tree_add_item(tree, hf_bthci_evt_window, tvb, offset, 2, TRUE);
1525                         offset+=2;
1526
1527                         break;
1528
1529                 case 0x0420: /* Read LMP Handle */
1530                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1531                         offset++;
1532
1533                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1534                         offset+=2;
1535
1536                         proto_tree_add_item(tree, hf_bthci_evt_lmp_handle, tvb, offset, 1, TRUE);
1537                         offset++;
1538
1539                         /* 4 reserved bytes */
1540                         offset+=4;
1541                         break;
1542
1543                 case 0x0809: /* Role Discovery */
1544                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1545                         offset++;
1546
1547                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1548                         offset+=2;
1549
1550                         proto_tree_add_item(tree, hf_bthci_evt_curr_role, tvb, offset, 1, TRUE);
1551                         offset++;
1552
1553                         break;
1554
1555                 case 0x080c: /* Read Link Policy Settings */
1556                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1557                         offset++;
1558
1559                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1560                         offset+=2;
1561
1562                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_switch, tvb, offset, 2, TRUE);
1563                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_hold  , tvb, offset, 2, TRUE);
1564                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_sniff , tvb, offset, 2, TRUE);
1565                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_park  , tvb, offset, 2, TRUE);
1566                         offset+=2;
1567
1568                         break;
1569
1570                 case 0x080e: /* Read Default Link Policy Settings */
1571                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1572                         offset++;
1573
1574                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_switch, tvb, offset, 2, TRUE);
1575                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_hold  , tvb, offset, 2, TRUE);
1576                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_sniff , tvb, offset, 2, TRUE);
1577                         proto_tree_add_item(tree, hf_bthci_evt_link_policy_setting_park  , tvb, offset, 2, TRUE);
1578                         offset+=2;
1579
1580                         break;
1581
1582                 case 0x0c09: /* Read PIN Type */
1583                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1584                         offset++;
1585
1586                         proto_tree_add_item(tree, hf_bthci_evt_pin_type, tvb, offset, 1, TRUE);
1587                         offset++;
1588
1589                         break;
1590
1591                 case 0x0c0d: /* Read Stored Link Key */
1592                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1593                         offset++;
1594
1595                         proto_tree_add_item(tree, hf_bthci_evt_max_num_keys, tvb, offset, 2, TRUE);
1596                         offset+=2;
1597
1598                         proto_tree_add_item(tree, hf_bthci_evt_num_keys_read, tvb, offset, 2, TRUE);
1599                         offset+=2;
1600
1601                         break;
1602
1603                 case 0x0c11: /* Write Stored Link Key */
1604                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1605                         offset++;
1606
1607                         proto_tree_add_item(tree, hf_bthci_evt_num_keys_written, tvb, offset, 1, TRUE);
1608                         offset++;
1609
1610                         break;
1611
1612                 case 0x0c12: /* Delete Stored Link Key */
1613                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1614                         offset++;
1615
1616                         proto_tree_add_item(tree, hf_bthci_evt_num_keys_deleted, tvb, offset, 2, TRUE);
1617                         offset+=2;
1618
1619                         break;
1620
1621                 case 0x0c14: /* Read Local Name */
1622                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1623                         offset++;
1624
1625                         proto_tree_add_item(tree, hf_bthci_evt_device_name, tvb, offset, 248, FALSE);
1626                         offset+=248;
1627
1628                         break;
1629
1630                 case 0x0c19: /* Read Scan Enable */
1631                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1632                         offset++;
1633
1634                         proto_tree_add_item(tree, hf_bthci_evt_scan_enable, tvb, offset, 1, TRUE);
1635                         offset++;
1636
1637                         break;
1638
1639                 case 0x0c1f: /* Read Authentication Enable */
1640                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1641                         offset++;
1642
1643                         proto_tree_add_item(tree, hf_bthci_evt_authentication_enable, tvb, offset, 1, TRUE);
1644                         offset++;
1645
1646                         break;
1647
1648                 case 0x0c21: /* Read Encryption Mode */
1649                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1650                         offset++;
1651
1652                         proto_tree_add_item(tree, hf_bthci_evt_encryption_mode, tvb, offset, 1, TRUE);
1653                         offset++;
1654
1655                         break;
1656
1657                 case 0x0c23: /* Read Class of Device */
1658                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1659                         offset++;
1660
1661                         offset = dissect_bthci_evt_cod(tvb, offset, pinfo, tree);
1662
1663                         break;
1664
1665                 case 0x0c25: /* Read Voice Setting */
1666                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1667                         offset++;
1668
1669                         proto_tree_add_item(tree, hf_bthci_evt_input_coding, tvb, offset, 2, TRUE);
1670                         proto_tree_add_item(tree, hf_bthci_evt_input_data_format, tvb, offset, 2, TRUE);
1671                         proto_tree_add_item(tree, hf_bthci_evt_input_sample_size, tvb, offset, 2, TRUE);
1672                         offset+=2;
1673
1674                         break;
1675
1676                 case 0x0c29: /* Read Num Broadcast Retransmissions */
1677                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1678                         offset++;
1679
1680                         proto_tree_add_item(tree, hf_bthci_evt_num_broadcast_retransm, tvb, offset, 1, TRUE);
1681                         offset++;
1682
1683                         break;
1684
1685                 case 0x0c2b: /* Read Hold Mode Activity */
1686                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1687                         offset++;
1688
1689                         proto_tree_add_item(tree, hf_bthci_evt_hold_mode_act_page, tvb, offset, 1, TRUE);
1690                         proto_tree_add_item(tree, hf_bthci_evt_hold_mode_act_inquiry, tvb, offset, 1, TRUE);
1691                         proto_tree_add_item(tree, hf_bthci_evt_hold_mode_act_periodic, tvb, offset, 1, TRUE);
1692                         offset++;
1693
1694                         break;
1695
1696                 case 0x0c2d: /* Read Transmit Power Level */
1697                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1698                         offset++;
1699
1700                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1701                         offset+=2;
1702
1703                         proto_tree_add_item(tree, hf_bthci_evt_transmit_power_level, tvb, offset, 1, TRUE);
1704                         offset++;
1705
1706                         break;
1707
1708                 case 0x0c2e: /* Read SCO Flow Control Enable */
1709                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1710                         offset++;
1711
1712                         proto_tree_add_item(tree, hf_bthci_evt_sco_flow_cont_enable, tvb, offset, 1, TRUE);
1713                         offset++;
1714
1715                         break;
1716
1717
1718                 case 0x0c38: /* Read Number of Supported IAC */
1719                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1720                         offset++;
1721
1722                         proto_tree_add_item(tree, hf_bthci_evt_num_supp_iac, tvb, offset, 1, TRUE);
1723                         offset++;
1724
1725                         break; 
1726
1727                 case 0x0c39: /* Read Current IAC LAP */
1728                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1729                         offset++;
1730
1731                         num8 = tvb_get_guint8(tvb, offset);
1732                         proto_tree_add_item(tree, hf_bthci_evt_num_curr_iac, tvb, offset, 1, TRUE);
1733                         offset++;
1734
1735                         for (i=0; i<num8; i++) {
1736                                 proto_tree_add_item(tree, hf_bthci_evt_iac_lap, tvb, offset, 3, TRUE);
1737                                 offset+=3;
1738                         }
1739                         break;
1740
1741                 case 0x0c3b: /* Read Page Scan Period Mode */
1742                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1743                         offset++;
1744
1745                         proto_tree_add_item(tree, hf_bthci_evt_page_scan_period_mode, tvb, offset, 1, TRUE);
1746                         offset++;
1747
1748                         break;
1749
1750                 case 0x0c3d: /* Read Page Scan Mode */
1751                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1752                         offset++;
1753
1754                         proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, TRUE);
1755                         offset++;
1756
1757                         break;
1758
1759                 case 0x0c42: /* Read Inquiry Scan Type */
1760                 case 0x0c46: /* Read Page Scan Type */
1761                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1762                         offset++;
1763                         proto_tree_add_item(tree, hf_bthci_evt_scan_type, tvb, offset, 1, TRUE);
1764                         offset++;
1765                         break;
1766
1767                 case 0x0c44: /* Read Inquiry Mode */
1768                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1769                         offset++;
1770                         proto_tree_add_item(tree, hf_bthci_evt_inq_mode, tvb, offset, 1, TRUE);
1771                         offset++;
1772                         break;
1773
1774                 case 0x0c48: /* Read AFH Channel Assessment Mode */
1775                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1776                         offset++;
1777                         proto_tree_add_item(tree, hf_bthci_evt_afh_ch_assessment_mode, tvb, offset, 1, TRUE);
1778                         offset++;
1779                         break;
1780
1781                 case 0x0c51: /* Read Extended Inquiry Response */
1782                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1783                         offset++;
1784
1785                         proto_tree_add_item(tree, hf_bthci_evt_fec_required, tvb, offset, 1, TRUE);
1786                         offset++;
1787
1788                         offset=dissect_bthci_evt_ext_inquiry_response(tvb, offset, pinfo, tree);
1789                         break;
1790
1791                 case 0x0c55: /* Read Simple Pairing Mode */
1792                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1793                         offset++;
1794
1795                         proto_tree_add_item(tree, hf_bthci_evt_simple_pairing_mode, tvb, offset, 1, TRUE);
1796                         offset++;
1797                         break;
1798
1799                 case 0x0c57: /* Read Local OOB Data */
1800                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1801                         offset++;
1802                         proto_tree_add_item(tree, hf_bthci_evt_hash_c, tvb, offset, 2, TRUE);
1803                         offset+=2;
1804                         proto_tree_add_item(tree, hf_bthci_evt_randomizer_r, tvb, offset, 2, TRUE);
1805                         offset+=2;
1806                         break;
1807
1808                 case 0x0c58: /* Read Inquiry Response Tx Power Level */
1809                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1810                         offset++;
1811                         proto_tree_add_item(tree, hf_bthci_evt_power_level_type, tvb, offset, 1, TRUE);
1812                         offset++;
1813                         break;
1814                         
1815
1816                 case 0x0c5a: /* Read Default Erroneous Data Reporting */
1817                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1818                         offset++;
1819
1820                         proto_tree_add_item(tree, hf_bthci_evt_err_data_reporting, tvb, offset, 1, TRUE);
1821                         offset++;
1822
1823                         break;
1824                         
1825                 case 0x1001: /* Read Local Version Information */
1826                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1827                         offset++;
1828
1829                         proto_tree_add_item(tree, hf_bthci_evt_hci_vers_nr, tvb, offset, 1, TRUE);
1830                         offset++;
1831
1832                         proto_tree_add_item(tree, hf_bthci_evt_hci_revision, tvb, offset, 2, TRUE);
1833                         offset+=2;
1834
1835                         proto_tree_add_item(tree, hf_bthci_evt_vers_nr, tvb, offset, 1, TRUE);
1836                         offset++;
1837
1838                         proto_tree_add_item(tree, hf_bthci_evt_comp_id, tvb, offset, 2, TRUE);
1839                         offset+=2;
1840
1841                         proto_tree_add_item(tree, hf_bthci_evt_sub_vers_nr, tvb, offset, 2, TRUE);
1842                         offset+=2;
1843
1844                         break;
1845
1846                 case 0x1002: /* Read Local Supported Commands */
1847                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1848                         offset++;
1849
1850                         proto_tree_add_item(tree, hf_bthci_evt_local_supported_cmds, tvb, offset, 64, TRUE);
1851                         offset+=64;
1852                         
1853                         break;
1854
1855                 case 0x1003: /* Read Local Supported Features */
1856                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1857                         offset++;
1858
1859                         offset=dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree);
1860
1861                         break;
1862
1863                 case 0x1004: /* Read Local Extended Features */
1864                         {
1865                                 guint8 page_number;
1866
1867                                 proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1868                                 offset++;
1869
1870                                 page_number = tvb_get_guint8(tvb, offset);                      
1871                                 proto_tree_add_item(tree, hf_bthci_evt_page_number, tvb, offset, 1, TRUE);
1872                                 offset++;
1873
1874                                 proto_tree_add_item(tree, hf_bthci_evt_max_page_number, tvb, offset, 1, TRUE);
1875                                 offset++;
1876
1877                                 if( page_number == 0 ){
1878                                         offset=dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree);
1879                                 }
1880                                 else {
1881                                         proto_tree_add_item(tree, hf_bthci_evt_ext_lmp_features, tvb, offset, 8, TRUE);
1882                                         offset+=8;
1883                                 }
1884                         }
1885
1886                         break;
1887
1888                 case 0x1005: /* Read Buffer Size */
1889                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1890                         offset++;
1891
1892                         proto_tree_add_item(tree, hf_bthci_evt_host_data_packet_length_acl, tvb, offset, 2, TRUE);
1893                         offset+=2;
1894
1895                         proto_tree_add_item(tree, hf_bthci_evt_host_data_packet_length_sco, tvb, offset, 1, TRUE);
1896                         offset++;
1897
1898                         proto_tree_add_item(tree, hf_bthci_evt_host_total_num_acl_data_packets, tvb, offset, 2, TRUE);
1899                         offset+=2;
1900
1901                         proto_tree_add_item(tree, hf_bthci_evt_host_total_num_sco_data_packets, tvb, offset, 2, TRUE);
1902                         offset+=2;
1903
1904                         break;
1905
1906                 case 0x1007: /* Read Country Code */
1907                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1908                         offset++;
1909
1910                         proto_tree_add_item(tree, hf_bthci_evt_country_code, tvb, offset, 1, TRUE);
1911                         offset++;
1912
1913                         break;
1914
1915                 case 0x1401: /* Read Failed Contact Counter */
1916                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1917                         offset++; 
1918
1919                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1920                         offset+=2;
1921
1922                         proto_tree_add_item(tree, hf_bthci_evt_failed_contact_counter, tvb, offset, 2, TRUE);
1923                         offset+=2;
1924
1925                         break;
1926
1927                 case 0x1403: /* Get Link Quality */
1928                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1929                         offset++;
1930
1931                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1932                         offset+=2;
1933
1934                         proto_tree_add_item(tree, hf_bthci_evt_link_quality, tvb, offset, 1, TRUE);
1935                         offset++;
1936
1937                         break;
1938
1939                 case 0x1405: /* Read RSSI */
1940                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1941                         offset++;
1942
1943                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1944                         offset+=2;
1945
1946                         proto_tree_add_item(tree, hf_bthci_evt_rssi, tvb, offset, 1, TRUE);
1947                         offset++;
1948
1949                         break;
1950
1951                 case 0x1406: /* Read AFH Channel Map */
1952                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1953                         offset++;
1954
1955                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1956                         offset+=2;
1957
1958                         proto_tree_add_item(tree, hf_bthci_evt_afh_mode, tvb, offset, 1, TRUE);
1959                         offset++;
1960
1961                         proto_tree_add_item(tree, hf_bthci_evt_afh_channel_map, tvb, offset, 10, TRUE);
1962                         offset+=10;
1963         
1964                         break;
1965                 
1966                 case 0x1407: /* Read Clock */
1967                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1968                         offset++;
1969
1970                         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
1971                         offset+=2;
1972
1973                         proto_tree_add_item(tree, hf_bthci_evt_clock, tvb, offset, 4, TRUE);
1974                         offset+=4;
1975
1976                         accuracy = tvb_get_letohl(tvb, offset);
1977                         item = proto_tree_add_item(tree, hf_bthci_evt_clock_accuracy, tvb, offset, 2, TRUE);
1978                         proto_item_append_text(item, " %g msec", accuracy*0.3125);
1979                         offset+=2;
1980         
1981                         break;
1982
1983                 case 0x1801: /* Read Loopback Mode */
1984                         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
1985                         offset++;
1986
1987                         proto_tree_add_item(tree, hf_bthci_evt_loopback_mode, tvb, offset, 1, TRUE);
1988                         offset++;
1989
1990                         break;
1991
1992                 default:
1993                         proto_tree_add_item(tree, hf_bthci_evt_ret_params, tvb, offset, -1, TRUE);
1994                         offset+=tvb_length_remaining(tvb, offset);
1995                         break;
1996         }
1997
1998         return offset;
1999 }
2000
2001 static int 
2002 dissect_bthci_evt_qos_setup_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2003 {
2004         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2005         offset++;
2006
2007         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2008         offset+=2;
2009
2010         proto_tree_add_item(tree, hf_bthci_evt_flags, tvb, offset, 1, TRUE);
2011         offset++;
2012
2013         proto_tree_add_item(tree, hf_bthci_evt_service_type, tvb, offset, 1, TRUE);
2014         offset++;
2015
2016         proto_tree_add_item(tree, hf_bthci_evt_token_rate, tvb, offset, 4, TRUE);
2017         offset+=4;
2018
2019         proto_tree_add_item(tree, hf_bthci_evt_peak_bandwidth, tvb, offset, 4, TRUE);
2020         offset+=4;
2021
2022         proto_tree_add_item(tree, hf_bthci_evt_latency, tvb, offset, 4, TRUE);
2023         offset+=4;
2024
2025         proto_tree_add_item(tree, hf_bthci_evt_delay_variation, tvb, offset, 4, TRUE);
2026         offset+=4;
2027
2028         return offset;
2029 }
2030
2031 static int 
2032 dissect_bthci_evt_change_conn_link_key_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2033 {
2034         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2035         offset++;
2036
2037         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2038         offset+=2;
2039
2040         return offset;
2041 }
2042
2043 static int 
2044 dissect_bthci_evt_master_link_key_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2045 {
2046         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2047         offset++;
2048
2049         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2050         offset+=2;
2051
2052         proto_tree_add_item(tree, hf_bthci_evt_key_flag, tvb, offset, 1, TRUE);
2053         offset++;
2054
2055         return offset;
2056 }
2057
2058 static int 
2059 dissect_bthci_evt_encryption_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2060 {
2061         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2062         offset++;
2063
2064         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2065         offset+=2;
2066
2067         proto_tree_add_item(tree, hf_bthci_evt_encryption_enable, tvb, offset, 1, TRUE);
2068         offset++;
2069
2070         return offset;
2071 }
2072
2073 static int 
2074 dissect_bthci_evt_read_remote_ext_features_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2075 {
2076         guint8 page_number;
2077
2078         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2079         offset++;
2080
2081         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2082         offset+=2;
2083
2084         page_number = tvb_get_guint8(tvb, offset);
2085         proto_tree_add_item(tree, hf_bthci_evt_page_number, tvb, offset, 1, TRUE);
2086         offset++;
2087
2088         proto_tree_add_item(tree, hf_bthci_evt_max_page_number, tvb, offset, 1, TRUE);
2089         offset++;
2090
2091         if( page_number == 0 ){
2092                 offset=dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree);
2093         }
2094         else {
2095                 proto_tree_add_item(tree, hf_bthci_evt_ext_lmp_features, tvb, offset, 8, TRUE);
2096                 offset+=8;
2097         }
2098
2099         return offset;
2100 }
2101
2102 static int
2103 dissect_bthci_evt_sync_connection_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2104 {
2105         proto_item *item;
2106
2107         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2108         offset++;
2109
2110         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2111         offset+=2;
2112
2113         offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
2114         
2115         proto_tree_add_item(tree, hf_bthci_evt_sync_link_type, tvb, offset, 1, TRUE);
2116         offset++;
2117         
2118         item = proto_tree_add_item(tree, hf_bthci_evt_sync_tx_interval, tvb, offset, 1, TRUE);
2119         proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
2120         offset++;
2121
2122         item = proto_tree_add_item(tree, hf_bthci_evt_sync_rtx_window, tvb, offset, 1, TRUE);
2123         proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
2124         offset++;
2125
2126         proto_tree_add_item(tree, hf_bthci_evt_sync_rx_packet_length, tvb, offset, 2, TRUE);
2127         offset+=2;
2128
2129         proto_tree_add_item(tree, hf_bthci_evt_sync_tx_packet_length, tvb, offset, 2, TRUE);
2130         offset+=2;
2131
2132         proto_tree_add_item(tree, hf_bthci_evt_air_mode, tvb, offset, 1, TRUE);
2133         offset++;
2134
2135         return offset;
2136 }
2137
2138 static int
2139 dissect_bthci_evt_sync_connection_changed(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2140 {
2141         proto_item *item;
2142
2143         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2144         offset++;
2145
2146         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2147         offset+=2;
2148
2149         item = proto_tree_add_item(tree, hf_bthci_evt_sync_tx_interval, tvb, offset, 1, TRUE);
2150         proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
2151         offset++;
2152
2153         item = proto_tree_add_item(tree, hf_bthci_evt_sync_rtx_window, tvb, offset, 1, TRUE);
2154         proto_item_append_text(item, " slots (%g msec)",  tvb_get_guint8(tvb, offset)*0.625);
2155         offset++;
2156
2157         proto_tree_add_item(tree, hf_bthci_evt_sync_rx_packet_length, tvb, offset, 2, TRUE);
2158         offset+=2;
2159
2160         proto_tree_add_item(tree, hf_bthci_evt_sync_tx_packet_length, tvb, offset, 2, TRUE);
2161         offset+=2;
2162
2163         return offset;
2164 }
2165
2166 static int
2167 dissect_bthci_evt_sniff_subrating(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2168 {
2169         proto_item *item;
2170
2171         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2172         offset++;
2173
2174         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2175         offset+=2;
2176
2177         item = proto_tree_add_item(tree, hf_bthci_evt_max_tx_latency, tvb, offset, 2, TRUE);
2178         proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
2179         offset+=2;
2180
2181         item = proto_tree_add_item(tree, hf_bthci_evt_max_rx_latency, tvb, offset, 2, TRUE);
2182         proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
2183         offset+=2;
2184
2185         item = proto_tree_add_item(tree, hf_bthci_evt_min_remote_timeout, tvb, offset, 2, TRUE);
2186         proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
2187         offset+=2;
2188
2189         item = proto_tree_add_item(tree, hf_bthci_evt_min_local_timeout, tvb, offset, 2, TRUE);
2190         proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
2191         offset+=2;
2192
2193         return offset;
2194 }
2195
2196 static int
2197 dissect_bthci_evt_flow_specification_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2198 {
2199         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2200         offset++;
2201
2202         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2203         offset+=2;
2204
2205         proto_tree_add_item(tree, hf_bthci_evt_flags, tvb, offset, 1, TRUE);
2206         offset++;
2207
2208         proto_tree_add_item(tree, hf_bthci_evt_flow_direction, tvb, offset, 1, TRUE);
2209         offset++;
2210
2211         proto_tree_add_item(tree, hf_bthci_evt_service_type, tvb, offset, 1, TRUE);
2212         offset++;
2213
2214         proto_tree_add_item(tree, hf_bthci_evt_token_rate, tvb, offset, 4, TRUE);
2215         offset+=4;
2216
2217         proto_tree_add_item(tree, hf_bthci_evt_token_bucket_size, tvb, offset, 4, TRUE);
2218         offset+=4;
2219
2220         proto_tree_add_item(tree, hf_bthci_evt_peak_bandwidth, tvb, offset, 4, TRUE);
2221         offset+=4;
2222
2223         proto_tree_add_item(tree, hf_bthci_evt_latency, tvb, offset, 4, TRUE);
2224         offset+=4;
2225
2226         return offset;
2227 }
2228
2229 static int
2230 dissect_bthci_evt_enhanced_flush_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2231 {
2232         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2233         offset+=2;
2234
2235         return offset;
2236 }
2237
2238 static int
2239 dissect_bthci_evt_encryption_key_refresh_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2240 {
2241         proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, TRUE);
2242         offset++;
2243
2244         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2245         offset+=2;
2246
2247         return offset;
2248 }
2249
2250 static int
2251 dissect_bthci_evt_link_supervision_timeout_changed(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2252 {
2253         proto_item *item;
2254
2255         proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, TRUE);
2256         offset+=2;
2257
2258         item = proto_tree_add_item(tree, hf_bthci_evt_link_supervision_timeout, tvb, offset, 2, TRUE);
2259         proto_item_append_text(item, " slots (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
2260         offset+=2;
2261
2262         return offset;
2263 }
2264
2265 static int 
2266 dissect_bthci_evt_inq_result(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
2267 {
2268         guint8 num, evt_num_responses;
2269
2270         evt_num_responses = tvb_get_guint8(tvb, offset);
2271         proto_tree_add_item(tree, hf_bthci_evt_num_responses, tvb, offset, 1, TRUE);
2272         offset++;
2273
2274         for(num=0;num<evt_num_responses;num++){
2275                 offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree);
2276
2277                 proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, TRUE);
2278                 offset++;
2279
2280                 proto_tree_add_item(tree, hf_bthci_evt_page_scan_period_mode, tvb, offset, 1, TRUE);
2281                 offset++;
2282
2283                 proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, TRUE);
2284                 offset++;
2285
2286                 offset = dissect_bthci_evt_cod(tvb, offset, pinfo, tree);
2287
2288                 proto_tree_add_item(tree, hf_bthci_evt_clock_offset, tvb, offset, 2, TRUE);
2289                 offset+=2;
2290         }
2291
2292         return offset;
2293 }
2294
2295
2296 /* Code to actually dissect the packets */
2297 static void 
2298 dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2299 {
2300         proto_item *ti;
2301         proto_tree *bthci_evt_tree=NULL;
2302         guint8 param_length, evt_code;
2303         int offset=0;
2304
2305         if(tree){
2306                 ti=proto_tree_add_item(tree, proto_bthci_evt, tvb, offset, -1, FALSE);
2307                 bthci_evt_tree=proto_item_add_subtree(ti, ett_bthci_evt);
2308         }
2309
2310         evt_code = tvb_get_guint8(tvb, offset);
2311         proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_code, tvb, offset, 1, TRUE);
2312         proto_item_append_text(bthci_evt_tree, " - %s", val_to_str(evt_code, evt_code_vals, "Unknown 0x%08x"));
2313         offset++;
2314
2315         param_length = tvb_get_guint8(tvb, offset);
2316         proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_param_length, tvb, offset, 1, TRUE);
2317         offset++;
2318
2319
2320         if(check_col(pinfo->cinfo, COL_PROTOCOL)){
2321                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_EVT");
2322         }
2323
2324         if((check_col(pinfo->cinfo, COL_INFO))){
2325                 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(evt_code, evt_code_vals, "Unknown 0x%08x"));
2326         }
2327
2328
2329         if (param_length > 0) {
2330                 switch(evt_code) {
2331                 case 0x01: /* Inquiry Complete */
2332                         offset=dissect_bthci_evt_inq_complete(tvb, offset, pinfo, bthci_evt_tree);
2333                         break;
2334
2335                 case 0x02: /* Inquiry result event  */
2336                         offset=dissect_bthci_evt_inq_result(tvb, offset, pinfo, bthci_evt_tree);
2337                         break;
2338
2339                 case 0x03: /* Connection Complete */
2340                         offset=dissect_bthci_evt_conn_complete(tvb, offset, pinfo, bthci_evt_tree);
2341                         break;
2342
2343                 case 0x04: /* Connection Request */
2344                         offset=dissect_bthci_evt_conn_request(tvb, offset, pinfo, bthci_evt_tree);
2345                         break;
2346
2347                 case 0x05: /* Disconnection Complete */
2348                         offset=dissect_bthci_evt_disconn_complete(tvb, offset, pinfo, bthci_evt_tree);
2349                         break;
2350
2351                 case 0x06: /* Authentication Complete */
2352                         offset=dissect_bthci_evt_auth_complete(tvb, offset, pinfo, bthci_evt_tree);
2353                         break;
2354
2355                 case 0x07: /* Remote Name Request Complete */
2356                         offset=dissect_bthci_evt_remote_name_req_complete(tvb, offset, pinfo, bthci_evt_tree);
2357                         break;
2358
2359                 case 0x08: /* Encryption Change */
2360                         offset=dissect_bthci_evt_encryption_change(tvb, offset, pinfo, bthci_evt_tree);
2361                         break;
2362
2363                 case 0x09: /* Change Connection Link Key Complete */
2364                         offset=dissect_bthci_evt_change_conn_link_key_complete(tvb, offset, pinfo, bthci_evt_tree);
2365                         break;
2366
2367                 case 0x0a: /* Master Link Key Complete */
2368                         offset=dissect_bthci_evt_master_link_key_complete(tvb, offset, pinfo, bthci_evt_tree);
2369                         break;
2370
2371                 case 0x0b: /* Read Remote Support Features Complete */
2372                         offset=dissect_bthci_evt_read_remote_support_features_complete(tvb, offset, pinfo, bthci_evt_tree);
2373                         break;
2374
2375                 case 0x0c: /* Read Remote Version Information Complete */
2376                         offset=dissect_bthci_evt_read_remote_version_information_complete(tvb, offset, pinfo, bthci_evt_tree);
2377                         break;
2378
2379                 case 0x0d: /* QoS Setup Complete */
2380                         offset=dissect_bthci_evt_qos_setup_complete(tvb, offset, pinfo, bthci_evt_tree);
2381                         break;
2382
2383                 case 0x0e: /* Command Complete */
2384                         offset=dissect_bthci_evt_command_complete(tvb, offset, pinfo, bthci_evt_tree);
2385                         break;
2386
2387                 case 0x0f: /* Command Status */
2388                         offset=dissect_bthci_evt_command_status(tvb, offset, pinfo, bthci_evt_tree);
2389                         break;
2390
2391                 case 0x10: /* Hardware Error */
2392                         offset=dissect_bthci_evt_hardware_error(tvb, offset, pinfo, bthci_evt_tree);
2393                         break;
2394
2395                 case 0x11: /* Flush Occurred */
2396                         offset=dissect_bthci_evt_flush_occured(tvb, offset, pinfo, bthci_evt_tree);
2397                         break;
2398
2399                 case 0x12: /* Role Change */
2400                         offset=dissect_bthci_evt_role_change(tvb, offset, pinfo, bthci_evt_tree);
2401                         break;
2402
2403                 case 0x13: /* Number Of Completed Packets */ 
2404                         offset=dissect_bthci_evt_number_of_completed_packets(tvb, offset, pinfo, bthci_evt_tree);
2405                         break;
2406
2407                 case 0x14: /* Mode Change */
2408                         offset=dissect_bthci_evt_mode_change(tvb, offset, pinfo, bthci_evt_tree);
2409                         break;
2410
2411                 case 0x15: /* Return Link Keys */
2412                         offset=dissect_bthci_evt_return_link_keys(tvb, offset, pinfo, bthci_evt_tree);
2413                         break;
2414
2415                 case 0x16: /* PIN Code Request */
2416                         offset=dissect_bthci_evt_pin_code_request(tvb, offset, pinfo, bthci_evt_tree);
2417                         break;
2418
2419                 case 0x17: /* Link Key Request */
2420                         offset=dissect_bthci_evt_link_key_request(tvb, offset, pinfo, bthci_evt_tree);
2421                         break;
2422
2423                 case 0x18: /* Link Key Notification */
2424                         offset=dissect_bthci_evt_link_key_notification(tvb, offset, pinfo, bthci_evt_tree);
2425                         break;
2426
2427                 case 0x19: /* Loopback Command */
2428                         offset=dissect_bthci_evt_loopback_command(tvb, offset, pinfo, bthci_evt_tree);
2429                         break;
2430
2431                 case 0x1a: /* Data Buffer Overflow */
2432                         offset=dissect_bthci_evt_data_buffer_overflow(tvb, offset, pinfo, bthci_evt_tree);
2433                         break;
2434
2435                 case 0x1b: /* Max Slots Change */
2436                         offset=dissect_bthci_evt_max_slots_change(tvb, offset, pinfo, bthci_evt_tree);
2437                         break;
2438
2439                 case 0x1c: /* Read Clock Offset Complete */
2440                         offset=dissect_bthci_evt_read_clock_offset_complete(tvb, offset, pinfo, bthci_evt_tree);
2441                         break;
2442
2443                 case 0x1d: /* Connection Packet Type Changed */
2444                         offset=dissect_bthci_evt_conn_packet_type_changed(tvb, offset, pinfo, bthci_evt_tree);
2445                         break;
2446
2447                 case 0x1e: /* QoS Violation */
2448                         offset=dissect_bthci_evt_qos_violation(tvb, offset, pinfo, bthci_evt_tree);
2449                         break;
2450
2451                 case 0x1f: /* Page Scan Mode Change */
2452                         offset=dissect_bthci_evt_page_scan_mode_change(tvb, offset, pinfo, bthci_evt_tree);
2453                         break;
2454
2455                 case 0x20: /* Page Scan Repetition Mode Change */
2456                         offset=dissect_bthci_evt_page_scan_repetition_mode_change(tvb, offset, pinfo, bthci_evt_tree);
2457                         break;
2458
2459                 case 0x21: /* Flow Specification Complete */
2460                         offset=dissect_bthci_evt_flow_specification_complete(tvb, offset, pinfo, bthci_evt_tree);
2461                         break;
2462
2463                 case 0x22: /* Inquiry Result with RSSI */
2464                         offset=dissect_bthci_evt_inq_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree);
2465                         break;
2466
2467                 case 0x23: /* Read Remote Extended Features Complete */
2468                         offset=dissect_bthci_evt_read_remote_ext_features_complete(tvb, offset, pinfo, bthci_evt_tree);
2469                         break;
2470
2471                 case 0x2c: /* Synchronous Connection Complete */
2472                         offset=dissect_bthci_evt_sync_connection_complete(tvb, offset, pinfo, bthci_evt_tree);
2473                         break;
2474
2475                 case 0x2d: /* Synchronous Connection Changed */
2476                         offset=dissect_bthci_evt_sync_connection_changed(tvb, offset, pinfo, bthci_evt_tree);
2477                         break;
2478
2479                 case 0x2e: /* Sniff Subrating */
2480                         offset=dissect_bthci_evt_sniff_subrating(tvb, offset, pinfo, bthci_evt_tree);
2481                         break;
2482
2483                 case 0x2f: /* Extended Inquiry Result */
2484                         offset=dissect_bthci_evt_inq_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree);
2485                         offset=dissect_bthci_evt_ext_inquiry_response(tvb, offset, pinfo, bthci_evt_tree);
2486                         break;
2487
2488                 case 0x30: /* Encryption Key Refresh Complete */
2489                         offset=dissect_bthci_evt_encryption_key_refresh_complete(tvb, offset, pinfo, bthci_evt_tree);
2490                         break;
2491
2492                 case 0x31: /* IO Capability Request */
2493                         offset=dissect_bthci_evt_io_capability_request(tvb, offset, pinfo, bthci_evt_tree);
2494                         break;
2495
2496                 case 0x32: /* IO Capability Response */
2497                         offset=dissect_bthci_evt_io_capability_response(tvb, offset, pinfo, bthci_evt_tree);
2498                         break;
2499
2500                 case 0x33: /* User Confirmation Request */
2501                         offset=dissect_bthci_evt_user_confirmation_request(tvb, offset, pinfo, bthci_evt_tree);
2502                         break;
2503
2504                 case 0x34: /* User Passkey Request */
2505                         offset=dissect_bthci_evt_user_passkey_request(tvb, offset, pinfo, bthci_evt_tree);
2506                         break;
2507
2508                 case 0x35: /* Remote OOB Data Request */
2509                         offset=dissect_bthci_evt_remote_oob_data_request(tvb, offset, pinfo, bthci_evt_tree);
2510                         break;
2511
2512                 case 0x36: /* Simple Pairing Complete */
2513                         offset=dissect_bthci_evt_simple_pairing_complete(tvb, offset, pinfo, bthci_evt_tree);
2514                         break;
2515
2516                 case 0x38: /* Link Supervision Timeout Changed */
2517                         offset=dissect_bthci_evt_link_supervision_timeout_changed(tvb, offset, pinfo, bthci_evt_tree);
2518                         break;
2519
2520                 case 0x39: /* Enhanced Flush Complete */
2521                         offset=dissect_bthci_evt_enhanced_flush_complete(tvb, offset, pinfo, bthci_evt_tree);
2522                         break;
2523
2524                 case 0x3b: /* Enhanced Flush Complete */
2525                         offset=dissect_bthci_evt_user_passkey_notification(tvb, offset, pinfo, bthci_evt_tree);
2526                         break;
2527
2528                 case 0x3c: /* Enhanced Flush Complete */
2529                         offset=dissect_bthci_evt_keypress_notification(tvb, offset, pinfo, bthci_evt_tree);
2530                         break;
2531                         
2532                 case 0x3d: /* Remote Host Supported Features Notification */
2533                         offset=dissect_bthci_evt_remote_host_sup_feat_notification(tvb, offset, pinfo, bthci_evt_tree);
2534                         break;
2535
2536                 default:
2537                         proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_params, tvb, 2, -1, TRUE);    
2538                         break;
2539                 }
2540
2541         }
2542 }
2543
2544
2545 /* Register the protocol with Wireshark */
2546
2547 /* this format is require because a script is used to build the C function
2548    that calls all the protocol registration.
2549    */
2550
2551 void
2552 proto_register_bthci_evt(void)
2553 {                 
2554
2555         /* Setup list of header fields  See Section 1.6.1 for details*/
2556         static hf_register_info hf[] = {
2557                 { &hf_bthci_evt_code,
2558                         { "Event Code",           "bthci_evt.code",
2559                                 FT_UINT8, BASE_HEX, VALS(evt_code_vals), 0x0,          
2560                                 NULL, HFILL }
2561                 },
2562                 { &hf_bthci_evt_param_length,
2563                         { "Parameter Total Length",           "bthci_evt.param_length",
2564                                 FT_UINT8, BASE_DEC, NULL, 0x0,          
2565                                 NULL, HFILL }
2566                 },
2567                 { &hf_bthci_evt_params,
2568                         { "Event Parameter",           "bthci_evt.params",
2569                                 FT_NONE, BASE_NONE, NULL, 0x0,          
2570                                 NULL, HFILL }
2571                 },
2572                 { &hf_bthci_evt_num_command_packets,
2573                         { "Number of Allowed Command Packets",           "bthci_evt.num_command_packets",
2574                                 FT_UINT8, BASE_DEC, NULL, 0x0,          
2575                                 NULL, HFILL }
2576                 },
2577                 { &hf_bthci_evt_num_handles,
2578                         { "Number of Connection Handles",           "bthci_evt.num_handles",
2579                                 FT_UINT8, BASE_DEC, NULL, 0x0,          
2580                                 "Number of Connection Handles and Num_HCI_Data_Packets parameter pairs", HFILL }
2581                 },
2582                 { &hf_bthci_evt_connection_handle,
2583                         { "Connection Handle",             "bthci_evt.connection_handle",
2584                                 FT_UINT16, BASE_HEX, NULL, 0x0,
2585                                 NULL, HFILL }
2586                 },
2587
2588                 { &hf_bthci_evt_num_compl_packets,
2589                         { "Number of Completed Packets",        "bthci_evt.num_compl_packets",
2590                                 FT_UINT16, BASE_DEC, NULL, 0x0,
2591                                 "The number of HCI Data Packets that have been completed", HFILL }
2592                 },
2593
2594                 { &hf_bthci_evt_com_opcode,
2595                         { "Command Opcode",           "bthci_evt.com_opcode",
2596                                 FT_UINT16, BASE_HEX, VALS(bthci_cmd_opcode_vals), 0x0,          
2597                                 NULL, HFILL }
2598                 },
2599                 { &hf_bthci_evt_ogf,
2600                         { "ogf",           "bthci_evt.ogf",
2601                                 FT_UINT16, BASE_HEX, VALS(bthci_ogf_vals), 0xfc00,          
2602                                 "Opcode Group Field", HFILL }
2603                 },
2604                 { &hf_bthci_evt_ocf,
2605                         { "ocf",           "bthci_evt.ocf",
2606                                 FT_UINT16, BASE_HEX, NULL, 0x03ff,          
2607                                 "Opcode Command Field", HFILL }
2608                 },
2609                 { &hf_bthci_evt_ret_params,
2610                         { "Return Parameter",           "bthci_evt.ret_params",
2611                                 FT_NONE, BASE_NONE, NULL, 0x0,          
2612                                 NULL, HFILL }
2613                 },
2614                 { &hf_bthci_evt_status,
2615                         { "Status",           "bthci_evt.status",
2616                                 FT_UINT8, BASE_HEX, VALS(bthci_cmd_status_vals), 0x0,          
2617                                 NULL, HFILL }
2618                 },
2619                 { &hf_bthci_evt_status_pending,
2620                         { "Status", "bthci_evt.status",
2621                                 FT_UINT8, BASE_HEX, VALS(bthci_cmd_status_pending_vals), 0x0,          
2622                                 NULL, HFILL }
2623                 },
2624                 { &hf_bthci_evt_bd_addr,
2625                         { "BD_ADDR:",          "bthci_evt.bd_addr",
2626                                 FT_NONE, BASE_NONE, NULL, 0x0,
2627                                 "Bluetooth Device Address", HFILL}
2628                 },
2629                 { &hf_bthci_evt_class_of_device,
2630                         { "Class of Device", "bthci_evt.class_of_device",
2631                                 FT_UINT24, BASE_HEX, NULL, 0x0,
2632                                 NULL, HFILL }
2633                 },
2634                 { &hf_bthci_evt_link_type,
2635                         { "Link Type",        "bthci_evt.link_type",
2636                                 FT_UINT8, BASE_HEX, VALS(evt_link_types), 0x0,
2637                                 NULL, HFILL }
2638                 },
2639                 { &hf_bthci_evt_encryption_mode,
2640                         { "Encryption Mode",  "bthci_evt.encryption_mode",
2641                                 FT_UINT8, BASE_HEX, VALS(evt_encryption_modes), 0x0,
2642                                 NULL, HFILL }
2643                 },
2644                 { &hf_bthci_evt_reason,
2645                         { "Reason",           "bthci_evt.reason",
2646                                 FT_UINT8, BASE_HEX, VALS(bthci_cmd_status_vals), 0x0,          
2647                                 NULL, HFILL }
2648                 },
2649                 { &hf_bthci_evt_remote_name,
2650                         { "Remote Name",           "bthci_evt.remote_name",
2651                                 FT_STRINGZ, BASE_NONE, NULL, 0x0,          
2652                                 "Userfriendly descriptive name for the remote device", HFILL }
2653                 },
2654                 { &hf_bthci_evt_encryption_enable,
2655                         { "Encryption Enable",        "bthci_evt.encryption_enable",
2656                                 FT_UINT8, BASE_HEX, VALS(evt_encryption_enable), 0x0,
2657                                 NULL, HFILL }
2658                 },
2659                 { &hf_bthci_evt_key_flag,
2660                         { "Key Flag",        "bthci_evt.key_flag",
2661                                 FT_UINT8, BASE_HEX, VALS(evt_key_flag), 0x0,
2662                                 NULL, HFILL }
2663                 },
2664                 { &hf_bthci_evt_vers_nr,
2665                         { "LMP Version",        "bthci_evt.lmp_vers_nr",
2666                                 FT_UINT8, BASE_HEX, VALS(evt_lmp_vers_nr), 0x0,
2667                                 "Version of the Current LMP", HFILL }
2668                 },
2669                 { &hf_bthci_evt_hci_vers_nr,
2670                         { "HCI Version",        "bthci_evt.hci_vers_nr",
2671                                 FT_UINT8, BASE_HEX, VALS(evt_hci_vers_nr), 0x0,
2672                                 "Version of the Current HCI", HFILL }
2673                 },
2674                 { &hf_bthci_evt_hci_revision,
2675                         { "HCI Revision",        "bthci_evt.hci_vers_nr",
2676                                 FT_UINT16, BASE_DEC, NULL, 0x0,
2677                                 "Revision of the Current HCI", HFILL }
2678                 },
2679                 { &hf_bthci_evt_comp_id,
2680                         { "Manufacturer Name",        "bthci_evt.comp_id",
2681                                 FT_UINT16, BASE_HEX, VALS(evt_comp_id), 0x0,
2682                                 "Manufacturer Name of Bluetooth Hardware", HFILL }
2683                 },
2684                 { &hf_bthci_evt_sub_vers_nr,
2685                         { "LMP Subversion",        "bthci_evt.lmp_sub_vers_nr",
2686                                 FT_UINT16, BASE_DEC, NULL, 0x0,
2687                                 "Subversion of the Current LMP", HFILL }
2688                 },
2689                 { &hf_bthci_evt_flags,
2690                         { "Flags",        "bthci_evt.flags",
2691                                 FT_UINT8, BASE_HEX, NULL, 0x0,
2692                                 NULL, HFILL }
2693                 },
2694                 { &hf_bthci_evt_service_type,
2695                         { "Service Type",        "bthci_evt.service_type",
2696                                 FT_UINT8, BASE_HEX, VALS(evt_service_types), 0x0,
2697                                 NULL, HFILL }
2698                 },
2699                 { &hf_bthci_evt_token_rate,
2700                         { "Available Token Rate",        "bthci_evt.token_rate",
2701                                 FT_UINT32, BASE_DEC, NULL, 0x0,
2702                                 "Available Token Rate, in bytes per second", HFILL }
2703                 },
2704                 { &hf_bthci_evt_peak_bandwidth,
2705                         { "Available Peak Bandwidth",        "bthci_evt.peak_bandwidth",
2706                                 FT_UINT32, BASE_DEC, NULL, 0x0,
2707                                 "Available Peak Bandwidth, in bytes per second", HFILL }
2708                 },
2709                 { &hf_bthci_evt_latency,
2710                         { "Available Latency",        "bthci_evt.latency",
2711                                 FT_UINT32, BASE_DEC, NULL, 0x0,
2712                                 "Available Latency, in microseconds", HFILL }
2713                 },
2714                 { &hf_bthci_evt_delay_variation,
2715                         { "Available Delay Variation",        "bthci_evt.delay_variation",
2716                                 FT_UINT32, BASE_DEC, NULL, 0x0,
2717                                 "Available Delay Variation, in microseconds", HFILL }
2718                 },
2719                 { &hf_bthci_evt_hardware_code,
2720                         { "Hardware Code",        "bthci_evt.hardware_code",
2721                                 FT_UINT8, BASE_HEX, NULL, 0x0,
2722                                 "Hardware Code (implementation specific)", HFILL }
2723                 },
2724                 { &hf_bthci_evt_role,
2725                         { "Role",        "bthci_evt.role",
2726                                 FT_UINT8, BASE_HEX, VALS(evt_role_vals), 0x0,
2727                                 NULL, HFILL }
2728                 },
2729                 { &hf_bthci_evt_curr_mode,
2730                         { "Current Mode",        "bthci_evt.current_mode",
2731                                 FT_UINT8, BASE_HEX, VALS(evt_modes), 0x0,
2732                                 NULL, HFILL }
2733                 },
2734                 { &hf_bthci_evt_interval,
2735                         { "Interval",        "bthci_evt.interval",
2736                                 FT_UINT16, BASE_DEC, NULL, 0x0,
2737                                 "Interval - Number of Baseband slots", HFILL }
2738                 },
2739                 { &hf_bthci_evt_link_key,
2740                         { "Link Key",        "bthci_evt.link_key",
2741                                 FT_BYTES, BASE_NONE, NULL, 0x0,
2742                                 "Link Key for the associated BD_ADDR", HFILL }
2743                 },
2744                 { &hf_bthci_evt_key_type,
2745                         { "Key Type",        "bthci_evt.key_type",
2746                                 FT_UINT8, BASE_HEX, VALS(evt_key_types), 0x0,
2747                                 NULL, HFILL }
2748                 },
2749                 { &hf_bthci_evt_max_slots,
2750                         { "Maximum Number of Slots",        "bthci_evt.max_slots",
2751                                 FT_UINT8, BASE_DEC, NULL, 0x0,
2752                                 "Maximum Number of slots allowed for baseband packets", HFILL }
2753                 },
2754                 { &hf_bthci_evt_clock_offset,
2755                         { "Clock Offset",        "bthci_evt.clock_offset",
2756                                 FT_UINT16, BASE_HEX, NULL, 0x7FFF,
2757                                 "Bit 2-16 of the Clock Offset between CLKmaster-CLKslave", HFILL }
2758                 },
2759                 { &hf_bthci_evt_page_scan_mode,
2760                         { "Page Scan Mode",        "bthci_evt.page_scan_mode",
2761                                 FT_UINT8, BASE_HEX, VALS(evt_page_scan_modes), 0x0,
2762                                 NULL, HFILL }
2763                 },
2764                 { &hf_bthci_evt_page_scan_repetition_mode,
2765                         { "Page Scan Repetition Mode",        "bthci_evt.page_scan_repetition_mode",
2766                                 FT_UINT8, BASE_HEX, VALS(evt_page_scan_repetition_modes), 0x0,
2767                                 NULL, HFILL }
2768                 },
2769                 { &hf_bthci_evt_page_scan_period_mode,
2770                         { "Page Scan Period Mode",        "bthci_evt.page_scan_period_mode",
2771                                 FT_UINT8, BASE_HEX, VALS(evt_page_scan_period_modes), 0x0,
2772                                 NULL, HFILL }
2773                 },
2774                 { &hf_bthci_evt_link_type_2dh1,
2775                         { "ACL Link Type 2-DH1",        "bthci_evt.link_type_2dh1",
2776                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0002,
2777                                 NULL, HFILL }
2778                 },
2779                 { &hf_bthci_evt_link_type_3dh1,
2780                         { "ACL Link Type 3-DH1",        "bthci_evt.link_type_3dh1",
2781                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0004,
2782                                 NULL, HFILL }
2783                 },
2784                 { &hf_bthci_evt_link_type_dm1,
2785                         { "ACL Link Type DM1",        "bthci_evt.link_type_dm1",
2786                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0008,
2787                                 NULL, HFILL }
2788                 },
2789                 { &hf_bthci_evt_link_type_dh1,
2790                         { "ACL Link Type DH1",        "bthci_evt.link_type_dh1",
2791                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0010,
2792                                 NULL, HFILL }
2793                 },
2794                 { &hf_bthci_evt_link_type_2dh3,
2795                         { "ACL Link Type 2-DH3",        "bthci_evt.link_type_2dh3",
2796                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0100,
2797                                 NULL, HFILL }
2798                 },
2799                 { &hf_bthci_evt_link_type_3dh3,
2800                         { "ACL Link Type 3-DH3",        "bthci_evt.link_type_3dh3",
2801                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0200,
2802                                 NULL, HFILL }
2803                 },
2804                 { &hf_bthci_evt_link_type_dm3,
2805                         { "ACL Link Type DM3",        "bthci_evt.link_type_dm3",
2806                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0400,
2807                                 NULL, HFILL }
2808                 },
2809                 { &hf_bthci_evt_link_type_dh3,
2810                         { "ACL Link Type DH3",        "bthci_evt.link_type_dh3",
2811                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0800,
2812                                 NULL, HFILL }
2813                 },
2814                 { &hf_bthci_evt_link_type_2dh5,
2815                         { "ACL Link Type 2-DH5",        "bthci_evt.link_type_2dh5",
2816                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x1000,
2817                                 NULL, HFILL }
2818                 },
2819                 { &hf_bthci_evt_link_type_3dh5,
2820                         { "ACL Link Type 3-DH5",        "bthci_evt.link_type_3dh5",
2821                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x2000,
2822                                 NULL, HFILL }
2823                 },
2824                 { &hf_bthci_evt_link_type_dm5,
2825                         { "ACL Link Type DM5",        "bthci_evt.link_type_dm5",
2826                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x4000,
2827                                 NULL, HFILL }
2828                 },
2829                 { &hf_bthci_evt_link_type_dh5,
2830                         { "ACL Link Type DH5",        "bthci_evt.link_type_dh5",
2831                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x8000,
2832                                 NULL, HFILL }
2833                 },
2834                 { &hf_bthci_evt_link_type_hv1,
2835                         { "SCO Link Type HV1",        "bthci_evt.link_type_hv1",
2836                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0020,
2837                                 NULL, HFILL }
2838                 },
2839                 { &hf_bthci_evt_link_type_hv2,
2840                         { "SCO Link Type HV2",        "bthci_evt.link_type_hv2",
2841                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0040,
2842                                 NULL, HFILL }
2843                 },
2844                 { &hf_bthci_evt_link_type_hv3,
2845                         { "SCO Link Type HV3",        "bthci_evt.link_type_hv3",
2846                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0080,
2847                                 NULL, HFILL }
2848                 },
2849                 { &hf_bthci_evt_lmp_feature_00,
2850                         { "3-slot packets",        "bthci_evt.lmp_feature",
2851                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x01,
2852                                 NULL, HFILL }
2853                 },
2854                 { &hf_bthci_evt_lmp_feature_01,
2855                         { "5-slot packets",        "bthci_evt.lmp_feature",
2856                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x02,
2857                                 NULL, HFILL }
2858                 },
2859                 { &hf_bthci_evt_lmp_feature_02,
2860                         { "encryption",        "bthci_evt.lmp_feature",
2861                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x04,
2862                                 NULL, HFILL }
2863                 },
2864                 { &hf_bthci_evt_lmp_feature_03,
2865                         { "slot offset",        "bthci_evt.lmp_feature",
2866                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x08,
2867                                 NULL, HFILL }
2868                 },
2869                 { &hf_bthci_evt_lmp_feature_04,
2870                         { "timing accuracy",        "bthci_evt.lmp_feature",
2871                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x10,
2872                                 NULL, HFILL }
2873                 },
2874                 { &hf_bthci_evt_lmp_feature_05,
2875                         { "master/slave switch",        "bthci_evt.lmp_feature",
2876                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x20,
2877                                 NULL, HFILL }
2878                 },
2879                 { &hf_bthci_evt_lmp_feature_06,
2880                         { "hold mode",        "bthci_evt.lmp_feature",
2881                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x40,
2882                                 NULL, HFILL }
2883                 },
2884                 { &hf_bthci_evt_lmp_feature_07,
2885                         { "sniff mode",        "bthci_evt.lmp_feature",
2886                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x80,
2887                                 NULL, HFILL }
2888                 },
2889                 { &hf_bthci_evt_lmp_feature_10,
2890                         { "park mode",        "bthci_evt.lmp_feature",
2891                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x01,
2892                                 NULL, HFILL }
2893                 },
2894                 { &hf_bthci_evt_lmp_feature_11,
2895                         { "RSSI",        "bthci_evt.lmp_feature",
2896                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x02,
2897                                 NULL, HFILL }
2898                 },
2899                 { &hf_bthci_evt_lmp_feature_12,
2900                         { "channel quality driven data rate",        "bthci_evt.lmp_feature",
2901                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x04,
2902                                 NULL, HFILL }
2903                 },
2904                 { &hf_bthci_evt_lmp_feature_13,
2905                         { "SCO link",        "bthci_evt.lmp_feature",
2906                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x08,
2907                                 NULL, HFILL }
2908                 },
2909                 { &hf_bthci_evt_lmp_feature_14,
2910                         { "HV2 packets",        "bthci_evt.lmp_feature",
2911                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x10,
2912                                 NULL, HFILL }
2913                 },
2914                 { &hf_bthci_evt_lmp_feature_15,
2915                         { "HV3 packets",        "bthci_evt.lmp_feature",
2916                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x20,
2917                                 NULL, HFILL }
2918                 },
2919                 { &hf_bthci_evt_lmp_feature_16,
2920                         { "u-law log",        "bthci_evt.lmp_feature",
2921                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x40,
2922                                 NULL, HFILL }
2923                 },
2924                 { &hf_bthci_evt_lmp_feature_17,
2925                         { "A-law log",        "bthci_evt.lmp_feature",
2926                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x80,
2927                                 NULL, HFILL }
2928                 },
2929                 { &hf_bthci_evt_lmp_feature_20,
2930                         { "CVSD",        "bthci_evt.lmp_feature",
2931                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x01,
2932                                 NULL, HFILL }
2933                 },
2934                 { &hf_bthci_evt_lmp_feature_21,
2935                         { "paging scheme",        "bthci_evt.lmp_feature",
2936                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x02,
2937                                 NULL, HFILL }
2938                 },
2939                 { &hf_bthci_evt_lmp_feature_22,
2940                         { "power control",        "bthci_evt.lmp_feature",
2941                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x04,
2942                                 NULL, HFILL }
2943                 },
2944                 { &hf_bthci_evt_lmp_feature_23,
2945                         { "transparent SCO data",        "bthci_evt.lmp_feature",
2946                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x08,
2947                                 NULL, HFILL }
2948                 },
2949                 { &hf_bthci_evt_lmp_feature_24,
2950                         { "Flow control lag",        "bthci_evt.lmp_feature",
2951                                 FT_UINT8, BASE_DEC, NULL, 0x70,
2952                                 NULL, HFILL }
2953                 },
2954                 { &hf_bthci_evt_lmp_feature_27,
2955                         { "broadband encryption",        "bthci_evt.lmp_feature",
2956                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x80,
2957                                 NULL, HFILL }
2958                 },
2959                 { &hf_bthci_evt_lmp_feature_31,
2960                         { "EDR ACL 2 Mbps mode",        "bthci_evt.lmp_feature",
2961                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x02,
2962                                 NULL, HFILL }
2963                 },
2964                 { &hf_bthci_evt_lmp_feature_32,
2965                         { "EDR ACL 3 Mbps mode",        "bthci_evt.lmp_feature",
2966                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x04,
2967                                 NULL, HFILL }
2968                 },
2969                 { &hf_bthci_evt_lmp_feature_33,
2970                         { "enhanced inquiry scan",        "bthci_evt.lmp_feature",
2971                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x08,
2972                                 NULL, HFILL }
2973                 },
2974                 { &hf_bthci_evt_lmp_feature_34,
2975                         { "interlaced inquiry scan",        "bthci_evt.lmp_feature",
2976                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x10,
2977                                 NULL, HFILL }
2978                 },
2979                 { &hf_bthci_evt_lmp_feature_35,
2980                         { "interlaced page scan",        "bthci_evt.lmp_feature",
2981                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x20,
2982                                 NULL, HFILL }
2983                 },
2984                 { &hf_bthci_evt_lmp_feature_36,
2985                         { "RSSI with inquiry results",        "bthci_evt.lmp_feature",
2986                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x40,
2987                                 NULL, HFILL }
2988                 },
2989                 { &hf_bthci_evt_lmp_feature_37,
2990                         { "eSCO EV3 packets",        "bthci_evt.lmp_feature",
2991                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x80,
2992                                 NULL, HFILL }
2993                 },
2994                 { &hf_bthci_evt_lmp_feature_40,
2995                         { "eSCO EV4 packets",        "bthci_evt.lmp_feature",
2996                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x01,
2997                                 NULL, HFILL }
2998                 },
2999                 { &hf_bthci_evt_lmp_feature_41,
3000                         { "eSCO EV5 packets",        "bthci_evt.lmp_feature",
3001                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x02,
3002                                 NULL, HFILL }
3003                 },
3004                 { &hf_bthci_evt_lmp_feature_43,
3005                         { "AFH capable slave",        "bthci_evt.lmp_feature",
3006                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x08,
3007                                 NULL, HFILL }
3008                 },
3009                 { &hf_bthci_evt_lmp_feature_44,
3010                         { "AFH classification slave",        "bthci_evt.lmp_feature",
3011                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x10,
3012                                 NULL, HFILL }
3013                 },
3014                 { &hf_bthci_evt_lmp_feature_47,
3015                         { "3-slot EDR ACL packets",        "bthci_evt.lmp_feature",
3016                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x80,
3017                                 NULL, HFILL }
3018                 },
3019                 { &hf_bthci_evt_lmp_feature_50,
3020                         { "5-slot EDR ACL packets",        "bthci_evt.lmp_feature",
3021                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x01,
3022                                 NULL, HFILL }
3023                 },
3024                 { &hf_bthci_evt_lmp_feature_51,
3025                         { "sniff subrating",        "bthci_evt.lmp_feature",
3026                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x02,
3027                                 NULL, HFILL }
3028                 },
3029                 { &hf_bthci_evt_lmp_feature_52,
3030                         { "pause encryption",        "bthci_evt.lmp_feature",
3031                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x04,
3032                                 NULL, HFILL }
3033                 },
3034                 { &hf_bthci_evt_lmp_feature_53,
3035                         { "AFH capable master",        "bthci_evt.lmp_feature",
3036                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x08,
3037                                 NULL, HFILL }
3038                 },
3039                 { &hf_bthci_evt_lmp_feature_54,
3040                         { "AFH classification master",        "bthci_evt.lmp_feature",
3041                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x10,
3042                                 NULL, HFILL }
3043                 },
3044                 { &hf_bthci_evt_lmp_feature_55,
3045                         { "EDR eSCO 2 Mbps mode",        "bthci_evt.lmp_feature",
3046                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x20,
3047                                 NULL, HFILL }
3048                 },
3049                 { &hf_bthci_evt_lmp_feature_56,
3050                         { "EDR eSCO 3 Mbps mode",        "bthci_evt.lmp_feature",
3051                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x40,
3052                                 NULL, HFILL }
3053                 },
3054                 { &hf_bthci_evt_lmp_feature_57,
3055                         { "3-slot EDR eSCO packets",        "bthci_evt.lmp_feature",
3056                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x80,
3057                                 NULL, HFILL }
3058                 },
3059                 { &hf_bthci_evt_lmp_feature_60,
3060                         { "extended inquiry response",        "bthci_evt.lmp_feature",
3061                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x01,
3062                                 NULL, HFILL }
3063                 },
3064                 { &hf_bthci_evt_lmp_feature_63,
3065                         { "secure simple pairing",        "bthci_evt.lmp_feature",
3066                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x08,
3067                                 NULL, HFILL }
3068                 },
3069                 { &hf_bthci_evt_lmp_feature_64,
3070                         { "encapsulated PDU",        "bthci_evt.lmp_feature",
3071                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x10,
3072                                 NULL, HFILL }
3073                 },
3074                 { &hf_bthci_evt_lmp_feature_65,
3075                         { "erroneous data reporting",        "bthci_evt.lmp_feature",
3076                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x20,
3077                                 NULL, HFILL }
3078                 },
3079                 { &hf_bthci_evt_lmp_feature_66,
3080                         { "non-flushable packet boundary flag",        "bthci_evt.lmp_feature",
3081                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x40,
3082                                 NULL, HFILL }
3083                 },
3084                 { &hf_bthci_evt_lmp_feature_70,
3085                         { "link supervision timeout changed event",        "bthci_evt.lmp_feature",
3086                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x01,
3087                                 NULL, HFILL }
3088                 },
3089                 { &hf_bthci_evt_lmp_feature_71,
3090                         { "inquiry response TX power level",        "bthci_evt.lmp_feature",
3091                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x02,
3092                                 NULL, HFILL }
3093                 },
3094                 { &hf_bthci_evt_lmp_feature_77,
3095                         { "extended features",        "bthci_evt.lmp_feature",
3096                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x80,
3097                                 NULL, HFILL }
3098                 },
3099                 { &hf_bthci_evt_num_keys,
3100                         { "Number of Link Keys",        "bthci_evt.num_keys",
3101                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3102                                 "Number of Link Keys contained", HFILL }
3103                 },
3104                 { &hf_bthci_evt_num_keys_read,
3105                         { "Number of Link Keys Read",        "bthci_evt.num_keys_read",
3106                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3107                                 NULL, HFILL }
3108                 },
3109                 { &hf_bthci_evt_num_keys_deleted,
3110                         { "Number of Link Keys Deleted",        "bthci_evt.num_keys_deleted",
3111                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3112                                 NULL, HFILL }
3113                 },
3114                 { &hf_bthci_evt_num_keys_written,
3115                         { "Number of Link Keys Written",        "bthci_evt.num_keys_written",
3116                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3117                                 NULL, HFILL }
3118                 },
3119                 { &hf_bthci_evt_max_num_keys,
3120                         { "Max Num Keys",        "bthci_evt.max_num_keys",
3121                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3122                                 "Total Number of Link Keys that the Host Controller can store", HFILL }
3123                 },
3124                 { &hf_bthci_evt_num_responses,
3125                         { "Number of responses",        "bthci_evt.num_responses",
3126                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3127                                 "Number of Responses from Inquiry", HFILL }
3128                 },
3129                 { &hf_bthci_evt_link_policy_setting_switch,
3130                         { "Enable Master Slave Switch", "bthci_evt.link_policy_switch",
3131                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0001,
3132                                 NULL, HFILL }
3133                 }, 
3134                 { &hf_bthci_evt_link_policy_setting_hold,
3135                         { "Enable Hold Mode", "bthci_evt.link_policy_hold",
3136                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0002,
3137                                 NULL, HFILL }
3138                 },
3139                 { &hf_bthci_evt_link_policy_setting_sniff,
3140                         { "Enable Sniff Mode", "bthci_evt.link_policy_sniff",
3141                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0004,
3142                                 NULL, HFILL }
3143                 },
3144                 { &hf_bthci_evt_link_policy_setting_park,
3145                         { "Enable Park Mode", "bthci_evt.link_policy_park",
3146                                 FT_UINT16, BASE_DEC, VALS(evt_boolean), 0x0008,
3147                                 NULL, HFILL }
3148                 },
3149                 { &hf_bthci_evt_curr_role,
3150                         { "Current Role", "bthci_evt_curr_role",
3151                                 FT_UINT8, BASE_HEX, VALS(evt_role_vals_handle), 0x0,
3152                                 "Current role for this connection handle", HFILL }
3153                 },
3154                 { &hf_bthci_evt_pin_type,
3155                         { "PIN Type", "bthci_evt.pin_type",
3156                                 FT_UINT8, BASE_HEX, VALS(evt_pin_types), 0x0,
3157                                 "PIN Types", HFILL }
3158                 },
3159                 { &hf_bthci_evt_device_name,
3160                         { "Device Name",           "bthci_evt.device_name",
3161                                 FT_STRINGZ, BASE_NONE, NULL, 0x0,          
3162                                 "Userfriendly descriptive name for the device", HFILL }
3163                 },
3164                 { &hf_bthci_evt_timeout,
3165                         { "Timeout",        "bthci_evt.timeout",
3166                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3167                                 "Number of Baseband slots for timeout.", HFILL }
3168                 },
3169                 { &hf_bthci_evt_scan_enable,
3170                         { "Scan", "bthci_evt.scan_enable",
3171                                 FT_UINT8, BASE_HEX, VALS(evt_scan_enable_values), 0x0,
3172                                 "Scan Enable", HFILL }
3173                 },
3174                 { &hf_bthci_evt_authentication_enable,
3175                         { "Authentication", "bthci_evt.auth_enable",
3176                                 FT_UINT8, BASE_HEX, VALS(evt_auth_enable_values), 0x0,
3177                                 "Authentication Enable", HFILL }
3178                 },
3179                 { &hf_bthci_evt_sco_flow_cont_enable,
3180                         { "SCO Flow Control", "bthci_evt.sco_flow_cont_enable",
3181                                 FT_UINT8, BASE_HEX, VALS(evt_enable_values), 0x0,
3182                                 "SCO Flow Control Enable", HFILL }
3183                 },
3184                 { &hf_bthci_evt_window,
3185                         { "Interval", "bthci_evt.window",
3186                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3187                                 "Window", HFILL }
3188                 },
3189                 { &hf_bthci_evt_input_coding,
3190                         { "Input Coding", "bthci_evt.input_coding",
3191                                 FT_UINT16, BASE_DEC, VALS(evt_input_coding_values), 0x0300,
3192                                 "Authentication Enable", HFILL }
3193                 },
3194                 { &hf_bthci_evt_input_data_format,
3195                         { "Input Data Format", "bthci_evt.input_data_format",
3196                                 FT_UINT16, BASE_DEC, VALS(evt_input_data_format_values), 0x00c0,
3197                                 NULL, HFILL }
3198                 },  
3199                 { &hf_bthci_evt_input_sample_size,
3200                         { "Input Sample Size", "bthci_evt.input_sample_size",
3201                                 FT_UINT16, BASE_DEC, VALS(evt_input_sample_size_values), 0x0020,
3202                                 NULL, HFILL }
3203                 }, 
3204                 { &hf_bthci_evt_num_broadcast_retransm,
3205                         { "Num Broadcast Retran", "bthci_evt.num_broad_retran",
3206                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3207                                 "Number of Broadcast Retransmissions", HFILL }
3208                 },
3209                 { &hf_bthci_evt_hold_mode_act_page,
3210                         { "Suspend Page Scan", "bthci_evt.hold_mode_page",
3211                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x1,
3212                                 "Device can enter low power state", HFILL }
3213                 },
3214                 { &hf_bthci_evt_hold_mode_act_inquiry,
3215                         { "Suspend Inquiry Scan", "bthci_evt.hold_mode_inquiry",
3216                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x2,
3217                                 "Device can enter low power state", HFILL }
3218                 },
3219                 { &hf_bthci_evt_hold_mode_act_periodic,
3220                         { "Suspend Periodic Inquiries", "bthci_evt.hold_mode_periodic",
3221                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x4,
3222                                 "Device can enter low power state", HFILL }
3223                 },
3224                 { &hf_bthci_evt_transmit_power_level,
3225                         { "Transmit Power Level (dBm)", "bthci_evt.transmit_power_level",
3226                                 FT_INT8, BASE_DEC, NULL, 0x0,
3227                                 NULL, HFILL }
3228                 },
3229                 { &hf_bthci_evt_num_supp_iac,
3230                         {"Num Support IAC", "bthci_evt.num_supp_iac",
3231                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3232                                 "Num of supported IAC the device can simultaneously listen", HFILL }
3233                 },
3234                 { &hf_bthci_evt_num_curr_iac,
3235                         {"Num Current IAC", "bthci_evt.num_curr_iac",
3236                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3237                                 "Num of IACs currently in use to simultaneously listen", HFILL }
3238                 },
3239                 { &hf_bthci_evt_iac_lap,
3240                         { "IAC LAP", "bthci_evt.num_curr_iac",
3241                                 FT_UINT24, BASE_HEX, NULL, 0x0,
3242                                 "LAP(s)used to create IAC", HFILL }
3243                 },
3244                 { &hf_bthci_evt_loopback_mode,
3245                         {"Loopback Mode", "bthci_evt.loopback_mode",
3246                                 FT_UINT8, BASE_HEX, VALS(evt_loopback_modes), 0x0,
3247                                 NULL, HFILL }
3248                 },
3249                 { &hf_bthci_evt_country_code,
3250                         {"Country Code", "bthci_evt.country_code",
3251                                 FT_UINT8, BASE_HEX, VALS(evt_country_code_values), 0x0,
3252                                 NULL, HFILL }
3253                 },
3254                 { &hf_bthci_evt_failed_contact_counter,
3255                         {"Failed Contact Counter", "bthci_evt.failed_contact_counter",
3256                                 FT_UINT16, BASE_DEC, NULL, 0x0,  
3257                                 NULL, HFILL }
3258                 },   
3259                 { &hf_bthci_evt_link_quality,
3260                         {"Link Quality", "bthci_evt.link_quality",
3261                                 FT_UINT8, BASE_DEC, NULL, 0x0,  
3262                                 "Link Quality (0x00 - 0xFF Higher Value = Better Link)", HFILL }
3263                 },
3264                 { &hf_bthci_evt_rssi,
3265                         { "RSSI (dB)", "bthci_evt.rssi",
3266                                 FT_INT8, BASE_DEC, NULL, 0x0,
3267                                 NULL, HFILL }
3268                 },
3269                 { &hf_bthci_evt_host_data_packet_length_acl,
3270                         {"Host ACL Data Packet Length (bytes)", "bthci_evt.max_data_length_acl",
3271                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3272                                 "Max Host ACL Data Packet length of data portion host is able to accept", HFILL }
3273                 }, 
3274                 { &hf_bthci_evt_host_data_packet_length_sco,
3275                         {"Host SCO Data Packet Length (bytes)", "bthci_evt.max_data_length_sco",
3276                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3277                                 "Max Host SCO Data Packet length of data portion host is able to accept", HFILL }
3278                 }, 
3279                 { &hf_bthci_evt_host_total_num_acl_data_packets,
3280                         {"Host Total Num ACL Data Packets", "bthci_evt.max_data_num_acl",
3281                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3282                                 "Total Number of HCI ACL Data Packets that can be stored in the data buffers of the Host", HFILL }
3283                 }, 
3284                 { &hf_bthci_evt_host_total_num_sco_data_packets,
3285                         {"Host Total Num SCO Data Packets", "bthci_evt.max_data_num_sco",
3286                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3287                                 "Total Number of HCI SCO Data Packets that can be stored in the data buffers of the Host", HFILL }
3288                 }, 
3289                 { &hf_bthci_evt_page_number,
3290                         {"Page Number", "bthci_evt.page_number",
3291                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3292                                 NULL, HFILL}
3293                 },
3294                 { &hf_bthci_evt_max_page_number,
3295                         {"Max. Page Number", "bthci_evt.max_page_number",
3296                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3297                                 NULL, HFILL}
3298                 },
3299                 { &hf_bthci_evt_local_supported_cmds,
3300                         { "Local Supported Commands",        "bthci_evt.local_supported_cmds",
3301                                 FT_BYTES, BASE_NONE, NULL, 0x0,
3302                                 NULL, HFILL }
3303                 },
3304                 { &hf_bthci_evt_fec_required,
3305                         {"FEC Required", "bthci_evt.fec_required",
3306                                 FT_UINT8, BASE_DEC, VALS(evt_boolean), 0x0,
3307                                 NULL, HFILL}
3308                 },
3309                 { &hf_bthci_evt_err_data_reporting,
3310                         {"Erroneous Data Reporting", "bthci_evt.err_data_reporting",
3311                                 FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
3312                                 NULL, HFILL}
3313                 },
3314                 { &hf_bthci_evt_scan_type,
3315                         {"Scan Type", "bthci_evt.inq_scan_type",
3316                                 FT_UINT8, BASE_DEC, VALS(evt_scan_types), 0x0,
3317                                 NULL, HFILL}
3318                 },
3319                 { &hf_bthci_evt_inq_mode,
3320                         {"Inquiry Mode", "bthci_evt.inq_scan_type",
3321                                 FT_UINT8, BASE_DEC, VALS(evt_inq_modes), 0x0,
3322                                 NULL, HFILL}
3323                 },
3324                 { &hf_bthci_evt_power_level_type,
3325                         {"Type", "bthci_evt.power_level_type",
3326                                 FT_UINT8, BASE_HEX, VALS(evt_power_level_types), 0x0,
3327                                 NULL, HFILL}
3328                 },
3329                 { &hf_bthci_evt_ext_lmp_features,
3330                         {"Ext. LMP Features", "bthci_evt.page_number",
3331                                 FT_UINT64, BASE_HEX, NULL, 0x0,
3332                                 "Extended LMP Features", HFILL}
3333                 },
3334                 { &hf_bthci_evt_sync_link_type,
3335                         {"Link Type", "bthci_evt.sync_link_type",
3336                                 FT_UINT8, BASE_HEX, VALS(evt_sync_link_types), 0x0,
3337                                 NULL, HFILL}
3338                 },
3339                 { &hf_bthci_evt_sync_tx_interval,
3340                         {"Transmit Interval", "bthci_evt.sync_tx_interval",
3341                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3342                                 NULL, HFILL}
3343                 },
3344                 { &hf_bthci_evt_sync_rtx_window,
3345                         {"Retransmit Window", "bthci_evt.sync_rtx_window",
3346                                 FT_UINT8, BASE_DEC, NULL, 0x0,
3347                                 NULL, HFILL}
3348                 },
3349                 { &hf_bthci_evt_sync_rx_packet_length,
3350                         {"Rx Packet Length", "bthci_evt.sync_rx_pkt_len",
3351                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3352                                 NULL, HFILL}
3353                 },
3354                 { &hf_bthci_evt_sync_tx_packet_length,
3355                         {"Tx Packet Length", "bthci_evt.sync_tx_pkt_len",
3356                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3357                                 NULL, HFILL}
3358                 },      
3359                 { &hf_bthci_evt_air_mode,
3360                         {"Air Mode", "bthci_evt.air_mode",
3361                                 FT_UINT8, BASE_DEC, VALS(evt_air_mode_values), 0x0,
3362                                 NULL, HFILL}
3363                 },
3364                 { &hf_bthci_evt_max_tx_latency,
3365                         {"Max. Tx Latency", "bthci_evt.max_tx_latency",
3366                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3367                                 NULL, HFILL}
3368                 },
3369                 { &hf_bthci_evt_max_rx_latency,
3370                         {"Max. Rx Latency", "bthci_evt.max_rx_latency",
3371                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3372                                 NULL, HFILL}
3373                 },
3374                 { &hf_bthci_evt_min_remote_timeout,
3375                         {"Min. Remote Timeout", "bthci_evt.min_remote_timeout",
3376                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3377                                 NULL, HFILL}
3378                 },
3379                 { &hf_bthci_evt_min_local_timeout,
3380                         {"Min. Local Timeout", "bthci_evt.min_local_timeout",
3381                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3382                                 NULL, HFILL}
3383                 },
3384                 { &hf_bthci_evt_link_supervision_timeout,
3385                         {"Link Supervision Timeout", "bthci_evt.link_supervision_timeout",
3386                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3387                                 NULL, HFILL}
3388                 },
3389                 { &hf_bthci_evt_token_bucket_size,
3390                         { "Token Bucket Size",        "bthci_evt.token_bucket_size",
3391                                 FT_UINT32, BASE_DEC, NULL, 0x0,
3392                                 "Token Bucket Size (bytes)", HFILL }
3393                 },
3394                 { &hf_bthci_evt_flow_direction,
3395                         {"Flow Direction", "bthci_evt.flow_direction",
3396                                 FT_UINT8, BASE_DEC, VALS(evt_flow_direction_values), 0x0,
3397                                 NULL, HFILL}
3398                 },
3399                 { &hf_bthci_evt_afh_ch_assessment_mode,
3400                         {"AFH Channel Assessment Mode", "bthci_evt.afh_ch_assessment_mode",
3401                                 FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
3402                                 NULL, HFILL}
3403                 },
3404                 { &hf_bthci_evt_lmp_handle,
3405                         { "LMP Handle",             "bthci_evt.lmp_handle",
3406                                 FT_UINT16, BASE_HEX, NULL, 0x0,
3407                                 NULL, HFILL }
3408                 },
3409                 { &hf_bthci_evt_clock,
3410                         { "Clock",        "bthci_evt.clock",
3411                                 FT_UINT32, BASE_HEX, NULL, 0x0,
3412                                 NULL, HFILL }
3413                 },
3414                 { &hf_bthci_evt_clock_accuracy,
3415                         { "Clock",        "bthci_evt.clock_accuracy",
3416                                 FT_UINT16, BASE_HEX, NULL, 0x0,
3417                                 NULL, HFILL }
3418                 },
3419                 { &hf_bthci_evt_afh_mode,
3420                         {"AFH Mode", "bthci_evt.afh_mode",
3421                                 FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
3422                                 NULL, HFILL}
3423                 },
3424                 { &hf_bthci_evt_afh_channel_map,
3425                         {"AFH Channel Map", "bthci_evt.afh_channel_map",
3426                                 FT_UINT_BYTES, BASE_NONE, NULL, 0x0,
3427                                 NULL, HFILL}
3428                 },
3429                 { &hf_bthci_evt_simple_pairing_mode,
3430                         {"Simple Pairing Mode", "bthci_evt.simple_pairing_mode",
3431                                 FT_UINT8, BASE_DEC, VALS(evt_enable_values), 0x0,
3432                                 NULL, HFILL}
3433                 },
3434                 { &hf_bthci_evt_hash_c,
3435                         {"Hash C", "bthci_evt.hash_c",
3436                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3437                                 NULL, HFILL}
3438                 },
3439                 { &hf_bthci_evt_randomizer_r,
3440                         {"Randomizer R", "bthci_evt.randomizer_r",
3441                                 FT_UINT16, BASE_DEC, NULL, 0x0,
3442                                 NULL, HFILL}
3443                 },
3444                 { &hf_bthci_evt_io_capability,
3445                         {"IO Capability", "bthci_evt.io_capability",
3446                                 FT_UINT8, BASE_HEX, VALS(bthci_cmd_io_capability_vals), 0x0,
3447                                 NULL, HFILL}
3448                 },
3449                 { &hf_bthci_evt_oob_data_present,
3450                         {"OOB Data Present", "bthci_evt.oob_data_present",
3451                                 FT_UINT8, BASE_DEC, VALS(bthci_cmd_oob_data_present_vals), 0x0,
3452                                 NULL, HFILL}
3453                 },
3454                 { &hf_bthci_evt_auth_requirements,
3455                         {"Authentication Requirements", "bthci_evt.auth_requirements",
3456                                 FT_UINT8, BASE_DEC, VALS(bthci_cmd_auth_req_vals), 0x0,
3457                                 NULL, HFILL}
3458                 },
3459                 { &hf_bthci_evt_numeric_value,
3460                         {"Numeric Value", "bthci_evt.numeric_value",
3461                                 FT_UINT32, BASE_DEC, NULL, 0x0,
3462                                 NULL, HFILL}
3463                 },
3464                 { &hf_bthci_evt_passkey,
3465                         {"Passkey", "bthci_evt.passkey",
3466                                 FT_UINT32, BASE_DEC, NULL, 0x0,
3467                                 NULL, HFILL}
3468                 },
3469                 { &hf_bthci_evt_notification_type,
3470                         {"Notification Type", "bthci_evt.notification_type",
3471                                 FT_UINT8, BASE_DEC, VALS(evt_notification_type_vals), 0x0,
3472                                 NULL, HFILL}
3473                 },
3474                 { &hf_bthci_evt_eir_data,
3475                         {"Data", "bthci_cmd.eir_data",
3476                                 FT_BYTES, BASE_NONE, NULL, 0x0,
3477                                 "EIR Data", HFILL}
3478                 },
3479                 { &hf_bthci_evt_eir_struct_length,
3480                         { "Length",           "bthci_cmd.eir_struct_length",
3481                                 FT_UINT8, BASE_DEC, NULL, 0x0,          
3482                                 "Structure Length", HFILL }
3483                 },
3484                 { &hf_bthci_evt_eir_struct_type,
3485                         { "Type",           "bthci_cmd.eir_data_type",
3486                                 FT_UINT8, BASE_HEX, VALS(bthci_cmd_eir_data_type_vals), 0x0,          
3487                                 "Data Type", HFILL }
3488                 },
3489                 { &hf_bthci_evt_sc_uuid16,
3490                         { "UUID",           "bthci_cmd.service_class_uuid16",
3491                                 FT_UINT16, BASE_HEX, VALS(bthci_cmd_service_class_type_vals), 0x0,          
3492                                 "16-bit Service Class UUID", HFILL }
3493                 },
3494                 { &hf_bthci_evt_sc_uuid32,
3495                         { "UUID",           "bthci_cmd.service_class_uuid32",
3496                                 FT_UINT32, BASE_HEX, NULL, 0x0,          
3497                                 "32-bit Service Class UUID", HFILL }
3498                 },
3499                 { &hf_bthci_evt_sc_uuid128,
3500                         { "UUID",           "bthci_cmd.service_class_uuid128",
3501                                 FT_BYTES, BASE_NONE, NULL, 0x0,          
3502                                 "128-bit Service Class UUID", HFILL }
3503                 }
3504         };
3505
3506         /* Setup protocol subtree array */
3507         static gint *ett[] = {
3508                 &ett_bthci_evt,
3509                 &ett_opcode,
3510                 &ett_lmp_subtree,
3511                 &ett_ptype_subtree,
3512                 &ett_eir_subtree,
3513                 &ett_eir_struct_subtree
3514         };
3515
3516         /* Register the protocol name and description */
3517         proto_bthci_evt = proto_register_protocol("Bluetooth HCI Event",
3518                         "HCI_EVT", "bthci_evt");
3519
3520         register_dissector("bthci_evt", dissect_bthci_evt, proto_bthci_evt);
3521
3522
3523
3524         /* Required function calls to register the header fields and subtrees used */
3525         proto_register_field_array(proto_bthci_evt, hf, array_length(hf));
3526         proto_register_subtree_array(ett, array_length(ett));
3527 }
3528
3529
3530 /* If this dissector uses sub-dissector registration add a registration routine.
3531    This format is required because a script is used to find these routines and
3532    create the code that calls these routines.
3533    */
3534 void
3535 proto_reg_handoff_bthci_evt(void)
3536 {
3537         dissector_handle_t bthci_evt_handle;
3538
3539         bthci_evt_handle = find_dissector("bthci_evt");
3540         dissector_add("hci_h4.type", HCI_H4_TYPE_EVT, bthci_evt_handle);
3541         dissector_add("hci_h1.type", BTHCI_CHANNEL_EVENT, bthci_evt_handle);
3542
3543         bthci_com_handle = find_dissector("bthci_cmd");
3544 }
3545
3546