blob: 44ac55c850794ec971b7a820e1186f6052f9bc25 [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
24struct mgmt_hdr {
25 __le16 opcode;
26 __le16 len;
27} __packed;
28#define MGMT_HDR_SIZE 4
29
Johan Hedberg02d98122010-12-13 21:07:04 +020030#define MGMT_OP_READ_VERSION 0x0001
31struct mgmt_rp_read_version {
32 __u8 version;
33 __le16 revision;
34} __packed;
35
Johan Hedbergfaba42e2010-12-13 21:07:05 +020036#define MGMT_OP_READ_INDEX_LIST 0x0003
37struct mgmt_rp_read_index_list {
38 __le16 num_controllers;
39 __le16 index[0];
40} __packed;
41
Johan Hedbergf7b64e692010-12-13 21:07:06 +020042#define MGMT_OP_READ_INFO 0x0004
43struct mgmt_cp_read_info {
44 __le16 index;
45} __packed;
46struct mgmt_rp_read_info {
47 __le16 index;
48 __u8 type;
49 __u8 powered;
Johan Hedberg9fbcbb42010-12-30 00:18:33 +020050 __u8 connectable;
Johan Hedbergf7b64e692010-12-13 21:07:06 +020051 __u8 discoverable;
52 __u8 pairable;
53 __u8 sec_mode;
54 bdaddr_t bdaddr;
55 __u8 dev_class[3];
56 __u8 features[8];
57 __u16 manufacturer;
58 __u8 hci_ver;
59 __u16 hci_rev;
60} __packed;
61
Johan Hedberg72a734e2010-12-30 00:38:22 +020062struct mgmt_mode {
63 __le16 index;
64 __u8 val;
65} __packed;
66
Johan Hedbergeec8d2b2010-12-16 10:17:38 +020067#define MGMT_OP_SET_POWERED 0x0005
Johan Hedbergeec8d2b2010-12-16 10:17:38 +020068
Johan Hedberg73f22f62010-12-29 16:00:25 +020069#define MGMT_OP_SET_DISCOVERABLE 0x0006
Johan Hedberg73f22f62010-12-29 16:00:25 +020070
Johan Hedberg9fbcbb42010-12-30 00:18:33 +020071#define MGMT_OP_SET_CONNECTABLE 0x0007
Johan Hedberg9fbcbb42010-12-30 00:18:33 +020072
Johan Hedbergc542a062011-01-26 13:11:03 +020073#define MGMT_OP_SET_PAIRABLE 0x0008
74
Johan Hedberg2aeb9a12011-01-04 12:08:51 +020075#define MGMT_OP_ADD_UUID 0x0009
76struct mgmt_cp_add_uuid {
77 __le16 index;
78 __u8 uuid[16];
Johan Hedberg1aff6f02011-01-13 21:56:52 +020079 __u8 svc_hint;
Johan Hedberg2aeb9a12011-01-04 12:08:51 +020080} __packed;
81
82#define MGMT_OP_REMOVE_UUID 0x000A
83struct mgmt_cp_remove_uuid {
84 __le16 index;
85 __u8 uuid[16];
86} __packed;
87
Johan Hedberg1aff6f02011-01-13 21:56:52 +020088#define MGMT_OP_SET_DEV_CLASS 0x000B
89struct mgmt_cp_set_dev_class {
90 __le16 index;
91 __u8 major;
92 __u8 minor;
93} __packed;
94
95#define MGMT_OP_SET_SERVICE_CACHE 0x000C
96struct mgmt_cp_set_service_cache {
97 __le16 index;
98 __u8 enable;
99} __packed;
100
Johan Hedberg55ed8ca12011-01-17 14:41:05 +0200101struct mgmt_key_info {
102 bdaddr_t bdaddr;
103 u8 type;
104 u8 val[16];
105 u8 pin_len;
106} __packed;
107
108#define MGMT_OP_LOAD_KEYS 0x000D
109struct mgmt_cp_load_keys {
110 __le16 index;
111 __u8 debug_keys;
112 __le16 key_count;
113 struct mgmt_key_info keys[0];
114} __packed;
115
116#define MGMT_OP_REMOVE_KEY 0x000E
117struct mgmt_cp_remove_key {
118 __le16 index;
119 bdaddr_t bdaddr;
120 __u8 disconnect;
121} __packed;
122
Johan Hedberg8962ee72011-01-20 12:40:27 +0200123#define MGMT_OP_DISCONNECT 0x000F
124struct mgmt_cp_disconnect {
125 __le16 index;
126 bdaddr_t bdaddr;
127} __packed;
128struct mgmt_rp_disconnect {
129 __le16 index;
130 bdaddr_t bdaddr;
131} __packed;
132
Johan Hedberg2784eb42011-01-21 13:56:35 +0200133#define MGMT_OP_GET_CONNECTIONS 0x0010
134struct mgmt_cp_get_connections {
135 __le16 index;
136} __packed;
137struct mgmt_rp_get_connections {
138 __le16 index;
139 __le16 conn_count;
140 bdaddr_t conn[0];
141} __packed;
142
Johan Hedberg980e1a52011-01-22 06:10:07 +0200143#define MGMT_OP_PIN_CODE_REPLY 0x0011
144struct mgmt_cp_pin_code_reply {
145 __le16 index;
146 bdaddr_t bdaddr;
147 __u8 pin_len;
148 __u8 pin_code[16];
149} __packed;
150
151#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012
152struct mgmt_cp_pin_code_neg_reply {
153 __le16 index;
154 bdaddr_t bdaddr;
155} __packed;
156
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200157#define MGMT_OP_SET_IO_CAPABILITY 0x0013
158struct mgmt_cp_set_io_capability {
159 __le16 index;
160 __u8 io_capability;
161} __packed;
162
Johan Hedbergc02178d2010-12-08 00:21:05 +0200163#define MGMT_EV_CMD_COMPLETE 0x0001
164struct mgmt_ev_cmd_complete {
165 __le16 opcode;
166 __u8 data[0];
167} __packed;
168
169#define MGMT_EV_CMD_STATUS 0x0002
170struct mgmt_ev_cmd_status {
171 __u8 status;
172 __le16 opcode;
173} __packed;
174
175#define MGMT_EV_CONTROLLER_ERROR 0x0003
176struct mgmt_ev_controller_error {
177 __le16 index;
178 __u8 error_code;
179} __packed;
Johan Hedbergc71e97b2010-12-13 21:07:07 +0200180
181#define MGMT_EV_INDEX_ADDED 0x0004
182struct mgmt_ev_index_added {
183 __le16 index;
184} __packed;
185
186#define MGMT_EV_INDEX_REMOVED 0x0005
187struct mgmt_ev_index_removed {
188 __le16 index;
189} __packed;
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 Hedberg55ed8ca12011-01-17 14:41:05 +0200198
199#define MGMT_EV_NEW_KEY 0x000A
200struct mgmt_ev_new_key {
201 __le16 index;
202 struct mgmt_key_info key;
203 __u8 old_key_type;
204} __packed;
Johan Hedbergf7520542011-01-20 12:34:39 +0200205
206#define MGMT_EV_CONNECTED 0x000B
207struct mgmt_ev_connected {
208 __le16 index;
209 bdaddr_t bdaddr;
210} __packed;
211
212#define MGMT_EV_DISCONNECTED 0x000C
213struct mgmt_ev_disconnected {
214 __le16 index;
215 bdaddr_t bdaddr;
216} __packed;
Johan Hedberg17d5c042011-01-22 06:09:08 +0200217
218#define MGMT_EV_CONNECT_FAILED 0x000D
219struct mgmt_ev_connect_failed {
220 __le16 index;
221 bdaddr_t bdaddr;
222 __u8 status;
223} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200224
225#define MGMT_EV_PIN_CODE_REQUEST 0x000E
226struct mgmt_ev_pin_code_request {
227 __le16 index;
228 bdaddr_t bdaddr;
229} __packed;