libpcap-1.8.1-enable_bluetooth-1.patch 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. Submitted By: Fernando de Oliveira <famobr at yahoo dot com dot br>
  2. Date: 2014-09-07
  3. Initial Package Version: 1.6.2 (problem started with 1.6.1)
  4. Upstream Status: Unknown
  5. Origin: ArchLinux
  6. URL: https://projects.archlinux.org/svntogit/packages.git/plain/trunk/mgmt.h?h=packages/libpcap
  7. Description: Fix build with bluez-5.21
  8. diff -Naur libpcap-1.6.2.orig/bluetooth/mgmt.h libpcap-1.6.2/bluetooth/mgmt.h
  9. --- libpcap-1.6.2.orig/bluetooth/mgmt.h 1969-12-31 21:00:00.000000000 -0300
  10. +++ libpcap-1.6.2/bluetooth/mgmt.h 2014-09-07 14:11:36.456414731 -0300
  11. @@ -0,0 +1,772 @@
  12. +/*
  13. + * BlueZ - Bluetooth protocol stack for Linux
  14. + *
  15. + * Copyright (C) 2010 Nokia Corporation
  16. + * Copyright (C) 2010 Marcel Holtmann <marcel@holtmann.org>
  17. + *
  18. + *
  19. + * This program is free software; you can redistribute it and/or modify
  20. + * it under the terms of the GNU General Public License as published by
  21. + * the Free Software Foundation; either version 2 of the License, or
  22. + * (at your option) any later version.
  23. + *
  24. + * This program is distributed in the hope that it will be useful,
  25. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. + * GNU General Public License for more details.
  28. + *
  29. + * You should have received a copy of the GNU General Public License
  30. + * along with this program; if not, write to the Free Software
  31. + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  32. + *
  33. + */
  34. +
  35. +#ifndef __packed
  36. +#define __packed __attribute__((packed))
  37. +#endif
  38. +
  39. +#define MGMT_INDEX_NONE 0xFFFF
  40. +
  41. +#define MGMT_STATUS_SUCCESS 0x00
  42. +#define MGMT_STATUS_UNKNOWN_COMMAND 0x01
  43. +#define MGMT_STATUS_NOT_CONNECTED 0x02
  44. +#define MGMT_STATUS_FAILED 0x03
  45. +#define MGMT_STATUS_CONNECT_FAILED 0x04
  46. +#define MGMT_STATUS_AUTH_FAILED 0x05
  47. +#define MGMT_STATUS_NOT_PAIRED 0x06
  48. +#define MGMT_STATUS_NO_RESOURCES 0x07
  49. +#define MGMT_STATUS_TIMEOUT 0x08
  50. +#define MGMT_STATUS_ALREADY_CONNECTED 0x09
  51. +#define MGMT_STATUS_BUSY 0x0a
  52. +#define MGMT_STATUS_REJECTED 0x0b
  53. +#define MGMT_STATUS_NOT_SUPPORTED 0x0c
  54. +#define MGMT_STATUS_INVALID_PARAMS 0x0d
  55. +#define MGMT_STATUS_DISCONNECTED 0x0e
  56. +#define MGMT_STATUS_NOT_POWERED 0x0f
  57. +#define MGMT_STATUS_CANCELLED 0x10
  58. +#define MGMT_STATUS_INVALID_INDEX 0x11
  59. +#define MGMT_STATUS_RFKILLED 0x12
  60. +
  61. +struct mgmt_hdr {
  62. + uint16_t opcode;
  63. + uint16_t index;
  64. + uint16_t len;
  65. +} __packed;
  66. +#define MGMT_HDR_SIZE 6
  67. +
  68. +struct mgmt_addr_info {
  69. + bdaddr_t bdaddr;
  70. + uint8_t type;
  71. +} __packed;
  72. +
  73. +#define MGMT_OP_READ_VERSION 0x0001
  74. +struct mgmt_rp_read_version {
  75. + uint8_t version;
  76. + uint16_t revision;
  77. +} __packed;
  78. +
  79. +#define MGMT_OP_READ_COMMANDS 0x0002
  80. +struct mgmt_rp_read_commands {
  81. + uint16_t num_commands;
  82. + uint16_t num_events;
  83. + uint16_t opcodes[0];
  84. +} __packed;
  85. +
  86. +#define MGMT_OP_READ_INDEX_LIST 0x0003
  87. +struct mgmt_rp_read_index_list {
  88. + uint16_t num_controllers;
  89. + uint16_t index[0];
  90. +} __packed;
  91. +
  92. +/* Reserve one extra byte for names in management messages so that they
  93. + * are always guaranteed to be nul-terminated */
  94. +#define MGMT_MAX_NAME_LENGTH (248 + 1)
  95. +#define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1)
  96. +
  97. +#define MGMT_SETTING_POWERED 0x00000001
  98. +#define MGMT_SETTING_CONNECTABLE 0x00000002
  99. +#define MGMT_SETTING_FAST_CONNECTABLE 0x00000004
  100. +#define MGMT_SETTING_DISCOVERABLE 0x00000008
  101. +#define MGMT_SETTING_BONDABLE 0x00000010
  102. +#define MGMT_SETTING_LINK_SECURITY 0x00000020
  103. +#define MGMT_SETTING_SSP 0x00000040
  104. +#define MGMT_SETTING_BREDR 0x00000080
  105. +#define MGMT_SETTING_HS 0x00000100
  106. +#define MGMT_SETTING_LE 0x00000200
  107. +#define MGMT_SETTING_ADVERTISING 0x00000400
  108. +#define MGMT_SETTING_SECURE_CONN 0x00000800
  109. +#define MGMT_SETTING_DEBUG_KEYS 0x00001000
  110. +#define MGMT_SETTING_PRIVACY 0x00002000
  111. +#define MGMT_SETTING_CONFIGURATION 0x00004000
  112. +
  113. +#define MGMT_OP_READ_INFO 0x0004
  114. +struct mgmt_rp_read_info {
  115. + bdaddr_t bdaddr;
  116. + uint8_t version;
  117. + uint16_t manufacturer;
  118. + uint32_t supported_settings;
  119. + uint32_t current_settings;
  120. + uint8_t dev_class[3];
  121. + uint8_t name[MGMT_MAX_NAME_LENGTH];
  122. + uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
  123. +} __packed;
  124. +
  125. +struct mgmt_mode {
  126. + uint8_t val;
  127. +} __packed;
  128. +
  129. +struct mgmt_cod {
  130. + uint8_t val[3];
  131. +} __packed;
  132. +
  133. +#define MGMT_OP_SET_POWERED 0x0005
  134. +
  135. +#define MGMT_OP_SET_DISCOVERABLE 0x0006
  136. +struct mgmt_cp_set_discoverable {
  137. + uint8_t val;
  138. + uint16_t timeout;
  139. +} __packed;
  140. +
  141. +#define MGMT_OP_SET_CONNECTABLE 0x0007
  142. +
  143. +#define MGMT_OP_SET_FAST_CONNECTABLE 0x0008
  144. +
  145. +#define MGMT_OP_SET_BONDABLE 0x0009
  146. +
  147. +#define MGMT_OP_SET_LINK_SECURITY 0x000A
  148. +
  149. +#define MGMT_OP_SET_SSP 0x000B
  150. +
  151. +#define MGMT_OP_SET_HS 0x000C
  152. +
  153. +#define MGMT_OP_SET_LE 0x000D
  154. +
  155. +#define MGMT_OP_SET_DEV_CLASS 0x000E
  156. +struct mgmt_cp_set_dev_class {
  157. + uint8_t major;
  158. + uint8_t minor;
  159. +} __packed;
  160. +
  161. +#define MGMT_OP_SET_LOCAL_NAME 0x000F
  162. +struct mgmt_cp_set_local_name {
  163. + uint8_t name[MGMT_MAX_NAME_LENGTH];
  164. + uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
  165. +} __packed;
  166. +
  167. +#define MGMT_OP_ADD_UUID 0x0010
  168. +struct mgmt_cp_add_uuid {
  169. + uint8_t uuid[16];
  170. + uint8_t svc_hint;
  171. +} __packed;
  172. +
  173. +#define MGMT_OP_REMOVE_UUID 0x0011
  174. +struct mgmt_cp_remove_uuid {
  175. + uint8_t uuid[16];
  176. +} __packed;
  177. +
  178. +struct mgmt_link_key_info {
  179. + struct mgmt_addr_info addr;
  180. + uint8_t type;
  181. + uint8_t val[16];
  182. + uint8_t pin_len;
  183. +} __packed;
  184. +
  185. +#define MGMT_OP_LOAD_LINK_KEYS 0x0012
  186. +struct mgmt_cp_load_link_keys {
  187. + uint8_t debug_keys;
  188. + uint16_t key_count;
  189. + struct mgmt_link_key_info keys[0];
  190. +} __packed;
  191. +
  192. +struct mgmt_ltk_info {
  193. + struct mgmt_addr_info addr;
  194. + uint8_t type;
  195. + uint8_t master;
  196. + uint8_t enc_size;
  197. + uint16_t ediv;
  198. + uint64_t rand;
  199. + uint8_t val[16];
  200. +} __packed;
  201. +
  202. +#define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013
  203. +struct mgmt_cp_load_long_term_keys {
  204. + uint16_t key_count;
  205. + struct mgmt_ltk_info keys[0];
  206. +} __packed;
  207. +
  208. +#define MGMT_OP_DISCONNECT 0x0014
  209. +struct mgmt_cp_disconnect {
  210. + struct mgmt_addr_info addr;
  211. +} __packed;
  212. +struct mgmt_rp_disconnect {
  213. + struct mgmt_addr_info addr;
  214. +} __packed;
  215. +
  216. +#define MGMT_OP_GET_CONNECTIONS 0x0015
  217. +struct mgmt_rp_get_connections {
  218. + uint16_t conn_count;
  219. + struct mgmt_addr_info addr[0];
  220. +} __packed;
  221. +
  222. +#define MGMT_OP_PIN_CODE_REPLY 0x0016
  223. +struct mgmt_cp_pin_code_reply {
  224. + struct mgmt_addr_info addr;
  225. + uint8_t pin_len;
  226. + uint8_t pin_code[16];
  227. +} __packed;
  228. +
  229. +#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017
  230. +struct mgmt_cp_pin_code_neg_reply {
  231. + struct mgmt_addr_info addr;
  232. +} __packed;
  233. +
  234. +#define MGMT_OP_SET_IO_CAPABILITY 0x0018
  235. +struct mgmt_cp_set_io_capability {
  236. + uint8_t io_capability;
  237. +} __packed;
  238. +
  239. +#define MGMT_OP_PAIR_DEVICE 0x0019
  240. +struct mgmt_cp_pair_device {
  241. + struct mgmt_addr_info addr;
  242. + uint8_t io_cap;
  243. +} __packed;
  244. +struct mgmt_rp_pair_device {
  245. + struct mgmt_addr_info addr;
  246. +} __packed;
  247. +
  248. +#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A
  249. +
  250. +#define MGMT_OP_UNPAIR_DEVICE 0x001B
  251. +struct mgmt_cp_unpair_device {
  252. + struct mgmt_addr_info addr;
  253. + uint8_t disconnect;
  254. +} __packed;
  255. +struct mgmt_rp_unpair_device {
  256. + struct mgmt_addr_info addr;
  257. +} __packed;
  258. +
  259. +#define MGMT_OP_USER_CONFIRM_REPLY 0x001C
  260. +struct mgmt_cp_user_confirm_reply {
  261. + struct mgmt_addr_info addr;
  262. +} __packed;
  263. +struct mgmt_rp_user_confirm_reply {
  264. + struct mgmt_addr_info addr;
  265. +} __packed;
  266. +
  267. +#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D
  268. +
  269. +#define MGMT_OP_USER_PASSKEY_REPLY 0x001E
  270. +struct mgmt_cp_user_passkey_reply {
  271. + struct mgmt_addr_info addr;
  272. + uint32_t passkey;
  273. +} __packed;
  274. +struct mgmt_rp_user_passkey_reply {
  275. + struct mgmt_addr_info addr;
  276. +} __packed;
  277. +
  278. +#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F
  279. +struct mgmt_cp_user_passkey_neg_reply {
  280. + struct mgmt_addr_info addr;
  281. +} __packed;
  282. +
  283. +#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020
  284. +struct mgmt_rp_read_local_oob_data {
  285. + uint8_t hash[16];
  286. + uint8_t randomizer[16];
  287. +} __packed;
  288. +struct mgmt_rp_read_local_oob_ext_data {
  289. + uint8_t hash192[16];
  290. + uint8_t randomizer192[16];
  291. + uint8_t hash256[16];
  292. + uint8_t randomizer256[16];
  293. +} __packed;
  294. +
  295. +#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
  296. +struct mgmt_cp_add_remote_oob_data {
  297. + struct mgmt_addr_info addr;
  298. + uint8_t hash[16];
  299. + uint8_t randomizer[16];
  300. +} __packed;
  301. +
  302. +#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
  303. +struct mgmt_cp_remove_remote_oob_data {
  304. + struct mgmt_addr_info addr;
  305. +} __packed;
  306. +
  307. +#define MGMT_OP_START_DISCOVERY 0x0023
  308. +struct mgmt_cp_start_discovery {
  309. + uint8_t type;
  310. +} __packed;
  311. +
  312. +#define MGMT_OP_STOP_DISCOVERY 0x0024
  313. +struct mgmt_cp_stop_discovery {
  314. + uint8_t type;
  315. +} __packed;
  316. +
  317. +#define MGMT_OP_CONFIRM_NAME 0x0025
  318. +struct mgmt_cp_confirm_name {
  319. + struct mgmt_addr_info addr;
  320. + uint8_t name_known;
  321. +} __packed;
  322. +struct mgmt_rp_confirm_name {
  323. + struct mgmt_addr_info addr;
  324. +} __packed;
  325. +
  326. +#define MGMT_OP_BLOCK_DEVICE 0x0026
  327. +struct mgmt_cp_block_device {
  328. + struct mgmt_addr_info addr;
  329. +} __packed;
  330. +
  331. +#define MGMT_OP_UNBLOCK_DEVICE 0x0027
  332. +struct mgmt_cp_unblock_device {
  333. + struct mgmt_addr_info addr;
  334. +} __packed;
  335. +
  336. +#define MGMT_OP_SET_DEVICE_ID 0x0028
  337. +struct mgmt_cp_set_device_id {
  338. + uint16_t source;
  339. + uint16_t vendor;
  340. + uint16_t product;
  341. + uint16_t version;
  342. +} __packed;
  343. +
  344. +#define MGMT_OP_SET_ADVERTISING 0x0029
  345. +
  346. +#define MGMT_OP_SET_BREDR 0x002A
  347. +
  348. +#define MGMT_OP_SET_STATIC_ADDRESS 0x002B
  349. +struct mgmt_cp_set_static_address {
  350. + bdaddr_t bdaddr;
  351. +} __packed;
  352. +
  353. +#define MGMT_OP_SET_SCAN_PARAMS 0x002C
  354. +struct mgmt_cp_set_scan_params {
  355. + uint16_t interval;
  356. + uint16_t window;
  357. +} __packed;
  358. +
  359. +#define MGMT_OP_SET_SECURE_CONN 0x002D
  360. +
  361. +#define MGMT_OP_SET_DEBUG_KEYS 0x002E
  362. +
  363. +struct mgmt_irk_info {
  364. + struct mgmt_addr_info addr;
  365. + uint8_t val[16];
  366. +} __packed;
  367. +
  368. +#define MGMT_OP_SET_PRIVACY 0x002F
  369. +struct mgmt_cp_set_privacy {
  370. + uint8_t privacy;
  371. + uint8_t irk[16];
  372. +} __packed;
  373. +
  374. +#define MGMT_OP_LOAD_IRKS 0x0030
  375. +struct mgmt_cp_load_irks {
  376. + uint16_t irk_count;
  377. + struct mgmt_irk_info irks[0];
  378. +} __packed;
  379. +
  380. +#define MGMT_OP_GET_CONN_INFO 0x0031
  381. +struct mgmt_cp_get_conn_info {
  382. + struct mgmt_addr_info addr;
  383. +} __packed;
  384. +struct mgmt_rp_get_conn_info {
  385. + struct mgmt_addr_info addr;
  386. + int8_t rssi;
  387. + int8_t tx_power;
  388. + int8_t max_tx_power;
  389. +} __packed;
  390. +
  391. +#define MGMT_OP_GET_CLOCK_INFO 0x0032
  392. +struct mgmt_cp_get_clock_info {
  393. + struct mgmt_addr_info addr;
  394. +} __packed;
  395. +struct mgmt_rp_get_clock_info {
  396. + struct mgmt_addr_info addr;
  397. + uint32_t local_clock;
  398. + uint32_t piconet_clock;
  399. + uint16_t accuracy;
  400. +} __packed;
  401. +
  402. +#define MGMT_OP_ADD_DEVICE 0x0033
  403. +struct mgmt_cp_add_device {
  404. + struct mgmt_addr_info addr;
  405. + uint8_t action;
  406. +} __packed;
  407. +struct mgmt_rp_add_device {
  408. + struct mgmt_addr_info addr;
  409. +} __packed;
  410. +
  411. +#define MGMT_OP_REMOVE_DEVICE 0x0034
  412. +struct mgmt_cp_remove_device {
  413. + struct mgmt_addr_info addr;
  414. +} __packed;
  415. +struct mgmt_rp_remove_device {
  416. + struct mgmt_addr_info addr;
  417. +} __packed;
  418. +
  419. +struct mgmt_conn_param {
  420. + struct mgmt_addr_info addr;
  421. + uint16_t min_interval;
  422. + uint16_t max_interval;
  423. + uint16_t latency;
  424. + uint16_t timeout;
  425. +} __packed;
  426. +
  427. +#define MGMT_OP_LOAD_CONN_PARAM 0x0035
  428. +struct mgmt_cp_load_conn_param {
  429. + uint16_t param_count;
  430. + struct mgmt_conn_param params[0];
  431. +} __packed;
  432. +
  433. +#define MGMT_OP_READ_UNCONF_INDEX_LIST 0x0036
  434. +struct mgmt_rp_read_unconf_index_list {
  435. + uint16_t num_controllers;
  436. + uint16_t index[0];
  437. +} __packed;
  438. +
  439. +#define MGMT_OPTION_EXTERNAL_CONFIG 0x00000001
  440. +#define MGMT_OPTION_PUBLIC_ADDRESS 0x00000002
  441. +
  442. +#define MGMT_OP_READ_CONFIG_INFO 0x0037
  443. +struct mgmt_rp_read_config_info {
  444. + uint16_t manufacturer;
  445. + uint32_t supported_options;
  446. + uint32_t missing_options;
  447. +} __packed;
  448. +
  449. +#define MGMT_OP_SET_EXTERNAL_CONFIG 0x0038
  450. +struct mgmt_cp_set_external_config {
  451. + uint8_t config;
  452. +} __packed;
  453. +
  454. +#define MGMT_OP_SET_PUBLIC_ADDRESS 0x0039
  455. +struct mgmt_cp_set_public_address {
  456. + bdaddr_t bdaddr;
  457. +} __packed;
  458. +
  459. +#define MGMT_EV_CMD_COMPLETE 0x0001
  460. +struct mgmt_ev_cmd_complete {
  461. + uint16_t opcode;
  462. + uint8_t status;
  463. + uint8_t data[0];
  464. +} __packed;
  465. +
  466. +#define MGMT_EV_CMD_STATUS 0x0002
  467. +struct mgmt_ev_cmd_status {
  468. + uint16_t opcode;
  469. + uint8_t status;
  470. +} __packed;
  471. +
  472. +#define MGMT_EV_CONTROLLER_ERROR 0x0003
  473. +struct mgmt_ev_controller_error {
  474. + uint8_t error_code;
  475. +} __packed;
  476. +
  477. +#define MGMT_EV_INDEX_ADDED 0x0004
  478. +
  479. +#define MGMT_EV_INDEX_REMOVED 0x0005
  480. +
  481. +#define MGMT_EV_NEW_SETTINGS 0x0006
  482. +
  483. +#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007
  484. +struct mgmt_ev_class_of_dev_changed {
  485. + uint8_t class_of_dev[3];
  486. +} __packed;
  487. +
  488. +#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008
  489. +struct mgmt_ev_local_name_changed {
  490. + uint8_t name[MGMT_MAX_NAME_LENGTH];
  491. + uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
  492. +} __packed;
  493. +
  494. +#define MGMT_EV_NEW_LINK_KEY 0x0009
  495. +struct mgmt_ev_new_link_key {
  496. + uint8_t store_hint;
  497. + struct mgmt_link_key_info key;
  498. +} __packed;
  499. +
  500. +#define MGMT_EV_NEW_LONG_TERM_KEY 0x000A
  501. +struct mgmt_ev_new_long_term_key {
  502. + uint8_t store_hint;
  503. + struct mgmt_ltk_info key;
  504. +} __packed;
  505. +
  506. +#define MGMT_EV_DEVICE_CONNECTED 0x000B
  507. +struct mgmt_ev_device_connected {
  508. + struct mgmt_addr_info addr;
  509. + uint32_t flags;
  510. + uint16_t eir_len;
  511. + uint8_t eir[0];
  512. +} __packed;
  513. +
  514. +#define MGMT_DEV_DISCONN_UNKNOWN 0x00
  515. +#define MGMT_DEV_DISCONN_TIMEOUT 0x01
  516. +#define MGMT_DEV_DISCONN_LOCAL_HOST 0x02
  517. +#define MGMT_DEV_DISCONN_REMOTE 0x03
  518. +
  519. +#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
  520. +struct mgmt_ev_device_disconnected {
  521. + struct mgmt_addr_info addr;
  522. + uint8_t reason;
  523. +} __packed;
  524. +
  525. +#define MGMT_EV_CONNECT_FAILED 0x000D
  526. +struct mgmt_ev_connect_failed {
  527. + struct mgmt_addr_info addr;
  528. + uint8_t status;
  529. +} __packed;
  530. +
  531. +#define MGMT_EV_PIN_CODE_REQUEST 0x000E
  532. +struct mgmt_ev_pin_code_request {
  533. + struct mgmt_addr_info addr;
  534. + uint8_t secure;
  535. +} __packed;
  536. +
  537. +#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
  538. +struct mgmt_ev_user_confirm_request {
  539. + struct mgmt_addr_info addr;
  540. + uint8_t confirm_hint;
  541. + uint32_t value;
  542. +} __packed;
  543. +
  544. +#define MGMT_EV_USER_PASSKEY_REQUEST 0x0010
  545. +struct mgmt_ev_user_passkey_request {
  546. + struct mgmt_addr_info addr;
  547. +} __packed;
  548. +
  549. +#define MGMT_EV_AUTH_FAILED 0x0011
  550. +struct mgmt_ev_auth_failed {
  551. + struct mgmt_addr_info addr;
  552. + uint8_t status;
  553. +} __packed;
  554. +
  555. +#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
  556. +#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
  557. +#define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04
  558. +
  559. +#define MGMT_EV_DEVICE_FOUND 0x0012
  560. +struct mgmt_ev_device_found {
  561. + struct mgmt_addr_info addr;
  562. + int8_t rssi;
  563. + uint32_t flags;
  564. + uint16_t eir_len;
  565. + uint8_t eir[0];
  566. +} __packed;
  567. +
  568. +#define MGMT_EV_DISCOVERING 0x0013
  569. +struct mgmt_ev_discovering {
  570. + uint8_t type;
  571. + uint8_t discovering;
  572. +} __packed;
  573. +
  574. +#define MGMT_EV_DEVICE_BLOCKED 0x0014
  575. +struct mgmt_ev_device_blocked {
  576. + struct mgmt_addr_info addr;
  577. +} __packed;
  578. +
  579. +#define MGMT_EV_DEVICE_UNBLOCKED 0x0015
  580. +struct mgmt_ev_device_unblocked {
  581. + struct mgmt_addr_info addr;
  582. +} __packed;
  583. +
  584. +#define MGMT_EV_DEVICE_UNPAIRED 0x0016
  585. +struct mgmt_ev_device_unpaired {
  586. + struct mgmt_addr_info addr;
  587. +} __packed;
  588. +
  589. +#define MGMT_EV_PASSKEY_NOTIFY 0x0017
  590. +struct mgmt_ev_passkey_notify {
  591. + struct mgmt_addr_info addr;
  592. + uint32_t passkey;
  593. + uint8_t entered;
  594. +} __packed;
  595. +
  596. +#define MGMT_EV_NEW_IRK 0x0018
  597. +struct mgmt_ev_new_irk {
  598. + uint8_t store_hint;
  599. + bdaddr_t rpa;
  600. + struct mgmt_irk_info key;
  601. +} __packed;
  602. +
  603. +struct mgmt_csrk_info {
  604. + struct mgmt_addr_info addr;
  605. + uint8_t master;
  606. + uint8_t val[16];
  607. +} __packed;
  608. +
  609. +#define MGMT_EV_NEW_CSRK 0x0019
  610. +struct mgmt_ev_new_csrk {
  611. + uint8_t store_hint;
  612. + struct mgmt_csrk_info key;
  613. +} __packed;
  614. +
  615. +#define MGMT_EV_DEVICE_ADDED 0x001a
  616. +struct mgmt_ev_device_added {
  617. + struct mgmt_addr_info addr;
  618. + uint8_t action;
  619. +} __packed;
  620. +
  621. +#define MGMT_EV_DEVICE_REMOVED 0x001b
  622. +struct mgmt_ev_device_removed {
  623. + struct mgmt_addr_info addr;
  624. +} __packed;
  625. +
  626. +#define MGMT_EV_NEW_CONN_PARAM 0x001c
  627. +struct mgmt_ev_new_conn_param {
  628. + struct mgmt_addr_info addr;
  629. + uint8_t store_hint;
  630. + uint16_t min_interval;
  631. + uint16_t max_interval;
  632. + uint16_t latency;
  633. + uint16_t timeout;
  634. +} __packed;
  635. +
  636. +#define MGMT_EV_UNCONF_INDEX_ADDED 0x001d
  637. +
  638. +#define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e
  639. +
  640. +#define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f
  641. +
  642. +static const char *mgmt_op[] = {
  643. + "<0x0000>",
  644. + "Read Version",
  645. + "Read Commands",
  646. + "Read Index List",
  647. + "Read Controller Info",
  648. + "Set Powered",
  649. + "Set Discoverable",
  650. + "Set Connectable",
  651. + "Set Fast Connectable", /* 0x0008 */
  652. + "Set Bondable",
  653. + "Set Link Security",
  654. + "Set Secure Simple Pairing",
  655. + "Set High Speed",
  656. + "Set Low Energy",
  657. + "Set Dev Class",
  658. + "Set Local Name",
  659. + "Add UUID", /* 0x0010 */
  660. + "Remove UUID",
  661. + "Load Link Keys",
  662. + "Load Long Term Keys",
  663. + "Disconnect",
  664. + "Get Connections",
  665. + "PIN Code Reply",
  666. + "PIN Code Neg Reply",
  667. + "Set IO Capability", /* 0x0018 */
  668. + "Pair Device",
  669. + "Cancel Pair Device",
  670. + "Unpair Device",
  671. + "User Confirm Reply",
  672. + "User Confirm Neg Reply",
  673. + "User Passkey Reply",
  674. + "User Passkey Neg Reply",
  675. + "Read Local OOB Data", /* 0x0020 */
  676. + "Add Remote OOB Data",
  677. + "Remove Remove OOB Data",
  678. + "Start Discovery",
  679. + "Stop Discovery",
  680. + "Confirm Name",
  681. + "Block Device",
  682. + "Unblock Device",
  683. + "Set Device ID",
  684. + "Set Advertising",
  685. + "Set BR/EDR",
  686. + "Set Static Address",
  687. + "Set Scan Parameters",
  688. + "Set Secure Connections",
  689. + "Set Debug Keys",
  690. + "Set Privacy",
  691. + "Load Identity Resolving Keys",
  692. + "Get Connection Information",
  693. + "Get Clock Information",
  694. + "Add Device",
  695. + "Remove Device",
  696. + "Load Connection Parameters",
  697. + "Read Unconfigured Index List",
  698. + "Read Controller Configuration Information",
  699. + "Set External Configuration",
  700. + "Set Public Address",
  701. +};
  702. +
  703. +static const char *mgmt_ev[] = {
  704. + "<0x0000>",
  705. + "Command Complete",
  706. + "Command Status",
  707. + "Controller Error",
  708. + "Index Added",
  709. + "Index Removed",
  710. + "New Settings",
  711. + "Class of Device Changed",
  712. + "Local Name Changed", /* 0x0008 */
  713. + "New Link Key",
  714. + "New Long Term Key",
  715. + "Device Connected",
  716. + "Device Disconnected",
  717. + "Connect Failed",
  718. + "PIN Code Request",
  719. + "User Confirm Request",
  720. + "User Passkey Request", /* 0x0010 */
  721. + "Authentication Failed",
  722. + "Device Found",
  723. + "Discovering",
  724. + "Device Blocked",
  725. + "Device Unblocked",
  726. + "Device Unpaired",
  727. + "Passkey Notify",
  728. + "New Identity Resolving Key",
  729. + "New Signature Resolving Key",
  730. + "Device Added",
  731. + "Device Removed",
  732. + "New Connection Parameter",
  733. + "Unconfigured Index Added",
  734. + "Unconfigured Index Removed",
  735. + "New Configuration Options",
  736. +};
  737. +
  738. +static const char *mgmt_status[] = {
  739. + "Success",
  740. + "Unknown Command",
  741. + "Not Connected",
  742. + "Failed",
  743. + "Connect Failed",
  744. + "Authentication Failed",
  745. + "Not Paired",
  746. + "No Resources",
  747. + "Timeout",
  748. + "Already Connected",
  749. + "Busy",
  750. + "Rejected",
  751. + "Not Supported",
  752. + "Invalid Parameters",
  753. + "Disconnected",
  754. + "Not Powered",
  755. + "Cancelled",
  756. + "Invalid Index",
  757. + "Blocked through rfkill",
  758. +};
  759. +
  760. +#ifndef NELEM
  761. +#define NELEM(x) (sizeof(x) / sizeof((x)[0]))
  762. +#endif
  763. +
  764. +static inline const char *mgmt_opstr(uint16_t op)
  765. +{
  766. + if (op >= NELEM(mgmt_op))
  767. + return "<unknown opcode>";
  768. + return mgmt_op[op];
  769. +}
  770. +
  771. +static inline const char *mgmt_evstr(uint16_t ev)
  772. +{
  773. + if (ev >= NELEM(mgmt_ev))
  774. + return "<unknown event>";
  775. + return mgmt_ev[ev];
  776. +}
  777. +
  778. +static inline const char *mgmt_errstr(uint8_t status)
  779. +{
  780. + if (status >= NELEM(mgmt_status))
  781. + return "<unknown status>";
  782. + return mgmt_status[status];
  783. +}