blob: 5fabfa886b3eefc58bfe5fefc82350a178753c4f [file] [log] [blame]
Johan Hedbergc02178d2010-12-08 00:21:05 +02001/*
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
Szymon Janc4e51eae2011-02-25 19:05:48 +010024#define MGMT_INDEX_NONE 0xFFFF
25
Johan Hedbergc02178d2010-12-08 00:21:05 +020026struct mgmt_hdr {
27 __le16 opcode;
Szymon Janc4e51eae2011-02-25 19:05:48 +010028 __le16 index;
Johan Hedbergc02178d2010-12-08 00:21:05 +020029 __le16 len;
30} __packed;
Johan Hedbergc02178d2010-12-08 00:21:05 +020031
Johan Hedberg02d98122010-12-13 21:07:04 +020032#define MGMT_OP_READ_VERSION 0x0001
33struct mgmt_rp_read_version {
34 __u8 version;
35 __le16 revision;
36} __packed;
37
Johan Hedbergfaba42e2010-12-13 21:07:05 +020038#define MGMT_OP_READ_INDEX_LIST 0x0003
39struct mgmt_rp_read_index_list {
40 __le16 num_controllers;
41 __le16 index[0];
42} __packed;
43
Johan Hedbergf7b64e62010-12-13 21:07:06 +020044#define MGMT_OP_READ_INFO 0x0004
Johan Hedbergf7b64e62010-12-13 21:07:06 +020045struct mgmt_rp_read_info {
Johan Hedbergf7b64e62010-12-13 21:07:06 +020046 __u8 type;
47 __u8 powered;
Johan Hedberg9fbcbb42010-12-30 00:18:33 +020048 __u8 connectable;
Johan Hedbergf7b64e62010-12-13 21:07:06 +020049 __u8 discoverable;
50 __u8 pairable;
51 __u8 sec_mode;
52 bdaddr_t bdaddr;
53 __u8 dev_class[3];
54 __u8 features[8];
55 __u16 manufacturer;
56 __u8 hci_ver;
57 __u16 hci_rev;
58} __packed;
59
Johan Hedberg72a734e2010-12-30 00:38:22 +020060struct mgmt_mode {
Johan Hedberg72a734e2010-12-30 00:38:22 +020061 __u8 val;
62} __packed;
63
Johan Hedbergeec8d2b2010-12-16 10:17:38 +020064#define MGMT_OP_SET_POWERED 0x0005
Johan Hedbergeec8d2b2010-12-16 10:17:38 +020065
Johan Hedberg73f22f62010-12-29 16:00:25 +020066#define MGMT_OP_SET_DISCOVERABLE 0x0006
Johan Hedberg73f22f62010-12-29 16:00:25 +020067
Johan Hedberg9fbcbb42010-12-30 00:18:33 +020068#define MGMT_OP_SET_CONNECTABLE 0x0007
Johan Hedberg9fbcbb42010-12-30 00:18:33 +020069
Johan Hedbergc542a062011-01-26 13:11:03 +020070#define MGMT_OP_SET_PAIRABLE 0x0008
71
Johan Hedberg2aeb9a12011-01-04 12:08:51 +020072#define MGMT_OP_ADD_UUID 0x0009
73struct mgmt_cp_add_uuid {
Johan Hedberg2aeb9a12011-01-04 12:08:51 +020074 __u8 uuid[16];
Johan Hedberg1aff6f02011-01-13 21:56:52 +020075 __u8 svc_hint;
Johan Hedberg2aeb9a12011-01-04 12:08:51 +020076} __packed;
77
78#define MGMT_OP_REMOVE_UUID 0x000A
79struct mgmt_cp_remove_uuid {
Johan Hedberg2aeb9a12011-01-04 12:08:51 +020080 __u8 uuid[16];
81} __packed;
82
Johan Hedberg1aff6f02011-01-13 21:56:52 +020083#define MGMT_OP_SET_DEV_CLASS 0x000B
84struct mgmt_cp_set_dev_class {
Johan Hedberg1aff6f02011-01-13 21:56:52 +020085 __u8 major;
86 __u8 minor;
87} __packed;
88
89#define MGMT_OP_SET_SERVICE_CACHE 0x000C
90struct mgmt_cp_set_service_cache {
Johan Hedberg1aff6f02011-01-13 21:56:52 +020091 __u8 enable;
92} __packed;
93
Johan Hedberg55ed8ca2011-01-17 14:41:05 +020094struct 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 {
Johan Hedberg55ed8ca2011-01-17 14:41:05 +0200103 __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 {
Johan Hedberg55ed8ca2011-01-17 14:41:05 +0200110 bdaddr_t bdaddr;
111 __u8 disconnect;
112} __packed;
113
Johan Hedberg8962ee72011-01-20 12:40:27 +0200114#define MGMT_OP_DISCONNECT 0x000F
115struct mgmt_cp_disconnect {
Johan Hedberg8962ee72011-01-20 12:40:27 +0200116 bdaddr_t bdaddr;
117} __packed;
118struct mgmt_rp_disconnect {
Johan Hedberg8962ee72011-01-20 12:40:27 +0200119 bdaddr_t bdaddr;
120} __packed;
121
Johan Hedberg2784eb42011-01-21 13:56:35 +0200122#define MGMT_OP_GET_CONNECTIONS 0x0010
Johan Hedberg2784eb42011-01-21 13:56:35 +0200123struct mgmt_rp_get_connections {
Johan Hedberg2784eb42011-01-21 13:56:35 +0200124 __le16 conn_count;
125 bdaddr_t conn[0];
126} __packed;
127
Johan Hedberg980e1a52011-01-22 06:10:07 +0200128#define MGMT_OP_PIN_CODE_REPLY 0x0011
129struct mgmt_cp_pin_code_reply {
Johan Hedberg980e1a52011-01-22 06:10:07 +0200130 bdaddr_t bdaddr;
131 __u8 pin_len;
132 __u8 pin_code[16];
133} __packed;
Johan Hedbergac56fb12011-02-19 12:05:59 -0300134struct mgmt_rp_pin_code_reply {
Johan Hedbergac56fb12011-02-19 12:05:59 -0300135 bdaddr_t bdaddr;
136 uint8_t status;
137} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200138
139#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012
140struct mgmt_cp_pin_code_neg_reply {
Johan Hedberg980e1a52011-01-22 06:10:07 +0200141 bdaddr_t bdaddr;
142} __packed;
143
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200144#define MGMT_OP_SET_IO_CAPABILITY 0x0013
145struct mgmt_cp_set_io_capability {
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200146 __u8 io_capability;
147} __packed;
148
Johan Hedberge9a416b2011-02-19 12:05:56 -0300149#define MGMT_OP_PAIR_DEVICE 0x0014
150struct mgmt_cp_pair_device {
Johan Hedberge9a416b2011-02-19 12:05:56 -0300151 bdaddr_t bdaddr;
152 __u8 io_cap;
153} __packed;
154struct mgmt_rp_pair_device {
Johan Hedberge9a416b2011-02-19 12:05:56 -0300155 bdaddr_t bdaddr;
156 __u8 status;
157} __packed;
158
Johan Hedberga5c29682011-02-19 12:05:57 -0300159#define MGMT_OP_USER_CONFIRM_REPLY 0x0015
160struct mgmt_cp_user_confirm_reply {
Johan Hedberga5c29682011-02-19 12:05:57 -0300161 bdaddr_t bdaddr;
162} __packed;
163struct mgmt_rp_user_confirm_reply {
Johan Hedberga5c29682011-02-19 12:05:57 -0300164 bdaddr_t bdaddr;
165 __u8 status;
166} __packed;
167
168#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016
169
Johan Hedbergc02178d2010-12-08 00:21:05 +0200170#define MGMT_EV_CMD_COMPLETE 0x0001
171struct mgmt_ev_cmd_complete {
172 __le16 opcode;
173 __u8 data[0];
174} __packed;
175
176#define MGMT_EV_CMD_STATUS 0x0002
177struct mgmt_ev_cmd_status {
178 __u8 status;
179 __le16 opcode;
180} __packed;
181
182#define MGMT_EV_CONTROLLER_ERROR 0x0003
183struct mgmt_ev_controller_error {
Johan Hedbergc02178d2010-12-08 00:21:05 +0200184 __u8 error_code;
185} __packed;
Johan Hedbergc71e97b2010-12-13 21:07:07 +0200186
187#define MGMT_EV_INDEX_ADDED 0x0004
Johan Hedbergc71e97b2010-12-13 21:07:07 +0200188
189#define MGMT_EV_INDEX_REMOVED 0x0005
Johan Hedberg5add6af2010-12-16 10:00:37 +0200190
191#define MGMT_EV_POWERED 0x0006
Johan Hedberg73f22f62010-12-29 16:00:25 +0200192
193#define MGMT_EV_DISCOVERABLE 0x0007
Johan Hedberg9fbcbb42010-12-30 00:18:33 +0200194
195#define MGMT_EV_CONNECTABLE 0x0008
Johan Hedbergc542a062011-01-26 13:11:03 +0200196
197#define MGMT_EV_PAIRABLE 0x0009
Johan Hedberg55ed8ca2011-01-17 14:41:05 +0200198
199#define MGMT_EV_NEW_KEY 0x000A
200struct mgmt_ev_new_key {
Johan Hedberg55ed8ca2011-01-17 14:41:05 +0200201 struct mgmt_key_info key;
202 __u8 old_key_type;
203} __packed;
Johan Hedbergf7520542011-01-20 12:34:39 +0200204
205#define MGMT_EV_CONNECTED 0x000B
206struct mgmt_ev_connected {
Johan Hedbergf7520542011-01-20 12:34:39 +0200207 bdaddr_t bdaddr;
208} __packed;
209
210#define MGMT_EV_DISCONNECTED 0x000C
211struct mgmt_ev_disconnected {
Johan Hedbergf7520542011-01-20 12:34:39 +0200212 bdaddr_t bdaddr;
213} __packed;
Johan Hedberg17d5c042011-01-22 06:09:08 +0200214
215#define MGMT_EV_CONNECT_FAILED 0x000D
216struct mgmt_ev_connect_failed {
Johan Hedberg17d5c042011-01-22 06:09:08 +0200217 bdaddr_t bdaddr;
218 __u8 status;
219} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200220
221#define MGMT_EV_PIN_CODE_REQUEST 0x000E
222struct mgmt_ev_pin_code_request {
Johan Hedberg980e1a52011-01-22 06:10:07 +0200223 bdaddr_t bdaddr;
224} __packed;
Johan Hedberga5c29682011-02-19 12:05:57 -0300225
226#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
227struct mgmt_ev_user_confirm_request {
Johan Hedberga5c29682011-02-19 12:05:57 -0300228 bdaddr_t bdaddr;
229 __le32 value;
230} __packed;
Johan Hedberg2a611692011-02-19 12:06:00 -0300231
232#define MGMT_EV_AUTH_FAILED 0x0010
233struct mgmt_ev_auth_failed {
Johan Hedberg2a611692011-02-19 12:06:00 -0300234 bdaddr_t bdaddr;
235 __u8 status;
236} __packed;