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.h171
1 files changed, 160 insertions, 11 deletions
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index ca29c1367ffd..5fabfa886b3e 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -21,11 +21,13 @@
21 SOFTWARE IS DISCLAIMED. 21 SOFTWARE IS DISCLAIMED.
22*/ 22*/
23 23
24#define MGMT_INDEX_NONE 0xFFFF
25
24struct mgmt_hdr { 26struct mgmt_hdr {
25 __le16 opcode; 27 __le16 opcode;
28 __le16 index;
26 __le16 len; 29 __le16 len;
27} __packed; 30} __packed;
28#define MGMT_HDR_SIZE 4
29 31
30#define MGMT_OP_READ_VERSION 0x0001 32#define MGMT_OP_READ_VERSION 0x0001
31struct mgmt_rp_read_version { 33struct mgmt_rp_read_version {
@@ -40,13 +42,10 @@ struct mgmt_rp_read_index_list {
40} __packed; 42} __packed;
41 43
42#define MGMT_OP_READ_INFO 0x0004 44#define MGMT_OP_READ_INFO 0x0004
43struct mgmt_cp_read_info {
44 __le16 index;
45} __packed;
46struct mgmt_rp_read_info { 45struct mgmt_rp_read_info {
47 __le16 index;
48 __u8 type; 46 __u8 type;
49 __u8 powered; 47 __u8 powered;
48 __u8 connectable;
50 __u8 discoverable; 49 __u8 discoverable;
51 __u8 pairable; 50 __u8 pairable;
52 __u8 sec_mode; 51 __u8 sec_mode;
@@ -58,6 +57,116 @@ struct mgmt_rp_read_info {
58 __u16 hci_rev; 57 __u16 hci_rev;
59} __packed; 58} __packed;
60 59
60struct mgmt_mode {
61 __u8 val;
62} __packed;
63
64#define MGMT_OP_SET_POWERED 0x0005
65
66#define MGMT_OP_SET_DISCOVERABLE 0x0006
67
68#define MGMT_OP_SET_CONNECTABLE 0x0007
69
70#define MGMT_OP_SET_PAIRABLE 0x0008
71
72#define MGMT_OP_ADD_UUID 0x0009
73struct mgmt_cp_add_uuid {
74 __u8 uuid[16];
75 __u8 svc_hint;
76} __packed;
77
78#define MGMT_OP_REMOVE_UUID 0x000A
79struct mgmt_cp_remove_uuid {
80 __u8 uuid[16];
81} __packed;
82
83#define MGMT_OP_SET_DEV_CLASS 0x000B
84struct mgmt_cp_set_dev_class {
85 __u8 major;
86 __u8 minor;
87} __packed;
88
89#define MGMT_OP_SET_SERVICE_CACHE 0x000C
90struct mgmt_cp_set_service_cache {
91 __u8 enable;
92} __packed;
93
94struct mgmt_key_info {
95 bdaddr_t bdaddr;
96 u8 type;
97 u8 val[16];
98 u8 pin_len;
99} __packed;
100
101#define MGMT_OP_LOAD_KEYS 0x000D
102struct mgmt_cp_load_keys {
103 __u8 debug_keys;
104 __le16 key_count;
105 struct mgmt_key_info keys[0];
106} __packed;
107
108#define MGMT_OP_REMOVE_KEY 0x000E
109struct mgmt_cp_remove_key {
110 bdaddr_t bdaddr;
111 __u8 disconnect;
112} __packed;
113
114#define MGMT_OP_DISCONNECT 0x000F
115struct mgmt_cp_disconnect {
116 bdaddr_t bdaddr;
117} __packed;
118struct mgmt_rp_disconnect {
119 bdaddr_t bdaddr;
120} __packed;
121
122#define MGMT_OP_GET_CONNECTIONS 0x0010
123struct mgmt_rp_get_connections {
124 __le16 conn_count;
125 bdaddr_t conn[0];
126} __packed;
127
128#define MGMT_OP_PIN_CODE_REPLY 0x0011
129struct mgmt_cp_pin_code_reply {
130 bdaddr_t bdaddr;
131 __u8 pin_len;
132 __u8 pin_code[16];
133} __packed;
134struct mgmt_rp_pin_code_reply {
135 bdaddr_t bdaddr;
136 uint8_t status;
137} __packed;
138
139#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012
140struct mgmt_cp_pin_code_neg_reply {
141 bdaddr_t bdaddr;
142} __packed;
143
144#define MGMT_OP_SET_IO_CAPABILITY 0x0013
145struct mgmt_cp_set_io_capability {
146 __u8 io_capability;
147} __packed;
148
149#define MGMT_OP_PAIR_DEVICE 0x0014
150struct mgmt_cp_pair_device {
151 bdaddr_t bdaddr;
152 __u8 io_cap;
153} __packed;
154struct mgmt_rp_pair_device {
155 bdaddr_t bdaddr;
156 __u8 status;
157} __packed;
158
159#define MGMT_OP_USER_CONFIRM_REPLY 0x0015
160struct mgmt_cp_user_confirm_reply {
161 bdaddr_t bdaddr;
162} __packed;
163struct mgmt_rp_user_confirm_reply {
164 bdaddr_t bdaddr;
165 __u8 status;
166} __packed;
167
168#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016
169
61#define MGMT_EV_CMD_COMPLETE 0x0001 170#define MGMT_EV_CMD_COMPLETE 0x0001
62struct mgmt_ev_cmd_complete { 171struct mgmt_ev_cmd_complete {
63 __le16 opcode; 172 __le16 opcode;
@@ -72,16 +181,56 @@ struct mgmt_ev_cmd_status {
72 181
73#define MGMT_EV_CONTROLLER_ERROR 0x0003 182#define MGMT_EV_CONTROLLER_ERROR 0x0003
74struct mgmt_ev_controller_error { 183struct mgmt_ev_controller_error {
75 __le16 index;
76 __u8 error_code; 184 __u8 error_code;
77} __packed; 185} __packed;
78 186
79#define MGMT_EV_INDEX_ADDED 0x0004 187#define MGMT_EV_INDEX_ADDED 0x0004
80struct mgmt_ev_index_added {
81 __le16 index;
82} __packed;
83 188
84#define MGMT_EV_INDEX_REMOVED 0x0005 189#define MGMT_EV_INDEX_REMOVED 0x0005
85struct mgmt_ev_index_removed { 190
86 __le16 index; 191#define MGMT_EV_POWERED 0x0006
192
193#define MGMT_EV_DISCOVERABLE 0x0007
194
195#define MGMT_EV_CONNECTABLE 0x0008
196
197#define MGMT_EV_PAIRABLE 0x0009
198
199#define MGMT_EV_NEW_KEY 0x000A
200struct mgmt_ev_new_key {
201 struct mgmt_key_info key;
202 __u8 old_key_type;
203} __packed;
204
205#define MGMT_EV_CONNECTED 0x000B
206struct mgmt_ev_connected {
207 bdaddr_t bdaddr;
208} __packed;
209
210#define MGMT_EV_DISCONNECTED 0x000C
211struct mgmt_ev_disconnected {
212 bdaddr_t bdaddr;
213} __packed;
214
215#define MGMT_EV_CONNECT_FAILED 0x000D
216struct mgmt_ev_connect_failed {
217 bdaddr_t bdaddr;
218 __u8 status;
219} __packed;
220
221#define MGMT_EV_PIN_CODE_REQUEST 0x000E
222struct mgmt_ev_pin_code_request {
223 bdaddr_t bdaddr;
224} __packed;
225
226#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
227struct mgmt_ev_user_confirm_request {
228 bdaddr_t bdaddr;
229 __le32 value;
230} __packed;
231
232#define MGMT_EV_AUTH_FAILED 0x0010
233struct mgmt_ev_auth_failed {
234 bdaddr_t bdaddr;
235 __u8 status;
87} __packed; 236} __packed;