wok-next view libpcap/stuff/patches/libpcap-1.9.0-enable_bluetooth-1.patch @ rev 21196

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