mgmt.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. /*
  2. BlueZ - Bluetooth protocol stack for Linux
  3. Copyright (C) 2010 Nokia Corporation
  4. Copyright (C) 2011-2012 Intel Corporation
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License version 2 as
  7. published by the Free Software Foundation;
  8. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  9. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
  11. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
  12. CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
  13. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
  17. COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
  18. SOFTWARE IS DISCLAIMED.
  19. */
  20. #define MGMT_INDEX_NONE 0xFFFF
  21. #define MGMT_STATUS_SUCCESS 0x00
  22. #define MGMT_STATUS_UNKNOWN_COMMAND 0x01
  23. #define MGMT_STATUS_NOT_CONNECTED 0x02
  24. #define MGMT_STATUS_FAILED 0x03
  25. #define MGMT_STATUS_CONNECT_FAILED 0x04
  26. #define MGMT_STATUS_AUTH_FAILED 0x05
  27. #define MGMT_STATUS_NOT_PAIRED 0x06
  28. #define MGMT_STATUS_NO_RESOURCES 0x07
  29. #define MGMT_STATUS_TIMEOUT 0x08
  30. #define MGMT_STATUS_ALREADY_CONNECTED 0x09
  31. #define MGMT_STATUS_BUSY 0x0a
  32. #define MGMT_STATUS_REJECTED 0x0b
  33. #define MGMT_STATUS_NOT_SUPPORTED 0x0c
  34. #define MGMT_STATUS_INVALID_PARAMS 0x0d
  35. #define MGMT_STATUS_DISCONNECTED 0x0e
  36. #define MGMT_STATUS_NOT_POWERED 0x0f
  37. #define MGMT_STATUS_CANCELLED 0x10
  38. #define MGMT_STATUS_INVALID_INDEX 0x11
  39. #define MGMT_STATUS_RFKILLED 0x12
  40. #define MGMT_STATUS_ALREADY_PAIRED 0x13
  41. #define MGMT_STATUS_PERMISSION_DENIED 0x14
  42. struct mgmt_hdr {
  43. __le16 opcode;
  44. __le16 index;
  45. __le16 len;
  46. } __packed;
  47. struct mgmt_addr_info {
  48. bdaddr_t bdaddr;
  49. __u8 type;
  50. } __packed;
  51. #define MGMT_ADDR_INFO_SIZE 7
  52. #define MGMT_OP_READ_VERSION 0x0001
  53. #define MGMT_READ_VERSION_SIZE 0
  54. struct mgmt_rp_read_version {
  55. __u8 version;
  56. __le16 revision;
  57. } __packed;
  58. #define MGMT_OP_READ_COMMANDS 0x0002
  59. #define MGMT_READ_COMMANDS_SIZE 0
  60. struct mgmt_rp_read_commands {
  61. __le16 num_commands;
  62. __le16 num_events;
  63. __le16 opcodes[0];
  64. } __packed;
  65. #define MGMT_OP_READ_INDEX_LIST 0x0003
  66. #define MGMT_READ_INDEX_LIST_SIZE 0
  67. struct mgmt_rp_read_index_list {
  68. __le16 num_controllers;
  69. __le16 index[0];
  70. } __packed;
  71. /* Reserve one extra byte for names in management messages so that they
  72. * are always guaranteed to be nul-terminated */
  73. #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1)
  74. #define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1)
  75. #define MGMT_SETTING_POWERED 0x00000001
  76. #define MGMT_SETTING_CONNECTABLE 0x00000002
  77. #define MGMT_SETTING_FAST_CONNECTABLE 0x00000004
  78. #define MGMT_SETTING_DISCOVERABLE 0x00000008
  79. #define MGMT_SETTING_BONDABLE 0x00000010
  80. #define MGMT_SETTING_LINK_SECURITY 0x00000020
  81. #define MGMT_SETTING_SSP 0x00000040
  82. #define MGMT_SETTING_BREDR 0x00000080
  83. #define MGMT_SETTING_HS 0x00000100
  84. #define MGMT_SETTING_LE 0x00000200
  85. #define MGMT_SETTING_ADVERTISING 0x00000400
  86. #define MGMT_SETTING_SECURE_CONN 0x00000800
  87. #define MGMT_SETTING_DEBUG_KEYS 0x00001000
  88. #define MGMT_SETTING_PRIVACY 0x00002000
  89. #define MGMT_SETTING_CONFIGURATION 0x00004000
  90. #define MGMT_SETTING_STATIC_ADDRESS 0x00008000
  91. #define MGMT_OP_READ_INFO 0x0004
  92. #define MGMT_READ_INFO_SIZE 0
  93. struct mgmt_rp_read_info {
  94. bdaddr_t bdaddr;
  95. __u8 version;
  96. __le16 manufacturer;
  97. __le32 supported_settings;
  98. __le32 current_settings;
  99. __u8 dev_class[3];
  100. __u8 name[MGMT_MAX_NAME_LENGTH];
  101. __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
  102. } __packed;
  103. struct mgmt_mode {
  104. __u8 val;
  105. } __packed;
  106. #define MGMT_SETTING_SIZE 1
  107. #define MGMT_OP_SET_POWERED 0x0005
  108. #define MGMT_OP_SET_DISCOVERABLE 0x0006
  109. struct mgmt_cp_set_discoverable {
  110. __u8 val;
  111. __le16 timeout;
  112. } __packed;
  113. #define MGMT_SET_DISCOVERABLE_SIZE 3
  114. #define MGMT_OP_SET_CONNECTABLE 0x0007
  115. #define MGMT_OP_SET_FAST_CONNECTABLE 0x0008
  116. #define MGMT_OP_SET_BONDABLE 0x0009
  117. #define MGMT_OP_SET_LINK_SECURITY 0x000A
  118. #define MGMT_OP_SET_SSP 0x000B
  119. #define MGMT_OP_SET_HS 0x000C
  120. #define MGMT_OP_SET_LE 0x000D
  121. #define MGMT_OP_SET_DEV_CLASS 0x000E
  122. struct mgmt_cp_set_dev_class {
  123. __u8 major;
  124. __u8 minor;
  125. } __packed;
  126. #define MGMT_SET_DEV_CLASS_SIZE 2
  127. #define MGMT_OP_SET_LOCAL_NAME 0x000F
  128. struct mgmt_cp_set_local_name {
  129. __u8 name[MGMT_MAX_NAME_LENGTH];
  130. __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
  131. } __packed;
  132. #define MGMT_SET_LOCAL_NAME_SIZE 260
  133. #define MGMT_OP_ADD_UUID 0x0010
  134. struct mgmt_cp_add_uuid {
  135. __u8 uuid[16];
  136. __u8 svc_hint;
  137. } __packed;
  138. #define MGMT_ADD_UUID_SIZE 17
  139. #define MGMT_OP_REMOVE_UUID 0x0011
  140. struct mgmt_cp_remove_uuid {
  141. __u8 uuid[16];
  142. } __packed;
  143. #define MGMT_REMOVE_UUID_SIZE 16
  144. struct mgmt_link_key_info {
  145. struct mgmt_addr_info addr;
  146. __u8 type;
  147. __u8 val[16];
  148. __u8 pin_len;
  149. } __packed;
  150. #define MGMT_OP_LOAD_LINK_KEYS 0x0012
  151. struct mgmt_cp_load_link_keys {
  152. __u8 debug_keys;
  153. __le16 key_count;
  154. struct mgmt_link_key_info keys[0];
  155. } __packed;
  156. #define MGMT_LOAD_LINK_KEYS_SIZE 3
  157. #define MGMT_LTK_UNAUTHENTICATED 0x00
  158. #define MGMT_LTK_AUTHENTICATED 0x01
  159. #define MGMT_LTK_P256_UNAUTH 0x02
  160. #define MGMT_LTK_P256_AUTH 0x03
  161. #define MGMT_LTK_P256_DEBUG 0x04
  162. struct mgmt_ltk_info {
  163. struct mgmt_addr_info addr;
  164. __u8 type;
  165. __u8 master;
  166. __u8 enc_size;
  167. __le16 ediv;
  168. __le64 rand;
  169. __u8 val[16];
  170. } __packed;
  171. #define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013
  172. struct mgmt_cp_load_long_term_keys {
  173. __le16 key_count;
  174. struct mgmt_ltk_info keys[0];
  175. } __packed;
  176. #define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2
  177. #define MGMT_OP_DISCONNECT 0x0014
  178. struct mgmt_cp_disconnect {
  179. struct mgmt_addr_info addr;
  180. } __packed;
  181. #define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE
  182. struct mgmt_rp_disconnect {
  183. struct mgmt_addr_info addr;
  184. } __packed;
  185. #define MGMT_OP_GET_CONNECTIONS 0x0015
  186. #define MGMT_GET_CONNECTIONS_SIZE 0
  187. struct mgmt_rp_get_connections {
  188. __le16 conn_count;
  189. struct mgmt_addr_info addr[0];
  190. } __packed;
  191. #define MGMT_OP_PIN_CODE_REPLY 0x0016
  192. struct mgmt_cp_pin_code_reply {
  193. struct mgmt_addr_info addr;
  194. __u8 pin_len;
  195. __u8 pin_code[16];
  196. } __packed;
  197. #define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17)
  198. struct mgmt_rp_pin_code_reply {
  199. struct mgmt_addr_info addr;
  200. } __packed;
  201. #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017
  202. struct mgmt_cp_pin_code_neg_reply {
  203. struct mgmt_addr_info addr;
  204. } __packed;
  205. #define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
  206. #define MGMT_OP_SET_IO_CAPABILITY 0x0018
  207. struct mgmt_cp_set_io_capability {
  208. __u8 io_capability;
  209. } __packed;
  210. #define MGMT_SET_IO_CAPABILITY_SIZE 1
  211. #define MGMT_OP_PAIR_DEVICE 0x0019
  212. struct mgmt_cp_pair_device {
  213. struct mgmt_addr_info addr;
  214. __u8 io_cap;
  215. } __packed;
  216. #define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
  217. struct mgmt_rp_pair_device {
  218. struct mgmt_addr_info addr;
  219. } __packed;
  220. #define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A
  221. #define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
  222. #define MGMT_OP_UNPAIR_DEVICE 0x001B
  223. struct mgmt_cp_unpair_device {
  224. struct mgmt_addr_info addr;
  225. __u8 disconnect;
  226. } __packed;
  227. #define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
  228. struct mgmt_rp_unpair_device {
  229. struct mgmt_addr_info addr;
  230. };
  231. #define MGMT_OP_USER_CONFIRM_REPLY 0x001C
  232. struct mgmt_cp_user_confirm_reply {
  233. struct mgmt_addr_info addr;
  234. } __packed;
  235. #define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE
  236. struct mgmt_rp_user_confirm_reply {
  237. struct mgmt_addr_info addr;
  238. } __packed;
  239. #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D
  240. struct mgmt_cp_user_confirm_neg_reply {
  241. struct mgmt_addr_info addr;
  242. } __packed;
  243. #define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
  244. #define MGMT_OP_USER_PASSKEY_REPLY 0x001E
  245. struct mgmt_cp_user_passkey_reply {
  246. struct mgmt_addr_info addr;
  247. __le32 passkey;
  248. } __packed;
  249. #define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4)
  250. struct mgmt_rp_user_passkey_reply {
  251. struct mgmt_addr_info addr;
  252. } __packed;
  253. #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F
  254. struct mgmt_cp_user_passkey_neg_reply {
  255. struct mgmt_addr_info addr;
  256. } __packed;
  257. #define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
  258. #define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020
  259. #define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
  260. struct mgmt_rp_read_local_oob_data {
  261. __u8 hash192[16];
  262. __u8 rand192[16];
  263. __u8 hash256[16];
  264. __u8 rand256[16];
  265. } __packed;
  266. #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
  267. struct mgmt_cp_add_remote_oob_data {
  268. struct mgmt_addr_info addr;
  269. __u8 hash[16];
  270. __u8 rand[16];
  271. } __packed;
  272. #define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
  273. struct mgmt_cp_add_remote_oob_ext_data {
  274. struct mgmt_addr_info addr;
  275. __u8 hash192[16];
  276. __u8 rand192[16];
  277. __u8 hash256[16];
  278. __u8 rand256[16];
  279. } __packed;
  280. #define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
  281. #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
  282. struct mgmt_cp_remove_remote_oob_data {
  283. struct mgmt_addr_info addr;
  284. } __packed;
  285. #define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE
  286. #define MGMT_OP_START_DISCOVERY 0x0023
  287. struct mgmt_cp_start_discovery {
  288. __u8 type;
  289. } __packed;
  290. #define MGMT_START_DISCOVERY_SIZE 1
  291. #define MGMT_OP_STOP_DISCOVERY 0x0024
  292. struct mgmt_cp_stop_discovery {
  293. __u8 type;
  294. } __packed;
  295. #define MGMT_STOP_DISCOVERY_SIZE 1
  296. #define MGMT_OP_CONFIRM_NAME 0x0025
  297. struct mgmt_cp_confirm_name {
  298. struct mgmt_addr_info addr;
  299. __u8 name_known;
  300. } __packed;
  301. #define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1)
  302. struct mgmt_rp_confirm_name {
  303. struct mgmt_addr_info addr;
  304. } __packed;
  305. #define MGMT_OP_BLOCK_DEVICE 0x0026
  306. struct mgmt_cp_block_device {
  307. struct mgmt_addr_info addr;
  308. } __packed;
  309. #define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
  310. #define MGMT_OP_UNBLOCK_DEVICE 0x0027
  311. struct mgmt_cp_unblock_device {
  312. struct mgmt_addr_info addr;
  313. } __packed;
  314. #define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
  315. #define MGMT_OP_SET_DEVICE_ID 0x0028
  316. struct mgmt_cp_set_device_id {
  317. __le16 source;
  318. __le16 vendor;
  319. __le16 product;
  320. __le16 version;
  321. } __packed;
  322. #define MGMT_SET_DEVICE_ID_SIZE 8
  323. #define MGMT_OP_SET_ADVERTISING 0x0029
  324. #define MGMT_OP_SET_BREDR 0x002A
  325. #define MGMT_OP_SET_STATIC_ADDRESS 0x002B
  326. struct mgmt_cp_set_static_address {
  327. bdaddr_t bdaddr;
  328. } __packed;
  329. #define MGMT_SET_STATIC_ADDRESS_SIZE 6
  330. #define MGMT_OP_SET_SCAN_PARAMS 0x002C
  331. struct mgmt_cp_set_scan_params {
  332. __le16 interval;
  333. __le16 window;
  334. } __packed;
  335. #define MGMT_SET_SCAN_PARAMS_SIZE 4
  336. #define MGMT_OP_SET_SECURE_CONN 0x002D
  337. #define MGMT_OP_SET_DEBUG_KEYS 0x002E
  338. #define MGMT_OP_SET_PRIVACY 0x002F
  339. struct mgmt_cp_set_privacy {
  340. __u8 privacy;
  341. __u8 irk[16];
  342. } __packed;
  343. #define MGMT_SET_PRIVACY_SIZE 17
  344. struct mgmt_irk_info {
  345. struct mgmt_addr_info addr;
  346. __u8 val[16];
  347. } __packed;
  348. #define MGMT_OP_LOAD_IRKS 0x0030
  349. struct mgmt_cp_load_irks {
  350. __le16 irk_count;
  351. struct mgmt_irk_info irks[0];
  352. } __packed;
  353. #define MGMT_LOAD_IRKS_SIZE 2
  354. #define MGMT_OP_GET_CONN_INFO 0x0031
  355. struct mgmt_cp_get_conn_info {
  356. struct mgmt_addr_info addr;
  357. } __packed;
  358. #define MGMT_GET_CONN_INFO_SIZE MGMT_ADDR_INFO_SIZE
  359. struct mgmt_rp_get_conn_info {
  360. struct mgmt_addr_info addr;
  361. __s8 rssi;
  362. __s8 tx_power;
  363. __s8 max_tx_power;
  364. } __packed;
  365. #define MGMT_OP_GET_CLOCK_INFO 0x0032
  366. struct mgmt_cp_get_clock_info {
  367. struct mgmt_addr_info addr;
  368. } __packed;
  369. #define MGMT_GET_CLOCK_INFO_SIZE MGMT_ADDR_INFO_SIZE
  370. struct mgmt_rp_get_clock_info {
  371. struct mgmt_addr_info addr;
  372. __le32 local_clock;
  373. __le32 piconet_clock;
  374. __le16 accuracy;
  375. } __packed;
  376. #define MGMT_OP_ADD_DEVICE 0x0033
  377. struct mgmt_cp_add_device {
  378. struct mgmt_addr_info addr;
  379. __u8 action;
  380. } __packed;
  381. #define MGMT_ADD_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
  382. #define MGMT_OP_REMOVE_DEVICE 0x0034
  383. struct mgmt_cp_remove_device {
  384. struct mgmt_addr_info addr;
  385. } __packed;
  386. #define MGMT_REMOVE_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
  387. struct mgmt_conn_param {
  388. struct mgmt_addr_info addr;
  389. __le16 min_interval;
  390. __le16 max_interval;
  391. __le16 latency;
  392. __le16 timeout;
  393. } __packed;
  394. #define MGMT_OP_LOAD_CONN_PARAM 0x0035
  395. struct mgmt_cp_load_conn_param {
  396. __le16 param_count;
  397. struct mgmt_conn_param params[0];
  398. } __packed;
  399. #define MGMT_LOAD_CONN_PARAM_SIZE 2
  400. #define MGMT_OP_READ_UNCONF_INDEX_LIST 0x0036
  401. #define MGMT_READ_UNCONF_INDEX_LIST_SIZE 0
  402. struct mgmt_rp_read_unconf_index_list {
  403. __le16 num_controllers;
  404. __le16 index[0];
  405. } __packed;
  406. #define MGMT_OPTION_EXTERNAL_CONFIG 0x00000001
  407. #define MGMT_OPTION_PUBLIC_ADDRESS 0x00000002
  408. #define MGMT_OP_READ_CONFIG_INFO 0x0037
  409. #define MGMT_READ_CONFIG_INFO_SIZE 0
  410. struct mgmt_rp_read_config_info {
  411. __le16 manufacturer;
  412. __le32 supported_options;
  413. __le32 missing_options;
  414. } __packed;
  415. #define MGMT_OP_SET_EXTERNAL_CONFIG 0x0038
  416. struct mgmt_cp_set_external_config {
  417. __u8 config;
  418. } __packed;
  419. #define MGMT_SET_EXTERNAL_CONFIG_SIZE 1
  420. #define MGMT_OP_SET_PUBLIC_ADDRESS 0x0039
  421. struct mgmt_cp_set_public_address {
  422. bdaddr_t bdaddr;
  423. } __packed;
  424. #define MGMT_SET_PUBLIC_ADDRESS_SIZE 6
  425. #define MGMT_OP_START_SERVICE_DISCOVERY 0x003A
  426. struct mgmt_cp_start_service_discovery {
  427. __u8 type;
  428. __s8 rssi;
  429. __le16 uuid_count;
  430. __u8 uuids[0][16];
  431. } __packed;
  432. #define MGMT_START_SERVICE_DISCOVERY_SIZE 4
  433. #define MGMT_OP_READ_LOCAL_OOB_EXT_DATA 0x003B
  434. struct mgmt_cp_read_local_oob_ext_data {
  435. __u8 type;
  436. } __packed;
  437. #define MGMT_READ_LOCAL_OOB_EXT_DATA_SIZE 1
  438. struct mgmt_rp_read_local_oob_ext_data {
  439. __u8 type;
  440. __le16 eir_len;
  441. __u8 eir[0];
  442. } __packed;
  443. #define MGMT_OP_READ_EXT_INDEX_LIST 0x003C
  444. #define MGMT_READ_EXT_INDEX_LIST_SIZE 0
  445. struct mgmt_rp_read_ext_index_list {
  446. __le16 num_controllers;
  447. struct {
  448. __le16 index;
  449. __u8 type;
  450. __u8 bus;
  451. } entry[0];
  452. } __packed;
  453. #define MGMT_OP_READ_ADV_FEATURES 0x0003D
  454. #define MGMT_READ_ADV_FEATURES_SIZE 0
  455. struct mgmt_rp_read_adv_features {
  456. __le32 supported_flags;
  457. __u8 max_adv_data_len;
  458. __u8 max_scan_rsp_len;
  459. __u8 max_instances;
  460. __u8 num_instances;
  461. __u8 instance[0];
  462. } __packed;
  463. #define MGMT_OP_ADD_ADVERTISING 0x003E
  464. struct mgmt_cp_add_advertising {
  465. __u8 instance;
  466. __le32 flags;
  467. __le16 duration;
  468. __le16 timeout;
  469. __u8 adv_data_len;
  470. __u8 scan_rsp_len;
  471. __u8 data[0];
  472. } __packed;
  473. #define MGMT_ADD_ADVERTISING_SIZE 11
  474. struct mgmt_rp_add_advertising {
  475. __u8 instance;
  476. } __packed;
  477. #define MGMT_ADV_FLAG_CONNECTABLE BIT(0)
  478. #define MGMT_ADV_FLAG_DISCOV BIT(1)
  479. #define MGMT_ADV_FLAG_LIMITED_DISCOV BIT(2)
  480. #define MGMT_ADV_FLAG_MANAGED_FLAGS BIT(3)
  481. #define MGMT_ADV_FLAG_TX_POWER BIT(4)
  482. #define MGMT_ADV_FLAG_APPEARANCE BIT(5)
  483. #define MGMT_ADV_FLAG_LOCAL_NAME BIT(6)
  484. #define MGMT_OP_REMOVE_ADVERTISING 0x003F
  485. struct mgmt_cp_remove_advertising {
  486. __u8 instance;
  487. } __packed;
  488. #define MGMT_REMOVE_ADVERTISING_SIZE 1
  489. struct mgmt_rp_remove_advertising {
  490. __u8 instance;
  491. } __packed;
  492. #define MGMT_OP_GET_ADV_SIZE_INFO 0x0040
  493. struct mgmt_cp_get_adv_size_info {
  494. __u8 instance;
  495. __le32 flags;
  496. } __packed;
  497. #define MGMT_GET_ADV_SIZE_INFO_SIZE 5
  498. struct mgmt_rp_get_adv_size_info {
  499. __u8 instance;
  500. __le32 flags;
  501. __u8 max_adv_data_len;
  502. __u8 max_scan_rsp_len;
  503. } __packed;
  504. #define MGMT_OP_START_LIMITED_DISCOVERY 0x0041
  505. #define MGMT_OP_READ_EXT_INFO 0x0042
  506. #define MGMT_READ_EXT_INFO_SIZE 0
  507. struct mgmt_rp_read_ext_info {
  508. bdaddr_t bdaddr;
  509. __u8 version;
  510. __le16 manufacturer;
  511. __le32 supported_settings;
  512. __le32 current_settings;
  513. __le16 eir_len;
  514. __u8 eir[0];
  515. } __packed;
  516. #define MGMT_OP_SET_APPEARANCE 0x0043
  517. struct mgmt_cp_set_appearance {
  518. __u16 appearance;
  519. } __packed;
  520. #define MGMT_SET_APPEARANCE_SIZE 2
  521. #define MGMT_EV_CMD_COMPLETE 0x0001
  522. struct mgmt_ev_cmd_complete {
  523. __le16 opcode;
  524. __u8 status;
  525. __u8 data[0];
  526. } __packed;
  527. #define MGMT_EV_CMD_STATUS 0x0002
  528. struct mgmt_ev_cmd_status {
  529. __le16 opcode;
  530. __u8 status;
  531. } __packed;
  532. #define MGMT_EV_CONTROLLER_ERROR 0x0003
  533. struct mgmt_ev_controller_error {
  534. __u8 error_code;
  535. } __packed;
  536. #define MGMT_EV_INDEX_ADDED 0x0004
  537. #define MGMT_EV_INDEX_REMOVED 0x0005
  538. #define MGMT_EV_NEW_SETTINGS 0x0006
  539. #define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007
  540. struct mgmt_ev_class_of_dev_changed {
  541. __u8 dev_class[3];
  542. };
  543. #define MGMT_EV_LOCAL_NAME_CHANGED 0x0008
  544. struct mgmt_ev_local_name_changed {
  545. __u8 name[MGMT_MAX_NAME_LENGTH];
  546. __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
  547. } __packed;
  548. #define MGMT_EV_NEW_LINK_KEY 0x0009
  549. struct mgmt_ev_new_link_key {
  550. __u8 store_hint;
  551. struct mgmt_link_key_info key;
  552. } __packed;
  553. #define MGMT_EV_NEW_LONG_TERM_KEY 0x000A
  554. struct mgmt_ev_new_long_term_key {
  555. __u8 store_hint;
  556. struct mgmt_ltk_info key;
  557. } __packed;
  558. #define MGMT_EV_DEVICE_CONNECTED 0x000B
  559. struct mgmt_ev_device_connected {
  560. struct mgmt_addr_info addr;
  561. __le32 flags;
  562. __le16 eir_len;
  563. __u8 eir[0];
  564. } __packed;
  565. #define MGMT_DEV_DISCONN_UNKNOWN 0x00
  566. #define MGMT_DEV_DISCONN_TIMEOUT 0x01
  567. #define MGMT_DEV_DISCONN_LOCAL_HOST 0x02
  568. #define MGMT_DEV_DISCONN_REMOTE 0x03
  569. #define MGMT_DEV_DISCONN_AUTH_FAILURE 0x04
  570. #define MGMT_EV_DEVICE_DISCONNECTED 0x000C
  571. struct mgmt_ev_device_disconnected {
  572. struct mgmt_addr_info addr;
  573. __u8 reason;
  574. } __packed;
  575. #define MGMT_EV_CONNECT_FAILED 0x000D
  576. struct mgmt_ev_connect_failed {
  577. struct mgmt_addr_info addr;
  578. __u8 status;
  579. } __packed;
  580. #define MGMT_EV_PIN_CODE_REQUEST 0x000E
  581. struct mgmt_ev_pin_code_request {
  582. struct mgmt_addr_info addr;
  583. __u8 secure;
  584. } __packed;
  585. #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
  586. struct mgmt_ev_user_confirm_request {
  587. struct mgmt_addr_info addr;
  588. __u8 confirm_hint;
  589. __le32 value;
  590. } __packed;
  591. #define MGMT_EV_USER_PASSKEY_REQUEST 0x0010
  592. struct mgmt_ev_user_passkey_request {
  593. struct mgmt_addr_info addr;
  594. } __packed;
  595. #define MGMT_EV_AUTH_FAILED 0x0011
  596. struct mgmt_ev_auth_failed {
  597. struct mgmt_addr_info addr;
  598. __u8 status;
  599. } __packed;
  600. #define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
  601. #define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
  602. #define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04
  603. #define MGMT_EV_DEVICE_FOUND 0x0012
  604. struct mgmt_ev_device_found {
  605. struct mgmt_addr_info addr;
  606. __s8 rssi;
  607. __le32 flags;
  608. __le16 eir_len;
  609. __u8 eir[0];
  610. } __packed;
  611. #define MGMT_EV_DISCOVERING 0x0013
  612. struct mgmt_ev_discovering {
  613. __u8 type;
  614. __u8 discovering;
  615. } __packed;
  616. #define MGMT_EV_DEVICE_BLOCKED 0x0014
  617. struct mgmt_ev_device_blocked {
  618. struct mgmt_addr_info addr;
  619. } __packed;
  620. #define MGMT_EV_DEVICE_UNBLOCKED 0x0015
  621. struct mgmt_ev_device_unblocked {
  622. struct mgmt_addr_info addr;
  623. } __packed;
  624. #define MGMT_EV_DEVICE_UNPAIRED 0x0016
  625. struct mgmt_ev_device_unpaired {
  626. struct mgmt_addr_info addr;
  627. } __packed;
  628. #define MGMT_EV_PASSKEY_NOTIFY 0x0017
  629. struct mgmt_ev_passkey_notify {
  630. struct mgmt_addr_info addr;
  631. __le32 passkey;
  632. __u8 entered;
  633. } __packed;
  634. #define MGMT_EV_NEW_IRK 0x0018
  635. struct mgmt_ev_new_irk {
  636. __u8 store_hint;
  637. bdaddr_t rpa;
  638. struct mgmt_irk_info irk;
  639. } __packed;
  640. #define MGMT_CSRK_LOCAL_UNAUTHENTICATED 0x00
  641. #define MGMT_CSRK_REMOTE_UNAUTHENTICATED 0x01
  642. #define MGMT_CSRK_LOCAL_AUTHENTICATED 0x02
  643. #define MGMT_CSRK_REMOTE_AUTHENTICATED 0x03
  644. struct mgmt_csrk_info {
  645. struct mgmt_addr_info addr;
  646. __u8 type;
  647. __u8 val[16];
  648. } __packed;
  649. #define MGMT_EV_NEW_CSRK 0x0019
  650. struct mgmt_ev_new_csrk {
  651. __u8 store_hint;
  652. struct mgmt_csrk_info key;
  653. } __packed;
  654. #define MGMT_EV_DEVICE_ADDED 0x001a
  655. struct mgmt_ev_device_added {
  656. struct mgmt_addr_info addr;
  657. __u8 action;
  658. } __packed;
  659. #define MGMT_EV_DEVICE_REMOVED 0x001b
  660. struct mgmt_ev_device_removed {
  661. struct mgmt_addr_info addr;
  662. } __packed;
  663. #define MGMT_EV_NEW_CONN_PARAM 0x001c
  664. struct mgmt_ev_new_conn_param {
  665. struct mgmt_addr_info addr;
  666. __u8 store_hint;
  667. __le16 min_interval;
  668. __le16 max_interval;
  669. __le16 latency;
  670. __le16 timeout;
  671. } __packed;
  672. #define MGMT_EV_UNCONF_INDEX_ADDED 0x001d
  673. #define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e
  674. #define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f
  675. struct mgmt_ev_ext_index {
  676. __u8 type;
  677. __u8 bus;
  678. } __packed;
  679. #define MGMT_EV_EXT_INDEX_ADDED 0x0020
  680. #define MGMT_EV_EXT_INDEX_REMOVED 0x0021
  681. #define MGMT_EV_LOCAL_OOB_DATA_UPDATED 0x0022
  682. struct mgmt_ev_local_oob_data_updated {
  683. __u8 type;
  684. __le16 eir_len;
  685. __u8 eir[0];
  686. } __packed;
  687. #define MGMT_EV_ADVERTISING_ADDED 0x0023
  688. struct mgmt_ev_advertising_added {
  689. __u8 instance;
  690. } __packed;
  691. #define MGMT_EV_ADVERTISING_REMOVED 0x0024
  692. struct mgmt_ev_advertising_removed {
  693. __u8 instance;
  694. } __packed;
  695. #define MGMT_EV_EXT_INFO_CHANGED 0x0025
  696. struct mgmt_ev_ext_info_changed {
  697. __le16 eir_len;
  698. __u8 eir[0];
  699. } __packed;