aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth/mgmt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/bluetooth/mgmt.h')
-rw-r--r--include/net/bluetooth/mgmt.h291
1 files changed, 291 insertions, 0 deletions
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
26struct mgmt_hdr {
27 __le16 opcode;
28 __le16 index;
29 __le16 len;
30} __packed;
31
32#define MGMT_OP_READ_VERSION 0x0001
33struct mgmt_rp_read_version {
34 __u8 version;
35 __le16 revision;
36} __packed;
37
38#define MGMT_OP_READ_INDEX_LIST 0x0003
39struct 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
49struct 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
65struct 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
78struct mgmt_cp_add_uuid {
79 __u8 uuid[16];
80 __u8 svc_hint;
81} __packed;
82
83#define MGMT_OP_REMOVE_UUID 0x000A
84struct mgmt_cp_remove_uuid {
85 __u8 uuid[16];
86} __packed;
87
88#define MGMT_OP_SET_DEV_CLASS 0x000B
89struct mgmt_cp_set_dev_class {
90 __u8 major;
91 __u8 minor;
92} __packed;
93
94#define MGMT_OP_SET_SERVICE_CACHE 0x000C
95struct mgmt_cp_set_service_cache {
96 __u8 enable;
97} __packed;
98
99struct 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
107struct 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
114struct mgmt_cp_remove_key {
115 bdaddr_t bdaddr;
116 __u8 disconnect;
117} __packed;
118
119#define MGMT_OP_DISCONNECT 0x000F
120struct mgmt_cp_disconnect {
121 bdaddr_t bdaddr;
122} __packed;
123struct mgmt_rp_disconnect {
124 bdaddr_t bdaddr;
125} __packed;
126
127#define MGMT_OP_GET_CONNECTIONS 0x0010
128struct mgmt_rp_get_connections {
129 __le16 conn_count;
130 bdaddr_t conn[0];
131} __packed;
132
133#define MGMT_OP_PIN_CODE_REPLY 0x0011
134struct mgmt_cp_pin_code_reply {
135 bdaddr_t bdaddr;
136 __u8 pin_len;
137 __u8 pin_code[16];
138} __packed;
139struct 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
145struct mgmt_cp_pin_code_neg_reply {
146 bdaddr_t bdaddr;
147} __packed;
148
149#define MGMT_OP_SET_IO_CAPABILITY 0x0013
150struct mgmt_cp_set_io_capability {
151 __u8 io_capability;
152} __packed;
153
154#define MGMT_OP_PAIR_DEVICE 0x0014
155struct mgmt_cp_pair_device {
156 bdaddr_t bdaddr;
157 __u8 io_cap;
158} __packed;
159struct mgmt_rp_pair_device {
160 bdaddr_t bdaddr;
161 __u8 status;
162} __packed;
163
164#define MGMT_OP_USER_CONFIRM_REPLY 0x0015
165struct mgmt_cp_user_confirm_reply {
166 bdaddr_t bdaddr;
167} __packed;
168struct 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
176struct mgmt_cp_set_local_name {
177 __u8 name[MGMT_MAX_NAME_LENGTH];
178} __packed;
179
180#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0018
181struct 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
187struct 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
194struct 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
203struct mgmt_ev_cmd_complete {
204 __le16 opcode;
205 __u8 data[0];
206} __packed;
207
208#define MGMT_EV_CMD_STATUS 0x0002
209struct mgmt_ev_cmd_status {
210 __u8 status;
211 __le16 opcode;
212} __packed;
213
214#define MGMT_EV_CONTROLLER_ERROR 0x0003
215struct 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
232struct mgmt_ev_new_key {
233 __u8 store_hint;
234 struct mgmt_key_info key;
235} __packed;
236
237#define MGMT_EV_CONNECTED 0x000B
238struct mgmt_ev_connected {
239 bdaddr_t bdaddr;
240} __packed;
241
242#define MGMT_EV_DISCONNECTED 0x000C
243struct mgmt_ev_disconnected {
244 bdaddr_t bdaddr;
245} __packed;
246
247#define MGMT_EV_CONNECT_FAILED 0x000D
248struct mgmt_ev_connect_failed {
249 bdaddr_t bdaddr;
250 __u8 status;
251} __packed;
252
253#define MGMT_EV_PIN_CODE_REQUEST 0x000E
254struct mgmt_ev_pin_code_request {
255 bdaddr_t bdaddr;
256 __u8 secure;
257} __packed;
258
259#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
260struct 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
267struct mgmt_ev_auth_failed {
268 bdaddr_t bdaddr;
269 __u8 status;
270} __packed;
271
272#define MGMT_EV_LOCAL_NAME_CHANGED 0x0011
273struct mgmt_ev_local_name_changed {
274 __u8 name[MGMT_MAX_NAME_LENGTH];
275} __packed;
276
277#define MGMT_EV_DEVICE_FOUND 0x0012
278struct 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
286struct mgmt_ev_remote_name {
287 bdaddr_t bdaddr;
288 __u8 name[MGMT_MAX_NAME_LENGTH];
289} __packed;
290
291#define MGMT_EV_DISCOVERING 0x0014