aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r--include/net/bluetooth/bluetooth.h33
-rw-r--r--include/net/bluetooth/hci.h139
-rw-r--r--include/net/bluetooth/hci_core.h173
-rw-r--r--include/net/bluetooth/l2cap.h53
-rw-r--r--include/net/bluetooth/mgmt.h171
-rw-r--r--include/net/bluetooth/smp.h76
6 files changed, 598 insertions, 47 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 0c5e72503b77..43750439c521 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -64,6 +64,11 @@ struct bt_security {
64 64
65#define BT_DEFER_SETUP 7 65#define BT_DEFER_SETUP 7
66 66
67#define BT_FLUSHABLE 8
68
69#define BT_FLUSHABLE_OFF 0
70#define BT_FLUSHABLE_ON 1
71
67#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 72#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
68#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 73#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
69#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) 74#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
@@ -200,4 +205,32 @@ extern void bt_sysfs_cleanup(void);
200 205
201extern struct dentry *bt_debugfs; 206extern struct dentry *bt_debugfs;
202 207
208#ifdef CONFIG_BT_L2CAP
209int l2cap_init(void);
210void l2cap_exit(void);
211#else
212static inline int l2cap_init(void)
213{
214 return 0;
215}
216
217static inline void l2cap_exit(void)
218{
219}
220#endif
221
222#ifdef CONFIG_BT_SCO
223int sco_init(void);
224void sco_exit(void);
225#else
226static inline int sco_init(void)
227{
228 return 0;
229}
230
231static inline void sco_exit(void)
232{
233}
234#endif
235
203#endif /* __BLUETOOTH_H */ 236#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 29a7a8ca0438..ec6acf2f1c0b 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -76,6 +76,14 @@ enum {
76 HCI_INQUIRY, 76 HCI_INQUIRY,
77 77
78 HCI_RAW, 78 HCI_RAW,
79
80 HCI_SETUP,
81 HCI_AUTO_OFF,
82 HCI_MGMT,
83 HCI_PAIRABLE,
84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS,
79}; 87};
80 88
81/* HCI ioctl defines */ 89/* HCI ioctl defines */
@@ -111,6 +119,7 @@ enum {
111#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 119#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
112#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 120#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
113#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 121#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
122#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
114 123
115/* HCI data types */ 124/* HCI data types */
116#define HCI_COMMAND_PKT 0x01 125#define HCI_COMMAND_PKT 0x01
@@ -150,6 +159,7 @@ enum {
150#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 159#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
151 160
152/* ACL flags */ 161/* ACL flags */
162#define ACL_START_NO_FLUSH 0x00
153#define ACL_CONT 0x01 163#define ACL_CONT 0x01
154#define ACL_START 0x02 164#define ACL_START 0x02
155#define ACL_ACTIVE_BCAST 0x04 165#define ACL_ACTIVE_BCAST 0x04
@@ -159,6 +169,8 @@ enum {
159#define SCO_LINK 0x00 169#define SCO_LINK 0x00
160#define ACL_LINK 0x01 170#define ACL_LINK 0x01
161#define ESCO_LINK 0x02 171#define ESCO_LINK 0x02
172/* Low Energy links do not have defined link type. Use invented one */
173#define LE_LINK 0x80
162 174
163/* LMP features */ 175/* LMP features */
164#define LMP_3SLOT 0x01 176#define LMP_3SLOT 0x01
@@ -183,17 +195,25 @@ enum {
183#define LMP_PSCHEME 0x02 195#define LMP_PSCHEME 0x02
184#define LMP_PCONTROL 0x04 196#define LMP_PCONTROL 0x04
185 197
198#define LMP_RSSI_INQ 0x40
186#define LMP_ESCO 0x80 199#define LMP_ESCO 0x80
187 200
188#define LMP_EV4 0x01 201#define LMP_EV4 0x01
189#define LMP_EV5 0x02 202#define LMP_EV5 0x02
203#define LMP_LE 0x40
190 204
191#define LMP_SNIFF_SUBR 0x02 205#define LMP_SNIFF_SUBR 0x02
206#define LMP_PAUSE_ENC 0x04
192#define LMP_EDR_ESCO_2M 0x20 207#define LMP_EDR_ESCO_2M 0x20
193#define LMP_EDR_ESCO_3M 0x40 208#define LMP_EDR_ESCO_3M 0x40
194#define LMP_EDR_3S_ESCO 0x80 209#define LMP_EDR_3S_ESCO 0x80
195 210
211#define LMP_EXT_INQ 0x01
196#define LMP_SIMPLE_PAIR 0x08 212#define LMP_SIMPLE_PAIR 0x08
213#define LMP_NO_FLUSH 0x40
214
215#define LMP_LSTO 0x01
216#define LMP_INQ_TX_PWR 0x02
197 217
198/* Connection modes */ 218/* Connection modes */
199#define HCI_CM_ACTIVE 0x0000 219#define HCI_CM_ACTIVE 0x0000
@@ -225,6 +245,8 @@ enum {
225#define HCI_AT_GENERAL_BONDING_MITM 0x05 245#define HCI_AT_GENERAL_BONDING_MITM 0x05
226 246
227/* ----- HCI Commands ---- */ 247/* ----- HCI Commands ---- */
248#define HCI_OP_NOP 0x0000
249
228#define HCI_OP_INQUIRY 0x0401 250#define HCI_OP_INQUIRY 0x0401
229struct hci_cp_inquiry { 251struct hci_cp_inquiry {
230 __u8 lap[3]; 252 __u8 lap[3];
@@ -292,11 +314,19 @@ struct hci_cp_pin_code_reply {
292 __u8 pin_len; 314 __u8 pin_len;
293 __u8 pin_code[16]; 315 __u8 pin_code[16];
294} __packed; 316} __packed;
317struct hci_rp_pin_code_reply {
318 __u8 status;
319 bdaddr_t bdaddr;
320} __packed;
295 321
296#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 322#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
297struct hci_cp_pin_code_neg_reply { 323struct hci_cp_pin_code_neg_reply {
298 bdaddr_t bdaddr; 324 bdaddr_t bdaddr;
299} __packed; 325} __packed;
326struct hci_rp_pin_code_neg_reply {
327 __u8 status;
328 bdaddr_t bdaddr;
329} __packed;
300 330
301#define HCI_OP_CHANGE_CONN_PTYPE 0x040f 331#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
302struct hci_cp_change_conn_ptype { 332struct hci_cp_change_conn_ptype {
@@ -377,6 +407,31 @@ struct hci_cp_reject_sync_conn_req {
377 __u8 reason; 407 __u8 reason;
378} __packed; 408} __packed;
379 409
410#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
411struct hci_cp_io_capability_reply {
412 bdaddr_t bdaddr;
413 __u8 capability;
414 __u8 oob_data;
415 __u8 authentication;
416} __packed;
417
418#define HCI_OP_USER_CONFIRM_REPLY 0x042c
419struct hci_cp_user_confirm_reply {
420 bdaddr_t bdaddr;
421} __packed;
422struct hci_rp_user_confirm_reply {
423 __u8 status;
424 bdaddr_t bdaddr;
425} __packed;
426
427#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
428
429#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
430struct hci_cp_io_capability_neg_reply {
431 bdaddr_t bdaddr;
432 __u8 reason;
433} __packed;
434
380#define HCI_OP_SNIFF_MODE 0x0803 435#define HCI_OP_SNIFF_MODE 0x0803
381struct hci_cp_sniff_mode { 436struct hci_cp_sniff_mode {
382 __le16 handle; 437 __le16 handle;
@@ -474,6 +529,12 @@ struct hci_cp_set_event_flt {
474#define HCI_CONN_SETUP_AUTO_OFF 0x01 529#define HCI_CONN_SETUP_AUTO_OFF 0x01
475#define HCI_CONN_SETUP_AUTO_ON 0x02 530#define HCI_CONN_SETUP_AUTO_ON 0x02
476 531
532#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
533struct hci_cp_delete_stored_link_key {
534 bdaddr_t bdaddr;
535 __u8 delete_all;
536} __packed;
537
477#define HCI_OP_WRITE_LOCAL_NAME 0x0c13 538#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
478struct hci_cp_write_local_name { 539struct hci_cp_write_local_name {
479 __u8 name[248]; 540 __u8 name[248];
@@ -537,6 +598,8 @@ struct hci_cp_host_buffer_size {
537 __le16 sco_max_pkt; 598 __le16 sco_max_pkt;
538} __packed; 599} __packed;
539 600
601#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
602
540#define HCI_OP_READ_SSP_MODE 0x0c55 603#define HCI_OP_READ_SSP_MODE 0x0c55
541struct hci_rp_read_ssp_mode { 604struct hci_rp_read_ssp_mode {
542 __u8 status; 605 __u8 status;
@@ -548,6 +611,8 @@ struct hci_cp_write_ssp_mode {
548 __u8 mode; 611 __u8 mode;
549} __packed; 612} __packed;
550 613
614#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
615
551#define HCI_OP_READ_LOCAL_VERSION 0x1001 616#define HCI_OP_READ_LOCAL_VERSION 0x1001
552struct hci_rp_read_local_version { 617struct hci_rp_read_local_version {
553 __u8 status; 618 __u8 status;
@@ -593,6 +658,47 @@ struct hci_rp_read_bd_addr {
593 bdaddr_t bdaddr; 658 bdaddr_t bdaddr;
594} __packed; 659} __packed;
595 660
661#define HCI_OP_LE_SET_EVENT_MASK 0x2001
662struct hci_cp_le_set_event_mask {
663 __u8 mask[8];
664} __packed;
665
666#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
667struct hci_rp_le_read_buffer_size {
668 __u8 status;
669 __le16 le_mtu;
670 __u8 le_max_pkt;
671} __packed;
672
673#define HCI_OP_LE_CREATE_CONN 0x200d
674struct hci_cp_le_create_conn {
675 __le16 scan_interval;
676 __le16 scan_window;
677 __u8 filter_policy;
678 __u8 peer_addr_type;
679 bdaddr_t peer_addr;
680 __u8 own_address_type;
681 __le16 conn_interval_min;
682 __le16 conn_interval_max;
683 __le16 conn_latency;
684 __le16 supervision_timeout;
685 __le16 min_ce_len;
686 __le16 max_ce_len;
687} __packed;
688
689#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
690
691#define HCI_OP_LE_CONN_UPDATE 0x2013
692struct hci_cp_le_conn_update {
693 __le16 handle;
694 __le16 conn_interval_min;
695 __le16 conn_interval_max;
696 __le16 conn_latency;
697 __le16 supervision_timeout;
698 __le16 min_ce_len;
699 __le16 max_ce_len;
700} __packed;
701
596/* ---- HCI Events ---- */ 702/* ---- HCI Events ---- */
597#define HCI_EV_INQUIRY_COMPLETE 0x01 703#define HCI_EV_INQUIRY_COMPLETE 0x01
598 704
@@ -833,6 +939,20 @@ struct hci_ev_io_capa_request {
833 bdaddr_t bdaddr; 939 bdaddr_t bdaddr;
834} __packed; 940} __packed;
835 941
942#define HCI_EV_IO_CAPA_REPLY 0x32
943struct hci_ev_io_capa_reply {
944 bdaddr_t bdaddr;
945 __u8 capability;
946 __u8 oob_data;
947 __u8 authentication;
948} __packed;
949
950#define HCI_EV_USER_CONFIRM_REQUEST 0x33
951struct hci_ev_user_confirm_req {
952 bdaddr_t bdaddr;
953 __le32 passkey;
954} __packed;
955
836#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 956#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
837struct hci_ev_simple_pair_complete { 957struct hci_ev_simple_pair_complete {
838 __u8 status; 958 __u8 status;
@@ -845,6 +965,25 @@ struct hci_ev_remote_host_features {
845 __u8 features[8]; 965 __u8 features[8];
846} __packed; 966} __packed;
847 967
968#define HCI_EV_LE_META 0x3e
969struct hci_ev_le_meta {
970 __u8 subevent;
971} __packed;
972
973/* Low energy meta events */
974#define HCI_EV_LE_CONN_COMPLETE 0x01
975struct hci_ev_le_conn_complete {
976 __u8 status;
977 __le16 handle;
978 __u8 role;
979 __u8 bdaddr_type;
980 bdaddr_t bdaddr;
981 __le16 interval;
982 __le16 latency;
983 __le16 supervision_timeout;
984 __u8 clk_accurancy;
985} __packed;
986
848/* Internal events generated by Bluetooth stack */ 987/* Internal events generated by Bluetooth stack */
849#define HCI_EV_STACK_INTERNAL 0xfd 988#define HCI_EV_STACK_INTERNAL 0xfd
850struct hci_ev_stack_internal { 989struct hci_ev_stack_internal {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d2cf88407690..441dadbf6a89 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -60,12 +60,28 @@ struct hci_conn_hash {
60 spinlock_t lock; 60 spinlock_t lock;
61 unsigned int acl_num; 61 unsigned int acl_num;
62 unsigned int sco_num; 62 unsigned int sco_num;
63 unsigned int le_num;
63}; 64};
64 65
65struct bdaddr_list { 66struct bdaddr_list {
66 struct list_head list; 67 struct list_head list;
67 bdaddr_t bdaddr; 68 bdaddr_t bdaddr;
68}; 69};
70
71struct bt_uuid {
72 struct list_head list;
73 u8 uuid[16];
74 u8 svc_hint;
75};
76
77struct link_key {
78 struct list_head list;
79 bdaddr_t bdaddr;
80 u8 type;
81 u8 val[16];
82 u8 pin_len;
83};
84
69#define NUM_REASSEMBLY 4 85#define NUM_REASSEMBLY 4
70struct hci_dev { 86struct hci_dev {
71 struct list_head list; 87 struct list_head list;
@@ -80,13 +96,18 @@ struct hci_dev {
80 bdaddr_t bdaddr; 96 bdaddr_t bdaddr;
81 __u8 dev_name[248]; 97 __u8 dev_name[248];
82 __u8 dev_class[3]; 98 __u8 dev_class[3];
99 __u8 major_class;
100 __u8 minor_class;
83 __u8 features[8]; 101 __u8 features[8];
84 __u8 commands[64]; 102 __u8 commands[64];
85 __u8 ssp_mode; 103 __u8 ssp_mode;
86 __u8 hci_ver; 104 __u8 hci_ver;
87 __u16 hci_rev; 105 __u16 hci_rev;
106 __u8 lmp_ver;
88 __u16 manufacturer; 107 __u16 manufacturer;
108 __le16 lmp_subver;
89 __u16 voice_setting; 109 __u16 voice_setting;
110 __u8 io_capability;
90 111
91 __u16 pkt_type; 112 __u16 pkt_type;
92 __u16 esco_type; 113 __u16 esco_type;
@@ -102,18 +123,26 @@ struct hci_dev {
102 atomic_t cmd_cnt; 123 atomic_t cmd_cnt;
103 unsigned int acl_cnt; 124 unsigned int acl_cnt;
104 unsigned int sco_cnt; 125 unsigned int sco_cnt;
126 unsigned int le_cnt;
105 127
106 unsigned int acl_mtu; 128 unsigned int acl_mtu;
107 unsigned int sco_mtu; 129 unsigned int sco_mtu;
130 unsigned int le_mtu;
108 unsigned int acl_pkts; 131 unsigned int acl_pkts;
109 unsigned int sco_pkts; 132 unsigned int sco_pkts;
133 unsigned int le_pkts;
110 134
111 unsigned long cmd_last_tx;
112 unsigned long acl_last_tx; 135 unsigned long acl_last_tx;
113 unsigned long sco_last_tx; 136 unsigned long sco_last_tx;
137 unsigned long le_last_tx;
114 138
115 struct workqueue_struct *workqueue; 139 struct workqueue_struct *workqueue;
116 140
141 struct work_struct power_on;
142 struct work_struct power_off;
143 struct timer_list off_timer;
144
145 struct timer_list cmd_timer;
117 struct tasklet_struct cmd_task; 146 struct tasklet_struct cmd_task;
118 struct tasklet_struct rx_task; 147 struct tasklet_struct rx_task;
119 struct tasklet_struct tx_task; 148 struct tasklet_struct tx_task;
@@ -129,12 +158,17 @@ struct hci_dev {
129 wait_queue_head_t req_wait_q; 158 wait_queue_head_t req_wait_q;
130 __u32 req_status; 159 __u32 req_status;
131 __u32 req_result; 160 __u32 req_result;
132 __u16 req_last_cmd; 161
162 __u16 init_last_cmd;
133 163
134 struct inquiry_cache inq_cache; 164 struct inquiry_cache inq_cache;
135 struct hci_conn_hash conn_hash; 165 struct hci_conn_hash conn_hash;
136 struct list_head blacklist; 166 struct list_head blacklist;
137 167
168 struct list_head uuids;
169
170 struct list_head link_keys;
171
138 struct hci_dev_stats stat; 172 struct hci_dev_stats stat;
139 173
140 struct sk_buff_head driver_init; 174 struct sk_buff_head driver_init;
@@ -165,31 +199,37 @@ struct hci_dev {
165struct hci_conn { 199struct hci_conn {
166 struct list_head list; 200 struct list_head list;
167 201
168 atomic_t refcnt; 202 atomic_t refcnt;
169 spinlock_t lock; 203 spinlock_t lock;
170 204
171 bdaddr_t dst; 205 bdaddr_t dst;
172 __u16 handle; 206 __u16 handle;
173 __u16 state; 207 __u16 state;
174 __u8 mode; 208 __u8 mode;
175 __u8 type; 209 __u8 type;
176 __u8 out; 210 __u8 out;
177 __u8 attempt; 211 __u8 attempt;
178 __u8 dev_class[3]; 212 __u8 dev_class[3];
179 __u8 features[8]; 213 __u8 features[8];
180 __u8 ssp_mode; 214 __u8 ssp_mode;
181 __u16 interval; 215 __u16 interval;
182 __u16 pkt_type; 216 __u16 pkt_type;
183 __u16 link_policy; 217 __u16 link_policy;
184 __u32 link_mode; 218 __u32 link_mode;
185 __u8 auth_type; 219 __u8 auth_type;
186 __u8 sec_level; 220 __u8 sec_level;
187 __u8 pending_sec_level; 221 __u8 pending_sec_level;
188 __u8 power_save; 222 __u8 pin_length;
189 __u16 disc_timeout; 223 __u8 io_capability;
190 unsigned long pend; 224 __u8 power_save;
191 225 __u16 disc_timeout;
192 unsigned int sent; 226 unsigned long pend;
227
228 __u8 remote_cap;
229 __u8 remote_oob;
230 __u8 remote_auth;
231
232 unsigned int sent;
193 233
194 struct sk_buff_head data_q; 234 struct sk_buff_head data_q;
195 235
@@ -208,6 +248,10 @@ struct hci_conn {
208 void *priv; 248 void *priv;
209 249
210 struct hci_conn *link; 250 struct hci_conn *link;
251
252 void (*connect_cfm_cb) (struct hci_conn *conn, u8 status);
253 void (*security_cfm_cb) (struct hci_conn *conn, u8 status);
254 void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason);
211}; 255};
212 256
213extern struct hci_proto *hci_proto[]; 257extern struct hci_proto *hci_proto[];
@@ -274,24 +318,40 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
274{ 318{
275 struct hci_conn_hash *h = &hdev->conn_hash; 319 struct hci_conn_hash *h = &hdev->conn_hash;
276 list_add(&c->list, &h->list); 320 list_add(&c->list, &h->list);
277 if (c->type == ACL_LINK) 321 switch (c->type) {
322 case ACL_LINK:
278 h->acl_num++; 323 h->acl_num++;
279 else 324 break;
325 case LE_LINK:
326 h->le_num++;
327 break;
328 case SCO_LINK:
329 case ESCO_LINK:
280 h->sco_num++; 330 h->sco_num++;
331 break;
332 }
281} 333}
282 334
283static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) 335static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
284{ 336{
285 struct hci_conn_hash *h = &hdev->conn_hash; 337 struct hci_conn_hash *h = &hdev->conn_hash;
286 list_del(&c->list); 338 list_del(&c->list);
287 if (c->type == ACL_LINK) 339 switch (c->type) {
340 case ACL_LINK:
288 h->acl_num--; 341 h->acl_num--;
289 else 342 break;
343 case LE_LINK:
344 h->le_num--;
345 break;
346 case SCO_LINK:
347 case ESCO_LINK:
290 h->sco_num--; 348 h->sco_num--;
349 break;
350 }
291} 351}
292 352
293static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 353static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
294 __u16 handle) 354 __u16 handle)
295{ 355{
296 struct hci_conn_hash *h = &hdev->conn_hash; 356 struct hci_conn_hash *h = &hdev->conn_hash;
297 struct list_head *p; 357 struct list_head *p;
@@ -306,7 +366,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
306} 366}
307 367
308static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, 368static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
309 __u8 type, bdaddr_t *ba) 369 __u8 type, bdaddr_t *ba)
310{ 370{
311 struct hci_conn_hash *h = &hdev->conn_hash; 371 struct hci_conn_hash *h = &hdev->conn_hash;
312 struct list_head *p; 372 struct list_head *p;
@@ -321,7 +381,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
321} 381}
322 382
323static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, 383static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
324 __u8 type, __u16 state) 384 __u8 type, __u16 state)
325{ 385{
326 struct hci_conn_hash *h = &hdev->conn_hash; 386 struct hci_conn_hash *h = &hdev->conn_hash;
327 struct list_head *p; 387 struct list_head *p;
@@ -437,6 +497,16 @@ int hci_inquiry(void __user *arg);
437struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 497struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
438int hci_blacklist_clear(struct hci_dev *hdev); 498int hci_blacklist_clear(struct hci_dev *hdev);
439 499
500int hci_uuids_clear(struct hci_dev *hdev);
501
502int hci_link_keys_clear(struct hci_dev *hdev);
503struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
504int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr,
505 u8 *key, u8 type, u8 pin_len);
506int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
507
508void hci_del_off_timer(struct hci_dev *hdev);
509
440void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 510void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
441 511
442int hci_recv_frame(struct sk_buff *skb); 512int hci_recv_frame(struct sk_buff *skb);
@@ -458,6 +528,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
458#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 528#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
459#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 529#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
460#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 530#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
531#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
532#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
461 533
462/* ----- HCI protocols ----- */ 534/* ----- HCI protocols ----- */
463struct hci_proto { 535struct hci_proto {
@@ -503,6 +575,9 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
503 hp = hci_proto[HCI_PROTO_SCO]; 575 hp = hci_proto[HCI_PROTO_SCO];
504 if (hp && hp->connect_cfm) 576 if (hp && hp->connect_cfm)
505 hp->connect_cfm(conn, status); 577 hp->connect_cfm(conn, status);
578
579 if (conn->connect_cfm_cb)
580 conn->connect_cfm_cb(conn, status);
506} 581}
507 582
508static inline int hci_proto_disconn_ind(struct hci_conn *conn) 583static inline int hci_proto_disconn_ind(struct hci_conn *conn)
@@ -532,6 +607,9 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
532 hp = hci_proto[HCI_PROTO_SCO]; 607 hp = hci_proto[HCI_PROTO_SCO];
533 if (hp && hp->disconn_cfm) 608 if (hp && hp->disconn_cfm)
534 hp->disconn_cfm(conn, reason); 609 hp->disconn_cfm(conn, reason);
610
611 if (conn->disconn_cfm_cb)
612 conn->disconn_cfm_cb(conn, reason);
535} 613}
536 614
537static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) 615static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
@@ -551,6 +629,9 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
551 hp = hci_proto[HCI_PROTO_SCO]; 629 hp = hci_proto[HCI_PROTO_SCO];
552 if (hp && hp->security_cfm) 630 if (hp && hp->security_cfm)
553 hp->security_cfm(conn, status, encrypt); 631 hp->security_cfm(conn, status, encrypt);
632
633 if (conn->security_cfm_cb)
634 conn->security_cfm_cb(conn, status);
554} 635}
555 636
556static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) 637static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt)
@@ -564,6 +645,9 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u
564 hp = hci_proto[HCI_PROTO_SCO]; 645 hp = hci_proto[HCI_PROTO_SCO];
565 if (hp && hp->security_cfm) 646 if (hp && hp->security_cfm)
566 hp->security_cfm(conn, status, encrypt); 647 hp->security_cfm(conn, status, encrypt);
648
649 if (conn->security_cfm_cb)
650 conn->security_cfm_cb(conn, status);
567} 651}
568 652
569int hci_register_proto(struct hci_proto *hproto); 653int hci_register_proto(struct hci_proto *hproto);
@@ -660,12 +744,29 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
660void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); 744void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
661 745
662/* ----- HCI Sockets ----- */ 746/* ----- HCI Sockets ----- */
663void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); 747void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
748 struct sock *skip_sk);
664 749
665/* Management interface */ 750/* Management interface */
666int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 751int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
667int mgmt_index_added(u16 index); 752int mgmt_index_added(u16 index);
668int mgmt_index_removed(u16 index); 753int mgmt_index_removed(u16 index);
754int mgmt_powered(u16 index, u8 powered);
755int mgmt_discoverable(u16 index, u8 discoverable);
756int mgmt_connectable(u16 index, u8 connectable);
757int mgmt_new_key(u16 index, struct link_key *key, u8 old_key_type);
758int mgmt_connected(u16 index, bdaddr_t *bdaddr);
759int mgmt_disconnected(u16 index, bdaddr_t *bdaddr);
760int mgmt_disconnect_failed(u16 index);
761int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
762int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr);
763int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
764int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
765int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value);
766int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
767int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr,
768 u8 status);
769int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status);
669 770
670/* HCI info for socket */ 771/* HCI info for socket */
671#define hci_pi(sk) ((struct hci_pinfo *) sk) 772#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -697,4 +798,6 @@ struct hci_sec_filter {
697 798
698void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); 799void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result);
699 800
801void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
802 u16 latency, u16 to_multiplier);
700#endif /* __HCI_CORE_H */ 803#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7ad25ca60ec0..4f4bff1eaed6 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -38,6 +38,7 @@
38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
39#define L2CAP_DEFAULT_ACK_TO 200 39#define L2CAP_DEFAULT_ACK_TO 200
40#define L2CAP_LOCAL_BUSY_TRIES 12 40#define L2CAP_LOCAL_BUSY_TRIES 12
41#define L2CAP_LE_DEFAULT_MTU 23
41 42
42#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 43#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
43#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 44#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -88,6 +89,8 @@ struct l2cap_conninfo {
88#define L2CAP_ECHO_RSP 0x09 89#define L2CAP_ECHO_RSP 0x09
89#define L2CAP_INFO_REQ 0x0a 90#define L2CAP_INFO_REQ 0x0a
90#define L2CAP_INFO_RSP 0x0b 91#define L2CAP_INFO_RSP 0x0b
92#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12
93#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13
91 94
92/* L2CAP feature mask */ 95/* L2CAP feature mask */
93#define L2CAP_FEAT_FLOWCTL 0x00000001 96#define L2CAP_FEAT_FLOWCTL 0x00000001
@@ -160,6 +163,9 @@ struct l2cap_conn_rsp {
160/* channel indentifier */ 163/* channel indentifier */
161#define L2CAP_CID_SIGNALING 0x0001 164#define L2CAP_CID_SIGNALING 0x0001
162#define L2CAP_CID_CONN_LESS 0x0002 165#define L2CAP_CID_CONN_LESS 0x0002
166#define L2CAP_CID_LE_DATA 0x0004
167#define L2CAP_CID_LE_SIGNALING 0x0005
168#define L2CAP_CID_SMP 0x0006
163#define L2CAP_CID_DYN_START 0x0040 169#define L2CAP_CID_DYN_START 0x0040
164#define L2CAP_CID_DYN_END 0xffff 170#define L2CAP_CID_DYN_END 0xffff
165 171
@@ -255,6 +261,21 @@ struct l2cap_info_rsp {
255#define L2CAP_IR_SUCCESS 0x0000 261#define L2CAP_IR_SUCCESS 0x0000
256#define L2CAP_IR_NOTSUPP 0x0001 262#define L2CAP_IR_NOTSUPP 0x0001
257 263
264struct l2cap_conn_param_update_req {
265 __le16 min;
266 __le16 max;
267 __le16 latency;
268 __le16 to_multiplier;
269} __packed;
270
271struct l2cap_conn_param_update_rsp {
272 __le16 result;
273} __packed;
274
275/* Connection Parameters result */
276#define L2CAP_CONN_PARAM_ACCEPTED 0x0000
277#define L2CAP_CONN_PARAM_REJECTED 0x0001
278
258/* ----- L2CAP connections ----- */ 279/* ----- L2CAP connections ----- */
259struct l2cap_chan_list { 280struct l2cap_chan_list {
260 struct sock *head; 281 struct sock *head;
@@ -327,6 +348,7 @@ struct l2cap_pinfo {
327 __u8 sec_level; 348 __u8 sec_level;
328 __u8 role_switch; 349 __u8 role_switch;
329 __u8 force_reliable; 350 __u8 force_reliable;
351 __u8 flushable;
330 352
331 __u8 conf_req[64]; 353 __u8 conf_req[64];
332 __u8 conf_len; 354 __u8 conf_len;
@@ -423,6 +445,35 @@ static inline int l2cap_tx_window_full(struct sock *sk)
423#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) 445#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE)
424#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) 446#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START)
425 447
426void l2cap_load(void); 448extern int disable_ertm;
449extern const struct proto_ops l2cap_sock_ops;
450extern struct bt_sock_list l2cap_sk_list;
451
452int l2cap_init_sockets(void);
453void l2cap_cleanup_sockets(void);
454
455u8 l2cap_get_ident(struct l2cap_conn *conn);
456void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data);
457int l2cap_build_conf_req(struct sock *sk, void *data);
458int __l2cap_wait_ack(struct sock *sk);
459
460struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len);
461struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len);
462struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen);
463int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, size_t len);
464void l2cap_do_send(struct sock *sk, struct sk_buff *skb);
465void l2cap_streaming_send(struct sock *sk);
466int l2cap_ertm_send(struct sock *sk);
467
468void l2cap_sock_set_timer(struct sock *sk, long timeout);
469void l2cap_sock_clear_timer(struct sock *sk);
470void __l2cap_sock_close(struct sock *sk, int reason);
471void l2cap_sock_kill(struct sock *sk);
472void l2cap_sock_init(struct sock *sk, struct sock *parent);
473struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
474 int proto, gfp_t prio);
475void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err);
476void l2cap_chan_del(struct sock *sk, int err);
477int l2cap_do_connect(struct sock *sk);
427 478
428#endif /* __L2CAP_H */ 479#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index ca29c1367ffd..5fabfa886b3e 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -21,11 +21,13 @@
21 SOFTWARE IS DISCLAIMED. 21 SOFTWARE IS DISCLAIMED.
22*/ 22*/
23 23
24#define MGMT_INDEX_NONE 0xFFFF
25
24struct mgmt_hdr { 26struct mgmt_hdr {
25 __le16 opcode; 27 __le16 opcode;
28 __le16 index;
26 __le16 len; 29 __le16 len;
27} __packed; 30} __packed;
28#define MGMT_HDR_SIZE 4
29 31
30#define MGMT_OP_READ_VERSION 0x0001 32#define MGMT_OP_READ_VERSION 0x0001
31struct mgmt_rp_read_version { 33struct mgmt_rp_read_version {
@@ -40,13 +42,10 @@ struct mgmt_rp_read_index_list {
40} __packed; 42} __packed;
41 43
42#define MGMT_OP_READ_INFO 0x0004 44#define MGMT_OP_READ_INFO 0x0004
43struct mgmt_cp_read_info {
44 __le16 index;
45} __packed;
46struct mgmt_rp_read_info { 45struct mgmt_rp_read_info {
47 __le16 index;
48 __u8 type; 46 __u8 type;
49 __u8 powered; 47 __u8 powered;
48 __u8 connectable;
50 __u8 discoverable; 49 __u8 discoverable;
51 __u8 pairable; 50 __u8 pairable;
52 __u8 sec_mode; 51 __u8 sec_mode;
@@ -58,6 +57,116 @@ struct mgmt_rp_read_info {
58 __u16 hci_rev; 57 __u16 hci_rev;
59} __packed; 58} __packed;
60 59
60struct mgmt_mode {
61 __u8 val;
62} __packed;
63
64#define MGMT_OP_SET_POWERED 0x0005
65
66#define MGMT_OP_SET_DISCOVERABLE 0x0006
67
68#define MGMT_OP_SET_CONNECTABLE 0x0007
69
70#define MGMT_OP_SET_PAIRABLE 0x0008
71
72#define MGMT_OP_ADD_UUID 0x0009
73struct mgmt_cp_add_uuid {
74 __u8 uuid[16];
75 __u8 svc_hint;
76} __packed;
77
78#define MGMT_OP_REMOVE_UUID 0x000A
79struct mgmt_cp_remove_uuid {
80 __u8 uuid[16];
81} __packed;
82
83#define MGMT_OP_SET_DEV_CLASS 0x000B
84struct mgmt_cp_set_dev_class {
85 __u8 major;
86 __u8 minor;
87} __packed;
88
89#define MGMT_OP_SET_SERVICE_CACHE 0x000C
90struct mgmt_cp_set_service_cache {
91 __u8 enable;
92} __packed;
93
94struct mgmt_key_info {
95 bdaddr_t bdaddr;
96 u8 type;
97 u8 val[16];
98 u8 pin_len;
99} __packed;
100
101#define MGMT_OP_LOAD_KEYS 0x000D
102struct mgmt_cp_load_keys {
103 __u8 debug_keys;
104 __le16 key_count;
105 struct mgmt_key_info keys[0];
106} __packed;
107
108#define MGMT_OP_REMOVE_KEY 0x000E
109struct mgmt_cp_remove_key {
110 bdaddr_t bdaddr;
111 __u8 disconnect;
112} __packed;
113
114#define MGMT_OP_DISCONNECT 0x000F
115struct mgmt_cp_disconnect {
116 bdaddr_t bdaddr;
117} __packed;
118struct mgmt_rp_disconnect {
119 bdaddr_t bdaddr;
120} __packed;
121
122#define MGMT_OP_GET_CONNECTIONS 0x0010
123struct mgmt_rp_get_connections {
124 __le16 conn_count;
125 bdaddr_t conn[0];
126} __packed;
127
128#define MGMT_OP_PIN_CODE_REPLY 0x0011
129struct mgmt_cp_pin_code_reply {
130 bdaddr_t bdaddr;
131 __u8 pin_len;
132 __u8 pin_code[16];
133} __packed;
134struct mgmt_rp_pin_code_reply {
135 bdaddr_t bdaddr;
136 uint8_t status;
137} __packed;
138
139#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012
140struct mgmt_cp_pin_code_neg_reply {
141 bdaddr_t bdaddr;
142} __packed;
143
144#define MGMT_OP_SET_IO_CAPABILITY 0x0013
145struct mgmt_cp_set_io_capability {
146 __u8 io_capability;
147} __packed;
148
149#define MGMT_OP_PAIR_DEVICE 0x0014
150struct mgmt_cp_pair_device {
151 bdaddr_t bdaddr;
152 __u8 io_cap;
153} __packed;
154struct mgmt_rp_pair_device {
155 bdaddr_t bdaddr;
156 __u8 status;
157} __packed;
158
159#define MGMT_OP_USER_CONFIRM_REPLY 0x0015
160struct mgmt_cp_user_confirm_reply {
161 bdaddr_t bdaddr;
162} __packed;
163struct mgmt_rp_user_confirm_reply {
164 bdaddr_t bdaddr;
165 __u8 status;
166} __packed;
167
168#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016
169
61#define MGMT_EV_CMD_COMPLETE 0x0001 170#define MGMT_EV_CMD_COMPLETE 0x0001
62struct mgmt_ev_cmd_complete { 171struct mgmt_ev_cmd_complete {
63 __le16 opcode; 172 __le16 opcode;
@@ -72,16 +181,56 @@ struct mgmt_ev_cmd_status {
72 181
73#define MGMT_EV_CONTROLLER_ERROR 0x0003 182#define MGMT_EV_CONTROLLER_ERROR 0x0003
74struct mgmt_ev_controller_error { 183struct mgmt_ev_controller_error {
75 __le16 index;
76 __u8 error_code; 184 __u8 error_code;
77} __packed; 185} __packed;
78 186
79#define MGMT_EV_INDEX_ADDED 0x0004 187#define MGMT_EV_INDEX_ADDED 0x0004
80struct mgmt_ev_index_added {
81 __le16 index;
82} __packed;
83 188
84#define MGMT_EV_INDEX_REMOVED 0x0005 189#define MGMT_EV_INDEX_REMOVED 0x0005
85struct mgmt_ev_index_removed { 190
86 __le16 index; 191#define MGMT_EV_POWERED 0x0006
192
193#define MGMT_EV_DISCOVERABLE 0x0007
194
195#define MGMT_EV_CONNECTABLE 0x0008
196
197#define MGMT_EV_PAIRABLE 0x0009
198
199#define MGMT_EV_NEW_KEY 0x000A
200struct mgmt_ev_new_key {
201 struct mgmt_key_info key;
202 __u8 old_key_type;
203} __packed;
204
205#define MGMT_EV_CONNECTED 0x000B
206struct mgmt_ev_connected {
207 bdaddr_t bdaddr;
208} __packed;
209
210#define MGMT_EV_DISCONNECTED 0x000C
211struct mgmt_ev_disconnected {
212 bdaddr_t bdaddr;
213} __packed;
214
215#define MGMT_EV_CONNECT_FAILED 0x000D
216struct mgmt_ev_connect_failed {
217 bdaddr_t bdaddr;
218 __u8 status;
219} __packed;
220
221#define MGMT_EV_PIN_CODE_REQUEST 0x000E
222struct mgmt_ev_pin_code_request {
223 bdaddr_t bdaddr;
224} __packed;
225
226#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
227struct mgmt_ev_user_confirm_request {
228 bdaddr_t bdaddr;
229 __le32 value;
230} __packed;
231
232#define MGMT_EV_AUTH_FAILED 0x0010
233struct mgmt_ev_auth_failed {
234 bdaddr_t bdaddr;
235 __u8 status;
87} __packed; 236} __packed;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
new file mode 100644
index 000000000000..8f2edbf979dc
--- /dev/null
+++ b/include/net/bluetooth/smp.h
@@ -0,0 +1,76 @@
1#ifndef __SMP_H
2#define __SMP_H
3
4struct smp_command_hdr {
5 __u8 code;
6} __packed;
7
8#define SMP_CMD_PAIRING_REQ 0x01
9#define SMP_CMD_PAIRING_RSP 0x02
10struct smp_cmd_pairing {
11 __u8 io_capability;
12 __u8 oob_flag;
13 __u8 auth_req;
14 __u8 max_key_size;
15 __u8 init_key_dist;
16 __u8 resp_key_dist;
17} __packed;
18
19#define SMP_CMD_PAIRING_CONFIRM 0x03
20struct smp_cmd_pairing_confirm {
21 __u8 confirm_val[16];
22} __packed;
23
24#define SMP_CMD_PAIRING_RANDOM 0x04
25struct smp_cmd_pairing_random {
26 __u8 rand_val[16];
27} __packed;
28
29#define SMP_CMD_PAIRING_FAIL 0x05
30struct smp_cmd_pairing_fail {
31 __u8 reason;
32} __packed;
33
34#define SMP_CMD_ENCRYPT_INFO 0x06
35struct smp_cmd_encrypt_info {
36 __u8 ltk[16];
37} __packed;
38
39#define SMP_CMD_MASTER_IDENT 0x07
40struct smp_cmd_master_ident {
41 __u16 ediv;
42 __u8 rand[8];
43} __packed;
44
45#define SMP_CMD_IDENT_INFO 0x08
46struct smp_cmd_ident_info {
47 __u8 irk[16];
48} __packed;
49
50#define SMP_CMD_IDENT_ADDR_INFO 0x09
51struct smp_cmd_ident_addr_info {
52 __u8 addr_type;
53 bdaddr_t bdaddr;
54} __packed;
55
56#define SMP_CMD_SIGN_INFO 0x0a
57struct smp_cmd_sign_info {
58 __u8 csrk[16];
59} __packed;
60
61#define SMP_CMD_SECURITY_REQ 0x0b
62struct smp_cmd_security_req {
63 __u8 auth_req;
64} __packed;
65
66#define SMP_PASSKEY_ENTRY_FAILED 0x01
67#define SMP_OOB_NOT_AVAIL 0x02
68#define SMP_AUTH_REQUIREMENTS 0x03
69#define SMP_CONFIRM_FAILED 0x04
70#define SMP_PAIRING_NOTSUPP 0x05
71#define SMP_ENC_KEY_SIZE 0x06
72#define SMP_CMD_NOTSUPP 0x07
73#define SMP_UNSPECIFIED 0x08
74#define SMP_REPEATED_ATTEMPTS 0x09
75
76#endif /* __SMP_H */