aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-03-01 15:23:42 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-01 16:55:58 -0500
commit9d1acbfb774fa5e043a44adedfcc36c9837a5e61 (patch)
tree81e551faeed6a542e31c2310353921fae379de31 /include/net
parent0f4e68cf6e70fc219f219799c799a8a3e3c13100 (diff)
Bluetooth: mgmt: Add defines for command sizes
These defines are shorter than "sizeof(struct mgmt_cp_foo_bar...)" and will be helpful when extending the command lookup table to contain the expected command size information. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/mgmt.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 7aab53e6b813..d33457d657c3 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -52,14 +52,17 @@ struct mgmt_addr_info {
52 bdaddr_t bdaddr; 52 bdaddr_t bdaddr;
53 __u8 type; 53 __u8 type;
54} __packed; 54} __packed;
55#define MGMT_ADDR_INFO_SIZE 7
55 56
56#define MGMT_OP_READ_VERSION 0x0001 57#define MGMT_OP_READ_VERSION 0x0001
58#define MGMT_READ_VERSION_SIZE 0
57struct mgmt_rp_read_version { 59struct mgmt_rp_read_version {
58 __u8 version; 60 __u8 version;
59 __le16 revision; 61 __le16 revision;
60} __packed; 62} __packed;
61 63
62#define MGMT_OP_READ_COMMANDS 0x0002 64#define MGMT_OP_READ_COMMANDS 0x0002
65#define MGMT_READ_COMMANDS_SIZE 0
63struct mgmt_rp_read_commands { 66struct mgmt_rp_read_commands {
64 __le16 num_commands; 67 __le16 num_commands;
65 __le16 num_events; 68 __le16 num_events;
@@ -67,6 +70,7 @@ struct mgmt_rp_read_commands {
67} __packed; 70} __packed;
68 71
69#define MGMT_OP_READ_INDEX_LIST 0x0003 72#define MGMT_OP_READ_INDEX_LIST 0x0003
73#define MGMT_READ_INDEX_LIST_SIZE 0
70struct mgmt_rp_read_index_list { 74struct mgmt_rp_read_index_list {
71 __le16 num_controllers; 75 __le16 num_controllers;
72 __le16 index[0]; 76 __le16 index[0];
@@ -89,6 +93,7 @@ struct mgmt_rp_read_index_list {
89#define MGMT_SETTING_LE 0x00000200 93#define MGMT_SETTING_LE 0x00000200
90 94
91#define MGMT_OP_READ_INFO 0x0004 95#define MGMT_OP_READ_INFO 0x0004
96#define MGMT_READ_INFO_SIZE 0
92struct mgmt_rp_read_info { 97struct mgmt_rp_read_info {
93 bdaddr_t bdaddr; 98 bdaddr_t bdaddr;
94 __u8 version; 99 __u8 version;
@@ -104,6 +109,8 @@ struct mgmt_mode {
104 __u8 val; 109 __u8 val;
105} __packed; 110} __packed;
106 111
112#define MGMT_SETTING_SIZE 1
113
107#define MGMT_OP_SET_POWERED 0x0005 114#define MGMT_OP_SET_POWERED 0x0005
108 115
109#define MGMT_OP_SET_DISCOVERABLE 0x0006 116#define MGMT_OP_SET_DISCOVERABLE 0x0006
@@ -111,6 +118,7 @@ struct mgmt_cp_set_discoverable {
111 __u8 val; 118 __u8 val;
112 __u16 timeout; 119 __u16 timeout;
113} __packed; 120} __packed;
121#define MGMT_SET_DISCOVERABLE_SIZE 3
114 122
115#define MGMT_OP_SET_CONNECTABLE 0x0007 123#define MGMT_OP_SET_CONNECTABLE 0x0007
116 124
@@ -131,23 +139,27 @@ struct mgmt_cp_set_dev_class {
131 __u8 major; 139 __u8 major;
132 __u8 minor; 140 __u8 minor;
133} __packed; 141} __packed;
142#define MGMT_SET_DEV_CLASS_SIZE 2
134 143
135#define MGMT_OP_SET_LOCAL_NAME 0x000F 144#define MGMT_OP_SET_LOCAL_NAME 0x000F
136struct mgmt_cp_set_local_name { 145struct mgmt_cp_set_local_name {
137 __u8 name[MGMT_MAX_NAME_LENGTH]; 146 __u8 name[MGMT_MAX_NAME_LENGTH];
138 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 147 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
139} __packed; 148} __packed;
149#define MGMT_SET_LOCAL_NAME_SIZE 260
140 150
141#define MGMT_OP_ADD_UUID 0x0010 151#define MGMT_OP_ADD_UUID 0x0010
142struct mgmt_cp_add_uuid { 152struct mgmt_cp_add_uuid {
143 __u8 uuid[16]; 153 __u8 uuid[16];
144 __u8 svc_hint; 154 __u8 svc_hint;
145} __packed; 155} __packed;
156#define MGMT_ADD_UUID_SIZE 17
146 157
147#define MGMT_OP_REMOVE_UUID 0x0011 158#define MGMT_OP_REMOVE_UUID 0x0011
148struct mgmt_cp_remove_uuid { 159struct mgmt_cp_remove_uuid {
149 __u8 uuid[16]; 160 __u8 uuid[16];
150} __packed; 161} __packed;
162#define MGMT_REMOVE_UUID_SIZE 16
151 163
152struct mgmt_link_key_info { 164struct mgmt_link_key_info {
153 struct mgmt_addr_info addr; 165 struct mgmt_addr_info addr;
@@ -162,6 +174,7 @@ struct mgmt_cp_load_link_keys {
162 __le16 key_count; 174 __le16 key_count;
163 struct mgmt_link_key_info keys[0]; 175 struct mgmt_link_key_info keys[0];
164} __packed; 176} __packed;
177#define MGMT_LOAD_LINK_KEYS_SIZE 3
165 178
166struct mgmt_ltk_info { 179struct mgmt_ltk_info {
167 struct mgmt_addr_info addr; 180 struct mgmt_addr_info addr;
@@ -178,16 +191,19 @@ struct mgmt_cp_load_long_term_keys {
178 __le16 key_count; 191 __le16 key_count;
179 struct mgmt_ltk_info keys[0]; 192 struct mgmt_ltk_info keys[0];
180} __packed; 193} __packed;
194#define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2
181 195
182#define MGMT_OP_DISCONNECT 0x0014 196#define MGMT_OP_DISCONNECT 0x0014
183struct mgmt_cp_disconnect { 197struct mgmt_cp_disconnect {
184 struct mgmt_addr_info addr; 198 struct mgmt_addr_info addr;
185} __packed; 199} __packed;
200#define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE
186struct mgmt_rp_disconnect { 201struct mgmt_rp_disconnect {
187 struct mgmt_addr_info addr; 202 struct mgmt_addr_info addr;
188} __packed; 203} __packed;
189 204
190#define MGMT_OP_GET_CONNECTIONS 0x0015 205#define MGMT_OP_GET_CONNECTIONS 0x0015
206#define MGMT_GET_CONNECTIONS_SIZE 0
191struct mgmt_rp_get_connections { 207struct mgmt_rp_get_connections {
192 __le16 conn_count; 208 __le16 conn_count;
193 struct mgmt_addr_info addr[0]; 209 struct mgmt_addr_info addr[0];
@@ -199,6 +215,7 @@ struct mgmt_cp_pin_code_reply {
199 __u8 pin_len; 215 __u8 pin_len;
200 __u8 pin_code[16]; 216 __u8 pin_code[16];
201} __packed; 217} __packed;
218#define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17)
202struct mgmt_rp_pin_code_reply { 219struct mgmt_rp_pin_code_reply {
203 struct mgmt_addr_info addr; 220 struct mgmt_addr_info addr;
204} __packed; 221} __packed;
@@ -207,28 +224,33 @@ struct mgmt_rp_pin_code_reply {
207struct mgmt_cp_pin_code_neg_reply { 224struct mgmt_cp_pin_code_neg_reply {
208 struct mgmt_addr_info addr; 225 struct mgmt_addr_info addr;
209} __packed; 226} __packed;
227#define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
210 228
211#define MGMT_OP_SET_IO_CAPABILITY 0x0018 229#define MGMT_OP_SET_IO_CAPABILITY 0x0018
212struct mgmt_cp_set_io_capability { 230struct mgmt_cp_set_io_capability {
213 __u8 io_capability; 231 __u8 io_capability;
214} __packed; 232} __packed;
233#define MGMT_SET_IO_CAPABILITY_SIZE 1
215 234
216#define MGMT_OP_PAIR_DEVICE 0x0019 235#define MGMT_OP_PAIR_DEVICE 0x0019
217struct mgmt_cp_pair_device { 236struct mgmt_cp_pair_device {
218 struct mgmt_addr_info addr; 237 struct mgmt_addr_info addr;
219 __u8 io_cap; 238 __u8 io_cap;
220} __packed; 239} __packed;
240#define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
221struct mgmt_rp_pair_device { 241struct mgmt_rp_pair_device {
222 struct mgmt_addr_info addr; 242 struct mgmt_addr_info addr;
223} __packed; 243} __packed;
224 244
225#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A 245#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A
246#define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
226 247
227#define MGMT_OP_UNPAIR_DEVICE 0x001B 248#define MGMT_OP_UNPAIR_DEVICE 0x001B
228struct mgmt_cp_unpair_device { 249struct mgmt_cp_unpair_device {
229 struct mgmt_addr_info addr; 250 struct mgmt_addr_info addr;
230 __u8 disconnect; 251 __u8 disconnect;
231} __packed; 252} __packed;
253#define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
232struct mgmt_rp_unpair_device { 254struct mgmt_rp_unpair_device {
233 struct mgmt_addr_info addr; 255 struct mgmt_addr_info addr;
234}; 256};
@@ -237,6 +259,7 @@ struct mgmt_rp_unpair_device {
237struct mgmt_cp_user_confirm_reply { 259struct mgmt_cp_user_confirm_reply {
238 struct mgmt_addr_info addr; 260 struct mgmt_addr_info addr;
239} __packed; 261} __packed;
262#define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE
240struct mgmt_rp_user_confirm_reply { 263struct mgmt_rp_user_confirm_reply {
241 struct mgmt_addr_info addr; 264 struct mgmt_addr_info addr;
242} __packed; 265} __packed;
@@ -245,12 +268,14 @@ struct mgmt_rp_user_confirm_reply {
245struct mgmt_cp_user_confirm_neg_reply { 268struct mgmt_cp_user_confirm_neg_reply {
246 struct mgmt_addr_info addr; 269 struct mgmt_addr_info addr;
247} __packed; 270} __packed;
271#define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
248 272
249#define MGMT_OP_USER_PASSKEY_REPLY 0x001E 273#define MGMT_OP_USER_PASSKEY_REPLY 0x001E
250struct mgmt_cp_user_passkey_reply { 274struct mgmt_cp_user_passkey_reply {
251 struct mgmt_addr_info addr; 275 struct mgmt_addr_info addr;
252 __le32 passkey; 276 __le32 passkey;
253} __packed; 277} __packed;
278#define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4)
254struct mgmt_rp_user_passkey_reply { 279struct mgmt_rp_user_passkey_reply {
255 struct mgmt_addr_info addr; 280 struct mgmt_addr_info addr;
256} __packed; 281} __packed;
@@ -259,8 +284,10 @@ struct mgmt_rp_user_passkey_reply {
259struct mgmt_cp_user_passkey_neg_reply { 284struct mgmt_cp_user_passkey_neg_reply {
260 struct mgmt_addr_info addr; 285 struct mgmt_addr_info addr;
261} __packed; 286} __packed;
287#define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
262 288
263#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020 289#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020
290#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
264struct mgmt_rp_read_local_oob_data { 291struct mgmt_rp_read_local_oob_data {
265 __u8 hash[16]; 292 __u8 hash[16];
266 __u8 randomizer[16]; 293 __u8 randomizer[16];
@@ -272,27 +299,32 @@ struct mgmt_cp_add_remote_oob_data {
272 __u8 hash[16]; 299 __u8 hash[16];
273 __u8 randomizer[16]; 300 __u8 randomizer[16];
274} __packed; 301} __packed;
302#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
275 303
276#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 304#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
277struct mgmt_cp_remove_remote_oob_data { 305struct mgmt_cp_remove_remote_oob_data {
278 struct mgmt_addr_info addr; 306 struct mgmt_addr_info addr;
279} __packed; 307} __packed;
308#define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE
280 309
281#define MGMT_OP_START_DISCOVERY 0x0023 310#define MGMT_OP_START_DISCOVERY 0x0023
282struct mgmt_cp_start_discovery { 311struct mgmt_cp_start_discovery {
283 __u8 type; 312 __u8 type;
284} __packed; 313} __packed;
314#define MGMT_START_DISCOVERY_SIZE 1
285 315
286#define MGMT_OP_STOP_DISCOVERY 0x0024 316#define MGMT_OP_STOP_DISCOVERY 0x0024
287struct mgmt_cp_stop_discovery { 317struct mgmt_cp_stop_discovery {
288 __u8 type; 318 __u8 type;
289} __packed; 319} __packed;
320#define MGMT_STOP_DISCOVERY_SIZE 1
290 321
291#define MGMT_OP_CONFIRM_NAME 0x0025 322#define MGMT_OP_CONFIRM_NAME 0x0025
292struct mgmt_cp_confirm_name { 323struct mgmt_cp_confirm_name {
293 struct mgmt_addr_info addr; 324 struct mgmt_addr_info addr;
294 __u8 name_known; 325 __u8 name_known;
295} __packed; 326} __packed;
327#define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1)
296struct mgmt_rp_confirm_name { 328struct mgmt_rp_confirm_name {
297 struct mgmt_addr_info addr; 329 struct mgmt_addr_info addr;
298} __packed; 330} __packed;
@@ -301,11 +333,13 @@ struct mgmt_rp_confirm_name {
301struct mgmt_cp_block_device { 333struct mgmt_cp_block_device {
302 struct mgmt_addr_info addr; 334 struct mgmt_addr_info addr;
303} __packed; 335} __packed;
336#define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
304 337
305#define MGMT_OP_UNBLOCK_DEVICE 0x0027 338#define MGMT_OP_UNBLOCK_DEVICE 0x0027
306struct mgmt_cp_unblock_device { 339struct mgmt_cp_unblock_device {
307 struct mgmt_addr_info addr; 340 struct mgmt_addr_info addr;
308} __packed; 341} __packed;
342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
309 343
310#define MGMT_EV_CMD_COMPLETE 0x0001 344#define MGMT_EV_CMD_COMPLETE 0x0001
311struct mgmt_ev_cmd_complete { 345struct mgmt_ev_cmd_complete {