Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / monitor / bt.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2011-2014  Intel Corporation
6  *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public
11  *  License as published by the Free Software Foundation; either
12  *  version 2.1 of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 #include <stdint.h>
26
27 struct bt_ll_hdr {
28         uint8_t  preamble;
29         uint32_t access_addr;
30 } __attribute__ ((packed));
31
32 #define BT_LL_CONN_UPDATE_REQ   0x00
33 struct bt_ll_conn_update_req {
34         uint8_t  win_size;
35         uint16_t win_offset;
36         uint16_t interval;
37         uint16_t latency;
38         uint16_t timeout;
39         uint16_t instant;
40 } __attribute__ ((packed));
41
42 #define BT_LL_CHANNEL_MAP_REQ   0x01
43 struct bt_ll_channel_map_req {
44         uint8_t  map[5];
45         uint16_t instant;
46 } __attribute__ ((packed));
47
48 #define BT_LL_TERMINATE_IND     0x02
49 struct bt_ll_terminate_ind {
50         uint8_t  error;
51 } __attribute__ ((packed));
52
53 #define BT_LL_ENC_REQ           0x03
54 struct bt_ll_enc_req {
55         uint64_t rand;
56         uint16_t ediv;
57         uint64_t skd;
58         uint32_t iv;
59 } __attribute__ ((packed));
60
61 #define BT_LL_ENC_RSP           0x04
62 struct bt_ll_enc_rsp {
63         uint64_t skd;
64         uint32_t iv;
65 } __attribute__ ((packed));
66
67 #define BT_LL_START_ENC_REQ     0x05
68
69 #define BT_LL_START_ENC_RSP     0x06
70
71 #define BT_LL_UNKNOWN_RSP       0x07
72 struct bt_ll_unknown_rsp {
73         uint8_t  type;
74 } __attribute__ ((packed));
75
76 #define BT_LL_FEATURE_REQ       0x08
77 struct bt_ll_feature_req {
78         uint8_t  features[8];
79 } __attribute__ ((packed));
80
81 #define BT_LL_FEATURE_RSP       0x09
82 struct bt_ll_feature_rsp {
83         uint8_t  features[8];
84 } __attribute__ ((packed));
85
86 #define BT_LL_PAUSE_ENC_REQ     0x0a
87
88 #define BT_LL_PAUSE_ENC_RSP     0x0b
89
90 #define BT_LL_VERSION_IND       0x0c
91 struct bt_ll_version_ind {
92         uint8_t  version;
93         uint16_t company;
94         uint16_t subversion;
95 } __attribute__ ((packed));
96
97 #define BT_LL_REJECT_IND        0x0d
98 struct bt_ll_reject_ind {
99         uint8_t  error;
100 } __attribute__ ((packed));
101
102 #define BT_LL_SLAVE_FEATURE_REQ 0x0e
103 struct bt_ll_slave_feature_req {
104         uint8_t  features[8];
105 } __attribute__ ((packed));
106
107 #define BT_LL_CONN_PARAM_REQ    0x0f
108
109 #define BT_LL_CONN_PARAM_RSP    0x10
110
111 #define BT_LL_REJECT_IND_EXT    0x11
112 struct bt_ll_reject_ind_ext {
113         uint8_t  opcode;
114         uint8_t  error;
115 } __attribute__ ((packed));
116
117 #define BT_LL_PING_REQ          0x12
118
119 #define BT_LL_PING_RSP          0x13
120
121 #define BT_LL_LENGTH_REQ        0x14
122
123 #define BT_LL_LENGTH_RSP        0x15
124
125 #define LMP_ESC4(x) ((127 << 8) | (x))
126
127 #define BT_LMP_NAME_REQ                 1
128 struct bt_lmp_name_req {
129         uint8_t  offset;
130 } __attribute__ ((packed));
131
132 #define BT_LMP_NAME_RSP                 2
133 struct bt_lmp_name_rsp {
134         uint8_t  offset;
135         uint8_t  length;
136         uint8_t  fragment[14];
137 } __attribute__ ((packed));
138
139 #define BT_LMP_ACCEPTED                 3
140 struct bt_lmp_accepted {
141         uint8_t  opcode;
142 } __attribute__ ((packed));
143
144 #define BT_LMP_NOT_ACCEPTED             4
145 struct bt_lmp_not_accepted {
146         uint8_t  opcode;
147         uint8_t  error;
148 } __attribute__ ((packed));
149
150 #define BT_LMP_CLKOFFSET_REQ            5
151
152 #define BT_LMP_CLKOFFSET_RSP            6
153 struct bt_lmp_clkoffset_rsp {
154         uint16_t offset;
155 } __attribute__ ((packed));
156
157 #define BT_LMP_DETACH                   7
158 struct bt_lmp_detach {
159         uint8_t  error;
160 } __attribute__ ((packed));
161
162 #define BT_LMP_AU_RAND                  11
163 struct bt_lmp_au_rand {
164         uint8_t  number[16];
165 } __attribute__ ((packed));
166
167 #define BT_LMP_SRES                     12
168 struct bt_lmp_sres {
169         uint8_t  response[4];
170 } __attribute__ ((packed));
171
172 #define BT_LMP_ENCRYPTION_MODE_REQ      15
173 struct bt_lmp_encryption_mode_req {
174         uint8_t  mode;
175 } __attribute__ ((packed));
176
177 #define BT_LMP_ENCRYPTION_KEY_SIZE_REQ  16
178 struct bt_lmp_encryption_key_size_req {
179         uint8_t  key_size;
180 } __attribute__ ((packed));
181
182 #define BT_LMP_START_ENCRYPTION_REQ     17
183 struct bt_lmp_start_encryption_req {
184         uint8_t  number[16];
185 } __attribute__ ((packed));
186
187 #define BT_LMP_STOP_ENCRYPTION_REQ      18
188
189 #define BT_LMP_SWITCH_REQ               19
190 struct bt_lmp_switch_req {
191         uint32_t instant;
192 } __attribute__ ((packed));
193
194 #define BT_LMP_UNSNIFF_REQ              24
195
196 #define BT_LMP_MAX_POWER                33
197
198 #define BT_LMP_MIN_POWER                34
199
200 #define BT_LMP_AUTO_RATE                35
201
202 #define BT_LMP_PREFERRED_RATE           36
203 struct bt_lmp_preferred_rate {
204         uint8_t  rate;
205 } __attribute__ ((packed));
206
207 #define BT_LMP_VERSION_REQ              37
208 struct bt_lmp_version_req {
209         uint8_t  version;
210         uint16_t company;
211         uint16_t subversion;
212 } __attribute__ ((packed));
213
214 #define BT_LMP_VERSION_RES              38
215 struct bt_lmp_version_res {
216         uint8_t  version;
217         uint16_t company;
218         uint16_t subversion;
219 } __attribute__ ((packed));
220
221 #define BT_LMP_FEATURES_REQ             39
222 struct bt_lmp_features_req {
223         uint8_t  features[8];
224 } __attribute__ ((packed));
225
226 #define BT_LMP_FEATURES_RES             40
227 struct bt_lmp_features_res {
228         uint8_t  features[8];
229 } __attribute__ ((packed));
230
231 #define BT_LMP_MAX_SLOT                 45
232 struct bt_lmp_max_slot {
233         uint8_t  slots;
234 } __attribute__ ((packed));
235
236 #define BT_LMP_MAX_SLOT_REQ             46
237 struct bt_lmp_max_slot_req {
238         uint8_t  slots;
239 } __attribute__ ((packed));
240
241 #define BT_LMP_TIMING_ACCURACY_REQ      47
242
243 #define BT_LMP_TIMING_ACCURACY_RES      48
244 struct bt_lmp_timing_accuracy_res {
245         uint8_t  drift;
246         uint8_t  jitter;
247 } __attribute__ ((packed));
248
249 #define BT_LMP_SETUP_COMPLETE           49
250
251 #define BT_LMP_USE_SEMI_PERMANENT_KEY   50
252
253 #define BT_LMP_HOST_CONNECTION_REQ      51
254
255 #define BT_LMP_SLOT_OFFSET              52
256 struct bt_lmp_slot_offset {
257         uint16_t offset;
258         uint8_t  bdaddr[6];
259 } __attribute__ ((packed));
260
261 #define BT_LMP_PAGE_SCAN_MODE_REQ       54
262 struct bt_lmp_page_scan_mode_req {
263         uint8_t  scheme;
264         uint8_t  settings;
265 } __attribute__ ((packed));
266
267 #define BT_LMP_TEST_ACTIVATE            56
268
269 #define BT_LMP_ENCRYPTION_KEY_SIZE_MASK_REQ     58
270
271 #define BT_LMP_SET_AFH                  60
272 struct bt_lmp_set_afh {
273         uint32_t instant;
274         uint8_t  mode;
275         uint8_t  map[10];
276 } __attribute__ ((packed));
277
278 #define BT_LMP_ENCAPSULATED_HEADER      61
279 struct bt_lmp_encapsulated_header {
280         uint8_t  major;
281         uint8_t  minor;
282         uint8_t  length;
283 } __attribute__ ((packed));
284
285 #define BT_LMP_ENCAPSULATED_PAYLOAD     62
286 struct bt_lmp_encapsulated_payload {
287         uint8_t  data[16];
288 } __attribute__ ((packed));
289
290 #define BT_LMP_SIMPLE_PAIRING_CONFIRM   63
291 struct bt_lmp_simple_pairing_confirm {
292         uint8_t  value[16];
293 } __attribute__ ((packed));
294
295 #define BT_LMP_SIMPLE_PAIRING_NUMBER    64
296 struct bt_lmp_simple_pairing_number {
297         uint8_t  value[16];
298 } __attribute__ ((packed));
299
300 #define BT_LMP_DHKEY_CHECK              65
301 struct bt_lmp_dhkey_check {
302         uint8_t  value[16];
303 } __attribute__ ((packed));
304
305 #define BT_LMP_PAUSE_ENCRYPTION_AES_REQ 66
306
307 #define BT_LMP_ACCEPTED_EXT             LMP_ESC4(1)
308 struct bt_lmp_accepted_ext {
309         uint8_t  escape;
310         uint8_t  opcode;
311 } __attribute__ ((packed));
312
313 #define BT_LMP_NOT_ACCEPTED_EXT         LMP_ESC4(2)
314 struct bt_lmp_not_accepted_ext {
315         uint8_t  escape;
316         uint8_t  opcode;
317         uint8_t  error;
318 } __attribute__ ((packed));
319
320 #define BT_LMP_FEATURES_REQ_EXT         LMP_ESC4(3)
321 struct bt_lmp_features_req_ext {
322         uint8_t  page;
323         uint8_t  max_page;
324         uint8_t  features[8];
325 } __attribute__ ((packed));
326
327 #define BT_LMP_FEATURES_RES_EXT         LMP_ESC4(4)
328 struct bt_lmp_features_res_ext {
329         uint8_t  page;
330         uint8_t  max_page;
331         uint8_t  features[8];
332 } __attribute__ ((packed));
333
334 #define BT_LMP_PACKET_TYPE_TABLE_REQ    LMP_ESC4(11)
335 struct bt_lmp_packet_type_table_req {
336         uint8_t  table;
337 } __attribute__ ((packed));
338
339 #define BT_LMP_CHANNEL_CLASSIFICATION_REQ       LMP_ESC4(16)
340 struct bt_lmp_channel_classification_req {
341         uint8_t  mode;
342         uint16_t min_interval;
343         uint16_t max_interval;
344 } __attribute__ ((packed));
345
346 #define BT_LMP_CHANNEL_CLASSIFICATION   LMP_ESC4(17)
347 struct bt_lmp_channel_classification {
348         uint8_t  classification[10];
349 } __attribute__ ((packed));
350
351 #define BT_LMP_PAUSE_ENCRYPTION_REQ     LMP_ESC4(23)
352
353 #define BT_LMP_RESUME_ENCRYPTION_REQ    LMP_ESC4(24)
354
355 #define BT_LMP_IO_CAPABILITY_REQ        LMP_ESC4(25)
356 struct bt_lmp_io_capability_req {
357         uint8_t  capability;
358         uint8_t  oob_data;
359         uint8_t  authentication;
360 } __attribute__ ((packed));
361
362 #define BT_LMP_IO_CAPABILITY_RES        LMP_ESC4(26)
363 struct bt_lmp_io_capability_res {
364         uint8_t  capability;
365         uint8_t  oob_data;
366         uint8_t  authentication;
367 } __attribute__ ((packed));
368
369 #define BT_LMP_NUMERIC_COMPARISON_FAILED        LMP_ESC(27)
370
371 #define BT_LMP_PASSKEY_FAILED           LMP_ESC4(28)
372
373 #define BT_LMP_OOB_FAILED               LMP_ESC(29)
374
375 #define BT_LMP_POWER_CONTROL_REQ        LMP_ESC4(31)
376 struct bt_lmp_power_control_req {
377         uint8_t  request;
378 } __attribute__ ((packed));
379
380 #define BT_LMP_POWER_CONTROL_RES        LMP_ESC4(32)
381 struct bt_lmp_power_control_res {
382         uint8_t  response;
383 } __attribute__ ((packed));
384
385 #define BT_LMP_PING_REQ                 LMP_ESC4(33)
386
387 #define BT_LMP_PING_RES                 LMP_ESC4(34)
388
389 #define BT_H4_CMD_PKT   0x01
390 #define BT_H4_ACL_PKT   0x02
391 #define BT_H4_SCO_PKT   0x03
392 #define BT_H4_EVT_PKT   0x04
393
394 struct bt_hci_cmd_hdr {
395         uint16_t opcode;
396         uint8_t  plen;
397 } __attribute__ ((packed));
398
399 struct bt_hci_acl_hdr {
400         uint16_t handle;
401         uint16_t dlen;
402 } __attribute__ ((packed));
403
404 struct bt_hci_sco_hdr {
405         uint16_t handle;
406         uint8_t  dlen;
407 } __attribute__ ((packed));
408
409 struct bt_hci_evt_hdr {
410         uint8_t  evt;
411         uint8_t  plen;
412 } __attribute__ ((packed));
413
414 #define BT_HCI_CMD_NOP                          0x0000
415
416 #define BT_HCI_CMD_INQUIRY                      0x0401
417 struct bt_hci_cmd_inquiry {
418         uint8_t  lap[3];
419         uint8_t  length;
420         uint8_t  num_resp;
421 } __attribute__ ((packed));
422
423 #define BT_HCI_CMD_INQUIRY_CANCEL               0x0402
424
425 #define BT_HCI_CMD_PERIODIC_INQUIRY             0x0403
426 struct bt_hci_cmd_periodic_inquiry {
427         uint16_t max_period;
428         uint16_t min_period;
429         uint8_t  lap[3];
430         uint8_t  length;
431         uint8_t  num_resp;
432 } __attribute__ ((packed));
433
434 #define BT_HCI_CMD_EXIT_PERIODIC_INQUIRY        0x0404
435
436 #define BT_HCI_CMD_CREATE_CONN                  0x0405
437 struct bt_hci_cmd_create_conn {
438         uint8_t  bdaddr[6];
439         uint16_t pkt_type;
440         uint8_t  pscan_rep_mode;
441         uint8_t  pscan_mode;
442         uint16_t clock_offset;
443         uint8_t  role_switch;
444 } __attribute__ ((packed));
445
446 #define BT_HCI_CMD_DISCONNECT                   0x0406
447 struct bt_hci_cmd_disconnect {
448         uint16_t handle;
449         uint8_t  reason;
450 } __attribute__ ((packed));
451
452 #define BT_HCI_CMD_ADD_SCO_CONN                 0x0407
453 struct bt_hci_cmd_add_sco_conn {
454         uint16_t handle;
455         uint16_t pkt_type;
456 } __attribute__ ((packed));
457
458 #define BT_HCI_CMD_CREATE_CONN_CANCEL           0x0408
459 struct bt_hci_cmd_create_conn_cancel {
460         uint8_t  bdaddr[6];
461 } __attribute__ ((packed));
462
463 #define BT_HCI_CMD_ACCEPT_CONN_REQUEST          0x0409
464 struct bt_hci_cmd_accept_conn_request {
465         uint8_t  bdaddr[6];
466         uint8_t  role;
467 } __attribute__ ((packed));
468
469 #define BT_HCI_CMD_REJECT_CONN_REQUEST          0x040a
470 struct bt_hci_cmd_reject_conn_request {
471         uint8_t  bdaddr[6];
472         uint8_t  reason;
473 } __attribute__ ((packed));
474
475 #define BT_HCI_CMD_LINK_KEY_REQUEST_REPLY       0x040b
476 struct bt_hci_cmd_link_key_request_reply {
477         uint8_t  bdaddr[6];
478         uint8_t  link_key[16];
479 } __attribute__ ((packed));
480 struct bt_hci_rsp_link_key_request_reply {
481         uint8_t  status;
482         uint8_t  bdaddr[6];
483 } __attribute__ ((packed));
484
485 #define BT_HCI_CMD_LINK_KEY_REQUEST_NEG_REPLY   0x040c
486 struct bt_hci_cmd_link_key_request_neg_reply {
487         uint8_t  bdaddr[6];
488 } __attribute__ ((packed));
489 struct bt_hci_rsp_link_key_request_neg_reply {
490         uint8_t  status;
491         uint8_t  bdaddr[6];
492 } __attribute__ ((packed));
493
494 #define BT_HCI_CMD_PIN_CODE_REQUEST_REPLY       0x040d
495 struct bt_hci_cmd_pin_code_request_reply {
496         uint8_t  bdaddr[6];
497         uint8_t  pin_len;
498         uint8_t  pin_code[16];
499 } __attribute__ ((packed));
500
501 #define BT_HCI_CMD_PIN_CODE_REQUEST_NEG_REPLY   0x040e
502 struct bt_hci_cmd_pin_code_request_neg_reply {
503         uint8_t  bdaddr[6];
504 } __attribute__ ((packed));
505 struct bt_hci_rsp_pin_code_request_neg_reply {
506         uint8_t  status;
507         uint8_t  bdaddr[6];
508 } __attribute__ ((packed));
509
510 #define BT_HCI_CMD_CHANGE_CONN_PKT_TYPE         0x040f
511 struct bt_hci_cmd_change_conn_pkt_type {
512         uint16_t handle;
513         uint16_t pkt_type;
514 } __attribute__ ((packed));
515
516 #define BT_HCI_CMD_AUTH_REQUESTED               0x0411
517 struct bt_hci_cmd_auth_requested {
518         uint16_t handle;
519 } __attribute__ ((packed));
520
521 #define BT_HCI_CMD_SET_CONN_ENCRYPT             0x0413
522 struct bt_hci_cmd_set_conn_encrypt {
523         uint16_t handle;
524         uint8_t  encr_mode;
525 } __attribute__ ((packed));
526
527 #define BT_HCI_CMD_CHANGE_CONN_LINK_KEY         0x0415
528 struct bt_hci_cmd_change_conn_link_key {
529         uint16_t handle;
530 } __attribute__ ((packed));
531
532 #define BT_HCI_CMD_MASTER_LINK_KEY              0x0417
533 struct bt_hci_cmd_master_link_key {
534         uint8_t  key_flag;
535 } __attribute__ ((packed));
536
537 #define BT_HCI_CMD_REMOTE_NAME_REQUEST          0x0419
538 struct bt_hci_cmd_remote_name_request {
539         uint8_t  bdaddr[6];
540         uint8_t  pscan_rep_mode;
541         uint8_t  pscan_mode;
542         uint16_t clock_offset;
543 } __attribute__ ((packed));
544
545 #define BT_HCI_CMD_REMOTE_NAME_REQUEST_CANCEL   0x041a
546 struct bt_hci_cmd_remote_name_request_cancel {
547         uint8_t  bdaddr[6];
548 } __attribute__ ((packed));
549 struct bt_hci_rsp_remote_name_request_cancel {
550         uint8_t  status;
551         uint8_t  bdaddr[6];
552 } __attribute__ ((packed));
553
554 #define BT_HCI_CMD_READ_REMOTE_FEATURES         0x041b
555 struct bt_hci_cmd_read_remote_features {
556         uint16_t handle;
557 } __attribute__ ((packed));
558
559 #define BT_HCI_CMD_READ_REMOTE_EXT_FEATURES     0x041c
560 struct bt_hci_cmd_read_remote_ext_features {
561         uint16_t handle;
562         uint8_t  page;
563 } __attribute__ ((packed));
564
565 #define BT_HCI_CMD_READ_REMOTE_VERSION          0x041d
566 struct bt_hci_cmd_read_remote_version {
567         uint16_t handle;
568 } __attribute__ ((packed));
569
570 #define BT_HCI_CMD_READ_CLOCK_OFFSET            0x041f
571 struct bt_hci_cmd_read_clock_offset {
572         uint16_t handle;
573 } __attribute__ ((packed));
574
575 #define BT_HCI_CMD_READ_LMP_HANDLE              0x0420
576 struct bt_hci_cmd_read_lmp_handle {
577         uint16_t  handle;
578 } __attribute__ ((packed));
579 struct bt_hci_rsp_read_lmp_handle {
580         uint8_t  status;
581         uint16_t handle;
582         uint8_t  lmp_handle;
583         uint32_t reserved;
584 } __attribute__ ((packed));
585
586 #define BT_HCI_CMD_SETUP_SYNC_CONN              0x0428
587 struct bt_hci_cmd_setup_sync_conn {
588         uint16_t handle;
589         uint32_t tx_bandwidth;
590         uint32_t rx_bandwidth;
591         uint16_t max_latency;
592         uint16_t voice_setting;
593         uint8_t  retrans_effort;
594         uint16_t pkt_type;
595 } __attribute__ ((packed));
596
597 #define BT_HCI_CMD_ACCEPT_SYNC_CONN_REQUEST     0x0429
598 struct bt_hci_cmd_accept_sync_conn_request {
599         uint8_t  bdaddr[6];
600         uint32_t tx_bandwidth;
601         uint32_t rx_bandwidth;
602         uint16_t max_latency;
603         uint16_t voice_setting;
604         uint8_t  retrans_effort;
605         uint16_t pkt_type;
606 } __attribute__ ((packed));
607
608 #define BT_HCI_CMD_REJECT_SYNC_CONN_REQUEST     0x042a
609 struct bt_hci_cmd_reject_sync_conn_request {
610         uint8_t  bdaddr[6];
611         uint8_t  reason;
612 } __attribute__ ((packed));
613
614 #define BT_HCI_CMD_IO_CAPABILITY_REQUEST_REPLY          0x042b
615 struct bt_hci_cmd_io_capability_request_reply {
616         uint8_t  bdaddr[6];
617         uint8_t  capability;
618         uint8_t  oob_data;
619         uint8_t  authentication;
620 } __attribute__ ((packed));
621 struct bt_hci_rsp_io_capability_request_reply {
622         uint8_t  status;
623         uint8_t  bdaddr[6];
624 } __attribute__ ((packed));
625
626 #define BT_HCI_CMD_USER_CONFIRM_REQUEST_REPLY           0x042c
627 struct bt_hci_cmd_user_confirm_request_reply {
628         uint8_t  bdaddr[6];
629 } __attribute__ ((packed));
630 struct bt_hci_rsp_user_confirm_request_reply {
631         uint8_t  status;
632         uint8_t  bdaddr[6];
633 } __attribute__ ((packed));
634
635 #define BT_HCI_CMD_USER_CONFIRM_REQUEST_NEG_REPLY       0x042d
636 struct bt_hci_cmd_user_confirm_request_neg_reply {
637         uint8_t  bdaddr[6];
638 } __attribute__ ((packed));
639 struct bt_hci_rsp_user_confirm_request_neg_reply {
640         uint8_t  status;
641         uint8_t  bdaddr[6];
642 } __attribute__ ((packed));
643
644 #define BT_HCI_CMD_USER_PASSKEY_REQUEST_REPLY           0x042e
645 struct bt_hci_cmd_user_passkey_request_reply {
646         uint8_t  bdaddr[6];
647         uint32_t passkey;
648 } __attribute__ ((packed));
649
650 #define BT_HCI_CMD_USER_PASSKEY_REQUEST_NEG_REPLY       0x042f
651 struct bt_hci_cmd_user_passkey_request_neg_reply {
652         uint8_t  bdaddr[6];
653 } __attribute__ ((packed));
654
655 #define BT_HCI_CMD_REMOTE_OOB_DATA_REQUEST_REPLY        0x0430
656 struct bt_hci_cmd_remote_oob_data_request_reply {
657         uint8_t  bdaddr[6];
658         uint8_t  hash[16];
659         uint8_t  randomizer[16];
660 } __attribute__ ((packed));
661
662 #define BT_HCI_CMD_REMOTE_OOB_DATA_REQUEST_NEG_REPLY    0x0433
663 struct bt_hci_cmd_remote_oob_data_request_neg_reply {
664         uint8_t  bdaddr[6];
665 } __attribute__ ((packed));
666
667 #define BT_HCI_CMD_IO_CAPABILITY_REQUEST_NEG_REPLY      0x0434
668 struct bt_hci_cmd_io_capability_request_neg_reply {
669         uint8_t  bdaddr[6];
670         uint8_t  reason;
671 } __attribute__ ((packed));
672 struct bt_hci_rsp_io_capability_request_neg_reply {
673         uint8_t  status;
674         uint8_t  bdaddr[6];
675 } __attribute__ ((packed));
676
677 #define BT_HCI_CMD_CREATE_PHY_LINK              0x0435
678 struct bt_hci_cmd_create_phy_link {
679         uint8_t  phy_handle;
680         uint8_t  key_len;
681         uint8_t  key_type;
682 } __attribute__ ((packed));
683
684 #define BT_HCI_CMD_ACCEPT_PHY_LINK              0x0436
685 struct bt_hci_cmd_accept_phy_link {
686         uint8_t  phy_handle;
687         uint8_t  key_len;
688         uint8_t  key_type;
689 } __attribute__ ((packed));
690
691 #define BT_HCI_CMD_DISCONN_PHY_LINK             0x0437
692 struct bt_hci_cmd_disconn_phy_link {
693         uint8_t  phy_handle;
694         uint8_t  reason;
695 } __attribute__ ((packed));
696
697 #define BT_HCI_CMD_CREATE_LOGIC_LINK            0x0438
698 struct bt_hci_cmd_create_logic_link {
699         uint8_t  phy_handle;
700         uint8_t  tx_flow_spec[16];
701         uint8_t  rx_flow_spec[16];
702 } __attribute__ ((packed));
703
704 #define BT_HCI_CMD_ACCEPT_LOGIC_LINK            0x0439
705 struct bt_hci_cmd_accept_logic_link {
706         uint8_t  phy_handle;
707         uint8_t  tx_flow_spec[16];
708         uint8_t  rx_flow_spec[16];
709 } __attribute__ ((packed));
710
711 #define BT_HCI_CMD_DISCONN_LOGIC_LINK           0x043a
712 struct bt_hci_cmd_disconn_logic_link {
713         uint16_t handle;
714 } __attribute__ ((packed));
715
716 #define BT_HCI_CMD_LOGIC_LINK_CANCEL            0x043b
717 struct bt_hci_cmd_logic_link_cancel {
718         uint8_t  phy_handle;
719         uint8_t  flow_spec;
720 } __attribute__ ((packed));
721 struct bt_hci_rsp_logic_link_cancel {
722         uint8_t  status;
723         uint8_t  phy_handle;
724         uint8_t  flow_spec;
725 } __attribute__ ((packed));
726
727 #define BT_HCI_CMD_FLOW_SPEC_MODIFY             0x043c
728 struct bt_hci_cmd_flow_spec_modify {
729         uint16_t handle;
730         uint8_t  tx_flow_spec[16];
731         uint8_t  rx_flow_spec[16];
732 } __attribute__ ((packed));
733
734 #define BT_HCI_CMD_ENHANCED_SETUP_SYNC_CONN     0x043d
735 struct bt_hci_cmd_enhanced_setup_sync_conn {
736         uint16_t handle;
737         uint32_t tx_bandwidth;
738         uint32_t rx_bandwidth;
739         uint8_t  tx_coding_format[5];
740         uint8_t  rx_coding_format[5];
741         uint16_t tx_codec_frame_size;
742         uint16_t rx_codec_frame_size;
743         uint32_t input_bandwidth;
744         uint32_t output_bandwidth;
745         uint8_t  input_coding_format[5];
746         uint8_t  output_coding_format[5];
747         uint16_t input_coded_data_size;
748         uint16_t output_coded_data_size;
749         uint8_t  input_pcm_data_format;
750         uint8_t  output_pcm_data_format;
751         uint8_t  input_pcm_msb_position;
752         uint8_t  output_pcm_msb_position;
753         uint8_t  input_data_path;
754         uint8_t  output_data_path;
755         uint8_t  input_unit_size;
756         uint8_t  output_unit_size;
757         uint16_t max_latency;
758         uint16_t pkt_type;
759         uint8_t  retrans_effort;
760 } __attribute__ ((packed));
761
762 #define BT_HCI_CMD_ENHANCED_ACCEPT_SYNC_CONN_REQUEST    0x043e
763 struct bt_hci_cmd_enhanced_accept_sync_conn_request {
764         uint8_t  bdaddr[6];
765         uint32_t tx_bandwidth;
766         uint32_t rx_bandwidth;
767         uint8_t  tx_coding_format[5];
768         uint8_t  rx_coding_format[5];
769         uint16_t tx_codec_frame_size;
770         uint16_t rx_codec_frame_size;
771         uint32_t input_bandwidth;
772         uint32_t output_bandwidth;
773         uint8_t  input_coding_format[5];
774         uint8_t  output_coding_format[5];
775         uint16_t input_coded_data_size;
776         uint16_t output_coded_data_size;
777         uint8_t  input_pcm_data_format;
778         uint8_t  output_pcm_data_format;
779         uint8_t  input_pcm_msb_position;
780         uint8_t  output_pcm_msb_position;
781         uint8_t  input_data_path;
782         uint8_t  output_data_path;
783         uint8_t  input_unit_size;
784         uint8_t  output_unit_size;
785         uint16_t max_latency;
786         uint16_t pkt_type;
787         uint8_t  retrans_effort;
788 } __attribute__ ((packed));
789
790 #define BT_HCI_CMD_TRUNCATED_PAGE               0x043f
791 struct bt_hci_cmd_truncated_page {
792         uint8_t  bdaddr[6];
793         uint8_t  pscan_rep_mode;
794         uint16_t clock_offset;
795 } __attribute__ ((packed));
796
797 #define BT_HCI_CMD_TRUNCATED_PAGE_CANCEL        0x0440
798 struct bt_hci_cmd_truncated_page_cancel {
799         uint8_t  bdaddr[6];
800 } __attribute__ ((packed));
801
802 #define BT_HCI_CMD_SET_SLAVE_BROADCAST          0x0441
803 struct bt_hci_cmd_set_slave_broadcast {
804         uint8_t  enable;
805         uint8_t  lt_addr;
806         uint8_t  lpo_allowed;
807         uint16_t pkt_type;
808         uint16_t min_interval;
809         uint16_t max_interval;
810         uint16_t timeout;
811 } __attribute__ ((packed));
812 struct bt_hci_rsp_set_slave_broadcast {
813         uint8_t  status;
814         uint8_t  lt_addr;
815         uint16_t interval;
816 } __attribute__ ((packed));
817
818 #define BT_HCI_CMD_SET_SLAVE_BROADCAST_RECEIVE  0x0442
819 struct bt_hci_cmd_set_slave_broadcast_receive {
820         uint8_t  enable;
821         uint8_t  bdaddr[6];
822         uint8_t  lt_addr;
823         uint16_t interval;
824         uint32_t offset;
825         uint32_t instant;
826         uint16_t timeout;
827         uint8_t  accuracy;
828         uint8_t  skip;
829         uint16_t pkt_type;
830         uint8_t  map[10];
831 } __attribute__ ((packed));
832 struct bt_hci_rsp_set_slave_broadcast_receive {
833         uint8_t  status;
834         uint8_t  bdaddr[6];
835         uint8_t  lt_addr;
836 } __attribute__ ((packed));
837
838 #define BT_HCI_CMD_START_SYNC_TRAIN             0x0443
839
840 #define BT_HCI_CMD_RECEIVE_SYNC_TRAIN           0x0444
841 struct bt_hci_cmd_receive_sync_train {
842         uint8_t  bdaddr[6];
843         uint16_t timeout;
844         uint16_t window;
845         uint16_t interval;
846 } __attribute__ ((packed));
847
848 #define BT_HCI_CMD_REMOTE_OOB_EXT_DATA_REQUEST_REPLY    0x0445
849 struct bt_hci_cmd_remote_oob_ext_data_request_reply {
850         uint8_t  bdaddr[6];
851         uint8_t  hash192[16];
852         uint8_t  randomizer192[16];
853         uint8_t  hash256[16];
854         uint8_t  randomizer256[16];
855 } __attribute__ ((packed));
856
857 #define BT_HCI_CMD_HOLD_MODE                    0x0801
858 struct bt_hci_cmd_hold_mode {
859         uint16_t handle;
860         uint16_t max_interval;
861         uint16_t min_interval;
862 } __attribute__ ((packed));
863
864 #define BT_HCI_CMD_SNIFF_MODE                   0x0803
865 struct bt_hci_cmd_sniff_mode {
866         uint16_t handle;
867         uint16_t max_interval;
868         uint16_t min_interval;
869         uint16_t attempt;
870         uint16_t timeout;
871 } __attribute__ ((packed));
872
873 #define BT_HCI_CMD_EXIT_SNIFF_MODE              0x0804
874 struct bt_hci_cmd_exit_sniff_mode {
875         uint16_t handle;
876 } __attribute__ ((packed));
877
878 #define BT_HCI_CMD_PARK_STATE                   0x0805
879 struct bt_hci_cmd_park_state {
880         uint16_t handle;
881         uint16_t max_interval;
882         uint16_t min_interval;
883 } __attribute__ ((packed));
884
885 #define BT_HCI_CMD_EXIT_PARK_STATE              0x0806
886 struct bt_hci_cmd_exit_park_state {
887         uint16_t handle;
888 } __attribute__ ((packed));
889
890 #define BT_HCI_CMD_QOS_SETUP                    0x0807
891 struct bt_hci_cmd_qos_setup {
892         uint16_t handle;
893         uint8_t  flags;
894         uint8_t  service_type;
895         uint32_t token_rate;
896         uint32_t peak_bandwidth;
897         uint32_t latency;
898         uint32_t delay_variation;
899 } __attribute__ ((packed));
900
901 #define BT_HCI_CMD_ROLE_DISCOVERY               0x0809
902 struct bt_hci_cmd_role_discovery {
903         uint16_t handle;
904 } __attribute__ ((packed));
905 struct bt_hci_rsp_role_discovery {
906         uint8_t  status;
907         uint16_t handle;
908         uint8_t  role;
909 } __attribute__ ((packed));
910
911 #define BT_HCI_CMD_SWITCH_ROLE                  0x080b
912 struct bt_hci_cmd_switch_role {
913         uint8_t  bdaddr[6];
914         uint8_t  role;
915 } __attribute__ ((packed));
916
917 #define BT_HCI_CMD_READ_LINK_POLICY             0x080c
918 struct bt_hci_cmd_read_link_policy {
919         uint16_t handle;
920 } __attribute__ ((packed));
921 struct bt_hci_rsp_read_link_policy {
922         uint8_t  status;
923         uint16_t handle;
924         uint16_t policy;
925 } __attribute__ ((packed));
926
927 #define BT_HCI_CMD_WRITE_LINK_POLICY            0x080d
928 struct bt_hci_cmd_write_link_policy {
929         uint16_t handle;
930         uint16_t policy;
931 } __attribute__ ((packed));
932 struct bt_hci_rsp_write_link_policy {
933         uint8_t  status;
934         uint16_t handle;
935 } __attribute__ ((packed));
936
937 #define BT_HCI_CMD_READ_DEFAULT_LINK_POLICY     0x080e
938 struct bt_hci_rsp_read_default_link_policy {
939         uint8_t  status;
940         uint16_t policy;
941 } __attribute__ ((packed));
942
943 #define BT_HCI_CMD_WRITE_DEFAULT_LINK_POLICY    0x080f
944 struct bt_hci_cmd_write_default_link_policy {
945         uint16_t policy;
946 } __attribute__ ((packed));
947
948 #define BT_HCI_CMD_FLOW_SPEC                    0x0810
949 struct bt_hci_cmd_flow_spec {
950         uint16_t handle;
951         uint8_t  flags;
952         uint8_t  direction;
953         uint8_t  service_type;
954         uint32_t token_rate;
955         uint32_t token_bucket_size;
956         uint32_t peak_bandwidth;
957         uint32_t access_latency;
958 } __attribute__ ((packed));
959
960 #define BT_HCI_CMD_SNIFF_SUBRATING              0x0811
961 struct bt_hci_cmd_sniff_subrating {
962         uint16_t handle;
963         uint16_t max_latency;
964         uint16_t min_remote_timeout;
965         uint16_t min_local_timeout;
966 } __attribute__ ((packed));
967 struct bt_hci_rsp_sniff_subrating {
968         uint8_t  status;
969         uint16_t handle;
970 } __attribute__ ((packed));
971
972 #define BT_HCI_CMD_SET_EVENT_MASK               0x0c01
973 struct bt_hci_cmd_set_event_mask {
974         uint8_t  mask[8];
975 } __attribute__ ((packed));
976
977 #define BT_HCI_CMD_RESET                        0x0c03
978
979 #define BT_HCI_CMD_SET_EVENT_FILTER             0x0c05
980 struct bt_hci_cmd_set_event_filter {
981         uint8_t  type;
982         uint8_t  cond_type;
983         uint8_t  cond[0];
984 } __attribute__ ((packed));
985
986 #define BT_HCI_CMD_FLUSH                        0x0c08
987 struct bt_hci_cmd_flush {
988         uint16_t handle;
989 } __attribute__ ((packed));
990 struct bt_hci_rsp_flush {
991         uint8_t  status;
992         uint16_t handle;
993 } __attribute__ ((packed));
994
995 #define BT_HCI_CMD_READ_PIN_TYPE                0x0c09
996 struct bt_hci_rsp_read_pin_type {
997         uint8_t  status;
998         uint8_t  pin_type;
999 } __attribute__ ((packed));
1000
1001 #define BT_HCI_CMD_WRITE_PIN_TYPE               0x0c0a
1002 struct bt_hci_cmd_write_pin_type {
1003         uint8_t  pin_type;
1004 } __attribute__ ((packed));
1005
1006 #define BT_HCI_CMD_CREATE_NEW_UNIT_KEY          0x0c0b
1007
1008 #define BT_HCI_CMD_READ_STORED_LINK_KEY         0x0c0d
1009 struct bt_hci_cmd_read_stored_link_key {
1010         uint8_t  bdaddr[6];
1011         uint8_t  read_all;
1012 } __attribute__ ((packed));
1013 struct bt_hci_rsp_read_stored_link_key {
1014         uint8_t  status;
1015         uint16_t max_num_keys;
1016         uint16_t num_keys;
1017 } __attribute__ ((packed));
1018
1019 #define BT_HCI_CMD_WRITE_STORED_LINK_KEY        0x0c11
1020 struct bt_hci_cmd_write_stored_link_key {
1021         uint8_t  num_keys;
1022 } __attribute__ ((packed));
1023 struct bt_hci_rsp_write_stored_link_key {
1024         uint8_t  status;
1025         uint8_t  num_keys;
1026 } __attribute__ ((packed));
1027
1028 #define BT_HCI_CMD_DELETE_STORED_LINK_KEY       0x0c12
1029 struct bt_hci_cmd_delete_stored_link_key {
1030         uint8_t  bdaddr[6];
1031         uint8_t  delete_all;
1032 } __attribute__ ((packed));
1033 struct bt_hci_rsp_delete_stored_link_key {
1034         uint8_t  status;
1035         uint16_t num_keys;
1036 } __attribute__ ((packed));
1037
1038 #define BT_HCI_CMD_WRITE_LOCAL_NAME             0x0c13
1039 struct bt_hci_cmd_write_local_name {
1040         uint8_t  name[248];
1041 } __attribute__ ((packed));
1042
1043 #define BT_HCI_CMD_READ_LOCAL_NAME              0x0c14
1044 struct bt_hci_rsp_read_local_name {
1045         uint8_t  status;
1046         uint8_t  name[248];
1047 } __attribute__ ((packed));
1048
1049 #define BT_HCI_CMD_READ_CONN_ACCEPT_TIMEOUT     0x0c15
1050 struct bt_hci_rsp_read_conn_accept_timeout {
1051         uint8_t  status;
1052         uint16_t timeout;
1053 } __attribute__ ((packed));
1054
1055 #define BT_HCI_CMD_WRITE_CONN_ACCEPT_TIMEOUT    0x0c16
1056 struct bt_hci_cmd_write_conn_accept_timeout {
1057         uint16_t timeout;
1058 } __attribute__ ((packed));
1059
1060 #define BT_HCI_CMD_READ_PAGE_TIMEOUT            0x0c17
1061 struct bt_hci_rsp_read_page_timeout {
1062         uint8_t  status;
1063         uint16_t timeout;
1064 } __attribute__ ((packed));
1065
1066 #define BT_HCI_CMD_WRITE_PAGE_TIMEOUT           0x0c18
1067 struct bt_hci_cmd_write_page_timeout {
1068         uint16_t timeout;
1069 } __attribute__ ((packed));
1070
1071 #define BT_HCI_CMD_READ_SCAN_ENABLE             0x0c19
1072 struct bt_hci_rsp_read_scan_enable {
1073         uint8_t  status;
1074         uint8_t  enable;
1075 } __attribute__ ((packed));
1076
1077 #define BT_HCI_CMD_WRITE_SCAN_ENABLE            0x0c1a
1078 struct bt_hci_cmd_write_scan_enable {
1079         uint8_t  enable;
1080 } __attribute__ ((packed));
1081
1082 #define BT_HCI_CMD_READ_PAGE_SCAN_ACTIVITY      0x0c1b
1083 struct bt_hci_rsp_read_page_scan_activity {
1084         uint8_t  status;
1085         uint16_t interval;
1086         uint16_t window;
1087 } __attribute__ ((packed));
1088
1089 #define BT_HCI_CMD_WRITE_PAGE_SCAN_ACTIVITY     0x0c1c
1090 struct bt_hci_cmd_write_page_scan_activity {
1091         uint16_t interval;
1092         uint16_t window;
1093 } __attribute__ ((packed));
1094
1095 #define BT_HCI_CMD_READ_INQUIRY_SCAN_ACTIVITY   0x0c1d
1096 struct bt_hci_rsp_read_inquiry_scan_activity {
1097         uint8_t  status;
1098         uint16_t interval;
1099         uint16_t window;
1100 } __attribute__ ((packed));
1101
1102 #define BT_HCI_CMD_WRITE_INQUIRY_SCAN_ACTIVITY  0x0c1e
1103 struct bt_hci_cmd_write_inquiry_scan_activity {
1104         uint16_t interval;
1105         uint16_t window;
1106 } __attribute__ ((packed));
1107
1108 #define BT_HCI_CMD_READ_AUTH_ENABLE             0x0c1f
1109 struct bt_hci_rsp_read_auth_enable {
1110         uint8_t  status;
1111         uint8_t  enable;
1112 } __attribute__ ((packed));
1113
1114 #define BT_HCI_CMD_WRITE_AUTH_ENABLE            0x0c20
1115 struct bt_hci_cmd_write_auth_enable {
1116         uint8_t  enable;
1117 } __attribute__ ((packed));
1118
1119 #define BT_HCI_CMD_READ_ENCRYPT_MODE            0x0c21
1120 struct bt_hci_rsp_read_encrypt_mode {
1121         uint8_t  status;
1122         uint8_t  mode;
1123 } __attribute__ ((packed));
1124
1125 #define BT_HCI_CMD_WRITE_ENCRYPT_MODE           0x0c22
1126 struct bt_hci_cmd_write_encrypt_mode {
1127         uint8_t  mode;
1128 } __attribute__ ((packed));
1129
1130 #define BT_HCI_CMD_READ_CLASS_OF_DEV            0x0c23
1131 struct bt_hci_rsp_read_class_of_dev {
1132         uint8_t  status;
1133         uint8_t  dev_class[3];
1134 } __attribute__ ((packed));
1135
1136 #define BT_HCI_CMD_WRITE_CLASS_OF_DEV           0x0c24
1137 struct bt_hci_cmd_write_class_of_dev {
1138         uint8_t  dev_class[3];
1139 } __attribute__ ((packed));
1140
1141 #define BT_HCI_CMD_READ_VOICE_SETTING           0x0c25
1142 struct bt_hci_rsp_read_voice_setting {
1143         uint8_t  status;
1144         uint16_t setting;
1145 } __attribute__ ((packed));
1146
1147 #define BT_HCI_CMD_WRITE_VOICE_SETTING          0x0c26
1148 struct bt_hci_cmd_write_voice_setting {
1149         uint16_t setting;
1150 } __attribute__ ((packed));
1151
1152 #define BT_HCI_CMD_READ_AUTO_FLUSH_TIMEOUT      0x0c27
1153 struct bt_hci_cmd_read_auto_flush_timeout {
1154         uint16_t handle;
1155 } __attribute__ ((packed));
1156 struct bt_hci_rsp_read_auto_flush_timeout {
1157         uint8_t  status;
1158         uint16_t handle;
1159         uint16_t timeout;
1160 } __attribute__ ((packed));
1161
1162 #define BT_HCI_CMD_WRITE_AUTO_FLUSH_TIMEOUT     0x0c28
1163 struct bt_hci_cmd_write_auto_flush_timeout {
1164         uint16_t handle;
1165         uint16_t timeout;
1166 } __attribute__ ((packed));
1167 struct bt_hci_rsp_write_auto_flush_timeout {
1168         uint8_t  status;
1169         uint16_t handle;
1170 } __attribute__ ((packed));
1171
1172 #define BT_HCI_CMD_READ_NUM_BROADCAST_RETRANS   0x0c29
1173 struct bt_hci_rsp_read_num_broadcast_retrans {
1174         uint8_t  status;
1175         uint8_t  num_retrans;
1176 } __attribute__ ((packed));
1177
1178 #define BT_HCI_CMD_WRITE_NUM_BROADCAST_RETRANS  0x0c2a
1179 struct bt_hci_cmd_write_num_broadcast_retrans {
1180         uint8_t  num_retrans;
1181 } __attribute__ ((packed));
1182
1183 #define BT_HCI_CMD_READ_HOLD_MODE_ACTIVITY      0x0c2b
1184 struct bt_hci_rsp_read_hold_mode_activity {
1185         uint8_t  status;
1186         uint8_t  activity;
1187 } __attribute__ ((packed));
1188
1189 #define BT_HCI_CMD_WRITE_HOLD_MODE_ACTIVITY     0x0c2c
1190 struct bt_hci_cmd_write_hold_mode_activity {
1191         uint8_t  activity;
1192 } __attribute__ ((packed));
1193
1194 #define BT_HCI_CMD_READ_TX_POWER                0x0c2d
1195 struct bt_hci_cmd_read_tx_power {
1196         uint16_t handle;
1197         uint8_t  type;
1198 } __attribute__ ((packed));
1199 struct bt_hci_rsp_read_tx_power {
1200         uint8_t  status;
1201         uint16_t handle;
1202         int8_t   level;
1203 } __attribute__ ((packed));
1204
1205 #define BT_HCI_CMD_READ_SYNC_FLOW_CONTROL       0x0c2e
1206 struct bt_hci_rsp_read_sync_flow_control {
1207         uint8_t  status;
1208         uint8_t  enable;
1209 } __attribute__ ((packed));
1210
1211 #define BT_HCI_CMD_WRITE_SYNC_FLOW_CONTROL      0x0c2f
1212 struct bt_hci_cmd_write_sync_flow_control {
1213         uint8_t  enable;
1214 } __attribute__ ((packed));
1215
1216 #define BT_HCI_CMD_SET_HOST_FLOW_CONTROL        0x0c31
1217 struct bt_hci_cmd_set_host_flow_control {
1218         uint8_t  enable;
1219 } __attribute__ ((packed));
1220
1221 #define BT_HCI_CMD_HOST_BUFFER_SIZE             0x0c33
1222 struct bt_hci_cmd_host_buffer_size {
1223         uint16_t acl_mtu;
1224         uint8_t  sco_mtu;
1225         uint16_t acl_max_pkt;
1226         uint16_t sco_max_pkt;
1227 } __attribute__ ((packed));
1228
1229 #define BT_HCI_CMD_HOST_NUM_COMPLETED_PACKETS   0x0c35
1230 struct bt_hci_cmd_host_num_completed_packets {
1231         uint8_t  num_handles;
1232         uint16_t handle;
1233         uint16_t count;
1234 } __attribute__ ((packed));
1235
1236 #define BT_HCI_CMD_READ_LINK_SUPV_TIMEOUT       0x0c36
1237 struct bt_hci_cmd_read_link_supv_timeout {
1238         uint16_t handle;
1239 } __attribute__ ((packed));
1240 struct bt_hci_rsp_read_link_supv_timeout {
1241         uint8_t  status;
1242         uint16_t handle;
1243         uint16_t timeout;
1244 } __attribute__ ((packed));
1245
1246 #define BT_HCI_CMD_WRITE_LINK_SUPV_TIMEOUT      0x0c37
1247 struct bt_hci_cmd_write_link_supv_timeout {
1248         uint16_t handle;
1249         uint16_t timeout;
1250 } __attribute__ ((packed));
1251 struct bt_hci_rsp_write_link_supv_timeout {
1252         uint8_t  status;
1253         uint16_t handle;
1254 } __attribute__ ((packed));
1255
1256 #define BT_HCI_CMD_READ_NUM_SUPPORTED_IAC       0x0c38
1257 struct bt_hci_rsp_read_num_supported_iac {
1258         uint8_t  status;
1259         uint8_t  num_iac;
1260 } __attribute__ ((packed));
1261
1262 #define BT_HCI_CMD_READ_CURRENT_IAC_LAP         0x0c39
1263 struct bt_hci_rsp_read_current_iac_lap {
1264         uint8_t  status;
1265         uint8_t  num_iac;
1266         uint8_t  iac_lap[0];
1267 } __attribute__ ((packed));
1268
1269 #define BT_HCI_CMD_WRITE_CURRENT_IAC_LAP        0x0c3a
1270 struct bt_hci_cmd_write_current_iac_lap {
1271         uint8_t  num_iac;
1272         uint8_t  iac_lap[0];
1273 } __attribute__ ((packed));
1274
1275 #define BT_HCI_CMD_READ_PAGE_SCAN_PERIOD_MODE   0x0c3b
1276 struct bt_hci_rsp_read_page_scan_period_mode {
1277         uint8_t  status;
1278         uint8_t  mode;
1279 } __attribute__ ((packed));
1280
1281 #define BT_HCI_CMD_WRITE_PAGE_SCAN_PERIOD_MODE  0x0c3c
1282 struct bt_hci_cmd_write_page_scan_period_mode {
1283         uint8_t  mode;
1284 } __attribute__ ((packed));
1285
1286 #define BT_HCI_CMD_READ_PAGE_SCAN_MODE          0x0c3d
1287 struct bt_hci_rsp_read_page_scan_mode {
1288         uint8_t  status;
1289         uint8_t  mode;
1290 } __attribute__ ((packed));
1291
1292 #define BT_HCI_CMD_WRITE_PAGE_SCAN_MODE         0x0c3e
1293 struct bt_hci_cmd_write_page_scan_mode {
1294         uint8_t  mode;
1295 } __attribute__ ((packed));
1296
1297 #define BT_HCI_CMD_SET_AFH_HOST_CLASSIFICATION  0x0c3f
1298 struct bt_hci_cmd_set_afh_host_classification {
1299         uint8_t  map[10];
1300 } __attribute__ ((packed));
1301
1302 #define BT_HCI_CMD_READ_INQUIRY_SCAN_TYPE       0x0c42
1303 struct bt_hci_rsp_read_inquiry_scan_type {
1304         uint8_t  status;
1305         uint8_t  type;
1306 } __attribute__ ((packed));
1307
1308 #define BT_HCI_CMD_WRITE_INQUIRY_SCAN_TYPE      0x0c43
1309 struct bt_hci_cmd_write_inquiry_scan_type {
1310         uint8_t type;
1311 } __attribute__ ((packed));
1312
1313 #define BT_HCI_CMD_READ_INQUIRY_MODE            0x0c44
1314 struct bt_hci_rsp_read_inquiry_mode {
1315         uint8_t  status;
1316         uint8_t  mode;
1317 } __attribute__ ((packed));
1318
1319 #define BT_HCI_CMD_WRITE_INQUIRY_MODE           0x0c45
1320 struct bt_hci_cmd_write_inquiry_mode {
1321         uint8_t  mode;
1322 } __attribute__ ((packed));
1323
1324 #define BT_HCI_CMD_READ_PAGE_SCAN_TYPE          0x0c46
1325 struct bt_hci_rsp_read_page_scan_type {
1326         uint8_t status;
1327         uint8_t type;
1328 } __attribute__ ((packed));
1329
1330 #define BT_HCI_CMD_WRITE_PAGE_SCAN_TYPE         0x0c47
1331 struct bt_hci_cmd_write_page_scan_type {
1332         uint8_t type;
1333 } __attribute__ ((packed));
1334
1335 #define BT_HCI_CMD_READ_AFH_ASSESSMENT_MODE     0x0c48
1336 struct bt_hci_rsp_read_afh_assessment_mode {
1337         uint8_t  status;
1338         uint8_t  mode;
1339 } __attribute__ ((packed));
1340
1341 #define BT_HCI_CMD_WRITE_AFH_ASSESSMENT_MODE    0x0c49
1342 struct bt_hci_cmd_write_afh_assessment_mode {
1343         uint8_t  mode;
1344 } __attribute__ ((packed));
1345
1346 #define BT_HCI_CMD_READ_EXT_INQUIRY_RESPONSE    0x0c51
1347 struct bt_hci_rsp_read_ext_inquiry_response {
1348         uint8_t  status;
1349         uint8_t  fec;
1350         uint8_t  data[240];
1351 } __attribute__ ((packed));
1352
1353 #define BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE   0x0c52
1354 struct bt_hci_cmd_write_ext_inquiry_response {
1355         uint8_t  fec;
1356         uint8_t  data[240];
1357 } __attribute__ ((packed));
1358
1359 #define BT_HCI_CMD_REFRESH_ENCRYPT_KEY          0x0c53
1360 struct bt_hci_cmd_refresh_encrypt_key {
1361         uint16_t handle;
1362 } __attribute__ ((packed));
1363
1364 #define BT_HCI_CMD_READ_SIMPLE_PAIRING_MODE     0x0c55
1365 struct bt_hci_rsp_read_simple_pairing_mode {
1366         uint8_t  status;
1367         uint8_t  mode;
1368 } __attribute__ ((packed));
1369
1370 #define BT_HCI_CMD_WRITE_SIMPLE_PAIRING_MODE    0x0c56
1371 struct bt_hci_cmd_write_simple_pairing_mode {
1372         uint8_t  mode;
1373 } __attribute__ ((packed));
1374
1375 #define BT_HCI_CMD_READ_LOCAL_OOB_DATA          0x0c57
1376 struct bt_hci_rsp_read_local_oob_data {
1377         uint8_t  status;
1378         uint8_t  hash[16];
1379         uint8_t  randomizer[16];
1380 } __attribute__ ((packed));
1381
1382 #define BT_HCI_CMD_READ_INQUIRY_RESP_TX_POWER   0x0c58
1383 struct bt_hci_rsp_read_inquiry_resp_tx_power {
1384         uint8_t  status;
1385         int8_t   level;
1386 } __attribute__ ((packed));
1387
1388 #define BT_HCI_CMD_WRITE_INQUIRY_TX_POWER       0x0c59
1389 struct bt_hci_cmd_write_inquiry_tx_power {
1390         int8_t   level;
1391 } __attribute__ ((packed));
1392
1393 #define BT_HCI_CMD_READ_ERRONEOUS_REPORTING     0x0c5a
1394 struct bt_hci_rsp_read_erroneous_reporting {
1395         uint8_t  status;
1396         uint8_t  mode;
1397 } __attribute__ ((packed));
1398
1399 #define BT_HCI_CMD_WRITE_ERRONEOUS_REPORTING    0x0c5b
1400 struct bt_hci_cmd_write_erroneous_reporting {
1401         uint8_t  mode;
1402 } __attribute__ ((packed));
1403
1404 #define BT_HCI_CMD_ENHANCED_FLUSH               0x0c5f
1405 struct bt_hci_cmd_enhanced_flush {
1406         uint16_t handle;
1407         uint8_t  type;
1408 } __attribute__ ((packed));
1409
1410 #define BT_HCI_CMD_SEND_KEYPRESS_NOTIFY         0x0c60
1411 struct bt_hci_cmd_send_keypress_notify {
1412         uint8_t  bdaddr[6];
1413         uint8_t  type;
1414 } __attribute__ ((packed));
1415 struct bt_hci_rsp_send_keypress_notify {
1416         uint8_t  status;
1417         uint8_t  bdaddr[6];
1418 } __attribute__ ((packed));
1419
1420 #define BT_HCI_CMD_SET_EVENT_MASK_PAGE2         0x0c63
1421 struct bt_hci_cmd_set_event_mask_page2 {
1422         uint8_t  mask[8];
1423 } __attribute__ ((packed));
1424
1425 #define BT_HCI_CMD_READ_LOCATION_DATA           0x0c64
1426 struct bt_hci_rsp_read_location_data {
1427         uint8_t  status;
1428         uint8_t  domain_aware;
1429         uint8_t  domain[2];
1430         uint8_t  domain_options;
1431         uint8_t  options;
1432 } __attribute__ ((packed));
1433
1434 #define BT_HCI_CMD_WRITE_LOCATION_DATA          0x0c65
1435 struct bt_hci_cmd_write_location_data {
1436         uint8_t  domain_aware;
1437         uint8_t  domain[2];
1438         uint8_t  domain_options;
1439         uint8_t  options;
1440 } __attribute__ ((packed));
1441
1442 #define BT_HCI_CMD_READ_FLOW_CONTROL_MODE       0x0c66
1443 struct bt_hci_rsp_read_flow_control_mode {
1444         uint8_t  status;
1445         uint8_t  mode;
1446 } __attribute__ ((packed));
1447
1448 #define BT_HCI_CMD_WRITE_FLOW_CONTROL_MODE      0x0c67
1449 struct bt_hci_cmd_write_flow_control_mode {
1450         uint8_t  mode;
1451 } __attribute__ ((packed));
1452
1453 #define BT_HCI_CMD_READ_ENHANCED_TX_POWER       0x0c68
1454 struct bt_hci_cmd_read_enhanced_tx_power {
1455         uint16_t handle;
1456         uint8_t  type;
1457 } __attribute__ ((packed));
1458 struct bt_hci_rsp_read_enhanced_tx_power {
1459         uint8_t  status;
1460         uint16_t handle;
1461         int8_t   level_gfsk;
1462         int8_t   level_dqpsk;
1463         int8_t   level_8dpsk;
1464 } __attribute__ ((packed));
1465
1466 #define BT_HCI_CMD_SHORT_RANGE_MODE             0x0c6b
1467 struct bt_hci_cmd_short_range_mode {
1468         uint8_t  phy_handle;
1469         uint8_t  mode;
1470 } __attribute__ ((packed));
1471
1472 #define BT_HCI_CMD_READ_LE_HOST_SUPPORTED       0x0c6c
1473 struct bt_hci_rsp_read_le_host_supported {
1474         uint8_t  status;
1475         uint8_t  supported;
1476         uint8_t  simultaneous;
1477 } __attribute__ ((packed));
1478
1479 #define BT_HCI_CMD_WRITE_LE_HOST_SUPPORTED      0x0c6d
1480 struct bt_hci_cmd_write_le_host_supported {
1481         uint8_t  supported;
1482         uint8_t  simultaneous;
1483 } __attribute__ ((packed));
1484
1485 #define BT_HCI_CMD_SET_RESERVED_LT_ADDR         0x0c74
1486 struct bt_hci_cmd_set_reserved_lt_addr {
1487         uint8_t  lt_addr;
1488 } __attribute__ ((packed));
1489 struct bt_hci_rsp_set_reserved_lt_addr {
1490         uint8_t  status;
1491         uint8_t  lt_addr;
1492 } __attribute__ ((packed));
1493
1494 #define BT_HCI_CMD_DELETE_RESERVED_LT_ADDR      0x0c75
1495 struct bt_hci_cmd_delete_reserved_lt_addr {
1496         uint8_t  lt_addr;
1497 } __attribute__ ((packed));
1498 struct bt_hci_rsp_delete_reserved_lt_addr {
1499         uint8_t  status;
1500         uint8_t  lt_addr;
1501 } __attribute__ ((packed));
1502
1503 #define BT_HCI_CMD_SET_SLAVE_BROADCAST_DATA     0x0c76
1504 struct bt_hci_cmd_set_slave_broadcast_data {
1505         uint8_t  lt_addr;
1506         uint8_t  fragment;
1507         uint8_t  length;
1508 } __attribute__ ((packed));
1509 struct bt_hci_rsp_set_slave_broadcast_data {
1510         uint8_t  status;
1511         uint8_t  lt_addr;
1512 } __attribute__ ((packed));
1513
1514 #define BT_HCI_CMD_READ_SYNC_TRAIN_PARAMS       0x0c77
1515 struct bt_hci_rsp_read_sync_train_params {
1516         uint8_t  status;
1517         uint16_t interval;
1518         uint32_t timeout;
1519         uint8_t  service_data;
1520 } __attribute__ ((packed));
1521
1522 #define BT_HCI_CMD_WRITE_SYNC_TRAIN_PARAMS      0x0c78
1523 struct bt_hci_cmd_write_sync_train_params {
1524         uint16_t min_interval;
1525         uint16_t max_interval;
1526         uint32_t timeout;
1527         uint8_t  service_data;
1528 } __attribute__ ((packed));
1529 struct bt_hci_rsp_write_sync_train_params {
1530         uint8_t  status;
1531         uint16_t interval;
1532 } __attribute__ ((packed));
1533
1534 #define BT_HCI_CMD_READ_SECURE_CONN_SUPPORT     0x0c79
1535 struct bt_hci_rsp_read_secure_conn_support {
1536         uint8_t  status;
1537         uint8_t  support;
1538 } __attribute__ ((packed));
1539
1540 #define BT_HCI_CMD_WRITE_SECURE_CONN_SUPPORT    0x0c7a
1541 struct bt_hci_cmd_write_secure_conn_support {
1542         uint8_t support;
1543 } __attribute__ ((packed));
1544
1545 #define BT_HCI_CMD_READ_AUTH_PAYLOAD_TIMEOUT    0x0c7b
1546 struct bt_hci_cmd_read_auth_payload_timeout {
1547         uint16_t handle;
1548 } __attribute__ ((packed));
1549 struct bt_hci_rsp_read_auth_payload_timeout {
1550         uint8_t  status;
1551         uint16_t handle;
1552         uint16_t timeout;
1553 } __attribute__ ((packed));
1554
1555 #define BT_HCI_CMD_WRITE_AUTH_PAYLOAD_TIMEOUT   0x0c7c
1556 struct bt_hci_cmd_write_auth_payload_timeout {
1557         uint16_t handle;
1558         uint16_t timeout;
1559 } __attribute__ ((packed));
1560 struct bt_hci_rsp_write_auth_payload_timeout {
1561         uint8_t  status;
1562         uint16_t handle;
1563 } __attribute__ ((packed));
1564
1565 #define BT_HCI_CMD_READ_LOCAL_OOB_EXT_DATA      0x0c7d
1566 struct bt_hci_rsp_read_local_oob_ext_data {
1567         uint8_t  status;
1568         uint8_t  hash192[16];
1569         uint8_t  randomizer192[16];
1570         uint8_t  hash256[16];
1571         uint8_t  randomizer256[16];
1572 } __attribute__ ((packed));
1573
1574 #define BT_HCI_CMD_READ_EXT_PAGE_TIMEOUT        0x0c7e
1575 struct bt_hci_rsp_read_ext_page_timeout {
1576         uint8_t  status;
1577         uint16_t timeout;
1578 } __attribute__ ((packed));
1579
1580 #define BT_HCI_CMD_WRITE_EXT_PAGE_TIMEOUT       0x0c7f
1581 struct bt_hci_cmd_write_ext_page_timeout {
1582         uint16_t timeout;
1583 } __attribute__ ((packed));
1584
1585 #define BT_HCI_CMD_READ_EXT_INQUIRY_LENGTH      0x0c80
1586 struct bt_hci_rsp_read_ext_inquiry_length {
1587         uint8_t  status;
1588         uint16_t interval;
1589 } __attribute__ ((packed));
1590
1591 #define BT_HCI_CMD_WRITE_EXT_INQUIRY_LENGTH     0x0c81
1592 struct bt_hci_cmd_write_ext_inquiry_length {
1593         uint16_t interval;
1594 } __attribute__ ((packed));
1595
1596 #define BT_HCI_CMD_READ_LOCAL_VERSION           0x1001
1597 struct bt_hci_rsp_read_local_version {
1598         uint8_t  status;
1599         uint8_t  hci_ver;
1600         uint16_t hci_rev;
1601         uint8_t  lmp_ver;
1602         uint16_t manufacturer;
1603         uint16_t lmp_subver;
1604 } __attribute__ ((packed));
1605
1606 #define BT_HCI_CMD_READ_LOCAL_COMMANDS          0x1002
1607 struct bt_hci_rsp_read_local_commands {
1608         uint8_t  status;
1609         uint8_t  commands[64];
1610 } __attribute__ ((packed));
1611
1612 #define BT_HCI_CMD_READ_LOCAL_FEATURES          0x1003
1613 struct bt_hci_rsp_read_local_features {
1614         uint8_t  status;
1615         uint8_t  features[8];
1616 } __attribute__ ((packed));
1617
1618 #define BT_HCI_CMD_READ_LOCAL_EXT_FEATURES      0x1004
1619 struct bt_hci_cmd_read_local_ext_features {
1620         uint8_t  page;
1621 } __attribute__ ((packed));
1622 struct bt_hci_rsp_read_local_ext_features {
1623         uint8_t  status;
1624         uint8_t  page;
1625         uint8_t  max_page;
1626         uint8_t  features[8];
1627 } __attribute__ ((packed));
1628
1629 #define BT_HCI_CMD_READ_BUFFER_SIZE             0x1005
1630 struct bt_hci_rsp_read_buffer_size {
1631         uint8_t  status;
1632         uint16_t acl_mtu;
1633         uint8_t  sco_mtu;
1634         uint16_t acl_max_pkt;
1635         uint16_t sco_max_pkt;
1636 } __attribute__ ((packed));
1637
1638 #define BT_HCI_CMD_READ_COUNTRY_CODE            0x1007
1639 struct bt_hci_rsp_read_country_code {
1640         uint8_t  status;
1641         uint8_t  code;
1642 } __attribute__ ((packed));
1643
1644 #define BT_HCI_CMD_READ_BD_ADDR                 0x1009
1645 struct bt_hci_rsp_read_bd_addr {
1646         uint8_t  status;
1647         uint8_t  bdaddr[6];
1648 } __attribute__ ((packed));
1649
1650 #define BT_HCI_CMD_READ_DATA_BLOCK_SIZE         0x100a
1651 struct bt_hci_rsp_read_data_block_size {
1652         uint8_t  status;
1653         uint16_t max_acl_len;
1654         uint16_t block_len;
1655         uint16_t num_blocks;
1656 } __attribute__ ((packed));
1657
1658 #define BT_HCI_CMD_READ_LOCAL_CODECS            0x100b
1659 struct bt_hci_rsp_read_local_codecs {
1660         uint8_t  status;
1661         uint8_t  num_codecs;
1662         uint8_t  codec[0];
1663 } __attribute__ ((packed));
1664
1665 #define BT_HCI_CMD_READ_FAILED_CONTACT_COUNTER  0x1401
1666 struct bt_hci_cmd_read_failed_contact_counter {
1667         uint16_t handle;
1668 } __attribute__ ((packed));
1669 struct bt_hci_rsp_read_failed_contact_counter {
1670         uint8_t  status;
1671         uint16_t handle;
1672         uint16_t counter;
1673 } __attribute__ ((packed));
1674
1675 #define BT_HCI_CMD_RESET_FAILED_CONTACT_COUNTER 0x1402
1676 struct bt_hci_cmd_reset_failed_contact_counter {
1677         uint16_t handle;
1678 } __attribute__ ((packed));
1679 struct bt_hci_rsp_reset_failed_contact_counter {
1680         uint8_t  status;
1681         uint16_t handle;
1682 } __attribute__ ((packed));
1683
1684 #define BT_HCI_CMD_READ_LINK_QUALITY            0x1403
1685 struct bt_hci_cmd_read_link_quality {
1686         uint16_t handle;
1687 } __attribute__ ((packed));
1688 struct bt_hci_rsp_read_link_quality {
1689         uint8_t  status;
1690         uint16_t handle;
1691         uint8_t  link_quality;
1692 } __attribute__ ((packed));
1693
1694 #define BT_HCI_CMD_READ_RSSI                    0x1405
1695 struct bt_hci_cmd_read_rssi {
1696         uint16_t handle;
1697 } __attribute__ ((packed));
1698 struct bt_hci_rsp_read_rssi {
1699         uint8_t  status;
1700         uint16_t handle;
1701         int8_t   rssi;
1702 } __attribute__ ((packed));
1703
1704 #define BT_HCI_CMD_READ_AFH_CHANNEL_MAP         0x1406
1705 struct bt_hci_cmd_read_afh_channel_map {
1706         uint16_t handle;
1707 } __attribute__ ((packed));
1708 struct bt_hci_rsp_read_afh_channel_map {
1709         uint8_t  status;
1710         uint16_t handle;
1711         uint8_t  mode;
1712         uint8_t  map[10];
1713 } __attribute__ ((packed));
1714
1715 #define BT_HCI_CMD_READ_CLOCK                   0x1407
1716 struct bt_hci_cmd_read_clock {
1717         uint16_t handle;
1718         uint8_t  type;
1719 } __attribute__ ((packed));
1720 struct bt_hci_rsp_read_clock {
1721         uint8_t  status;
1722         uint16_t handle;
1723         uint32_t clock;
1724         uint16_t accuracy;
1725 } __attribute__ ((packed));
1726
1727 #define BT_HCI_CMD_READ_ENCRYPT_KEY_SIZE        0x1408
1728 struct bt_hci_cmd_read_encrypt_key_size {
1729         uint16_t handle;
1730 } __attribute__ ((packed));
1731 struct bt_hci_rsp_read_encrypt_key_size {
1732         uint8_t  status;
1733         uint16_t handle;
1734         uint8_t  key_size;
1735 } __attribute__ ((packed));
1736
1737 #define BT_HCI_CMD_READ_LOCAL_AMP_INFO          0x1409
1738 struct bt_hci_rsp_read_local_amp_info {
1739         uint8_t  status;
1740         uint8_t  amp_status;
1741         uint32_t total_bw;
1742         uint32_t max_bw;
1743         uint32_t min_latency;
1744         uint32_t max_pdu;
1745         uint8_t  amp_type;
1746         uint16_t pal_cap;
1747         uint16_t max_assoc_len;
1748         uint32_t max_flush_to;
1749         uint32_t be_flush_to;
1750 } __attribute__ ((packed));
1751
1752 #define BT_HCI_CMD_READ_LOCAL_AMP_ASSOC         0x140a
1753 struct bt_hci_cmd_read_local_amp_assoc {
1754         uint8_t  phy_handle;
1755         uint16_t len_so_far;
1756         uint16_t max_assoc_len;
1757 } __attribute__ ((packed));
1758 struct bt_hci_rsp_read_local_amp_assoc {
1759         uint8_t  status;
1760         uint8_t  phy_handle;
1761         uint16_t remain_assoc_len;
1762         uint8_t  assoc_fragment[248];
1763 } __attribute__ ((packed));
1764
1765 #define BT_HCI_CMD_WRITE_REMOTE_AMP_ASSOC       0x140b
1766 struct bt_hci_cmd_write_remote_amp_assoc {
1767         uint8_t  phy_handle;
1768         uint16_t len_so_far;
1769         uint16_t remain_assoc_len;
1770         uint8_t  assoc_fragment[248];
1771 } __attribute__ ((packed));
1772 struct bt_hci_rsp_write_remote_amp_assoc {
1773         uint8_t  status;
1774         uint8_t  phy_handle;
1775 } __attribute__ ((packed));
1776
1777 #define BT_HCI_CMD_GET_MWS_TRANSPORT_CONFIG     0x140c
1778 struct bt_hci_rsp_get_mws_transport_config {
1779         uint8_t  status;
1780         uint8_t  num_transports;
1781         uint8_t  transport[0];
1782 } __attribute__ ((packed));
1783
1784 #define BT_HCI_CMD_SET_TRIGGERED_CLOCK_CAPTURE  0x140d
1785 struct bt_hci_cmd_set_triggered_clock_capture {
1786         uint16_t handle;
1787         uint8_t  enable;
1788         uint8_t  type;
1789         uint8_t  lpo_allowed;
1790         uint8_t  num_filter;
1791 } __attribute__ ((packed));
1792
1793 #define BT_HCI_CMD_READ_LOOPBACK_MODE           0x1801
1794 struct bt_hci_rsp_read_loopback_mode {
1795         uint8_t  status;
1796         uint8_t  mode;
1797 } __attribute__ ((packed));
1798
1799 #define BT_HCI_CMD_WRITE_LOOPBACK_MODE          0x1802
1800 struct bt_hci_cmd_write_loopback_mode {
1801         uint8_t  mode;
1802 } __attribute__ ((packed));
1803
1804 #define BT_HCI_CMD_ENABLE_DUT_MODE              0x1803
1805
1806 #define BT_HCI_CMD_WRITE_SSP_DEBUG_MODE         0x1804
1807 struct bt_hci_cmd_write_ssp_debug_mode {
1808         uint8_t  mode;
1809 } __attribute__ ((packed));
1810
1811 #define BT_HCI_CMD_LE_SET_EVENT_MASK            0x2001
1812 struct bt_hci_cmd_le_set_event_mask {
1813         uint8_t  mask[8];
1814 } __attribute__ ((packed));
1815
1816 #define BT_HCI_CMD_LE_READ_BUFFER_SIZE          0x2002
1817 struct bt_hci_rsp_le_read_buffer_size {
1818         uint8_t  status;
1819         uint16_t le_mtu;
1820         uint8_t  le_max_pkt;
1821 } __attribute__ ((packed));
1822
1823 #define BT_HCI_CMD_LE_READ_LOCAL_FEATURES       0x2003
1824 struct bt_hci_rsp_le_read_local_features {
1825         uint8_t  status;
1826         uint8_t  features[8];
1827 } __attribute__ ((packed));
1828
1829 #define BT_HCI_CMD_LE_SET_RANDOM_ADDRESS        0x2005
1830 struct bt_hci_cmd_le_set_random_address {
1831         uint8_t  addr[6];
1832 } __attribute__ ((packed));
1833
1834 #define BT_HCI_CMD_LE_SET_ADV_PARAMETERS        0x2006
1835 struct bt_hci_cmd_le_set_adv_parameters {
1836         uint16_t min_interval;
1837         uint16_t max_interval;
1838         uint8_t  type;
1839         uint8_t  own_addr_type;
1840         uint8_t  direct_addr_type;
1841         uint8_t  direct_addr[6];
1842         uint8_t  channel_map;
1843         uint8_t  filter_policy;
1844 } __attribute__ ((packed));
1845
1846 #define BT_HCI_CMD_LE_READ_ADV_TX_POWER         0x2007
1847 struct bt_hci_rsp_le_read_adv_tx_power {
1848         uint8_t  status;
1849         int8_t   level;
1850 } __attribute__ ((packed));
1851
1852 #define BT_HCI_CMD_LE_SET_ADV_DATA              0x2008
1853 struct bt_hci_cmd_le_set_adv_data {
1854         uint8_t  len;
1855         uint8_t  data[31];
1856 } __attribute__ ((packed));
1857
1858 #define BT_HCI_CMD_LE_SET_SCAN_RSP_DATA         0x2009
1859 struct bt_hci_cmd_le_set_scan_rsp_data {
1860         uint8_t  len;
1861         uint8_t  data[31];
1862 } __attribute__ ((packed));
1863
1864 #define BT_HCI_CMD_LE_SET_ADV_ENABLE            0x200a
1865 struct bt_hci_cmd_le_set_adv_enable {
1866         uint8_t  enable;
1867 } __attribute__ ((packed));
1868
1869 #define BT_HCI_CMD_LE_SET_SCAN_PARAMETERS       0x200b
1870 struct bt_hci_cmd_le_set_scan_parameters {
1871         uint8_t  type;
1872         uint16_t interval;
1873         uint16_t window;
1874         uint8_t  own_addr_type;
1875         uint8_t  filter_policy;
1876 } __attribute__ ((packed));
1877
1878 #define BT_HCI_CMD_LE_SET_SCAN_ENABLE           0x200c
1879 struct bt_hci_cmd_le_set_scan_enable {
1880         uint8_t  enable;
1881         uint8_t  filter_dup;
1882 } __attribute__ ((packed));
1883
1884 #define BT_HCI_CMD_LE_CREATE_CONN               0x200d
1885 struct bt_hci_cmd_le_create_conn {
1886         uint16_t scan_interval;
1887         uint16_t scan_window;
1888         uint8_t  filter_policy;
1889         uint8_t  peer_addr_type;
1890         uint8_t  peer_addr[6];
1891         uint8_t  own_addr_type;
1892         uint16_t min_interval;
1893         uint16_t max_interval;
1894         uint16_t latency;
1895         uint16_t supv_timeout;
1896         uint16_t min_length;
1897         uint16_t max_length;
1898 } __attribute__ ((packed));
1899
1900 #define BT_HCI_CMD_LE_CREATE_CONN_CANCEL        0x200e
1901
1902 #define BT_HCI_CMD_LE_READ_WHITE_LIST_SIZE      0x200f
1903 struct bt_hci_rsp_le_read_white_list_size {
1904         uint8_t  status;
1905         uint8_t  size;
1906 } __attribute__ ((packed));
1907
1908 #define BT_HCI_CMD_LE_CLEAR_WHITE_LIST          0x2010
1909
1910 #define BT_HCI_CMD_LE_ADD_TO_WHITE_LIST         0x2011
1911 struct bt_hci_cmd_le_add_to_white_list {
1912         uint8_t  addr_type;
1913         uint8_t  addr[6];
1914 } __attribute__ ((packed));
1915
1916 #define BT_HCI_CMD_LE_REMOVE_FROM_WHITE_LIST    0x2012
1917 struct bt_hci_cmd_le_remove_from_white_list {
1918         uint8_t  addr_type;
1919         uint8_t  addr[6];
1920 } __attribute__ ((packed));
1921
1922 #define BT_HCI_CMD_LE_CONN_UPDATE               0x2013
1923 struct bt_hci_cmd_le_conn_update {
1924         uint16_t handle;
1925         uint16_t min_interval;
1926         uint16_t max_interval;
1927         uint16_t latency;
1928         uint16_t supv_timeout;
1929         uint16_t min_length;
1930         uint16_t max_length;
1931 } __attribute__ ((packed));
1932
1933 #define BT_HCI_CMD_LE_SET_HOST_CLASSIFICATION   0x2014
1934 struct bt_hci_cmd_le_set_host_classification {
1935         uint8_t  map[5];
1936 } __attribute__ ((packed));
1937
1938 #define BT_HCI_CMD_LE_READ_CHANNEL_MAP          0x2015
1939 struct bt_hci_cmd_le_read_channel_map {
1940         uint16_t handle;
1941 } __attribute__ ((packed));
1942 struct bt_hci_rsp_le_read_channel_map {
1943         uint8_t  status;
1944         uint16_t handle;
1945         uint8_t  map[5];
1946 } __attribute__ ((packed));
1947
1948 #define BT_HCI_CMD_LE_READ_REMOTE_FEATURES      0x2016
1949 struct bt_hci_cmd_le_read_remote_features {
1950         uint16_t handle;
1951 } __attribute__ ((packed));
1952
1953 #define BT_HCI_CMD_LE_ENCRYPT                   0x2017
1954 struct bt_hci_cmd_le_encrypt {
1955         uint8_t  key[16];
1956         uint8_t  plaintext[16];
1957 } __attribute__ ((packed));
1958 struct bt_hci_rsp_le_encrypt {
1959         uint8_t  status;
1960         uint8_t  data[16];
1961 } __attribute__ ((packed));
1962
1963 #define BT_HCI_CMD_LE_RAND                      0x2018
1964 struct bt_hci_rsp_le_rand {
1965         uint8_t  status;
1966         uint64_t number;
1967 } __attribute__ ((packed));
1968
1969 #define BT_HCI_CMD_LE_START_ENCRYPT             0x2019
1970 struct bt_hci_cmd_le_start_encrypt {
1971         uint16_t handle;
1972         uint64_t rand;
1973         uint16_t ediv;
1974         uint8_t  ltk[16];
1975 } __attribute__ ((packed));
1976
1977 #define BT_HCI_CMD_LE_LTK_REQ_REPLY             0x201a
1978 struct bt_hci_cmd_le_ltk_req_reply {
1979         uint16_t handle;
1980         uint8_t  ltk[16];
1981 } __attribute__ ((packed));
1982 struct bt_hci_rsp_le_ltk_req_reply {
1983         uint8_t  status;
1984         uint16_t handle;
1985 } __attribute__ ((packed));
1986
1987 #define BT_HCI_CMD_LE_LTK_REQ_NEG_REPLY         0x201b
1988 struct bt_hci_cmd_le_ltk_req_neg_reply {
1989         uint16_t handle;
1990 } __attribute__ ((packed));
1991 struct bt_hci_rsp_le_ltk_req_neg_reply {
1992         uint8_t  status;
1993         uint16_t handle;
1994 } __attribute__ ((packed));
1995
1996 #define BT_HCI_CMD_LE_READ_SUPPORTED_STATES     0x201c
1997 struct bt_hci_rsp_le_read_supported_states {
1998         uint8_t  status;
1999         uint8_t  states[8];
2000 } __attribute__ ((packed));
2001
2002 #define BT_HCI_CMD_LE_RECEIVER_TEST             0x201d
2003 struct bt_hci_cmd_le_receiver_test {
2004         uint8_t  frequency;
2005 } __attribute__ ((packed));
2006
2007 #define BT_HCI_CMD_LE_TRANSMITTER_TEST          0x201e
2008 struct bt_hci_cmd_le_transmitter_test {
2009         uint8_t  frequency;
2010         uint8_t  data_len;
2011         uint8_t  payload;
2012 } __attribute__ ((packed));
2013
2014 #define BT_HCI_CMD_LE_TEST_END                  0x201f
2015 struct bt_hci_rsp_le_test_end {
2016         uint8_t  status;
2017         uint16_t num_packets;
2018 } __attribute__ ((packed));
2019
2020 #define BT_HCI_CMD_LE_CONN_PARAM_REQ_REPLY      0x2020
2021 struct bt_hci_cmd_le_conn_param_req_reply {
2022         uint16_t handle;
2023         uint16_t min_interval;
2024         uint16_t max_interval;
2025         uint16_t latency;
2026         uint16_t supv_timeout;
2027         uint16_t min_length;
2028         uint16_t max_length;
2029 } __attribute__ ((packed));
2030 struct bt_hci_rsp_le_conn_param_req_reply {
2031         uint8_t  status;
2032         uint16_t handle;
2033 } __attribute__ ((packed));
2034
2035 #define BT_HCI_CMD_LE_CONN_PARAM_REQ_NEG_REPLY  0x2021
2036 struct bt_hci_cmd_le_conn_param_req_neg_reply {
2037         uint16_t handle;
2038         uint8_t  reason;
2039 } __attribute__ ((packed));
2040 struct bt_hci_rsp_le_conn_param_req_neg_reply {
2041         uint8_t  status;
2042         uint16_t handle;
2043 } __attribute__ ((packed));
2044
2045 #define BT_HCI_CMD_LE_SET_DATA_LENGTH           0x2022
2046 struct bt_hci_cmd_le_set_data_length {
2047         uint16_t handle;
2048         uint16_t tx_len;
2049         uint16_t tx_time;
2050 } __attribute__ ((packed));
2051 struct bt_hci_rsp_le_set_data_length {
2052         uint8_t  status;
2053         uint16_t handle;
2054 } __attribute__ ((packed));
2055
2056 #define BT_HCI_CMD_LE_READ_DEFAULT_DATA_LENGTH  0x2023
2057 struct bt_hci_rsp_le_read_default_data_length {
2058         uint8_t  status;
2059         uint16_t tx_len;
2060         uint16_t tx_time;
2061 } __attribute__ ((packed));
2062
2063 #define BT_HCI_CMD_LE_WRITE_DEFAULT_DATA_LENGTH 0x2024
2064 struct bt_hci_cmd_le_write_default_data_length {
2065         uint16_t tx_len;
2066         uint16_t tx_time;
2067 } __attribute__ ((packed));
2068
2069 #define BT_HCI_CMD_LE_READ_LOCAL_PK256          0x2025
2070
2071 #define BT_HCI_CMD_LE_GENERATE_DHKEY            0x2026
2072 struct bt_hci_cmd_le_generate_dhkey {
2073         uint8_t  remote_pk256[64];
2074 } __attribute__ ((packed));
2075
2076 #define BT_HCI_CMD_LE_ADD_TO_RESOLV_LIST        0x2027
2077 struct bt_hci_cmd_le_add_to_resolv_list {
2078         uint8_t  addr_type;
2079         uint8_t  addr[6];
2080         uint8_t  peer_irk[16];
2081         uint8_t  local_irk[16];
2082 } __attribute__ ((packed));
2083
2084 #define BT_HCI_CMD_LE_REMOVE_FROM_RESOLV_LIST   0x2028
2085 struct bt_hci_cmd_le_remove_from_resolv_list {
2086         uint8_t  addr_type;
2087         uint8_t  addr[6];
2088 } __attribute__ ((packed));
2089
2090 #define BT_HCI_CMD_LE_CLEAR_RESOLV_LIST         0x2029
2091
2092 #define BT_HCI_CMD_LE_READ_RESOLV_LIST_SIZE     0x202a
2093 struct bt_hci_rsp_le_read_resolv_list_size {
2094         uint8_t  status;
2095         uint8_t  size;
2096 } __attribute__ ((packed));
2097
2098 #define BT_HCI_CMD_LE_READ_PEER_RESOLV_ADDR     0x202b
2099 struct bt_hci_cmd_le_read_peer_resolv_addr {
2100         uint8_t  addr_type;
2101         uint8_t  addr[6];
2102 } __attribute__ ((packed));
2103 struct bt_hci_rsp_le_read_peer_resolv_addr {
2104         uint8_t  status;
2105         uint8_t  addr[6];
2106 } __attribute__ ((packed));
2107
2108 #define BT_HCI_CMD_LE_READ_LOCAL_RESOLV_ADDR    0x202c
2109 struct bt_hci_cmd_le_read_local_resolv_addr {
2110         uint8_t  addr_type;
2111         uint8_t  addr[6];
2112 } __attribute__ ((packed));
2113 struct bt_hci_rsp_le_read_local_resolv_addr {
2114         uint8_t  status;
2115         uint8_t  addr[6];
2116 } __attribute__ ((packed));
2117
2118 #define BT_HCI_CMD_LE_SET_RESOLV_ENABLE         0x202d
2119 struct bt_hci_cmd_le_set_resolv_enable {
2120         uint8_t  enable;
2121 } __attribute__ ((packed));
2122
2123 #define BT_HCI_CMD_LE_SET_RESOLV_TIMEOUT        0x202e
2124 struct bt_hci_cmd_le_set_resolv_timeout {
2125         uint16_t timeout;
2126 } __attribute__ ((packed));
2127
2128 #define BT_HCI_CMD_LE_READ_MAX_DATA_LENGTH      0x202f
2129 struct bt_hci_rsp_le_read_max_data_length {
2130         uint8_t  status;
2131         uint16_t max_tx_len;
2132         uint16_t max_tx_time;
2133         uint16_t max_rx_len;
2134         uint16_t max_rx_time;
2135 } __attribute__ ((packed));
2136
2137 #define BT_HCI_EVT_INQUIRY_COMPLETE             0x01
2138 struct bt_hci_evt_inquiry_complete {
2139         uint8_t  status;
2140 } __attribute__ ((packed));
2141
2142 #define BT_HCI_EVT_INQUIRY_RESULT               0x02
2143 struct bt_hci_evt_inquiry_result {
2144         uint8_t  num_resp;
2145         uint8_t  bdaddr[6];
2146         uint8_t  pscan_rep_mode;
2147         uint8_t  pscan_period_mode;
2148         uint8_t  pscan_mode;
2149         uint8_t  dev_class[3];
2150         uint16_t clock_offset;
2151 } __attribute__ ((packed));
2152
2153 #define BT_HCI_EVT_CONN_COMPLETE                0x03
2154 struct bt_hci_evt_conn_complete {
2155         uint8_t  status;
2156         uint16_t handle;
2157         uint8_t  bdaddr[6];
2158         uint8_t  link_type;
2159         uint8_t  encr_mode;
2160 } __attribute__ ((packed));
2161
2162 #define BT_HCI_EVT_CONN_REQUEST                 0x04
2163 struct bt_hci_evt_conn_request {
2164         uint8_t  bdaddr[6];
2165         uint8_t  dev_class[3];
2166         uint8_t  link_type;
2167 } __attribute__ ((packed));
2168
2169 #define BT_HCI_EVT_DISCONNECT_COMPLETE          0x05
2170 struct bt_hci_evt_disconnect_complete {
2171         uint8_t  status;
2172         uint16_t handle;
2173         uint8_t  reason;
2174 } __attribute__ ((packed));
2175
2176 #define BT_HCI_EVT_AUTH_COMPLETE                0x06
2177 struct bt_hci_evt_auth_complete {
2178         uint8_t  status;
2179         uint16_t handle;
2180 } __attribute__ ((packed));
2181
2182 #define BT_HCI_EVT_REMOTE_NAME_REQUEST_COMPLETE 0x07
2183 struct bt_hci_evt_remote_name_request_complete {
2184         uint8_t  status;
2185         uint8_t  bdaddr[6];
2186         uint8_t  name[248];
2187 } __attribute__ ((packed));
2188
2189 #define BT_HCI_EVT_ENCRYPT_CHANGE               0x08
2190 struct bt_hci_evt_encrypt_change {
2191         uint8_t  status;
2192         uint16_t handle;
2193         uint8_t  encr_mode;
2194 } __attribute__ ((packed));
2195
2196 #define BT_HCI_EVT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
2197 struct bt_hci_evt_change_conn_link_key_complete {
2198         uint8_t  status;
2199         uint16_t handle;
2200 } __attribute__ ((packed));
2201
2202 #define BT_HCI_EVT_MASTER_LINK_KEY_COMPLETE     0x0a
2203 struct bt_hci_evt_master_link_key_complete {
2204         uint8_t  status;
2205         uint16_t handle;
2206         uint8_t  key_flag;
2207 } __attribute__ ((packed));
2208
2209 #define BT_HCI_EVT_REMOTE_FEATURES_COMPLETE     0x0b
2210 struct bt_hci_evt_remote_features_complete {
2211         uint8_t  status;
2212         uint16_t handle;
2213         uint8_t  features[8];
2214 } __attribute__ ((packed));
2215
2216 #define BT_HCI_EVT_REMOTE_VERSION_COMPLETE      0x0c
2217 struct bt_hci_evt_remote_version_complete {
2218         uint8_t  status;
2219         uint16_t handle;
2220         uint8_t  lmp_ver;
2221         uint16_t manufacturer;
2222         uint16_t lmp_subver;
2223 } __attribute__ ((packed));
2224
2225 #define BT_HCI_EVT_QOS_SETUP_COMPLETE           0x0d
2226 struct bt_hci_evt_qos_setup_complete {
2227         uint8_t  status;
2228         uint16_t handle;
2229         uint8_t  flags;
2230         uint8_t  service_type;
2231         uint32_t token_rate;
2232         uint32_t peak_bandwidth;
2233         uint32_t latency;
2234         uint32_t delay_variation;
2235 } __attribute__ ((packed));
2236
2237 #define BT_HCI_EVT_CMD_COMPLETE                 0x0e
2238 struct bt_hci_evt_cmd_complete {
2239         uint8_t  ncmd;
2240         uint16_t opcode;
2241 } __attribute__ ((packed));
2242
2243 #define BT_HCI_EVT_CMD_STATUS                   0x0f
2244 struct bt_hci_evt_cmd_status {
2245         uint8_t  status;
2246         uint8_t  ncmd;
2247         uint16_t opcode;
2248 } __attribute__ ((packed));
2249
2250 #define BT_HCI_EVT_HARDWARE_ERROR               0x10
2251 struct bt_hci_evt_hardware_error {
2252         uint8_t  code;
2253 } __attribute__ ((packed));
2254
2255 #define BT_HCI_EVT_FLUSH_OCCURRED               0x11
2256 struct bt_hci_evt_flush_occurred {
2257         uint16_t handle;
2258 } __attribute__ ((packed));
2259
2260 #define BT_HCI_EVT_ROLE_CHANGE                  0x12
2261 struct bt_hci_evt_role_change {
2262         uint8_t  status;
2263         uint8_t  bdaddr[6];
2264         uint8_t  role;
2265 } __attribute__ ((packed));
2266
2267 #define BT_HCI_EVT_NUM_COMPLETED_PACKETS        0x13
2268 struct bt_hci_evt_num_completed_packets {
2269         uint8_t  num_handles;
2270         uint16_t handle;
2271         uint16_t count;
2272 } __attribute__ ((packed));
2273
2274 #define BT_HCI_EVT_MODE_CHANGE                  0x14
2275 struct bt_hci_evt_mode_change {
2276         uint8_t  status;
2277         uint16_t handle;
2278         uint8_t  mode;
2279         uint16_t interval;
2280 } __attribute__ ((packed));
2281
2282 #define BT_HCI_EVT_RETURN_LINK_KEYS             0x15
2283 struct bt_hci_evt_return_link_keys {
2284         uint8_t  num_keys;
2285         uint8_t  keys[0];
2286 } __attribute__ ((packed));
2287
2288 #define BT_HCI_EVT_PIN_CODE_REQUEST             0x16
2289 struct bt_hci_evt_pin_code_request {
2290         uint8_t  bdaddr[6];
2291 } __attribute__ ((packed));
2292
2293 #define BT_HCI_EVT_LINK_KEY_REQUEST             0x17
2294 struct bt_hci_evt_link_key_request {
2295         uint8_t  bdaddr[6];
2296 } __attribute__ ((packed));
2297
2298 #define BT_HCI_EVT_LINK_KEY_NOTIFY              0x18
2299 struct bt_hci_evt_link_key_notify {
2300         uint8_t  bdaddr[6];
2301         uint8_t  link_key[16];
2302         uint8_t  key_type;
2303 } __attribute__ ((packed));
2304
2305 #define BT_HCI_EVT_LOOPBACK_COMMAND             0x19
2306
2307 #define BT_HCI_EVT_DATA_BUFFER_OVERFLOW         0x1a
2308 struct bt_hci_evt_data_buffer_overflow {
2309         uint8_t  link_type;
2310 } __attribute__ ((packed));
2311
2312 #define BT_HCI_EVT_MAX_SLOTS_CHANGE             0x1b
2313 struct bt_hci_evt_max_slots_change {
2314         uint16_t handle;
2315         uint8_t  max_slots;
2316 } __attribute__ ((packed));
2317
2318 #define BT_HCI_EVT_CLOCK_OFFSET_COMPLETE        0x1c
2319 struct bt_hci_evt_clock_offset_complete {
2320         uint8_t  status;
2321         uint16_t handle;
2322         uint16_t clock_offset;
2323 } __attribute__ ((packed));
2324
2325 #define BT_HCI_EVT_CONN_PKT_TYPE_CHANGED        0x1d
2326 struct bt_hci_evt_conn_pkt_type_changed {
2327         uint8_t  status;
2328         uint16_t handle;
2329         uint16_t pkt_type;
2330 } __attribute__ ((packed));
2331
2332 #define BT_HCI_EVT_QOS_VIOLATION                0x1e
2333 struct bt_hci_evt_qos_violation {
2334         uint16_t handle;
2335 } __attribute__ ((packed));
2336
2337 #define BT_HCI_EVT_PSCAN_MODE_CHANGE            0x1f
2338 struct bt_hci_evt_pscan_mode_change {
2339         uint8_t  bdaddr[6];
2340         uint8_t  pscan_mode;
2341 } __attribute__ ((packed));
2342
2343 #define BT_HCI_EVT_PSCAN_REP_MODE_CHANGE        0x20
2344 struct bt_hci_evt_pscan_rep_mode_change {
2345         uint8_t  bdaddr[6];
2346         uint8_t  pscan_rep_mode;
2347 } __attribute__ ((packed));
2348
2349 #define BT_HCI_EVT_FLOW_SPEC_COMPLETE           0x21
2350 struct bt_hci_evt_flow_spec_complete {
2351         uint8_t  status;
2352         uint16_t handle;
2353         uint8_t  flags;
2354         uint8_t  direction;
2355         uint8_t  service_type;
2356         uint32_t token_rate;
2357         uint32_t token_bucket_size;
2358         uint32_t peak_bandwidth;
2359         uint32_t access_latency;
2360 } __attribute__ ((packed));
2361
2362 #define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI     0x22
2363 struct bt_hci_evt_inquiry_result_with_rssi {
2364         uint8_t  num_resp;
2365         uint8_t  bdaddr[6];
2366         uint8_t  pscan_rep_mode;
2367         uint8_t  pscan_period_mode;
2368         uint8_t  dev_class[3];
2369         uint16_t clock_offset;
2370         int8_t   rssi;
2371 } __attribute__ ((packed));
2372
2373 #define BT_HCI_EVT_REMOTE_EXT_FEATURES_COMPLETE 0x23
2374 struct bt_hci_evt_remote_ext_features_complete {
2375         uint8_t  status;
2376         uint16_t handle;
2377         uint8_t  page;
2378         uint8_t  max_page;
2379         uint8_t  features[8];
2380 } __attribute__ ((packed));
2381
2382 #define BT_HCI_EVT_SYNC_CONN_COMPLETE           0x2c
2383 struct bt_hci_evt_sync_conn_complete {
2384         uint8_t  status;
2385         uint16_t handle;
2386         uint8_t  bdaddr[6];
2387         uint8_t  link_type;
2388         uint8_t  tx_interval;
2389         uint8_t  retrans_window;
2390         uint16_t rx_pkt_len;
2391         uint16_t tx_pkt_len;
2392         uint8_t  air_mode;
2393 } __attribute__ ((packed));
2394
2395 #define BT_HCI_EVT_SYNC_CONN_CHANGED            0x2d
2396 struct bt_hci_evt_sync_conn_changed {
2397         uint8_t  status;
2398         uint16_t handle;
2399         uint8_t  tx_interval;
2400         uint8_t  retrans_window;
2401         uint16_t rx_pkt_len;
2402         uint16_t tx_pkt_len;
2403 } __attribute__ ((packed));
2404
2405 #define BT_HCI_EVT_SNIFF_SUBRATING              0x2e
2406 struct bt_hci_evt_sniff_subrating {
2407         uint8_t  status;
2408         uint16_t handle;
2409         uint16_t max_tx_latency;
2410         uint16_t max_rx_latency;
2411         uint16_t min_remote_timeout;
2412         uint16_t min_local_timeout;
2413 } __attribute__ ((packed));
2414
2415 #define BT_HCI_EVT_EXT_INQUIRY_RESULT           0x2f
2416 struct bt_hci_evt_ext_inquiry_result {
2417         uint8_t  num_resp;
2418         uint8_t  bdaddr[6];
2419         uint8_t  pscan_rep_mode;
2420         uint8_t  pscan_period_mode;
2421         uint8_t  dev_class[3];
2422         uint16_t clock_offset;
2423         int8_t   rssi;
2424         uint8_t  data[240];
2425 } __attribute__ ((packed));
2426
2427 #define BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE 0x30
2428 struct bt_hci_evt_encrypt_key_refresh_complete {
2429         uint8_t  status;
2430         uint16_t handle;
2431 } __attribute__ ((packed));
2432
2433 #define BT_HCI_EVT_IO_CAPABILITY_REQUEST        0x31
2434 struct bt_hci_evt_io_capability_request {
2435         uint8_t  bdaddr[6];
2436 } __attribute__ ((packed));
2437
2438 #define BT_HCI_EVT_IO_CAPABILITY_RESPONSE       0x32
2439 struct bt_hci_evt_io_capability_response {
2440         uint8_t  bdaddr[6];
2441         uint8_t  capability;
2442         uint8_t  oob_data;
2443         uint8_t  authentication;
2444 } __attribute__ ((packed));
2445
2446 #define BT_HCI_EVT_USER_CONFIRM_REQUEST         0x33
2447 struct bt_hci_evt_user_confirm_request {
2448         uint8_t  bdaddr[6];
2449         uint32_t passkey;
2450 } __attribute__ ((packed));
2451
2452 #define BT_HCI_EVT_USER_PASSKEY_REQUEST         0x34
2453 struct bt_hci_evt_user_passkey_request {
2454         uint8_t  bdaddr[6];
2455 } __attribute__ ((packed));
2456
2457 #define BT_HCI_EVT_REMOTE_OOB_DATA_REQUEST      0x35
2458 struct bt_hci_evt_remote_oob_data_request {
2459         uint8_t  bdaddr[6];
2460 } __attribute__ ((packed));
2461
2462 #define BT_HCI_EVT_SIMPLE_PAIRING_COMPLETE      0x36
2463 struct bt_hci_evt_simple_pairing_complete {
2464         uint8_t  status;
2465         uint8_t  bdaddr[6];
2466 } __attribute__ ((packed));
2467
2468 #define BT_HCI_EVT_LINK_SUPV_TIMEOUT_CHANGED    0x38
2469 struct bt_hci_evt_link_supv_timeout_changed {
2470         uint16_t handle;
2471         uint16_t timeout;
2472 } __attribute__ ((packed));
2473
2474 #define BT_HCI_EVT_ENHANCED_FLUSH_COMPLETE      0x39
2475 struct bt_hci_evt_enhanced_flush_complete {
2476         uint16_t handle;
2477 } __attribute__ ((packed));
2478
2479 #define BT_HCI_EVT_USER_PASSKEY_NOTIFY          0x3b
2480 struct bt_hci_evt_user_passkey_notify {
2481         uint8_t  bdaddr[6];
2482         uint32_t passkey;
2483 } __attribute__ ((packed));
2484
2485 #define BT_HCI_EVT_KEYPRESS_NOTIFY              0x3c
2486 struct bt_hci_evt_keypress_notify {
2487         uint8_t  bdaddr[6];
2488         uint8_t  type;
2489 } __attribute__ ((packed));
2490
2491 #define BT_HCI_EVT_REMOTE_HOST_FEATURES_NOTIFY  0x3d
2492 struct bt_hci_evt_remote_host_features_notify {
2493         uint8_t  bdaddr[6];
2494         uint8_t  features[8];
2495 } __attribute__ ((packed));
2496
2497 #define BT_HCI_EVT_LE_META_EVENT                0x3e
2498
2499 #define BT_HCI_EVT_PHY_LINK_COMPLETE            0x40
2500 struct bt_hci_evt_phy_link_complete {
2501         uint8_t  status;
2502         uint8_t  phy_handle;
2503 } __attribute__ ((packed));
2504
2505 #define BT_HCI_EVT_CHANNEL_SELECTED             0x41
2506 struct bt_hci_evt_channel_selected {
2507         uint8_t  phy_handle;
2508 } __attribute__ ((packed));
2509
2510 #define BT_HCI_EVT_DISCONN_PHY_LINK_COMPLETE    0x42
2511 struct bt_hci_evt_disconn_phy_link_complete {
2512         uint8_t  status;
2513         uint8_t  phy_handle;
2514         uint8_t  reason;
2515 } __attribute__ ((packed));
2516
2517 #define BT_HCI_EVT_PHY_LINK_LOSS_EARLY_WARNING  0x43
2518 struct bt_hci_evt_phy_link_loss_early_warning {
2519         uint8_t  phy_handle;
2520         uint8_t  reason;
2521 } __attribute__ ((packed));
2522
2523 #define BT_HCI_EVT_PHY_LINK_RECOVERY            0x44
2524 struct bt_hci_evt_phy_link_recovery {
2525         uint8_t  phy_handle;
2526 } __attribute__ ((packed));
2527
2528 #define BT_HCI_EVT_LOGIC_LINK_COMPLETE          0x45
2529 struct bt_hci_evt_logic_link_complete {
2530         uint8_t  status;
2531         uint16_t handle;
2532         uint8_t  phy_handle;
2533         uint8_t  flow_spec;
2534 } __attribute__ ((packed));
2535
2536 #define BT_HCI_EVT_DISCONN_LOGIC_LINK_COMPLETE  0x46
2537 struct bt_hci_evt_disconn_logic_link_complete {
2538         uint8_t  status;
2539         uint16_t handle;
2540         uint8_t  reason;
2541 } __attribute__ ((packed));
2542
2543 #define BT_HCI_EVT_FLOW_SPEC_MODIFY_COMPLETE    0x47
2544 struct bt_hci_evt_flow_spec_modify_complete {
2545         uint8_t  status;
2546         uint16_t handle;
2547 } __attribute__ ((packed));
2548
2549 #define BT_HCI_EVT_NUM_COMPLETED_DATA_BLOCKS    0x48
2550 struct bt_hci_evt_num_completed_data_blocks {
2551         uint16_t total_num_blocks;
2552         uint8_t  num_handles;
2553         uint16_t handle;
2554         uint16_t num_packets;
2555         uint16_t num_blocks;
2556 } __attribute__ ((packed));
2557
2558 #define BT_HCI_EVT_SHORT_RANGE_MODE_CHANGE      0x4c
2559 struct bt_hci_evt_short_range_mode_change {
2560         uint8_t  status;
2561         uint8_t  phy_handle;
2562         uint8_t  mode;
2563 } __attribute__ ((packed));
2564
2565 #define BT_HCI_EVT_AMP_STATUS_CHANGE            0x4d
2566 struct bt_hci_evt_amp_status_change {
2567         uint8_t  status;
2568         uint8_t  amp_status;
2569 } __attribute__ ((packed));
2570
2571 #define BT_HCI_EVT_TRIGGERED_CLOCK_CAPTURE      0x4e
2572 struct bt_hci_evt_triggered_clock_capture {
2573         uint16_t handle;
2574         uint8_t  type;
2575         uint32_t clock;
2576         uint16_t clock_offset;
2577 } __attribute__ ((packed));
2578
2579 #define BT_HCI_EVT_SYNC_TRAIN_COMPLETE          0x4f
2580 struct bt_hci_evt_sync_train_complete {
2581         uint8_t  status;
2582 } __attribute__ ((packed));
2583
2584 #define BT_HCI_EVT_SYNC_TRAIN_RECEIVED          0x50
2585 struct bt_hci_evt_sync_train_received {
2586         uint8_t  status;
2587         uint8_t  bdaddr[6];
2588         uint32_t offset;
2589         uint8_t  map[10];
2590         uint8_t  lt_addr;
2591         uint32_t instant;
2592         uint16_t interval;
2593         uint8_t  service_data;
2594 } __attribute__ ((packed));
2595
2596 #define BT_HCI_EVT_SLAVE_BROADCAST_RECEIVE      0x51
2597 struct bt_hci_evt_slave_broadcast_receive {
2598         uint8_t  bdaddr[6];
2599         uint8_t  lt_addr;
2600         uint32_t clock;
2601         uint32_t offset;
2602         uint8_t  status;
2603         uint8_t  fragment;
2604         uint8_t  length;
2605 } __attribute__ ((packed));
2606
2607 #define BT_HCI_EVT_SLAVE_BROADCAST_TIMEOUT      0x52
2608 struct bt_hci_evt_slave_broadcast_timeout {
2609         uint8_t  bdaddr[6];
2610         uint8_t  lt_addr;
2611 } __attribute__ ((packed));
2612
2613 #define BT_HCI_EVT_TRUNCATED_PAGE_COMPLETE      0x53
2614 struct bt_hci_evt_truncated_page_complete {
2615         uint8_t  status;
2616         uint8_t  bdaddr[6];
2617 } __attribute__ ((packed));
2618
2619 #define BT_HCI_EVT_SLAVE_PAGE_RESPONSE_TIMEOUT  0x54
2620
2621 #define BT_HCI_EVT_SLAVE_BROADCAST_CHANNEL_MAP_CHANGE   0x55
2622 struct bt_hci_evt_slave_broadcast_channel_map_change {
2623         uint8_t  map[10];
2624 } __attribute__ ((packed));
2625
2626 #define BT_HCI_EVT_INQUIRY_RESPONSE_NOTIFY      0x56
2627 struct bt_hci_evt_inquiry_response_notify {
2628         uint8_t  lap[3];
2629         int8_t   rssi;
2630 } __attribute__ ((packed));
2631
2632 #define BT_HCI_EVT_AUTH_PAYLOAD_TIMEOUT_EXPIRED 0x57
2633 struct bt_hci_evt_auth_payload_timeout_expired {
2634         uint16_t handle;
2635 } __attribute__ ((packed));
2636
2637 #define BT_HCI_EVT_LE_CONN_COMPLETE             0x01
2638 struct bt_hci_evt_le_conn_complete {
2639         uint8_t  status;
2640         uint16_t handle;
2641         uint8_t  role;
2642         uint8_t  peer_addr_type;
2643         uint8_t  peer_addr[6];
2644         uint16_t interval;
2645         uint16_t latency;
2646         uint16_t supv_timeout;
2647         uint8_t  clock_accuracy;
2648 } __attribute__ ((packed));
2649
2650 #define BT_HCI_EVT_LE_ADV_REPORT                0x02
2651 struct bt_hci_evt_le_adv_report {
2652         uint8_t  num_reports;
2653         uint8_t  event_type;
2654         uint8_t  addr_type;
2655         uint8_t  addr[6];
2656         uint8_t  data_len;
2657         uint8_t  data[0];
2658 } __attribute__ ((packed));
2659
2660 #define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE      0x03
2661 struct bt_hci_evt_le_conn_update_complete {
2662         uint8_t  status;
2663         uint16_t handle;
2664         uint16_t interval;
2665         uint16_t latency;
2666         uint16_t supv_timeout;
2667 } __attribute__ ((packed));
2668
2669 #define BT_HCI_EVT_LE_REMOTE_FEATURES_COMPLETE  0x04
2670 struct bt_hci_evt_le_remote_features_complete {
2671         uint8_t  status;
2672         uint16_t handle;
2673         uint8_t  features[8];
2674 } __attribute__ ((packed));
2675
2676 #define BT_HCI_EVT_LE_LONG_TERM_KEY_REQUEST     0x05
2677 struct bt_hci_evt_le_long_term_key_request {
2678         uint16_t handle;
2679         uint64_t rand;
2680         uint16_t ediv;
2681 } __attribute__ ((packed));
2682
2683 #define BT_HCI_EVT_LE_CONN_PARAM_REQUEST        0x06
2684 struct bt_hci_evt_le_conn_param_request {
2685         uint16_t handle;
2686         uint16_t min_interval;
2687         uint16_t max_interval;
2688         uint16_t latency;
2689         uint16_t supv_timeout;
2690 } __attribute__ ((packed));
2691
2692 #define BT_HCI_EVT_LE_DATA_LENGTH_CHANGE        0x07
2693 struct bt_hci_evt_le_data_length_change {
2694         uint16_t handle;
2695         uint16_t max_tx_len;
2696         uint16_t max_tx_time;
2697         uint16_t max_rx_len;
2698         uint16_t max_rx_time;
2699 } __attribute__ ((packed));
2700
2701 #define BT_HCI_EVT_LE_READ_LOCAL_PK256_COMPLETE 0x08
2702 struct bt_hci_evt_le_read_local_pk256_complete {
2703         uint8_t  status;
2704         uint8_t  local_pk256[64];
2705 } __attribute__ ((packed));
2706
2707 #define BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE   0x09
2708 struct bt_hci_evt_le_generate_dhkey_complete {
2709         uint8_t  status;
2710         uint8_t  dhkey[32];
2711 } __attribute__ ((packed));
2712
2713 #define BT_HCI_EVT_LE_ENHANCED_CONN_COMPLETE    0x0a
2714 struct bt_hci_evt_le_enhanced_conn_complete {
2715         uint8_t  status;
2716         uint16_t handle;
2717         uint8_t  role;
2718         uint8_t  peer_addr_type;
2719         uint8_t  peer_addr[6];
2720         uint8_t  local_rpa[6];
2721         uint8_t  peer_rpa[6];
2722         uint16_t interval;
2723         uint16_t latency;
2724         uint16_t supv_timeout;
2725         uint8_t  clock_accuracy;
2726 } __attribute__ ((packed));
2727
2728 #define BT_HCI_EVT_LE_DIRECT_ADV_REPORT         0x0b
2729 struct bt_hci_evt_le_direct_adv_report {
2730         uint8_t  num_reports;
2731         uint8_t  event_type;
2732         uint8_t  addr_type;
2733         uint8_t  addr[6];
2734         uint8_t  direct_addr_type;
2735         uint8_t  direct_addr[6];
2736         int8_t   rssi;
2737 } __attribute__ ((packed));
2738
2739 #define BT_HCI_ERR_SUCCESS                      0x00
2740 #define BT_HCI_ERR_UNKNOWN_COMMAND              0x01
2741 #define BT_HCI_ERR_UNKNOWN_CONN_ID              0x02
2742 #define BT_HCI_ERR_HARDWARE_FAILURE             0x03
2743 #define BT_HCI_ERR_PAGE_TIMEOUT                 0x04
2744 #define BT_HCI_ERR_AUTH_FAILURE                 0x05
2745 #define BT_HCI_ERR_PIN_OR_KEY_MISSING           0x06
2746 #define BT_HCI_ERR_MEM_CAPACITY_EXCEEDED        0x07
2747 #define BT_HCI_ERR_COMMAND_DISALLOWED           0x0c
2748 #define BT_HCI_ERR_UNSUPPORTED_FEATURE          0x11
2749 #define BT_HCI_ERR_INVALID_PARAMETERS           0x12
2750 #define BT_HCI_ERR_UNSPECIFIED_ERROR            0x1f
2751 #define BT_HCI_ERR_CONN_FAILED_TO_ESTABLISH     0x3e
2752
2753 struct bt_l2cap_hdr {
2754         uint16_t len;
2755         uint16_t cid;
2756 } __attribute__ ((packed));
2757
2758 struct bt_l2cap_hdr_sig {
2759         uint8_t  code;
2760         uint8_t  ident;
2761         uint16_t len;
2762 } __attribute__ ((packed));
2763
2764 #define BT_L2CAP_PDU_CMD_REJECT         0x01
2765 struct bt_l2cap_pdu_cmd_reject {
2766         uint16_t reason;
2767 } __attribute__ ((packed));
2768
2769 #define BT_L2CAP_PDU_CONN_REQ           0x02
2770 struct bt_l2cap_pdu_conn_req {
2771         uint16_t psm;
2772         uint16_t scid;
2773 } __attribute__ ((packed));
2774
2775 #define BT_L2CAP_PDU_CONN_RSP           0x03
2776 struct bt_l2cap_pdu_conn_rsp {
2777         uint16_t dcid;
2778         uint16_t scid;
2779         uint16_t result;
2780         uint16_t status;
2781 } __attribute__ ((packed));
2782
2783 #define BT_L2CAP_PDU_CONFIG_REQ         0x04
2784 struct bt_l2cap_pdu_config_req {
2785         uint16_t dcid;
2786         uint16_t flags;
2787 } __attribute__ ((packed));
2788
2789 #define BT_L2CAP_PDU_CONFIG_RSP         0x05
2790 struct bt_l2cap_pdu_config_rsp {
2791         uint16_t scid;
2792         uint16_t flags;
2793         uint16_t result;
2794 } __attribute__ ((packed));
2795
2796 #define BT_L2CAP_PDU_DISCONN_REQ        0x06
2797 struct bt_l2cap_pdu_disconn_req {
2798         uint16_t dcid;
2799         uint16_t scid;
2800 } __attribute__ ((packed));
2801
2802 #define BT_L2CAP_PDU_DISCONN_RSP        0x07
2803 struct bt_l2cap_pdu_disconn_rsp {
2804         uint16_t dcid;
2805         uint16_t scid;
2806 } __attribute__ ((packed));
2807
2808 #define BT_L2CAP_PDU_ECHO_REQ           0x08
2809
2810 #define BT_L2CAP_PDU_ECHO_RSP           0x09
2811
2812 #define BT_L2CAP_PDU_INFO_REQ           0x0a
2813 struct bt_l2cap_pdu_info_req {
2814         uint16_t type;
2815 } __attribute__ ((packed));
2816
2817 #define BT_L2CAP_PDU_INFO_RSP           0x0b
2818 struct bt_l2cap_pdu_info_rsp {
2819         uint16_t type;
2820         uint16_t result;
2821         uint8_t  data[0];
2822 } __attribute__ ((packed));
2823
2824 #define BT_L2CAP_PDU_CREATE_CHAN_REQ    0x0c
2825 struct bt_l2cap_pdu_create_chan_req {
2826         uint16_t psm;
2827         uint16_t scid;
2828         uint8_t  ctrlid;
2829 } __attribute__ ((packed));
2830
2831 #define BT_L2CAP_PDU_CREATE_CHAN_RSP    0x0d
2832 struct bt_l2cap_pdu_create_chan_rsp {
2833         uint16_t dcid;
2834         uint16_t scid;
2835         uint16_t result;
2836         uint16_t status;
2837 } __attribute__ ((packed));
2838
2839 #define BT_L2CAP_PDU_MOVE_CHAN_REQ      0x0e
2840 struct bt_l2cap_pdu_move_chan_req {
2841         uint16_t icid;
2842         uint8_t  ctrlid;
2843 } __attribute__ ((packed));
2844
2845 #define BT_L2CAP_PDU_MOVE_CHAN_RSP      0x0f
2846 struct bt_l2cap_pdu_move_chan_rsp {
2847         uint16_t icid;
2848         uint16_t result;
2849 } __attribute__ ((packed));
2850
2851 #define BT_L2CAP_PDU_MOVE_CHAN_CFM      0x10
2852 struct bt_l2cap_pdu_move_chan_cfm {
2853         uint16_t icid;
2854         uint16_t result;
2855 } __attribute__ ((packed));
2856
2857 #define BT_L2CAP_PDU_MOVE_CHAN_CFM_RSP  0x11
2858 struct bt_l2cap_pdu_move_chan_cfm_rsp {
2859         uint16_t icid;
2860 } __attribute__ ((packed));
2861
2862 #define BT_L2CAP_PDU_CONN_PARAM_REQ     0x12
2863 struct bt_l2cap_pdu_conn_param_req {
2864         uint16_t min_interval;
2865         uint16_t max_interval;
2866         uint16_t latency;
2867         uint16_t timeout;
2868 } __attribute__ ((packed));
2869
2870 #define BT_L2CAP_PDU_CONN_PARAM_RSP     0x13
2871 struct bt_l2cap_pdu_conn_param_rsp {
2872         uint16_t result;
2873 } __attribute__ ((packed));
2874
2875 #define BT_L2CAP_PDU_LE_CONN_REQ        0x14
2876 struct bt_l2cap_pdu_le_conn_req {
2877         uint16_t psm;
2878         uint16_t scid;
2879         uint16_t mtu;
2880         uint16_t mps;
2881         uint16_t credits;
2882 } __attribute__ ((packed));
2883
2884 #define BT_L2CAP_PDU_LE_CONN_RSP        0x15
2885 struct bt_l2cap_pdu_le_conn_rsp {
2886         uint16_t dcid;
2887         uint16_t mtu;
2888         uint16_t mps;
2889         uint16_t credits;
2890         uint16_t result;
2891 } __attribute__ ((packed));
2892
2893 #define BT_L2CAP_PDU_LE_FLOWCTL_CREDS   0x16
2894 struct bt_l2cap_pdu_le_flowctl_creds {
2895         uint16_t cid;
2896         uint16_t credits;
2897 } __attribute__ ((packed));
2898
2899 struct bt_l2cap_hdr_connless {
2900         uint16_t psm;
2901 } __attribute__ ((packed));
2902
2903 struct bt_l2cap_hdr_amp {
2904         uint8_t  code;
2905         uint8_t  ident;
2906         uint16_t len;
2907 } __attribute__ ((packed));
2908
2909 #define BT_L2CAP_AMP_CMD_REJECT         0x01
2910 struct bt_l2cap_amp_cmd_reject {
2911         uint16_t reason;
2912 } __attribute__ ((packed));
2913
2914 #define BT_L2CAP_AMP_DISCOVER_REQ       0x02
2915 struct bt_l2cap_amp_discover_req {
2916         uint16_t size;
2917         uint16_t features;
2918 } __attribute__ ((packed));
2919
2920 #define BT_L2CAP_AMP_DISCOVER_RSP       0x03
2921 struct bt_l2cap_amp_discover_rsp {
2922         uint16_t size;
2923         uint16_t features;
2924 } __attribute__ ((packed));
2925
2926 #define BT_L2CAP_AMP_CHANGE_NOTIFY      0x04
2927
2928 #define BT_L2CAP_AMP_CHANGE_RESPONSE    0x05
2929
2930 #define BT_L2CAP_AMP_GET_INFO_REQ       0x06
2931 struct bt_l2cap_amp_get_info_req {
2932         uint8_t  ctrlid;
2933 } __attribute__ ((packed));
2934
2935 #define BT_L2CAP_AMP_GET_INFO_RSP       0x07
2936 struct bt_l2cap_amp_get_info_rsp {
2937         uint8_t  ctrlid;
2938         uint8_t  status;
2939         uint32_t total_bw;
2940         uint32_t max_bw;
2941         uint32_t min_latency;
2942         uint16_t pal_cap;
2943         uint16_t max_assoc_len;
2944 } __attribute__ ((packed));
2945
2946 #define BT_L2CAP_AMP_GET_ASSOC_REQ      0x08
2947 struct bt_l2cap_amp_get_assoc_req {
2948         uint8_t  ctrlid;
2949 } __attribute__ ((packed));
2950
2951 #define BT_L2CAP_AMP_GET_ASSOC_RSP      0x09
2952 struct bt_l2cap_amp_get_assoc_rsp {
2953         uint8_t  ctrlid;
2954         uint8_t  status;
2955 } __attribute__ ((packed));
2956
2957 #define BT_L2CAP_AMP_CREATE_PHY_LINK_REQ        0x0a
2958 struct bt_l2cap_amp_create_phy_link_req {
2959         uint8_t  local_ctrlid;
2960         uint8_t  remote_ctrlid;
2961 } __attribute__ ((packed));
2962
2963 #define BT_L2CAP_AMP_CREATE_PHY_LINK_RSP        0x0b
2964 struct bt_l2cap_amp_create_phy_link_rsp {
2965         uint8_t  local_ctrlid;
2966         uint8_t  remote_ctrlid;
2967         uint8_t  status;
2968 } __attribute__ ((packed));
2969
2970 #define BT_L2CAP_AMP_DISCONN_PHY_LINK_REQ       0x0c
2971 struct bt_l2cap_amp_disconn_phy_link_req {
2972         uint8_t  local_ctrlid;
2973         uint8_t  remote_ctrlid;
2974 } __attribute__ ((packed));
2975
2976 #define BT_L2CAP_AMP_DISCONN_PHY_LINK_RSP       0x0d
2977 struct bt_l2cap_amp_disconn_phy_link_rsp {
2978         uint8_t  local_ctrlid;
2979         uint8_t  remote_ctrlid;
2980         uint8_t  status;
2981 } __attribute__ ((packed));
2982
2983 struct bt_l2cap_hdr_att {
2984         uint8_t  code;
2985 } __attribute__ ((packed));
2986
2987 #define BT_L2CAP_ATT_ERROR_RESPONSE             0x01
2988 struct bt_l2cap_att_error_response {
2989         uint8_t  request;
2990         uint16_t handle;
2991         uint8_t  error;
2992 } __attribute__ ((packed));
2993
2994 #define BT_L2CAP_ATT_EXCHANGE_MTU_REQ           0x02
2995 struct bt_l2cap_att_exchange_mtu_req {
2996         uint16_t mtu;
2997 } __attribute__ ((packed));
2998
2999 #define BT_L2CAP_ATT_EXCHANGE_MTU_RSP           0x03
3000 struct bt_l2cap_att_exchange_mtu_rsp {
3001         uint16_t mtu;
3002 } __attribute__ ((packed));
3003
3004 #define BT_L2CAP_ATT_READ_TYPE_REQ              0x08
3005 struct bt_l2cap_att_read_type_req {
3006         uint16_t start_handle;
3007         uint16_t end_handle;
3008 } __attribute__ ((packed));
3009
3010 #define BT_L2CAP_ATT_READ_TYPE_RSP              0x09
3011 struct bt_l2cap_att_read_type_rsp {
3012         uint8_t  length;
3013 } __attribute__ ((packed));
3014
3015 #define BT_L2CAP_ATT_READ_REQ                   0x0a
3016 struct bt_l2cap_att_read_req {
3017         uint16_t handle;
3018 } __attribute__ ((packed));
3019
3020 #define BT_L2CAP_ATT_READ_RSP                   0x0b
3021
3022 #define BT_L2CAP_ATT_READ_GROUP_TYPE_REQ        0x10
3023 struct bt_l2cap_att_read_group_type_req {
3024         uint16_t start_handle;
3025         uint16_t end_handle;
3026 } __attribute__ ((packed));
3027
3028 #define BT_L2CAP_ATT_READ_GROUP_TYPE_RSP        0x11
3029 struct bt_l2cap_att_read_group_type_rsp {
3030         uint8_t  length;
3031 } __attribute__ ((packed));
3032
3033 #define BT_L2CAP_ATT_HANDLE_VALUE_NOTIFY        0x1b
3034 struct bt_l2cap_att_handle_value_notify {
3035         uint16_t handle;
3036 } __attribute__ ((packed));
3037
3038 #define BT_L2CAP_ATT_HANDLE_VALUE_IND           0x1d
3039 struct bt_l2cap_att_handle_value_ind {
3040         uint16_t handle;
3041 } __attribute__ ((packed));
3042
3043 #define BT_L2CAP_ATT_HANDLE_VALUE_CONF          0x1e
3044
3045 struct bt_l2cap_hdr_smp {
3046         uint8_t  code;
3047 } __attribute__ ((packed));
3048
3049 #define BT_L2CAP_SMP_PAIRING_REQUEST    0x01
3050 struct bt_l2cap_smp_pairing_request {
3051         uint8_t  io_capa;
3052         uint8_t  oob_data;
3053         uint8_t  auth_req;
3054         uint8_t  max_key_size;
3055         uint8_t  init_key_dist;
3056         uint8_t  resp_key_dist;
3057 } __attribute__ ((packed));
3058
3059 #define BT_L2CAP_SMP_PAIRING_RESPONSE   0x02
3060 struct bt_l2cap_smp_pairing_response {
3061         uint8_t  io_capa;
3062         uint8_t  oob_data;
3063         uint8_t  auth_req;
3064         uint8_t  max_key_size;
3065         uint8_t  init_key_dist;
3066         uint8_t  resp_key_dist;
3067 } __attribute__ ((packed));
3068
3069 #define BT_L2CAP_SMP_PAIRING_CONFIRM    0x03
3070 struct bt_l2cap_smp_pairing_confirm {
3071         uint8_t  value[16];
3072 } __attribute__ ((packed));
3073
3074 #define BT_L2CAP_SMP_PAIRING_RANDOM     0x04
3075 struct bt_l2cap_smp_pairing_random {
3076         uint8_t  value[16];
3077 } __attribute__ ((packed));
3078
3079 #define BT_L2CAP_SMP_PAIRING_FAILED     0x05
3080 struct bt_l2cap_smp_pairing_failed {
3081         uint8_t  reason;
3082 } __attribute__ ((packed));
3083
3084 #define BT_L2CAP_SMP_ENCRYPT_INFO       0x06
3085 struct bt_l2cap_smp_encrypt_info {
3086         uint8_t  ltk[16];
3087 } __attribute__ ((packed));
3088
3089 #define BT_L2CAP_SMP_MASTER_IDENT       0x07
3090 struct bt_l2cap_smp_master_ident {
3091         uint16_t ediv;
3092         uint64_t rand;
3093 } __attribute__ ((packed));
3094
3095 #define BT_L2CAP_SMP_IDENT_INFO         0x08
3096 struct bt_l2cap_smp_ident_info {
3097         uint8_t  irk[16];
3098 } __attribute__ ((packed));
3099
3100 #define BT_L2CAP_SMP_IDENT_ADDR_INFO    0x09
3101 struct bt_l2cap_smp_ident_addr_info {
3102         uint8_t  addr_type;
3103         uint8_t  addr[6];
3104 } __attribute__ ((packed));
3105
3106 #define BT_L2CAP_SMP_SIGNING_INFO       0x0a
3107 struct bt_l2cap_smp_signing_info {
3108         uint8_t  csrk[16];
3109 } __attribute__ ((packed));
3110
3111 #define BT_L2CAP_SMP_SECURITY_REQUEST   0x0b
3112 struct bt_l2cap_smp_security_request {
3113         uint8_t  auth_req;
3114 } __attribute__ ((packed));
3115
3116 #define BT_L2CAP_SMP_PUBLIC_KEY         0x0c
3117 struct bt_l2cap_smp_public_key {
3118         uint8_t  x[32];
3119         uint8_t  y[32];
3120 } __attribute__ ((packed));
3121
3122 #define BT_L2CAP_SMP_DHKEY_CHECK        0x0d
3123 struct bt_l2cap_smp_dhkey_check {
3124         uint8_t  e[16];
3125 } __attribute__ ((packed));
3126
3127 #define BT_L2CAP_SMP_KEYPRESS_NOTIFY    0x0e
3128 struct bt_l2cap_smp_keypress_notify {
3129         uint8_t  type;
3130 } __attribute__ ((packed));
3131
3132 struct bt_sdp_hdr {
3133         uint8_t  pdu;
3134         uint16_t tid;
3135         uint16_t plen;
3136 } __attribute__ ((packed));