aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-06-22 16:06:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-22 16:06:58 -0400
commit1c1236e3af9c0a52e63c1c386413f13627e68e67 (patch)
tree554430c73c927a8a3fcab132cad83f4a04a7626d /include
parente10542c447abf7c840931ff12f7d0dee976ca2ea (diff)
parent43f3dc41571c47a1fbded9aca1cf0a737967b005 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6
Diffstat (limited to 'include')
-rw-r--r--include/net/bluetooth/hci.h34
-rw-r--r--include/net/bluetooth/hci_core.h13
-rw-r--r--include/net/bluetooth/l2cap.h95
-rw-r--r--include/net/bluetooth/mgmt.h10
-rw-r--r--include/net/bluetooth/smp.h46
5 files changed, 165 insertions, 33 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index bd285c6a5509..65345cd215be 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -745,6 +745,33 @@ struct hci_cp_le_conn_update {
745 __le16 max_ce_len; 745 __le16 max_ce_len;
746} __packed; 746} __packed;
747 747
748#define HCI_OP_LE_START_ENC 0x2019
749struct hci_cp_le_start_enc {
750 __le16 handle;
751 __u8 rand[8];
752 __le16 ediv;
753 __u8 ltk[16];
754} __packed;
755
756#define HCI_OP_LE_LTK_REPLY 0x201a
757struct hci_cp_le_ltk_reply {
758 __le16 handle;
759 __u8 ltk[16];
760} __packed;
761struct hci_rp_le_ltk_reply {
762 __u8 status;
763 __le16 handle;
764} __packed;
765
766#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
767struct hci_cp_le_ltk_neg_reply {
768 __le16 handle;
769} __packed;
770struct hci_rp_le_ltk_neg_reply {
771 __u8 status;
772 __le16 handle;
773} __packed;
774
748/* ---- HCI Events ---- */ 775/* ---- HCI Events ---- */
749#define HCI_EV_INQUIRY_COMPLETE 0x01 776#define HCI_EV_INQUIRY_COMPLETE 0x01
750 777
@@ -1035,6 +1062,13 @@ struct hci_ev_le_conn_complete {
1035 __u8 clk_accurancy; 1062 __u8 clk_accurancy;
1036} __packed; 1063} __packed;
1037 1064
1065#define HCI_EV_LE_LTK_REQ 0x05
1066struct hci_ev_le_ltk_req {
1067 __le16 handle;
1068 __u8 random[8];
1069 __le16 ediv;
1070} __packed;
1071
1038/* Advertising report event types */ 1072/* Advertising report event types */
1039#define ADV_IND 0x00 1073#define ADV_IND 0x00
1040#define ADV_DIRECT_IND 0x01 1074#define ADV_DIRECT_IND 0x01
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 836d3e8c4bf1..26233d4d371c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -177,6 +177,8 @@ struct hci_dev {
177 177
178 __u16 init_last_cmd; 178 __u16 init_last_cmd;
179 179
180 struct crypto_blkcipher *tfm;
181
180 struct inquiry_cache inq_cache; 182 struct inquiry_cache inq_cache;
181 struct hci_conn_hash conn_hash; 183 struct hci_conn_hash conn_hash;
182 struct list_head blacklist; 184 struct list_head blacklist;
@@ -247,6 +249,7 @@ struct hci_conn {
247 __u8 power_save; 249 __u8 power_save;
248 __u16 disc_timeout; 250 __u16 disc_timeout;
249 unsigned long pend; 251 unsigned long pend;
252 __u8 ltk[16];
250 253
251 __u8 remote_cap; 254 __u8 remote_cap;
252 __u8 remote_oob; 255 __u8 remote_oob;
@@ -526,6 +529,8 @@ int hci_inquiry(void __user *arg);
526 529
527struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 530struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
528int hci_blacklist_clear(struct hci_dev *hdev); 531int hci_blacklist_clear(struct hci_dev *hdev);
532int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr);
533int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr);
529 534
530int hci_uuids_clear(struct hci_dev *hdev); 535int hci_uuids_clear(struct hci_dev *hdev);
531 536
@@ -742,6 +747,9 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
742 if (conn->sec_level == BT_SECURITY_SDP) 747 if (conn->sec_level == BT_SECURITY_SDP)
743 conn->sec_level = BT_SECURITY_LOW; 748 conn->sec_level = BT_SECURITY_LOW;
744 749
750 if (conn->pending_sec_level > conn->sec_level)
751 conn->sec_level = conn->pending_sec_level;
752
745 hci_proto_encrypt_cfm(conn, status, encrypt); 753 hci_proto_encrypt_cfm(conn, status, encrypt);
746 754
747 read_lock_bh(&hci_cb_list_lock); 755 read_lock_bh(&hci_cb_list_lock);
@@ -859,4 +867,9 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result);
859 867
860void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 868void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
861 u16 latency, u16 to_multiplier); 869 u16 latency, u16 to_multiplier);
870void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
871 __u8 ltk[16]);
872void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]);
873void hci_le_ltk_neg_reply(struct hci_conn *conn);
874
862#endif /* __HCI_CORE_H */ 875#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 0529d278e068..9c18e555b6ed 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -287,6 +287,10 @@ struct l2cap_chan {
287 287
288 struct l2cap_conn *conn; 288 struct l2cap_conn *conn;
289 289
290 __u8 state;
291
292 atomic_t refcnt;
293
290 __le16 psm; 294 __le16 psm;
291 __u16 dcid; 295 __u16 dcid;
292 __u16 scid; 296 __u16 scid;
@@ -320,8 +324,8 @@ struct l2cap_chan {
320 __u16 monitor_timeout; 324 __u16 monitor_timeout;
321 __u16 mps; 325 __u16 mps;
322 326
323 __u8 conf_state; 327 unsigned long conf_state;
324 __u16 conn_state; 328 unsigned long conn_state;
325 329
326 __u8 next_tx_seq; 330 __u8 next_tx_seq;
327 __u8 expected_ack_seq; 331 __u8 expected_ack_seq;
@@ -354,6 +358,18 @@ struct l2cap_chan {
354 358
355 struct list_head list; 359 struct list_head list;
356 struct list_head global_l; 360 struct list_head global_l;
361
362 void *data;
363 struct l2cap_ops *ops;
364};
365
366struct l2cap_ops {
367 char *name;
368
369 struct l2cap_chan *(*new_connection) (void *data);
370 int (*recv) (void *data, struct sk_buff *skb);
371 void (*close) (void *data);
372 void (*state_change) (void *data, int state);
357}; 373};
358 374
359struct l2cap_conn { 375struct l2cap_conn {
@@ -379,6 +395,15 @@ struct l2cap_conn {
379 395
380 __u8 disc_reason; 396 __u8 disc_reason;
381 397
398 __u8 preq[7]; /* SMP Pairing Request */
399 __u8 prsp[7]; /* SMP Pairing Response */
400 __u8 prnd[16]; /* SMP Pairing Random */
401 __u8 pcnf[16]; /* SMP Pairing Confirm */
402 __u8 tk[16]; /* SMP Temporary Key */
403 __u8 smp_key_size;
404
405 struct timer_list security_timer;
406
382 struct list_head chan_l; 407 struct list_head chan_l;
383 rwlock_t chan_lock; 408 rwlock_t chan_lock;
384}; 409};
@@ -399,36 +424,45 @@ struct l2cap_pinfo {
399 struct l2cap_chan *chan; 424 struct l2cap_chan *chan;
400}; 425};
401 426
402#define L2CAP_CONF_REQ_SENT 0x01 427enum {
403#define L2CAP_CONF_INPUT_DONE 0x02 428 CONF_REQ_SENT,
404#define L2CAP_CONF_OUTPUT_DONE 0x04 429 CONF_INPUT_DONE,
405#define L2CAP_CONF_MTU_DONE 0x08 430 CONF_OUTPUT_DONE,
406#define L2CAP_CONF_MODE_DONE 0x10 431 CONF_MTU_DONE,
407#define L2CAP_CONF_CONNECT_PEND 0x20 432 CONF_MODE_DONE,
408#define L2CAP_CONF_NO_FCS_RECV 0x40 433 CONF_CONNECT_PEND,
409#define L2CAP_CONF_STATE2_DEVICE 0x80 434 CONF_NO_FCS_RECV,
435 CONF_STATE2_DEVICE,
436};
410 437
411#define L2CAP_CONF_MAX_CONF_REQ 2 438#define L2CAP_CONF_MAX_CONF_REQ 2
412#define L2CAP_CONF_MAX_CONF_RSP 2 439#define L2CAP_CONF_MAX_CONF_RSP 2
413 440
414#define L2CAP_CONN_SAR_SDU 0x0001 441enum {
415#define L2CAP_CONN_SREJ_SENT 0x0002 442 CONN_SAR_SDU,
416#define L2CAP_CONN_WAIT_F 0x0004 443 CONN_SREJ_SENT,
417#define L2CAP_CONN_SREJ_ACT 0x0008 444 CONN_WAIT_F,
418#define L2CAP_CONN_SEND_PBIT 0x0010 445 CONN_SREJ_ACT,
419#define L2CAP_CONN_REMOTE_BUSY 0x0020 446 CONN_SEND_PBIT,
420#define L2CAP_CONN_LOCAL_BUSY 0x0040 447 CONN_REMOTE_BUSY,
421#define L2CAP_CONN_REJ_ACT 0x0080 448 CONN_LOCAL_BUSY,
422#define L2CAP_CONN_SEND_FBIT 0x0100 449 CONN_REJ_ACT,
423#define L2CAP_CONN_RNR_SENT 0x0200 450 CONN_SEND_FBIT,
424#define L2CAP_CONN_SAR_RETRY 0x0400 451 CONN_RNR_SENT,
425 452 CONN_SAR_RETRY,
426#define __mod_retrans_timer() mod_timer(&chan->retrans_timer, \ 453};
427 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); 454
428#define __mod_monitor_timer() mod_timer(&chan->monitor_timer, \ 455#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
429 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); 456#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
430#define __mod_ack_timer() mod_timer(&chan->ack_timer, \ 457#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
431 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); 458 L2CAP_DEFAULT_RETRANS_TO);
459#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
460#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \
461 L2CAP_DEFAULT_MONITOR_TO);
462#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
463#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
464 L2CAP_DEFAULT_ACK_TO);
465#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
432 466
433static inline int l2cap_tx_window_full(struct l2cap_chan *ch) 467static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
434{ 468{
@@ -459,11 +493,6 @@ int __l2cap_wait_ack(struct sock *sk);
459int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); 493int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
460int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); 494int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
461 495
462void l2cap_sock_kill(struct sock *sk);
463void l2cap_sock_init(struct sock *sk, struct sock *parent);
464struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
465 int proto, gfp_t prio);
466
467struct l2cap_chan *l2cap_chan_create(struct sock *sk); 496struct l2cap_chan *l2cap_chan_create(struct sock *sk);
468void l2cap_chan_close(struct l2cap_chan *chan, int reason); 497void l2cap_chan_close(struct l2cap_chan *chan, int reason);
469void l2cap_chan_destroy(struct l2cap_chan *chan); 498void l2cap_chan_destroy(struct l2cap_chan *chan);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 4899286ed4e4..45bea25d737f 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -199,6 +199,16 @@ struct mgmt_cp_remove_remote_oob_data {
199 199
200#define MGMT_OP_STOP_DISCOVERY 0x001C 200#define MGMT_OP_STOP_DISCOVERY 0x001C
201 201
202#define MGMT_OP_BLOCK_DEVICE 0x001D
203struct mgmt_cp_block_device {
204 bdaddr_t bdaddr;
205} __packed;
206
207#define MGMT_OP_UNBLOCK_DEVICE 0x001E
208struct mgmt_cp_unblock_device {
209 bdaddr_t bdaddr;
210} __packed;
211
202#define MGMT_EV_CMD_COMPLETE 0x0001 212#define MGMT_EV_CMD_COMPLETE 0x0001
203struct mgmt_ev_cmd_complete { 213struct mgmt_ev_cmd_complete {
204 __le16 opcode; 214 __le16 opcode;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 8f2edbf979dc..4fb7d198a876 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -1,3 +1,25 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 as
7 published by the Free Software Foundation;
8
9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
12 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
13 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
19 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
20 SOFTWARE IS DISCLAIMED.
21*/
22
1#ifndef __SMP_H 23#ifndef __SMP_H
2#define __SMP_H 24#define __SMP_H
3 25
@@ -16,6 +38,23 @@ struct smp_cmd_pairing {
16 __u8 resp_key_dist; 38 __u8 resp_key_dist;
17} __packed; 39} __packed;
18 40
41#define SMP_IO_DISPLAY_ONLY 0x00
42#define SMP_IO_DISPLAY_YESNO 0x01
43#define SMP_IO_KEYBOARD_ONLY 0x02
44#define SMP_IO_NO_INPUT_OUTPUT 0x03
45#define SMP_IO_KEYBOARD_DISPLAY 0x04
46
47#define SMP_OOB_NOT_PRESENT 0x00
48#define SMP_OOB_PRESENT 0x01
49
50#define SMP_DIST_ENC_KEY 0x01
51#define SMP_DIST_ID_KEY 0x02
52#define SMP_DIST_SIGN 0x04
53
54#define SMP_AUTH_NONE 0x00
55#define SMP_AUTH_BONDING 0x01
56#define SMP_AUTH_MITM 0x04
57
19#define SMP_CMD_PAIRING_CONFIRM 0x03 58#define SMP_CMD_PAIRING_CONFIRM 0x03
20struct smp_cmd_pairing_confirm { 59struct smp_cmd_pairing_confirm {
21 __u8 confirm_val[16]; 60 __u8 confirm_val[16];
@@ -73,4 +112,11 @@ struct smp_cmd_security_req {
73#define SMP_UNSPECIFIED 0x08 112#define SMP_UNSPECIFIED 0x08
74#define SMP_REPEATED_ATTEMPTS 0x09 113#define SMP_REPEATED_ATTEMPTS 0x09
75 114
115#define SMP_MIN_ENC_KEY_SIZE 7
116#define SMP_MAX_ENC_KEY_SIZE 16
117
118/* SMP Commands */
119int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level);
120int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
121
76#endif /* __SMP_H */ 122#endif /* __SMP_H */