aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/bluetooth/hci.h150
-rw-r--r--include/net/bluetooth/hci_core.h34
-rw-r--r--include/net/bluetooth/hci_sock.h175
-rw-r--r--include/net/bluetooth/l2cap.h8
-rw-r--r--include/net/bluetooth/sco.h30
5 files changed, 184 insertions, 213 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index a01236e2df13..2fee852816ee 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -202,33 +202,6 @@ enum {
202#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ 202#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
203 BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV)) 203 BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV))
204 204
205/* HCI ioctl defines */
206#define HCIDEVUP _IOW('H', 201, int)
207#define HCIDEVDOWN _IOW('H', 202, int)
208#define HCIDEVRESET _IOW('H', 203, int)
209#define HCIDEVRESTAT _IOW('H', 204, int)
210
211#define HCIGETDEVLIST _IOR('H', 210, int)
212#define HCIGETDEVINFO _IOR('H', 211, int)
213#define HCIGETCONNLIST _IOR('H', 212, int)
214#define HCIGETCONNINFO _IOR('H', 213, int)
215#define HCIGETAUTHINFO _IOR('H', 215, int)
216
217#define HCISETRAW _IOW('H', 220, int)
218#define HCISETSCAN _IOW('H', 221, int)
219#define HCISETAUTH _IOW('H', 222, int)
220#define HCISETENCRYPT _IOW('H', 223, int)
221#define HCISETPTYPE _IOW('H', 224, int)
222#define HCISETLINKPOL _IOW('H', 225, int)
223#define HCISETLINKMODE _IOW('H', 226, int)
224#define HCISETACLMTU _IOW('H', 227, int)
225#define HCISETSCOMTU _IOW('H', 228, int)
226
227#define HCIBLOCKADDR _IOW('H', 230, int)
228#define HCIUNBLOCKADDR _IOW('H', 231, int)
229
230#define HCIINQUIRY _IOR('H', 240, int)
231
232/* HCI timeouts */ 205/* HCI timeouts */
233#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 206#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
234#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ 207#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */
@@ -356,6 +329,7 @@ enum {
356#define LMP_HOST_SC 0x08 329#define LMP_HOST_SC 0x08
357 330
358/* LE features */ 331/* LE features */
332#define HCI_LE_ENCRYPTION 0x01
359#define HCI_LE_CONN_PARAM_REQ_PROC 0x02 333#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
360#define HCI_LE_PING 0x10 334#define HCI_LE_PING 0x10
361 335
@@ -1871,126 +1845,4 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1871#define hci_handle(h) (h & 0x0fff) 1845#define hci_handle(h) (h & 0x0fff)
1872#define hci_flags(h) (h >> 12) 1846#define hci_flags(h) (h >> 12)
1873 1847
1874/* ---- HCI Sockets ---- */
1875
1876/* Socket options */
1877#define HCI_DATA_DIR 1
1878#define HCI_FILTER 2
1879#define HCI_TIME_STAMP 3
1880
1881/* CMSG flags */
1882#define HCI_CMSG_DIR 0x0001
1883#define HCI_CMSG_TSTAMP 0x0002
1884
1885struct sockaddr_hci {
1886 sa_family_t hci_family;
1887 unsigned short hci_dev;
1888 unsigned short hci_channel;
1889};
1890#define HCI_DEV_NONE 0xffff
1891
1892#define HCI_CHANNEL_RAW 0
1893#define HCI_CHANNEL_USER 1
1894#define HCI_CHANNEL_MONITOR 2
1895#define HCI_CHANNEL_CONTROL 3
1896
1897struct hci_filter {
1898 unsigned long type_mask;
1899 unsigned long event_mask[2];
1900 __le16 opcode;
1901};
1902
1903struct hci_ufilter {
1904 __u32 type_mask;
1905 __u32 event_mask[2];
1906 __le16 opcode;
1907};
1908
1909#define HCI_FLT_TYPE_BITS 31
1910#define HCI_FLT_EVENT_BITS 63
1911#define HCI_FLT_OGF_BITS 63
1912#define HCI_FLT_OCF_BITS 127
1913
1914/* ---- HCI Ioctl requests structures ---- */
1915struct hci_dev_stats {
1916 __u32 err_rx;
1917 __u32 err_tx;
1918 __u32 cmd_tx;
1919 __u32 evt_rx;
1920 __u32 acl_tx;
1921 __u32 acl_rx;
1922 __u32 sco_tx;
1923 __u32 sco_rx;
1924 __u32 byte_rx;
1925 __u32 byte_tx;
1926};
1927
1928struct hci_dev_info {
1929 __u16 dev_id;
1930 char name[8];
1931
1932 bdaddr_t bdaddr;
1933
1934 __u32 flags;
1935 __u8 type;
1936
1937 __u8 features[8];
1938
1939 __u32 pkt_type;
1940 __u32 link_policy;
1941 __u32 link_mode;
1942
1943 __u16 acl_mtu;
1944 __u16 acl_pkts;
1945 __u16 sco_mtu;
1946 __u16 sco_pkts;
1947
1948 struct hci_dev_stats stat;
1949};
1950
1951struct hci_conn_info {
1952 __u16 handle;
1953 bdaddr_t bdaddr;
1954 __u8 type;
1955 __u8 out;
1956 __u16 state;
1957 __u32 link_mode;
1958};
1959
1960struct hci_dev_req {
1961 __u16 dev_id;
1962 __u32 dev_opt;
1963};
1964
1965struct hci_dev_list_req {
1966 __u16 dev_num;
1967 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1968};
1969
1970struct hci_conn_list_req {
1971 __u16 dev_id;
1972 __u16 conn_num;
1973 struct hci_conn_info conn_info[0];
1974};
1975
1976struct hci_conn_info_req {
1977 bdaddr_t bdaddr;
1978 __u8 type;
1979 struct hci_conn_info conn_info[0];
1980};
1981
1982struct hci_auth_info_req {
1983 bdaddr_t bdaddr;
1984 __u8 type;
1985};
1986
1987struct hci_inquiry_req {
1988 __u16 dev_id;
1989 __u16 flags;
1990 __u8 lap[3];
1991 __u8 length;
1992 __u8 num_rsp;
1993};
1994#define IREQ_CACHE_FLUSH 0x0001
1995
1996#endif /* __HCI_H */ 1848#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e69c2b08c0c6..b52c2ef3f56d 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -26,6 +26,7 @@
26#define __HCI_CORE_H 26#define __HCI_CORE_H
27 27
28#include <net/bluetooth/hci.h> 28#include <net/bluetooth/hci.h>
29#include <net/bluetooth/hci_sock.h>
29 30
30/* HCI priority */ 31/* HCI priority */
31#define HCI_PRIO_MAX 7 32#define HCI_PRIO_MAX 7
@@ -1239,6 +1240,7 @@ void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
1239void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, 1240void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
1240 const void *param, u8 event); 1241 const void *param, u8 event);
1241void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); 1242void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
1243bool hci_req_pending(struct hci_dev *hdev);
1242 1244
1243void hci_req_add_le_scan_disable(struct hci_request *req); 1245void hci_req_add_le_scan_disable(struct hci_request *req);
1244void hci_req_add_le_passive_scan(struct hci_request *req); 1246void hci_req_add_le_passive_scan(struct hci_request *req);
@@ -1286,10 +1288,8 @@ void mgmt_index_added(struct hci_dev *hdev);
1286void mgmt_index_removed(struct hci_dev *hdev); 1288void mgmt_index_removed(struct hci_dev *hdev);
1287void mgmt_set_powered_failed(struct hci_dev *hdev, int err); 1289void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
1288int mgmt_powered(struct hci_dev *hdev, u8 powered); 1290int mgmt_powered(struct hci_dev *hdev, u8 powered);
1291int mgmt_update_adv_data(struct hci_dev *hdev);
1289void mgmt_discoverable_timeout(struct hci_dev *hdev); 1292void mgmt_discoverable_timeout(struct hci_dev *hdev);
1290void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1291void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1292void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1293void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1293void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1294 bool persistent); 1294 bool persistent);
1295void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1295void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
@@ -1350,34 +1350,6 @@ void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
1350void mgmt_reenable_advertising(struct hci_dev *hdev); 1350void mgmt_reenable_advertising(struct hci_dev *hdev);
1351void mgmt_smp_complete(struct hci_conn *conn, bool complete); 1351void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1352 1352
1353/* HCI info for socket */
1354#define hci_pi(sk) ((struct hci_pinfo *) sk)
1355
1356struct hci_pinfo {
1357 struct bt_sock bt;
1358 struct hci_dev *hdev;
1359 struct hci_filter filter;
1360 __u32 cmsg_mask;
1361 unsigned short channel;
1362};
1363
1364/* HCI security filter */
1365#define HCI_SFLT_MAX_OGF 5
1366
1367struct hci_sec_filter {
1368 __u32 type_mask;
1369 __u32 event_mask[2];
1370 __u32 ocf_mask[HCI_SFLT_MAX_OGF + 1][4];
1371};
1372
1373/* ----- HCI requests ----- */
1374#define HCI_REQ_DONE 0
1375#define HCI_REQ_PEND 1
1376#define HCI_REQ_CANCELED 2
1377
1378#define hci_req_lock(d) mutex_lock(&d->req_lock)
1379#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1380
1381u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency, 1353u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
1382 u16 to_multiplier); 1354 u16 to_multiplier);
1383void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, 1355void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
diff --git a/include/net/bluetooth/hci_sock.h b/include/net/bluetooth/hci_sock.h
new file mode 100644
index 000000000000..9a46d665c1b5
--- /dev/null
+++ b/include/net/bluetooth/hci_sock.h
@@ -0,0 +1,175 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
10
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
23*/
24
25#ifndef __HCI_SOCK_H
26#define __HCI_SOCK_H
27
28/* Socket options */
29#define HCI_DATA_DIR 1
30#define HCI_FILTER 2
31#define HCI_TIME_STAMP 3
32
33/* CMSG flags */
34#define HCI_CMSG_DIR 0x0001
35#define HCI_CMSG_TSTAMP 0x0002
36
37struct sockaddr_hci {
38 sa_family_t hci_family;
39 unsigned short hci_dev;
40 unsigned short hci_channel;
41};
42#define HCI_DEV_NONE 0xffff
43
44#define HCI_CHANNEL_RAW 0
45#define HCI_CHANNEL_USER 1
46#define HCI_CHANNEL_MONITOR 2
47#define HCI_CHANNEL_CONTROL 3
48
49struct hci_filter {
50 unsigned long type_mask;
51 unsigned long event_mask[2];
52 __le16 opcode;
53};
54
55struct hci_ufilter {
56 __u32 type_mask;
57 __u32 event_mask[2];
58 __le16 opcode;
59};
60
61#define HCI_FLT_TYPE_BITS 31
62#define HCI_FLT_EVENT_BITS 63
63#define HCI_FLT_OGF_BITS 63
64#define HCI_FLT_OCF_BITS 127
65
66/* Ioctl defines */
67#define HCIDEVUP _IOW('H', 201, int)
68#define HCIDEVDOWN _IOW('H', 202, int)
69#define HCIDEVRESET _IOW('H', 203, int)
70#define HCIDEVRESTAT _IOW('H', 204, int)
71
72#define HCIGETDEVLIST _IOR('H', 210, int)
73#define HCIGETDEVINFO _IOR('H', 211, int)
74#define HCIGETCONNLIST _IOR('H', 212, int)
75#define HCIGETCONNINFO _IOR('H', 213, int)
76#define HCIGETAUTHINFO _IOR('H', 215, int)
77
78#define HCISETRAW _IOW('H', 220, int)
79#define HCISETSCAN _IOW('H', 221, int)
80#define HCISETAUTH _IOW('H', 222, int)
81#define HCISETENCRYPT _IOW('H', 223, int)
82#define HCISETPTYPE _IOW('H', 224, int)
83#define HCISETLINKPOL _IOW('H', 225, int)
84#define HCISETLINKMODE _IOW('H', 226, int)
85#define HCISETACLMTU _IOW('H', 227, int)
86#define HCISETSCOMTU _IOW('H', 228, int)
87
88#define HCIBLOCKADDR _IOW('H', 230, int)
89#define HCIUNBLOCKADDR _IOW('H', 231, int)
90
91#define HCIINQUIRY _IOR('H', 240, int)
92
93/* Ioctl requests structures */
94struct hci_dev_stats {
95 __u32 err_rx;
96 __u32 err_tx;
97 __u32 cmd_tx;
98 __u32 evt_rx;
99 __u32 acl_tx;
100 __u32 acl_rx;
101 __u32 sco_tx;
102 __u32 sco_rx;
103 __u32 byte_rx;
104 __u32 byte_tx;
105};
106
107struct hci_dev_info {
108 __u16 dev_id;
109 char name[8];
110
111 bdaddr_t bdaddr;
112
113 __u32 flags;
114 __u8 type;
115
116 __u8 features[8];
117
118 __u32 pkt_type;
119 __u32 link_policy;
120 __u32 link_mode;
121
122 __u16 acl_mtu;
123 __u16 acl_pkts;
124 __u16 sco_mtu;
125 __u16 sco_pkts;
126
127 struct hci_dev_stats stat;
128};
129
130struct hci_conn_info {
131 __u16 handle;
132 bdaddr_t bdaddr;
133 __u8 type;
134 __u8 out;
135 __u16 state;
136 __u32 link_mode;
137};
138
139struct hci_dev_req {
140 __u16 dev_id;
141 __u32 dev_opt;
142};
143
144struct hci_dev_list_req {
145 __u16 dev_num;
146 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
147};
148
149struct hci_conn_list_req {
150 __u16 dev_id;
151 __u16 conn_num;
152 struct hci_conn_info conn_info[0];
153};
154
155struct hci_conn_info_req {
156 bdaddr_t bdaddr;
157 __u8 type;
158 struct hci_conn_info conn_info[0];
159};
160
161struct hci_auth_info_req {
162 bdaddr_t bdaddr;
163 __u8 type;
164};
165
166struct hci_inquiry_req {
167 __u16 dev_id;
168 __u16 flags;
169 __u8 lap[3];
170 __u8 length;
171 __u8 num_rsp;
172};
173#define IREQ_CACHE_FLUSH 0x0001
174
175#endif /* __HCI_SOCK_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index e0c6a9abdb62..1fffd92808b0 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -134,9 +134,12 @@ struct l2cap_conninfo {
134#define L2CAP_FCS_CRC16 0x01 134#define L2CAP_FCS_CRC16 0x01
135 135
136/* L2CAP fixed channels */ 136/* L2CAP fixed channels */
137#define L2CAP_FC_L2CAP 0x02 137#define L2CAP_FC_SIG_BREDR 0x02
138#define L2CAP_FC_CONNLESS 0x04 138#define L2CAP_FC_CONNLESS 0x04
139#define L2CAP_FC_A2MP 0x08 139#define L2CAP_FC_A2MP 0x08
140#define L2CAP_FC_ATT 0x10
141#define L2CAP_FC_SIG_LE 0x20
142#define L2CAP_FC_SMP_LE 0x40
140 143
141/* L2CAP Control Field bit masks */ 144/* L2CAP Control Field bit masks */
142#define L2CAP_CTRL_SAR 0xC000 145#define L2CAP_CTRL_SAR 0xC000
@@ -622,11 +625,10 @@ struct l2cap_conn {
622 625
623 struct delayed_work info_timer; 626 struct delayed_work info_timer;
624 627
625 spinlock_t lock;
626
627 struct sk_buff *rx_skb; 628 struct sk_buff *rx_skb;
628 __u32 rx_len; 629 __u32 rx_len;
629 __u8 tx_ident; 630 __u8 tx_ident;
631 struct mutex ident_lock;
630 632
631 struct sk_buff_head pending_rx; 633 struct sk_buff_head pending_rx;
632 struct work_struct pending_rx_work; 634 struct work_struct pending_rx_work;
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index 2019d1a0996a..f40ddb4264fc 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -27,11 +27,6 @@
27 27
28/* SCO defaults */ 28/* SCO defaults */
29#define SCO_DEFAULT_MTU 500 29#define SCO_DEFAULT_MTU 500
30#define SCO_DEFAULT_FLUSH_TO 0xFFFF
31
32#define SCO_CONN_TIMEOUT (HZ * 40)
33#define SCO_DISCONN_TIMEOUT (HZ * 2)
34#define SCO_CONN_IDLE_TIMEOUT (HZ * 60)
35 30
36/* SCO socket address */ 31/* SCO socket address */
37struct sockaddr_sco { 32struct sockaddr_sco {
@@ -51,29 +46,4 @@ struct sco_conninfo {
51 __u8 dev_class[3]; 46 __u8 dev_class[3];
52}; 47};
53 48
54/* ---- SCO connections ---- */
55struct sco_conn {
56 struct hci_conn *hcon;
57
58 spinlock_t lock;
59 struct sock *sk;
60
61 unsigned int mtu;
62};
63
64#define sco_conn_lock(c) spin_lock(&c->lock);
65#define sco_conn_unlock(c) spin_unlock(&c->lock);
66
67/* ----- SCO socket info ----- */
68#define sco_pi(sk) ((struct sco_pinfo *) sk)
69
70struct sco_pinfo {
71 struct bt_sock bt;
72 bdaddr_t src;
73 bdaddr_t dst;
74 __u32 flags;
75 __u16 setting;
76 struct sco_conn *conn;
77};
78
79#endif /* __SCO_H */ 49#endif /* __SCO_H */