Bluetooth: Remove HCI notifier handling
[deliverable/linux.git] / include / net / bluetooth / hci.h
CommitLineData
be21871f 1/*
1da177e4
LT
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
10
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
be21871f
AE
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1da177e4
LT
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
be21871f
AE
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
1da177e4
LT
22 SOFTWARE IS DISCLAIMED.
23*/
24
25#ifndef __HCI_H
26#define __HCI_H
27
28#define HCI_MAX_ACL_SIZE 1024
29#define HCI_MAX_SCO_SIZE 255
30#define HCI_MAX_EVENT_SIZE 260
31#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
32
33/* HCI dev events */
34#define HCI_DEV_REG 1
35#define HCI_DEV_UNREG 2
36#define HCI_DEV_UP 3
37#define HCI_DEV_DOWN 4
38#define HCI_DEV_SUSPEND 5
39#define HCI_DEV_RESUME 6
40
41/* HCI notify events */
42#define HCI_NOTIFY_CONN_ADD 1
43#define HCI_NOTIFY_CONN_DEL 2
44#define HCI_NOTIFY_VOICE_SETTING 3
45
c13854ce 46/* HCI bus types */
0ac53939 47#define HCI_VIRTUAL 0
1da177e4
LT
48#define HCI_USB 1
49#define HCI_PCCARD 2
50#define HCI_UART 3
51#define HCI_RS232 4
52#define HCI_PCI 5
0ac53939 53#define HCI_SDIO 6
1da177e4 54
943da25d
MH
55/* HCI controller types */
56#define HCI_BREDR 0x00
8f1e1742 57#define HCI_AMP 0x01
943da25d 58
1da177e4
LT
59/* HCI device quirks */
60enum {
7a9d4020 61 HCI_QUIRK_NO_RESET,
da1f5198
MH
62 HCI_QUIRK_RAW_DEVICE,
63 HCI_QUIRK_FIXUP_BUFFER_SIZE
1da177e4
LT
64};
65
66/* HCI device flags */
67enum {
68 HCI_UP,
69 HCI_INIT,
70 HCI_RUNNING,
71
72 HCI_PSCAN,
73 HCI_ISCAN,
74 HCI_AUTH,
75 HCI_ENCRYPT,
76 HCI_INQUIRY,
77
78 HCI_RAW,
ab81cbf9 79
10572132 80 HCI_RESET,
1da177e4
LT
81};
82
d23264a8
AG
83/*
84 * BR/EDR and/or LE controller flags: the flags defined here should represent
85 * states from the controller.
86 */
87enum {
a8b2d5c2
JH
88 HCI_SETUP,
89 HCI_AUTO_OFF,
90 HCI_MGMT,
91 HCI_PAIRABLE,
92 HCI_SERVICE_CACHE,
93 HCI_LINK_KEYS,
94 HCI_DEBUG_KEYS,
95
d23264a8 96 HCI_LE_SCAN,
84bde9d6 97 HCI_SSP_ENABLED,
d23264a8
AG
98};
99
1da177e4
LT
100/* HCI ioctl defines */
101#define HCIDEVUP _IOW('H', 201, int)
102#define HCIDEVDOWN _IOW('H', 202, int)
103#define HCIDEVRESET _IOW('H', 203, int)
104#define HCIDEVRESTAT _IOW('H', 204, int)
105
106#define HCIGETDEVLIST _IOR('H', 210, int)
107#define HCIGETDEVINFO _IOR('H', 211, int)
108#define HCIGETCONNLIST _IOR('H', 212, int)
109#define HCIGETCONNINFO _IOR('H', 213, int)
40be492f 110#define HCIGETAUTHINFO _IOR('H', 215, int)
1da177e4
LT
111
112#define HCISETRAW _IOW('H', 220, int)
113#define HCISETSCAN _IOW('H', 221, int)
114#define HCISETAUTH _IOW('H', 222, int)
115#define HCISETENCRYPT _IOW('H', 223, int)
116#define HCISETPTYPE _IOW('H', 224, int)
117#define HCISETLINKPOL _IOW('H', 225, int)
118#define HCISETLINKMODE _IOW('H', 226, int)
119#define HCISETACLMTU _IOW('H', 227, int)
120#define HCISETSCOMTU _IOW('H', 228, int)
121
f0358568
JH
122#define HCIBLOCKADDR _IOW('H', 230, int)
123#define HCIUNBLOCKADDR _IOW('H', 231, int)
124
1da177e4
LT
125#define HCIINQUIRY _IOR('H', 240, int)
126
127/* HCI timeouts */
04837f64
MH
128#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
129#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
052b30b0 130#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
04837f64
MH
131#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
132#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
6bd32326 133#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
cc48dc0a 134#define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */
1da177e4 135
5b7f9909 136/* HCI data types */
1da177e4
LT
137#define HCI_COMMAND_PKT 0x01
138#define HCI_ACLDATA_PKT 0x02
139#define HCI_SCODATA_PKT 0x03
140#define HCI_EVENT_PKT 0x04
141#define HCI_VENDOR_PKT 0xff
142
5b7f9909 143/* HCI packet types */
1da177e4
LT
144#define HCI_DM1 0x0008
145#define HCI_DM3 0x0400
146#define HCI_DM5 0x4000
147#define HCI_DH1 0x0010
148#define HCI_DH3 0x0800
149#define HCI_DH5 0x8000
150
151#define HCI_HV1 0x0020
152#define HCI_HV2 0x0040
153#define HCI_HV3 0x0080
154
155#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
156#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK)
157
5b7f9909
MH
158/* eSCO packet types */
159#define ESCO_HV1 0x0001
160#define ESCO_HV2 0x0002
161#define ESCO_HV3 0x0004
162#define ESCO_EV3 0x0008
163#define ESCO_EV4 0x0010
164#define ESCO_EV5 0x0020
efc7688b
MH
165#define ESCO_2EV3 0x0040
166#define ESCO_3EV3 0x0080
167#define ESCO_2EV5 0x0100
168#define ESCO_3EV5 0x0200
5b7f9909 169
a8746417 170#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
efc7688b 171#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
a8746417 172
1da177e4 173/* ACL flags */
e702112f 174#define ACL_START_NO_FLUSH 0x00
1da177e4
LT
175#define ACL_CONT 0x01
176#define ACL_START 0x02
177#define ACL_ACTIVE_BCAST 0x04
178#define ACL_PICO_BCAST 0x08
179
180/* Baseband links */
181#define SCO_LINK 0x00
182#define ACL_LINK 0x01
5b7f9909 183#define ESCO_LINK 0x02
fcd89c09
VT
184/* Low Energy links do not have defined link type. Use invented one */
185#define LE_LINK 0x80
1da177e4
LT
186
187/* LMP features */
188#define LMP_3SLOT 0x01
189#define LMP_5SLOT 0x02
190#define LMP_ENCRYPT 0x04
191#define LMP_SOFFSET 0x08
192#define LMP_TACCURACY 0x10
193#define LMP_RSWITCH 0x20
194#define LMP_HOLD 0x40
04837f64 195#define LMP_SNIFF 0x80
1da177e4
LT
196
197#define LMP_PARK 0x01
198#define LMP_RSSI 0x02
199#define LMP_QUALITY 0x04
200#define LMP_SCO 0x08
201#define LMP_HV2 0x10
202#define LMP_HV3 0x20
203#define LMP_ULAW 0x40
204#define LMP_ALAW 0x80
205
206#define LMP_CVSD 0x01
207#define LMP_PSCHEME 0x02
208#define LMP_PCONTROL 0x04
209
d5859e22 210#define LMP_RSSI_INQ 0x40
5b7f9909
MH
211#define LMP_ESCO 0x80
212
213#define LMP_EV4 0x01
214#define LMP_EV5 0x02
69ab39ea 215#define LMP_NO_BREDR 0x20
d5859e22 216#define LMP_LE 0x40
5b7f9909 217
04837f64 218#define LMP_SNIFF_SUBR 0x02
d5859e22 219#define LMP_PAUSE_ENC 0x04
efc7688b
MH
220#define LMP_EDR_ESCO_2M 0x20
221#define LMP_EDR_ESCO_3M 0x40
222#define LMP_EDR_3S_ESCO 0x80
04837f64 223
d5859e22 224#define LMP_EXT_INQ 0x01
e6100a25 225#define LMP_SIMUL_LE_BR 0x02
769be974 226#define LMP_SIMPLE_PAIR 0x08
e702112f 227#define LMP_NO_FLUSH 0x40
769be974 228
d5859e22
JH
229#define LMP_LSTO 0x01
230#define LMP_INQ_TX_PWR 0x02
971e3a4b 231#define LMP_EXTFEATURES 0x80
d5859e22 232
eead27da
AG
233/* Extended LMP features */
234#define LMP_HOST_LE 0x02
235
04837f64
MH
236/* Connection modes */
237#define HCI_CM_ACTIVE 0x0000
238#define HCI_CM_HOLD 0x0001
239#define HCI_CM_SNIFF 0x0002
240#define HCI_CM_PARK 0x0003
241
1da177e4
LT
242/* Link policies */
243#define HCI_LP_RSWITCH 0x0001
244#define HCI_LP_HOLD 0x0002
245#define HCI_LP_SNIFF 0x0004
246#define HCI_LP_PARK 0x0008
247
04837f64 248/* Link modes */
1da177e4
LT
249#define HCI_LM_ACCEPT 0x8000
250#define HCI_LM_MASTER 0x0001
251#define HCI_LM_AUTH 0x0002
252#define HCI_LM_ENCRYPT 0x0004
253#define HCI_LM_TRUSTED 0x0008
254#define HCI_LM_RELIABLE 0x0010
255#define HCI_LM_SECURE 0x0020
256
40be492f
MH
257/* Authentication types */
258#define HCI_AT_NO_BONDING 0x00
259#define HCI_AT_NO_BONDING_MITM 0x01
260#define HCI_AT_DEDICATED_BONDING 0x02
261#define HCI_AT_DEDICATED_BONDING_MITM 0x03
262#define HCI_AT_GENERAL_BONDING 0x04
263#define HCI_AT_GENERAL_BONDING_MITM 0x05
264
b6020ba0
WR
265/* Link Key types */
266#define HCI_LK_COMBINATION 0x00
267#define HCI_LK_LOCAL_UNIT 0x01
268#define HCI_LK_REMOTE_UNIT 0x02
269#define HCI_LK_DEBUG_COMBINATION 0x03
270#define HCI_LK_UNAUTH_COMBINATION 0x04
271#define HCI_LK_AUTH_COMBINATION 0x05
272#define HCI_LK_CHANGED_COMBINATION 0x06
b899efaf
VCG
273/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
274#define HCI_SMP_STK 0x80
275#define HCI_SMP_STK_SLAVE 0x81
276#define HCI_SMP_LTK 0x82
277#define HCI_SMP_LTK_SLAVE 0x83
b6020ba0 278
9f5a0d7b
AE
279/* ---- HCI Error Codes ---- */
280#define HCI_ERROR_AUTH_FAILURE 0x05
281#define HCI_ERROR_REJ_BAD_ADDR 0x0f
282#define HCI_ERROR_REMOTE_USER_TERM 0x13
283#define HCI_ERROR_LOCAL_HOST_TERM 0x16
284#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
285
2455a3ea
AE
286/* Flow control modes */
287#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
288#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
289
32748db0
JH
290/* Extended Inquiry Response field types */
291#define EIR_FLAGS 0x01 /* flags */
292#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
293#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
294#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
295#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
296#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
297#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
298#define EIR_NAME_SHORT 0x08 /* shortened local name */
299#define EIR_NAME_COMPLETE 0x09 /* complete local name */
300#define EIR_TX_POWER 0x0A /* transmit power level */
9ec9fc8a
JH
301#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
302#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */
303#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
32748db0
JH
304#define EIR_DEVICE_ID 0x10 /* device ID */
305
1da177e4 306/* ----- HCI Commands ---- */
6bd32326
VT
307#define HCI_OP_NOP 0x0000
308
a9de9248
MH
309#define HCI_OP_INQUIRY 0x0401
310struct hci_cp_inquiry {
311 __u8 lap[3];
312 __u8 length;
313 __u8 num_rsp;
66c853cc 314} __packed;
1da177e4 315
a9de9248 316#define HCI_OP_INQUIRY_CANCEL 0x0402
1da177e4 317
a9de9248 318#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
6ac59344 319
a9de9248 320#define HCI_OP_CREATE_CONN 0x0405
1da177e4
LT
321struct hci_cp_create_conn {
322 bdaddr_t bdaddr;
1ebb9252 323 __le16 pkt_type;
1da177e4
LT
324 __u8 pscan_rep_mode;
325 __u8 pscan_mode;
1ebb9252 326 __le16 clock_offset;
1da177e4 327 __u8 role_switch;
66c853cc 328} __packed;
1da177e4 329
a9de9248 330#define HCI_OP_DISCONNECT 0x0406
1da177e4 331struct hci_cp_disconnect {
1ebb9252 332 __le16 handle;
1da177e4 333 __u8 reason;
66c853cc 334} __packed;
1da177e4 335
a9de9248 336#define HCI_OP_ADD_SCO 0x0407
1da177e4 337struct hci_cp_add_sco {
1ebb9252
MH
338 __le16 handle;
339 __le16 pkt_type;
66c853cc 340} __packed;
1da177e4 341
a9de9248
MH
342#define HCI_OP_CREATE_CONN_CANCEL 0x0408
343struct hci_cp_create_conn_cancel {
344 bdaddr_t bdaddr;
66c853cc 345} __packed;
1da177e4 346
a9de9248
MH
347#define HCI_OP_ACCEPT_CONN_REQ 0x0409
348struct hci_cp_accept_conn_req {
349 bdaddr_t bdaddr;
350 __u8 role;
66c853cc 351} __packed;
1da177e4 352
a9de9248
MH
353#define HCI_OP_REJECT_CONN_REQ 0x040a
354struct hci_cp_reject_conn_req {
355 bdaddr_t bdaddr;
356 __u8 reason;
66c853cc 357} __packed;
defc761b 358
a9de9248 359#define HCI_OP_LINK_KEY_REPLY 0x040b
1da177e4
LT
360struct hci_cp_link_key_reply {
361 bdaddr_t bdaddr;
362 __u8 link_key[16];
66c853cc 363} __packed;
1da177e4 364
a9de9248 365#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
1da177e4
LT
366struct hci_cp_link_key_neg_reply {
367 bdaddr_t bdaddr;
66c853cc 368} __packed;
1da177e4 369
a9de9248 370#define HCI_OP_PIN_CODE_REPLY 0x040d
1da177e4
LT
371struct hci_cp_pin_code_reply {
372 bdaddr_t bdaddr;
373 __u8 pin_len;
374 __u8 pin_code[16];
66c853cc 375} __packed;
980e1a53
JH
376struct hci_rp_pin_code_reply {
377 __u8 status;
378 bdaddr_t bdaddr;
379} __packed;
1da177e4 380
a9de9248 381#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
1da177e4
LT
382struct hci_cp_pin_code_neg_reply {
383 bdaddr_t bdaddr;
66c853cc 384} __packed;
980e1a53
JH
385struct hci_rp_pin_code_neg_reply {
386 __u8 status;
387 bdaddr_t bdaddr;
388} __packed;
1da177e4 389
a9de9248 390#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
1da177e4 391struct hci_cp_change_conn_ptype {
1ebb9252
MH
392 __le16 handle;
393 __le16 pkt_type;
66c853cc 394} __packed;
1da177e4 395
a9de9248 396#define HCI_OP_AUTH_REQUESTED 0x0411
1da177e4 397struct hci_cp_auth_requested {
1ebb9252 398 __le16 handle;
66c853cc 399} __packed;
1da177e4 400
a9de9248 401#define HCI_OP_SET_CONN_ENCRYPT 0x0413
1da177e4 402struct hci_cp_set_conn_encrypt {
1ebb9252 403 __le16 handle;
1da177e4 404 __u8 encrypt;
66c853cc 405} __packed;
1da177e4 406
a9de9248 407#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
1da177e4 408struct hci_cp_change_conn_link_key {
1ebb9252 409 __le16 handle;
66c853cc 410} __packed;
1da177e4 411
a9de9248
MH
412#define HCI_OP_REMOTE_NAME_REQ 0x0419
413struct hci_cp_remote_name_req {
414 bdaddr_t bdaddr;
415 __u8 pscan_rep_mode;
416 __u8 pscan_mode;
417 __le16 clock_offset;
66c853cc 418} __packed;
a9de9248
MH
419
420#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
421struct hci_cp_remote_name_req_cancel {
422 bdaddr_t bdaddr;
66c853cc 423} __packed;
a9de9248
MH
424
425#define HCI_OP_READ_REMOTE_FEATURES 0x041b
04837f64 426struct hci_cp_read_remote_features {
1ebb9252 427 __le16 handle;
66c853cc 428} __packed;
1da177e4 429
a9de9248
MH
430#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
431struct hci_cp_read_remote_ext_features {
432 __le16 handle;
433 __u8 page;
66c853cc 434} __packed;
a9de9248
MH
435
436#define HCI_OP_READ_REMOTE_VERSION 0x041d
04837f64 437struct hci_cp_read_remote_version {
1ebb9252 438 __le16 handle;
66c853cc 439} __packed;
1da177e4 440
a9de9248
MH
441#define HCI_OP_SETUP_SYNC_CONN 0x0428
442struct hci_cp_setup_sync_conn {
443 __le16 handle;
444 __le32 tx_bandwidth;
445 __le32 rx_bandwidth;
446 __le16 max_latency;
447 __le16 voice_setting;
448 __u8 retrans_effort;
449 __le16 pkt_type;
66c853cc 450} __packed;
04837f64 451
a9de9248
MH
452#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
453struct hci_cp_accept_sync_conn_req {
454 bdaddr_t bdaddr;
455 __le32 tx_bandwidth;
456 __le32 rx_bandwidth;
457 __le16 max_latency;
458 __le16 content_format;
459 __u8 retrans_effort;
460 __le16 pkt_type;
66c853cc 461} __packed;
a9de9248
MH
462
463#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
464struct hci_cp_reject_sync_conn_req {
465 bdaddr_t bdaddr;
466 __u8 reason;
66c853cc 467} __packed;
a9de9248 468
17fa4b9d
JH
469#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
470struct hci_cp_io_capability_reply {
471 bdaddr_t bdaddr;
472 __u8 capability;
473 __u8 oob_data;
474 __u8 authentication;
475} __packed;
476
a5c29683
JH
477#define HCI_OP_USER_CONFIRM_REPLY 0x042c
478struct hci_cp_user_confirm_reply {
479 bdaddr_t bdaddr;
480} __packed;
481struct hci_rp_user_confirm_reply {
482 __u8 status;
483 bdaddr_t bdaddr;
484} __packed;
485
486#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
487
9ad4019a
BG
488#define HCI_OP_USER_PASSKEY_REPLY 0x042e
489struct hci_cp_user_passkey_reply {
490 bdaddr_t bdaddr;
491 __le32 passkey;
492} __packed;
493
494#define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f
495
2763eda6
SJ
496#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
497struct hci_cp_remote_oob_data_reply {
498 bdaddr_t bdaddr;
499 __u8 hash[16];
500 __u8 randomizer[16];
501} __packed;
502
503#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
504struct hci_cp_remote_oob_data_neg_reply {
505 bdaddr_t bdaddr;
506} __packed;
507
03b555e1
JH
508#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
509struct hci_cp_io_capability_neg_reply {
510 bdaddr_t bdaddr;
511 __u8 reason;
512} __packed;
513
a9de9248 514#define HCI_OP_SNIFF_MODE 0x0803
04837f64
MH
515struct hci_cp_sniff_mode {
516 __le16 handle;
517 __le16 max_interval;
518 __le16 min_interval;
519 __le16 attempt;
520 __le16 timeout;
66c853cc 521} __packed;
04837f64 522
a9de9248 523#define HCI_OP_EXIT_SNIFF_MODE 0x0804
04837f64
MH
524struct hci_cp_exit_sniff_mode {
525 __le16 handle;
66c853cc 526} __packed;
04837f64 527
a9de9248 528#define HCI_OP_ROLE_DISCOVERY 0x0809
1da177e4 529struct hci_cp_role_discovery {
1ebb9252 530 __le16 handle;
66c853cc 531} __packed;
1da177e4
LT
532struct hci_rp_role_discovery {
533 __u8 status;
1ebb9252 534 __le16 handle;
1da177e4 535 __u8 role;
66c853cc 536} __packed;
1da177e4 537
a9de9248
MH
538#define HCI_OP_SWITCH_ROLE 0x080b
539struct hci_cp_switch_role {
540 bdaddr_t bdaddr;
541 __u8 role;
66c853cc 542} __packed;
a9de9248
MH
543
544#define HCI_OP_READ_LINK_POLICY 0x080c
1da177e4 545struct hci_cp_read_link_policy {
1ebb9252 546 __le16 handle;
66c853cc 547} __packed;
1da177e4
LT
548struct hci_rp_read_link_policy {
549 __u8 status;
1ebb9252
MH
550 __le16 handle;
551 __le16 policy;
66c853cc 552} __packed;
1da177e4 553
a9de9248 554#define HCI_OP_WRITE_LINK_POLICY 0x080d
1da177e4 555struct hci_cp_write_link_policy {
1ebb9252
MH
556 __le16 handle;
557 __le16 policy;
66c853cc 558} __packed;
1da177e4
LT
559struct hci_rp_write_link_policy {
560 __u8 status;
1ebb9252 561 __le16 handle;
66c853cc 562} __packed;
e4e8e37c
MH
563
564#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
565struct hci_rp_read_def_link_policy {
566 __u8 status;
567 __le16 policy;
66c853cc 568} __packed;
e4e8e37c
MH
569
570#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
571struct hci_cp_write_def_link_policy {
572 __le16 policy;
66c853cc 573} __packed;
1da177e4 574
a9de9248 575#define HCI_OP_SNIFF_SUBRATE 0x0811
04837f64
MH
576struct hci_cp_sniff_subrate {
577 __le16 handle;
578 __le16 max_latency;
579 __le16 min_remote_timeout;
580 __le16 min_local_timeout;
66c853cc 581} __packed;
04837f64 582
a9de9248
MH
583#define HCI_OP_SET_EVENT_MASK 0x0c01
584struct hci_cp_set_event_mask {
585 __u8 mask[8];
66c853cc 586} __packed;
1da177e4 587
a9de9248 588#define HCI_OP_RESET 0x0c03
1da177e4 589
a9de9248
MH
590#define HCI_OP_SET_EVENT_FLT 0x0c05
591struct hci_cp_set_event_flt {
592 __u8 flt_type;
593 __u8 cond_type;
594 __u8 condition[0];
66c853cc 595} __packed;
1da177e4 596
a9de9248
MH
597/* Filter types */
598#define HCI_FLT_CLEAR_ALL 0x00
599#define HCI_FLT_INQ_RESULT 0x01
600#define HCI_FLT_CONN_SETUP 0x02
1da177e4 601
a9de9248
MH
602/* CONN_SETUP Condition types */
603#define HCI_CONN_SETUP_ALLOW_ALL 0x00
604#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
605#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
606
607/* CONN_SETUP Conditions */
608#define HCI_CONN_SETUP_AUTO_OFF 0x01
609#define HCI_CONN_SETUP_AUTO_ON 0x02
610
b0916ea0
JH
611#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
612struct hci_cp_delete_stored_link_key {
613 bdaddr_t bdaddr;
614 __u8 delete_all;
615} __packed;
616
1f6c6378
JH
617#define HCI_MAX_NAME_LENGTH 248
618
a9de9248
MH
619#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
620struct hci_cp_write_local_name {
1f6c6378 621 __u8 name[HCI_MAX_NAME_LENGTH];
66c853cc 622} __packed;
a9de9248
MH
623
624#define HCI_OP_READ_LOCAL_NAME 0x0c14
625struct hci_rp_read_local_name {
626 __u8 status;
1f6c6378 627 __u8 name[HCI_MAX_NAME_LENGTH];
66c853cc 628} __packed;
a9de9248
MH
629
630#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
631
632#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
633
70f23020 634#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
a9de9248
MH
635 #define SCAN_DISABLED 0x00
636 #define SCAN_INQUIRY 0x01
637 #define SCAN_PAGE 0x02
638
639#define HCI_OP_READ_AUTH_ENABLE 0x0c1f
640
641#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
642 #define AUTH_DISABLED 0x00
643 #define AUTH_ENABLED 0x01
644
645#define HCI_OP_READ_ENCRYPT_MODE 0x0c21
646
647#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
648 #define ENCRYPT_DISABLED 0x00
649 #define ENCRYPT_P2P 0x01
650 #define ENCRYPT_BOTH 0x02
651
652#define HCI_OP_READ_CLASS_OF_DEV 0x0c23
653struct hci_rp_read_class_of_dev {
654 __u8 status;
1da177e4 655 __u8 dev_class[3];
66c853cc 656} __packed;
1da177e4 657
a9de9248
MH
658#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
659struct hci_cp_write_class_of_dev {
1da177e4 660 __u8 dev_class[3];
66c853cc 661} __packed;
a9de9248
MH
662
663#define HCI_OP_READ_VOICE_SETTING 0x0c25
664struct hci_rp_read_voice_setting {
665 __u8 status;
666 __le16 voice_setting;
66c853cc 667} __packed;
a9de9248
MH
668
669#define HCI_OP_WRITE_VOICE_SETTING 0x0c26
670struct hci_cp_write_voice_setting {
671 __le16 voice_setting;
66c853cc 672} __packed;
a9de9248
MH
673
674#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
675struct hci_cp_host_buffer_size {
676 __le16 acl_mtu;
677 __u8 sco_mtu;
678 __le16 acl_max_pkt;
679 __le16 sco_max_pkt;
66c853cc 680} __packed;
a9de9248 681
d5859e22
JH
682#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
683
80a1e1db
JH
684#define HCI_MAX_EIR_LENGTH 240
685
686#define HCI_OP_WRITE_EIR 0x0c52
687struct hci_cp_write_eir {
688 uint8_t fec;
689 uint8_t data[HCI_MAX_EIR_LENGTH];
690} __packed;
691
333140b5
MH
692#define HCI_OP_READ_SSP_MODE 0x0c55
693struct hci_rp_read_ssp_mode {
694 __u8 status;
695 __u8 mode;
66c853cc 696} __packed;
333140b5
MH
697
698#define HCI_OP_WRITE_SSP_MODE 0x0c56
699struct hci_cp_write_ssp_mode {
700 __u8 mode;
66c853cc 701} __packed;
333140b5 702
c35938b2
SJ
703#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
704struct hci_rp_read_local_oob_data {
705 __u8 status;
706 __u8 hash[16];
707 __u8 randomizer[16];
708} __packed;
709
d5859e22
JH
710#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
711
1e89cffb
AE
712#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
713struct hci_rp_read_flow_control_mode {
714 __u8 status;
715 __u8 mode;
716} __packed;
717
f9b49306
AG
718#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
719struct hci_cp_write_le_host_supported {
720 __u8 le;
721 __u8 simul;
722} __packed;
723
a9de9248
MH
724#define HCI_OP_READ_LOCAL_VERSION 0x1001
725struct hci_rp_read_local_version {
726 __u8 status;
727 __u8 hci_ver;
728 __le16 hci_rev;
729 __u8 lmp_ver;
730 __le16 manufacturer;
731 __le16 lmp_subver;
66c853cc 732} __packed;
a9de9248
MH
733
734#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
735struct hci_rp_read_local_commands {
736 __u8 status;
737 __u8 commands[64];
66c853cc 738} __packed;
a9de9248
MH
739
740#define HCI_OP_READ_LOCAL_FEATURES 0x1003
741struct hci_rp_read_local_features {
742 __u8 status;
743 __u8 features[8];
66c853cc 744} __packed;
a9de9248
MH
745
746#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
971e3a4b
AG
747struct hci_cp_read_local_ext_features {
748 __u8 page;
749} __packed;
a9de9248
MH
750struct hci_rp_read_local_ext_features {
751 __u8 status;
752 __u8 page;
753 __u8 max_page;
754 __u8 features[8];
66c853cc 755} __packed;
a9de9248
MH
756
757#define HCI_OP_READ_BUFFER_SIZE 0x1005
758struct hci_rp_read_buffer_size {
759 __u8 status;
760 __le16 acl_mtu;
761 __u8 sco_mtu;
762 __le16 acl_max_pkt;
763 __le16 sco_max_pkt;
66c853cc 764} __packed;
a9de9248
MH
765
766#define HCI_OP_READ_BD_ADDR 0x1009
767struct hci_rp_read_bd_addr {
768 __u8 status;
45bb4bf0 769 bdaddr_t bdaddr;
66c853cc 770} __packed;
1da177e4 771
350ee4cf
AE
772#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
773struct hci_rp_read_data_block_size {
774 __u8 status;
775 __le16 max_acl_len;
776 __le16 block_len;
777 __le16 num_blocks;
778} __packed;
779
f6422ec6
AJ
780#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
781struct hci_cp_write_page_scan_activity {
782 __le16 interval;
783 __le16 window;
784} __packed;
785
786#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47
787 #define PAGE_SCAN_TYPE_STANDARD 0x00
788 #define PAGE_SCAN_TYPE_INTERLACED 0x01
789
928abaa7
AE
790#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
791struct hci_rp_read_local_amp_info {
792 __u8 status;
793 __u8 amp_status;
794 __le32 total_bw;
795 __le32 max_bw;
796 __le32 min_latency;
797 __le32 max_pdu;
798 __u8 amp_type;
799 __le16 pal_cap;
800 __le16 max_assoc_size;
801 __le32 max_flush_to;
802 __le32 be_flush_to;
803} __packed;
804
63185f64
VT
805#define HCI_OP_LE_SET_EVENT_MASK 0x2001
806struct hci_cp_le_set_event_mask {
807 __u8 mask[8];
808} __packed;
809
810#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
811struct hci_rp_le_read_buffer_size {
812 __u8 status;
813 __le16 le_mtu;
814 __u8 le_max_pkt;
815} __packed;
816
07f7fa5d
AG
817#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
818struct hci_cp_le_set_scan_param {
819 __u8 type;
820 __le16 interval;
821 __le16 window;
822 __u8 own_address_type;
823 __u8 filter_policy;
824} __packed;
825
68a8aea4
AE
826#define LE_SCANNING_DISABLED 0x00
827#define LE_SCANNING_ENABLED 0x01
828
eb9d91f5
AG
829#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
830struct hci_cp_le_set_scan_enable {
831 __u8 enable;
832 __u8 filter_dup;
833} __packed;
834
63185f64
VT
835#define HCI_OP_LE_CREATE_CONN 0x200d
836struct hci_cp_le_create_conn {
837 __le16 scan_interval;
838 __le16 scan_window;
839 __u8 filter_policy;
840 __u8 peer_addr_type;
841 bdaddr_t peer_addr;
842 __u8 own_address_type;
843 __le16 conn_interval_min;
844 __le16 conn_interval_max;
845 __le16 conn_latency;
846 __le16 supervision_timeout;
847 __le16 min_ce_len;
848 __le16 max_ce_len;
849} __packed;
850
851#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
852
2ce603eb
CT
853#define HCI_OP_LE_CONN_UPDATE 0x2013
854struct hci_cp_le_conn_update {
855 __le16 handle;
856 __le16 conn_interval_min;
857 __le16 conn_interval_max;
858 __le16 conn_latency;
859 __le16 supervision_timeout;
860 __le16 min_ce_len;
861 __le16 max_ce_len;
862} __packed;
863
a7a595f6
VCG
864#define HCI_OP_LE_START_ENC 0x2019
865struct hci_cp_le_start_enc {
866 __le16 handle;
867 __u8 rand[8];
868 __le16 ediv;
869 __u8 ltk[16];
870} __packed;
871
872#define HCI_OP_LE_LTK_REPLY 0x201a
873struct hci_cp_le_ltk_reply {
874 __le16 handle;
875 __u8 ltk[16];
876} __packed;
877struct hci_rp_le_ltk_reply {
878 __u8 status;
879 __le16 handle;
880} __packed;
881
882#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
883struct hci_cp_le_ltk_neg_reply {
884 __le16 handle;
885} __packed;
886struct hci_rp_le_ltk_neg_reply {
887 __u8 status;
888 __le16 handle;
889} __packed;
890
a9de9248
MH
891/* ---- HCI Events ---- */
892#define HCI_EV_INQUIRY_COMPLETE 0x01
893
894#define HCI_EV_INQUIRY_RESULT 0x02
895struct inquiry_info {
21d9e30e
MH
896 bdaddr_t bdaddr;
897 __u8 pscan_rep_mode;
898 __u8 pscan_period_mode;
a9de9248 899 __u8 pscan_mode;
21d9e30e 900 __u8 dev_class[3];
1ebb9252 901 __le16 clock_offset;
66c853cc 902} __packed;
21d9e30e 903
a9de9248 904#define HCI_EV_CONN_COMPLETE 0x03
1da177e4
LT
905struct hci_ev_conn_complete {
906 __u8 status;
1ebb9252 907 __le16 handle;
1da177e4
LT
908 bdaddr_t bdaddr;
909 __u8 link_type;
910 __u8 encr_mode;
66c853cc 911} __packed;
1da177e4 912
a9de9248 913#define HCI_EV_CONN_REQUEST 0x04
1da177e4
LT
914struct hci_ev_conn_request {
915 bdaddr_t bdaddr;
916 __u8 dev_class[3];
917 __u8 link_type;
66c853cc 918} __packed;
1da177e4 919
a9de9248 920#define HCI_EV_DISCONN_COMPLETE 0x05
1da177e4
LT
921struct hci_ev_disconn_complete {
922 __u8 status;
1ebb9252 923 __le16 handle;
1da177e4 924 __u8 reason;
66c853cc 925} __packed;
1da177e4 926
a9de9248 927#define HCI_EV_AUTH_COMPLETE 0x06
1da177e4
LT
928struct hci_ev_auth_complete {
929 __u8 status;
1ebb9252 930 __le16 handle;
66c853cc 931} __packed;
1da177e4 932
a9de9248
MH
933#define HCI_EV_REMOTE_NAME 0x07
934struct hci_ev_remote_name {
935 __u8 status;
936 bdaddr_t bdaddr;
1f6c6378 937 __u8 name[HCI_MAX_NAME_LENGTH];
66c853cc 938} __packed;
a9de9248
MH
939
940#define HCI_EV_ENCRYPT_CHANGE 0x08
1da177e4
LT
941struct hci_ev_encrypt_change {
942 __u8 status;
1ebb9252 943 __le16 handle;
1da177e4 944 __u8 encrypt;
66c853cc 945} __packed;
1da177e4 946
a9de9248
MH
947#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
948struct hci_ev_change_link_key_complete {
949 __u8 status;
950 __le16 handle;
66c853cc 951} __packed;
a9de9248
MH
952
953#define HCI_EV_REMOTE_FEATURES 0x0b
954struct hci_ev_remote_features {
955 __u8 status;
956 __le16 handle;
957 __u8 features[8];
66c853cc 958} __packed;
a9de9248
MH
959
960#define HCI_EV_REMOTE_VERSION 0x0c
961struct hci_ev_remote_version {
1da177e4 962 __u8 status;
1ebb9252 963 __le16 handle;
a9de9248
MH
964 __u8 lmp_ver;
965 __le16 manufacturer;
966 __le16 lmp_subver;
66c853cc 967} __packed;
1da177e4 968
a9de9248 969#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1da177e4
LT
970struct hci_qos {
971 __u8 service_type;
972 __u32 token_rate;
973 __u32 peak_bandwidth;
974 __u32 latency;
975 __u32 delay_variation;
66c853cc 976} __packed;
1da177e4
LT
977struct hci_ev_qos_setup_complete {
978 __u8 status;
1ebb9252 979 __le16 handle;
1da177e4 980 struct hci_qos qos;
66c853cc 981} __packed;
1da177e4 982
a9de9248 983#define HCI_EV_CMD_COMPLETE 0x0e
1da177e4
LT
984struct hci_ev_cmd_complete {
985 __u8 ncmd;
1ebb9252 986 __le16 opcode;
66c853cc 987} __packed;
1da177e4 988
a9de9248 989#define HCI_EV_CMD_STATUS 0x0f
1da177e4
LT
990struct hci_ev_cmd_status {
991 __u8 status;
992 __u8 ncmd;
1ebb9252 993 __le16 opcode;
66c853cc 994} __packed;
1da177e4 995
a9de9248 996#define HCI_EV_ROLE_CHANGE 0x12
1da177e4
LT
997struct hci_ev_role_change {
998 __u8 status;
999 bdaddr_t bdaddr;
1000 __u8 role;
66c853cc 1001} __packed;
1da177e4 1002
a9de9248 1003#define HCI_EV_NUM_COMP_PKTS 0x13
613a1c0c
AE
1004struct hci_comp_pkts_info {
1005 __le16 handle;
1006 __le16 count;
1007} __packed;
1008
a9de9248
MH
1009struct hci_ev_num_comp_pkts {
1010 __u8 num_hndl;
613a1c0c 1011 struct hci_comp_pkts_info handles[0];
66c853cc 1012} __packed;
a9de9248
MH
1013
1014#define HCI_EV_MODE_CHANGE 0x14
1da177e4
LT
1015struct hci_ev_mode_change {
1016 __u8 status;
1ebb9252 1017 __le16 handle;
1da177e4 1018 __u8 mode;
1ebb9252 1019 __le16 interval;
66c853cc 1020} __packed;
1da177e4 1021
a9de9248 1022#define HCI_EV_PIN_CODE_REQ 0x16
1da177e4
LT
1023struct hci_ev_pin_code_req {
1024 bdaddr_t bdaddr;
66c853cc 1025} __packed;
1da177e4 1026
a9de9248 1027#define HCI_EV_LINK_KEY_REQ 0x17
1da177e4
LT
1028struct hci_ev_link_key_req {
1029 bdaddr_t bdaddr;
66c853cc 1030} __packed;
1da177e4 1031
a9de9248 1032#define HCI_EV_LINK_KEY_NOTIFY 0x18
1da177e4
LT
1033struct hci_ev_link_key_notify {
1034 bdaddr_t bdaddr;
a9de9248
MH
1035 __u8 link_key[16];
1036 __u8 key_type;
66c853cc 1037} __packed;
1da177e4 1038
a9de9248
MH
1039#define HCI_EV_CLOCK_OFFSET 0x1c
1040struct hci_ev_clock_offset {
1da177e4 1041 __u8 status;
1ebb9252 1042 __le16 handle;
a9de9248 1043 __le16 clock_offset;
66c853cc 1044} __packed;
1da177e4 1045
a8746417
MH
1046#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1047struct hci_ev_pkt_type_change {
1048 __u8 status;
1049 __le16 handle;
1050 __le16 pkt_type;
66c853cc 1051} __packed;
a8746417 1052
a9de9248
MH
1053#define HCI_EV_PSCAN_REP_MODE 0x20
1054struct hci_ev_pscan_rep_mode {
1055 bdaddr_t bdaddr;
1056 __u8 pscan_rep_mode;
66c853cc 1057} __packed;
a9de9248
MH
1058
1059#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1060struct inquiry_info_with_rssi {
1061 bdaddr_t bdaddr;
1062 __u8 pscan_rep_mode;
1063 __u8 pscan_period_mode;
1064 __u8 dev_class[3];
1065 __le16 clock_offset;
1066 __s8 rssi;
66c853cc 1067} __packed;
a9de9248
MH
1068struct inquiry_info_with_rssi_and_pscan_mode {
1069 bdaddr_t bdaddr;
1070 __u8 pscan_rep_mode;
1071 __u8 pscan_period_mode;
1072 __u8 pscan_mode;
1073 __u8 dev_class[3];
1074 __le16 clock_offset;
1075 __s8 rssi;
66c853cc 1076} __packed;
a9de9248
MH
1077
1078#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1079struct hci_ev_remote_ext_features {
1da177e4 1080 __u8 status;
1ebb9252 1081 __le16 handle;
a9de9248
MH
1082 __u8 page;
1083 __u8 max_page;
1084 __u8 features[8];
66c853cc 1085} __packed;
1da177e4 1086
a9de9248
MH
1087#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1088struct hci_ev_sync_conn_complete {
1da177e4 1089 __u8 status;
1ebb9252 1090 __le16 handle;
a9de9248
MH
1091 bdaddr_t bdaddr;
1092 __u8 link_type;
1093 __u8 tx_interval;
1094 __u8 retrans_window;
1095 __le16 rx_pkt_len;
1096 __le16 tx_pkt_len;
1097 __u8 air_mode;
66c853cc 1098} __packed;
1da177e4 1099
a9de9248
MH
1100#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1101struct hci_ev_sync_conn_changed {
1102 __u8 status;
1103 __le16 handle;
1104 __u8 tx_interval;
1105 __u8 retrans_window;
1106 __le16 rx_pkt_len;
1107 __le16 tx_pkt_len;
66c853cc 1108} __packed;
85a1e930 1109
a9de9248 1110#define HCI_EV_SNIFF_SUBRATE 0x2e
04837f64
MH
1111struct hci_ev_sniff_subrate {
1112 __u8 status;
1113 __le16 handle;
1114 __le16 max_tx_latency;
1115 __le16 max_rx_latency;
1116 __le16 max_remote_timeout;
1117 __le16 max_local_timeout;
66c853cc 1118} __packed;
04837f64 1119
a9de9248
MH
1120#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
1121struct extended_inquiry_info {
1122 bdaddr_t bdaddr;
1123 __u8 pscan_rep_mode;
1124 __u8 pscan_period_mode;
1125 __u8 dev_class[3];
1126 __le16 clock_offset;
1127 __s8 rssi;
1128 __u8 data[240];
66c853cc 1129} __packed;
a9de9248 1130
0493684e
MH
1131#define HCI_EV_IO_CAPA_REQUEST 0x31
1132struct hci_ev_io_capa_request {
1133 bdaddr_t bdaddr;
66c853cc 1134} __packed;
0493684e 1135
03b555e1
JH
1136#define HCI_EV_IO_CAPA_REPLY 0x32
1137struct hci_ev_io_capa_reply {
1138 bdaddr_t bdaddr;
1139 __u8 capability;
1140 __u8 oob_data;
1141 __u8 authentication;
1142} __packed;
1143
a5c29683
JH
1144#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1145struct hci_ev_user_confirm_req {
1146 bdaddr_t bdaddr;
1147 __le32 passkey;
1148} __packed;
1149
9ad4019a
BG
1150#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1151struct hci_ev_user_passkey_req {
1152 bdaddr_t bdaddr;
1153} __packed;
1154
2763eda6
SJ
1155#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1156struct hci_ev_remote_oob_data_request {
1157 bdaddr_t bdaddr;
1158} __packed;
1159
0493684e
MH
1160#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1161struct hci_ev_simple_pair_complete {
1162 __u8 status;
1163 bdaddr_t bdaddr;
66c853cc 1164} __packed;
0493684e 1165
41a96212
MH
1166#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1167struct hci_ev_remote_host_features {
1168 bdaddr_t bdaddr;
1169 __u8 features[8];
66c853cc 1170} __packed;
41a96212 1171
63185f64
VT
1172#define HCI_EV_LE_META 0x3e
1173struct hci_ev_le_meta {
1174 __u8 subevent;
1175} __packed;
1176
25e89e99
AE
1177#define HCI_EV_NUM_COMP_BLOCKS 0x48
1178struct hci_comp_blocks_info {
1179 __le16 handle;
1180 __le16 pkts;
1181 __le16 blocks;
1182} __packed;
1183
1184struct hci_ev_num_comp_blocks {
1185 __le16 num_blocks;
1186 __u8 num_hndl;
1187 struct hci_comp_blocks_info handles[0];
1188} __packed;
1189
63185f64
VT
1190/* Low energy meta events */
1191#define HCI_EV_LE_CONN_COMPLETE 0x01
1192struct hci_ev_le_conn_complete {
1193 __u8 status;
1194 __le16 handle;
1195 __u8 role;
1196 __u8 bdaddr_type;
1197 bdaddr_t bdaddr;
1198 __le16 interval;
1199 __le16 latency;
1200 __le16 supervision_timeout;
1201 __u8 clk_accurancy;
1202} __packed;
1203
a7a595f6
VCG
1204#define HCI_EV_LE_LTK_REQ 0x05
1205struct hci_ev_le_ltk_req {
1206 __le16 handle;
1207 __u8 random[8];
1208 __le16 ediv;
1209} __packed;
1210
57a56fd4
AB
1211/* Advertising report event types */
1212#define ADV_IND 0x00
1213#define ADV_DIRECT_IND 0x01
1214#define ADV_SCAN_IND 0x02
1215#define ADV_NONCONN_IND 0x03
1216#define ADV_SCAN_RSP 0x04
1217
1218#define ADDR_LE_DEV_PUBLIC 0x00
1219#define ADDR_LE_DEV_RANDOM 0x01
1220
1221#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1222struct hci_ev_le_advertising_info {
1223 __u8 evt_type;
1224 __u8 bdaddr_type;
1225 bdaddr_t bdaddr;
1226 __u8 length;
1227 __u8 data[0];
1228} __packed;
1229
1da177e4 1230/* Internal events generated by Bluetooth stack */
a9de9248 1231#define HCI_EV_STACK_INTERNAL 0xfd
1da177e4
LT
1232struct hci_ev_stack_internal {
1233 __u16 type;
1234 __u8 data[0];
66c853cc 1235} __packed;
1da177e4 1236
a9de9248 1237#define HCI_EV_SI_DEVICE 0x01
1da177e4
LT
1238struct hci_ev_si_device {
1239 __u16 event;
1240 __u16 dev_id;
66c853cc 1241} __packed;
1da177e4
LT
1242
1243#define HCI_EV_SI_SECURITY 0x02
1244struct hci_ev_si_security {
1245 __u16 event;
1246 __u16 proto;
1247 __u16 subproto;
1248 __u8 incoming;
66c853cc 1249} __packed;
1da177e4
LT
1250
1251/* ---- HCI Packet structures ---- */
1252#define HCI_COMMAND_HDR_SIZE 3
1253#define HCI_EVENT_HDR_SIZE 2
1254#define HCI_ACL_HDR_SIZE 4
1255#define HCI_SCO_HDR_SIZE 3
1256
1257struct hci_command_hdr {
a9de9248 1258 __le16 opcode; /* OCF & OGF */
70f23020 1259 __u8 plen;
66c853cc 1260} __packed;
1da177e4
LT
1261
1262struct hci_event_hdr {
a9de9248
MH
1263 __u8 evt;
1264 __u8 plen;
66c853cc 1265} __packed;
1da177e4
LT
1266
1267struct hci_acl_hdr {
a9de9248
MH
1268 __le16 handle; /* Handle & Flags(PB, BC) */
1269 __le16 dlen;
66c853cc 1270} __packed;
1da177e4
LT
1271
1272struct hci_sco_hdr {
a9de9248
MH
1273 __le16 handle;
1274 __u8 dlen;
66c853cc 1275} __packed;
1da177e4 1276
2a123b86
ACM
1277#include <linux/skbuff.h>
1278static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1279{
a9de9248 1280 return (struct hci_event_hdr *) skb->data;
2a123b86
ACM
1281}
1282
1283static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1284{
a9de9248 1285 return (struct hci_acl_hdr *) skb->data;
2a123b86
ACM
1286}
1287
1288static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1289{
a9de9248 1290 return (struct hci_sco_hdr *) skb->data;
2a123b86 1291}
2a123b86 1292
1da177e4 1293/* Command opcode pack/unpack */
1ebb9252 1294#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
1da177e4
LT
1295#define hci_opcode_ogf(op) (op >> 10)
1296#define hci_opcode_ocf(op) (op & 0x03ff)
1297
1298/* ACL handle and flags pack/unpack */
1ebb9252 1299#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
1da177e4
LT
1300#define hci_handle(h) (h & 0x0fff)
1301#define hci_flags(h) (h >> 12)
1302
1303/* ---- HCI Sockets ---- */
1304
1305/* Socket options */
1306#define HCI_DATA_DIR 1
1307#define HCI_FILTER 2
1308#define HCI_TIME_STAMP 3
1309
1310/* CMSG flags */
1311#define HCI_CMSG_DIR 0x0001
1312#define HCI_CMSG_TSTAMP 0x0002
1313
1314struct sockaddr_hci {
1315 sa_family_t hci_family;
1316 unsigned short hci_dev;
c02178d2 1317 unsigned short hci_channel;
1da177e4
LT
1318};
1319#define HCI_DEV_NONE 0xffff
1320
c02178d2
JH
1321#define HCI_CHANNEL_RAW 0
1322#define HCI_CHANNEL_CONTROL 1
1323
1da177e4
LT
1324struct hci_filter {
1325 unsigned long type_mask;
1326 unsigned long event_mask[2];
a9de9248 1327 __le16 opcode;
1da177e4
LT
1328};
1329
1330struct hci_ufilter {
a9de9248
MH
1331 __u32 type_mask;
1332 __u32 event_mask[2];
1333 __le16 opcode;
1da177e4
LT
1334};
1335
1336#define HCI_FLT_TYPE_BITS 31
1337#define HCI_FLT_EVENT_BITS 63
1338#define HCI_FLT_OGF_BITS 63
1339#define HCI_FLT_OCF_BITS 127
1340
1341/* ---- HCI Ioctl requests structures ---- */
1342struct hci_dev_stats {
1343 __u32 err_rx;
1344 __u32 err_tx;
1345 __u32 cmd_tx;
1346 __u32 evt_rx;
1347 __u32 acl_tx;
1348 __u32 acl_rx;
1349 __u32 sco_tx;
1350 __u32 sco_rx;
1351 __u32 byte_rx;
1352 __u32 byte_tx;
1353};
1354
1355struct hci_dev_info {
1356 __u16 dev_id;
1357 char name[8];
1358
1359 bdaddr_t bdaddr;
1360
1361 __u32 flags;
1362 __u8 type;
1363
1364 __u8 features[8];
1365
1366 __u32 pkt_type;
1367 __u32 link_policy;
1368 __u32 link_mode;
1369
1370 __u16 acl_mtu;
1371 __u16 acl_pkts;
1372 __u16 sco_mtu;
1373 __u16 sco_pkts;
1374
1375 struct hci_dev_stats stat;
1376};
1377
1378struct hci_conn_info {
1379 __u16 handle;
1380 bdaddr_t bdaddr;
a9de9248
MH
1381 __u8 type;
1382 __u8 out;
1383 __u16 state;
1384 __u32 link_mode;
1da177e4
LT
1385};
1386
1387struct hci_dev_req {
a9de9248
MH
1388 __u16 dev_id;
1389 __u32 dev_opt;
1da177e4
LT
1390};
1391
1392struct hci_dev_list_req {
1393 __u16 dev_num;
1394 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1395};
1396
1397struct hci_conn_list_req {
1398 __u16 dev_id;
1399 __u16 conn_num;
1400 struct hci_conn_info conn_info[0];
1401};
1402
1403struct hci_conn_info_req {
1404 bdaddr_t bdaddr;
1405 __u8 type;
1406 struct hci_conn_info conn_info[0];
1407};
1408
40be492f
MH
1409struct hci_auth_info_req {
1410 bdaddr_t bdaddr;
1411 __u8 type;
1412};
1413
1da177e4
LT
1414struct hci_inquiry_req {
1415 __u16 dev_id;
1416 __u16 flags;
1417 __u8 lap[3];
1418 __u8 length;
1419 __u8 num_rsp;
1420};
1421#define IREQ_CACHE_FLUSH 0x0001
1422
8b281b9c 1423extern bool enable_hs;
8830f514 1424
1da177e4 1425#endif /* __HCI_H */
This page took 0.737369 seconds and 5 git commands to generate.