diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/net/bluetooth | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 36 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 214 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 227 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 225 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 291 | ||||
-rw-r--r-- | include/net/bluetooth/rfcomm.h | 23 | ||||
-rw-r--r-- | include/net/bluetooth/sco.h | 20 | ||||
-rw-r--r-- | include/net/bluetooth/smp.h | 76 |
8 files changed, 943 insertions, 169 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 30fce0128dd7..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) |
@@ -126,6 +131,8 @@ int bt_sock_unregister(int proto); | |||
126 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); | 131 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); |
127 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); | 132 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); |
128 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); | 133 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); |
134 | int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | ||
135 | struct msghdr *msg, size_t len, int flags); | ||
129 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); | 136 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); |
130 | int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 137 | int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
131 | int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); | 138 | int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); |
@@ -142,6 +149,7 @@ struct bt_skb_cb { | |||
142 | __u8 tx_seq; | 149 | __u8 tx_seq; |
143 | __u8 retries; | 150 | __u8 retries; |
144 | __u8 sar; | 151 | __u8 sar; |
152 | unsigned short channel; | ||
145 | }; | 153 | }; |
146 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 154 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
147 | 155 | ||
@@ -197,4 +205,32 @@ extern void bt_sysfs_cleanup(void); | |||
197 | 205 | ||
198 | extern struct dentry *bt_debugfs; | 206 | extern struct dentry *bt_debugfs; |
199 | 207 | ||
208 | #ifdef CONFIG_BT_L2CAP | ||
209 | int l2cap_init(void); | ||
210 | void l2cap_exit(void); | ||
211 | #else | ||
212 | static inline int l2cap_init(void) | ||
213 | { | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static inline void l2cap_exit(void) | ||
218 | { | ||
219 | } | ||
220 | #endif | ||
221 | |||
222 | #ifdef CONFIG_BT_SCO | ||
223 | int sco_init(void); | ||
224 | void sco_exit(void); | ||
225 | #else | ||
226 | static inline int sco_init(void) | ||
227 | { | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | static inline void sco_exit(void) | ||
232 | { | ||
233 | } | ||
234 | #endif | ||
235 | |||
200 | #endif /* __BLUETOOTH_H */ | 236 | #endif /* __BLUETOOTH_H */ |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index bcbdd6d4e6dd..0c20227e57f6 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
4 | 4 | ||
@@ -12,13 +12,13 @@ | |||
12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | 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 | 14 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
15 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | 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 | 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 | 17 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | 19 | ||
20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | 20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | 21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
22 | SOFTWARE IS DISCLAIMED. | 22 | SOFTWARE IS DISCLAIMED. |
23 | */ | 23 | */ |
24 | 24 | ||
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | /* HCI controller types */ | 55 | /* HCI controller types */ |
56 | #define HCI_BREDR 0x00 | 56 | #define HCI_BREDR 0x00 |
57 | #define HCI_80211 0x01 | 57 | #define HCI_AMP 0x01 |
58 | 58 | ||
59 | /* HCI device quirks */ | 59 | /* HCI device quirks */ |
60 | enum { | 60 | enum { |
@@ -76,6 +76,16 @@ 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, | ||
87 | |||
88 | HCI_RESET, | ||
79 | }; | 89 | }; |
80 | 90 | ||
81 | /* HCI ioctl defines */ | 91 | /* HCI ioctl defines */ |
@@ -111,6 +121,7 @@ enum { | |||
111 | #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ | 121 | #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ |
112 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ | 122 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
113 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | 123 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ |
124 | #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ | ||
114 | 125 | ||
115 | /* HCI data types */ | 126 | /* HCI data types */ |
116 | #define HCI_COMMAND_PKT 0x01 | 127 | #define HCI_COMMAND_PKT 0x01 |
@@ -150,6 +161,7 @@ enum { | |||
150 | #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) | 161 | #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) |
151 | 162 | ||
152 | /* ACL flags */ | 163 | /* ACL flags */ |
164 | #define ACL_START_NO_FLUSH 0x00 | ||
153 | #define ACL_CONT 0x01 | 165 | #define ACL_CONT 0x01 |
154 | #define ACL_START 0x02 | 166 | #define ACL_START 0x02 |
155 | #define ACL_ACTIVE_BCAST 0x04 | 167 | #define ACL_ACTIVE_BCAST 0x04 |
@@ -159,6 +171,8 @@ enum { | |||
159 | #define SCO_LINK 0x00 | 171 | #define SCO_LINK 0x00 |
160 | #define ACL_LINK 0x01 | 172 | #define ACL_LINK 0x01 |
161 | #define ESCO_LINK 0x02 | 173 | #define ESCO_LINK 0x02 |
174 | /* Low Energy links do not have defined link type. Use invented one */ | ||
175 | #define LE_LINK 0x80 | ||
162 | 176 | ||
163 | /* LMP features */ | 177 | /* LMP features */ |
164 | #define LMP_3SLOT 0x01 | 178 | #define LMP_3SLOT 0x01 |
@@ -183,17 +197,25 @@ enum { | |||
183 | #define LMP_PSCHEME 0x02 | 197 | #define LMP_PSCHEME 0x02 |
184 | #define LMP_PCONTROL 0x04 | 198 | #define LMP_PCONTROL 0x04 |
185 | 199 | ||
200 | #define LMP_RSSI_INQ 0x40 | ||
186 | #define LMP_ESCO 0x80 | 201 | #define LMP_ESCO 0x80 |
187 | 202 | ||
188 | #define LMP_EV4 0x01 | 203 | #define LMP_EV4 0x01 |
189 | #define LMP_EV5 0x02 | 204 | #define LMP_EV5 0x02 |
205 | #define LMP_LE 0x40 | ||
190 | 206 | ||
191 | #define LMP_SNIFF_SUBR 0x02 | 207 | #define LMP_SNIFF_SUBR 0x02 |
208 | #define LMP_PAUSE_ENC 0x04 | ||
192 | #define LMP_EDR_ESCO_2M 0x20 | 209 | #define LMP_EDR_ESCO_2M 0x20 |
193 | #define LMP_EDR_ESCO_3M 0x40 | 210 | #define LMP_EDR_ESCO_3M 0x40 |
194 | #define LMP_EDR_3S_ESCO 0x80 | 211 | #define LMP_EDR_3S_ESCO 0x80 |
195 | 212 | ||
213 | #define LMP_EXT_INQ 0x01 | ||
196 | #define LMP_SIMPLE_PAIR 0x08 | 214 | #define LMP_SIMPLE_PAIR 0x08 |
215 | #define LMP_NO_FLUSH 0x40 | ||
216 | |||
217 | #define LMP_LSTO 0x01 | ||
218 | #define LMP_INQ_TX_PWR 0x02 | ||
197 | 219 | ||
198 | /* Connection modes */ | 220 | /* Connection modes */ |
199 | #define HCI_CM_ACTIVE 0x0000 | 221 | #define HCI_CM_ACTIVE 0x0000 |
@@ -224,7 +246,18 @@ enum { | |||
224 | #define HCI_AT_GENERAL_BONDING 0x04 | 246 | #define HCI_AT_GENERAL_BONDING 0x04 |
225 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 | 247 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 |
226 | 248 | ||
249 | /* Link Key types */ | ||
250 | #define HCI_LK_COMBINATION 0x00 | ||
251 | #define HCI_LK_LOCAL_UNIT 0x01 | ||
252 | #define HCI_LK_REMOTE_UNIT 0x02 | ||
253 | #define HCI_LK_DEBUG_COMBINATION 0x03 | ||
254 | #define HCI_LK_UNAUTH_COMBINATION 0x04 | ||
255 | #define HCI_LK_AUTH_COMBINATION 0x05 | ||
256 | #define HCI_LK_CHANGED_COMBINATION 0x06 | ||
257 | |||
227 | /* ----- HCI Commands ---- */ | 258 | /* ----- HCI Commands ---- */ |
259 | #define HCI_OP_NOP 0x0000 | ||
260 | |||
228 | #define HCI_OP_INQUIRY 0x0401 | 261 | #define HCI_OP_INQUIRY 0x0401 |
229 | struct hci_cp_inquiry { | 262 | struct hci_cp_inquiry { |
230 | __u8 lap[3]; | 263 | __u8 lap[3]; |
@@ -292,11 +325,19 @@ struct hci_cp_pin_code_reply { | |||
292 | __u8 pin_len; | 325 | __u8 pin_len; |
293 | __u8 pin_code[16]; | 326 | __u8 pin_code[16]; |
294 | } __packed; | 327 | } __packed; |
328 | struct hci_rp_pin_code_reply { | ||
329 | __u8 status; | ||
330 | bdaddr_t bdaddr; | ||
331 | } __packed; | ||
295 | 332 | ||
296 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e | 333 | #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e |
297 | struct hci_cp_pin_code_neg_reply { | 334 | struct hci_cp_pin_code_neg_reply { |
298 | bdaddr_t bdaddr; | 335 | bdaddr_t bdaddr; |
299 | } __packed; | 336 | } __packed; |
337 | struct hci_rp_pin_code_neg_reply { | ||
338 | __u8 status; | ||
339 | bdaddr_t bdaddr; | ||
340 | } __packed; | ||
300 | 341 | ||
301 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f | 342 | #define HCI_OP_CHANGE_CONN_PTYPE 0x040f |
302 | struct hci_cp_change_conn_ptype { | 343 | struct hci_cp_change_conn_ptype { |
@@ -377,6 +418,43 @@ struct hci_cp_reject_sync_conn_req { | |||
377 | __u8 reason; | 418 | __u8 reason; |
378 | } __packed; | 419 | } __packed; |
379 | 420 | ||
421 | #define HCI_OP_IO_CAPABILITY_REPLY 0x042b | ||
422 | struct hci_cp_io_capability_reply { | ||
423 | bdaddr_t bdaddr; | ||
424 | __u8 capability; | ||
425 | __u8 oob_data; | ||
426 | __u8 authentication; | ||
427 | } __packed; | ||
428 | |||
429 | #define HCI_OP_USER_CONFIRM_REPLY 0x042c | ||
430 | struct hci_cp_user_confirm_reply { | ||
431 | bdaddr_t bdaddr; | ||
432 | } __packed; | ||
433 | struct hci_rp_user_confirm_reply { | ||
434 | __u8 status; | ||
435 | bdaddr_t bdaddr; | ||
436 | } __packed; | ||
437 | |||
438 | #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d | ||
439 | |||
440 | #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 | ||
441 | struct hci_cp_remote_oob_data_reply { | ||
442 | bdaddr_t bdaddr; | ||
443 | __u8 hash[16]; | ||
444 | __u8 randomizer[16]; | ||
445 | } __packed; | ||
446 | |||
447 | #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 | ||
448 | struct hci_cp_remote_oob_data_neg_reply { | ||
449 | bdaddr_t bdaddr; | ||
450 | } __packed; | ||
451 | |||
452 | #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 | ||
453 | struct hci_cp_io_capability_neg_reply { | ||
454 | bdaddr_t bdaddr; | ||
455 | __u8 reason; | ||
456 | } __packed; | ||
457 | |||
380 | #define HCI_OP_SNIFF_MODE 0x0803 | 458 | #define HCI_OP_SNIFF_MODE 0x0803 |
381 | struct hci_cp_sniff_mode { | 459 | struct hci_cp_sniff_mode { |
382 | __le16 handle; | 460 | __le16 handle; |
@@ -474,22 +552,30 @@ struct hci_cp_set_event_flt { | |||
474 | #define HCI_CONN_SETUP_AUTO_OFF 0x01 | 552 | #define HCI_CONN_SETUP_AUTO_OFF 0x01 |
475 | #define HCI_CONN_SETUP_AUTO_ON 0x02 | 553 | #define HCI_CONN_SETUP_AUTO_ON 0x02 |
476 | 554 | ||
555 | #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 | ||
556 | struct hci_cp_delete_stored_link_key { | ||
557 | bdaddr_t bdaddr; | ||
558 | __u8 delete_all; | ||
559 | } __packed; | ||
560 | |||
561 | #define HCI_MAX_NAME_LENGTH 248 | ||
562 | |||
477 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 | 563 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 |
478 | struct hci_cp_write_local_name { | 564 | struct hci_cp_write_local_name { |
479 | __u8 name[248]; | 565 | __u8 name[HCI_MAX_NAME_LENGTH]; |
480 | } __packed; | 566 | } __packed; |
481 | 567 | ||
482 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 | 568 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 |
483 | struct hci_rp_read_local_name { | 569 | struct hci_rp_read_local_name { |
484 | __u8 status; | 570 | __u8 status; |
485 | __u8 name[248]; | 571 | __u8 name[HCI_MAX_NAME_LENGTH]; |
486 | } __packed; | 572 | } __packed; |
487 | 573 | ||
488 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 | 574 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 |
489 | 575 | ||
490 | #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 | 576 | #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 |
491 | 577 | ||
492 | #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a | 578 | #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a |
493 | #define SCAN_DISABLED 0x00 | 579 | #define SCAN_DISABLED 0x00 |
494 | #define SCAN_INQUIRY 0x01 | 580 | #define SCAN_INQUIRY 0x01 |
495 | #define SCAN_PAGE 0x02 | 581 | #define SCAN_PAGE 0x02 |
@@ -537,6 +623,16 @@ struct hci_cp_host_buffer_size { | |||
537 | __le16 sco_max_pkt; | 623 | __le16 sco_max_pkt; |
538 | } __packed; | 624 | } __packed; |
539 | 625 | ||
626 | #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 | ||
627 | |||
628 | #define HCI_MAX_EIR_LENGTH 240 | ||
629 | |||
630 | #define HCI_OP_WRITE_EIR 0x0c52 | ||
631 | struct hci_cp_write_eir { | ||
632 | uint8_t fec; | ||
633 | uint8_t data[HCI_MAX_EIR_LENGTH]; | ||
634 | } __packed; | ||
635 | |||
540 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 636 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
541 | struct hci_rp_read_ssp_mode { | 637 | struct hci_rp_read_ssp_mode { |
542 | __u8 status; | 638 | __u8 status; |
@@ -548,6 +644,15 @@ struct hci_cp_write_ssp_mode { | |||
548 | __u8 mode; | 644 | __u8 mode; |
549 | } __packed; | 645 | } __packed; |
550 | 646 | ||
647 | #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 | ||
648 | struct hci_rp_read_local_oob_data { | ||
649 | __u8 status; | ||
650 | __u8 hash[16]; | ||
651 | __u8 randomizer[16]; | ||
652 | } __packed; | ||
653 | |||
654 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | ||
655 | |||
551 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 656 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
552 | struct hci_rp_read_local_version { | 657 | struct hci_rp_read_local_version { |
553 | __u8 status; | 658 | __u8 status; |
@@ -593,6 +698,47 @@ struct hci_rp_read_bd_addr { | |||
593 | bdaddr_t bdaddr; | 698 | bdaddr_t bdaddr; |
594 | } __packed; | 699 | } __packed; |
595 | 700 | ||
701 | #define HCI_OP_LE_SET_EVENT_MASK 0x2001 | ||
702 | struct hci_cp_le_set_event_mask { | ||
703 | __u8 mask[8]; | ||
704 | } __packed; | ||
705 | |||
706 | #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 | ||
707 | struct hci_rp_le_read_buffer_size { | ||
708 | __u8 status; | ||
709 | __le16 le_mtu; | ||
710 | __u8 le_max_pkt; | ||
711 | } __packed; | ||
712 | |||
713 | #define HCI_OP_LE_CREATE_CONN 0x200d | ||
714 | struct hci_cp_le_create_conn { | ||
715 | __le16 scan_interval; | ||
716 | __le16 scan_window; | ||
717 | __u8 filter_policy; | ||
718 | __u8 peer_addr_type; | ||
719 | bdaddr_t peer_addr; | ||
720 | __u8 own_address_type; | ||
721 | __le16 conn_interval_min; | ||
722 | __le16 conn_interval_max; | ||
723 | __le16 conn_latency; | ||
724 | __le16 supervision_timeout; | ||
725 | __le16 min_ce_len; | ||
726 | __le16 max_ce_len; | ||
727 | } __packed; | ||
728 | |||
729 | #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e | ||
730 | |||
731 | #define HCI_OP_LE_CONN_UPDATE 0x2013 | ||
732 | struct hci_cp_le_conn_update { | ||
733 | __le16 handle; | ||
734 | __le16 conn_interval_min; | ||
735 | __le16 conn_interval_max; | ||
736 | __le16 conn_latency; | ||
737 | __le16 supervision_timeout; | ||
738 | __le16 min_ce_len; | ||
739 | __le16 max_ce_len; | ||
740 | } __packed; | ||
741 | |||
596 | /* ---- HCI Events ---- */ | 742 | /* ---- HCI Events ---- */ |
597 | #define HCI_EV_INQUIRY_COMPLETE 0x01 | 743 | #define HCI_EV_INQUIRY_COMPLETE 0x01 |
598 | 744 | ||
@@ -639,7 +785,7 @@ struct hci_ev_auth_complete { | |||
639 | struct hci_ev_remote_name { | 785 | struct hci_ev_remote_name { |
640 | __u8 status; | 786 | __u8 status; |
641 | bdaddr_t bdaddr; | 787 | bdaddr_t bdaddr; |
642 | __u8 name[248]; | 788 | __u8 name[HCI_MAX_NAME_LENGTH]; |
643 | } __packed; | 789 | } __packed; |
644 | 790 | ||
645 | #define HCI_EV_ENCRYPT_CHANGE 0x08 | 791 | #define HCI_EV_ENCRYPT_CHANGE 0x08 |
@@ -833,6 +979,25 @@ struct hci_ev_io_capa_request { | |||
833 | bdaddr_t bdaddr; | 979 | bdaddr_t bdaddr; |
834 | } __packed; | 980 | } __packed; |
835 | 981 | ||
982 | #define HCI_EV_IO_CAPA_REPLY 0x32 | ||
983 | struct hci_ev_io_capa_reply { | ||
984 | bdaddr_t bdaddr; | ||
985 | __u8 capability; | ||
986 | __u8 oob_data; | ||
987 | __u8 authentication; | ||
988 | } __packed; | ||
989 | |||
990 | #define HCI_EV_USER_CONFIRM_REQUEST 0x33 | ||
991 | struct hci_ev_user_confirm_req { | ||
992 | bdaddr_t bdaddr; | ||
993 | __le32 passkey; | ||
994 | } __packed; | ||
995 | |||
996 | #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 | ||
997 | struct hci_ev_remote_oob_data_request { | ||
998 | bdaddr_t bdaddr; | ||
999 | } __packed; | ||
1000 | |||
836 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 | 1001 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 |
837 | struct hci_ev_simple_pair_complete { | 1002 | struct hci_ev_simple_pair_complete { |
838 | __u8 status; | 1003 | __u8 status; |
@@ -845,6 +1010,25 @@ struct hci_ev_remote_host_features { | |||
845 | __u8 features[8]; | 1010 | __u8 features[8]; |
846 | } __packed; | 1011 | } __packed; |
847 | 1012 | ||
1013 | #define HCI_EV_LE_META 0x3e | ||
1014 | struct hci_ev_le_meta { | ||
1015 | __u8 subevent; | ||
1016 | } __packed; | ||
1017 | |||
1018 | /* Low energy meta events */ | ||
1019 | #define HCI_EV_LE_CONN_COMPLETE 0x01 | ||
1020 | struct hci_ev_le_conn_complete { | ||
1021 | __u8 status; | ||
1022 | __le16 handle; | ||
1023 | __u8 role; | ||
1024 | __u8 bdaddr_type; | ||
1025 | bdaddr_t bdaddr; | ||
1026 | __le16 interval; | ||
1027 | __le16 latency; | ||
1028 | __le16 supervision_timeout; | ||
1029 | __u8 clk_accurancy; | ||
1030 | } __packed; | ||
1031 | |||
848 | /* Internal events generated by Bluetooth stack */ | 1032 | /* Internal events generated by Bluetooth stack */ |
849 | #define HCI_EV_STACK_INTERNAL 0xfd | 1033 | #define HCI_EV_STACK_INTERNAL 0xfd |
850 | struct hci_ev_stack_internal { | 1034 | struct hci_ev_stack_internal { |
@@ -874,7 +1058,7 @@ struct hci_ev_si_security { | |||
874 | 1058 | ||
875 | struct hci_command_hdr { | 1059 | struct hci_command_hdr { |
876 | __le16 opcode; /* OCF & OGF */ | 1060 | __le16 opcode; /* OCF & OGF */ |
877 | __u8 plen; | 1061 | __u8 plen; |
878 | } __packed; | 1062 | } __packed; |
879 | 1063 | ||
880 | struct hci_event_hdr { | 1064 | struct hci_event_hdr { |
@@ -892,7 +1076,6 @@ struct hci_sco_hdr { | |||
892 | __u8 dlen; | 1076 | __u8 dlen; |
893 | } __packed; | 1077 | } __packed; |
894 | 1078 | ||
895 | #ifdef __KERNEL__ | ||
896 | #include <linux/skbuff.h> | 1079 | #include <linux/skbuff.h> |
897 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) | 1080 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) |
898 | { | 1081 | { |
@@ -908,7 +1091,6 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) | |||
908 | { | 1091 | { |
909 | return (struct hci_sco_hdr *) skb->data; | 1092 | return (struct hci_sco_hdr *) skb->data; |
910 | } | 1093 | } |
911 | #endif | ||
912 | 1094 | ||
913 | /* Command opcode pack/unpack */ | 1095 | /* Command opcode pack/unpack */ |
914 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) | 1096 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
@@ -934,9 +1116,13 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) | |||
934 | struct sockaddr_hci { | 1116 | struct sockaddr_hci { |
935 | sa_family_t hci_family; | 1117 | sa_family_t hci_family; |
936 | unsigned short hci_dev; | 1118 | unsigned short hci_dev; |
1119 | unsigned short hci_channel; | ||
937 | }; | 1120 | }; |
938 | #define HCI_DEV_NONE 0xffff | 1121 | #define HCI_DEV_NONE 0xffff |
939 | 1122 | ||
1123 | #define HCI_CHANNEL_RAW 0 | ||
1124 | #define HCI_CHANNEL_CONTROL 1 | ||
1125 | |||
940 | struct hci_filter { | 1126 | struct hci_filter { |
941 | unsigned long type_mask; | 1127 | unsigned long type_mask; |
942 | unsigned long event_mask[2]; | 1128 | unsigned long event_mask[2]; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 4568b938ca35..6c994c004d15 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -44,15 +44,15 @@ struct inquiry_data { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct inquiry_entry { | 46 | struct inquiry_entry { |
47 | struct inquiry_entry *next; | 47 | struct inquiry_entry *next; |
48 | __u32 timestamp; | 48 | __u32 timestamp; |
49 | struct inquiry_data data; | 49 | struct inquiry_data data; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct inquiry_cache { | 52 | struct inquiry_cache { |
53 | spinlock_t lock; | 53 | spinlock_t lock; |
54 | __u32 timestamp; | 54 | __u32 timestamp; |
55 | struct inquiry_entry *list; | 55 | struct inquiry_entry *list; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | struct hci_conn_hash { | 58 | struct hci_conn_hash { |
@@ -60,12 +60,35 @@ 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 | ||
65 | struct bdaddr_list { | 66 | struct bdaddr_list { |
66 | struct list_head list; | 67 | struct list_head list; |
67 | bdaddr_t bdaddr; | 68 | bdaddr_t bdaddr; |
68 | }; | 69 | }; |
70 | |||
71 | struct bt_uuid { | ||
72 | struct list_head list; | ||
73 | u8 uuid[16]; | ||
74 | u8 svc_hint; | ||
75 | }; | ||
76 | |||
77 | struct link_key { | ||
78 | struct list_head list; | ||
79 | bdaddr_t bdaddr; | ||
80 | u8 type; | ||
81 | u8 val[16]; | ||
82 | u8 pin_len; | ||
83 | }; | ||
84 | |||
85 | struct oob_data { | ||
86 | struct list_head list; | ||
87 | bdaddr_t bdaddr; | ||
88 | u8 hash[16]; | ||
89 | u8 randomizer[16]; | ||
90 | }; | ||
91 | |||
69 | #define NUM_REASSEMBLY 4 | 92 | #define NUM_REASSEMBLY 4 |
70 | struct hci_dev { | 93 | struct hci_dev { |
71 | struct list_head list; | 94 | struct list_head list; |
@@ -78,15 +101,21 @@ struct hci_dev { | |||
78 | __u8 bus; | 101 | __u8 bus; |
79 | __u8 dev_type; | 102 | __u8 dev_type; |
80 | bdaddr_t bdaddr; | 103 | bdaddr_t bdaddr; |
81 | __u8 dev_name[248]; | 104 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; |
105 | __u8 eir[HCI_MAX_EIR_LENGTH]; | ||
82 | __u8 dev_class[3]; | 106 | __u8 dev_class[3]; |
107 | __u8 major_class; | ||
108 | __u8 minor_class; | ||
83 | __u8 features[8]; | 109 | __u8 features[8]; |
84 | __u8 commands[64]; | 110 | __u8 commands[64]; |
85 | __u8 ssp_mode; | 111 | __u8 ssp_mode; |
86 | __u8 hci_ver; | 112 | __u8 hci_ver; |
87 | __u16 hci_rev; | 113 | __u16 hci_rev; |
114 | __u8 lmp_ver; | ||
88 | __u16 manufacturer; | 115 | __u16 manufacturer; |
116 | __le16 lmp_subver; | ||
89 | __u16 voice_setting; | 117 | __u16 voice_setting; |
118 | __u8 io_capability; | ||
90 | 119 | ||
91 | __u16 pkt_type; | 120 | __u16 pkt_type; |
92 | __u16 esco_type; | 121 | __u16 esco_type; |
@@ -97,23 +126,33 @@ struct hci_dev { | |||
97 | __u16 sniff_min_interval; | 126 | __u16 sniff_min_interval; |
98 | __u16 sniff_max_interval; | 127 | __u16 sniff_max_interval; |
99 | 128 | ||
129 | unsigned int auto_accept_delay; | ||
130 | |||
100 | unsigned long quirks; | 131 | unsigned long quirks; |
101 | 132 | ||
102 | atomic_t cmd_cnt; | 133 | atomic_t cmd_cnt; |
103 | unsigned int acl_cnt; | 134 | unsigned int acl_cnt; |
104 | unsigned int sco_cnt; | 135 | unsigned int sco_cnt; |
136 | unsigned int le_cnt; | ||
105 | 137 | ||
106 | unsigned int acl_mtu; | 138 | unsigned int acl_mtu; |
107 | unsigned int sco_mtu; | 139 | unsigned int sco_mtu; |
140 | unsigned int le_mtu; | ||
108 | unsigned int acl_pkts; | 141 | unsigned int acl_pkts; |
109 | unsigned int sco_pkts; | 142 | unsigned int sco_pkts; |
143 | unsigned int le_pkts; | ||
110 | 144 | ||
111 | unsigned long cmd_last_tx; | ||
112 | unsigned long acl_last_tx; | 145 | unsigned long acl_last_tx; |
113 | unsigned long sco_last_tx; | 146 | unsigned long sco_last_tx; |
147 | unsigned long le_last_tx; | ||
114 | 148 | ||
115 | struct workqueue_struct *workqueue; | 149 | struct workqueue_struct *workqueue; |
116 | 150 | ||
151 | struct work_struct power_on; | ||
152 | struct work_struct power_off; | ||
153 | struct timer_list off_timer; | ||
154 | |||
155 | struct timer_list cmd_timer; | ||
117 | struct tasklet_struct cmd_task; | 156 | struct tasklet_struct cmd_task; |
118 | struct tasklet_struct rx_task; | 157 | struct tasklet_struct rx_task; |
119 | struct tasklet_struct tx_task; | 158 | struct tasklet_struct tx_task; |
@@ -130,10 +169,18 @@ struct hci_dev { | |||
130 | __u32 req_status; | 169 | __u32 req_status; |
131 | __u32 req_result; | 170 | __u32 req_result; |
132 | 171 | ||
172 | __u16 init_last_cmd; | ||
173 | |||
133 | struct inquiry_cache inq_cache; | 174 | struct inquiry_cache inq_cache; |
134 | struct hci_conn_hash conn_hash; | 175 | struct hci_conn_hash conn_hash; |
135 | struct list_head blacklist; | 176 | struct list_head blacklist; |
136 | 177 | ||
178 | struct list_head uuids; | ||
179 | |||
180 | struct list_head link_keys; | ||
181 | |||
182 | struct list_head remote_oob_data; | ||
183 | |||
137 | struct hci_dev_stats stat; | 184 | struct hci_dev_stats stat; |
138 | 185 | ||
139 | struct sk_buff_head driver_init; | 186 | struct sk_buff_head driver_init; |
@@ -141,7 +188,7 @@ struct hci_dev { | |||
141 | void *driver_data; | 188 | void *driver_data; |
142 | void *core_data; | 189 | void *core_data; |
143 | 190 | ||
144 | atomic_t promisc; | 191 | atomic_t promisc; |
145 | 192 | ||
146 | struct dentry *debugfs; | 193 | struct dentry *debugfs; |
147 | 194 | ||
@@ -150,7 +197,7 @@ struct hci_dev { | |||
150 | 197 | ||
151 | struct rfkill *rfkill; | 198 | struct rfkill *rfkill; |
152 | 199 | ||
153 | struct module *owner; | 200 | struct module *owner; |
154 | 201 | ||
155 | int (*open)(struct hci_dev *hdev); | 202 | int (*open)(struct hci_dev *hdev); |
156 | int (*close)(struct hci_dev *hdev); | 203 | int (*close)(struct hci_dev *hdev); |
@@ -164,35 +211,44 @@ struct hci_dev { | |||
164 | struct hci_conn { | 211 | struct hci_conn { |
165 | struct list_head list; | 212 | struct list_head list; |
166 | 213 | ||
167 | atomic_t refcnt; | 214 | atomic_t refcnt; |
168 | spinlock_t lock; | 215 | spinlock_t lock; |
169 | 216 | ||
170 | bdaddr_t dst; | 217 | bdaddr_t dst; |
171 | __u16 handle; | 218 | __u16 handle; |
172 | __u16 state; | 219 | __u16 state; |
173 | __u8 mode; | 220 | __u8 mode; |
174 | __u8 type; | 221 | __u8 type; |
175 | __u8 out; | 222 | __u8 out; |
176 | __u8 attempt; | 223 | __u8 attempt; |
177 | __u8 dev_class[3]; | 224 | __u8 dev_class[3]; |
178 | __u8 features[8]; | 225 | __u8 features[8]; |
179 | __u8 ssp_mode; | 226 | __u8 ssp_mode; |
180 | __u16 interval; | 227 | __u16 interval; |
181 | __u16 pkt_type; | 228 | __u16 pkt_type; |
182 | __u16 link_policy; | 229 | __u16 link_policy; |
183 | __u32 link_mode; | 230 | __u32 link_mode; |
184 | __u8 auth_type; | 231 | __u8 key_type; |
185 | __u8 sec_level; | 232 | __u8 auth_type; |
186 | __u8 power_save; | 233 | __u8 sec_level; |
187 | __u16 disc_timeout; | 234 | __u8 pending_sec_level; |
188 | unsigned long pend; | 235 | __u8 pin_length; |
189 | 236 | __u8 io_capability; | |
190 | unsigned int sent; | 237 | __u8 power_save; |
238 | __u16 disc_timeout; | ||
239 | unsigned long pend; | ||
240 | |||
241 | __u8 remote_cap; | ||
242 | __u8 remote_oob; | ||
243 | __u8 remote_auth; | ||
244 | |||
245 | unsigned int sent; | ||
191 | 246 | ||
192 | struct sk_buff_head data_q; | 247 | struct sk_buff_head data_q; |
193 | 248 | ||
194 | struct timer_list disc_timer; | 249 | struct timer_list disc_timer; |
195 | struct timer_list idle_timer; | 250 | struct timer_list idle_timer; |
251 | struct timer_list auto_accept_timer; | ||
196 | 252 | ||
197 | struct work_struct work_add; | 253 | struct work_struct work_add; |
198 | struct work_struct work_del; | 254 | struct work_struct work_del; |
@@ -206,6 +262,10 @@ struct hci_conn { | |||
206 | void *priv; | 262 | void *priv; |
207 | 263 | ||
208 | struct hci_conn *link; | 264 | struct hci_conn *link; |
265 | |||
266 | void (*connect_cfm_cb) (struct hci_conn *conn, u8 status); | ||
267 | void (*security_cfm_cb) (struct hci_conn *conn, u8 status); | ||
268 | void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason); | ||
209 | }; | 269 | }; |
210 | 270 | ||
211 | extern struct hci_proto *hci_proto[]; | 271 | extern struct hci_proto *hci_proto[]; |
@@ -215,8 +275,8 @@ extern rwlock_t hci_dev_list_lock; | |||
215 | extern rwlock_t hci_cb_list_lock; | 275 | extern rwlock_t hci_cb_list_lock; |
216 | 276 | ||
217 | /* ----- Inquiry cache ----- */ | 277 | /* ----- Inquiry cache ----- */ |
218 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) // 30 seconds | 278 | #define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ |
219 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) // 60 seconds | 279 | #define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ |
220 | 280 | ||
221 | #define inquiry_cache_lock(c) spin_lock(&c->lock) | 281 | #define inquiry_cache_lock(c) spin_lock(&c->lock) |
222 | #define inquiry_cache_unlock(c) spin_unlock(&c->lock) | 282 | #define inquiry_cache_unlock(c) spin_unlock(&c->lock) |
@@ -233,7 +293,7 @@ static inline void inquiry_cache_init(struct hci_dev *hdev) | |||
233 | static inline int inquiry_cache_empty(struct hci_dev *hdev) | 293 | static inline int inquiry_cache_empty(struct hci_dev *hdev) |
234 | { | 294 | { |
235 | struct inquiry_cache *c = &hdev->inq_cache; | 295 | struct inquiry_cache *c = &hdev->inq_cache; |
236 | return (c->list == NULL); | 296 | return c->list == NULL; |
237 | } | 297 | } |
238 | 298 | ||
239 | static inline long inquiry_cache_age(struct hci_dev *hdev) | 299 | static inline long inquiry_cache_age(struct hci_dev *hdev) |
@@ -272,24 +332,40 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | |||
272 | { | 332 | { |
273 | struct hci_conn_hash *h = &hdev->conn_hash; | 333 | struct hci_conn_hash *h = &hdev->conn_hash; |
274 | list_add(&c->list, &h->list); | 334 | list_add(&c->list, &h->list); |
275 | if (c->type == ACL_LINK) | 335 | switch (c->type) { |
336 | case ACL_LINK: | ||
276 | h->acl_num++; | 337 | h->acl_num++; |
277 | else | 338 | break; |
339 | case LE_LINK: | ||
340 | h->le_num++; | ||
341 | break; | ||
342 | case SCO_LINK: | ||
343 | case ESCO_LINK: | ||
278 | h->sco_num++; | 344 | h->sco_num++; |
345 | break; | ||
346 | } | ||
279 | } | 347 | } |
280 | 348 | ||
281 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) | 349 | static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) |
282 | { | 350 | { |
283 | struct hci_conn_hash *h = &hdev->conn_hash; | 351 | struct hci_conn_hash *h = &hdev->conn_hash; |
284 | list_del(&c->list); | 352 | list_del(&c->list); |
285 | if (c->type == ACL_LINK) | 353 | switch (c->type) { |
354 | case ACL_LINK: | ||
286 | h->acl_num--; | 355 | h->acl_num--; |
287 | else | 356 | break; |
357 | case LE_LINK: | ||
358 | h->le_num--; | ||
359 | break; | ||
360 | case SCO_LINK: | ||
361 | case ESCO_LINK: | ||
288 | h->sco_num--; | 362 | h->sco_num--; |
363 | break; | ||
364 | } | ||
289 | } | 365 | } |
290 | 366 | ||
291 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | 367 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, |
292 | __u16 handle) | 368 | __u16 handle) |
293 | { | 369 | { |
294 | struct hci_conn_hash *h = &hdev->conn_hash; | 370 | struct hci_conn_hash *h = &hdev->conn_hash; |
295 | struct list_head *p; | 371 | struct list_head *p; |
@@ -304,7 +380,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | |||
304 | } | 380 | } |
305 | 381 | ||
306 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | 382 | static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, |
307 | __u8 type, bdaddr_t *ba) | 383 | __u8 type, bdaddr_t *ba) |
308 | { | 384 | { |
309 | struct hci_conn_hash *h = &hdev->conn_hash; | 385 | struct hci_conn_hash *h = &hdev->conn_hash; |
310 | struct list_head *p; | 386 | struct list_head *p; |
@@ -319,7 +395,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, | |||
319 | } | 395 | } |
320 | 396 | ||
321 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | 397 | static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, |
322 | __u8 type, __u16 state) | 398 | __u8 type, __u16 state) |
323 | { | 399 | { |
324 | struct hci_conn_hash *h = &hdev->conn_hash; | 400 | struct hci_conn_hash *h = &hdev->conn_hash; |
325 | struct list_head *p; | 401 | struct list_head *p; |
@@ -346,6 +422,7 @@ void hci_conn_check_pending(struct hci_dev *hdev); | |||
346 | 422 | ||
347 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type); | 423 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type); |
348 | int hci_conn_check_link_mode(struct hci_conn *conn); | 424 | int hci_conn_check_link_mode(struct hci_conn *conn); |
425 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); | ||
349 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); | 426 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); |
350 | int hci_conn_change_link_key(struct hci_conn *conn); | 427 | int hci_conn_change_link_key(struct hci_conn *conn); |
351 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); | 428 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); |
@@ -435,6 +512,23 @@ int hci_inquiry(void __user *arg); | |||
435 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 512 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
436 | int hci_blacklist_clear(struct hci_dev *hdev); | 513 | int hci_blacklist_clear(struct hci_dev *hdev); |
437 | 514 | ||
515 | int hci_uuids_clear(struct hci_dev *hdev); | ||
516 | |||
517 | int hci_link_keys_clear(struct hci_dev *hdev); | ||
518 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
519 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | ||
520 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | ||
521 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
522 | |||
523 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | ||
524 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, | ||
525 | bdaddr_t *bdaddr); | ||
526 | int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, | ||
527 | u8 *randomizer); | ||
528 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
529 | |||
530 | void hci_del_off_timer(struct hci_dev *hdev); | ||
531 | |||
438 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 532 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
439 | 533 | ||
440 | int hci_recv_frame(struct sk_buff *skb); | 534 | int hci_recv_frame(struct sk_buff *skb); |
@@ -456,6 +550,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
456 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) | 550 | #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) |
457 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) | 551 | #define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) |
458 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) | 552 | #define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) |
553 | #define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) | ||
554 | #define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) | ||
459 | 555 | ||
460 | /* ----- HCI protocols ----- */ | 556 | /* ----- HCI protocols ----- */ |
461 | struct hci_proto { | 557 | struct hci_proto { |
@@ -501,6 +597,9 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) | |||
501 | hp = hci_proto[HCI_PROTO_SCO]; | 597 | hp = hci_proto[HCI_PROTO_SCO]; |
502 | if (hp && hp->connect_cfm) | 598 | if (hp && hp->connect_cfm) |
503 | hp->connect_cfm(conn, status); | 599 | hp->connect_cfm(conn, status); |
600 | |||
601 | if (conn->connect_cfm_cb) | ||
602 | conn->connect_cfm_cb(conn, status); | ||
504 | } | 603 | } |
505 | 604 | ||
506 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) | 605 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) |
@@ -530,6 +629,9 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) | |||
530 | hp = hci_proto[HCI_PROTO_SCO]; | 629 | hp = hci_proto[HCI_PROTO_SCO]; |
531 | if (hp && hp->disconn_cfm) | 630 | if (hp && hp->disconn_cfm) |
532 | hp->disconn_cfm(conn, reason); | 631 | hp->disconn_cfm(conn, reason); |
632 | |||
633 | if (conn->disconn_cfm_cb) | ||
634 | conn->disconn_cfm_cb(conn, reason); | ||
533 | } | 635 | } |
534 | 636 | ||
535 | static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | 637 | static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) |
@@ -549,6 +651,9 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) | |||
549 | hp = hci_proto[HCI_PROTO_SCO]; | 651 | hp = hci_proto[HCI_PROTO_SCO]; |
550 | if (hp && hp->security_cfm) | 652 | if (hp && hp->security_cfm) |
551 | hp->security_cfm(conn, status, encrypt); | 653 | hp->security_cfm(conn, status, encrypt); |
654 | |||
655 | if (conn->security_cfm_cb) | ||
656 | conn->security_cfm_cb(conn, status); | ||
552 | } | 657 | } |
553 | 658 | ||
554 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) | 659 | static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) |
@@ -562,6 +667,9 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u | |||
562 | hp = hci_proto[HCI_PROTO_SCO]; | 667 | hp = hci_proto[HCI_PROTO_SCO]; |
563 | if (hp && hp->security_cfm) | 668 | if (hp && hp->security_cfm) |
564 | hp->security_cfm(conn, status, encrypt); | 669 | hp->security_cfm(conn, status, encrypt); |
670 | |||
671 | if (conn->security_cfm_cb) | ||
672 | conn->security_cfm_cb(conn, status); | ||
565 | } | 673 | } |
566 | 674 | ||
567 | int hci_register_proto(struct hci_proto *hproto); | 675 | int hci_register_proto(struct hci_proto *hproto); |
@@ -658,7 +766,37 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | |||
658 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); | 766 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); |
659 | 767 | ||
660 | /* ----- HCI Sockets ----- */ | 768 | /* ----- HCI Sockets ----- */ |
661 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); | 769 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, |
770 | struct sock *skip_sk); | ||
771 | |||
772 | /* Management interface */ | ||
773 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | ||
774 | int mgmt_index_added(u16 index); | ||
775 | int mgmt_index_removed(u16 index); | ||
776 | int mgmt_powered(u16 index, u8 powered); | ||
777 | int mgmt_discoverable(u16 index, u8 discoverable); | ||
778 | int mgmt_connectable(u16 index, u8 connectable); | ||
779 | int mgmt_new_key(u16 index, struct link_key *key, u8 persistent); | ||
780 | int mgmt_connected(u16 index, bdaddr_t *bdaddr); | ||
781 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); | ||
782 | int mgmt_disconnect_failed(u16 index); | ||
783 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); | ||
784 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure); | ||
785 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
786 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
787 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value, | ||
788 | u8 confirm_hint); | ||
789 | int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
790 | int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, | ||
791 | u8 status); | ||
792 | int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); | ||
793 | int mgmt_set_local_name_complete(u16 index, u8 *name, u8 status); | ||
794 | int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer, | ||
795 | u8 status); | ||
796 | int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, | ||
797 | u8 *eir); | ||
798 | int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); | ||
799 | int mgmt_discovering(u16 index, u8 discovering); | ||
662 | 800 | ||
663 | /* HCI info for socket */ | 801 | /* HCI info for socket */ |
664 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 802 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
@@ -668,6 +806,7 @@ struct hci_pinfo { | |||
668 | struct hci_dev *hdev; | 806 | struct hci_dev *hdev; |
669 | struct hci_filter filter; | 807 | struct hci_filter filter; |
670 | __u32 cmsg_mask; | 808 | __u32 cmsg_mask; |
809 | unsigned short channel; | ||
671 | }; | 810 | }; |
672 | 811 | ||
673 | /* HCI security filter */ | 812 | /* HCI security filter */ |
@@ -687,6 +826,8 @@ struct hci_sec_filter { | |||
687 | #define hci_req_lock(d) mutex_lock(&d->req_lock) | 826 | #define hci_req_lock(d) mutex_lock(&d->req_lock) |
688 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) | 827 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) |
689 | 828 | ||
690 | void hci_req_complete(struct hci_dev *hdev, int result); | 829 | void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); |
691 | 830 | ||
831 | void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, | ||
832 | u16 latency, u16 to_multiplier); | ||
692 | #endif /* __HCI_CORE_H */ | 833 | #endif /* __HCI_CORE_H */ |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 6c241444f902..d09c9b1118e3 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
4 | Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> | 4 | Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> |
@@ -14,13 +14,13 @@ | |||
14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. |
16 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | 16 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
17 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | 17 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES |
18 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 18 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
19 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 19 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
20 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 20 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
21 | 21 | ||
22 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | 22 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
23 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | 23 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
24 | SOFTWARE IS DISCLAIMED. | 24 | SOFTWARE IS DISCLAIMED. |
25 | */ | 25 | */ |
26 | 26 | ||
@@ -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,63 +261,32 @@ 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 | ||
258 | /* ----- L2CAP connections ----- */ | 264 | struct l2cap_conn_param_update_req { |
259 | struct l2cap_chan_list { | 265 | __le16 min; |
260 | struct sock *head; | 266 | __le16 max; |
261 | rwlock_t lock; | 267 | __le16 latency; |
262 | long num; | 268 | __le16 to_multiplier; |
263 | }; | 269 | } __packed; |
264 | |||
265 | struct l2cap_conn { | ||
266 | struct hci_conn *hcon; | ||
267 | |||
268 | bdaddr_t *dst; | ||
269 | bdaddr_t *src; | ||
270 | |||
271 | unsigned int mtu; | ||
272 | |||
273 | __u32 feat_mask; | ||
274 | |||
275 | __u8 info_state; | ||
276 | __u8 info_ident; | ||
277 | |||
278 | struct timer_list info_timer; | ||
279 | |||
280 | spinlock_t lock; | ||
281 | |||
282 | struct sk_buff *rx_skb; | ||
283 | __u32 rx_len; | ||
284 | __u8 rx_ident; | ||
285 | __u8 tx_ident; | ||
286 | |||
287 | __u8 disc_reason; | ||
288 | |||
289 | struct l2cap_chan_list chan_list; | ||
290 | }; | ||
291 | |||
292 | struct sock_del_list { | ||
293 | struct sock *sk; | ||
294 | struct list_head list; | ||
295 | }; | ||
296 | 270 | ||
297 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | 271 | struct l2cap_conn_param_update_rsp { |
298 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | 272 | __le16 result; |
299 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | 273 | } __packed; |
300 | 274 | ||
301 | /* ----- L2CAP channel and socket info ----- */ | 275 | /* Connection Parameters result */ |
302 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | 276 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000 |
303 | #define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) | 277 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 |
304 | #define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) | ||
305 | #define BUSY_QUEUE(sk) (&l2cap_pi(sk)->busy_queue) | ||
306 | #define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) | ||
307 | 278 | ||
279 | /* ----- L2CAP channels and connections ----- */ | ||
308 | struct srej_list { | 280 | struct srej_list { |
309 | __u8 tx_seq; | 281 | __u8 tx_seq; |
310 | struct list_head list; | 282 | struct list_head list; |
311 | }; | 283 | }; |
312 | 284 | ||
313 | struct l2cap_pinfo { | 285 | struct l2cap_chan { |
314 | struct bt_sock bt; | 286 | struct sock *sk; |
287 | |||
288 | struct l2cap_conn *conn; | ||
289 | |||
315 | __le16 psm; | 290 | __le16 psm; |
316 | __u16 dcid; | 291 | __u16 dcid; |
317 | __u16 scid; | 292 | __u16 scid; |
@@ -320,16 +295,29 @@ struct l2cap_pinfo { | |||
320 | __u16 omtu; | 295 | __u16 omtu; |
321 | __u16 flush_to; | 296 | __u16 flush_to; |
322 | __u8 mode; | 297 | __u8 mode; |
323 | __u8 num_conf_req; | ||
324 | __u8 num_conf_rsp; | ||
325 | 298 | ||
326 | __u8 fcs; | 299 | __le16 sport; |
300 | |||
327 | __u8 sec_level; | 301 | __u8 sec_level; |
328 | __u8 role_switch; | 302 | __u8 role_switch; |
329 | __u8 force_reliable; | 303 | __u8 force_reliable; |
304 | __u8 flushable; | ||
305 | |||
306 | __u8 ident; | ||
330 | 307 | ||
331 | __u8 conf_req[64]; | 308 | __u8 conf_req[64]; |
332 | __u8 conf_len; | 309 | __u8 conf_len; |
310 | __u8 num_conf_req; | ||
311 | __u8 num_conf_rsp; | ||
312 | |||
313 | __u8 fcs; | ||
314 | |||
315 | __u8 tx_win; | ||
316 | __u8 max_tx; | ||
317 | __u16 retrans_timeout; | ||
318 | __u16 monitor_timeout; | ||
319 | __u16 mps; | ||
320 | |||
333 | __u8 conf_state; | 321 | __u8 conf_state; |
334 | __u16 conn_state; | 322 | __u16 conn_state; |
335 | 323 | ||
@@ -347,30 +335,61 @@ struct l2cap_pinfo { | |||
347 | __u16 partial_sdu_len; | 335 | __u16 partial_sdu_len; |
348 | struct sk_buff *sdu; | 336 | struct sk_buff *sdu; |
349 | 337 | ||
350 | __u8 ident; | ||
351 | |||
352 | __u8 tx_win; | ||
353 | __u8 max_tx; | ||
354 | __u8 remote_tx_win; | 338 | __u8 remote_tx_win; |
355 | __u8 remote_max_tx; | 339 | __u8 remote_max_tx; |
356 | __u16 retrans_timeout; | ||
357 | __u16 monitor_timeout; | ||
358 | __u16 remote_mps; | 340 | __u16 remote_mps; |
359 | __u16 mps; | ||
360 | |||
361 | __le16 sport; | ||
362 | 341 | ||
363 | struct timer_list retrans_timer; | 342 | struct timer_list retrans_timer; |
364 | struct timer_list monitor_timer; | 343 | struct timer_list monitor_timer; |
365 | struct timer_list ack_timer; | 344 | struct timer_list ack_timer; |
366 | struct sk_buff_head tx_queue; | 345 | struct sk_buff *tx_send_head; |
367 | struct sk_buff_head srej_queue; | 346 | struct sk_buff_head tx_q; |
368 | struct sk_buff_head busy_queue; | 347 | struct sk_buff_head srej_q; |
348 | struct sk_buff_head busy_q; | ||
369 | struct work_struct busy_work; | 349 | struct work_struct busy_work; |
370 | struct srej_list srej_l; | 350 | struct list_head srej_l; |
371 | struct l2cap_conn *conn; | 351 | |
372 | struct sock *next_c; | 352 | struct list_head list; |
373 | struct sock *prev_c; | 353 | struct list_head global_l; |
354 | }; | ||
355 | |||
356 | struct l2cap_conn { | ||
357 | struct hci_conn *hcon; | ||
358 | |||
359 | bdaddr_t *dst; | ||
360 | bdaddr_t *src; | ||
361 | |||
362 | unsigned int mtu; | ||
363 | |||
364 | __u32 feat_mask; | ||
365 | |||
366 | __u8 info_state; | ||
367 | __u8 info_ident; | ||
368 | |||
369 | struct timer_list info_timer; | ||
370 | |||
371 | spinlock_t lock; | ||
372 | |||
373 | struct sk_buff *rx_skb; | ||
374 | __u32 rx_len; | ||
375 | __u8 tx_ident; | ||
376 | |||
377 | __u8 disc_reason; | ||
378 | |||
379 | struct list_head chan_l; | ||
380 | rwlock_t chan_lock; | ||
381 | }; | ||
382 | |||
383 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | ||
384 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | ||
385 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | ||
386 | |||
387 | /* ----- L2CAP socket info ----- */ | ||
388 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | ||
389 | |||
390 | struct l2cap_pinfo { | ||
391 | struct bt_sock bt; | ||
392 | struct l2cap_chan *chan; | ||
374 | }; | 393 | }; |
375 | 394 | ||
376 | #define L2CAP_CONF_REQ_SENT 0x01 | 395 | #define L2CAP_CONF_REQ_SENT 0x01 |
@@ -397,32 +416,62 @@ struct l2cap_pinfo { | |||
397 | #define L2CAP_CONN_RNR_SENT 0x0200 | 416 | #define L2CAP_CONN_RNR_SENT 0x0200 |
398 | #define L2CAP_CONN_SAR_RETRY 0x0400 | 417 | #define L2CAP_CONN_SAR_RETRY 0x0400 |
399 | 418 | ||
400 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ | 419 | #define __mod_retrans_timer() mod_timer(&chan->retrans_timer, \ |
401 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 420 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); |
402 | #define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ | 421 | #define __mod_monitor_timer() mod_timer(&chan->monitor_timer, \ |
403 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | 422 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); |
404 | #define __mod_ack_timer() mod_timer(&l2cap_pi(sk)->ack_timer, \ | 423 | #define __mod_ack_timer() mod_timer(&chan->ack_timer, \ |
405 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); | 424 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); |
406 | 425 | ||
407 | static inline int l2cap_tx_window_full(struct sock *sk) | 426 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) |
408 | { | 427 | { |
409 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
410 | int sub; | 428 | int sub; |
411 | 429 | ||
412 | sub = (pi->next_tx_seq - pi->expected_ack_seq) % 64; | 430 | sub = (ch->next_tx_seq - ch->expected_ack_seq) % 64; |
413 | 431 | ||
414 | if (sub < 0) | 432 | if (sub < 0) |
415 | sub += 64; | 433 | sub += 64; |
416 | 434 | ||
417 | return (sub == pi->remote_tx_win); | 435 | return sub == ch->remote_tx_win; |
418 | } | 436 | } |
419 | 437 | ||
420 | #define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1 | 438 | #define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) |
421 | #define __get_reqseq(ctrl) ((ctrl) & L2CAP_CTRL_REQSEQ) >> 8 | 439 | #define __get_reqseq(ctrl) (((ctrl) & L2CAP_CTRL_REQSEQ) >> 8) |
422 | #define __is_iframe(ctrl) !((ctrl) & L2CAP_CTRL_FRAME_TYPE) | 440 | #define __is_iframe(ctrl) (!((ctrl) & L2CAP_CTRL_FRAME_TYPE)) |
423 | #define __is_sframe(ctrl) (ctrl) & L2CAP_CTRL_FRAME_TYPE | 441 | #define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) |
424 | #define __is_sar_start(ctrl) ((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START | 442 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) |
425 | 443 | ||
426 | void l2cap_load(void); | 444 | extern int disable_ertm; |
445 | |||
446 | int l2cap_init_sockets(void); | ||
447 | void l2cap_cleanup_sockets(void); | ||
448 | |||
449 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); | ||
450 | void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); | ||
451 | int __l2cap_wait_ack(struct sock *sk); | ||
452 | |||
453 | struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | ||
454 | struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | ||
455 | struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len, u16 control, u16 sdulen); | ||
456 | int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); | ||
457 | void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb); | ||
458 | void l2cap_streaming_send(struct l2cap_chan *chan); | ||
459 | int l2cap_ertm_send(struct l2cap_chan *chan); | ||
460 | |||
461 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); | ||
462 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); | ||
463 | |||
464 | void l2cap_sock_set_timer(struct sock *sk, long timeout); | ||
465 | void l2cap_sock_clear_timer(struct sock *sk); | ||
466 | void __l2cap_sock_close(struct sock *sk, int reason); | ||
467 | void l2cap_sock_kill(struct sock *sk); | ||
468 | void l2cap_sock_init(struct sock *sk, struct sock *parent); | ||
469 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | ||
470 | int proto, gfp_t prio); | ||
471 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err); | ||
472 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); | ||
473 | void l2cap_chan_del(struct l2cap_chan *chan, int err); | ||
474 | void l2cap_chan_destroy(struct l2cap_chan *chan); | ||
475 | int l2cap_chan_connect(struct l2cap_chan *chan); | ||
427 | 476 | ||
428 | #endif /* __L2CAP_H */ | 477 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h new file mode 100644 index 000000000000..4899286ed4e4 --- /dev/null +++ b/include/net/bluetooth/mgmt.h | |||
@@ -0,0 +1,291 @@ | |||
1 | /* | ||
2 | BlueZ - Bluetooth protocol stack for Linux | ||
3 | |||
4 | Copyright (C) 2010 Nokia Corporation | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License version 2 as | ||
8 | published by the Free Software Foundation; | ||
9 | |||
10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | ||
14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | ||
15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
18 | |||
19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | ||
20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | ||
21 | SOFTWARE IS DISCLAIMED. | ||
22 | */ | ||
23 | |||
24 | #define MGMT_INDEX_NONE 0xFFFF | ||
25 | |||
26 | struct mgmt_hdr { | ||
27 | __le16 opcode; | ||
28 | __le16 index; | ||
29 | __le16 len; | ||
30 | } __packed; | ||
31 | |||
32 | #define MGMT_OP_READ_VERSION 0x0001 | ||
33 | struct mgmt_rp_read_version { | ||
34 | __u8 version; | ||
35 | __le16 revision; | ||
36 | } __packed; | ||
37 | |||
38 | #define MGMT_OP_READ_INDEX_LIST 0x0003 | ||
39 | struct mgmt_rp_read_index_list { | ||
40 | __le16 num_controllers; | ||
41 | __le16 index[0]; | ||
42 | } __packed; | ||
43 | |||
44 | /* Reserve one extra byte for names in management messages so that they | ||
45 | * are always guaranteed to be nul-terminated */ | ||
46 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) | ||
47 | |||
48 | #define MGMT_OP_READ_INFO 0x0004 | ||
49 | struct mgmt_rp_read_info { | ||
50 | __u8 type; | ||
51 | __u8 powered; | ||
52 | __u8 connectable; | ||
53 | __u8 discoverable; | ||
54 | __u8 pairable; | ||
55 | __u8 sec_mode; | ||
56 | bdaddr_t bdaddr; | ||
57 | __u8 dev_class[3]; | ||
58 | __u8 features[8]; | ||
59 | __u16 manufacturer; | ||
60 | __u8 hci_ver; | ||
61 | __u16 hci_rev; | ||
62 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
63 | } __packed; | ||
64 | |||
65 | struct mgmt_mode { | ||
66 | __u8 val; | ||
67 | } __packed; | ||
68 | |||
69 | #define MGMT_OP_SET_POWERED 0x0005 | ||
70 | |||
71 | #define MGMT_OP_SET_DISCOVERABLE 0x0006 | ||
72 | |||
73 | #define MGMT_OP_SET_CONNECTABLE 0x0007 | ||
74 | |||
75 | #define MGMT_OP_SET_PAIRABLE 0x0008 | ||
76 | |||
77 | #define MGMT_OP_ADD_UUID 0x0009 | ||
78 | struct mgmt_cp_add_uuid { | ||
79 | __u8 uuid[16]; | ||
80 | __u8 svc_hint; | ||
81 | } __packed; | ||
82 | |||
83 | #define MGMT_OP_REMOVE_UUID 0x000A | ||
84 | struct mgmt_cp_remove_uuid { | ||
85 | __u8 uuid[16]; | ||
86 | } __packed; | ||
87 | |||
88 | #define MGMT_OP_SET_DEV_CLASS 0x000B | ||
89 | struct mgmt_cp_set_dev_class { | ||
90 | __u8 major; | ||
91 | __u8 minor; | ||
92 | } __packed; | ||
93 | |||
94 | #define MGMT_OP_SET_SERVICE_CACHE 0x000C | ||
95 | struct mgmt_cp_set_service_cache { | ||
96 | __u8 enable; | ||
97 | } __packed; | ||
98 | |||
99 | struct mgmt_key_info { | ||
100 | bdaddr_t bdaddr; | ||
101 | u8 type; | ||
102 | u8 val[16]; | ||
103 | u8 pin_len; | ||
104 | } __packed; | ||
105 | |||
106 | #define MGMT_OP_LOAD_KEYS 0x000D | ||
107 | struct mgmt_cp_load_keys { | ||
108 | __u8 debug_keys; | ||
109 | __le16 key_count; | ||
110 | struct mgmt_key_info keys[0]; | ||
111 | } __packed; | ||
112 | |||
113 | #define MGMT_OP_REMOVE_KEY 0x000E | ||
114 | struct mgmt_cp_remove_key { | ||
115 | bdaddr_t bdaddr; | ||
116 | __u8 disconnect; | ||
117 | } __packed; | ||
118 | |||
119 | #define MGMT_OP_DISCONNECT 0x000F | ||
120 | struct mgmt_cp_disconnect { | ||
121 | bdaddr_t bdaddr; | ||
122 | } __packed; | ||
123 | struct mgmt_rp_disconnect { | ||
124 | bdaddr_t bdaddr; | ||
125 | } __packed; | ||
126 | |||
127 | #define MGMT_OP_GET_CONNECTIONS 0x0010 | ||
128 | struct mgmt_rp_get_connections { | ||
129 | __le16 conn_count; | ||
130 | bdaddr_t conn[0]; | ||
131 | } __packed; | ||
132 | |||
133 | #define MGMT_OP_PIN_CODE_REPLY 0x0011 | ||
134 | struct mgmt_cp_pin_code_reply { | ||
135 | bdaddr_t bdaddr; | ||
136 | __u8 pin_len; | ||
137 | __u8 pin_code[16]; | ||
138 | } __packed; | ||
139 | struct mgmt_rp_pin_code_reply { | ||
140 | bdaddr_t bdaddr; | ||
141 | uint8_t status; | ||
142 | } __packed; | ||
143 | |||
144 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 | ||
145 | struct mgmt_cp_pin_code_neg_reply { | ||
146 | bdaddr_t bdaddr; | ||
147 | } __packed; | ||
148 | |||
149 | #define MGMT_OP_SET_IO_CAPABILITY 0x0013 | ||
150 | struct mgmt_cp_set_io_capability { | ||
151 | __u8 io_capability; | ||
152 | } __packed; | ||
153 | |||
154 | #define MGMT_OP_PAIR_DEVICE 0x0014 | ||
155 | struct mgmt_cp_pair_device { | ||
156 | bdaddr_t bdaddr; | ||
157 | __u8 io_cap; | ||
158 | } __packed; | ||
159 | struct mgmt_rp_pair_device { | ||
160 | bdaddr_t bdaddr; | ||
161 | __u8 status; | ||
162 | } __packed; | ||
163 | |||
164 | #define MGMT_OP_USER_CONFIRM_REPLY 0x0015 | ||
165 | struct mgmt_cp_user_confirm_reply { | ||
166 | bdaddr_t bdaddr; | ||
167 | } __packed; | ||
168 | struct mgmt_rp_user_confirm_reply { | ||
169 | bdaddr_t bdaddr; | ||
170 | __u8 status; | ||
171 | } __packed; | ||
172 | |||
173 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016 | ||
174 | |||
175 | #define MGMT_OP_SET_LOCAL_NAME 0x0017 | ||
176 | struct mgmt_cp_set_local_name { | ||
177 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
178 | } __packed; | ||
179 | |||
180 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x0018 | ||
181 | struct mgmt_rp_read_local_oob_data { | ||
182 | __u8 hash[16]; | ||
183 | __u8 randomizer[16]; | ||
184 | } __packed; | ||
185 | |||
186 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0019 | ||
187 | struct mgmt_cp_add_remote_oob_data { | ||
188 | bdaddr_t bdaddr; | ||
189 | __u8 hash[16]; | ||
190 | __u8 randomizer[16]; | ||
191 | } __packed; | ||
192 | |||
193 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x001A | ||
194 | struct mgmt_cp_remove_remote_oob_data { | ||
195 | bdaddr_t bdaddr; | ||
196 | } __packed; | ||
197 | |||
198 | #define MGMT_OP_START_DISCOVERY 0x001B | ||
199 | |||
200 | #define MGMT_OP_STOP_DISCOVERY 0x001C | ||
201 | |||
202 | #define MGMT_EV_CMD_COMPLETE 0x0001 | ||
203 | struct mgmt_ev_cmd_complete { | ||
204 | __le16 opcode; | ||
205 | __u8 data[0]; | ||
206 | } __packed; | ||
207 | |||
208 | #define MGMT_EV_CMD_STATUS 0x0002 | ||
209 | struct mgmt_ev_cmd_status { | ||
210 | __u8 status; | ||
211 | __le16 opcode; | ||
212 | } __packed; | ||
213 | |||
214 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 | ||
215 | struct mgmt_ev_controller_error { | ||
216 | __u8 error_code; | ||
217 | } __packed; | ||
218 | |||
219 | #define MGMT_EV_INDEX_ADDED 0x0004 | ||
220 | |||
221 | #define MGMT_EV_INDEX_REMOVED 0x0005 | ||
222 | |||
223 | #define MGMT_EV_POWERED 0x0006 | ||
224 | |||
225 | #define MGMT_EV_DISCOVERABLE 0x0007 | ||
226 | |||
227 | #define MGMT_EV_CONNECTABLE 0x0008 | ||
228 | |||
229 | #define MGMT_EV_PAIRABLE 0x0009 | ||
230 | |||
231 | #define MGMT_EV_NEW_KEY 0x000A | ||
232 | struct mgmt_ev_new_key { | ||
233 | __u8 store_hint; | ||
234 | struct mgmt_key_info key; | ||
235 | } __packed; | ||
236 | |||
237 | #define MGMT_EV_CONNECTED 0x000B | ||
238 | struct mgmt_ev_connected { | ||
239 | bdaddr_t bdaddr; | ||
240 | } __packed; | ||
241 | |||
242 | #define MGMT_EV_DISCONNECTED 0x000C | ||
243 | struct mgmt_ev_disconnected { | ||
244 | bdaddr_t bdaddr; | ||
245 | } __packed; | ||
246 | |||
247 | #define MGMT_EV_CONNECT_FAILED 0x000D | ||
248 | struct mgmt_ev_connect_failed { | ||
249 | bdaddr_t bdaddr; | ||
250 | __u8 status; | ||
251 | } __packed; | ||
252 | |||
253 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E | ||
254 | struct mgmt_ev_pin_code_request { | ||
255 | bdaddr_t bdaddr; | ||
256 | __u8 secure; | ||
257 | } __packed; | ||
258 | |||
259 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F | ||
260 | struct mgmt_ev_user_confirm_request { | ||
261 | bdaddr_t bdaddr; | ||
262 | __u8 confirm_hint; | ||
263 | __le32 value; | ||
264 | } __packed; | ||
265 | |||
266 | #define MGMT_EV_AUTH_FAILED 0x0010 | ||
267 | struct mgmt_ev_auth_failed { | ||
268 | bdaddr_t bdaddr; | ||
269 | __u8 status; | ||
270 | } __packed; | ||
271 | |||
272 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0011 | ||
273 | struct mgmt_ev_local_name_changed { | ||
274 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
275 | } __packed; | ||
276 | |||
277 | #define MGMT_EV_DEVICE_FOUND 0x0012 | ||
278 | struct mgmt_ev_device_found { | ||
279 | bdaddr_t bdaddr; | ||
280 | __u8 dev_class[3]; | ||
281 | __s8 rssi; | ||
282 | __u8 eir[HCI_MAX_EIR_LENGTH]; | ||
283 | } __packed; | ||
284 | |||
285 | #define MGMT_EV_REMOTE_NAME 0x0013 | ||
286 | struct mgmt_ev_remote_name { | ||
287 | bdaddr_t bdaddr; | ||
288 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
289 | } __packed; | ||
290 | |||
291 | #define MGMT_EV_DISCOVERING 0x0014 | ||
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index a140847d622c..6eac4a760c3b 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | RFCOMM implementation for Linux Bluetooth stack (BlueZ). | 2 | RFCOMM implementation for Linux Bluetooth stack (BlueZ) |
3 | Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> | 3 | Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> |
4 | Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> | 4 | Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> |
5 | 5 | ||
@@ -11,13 +11,13 @@ | |||
11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. |
13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | 13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | 14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES |
15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
18 | 18 | ||
19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | 19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | 20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
21 | SOFTWARE IS DISCLAIMED. | 21 | SOFTWARE IS DISCLAIMED. |
22 | */ | 22 | */ |
23 | 23 | ||
@@ -105,7 +105,7 @@ | |||
105 | struct rfcomm_hdr { | 105 | struct rfcomm_hdr { |
106 | u8 addr; | 106 | u8 addr; |
107 | u8 ctrl; | 107 | u8 ctrl; |
108 | u8 len; // Actual size can be 2 bytes | 108 | u8 len; /* Actual size can be 2 bytes */ |
109 | } __packed; | 109 | } __packed; |
110 | 110 | ||
111 | struct rfcomm_cmd { | 111 | struct rfcomm_cmd { |
@@ -213,11 +213,6 @@ struct rfcomm_dlc { | |||
213 | #define RFCOMM_DEFER_SETUP 8 | 213 | #define RFCOMM_DEFER_SETUP 8 |
214 | 214 | ||
215 | /* Scheduling flags and events */ | 215 | /* Scheduling flags and events */ |
216 | #define RFCOMM_SCHED_STATE 0 | ||
217 | #define RFCOMM_SCHED_RX 1 | ||
218 | #define RFCOMM_SCHED_TX 2 | ||
219 | #define RFCOMM_SCHED_TIMEO 3 | ||
220 | #define RFCOMM_SCHED_AUTH 4 | ||
221 | #define RFCOMM_SCHED_WAKEUP 31 | 216 | #define RFCOMM_SCHED_WAKEUP 31 |
222 | 217 | ||
223 | /* MSC exchange flags */ | 218 | /* MSC exchange flags */ |
@@ -233,7 +228,7 @@ struct rfcomm_dlc { | |||
233 | /* ---- RFCOMM SEND RPN ---- */ | 228 | /* ---- RFCOMM SEND RPN ---- */ |
234 | int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, | 229 | int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, |
235 | u8 bit_rate, u8 data_bits, u8 stop_bits, | 230 | u8 bit_rate, u8 data_bits, u8 stop_bits, |
236 | u8 parity, u8 flow_ctrl_settings, | 231 | u8 parity, u8 flow_ctrl_settings, |
237 | u8 xon_char, u8 xoff_char, u16 param_mask); | 232 | u8 xon_char, u8 xoff_char, u16 param_mask); |
238 | 233 | ||
239 | /* ---- RFCOMM DLCs (channels) ---- */ | 234 | /* ---- RFCOMM DLCs (channels) ---- */ |
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h index e28a2a771471..1e35c43657c8 100644 --- a/include/net/bluetooth/sco.h +++ b/include/net/bluetooth/sco.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | BlueZ - Bluetooth protocol stack for Linux | 2 | BlueZ - Bluetooth protocol stack for Linux |
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
4 | 4 | ||
@@ -12,13 +12,13 @@ | |||
12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | 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 | 14 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
15 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | 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 | 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 | 17 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | 19 | ||
20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | 20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | 21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
22 | SOFTWARE IS DISCLAIMED. | 22 | SOFTWARE IS DISCLAIMED. |
23 | */ | 23 | */ |
24 | 24 | ||
@@ -55,11 +55,11 @@ struct sco_conninfo { | |||
55 | struct sco_conn { | 55 | struct sco_conn { |
56 | struct hci_conn *hcon; | 56 | struct hci_conn *hcon; |
57 | 57 | ||
58 | bdaddr_t *dst; | 58 | bdaddr_t *dst; |
59 | bdaddr_t *src; | 59 | bdaddr_t *src; |
60 | 60 | ||
61 | spinlock_t lock; | 61 | spinlock_t lock; |
62 | struct sock *sk; | 62 | struct sock *sk; |
63 | 63 | ||
64 | unsigned int mtu; | 64 | unsigned int mtu; |
65 | }; | 65 | }; |
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 | |||
4 | struct smp_command_hdr { | ||
5 | __u8 code; | ||
6 | } __packed; | ||
7 | |||
8 | #define SMP_CMD_PAIRING_REQ 0x01 | ||
9 | #define SMP_CMD_PAIRING_RSP 0x02 | ||
10 | struct 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 | ||
20 | struct smp_cmd_pairing_confirm { | ||
21 | __u8 confirm_val[16]; | ||
22 | } __packed; | ||
23 | |||
24 | #define SMP_CMD_PAIRING_RANDOM 0x04 | ||
25 | struct smp_cmd_pairing_random { | ||
26 | __u8 rand_val[16]; | ||
27 | } __packed; | ||
28 | |||
29 | #define SMP_CMD_PAIRING_FAIL 0x05 | ||
30 | struct smp_cmd_pairing_fail { | ||
31 | __u8 reason; | ||
32 | } __packed; | ||
33 | |||
34 | #define SMP_CMD_ENCRYPT_INFO 0x06 | ||
35 | struct smp_cmd_encrypt_info { | ||
36 | __u8 ltk[16]; | ||
37 | } __packed; | ||
38 | |||
39 | #define SMP_CMD_MASTER_IDENT 0x07 | ||
40 | struct smp_cmd_master_ident { | ||
41 | __u16 ediv; | ||
42 | __u8 rand[8]; | ||
43 | } __packed; | ||
44 | |||
45 | #define SMP_CMD_IDENT_INFO 0x08 | ||
46 | struct smp_cmd_ident_info { | ||
47 | __u8 irk[16]; | ||
48 | } __packed; | ||
49 | |||
50 | #define SMP_CMD_IDENT_ADDR_INFO 0x09 | ||
51 | struct smp_cmd_ident_addr_info { | ||
52 | __u8 addr_type; | ||
53 | bdaddr_t bdaddr; | ||
54 | } __packed; | ||
55 | |||
56 | #define SMP_CMD_SIGN_INFO 0x0a | ||
57 | struct smp_cmd_sign_info { | ||
58 | __u8 csrk[16]; | ||
59 | } __packed; | ||
60 | |||
61 | #define SMP_CMD_SECURITY_REQ 0x0b | ||
62 | struct 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 */ | ||