aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r--include/net/bluetooth/hci.h9
-rw-r--r--include/net/bluetooth/hci_core.h16
-rw-r--r--include/net/bluetooth/l2cap.h69
-rw-r--r--include/net/bluetooth/mgmt.h10
4 files changed, 65 insertions, 39 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 499b7b7c7c9..0c20227e57f 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -246,6 +246,15 @@ enum {
246#define HCI_AT_GENERAL_BONDING 0x04 246#define HCI_AT_GENERAL_BONDING 0x04
247#define HCI_AT_GENERAL_BONDING_MITM 0x05 247#define HCI_AT_GENERAL_BONDING_MITM 0x05
248 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
249/* ----- HCI Commands ---- */ 258/* ----- HCI Commands ---- */
250#define HCI_OP_NOP 0x0000 259#define HCI_OP_NOP 0x0000
251 260
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 4093133c128..14cc3249c1e 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -126,6 +126,8 @@ struct hci_dev {
126 __u16 sniff_min_interval; 126 __u16 sniff_min_interval;
127 __u16 sniff_max_interval; 127 __u16 sniff_max_interval;
128 128
129 unsigned int auto_accept_delay;
130
129 unsigned long quirks; 131 unsigned long quirks;
130 132
131 atomic_t cmd_cnt; 133 atomic_t cmd_cnt;
@@ -226,6 +228,7 @@ struct hci_conn {
226 __u16 pkt_type; 228 __u16 pkt_type;
227 __u16 link_policy; 229 __u16 link_policy;
228 __u32 link_mode; 230 __u32 link_mode;
231 __u8 key_type;
229 __u8 auth_type; 232 __u8 auth_type;
230 __u8 sec_level; 233 __u8 sec_level;
231 __u8 pending_sec_level; 234 __u8 pending_sec_level;
@@ -245,6 +248,7 @@ struct hci_conn {
245 248
246 struct timer_list disc_timer; 249 struct timer_list disc_timer;
247 struct timer_list idle_timer; 250 struct timer_list idle_timer;
251 struct timer_list auto_accept_timer;
248 252
249 struct work_struct work_add; 253 struct work_struct work_add;
250 struct work_struct work_del; 254 struct work_struct work_del;
@@ -511,8 +515,8 @@ int hci_uuids_clear(struct hci_dev *hdev);
511 515
512int hci_link_keys_clear(struct hci_dev *hdev); 516int hci_link_keys_clear(struct hci_dev *hdev);
513struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 517struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
514int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, 518int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
515 u8 *key, u8 type, u8 pin_len); 519 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
516int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 520int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
517 521
518int hci_remote_oob_data_clear(struct hci_dev *hdev); 522int hci_remote_oob_data_clear(struct hci_dev *hdev);
@@ -771,15 +775,16 @@ int mgmt_index_removed(u16 index);
771int mgmt_powered(u16 index, u8 powered); 775int mgmt_powered(u16 index, u8 powered);
772int mgmt_discoverable(u16 index, u8 discoverable); 776int mgmt_discoverable(u16 index, u8 discoverable);
773int mgmt_connectable(u16 index, u8 connectable); 777int mgmt_connectable(u16 index, u8 connectable);
774int mgmt_new_key(u16 index, struct link_key *key, u8 old_key_type); 778int mgmt_new_key(u16 index, struct link_key *key, u8 persistent);
775int mgmt_connected(u16 index, bdaddr_t *bdaddr); 779int mgmt_connected(u16 index, bdaddr_t *bdaddr);
776int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); 780int mgmt_disconnected(u16 index, bdaddr_t *bdaddr);
777int mgmt_disconnect_failed(u16 index); 781int mgmt_disconnect_failed(u16 index);
778int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); 782int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
779int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr); 783int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure);
780int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); 784int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
781int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); 785int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
782int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value); 786int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value,
787 u8 confirm_hint);
783int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); 788int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
784int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, 789int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr,
785 u8 status); 790 u8 status);
@@ -790,6 +795,7 @@ int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer,
790int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, 795int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi,
791 u8 *eir); 796 u8 *eir);
792int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); 797int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name);
798int mgmt_discovering(u16 index, u8 discovering);
793 799
794/* HCI info for socket */ 800/* HCI info for socket */
795#define hci_pi(sk) ((struct hci_pinfo *) sk) 801#define hci_pi(sk) ((struct hci_pinfo *) sk)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7a215a7f9e3..c34b1c12636 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -284,6 +284,25 @@ struct srej_list {
284 284
285struct l2cap_chan { 285struct l2cap_chan {
286 struct sock *sk; 286 struct sock *sk;
287
288 struct l2cap_conn *conn;
289
290 __le16 psm;
291 __u16 dcid;
292 __u16 scid;
293
294 __u16 imtu;
295 __u16 omtu;
296 __u16 flush_to;
297 __u8 mode;
298
299 __le16 sport;
300
301 __u8 sec_level;
302 __u8 role_switch;
303 __u8 force_reliable;
304 __u8 flushable;
305
287 __u8 ident; 306 __u8 ident;
288 307
289 __u8 conf_req[64]; 308 __u8 conf_req[64];
@@ -291,6 +310,15 @@ struct l2cap_chan {
291 __u8 num_conf_req; 310 __u8 num_conf_req;
292 __u8 num_conf_rsp; 311 __u8 num_conf_rsp;
293 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
321 __u8 conf_state;
294 __u16 conn_state; 322 __u16 conn_state;
295 323
296 __u8 next_tx_seq; 324 __u8 next_tx_seq;
@@ -360,32 +388,6 @@ struct l2cap_conn {
360 388
361struct l2cap_pinfo { 389struct l2cap_pinfo {
362 struct bt_sock bt; 390 struct bt_sock bt;
363 __le16 psm;
364 __u16 dcid;
365 __u16 scid;
366
367 __u16 imtu;
368 __u16 omtu;
369 __u16 flush_to;
370 __u8 mode;
371
372 __u8 fcs;
373 __u8 sec_level;
374 __u8 role_switch;
375 __u8 force_reliable;
376 __u8 flushable;
377
378 __u8 conf_state;
379
380 __u8 tx_win;
381 __u8 max_tx;
382 __u16 retrans_timeout;
383 __u16 monitor_timeout;
384 __u16 mps;
385
386 __le16 sport;
387
388 struct l2cap_conn *conn;
389 struct l2cap_chan *chan; 391 struct l2cap_chan *chan;
390}; 392};
391 393
@@ -439,21 +441,20 @@ static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
439#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) 441#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START)
440 442
441extern int disable_ertm; 443extern int disable_ertm;
442extern const struct proto_ops l2cap_sock_ops;
443extern struct bt_sock_list l2cap_sk_list; 444extern struct bt_sock_list l2cap_sk_list;
444 445
445int l2cap_init_sockets(void); 446int l2cap_init_sockets(void);
446void l2cap_cleanup_sockets(void); 447void l2cap_cleanup_sockets(void);
447 448
448void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); 449void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data);
449void __l2cap_connect_rsp_defer(struct sock *sk); 450void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
450int __l2cap_wait_ack(struct sock *sk); 451int __l2cap_wait_ack(struct sock *sk);
451 452
452struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len); 453struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
453struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len); 454struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
454struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen); 455struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len, u16 control, u16 sdulen);
455int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); 456int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
456void l2cap_do_send(struct sock *sk, struct sk_buff *skb); 457void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb);
457void l2cap_streaming_send(struct l2cap_chan *chan); 458void l2cap_streaming_send(struct l2cap_chan *chan);
458int l2cap_ertm_send(struct l2cap_chan *chan); 459int l2cap_ertm_send(struct l2cap_chan *chan);
459 460
@@ -465,7 +466,9 @@ void l2cap_sock_init(struct sock *sk, struct sock *parent);
465struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, 466struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
466 int proto, gfp_t prio); 467 int proto, gfp_t prio);
467void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err); 468void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err);
469struct l2cap_chan *l2cap_chan_alloc(struct sock *sk);
468void l2cap_chan_del(struct l2cap_chan *chan, int err); 470void l2cap_chan_del(struct l2cap_chan *chan, int err);
469int l2cap_do_connect(struct sock *sk); 471void l2cap_chan_free(struct l2cap_chan *chan);
472int l2cap_chan_connect(struct l2cap_chan *chan);
470 473
471#endif /* __L2CAP_H */ 474#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 6b6ff92ab49..4899286ed4e 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -195,6 +195,10 @@ struct mgmt_cp_remove_remote_oob_data {
195 bdaddr_t bdaddr; 195 bdaddr_t bdaddr;
196} __packed; 196} __packed;
197 197
198#define MGMT_OP_START_DISCOVERY 0x001B
199
200#define MGMT_OP_STOP_DISCOVERY 0x001C
201
198#define MGMT_EV_CMD_COMPLETE 0x0001 202#define MGMT_EV_CMD_COMPLETE 0x0001
199struct mgmt_ev_cmd_complete { 203struct mgmt_ev_cmd_complete {
200 __le16 opcode; 204 __le16 opcode;
@@ -226,8 +230,8 @@ struct mgmt_ev_controller_error {
226 230
227#define MGMT_EV_NEW_KEY 0x000A 231#define MGMT_EV_NEW_KEY 0x000A
228struct mgmt_ev_new_key { 232struct mgmt_ev_new_key {
233 __u8 store_hint;
229 struct mgmt_key_info key; 234 struct mgmt_key_info key;
230 __u8 old_key_type;
231} __packed; 235} __packed;
232 236
233#define MGMT_EV_CONNECTED 0x000B 237#define MGMT_EV_CONNECTED 0x000B
@@ -249,11 +253,13 @@ struct mgmt_ev_connect_failed {
249#define MGMT_EV_PIN_CODE_REQUEST 0x000E 253#define MGMT_EV_PIN_CODE_REQUEST 0x000E
250struct mgmt_ev_pin_code_request { 254struct mgmt_ev_pin_code_request {
251 bdaddr_t bdaddr; 255 bdaddr_t bdaddr;
256 __u8 secure;
252} __packed; 257} __packed;
253 258
254#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F 259#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
255struct mgmt_ev_user_confirm_request { 260struct mgmt_ev_user_confirm_request {
256 bdaddr_t bdaddr; 261 bdaddr_t bdaddr;
262 __u8 confirm_hint;
257 __le32 value; 263 __le32 value;
258} __packed; 264} __packed;
259 265
@@ -281,3 +287,5 @@ struct mgmt_ev_remote_name {
281 bdaddr_t bdaddr; 287 bdaddr_t bdaddr;
282 __u8 name[MGMT_MAX_NAME_LENGTH]; 288 __u8 name[MGMT_MAX_NAME_LENGTH];
283} __packed; 289} __packed;
290
291#define MGMT_EV_DISCOVERING 0x0014