wok-next diff libpcap/stuff/patches/libpcap-1.9.0-enable_bluetooth-1.patch @ rev 21084
Add librefox
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Dec 25 14:44:32 2018 +0200 (2018-12-25) |
parents | 5ff41aaf68d9 |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libpcap/stuff/patches/libpcap-1.9.0-enable_bluetooth-1.patch Tue Dec 25 14:44:32 2018 +0200 1.3 @@ -0,0 +1,785 @@ 1.4 +Submitted By: Fernando de Oliveira <famobr at yahoo dot com dot br> 1.5 +Date: 2014-09-07 1.6 +Initial Package Version: 1.6.2 (problem started with 1.6.1) 1.7 +Upstream Status: Unknown 1.8 +Origin: ArchLinux 1.9 +URL: https://projects.archlinux.org/svntogit/packages.git/plain/trunk/mgmt.h?h=packages/libpcap 1.10 +Description: Fix build with bluez-5.21 1.11 + 1.12 + 1.13 +diff -Naur libpcap-1.6.2.orig/bluetooth/mgmt.h libpcap-1.6.2/bluetooth/mgmt.h 1.14 +--- libpcap-1.6.2.orig/bluetooth/mgmt.h 1969-12-31 21:00:00.000000000 -0300 1.15 ++++ libpcap-1.6.2/bluetooth/mgmt.h 2014-09-07 14:11:36.456414731 -0300 1.16 +@@ -0,0 +1,772 @@ 1.17 ++/* 1.18 ++ * BlueZ - Bluetooth protocol stack for Linux 1.19 ++ * 1.20 ++ * Copyright (C) 2010 Nokia Corporation 1.21 ++ * Copyright (C) 2010 Marcel Holtmann <marcel@holtmann.org> 1.22 ++ * 1.23 ++ * 1.24 ++ * This program is free software; you can redistribute it and/or modify 1.25 ++ * it under the terms of the GNU General Public License as published by 1.26 ++ * the Free Software Foundation; either version 2 of the License, or 1.27 ++ * (at your option) any later version. 1.28 ++ * 1.29 ++ * This program is distributed in the hope that it will be useful, 1.30 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.31 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.32 ++ * GNU General Public License for more details. 1.33 ++ * 1.34 ++ * You should have received a copy of the GNU General Public License 1.35 ++ * along with this program; if not, write to the Free Software 1.36 ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 1.37 ++ * 1.38 ++ */ 1.39 ++ 1.40 ++#ifndef __packed 1.41 ++#define __packed __attribute__((packed)) 1.42 ++#endif 1.43 ++ 1.44 ++#define MGMT_INDEX_NONE 0xFFFF 1.45 ++ 1.46 ++#define MGMT_STATUS_SUCCESS 0x00 1.47 ++#define MGMT_STATUS_UNKNOWN_COMMAND 0x01 1.48 ++#define MGMT_STATUS_NOT_CONNECTED 0x02 1.49 ++#define MGMT_STATUS_FAILED 0x03 1.50 ++#define MGMT_STATUS_CONNECT_FAILED 0x04 1.51 ++#define MGMT_STATUS_AUTH_FAILED 0x05 1.52 ++#define MGMT_STATUS_NOT_PAIRED 0x06 1.53 ++#define MGMT_STATUS_NO_RESOURCES 0x07 1.54 ++#define MGMT_STATUS_TIMEOUT 0x08 1.55 ++#define MGMT_STATUS_ALREADY_CONNECTED 0x09 1.56 ++#define MGMT_STATUS_BUSY 0x0a 1.57 ++#define MGMT_STATUS_REJECTED 0x0b 1.58 ++#define MGMT_STATUS_NOT_SUPPORTED 0x0c 1.59 ++#define MGMT_STATUS_INVALID_PARAMS 0x0d 1.60 ++#define MGMT_STATUS_DISCONNECTED 0x0e 1.61 ++#define MGMT_STATUS_NOT_POWERED 0x0f 1.62 ++#define MGMT_STATUS_CANCELLED 0x10 1.63 ++#define MGMT_STATUS_INVALID_INDEX 0x11 1.64 ++#define MGMT_STATUS_RFKILLED 0x12 1.65 ++ 1.66 ++struct mgmt_hdr { 1.67 ++ uint16_t opcode; 1.68 ++ uint16_t index; 1.69 ++ uint16_t len; 1.70 ++} __packed; 1.71 ++#define MGMT_HDR_SIZE 6 1.72 ++ 1.73 ++struct mgmt_addr_info { 1.74 ++ bdaddr_t bdaddr; 1.75 ++ uint8_t type; 1.76 ++} __packed; 1.77 ++ 1.78 ++#define MGMT_OP_READ_VERSION 0x0001 1.79 ++struct mgmt_rp_read_version { 1.80 ++ uint8_t version; 1.81 ++ uint16_t revision; 1.82 ++} __packed; 1.83 ++ 1.84 ++#define MGMT_OP_READ_COMMANDS 0x0002 1.85 ++struct mgmt_rp_read_commands { 1.86 ++ uint16_t num_commands; 1.87 ++ uint16_t num_events; 1.88 ++ uint16_t opcodes[0]; 1.89 ++} __packed; 1.90 ++ 1.91 ++#define MGMT_OP_READ_INDEX_LIST 0x0003 1.92 ++struct mgmt_rp_read_index_list { 1.93 ++ uint16_t num_controllers; 1.94 ++ uint16_t index[0]; 1.95 ++} __packed; 1.96 ++ 1.97 ++/* Reserve one extra byte for names in management messages so that they 1.98 ++ * are always guaranteed to be nul-terminated */ 1.99 ++#define MGMT_MAX_NAME_LENGTH (248 + 1) 1.100 ++#define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) 1.101 ++ 1.102 ++#define MGMT_SETTING_POWERED 0x00000001 1.103 ++#define MGMT_SETTING_CONNECTABLE 0x00000002 1.104 ++#define MGMT_SETTING_FAST_CONNECTABLE 0x00000004 1.105 ++#define MGMT_SETTING_DISCOVERABLE 0x00000008 1.106 ++#define MGMT_SETTING_BONDABLE 0x00000010 1.107 ++#define MGMT_SETTING_LINK_SECURITY 0x00000020 1.108 ++#define MGMT_SETTING_SSP 0x00000040 1.109 ++#define MGMT_SETTING_BREDR 0x00000080 1.110 ++#define MGMT_SETTING_HS 0x00000100 1.111 ++#define MGMT_SETTING_LE 0x00000200 1.112 ++#define MGMT_SETTING_ADVERTISING 0x00000400 1.113 ++#define MGMT_SETTING_SECURE_CONN 0x00000800 1.114 ++#define MGMT_SETTING_DEBUG_KEYS 0x00001000 1.115 ++#define MGMT_SETTING_PRIVACY 0x00002000 1.116 ++#define MGMT_SETTING_CONFIGURATION 0x00004000 1.117 ++ 1.118 ++#define MGMT_OP_READ_INFO 0x0004 1.119 ++struct mgmt_rp_read_info { 1.120 ++ bdaddr_t bdaddr; 1.121 ++ uint8_t version; 1.122 ++ uint16_t manufacturer; 1.123 ++ uint32_t supported_settings; 1.124 ++ uint32_t current_settings; 1.125 ++ uint8_t dev_class[3]; 1.126 ++ uint8_t name[MGMT_MAX_NAME_LENGTH]; 1.127 ++ uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 1.128 ++} __packed; 1.129 ++ 1.130 ++struct mgmt_mode { 1.131 ++ uint8_t val; 1.132 ++} __packed; 1.133 ++ 1.134 ++struct mgmt_cod { 1.135 ++ uint8_t val[3]; 1.136 ++} __packed; 1.137 ++ 1.138 ++#define MGMT_OP_SET_POWERED 0x0005 1.139 ++ 1.140 ++#define MGMT_OP_SET_DISCOVERABLE 0x0006 1.141 ++struct mgmt_cp_set_discoverable { 1.142 ++ uint8_t val; 1.143 ++ uint16_t timeout; 1.144 ++} __packed; 1.145 ++ 1.146 ++#define MGMT_OP_SET_CONNECTABLE 0x0007 1.147 ++ 1.148 ++#define MGMT_OP_SET_FAST_CONNECTABLE 0x0008 1.149 ++ 1.150 ++#define MGMT_OP_SET_BONDABLE 0x0009 1.151 ++ 1.152 ++#define MGMT_OP_SET_LINK_SECURITY 0x000A 1.153 ++ 1.154 ++#define MGMT_OP_SET_SSP 0x000B 1.155 ++ 1.156 ++#define MGMT_OP_SET_HS 0x000C 1.157 ++ 1.158 ++#define MGMT_OP_SET_LE 0x000D 1.159 ++ 1.160 ++#define MGMT_OP_SET_DEV_CLASS 0x000E 1.161 ++struct mgmt_cp_set_dev_class { 1.162 ++ uint8_t major; 1.163 ++ uint8_t minor; 1.164 ++} __packed; 1.165 ++ 1.166 ++#define MGMT_OP_SET_LOCAL_NAME 0x000F 1.167 ++struct mgmt_cp_set_local_name { 1.168 ++ uint8_t name[MGMT_MAX_NAME_LENGTH]; 1.169 ++ uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 1.170 ++} __packed; 1.171 ++ 1.172 ++#define MGMT_OP_ADD_UUID 0x0010 1.173 ++struct mgmt_cp_add_uuid { 1.174 ++ uint8_t uuid[16]; 1.175 ++ uint8_t svc_hint; 1.176 ++} __packed; 1.177 ++ 1.178 ++#define MGMT_OP_REMOVE_UUID 0x0011 1.179 ++struct mgmt_cp_remove_uuid { 1.180 ++ uint8_t uuid[16]; 1.181 ++} __packed; 1.182 ++ 1.183 ++struct mgmt_link_key_info { 1.184 ++ struct mgmt_addr_info addr; 1.185 ++ uint8_t type; 1.186 ++ uint8_t val[16]; 1.187 ++ uint8_t pin_len; 1.188 ++} __packed; 1.189 ++ 1.190 ++#define MGMT_OP_LOAD_LINK_KEYS 0x0012 1.191 ++struct mgmt_cp_load_link_keys { 1.192 ++ uint8_t debug_keys; 1.193 ++ uint16_t key_count; 1.194 ++ struct mgmt_link_key_info keys[0]; 1.195 ++} __packed; 1.196 ++ 1.197 ++struct mgmt_ltk_info { 1.198 ++ struct mgmt_addr_info addr; 1.199 ++ uint8_t type; 1.200 ++ uint8_t master; 1.201 ++ uint8_t enc_size; 1.202 ++ uint16_t ediv; 1.203 ++ uint64_t rand; 1.204 ++ uint8_t val[16]; 1.205 ++} __packed; 1.206 ++ 1.207 ++#define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013 1.208 ++struct mgmt_cp_load_long_term_keys { 1.209 ++ uint16_t key_count; 1.210 ++ struct mgmt_ltk_info keys[0]; 1.211 ++} __packed; 1.212 ++ 1.213 ++#define MGMT_OP_DISCONNECT 0x0014 1.214 ++struct mgmt_cp_disconnect { 1.215 ++ struct mgmt_addr_info addr; 1.216 ++} __packed; 1.217 ++struct mgmt_rp_disconnect { 1.218 ++ struct mgmt_addr_info addr; 1.219 ++} __packed; 1.220 ++ 1.221 ++#define MGMT_OP_GET_CONNECTIONS 0x0015 1.222 ++struct mgmt_rp_get_connections { 1.223 ++ uint16_t conn_count; 1.224 ++ struct mgmt_addr_info addr[0]; 1.225 ++} __packed; 1.226 ++ 1.227 ++#define MGMT_OP_PIN_CODE_REPLY 0x0016 1.228 ++struct mgmt_cp_pin_code_reply { 1.229 ++ struct mgmt_addr_info addr; 1.230 ++ uint8_t pin_len; 1.231 ++ uint8_t pin_code[16]; 1.232 ++} __packed; 1.233 ++ 1.234 ++#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 1.235 ++struct mgmt_cp_pin_code_neg_reply { 1.236 ++ struct mgmt_addr_info addr; 1.237 ++} __packed; 1.238 ++ 1.239 ++#define MGMT_OP_SET_IO_CAPABILITY 0x0018 1.240 ++struct mgmt_cp_set_io_capability { 1.241 ++ uint8_t io_capability; 1.242 ++} __packed; 1.243 ++ 1.244 ++#define MGMT_OP_PAIR_DEVICE 0x0019 1.245 ++struct mgmt_cp_pair_device { 1.246 ++ struct mgmt_addr_info addr; 1.247 ++ uint8_t io_cap; 1.248 ++} __packed; 1.249 ++struct mgmt_rp_pair_device { 1.250 ++ struct mgmt_addr_info addr; 1.251 ++} __packed; 1.252 ++ 1.253 ++#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A 1.254 ++ 1.255 ++#define MGMT_OP_UNPAIR_DEVICE 0x001B 1.256 ++struct mgmt_cp_unpair_device { 1.257 ++ struct mgmt_addr_info addr; 1.258 ++ uint8_t disconnect; 1.259 ++} __packed; 1.260 ++struct mgmt_rp_unpair_device { 1.261 ++ struct mgmt_addr_info addr; 1.262 ++} __packed; 1.263 ++ 1.264 ++#define MGMT_OP_USER_CONFIRM_REPLY 0x001C 1.265 ++struct mgmt_cp_user_confirm_reply { 1.266 ++ struct mgmt_addr_info addr; 1.267 ++} __packed; 1.268 ++struct mgmt_rp_user_confirm_reply { 1.269 ++ struct mgmt_addr_info addr; 1.270 ++} __packed; 1.271 ++ 1.272 ++#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D 1.273 ++ 1.274 ++#define MGMT_OP_USER_PASSKEY_REPLY 0x001E 1.275 ++struct mgmt_cp_user_passkey_reply { 1.276 ++ struct mgmt_addr_info addr; 1.277 ++ uint32_t passkey; 1.278 ++} __packed; 1.279 ++struct mgmt_rp_user_passkey_reply { 1.280 ++ struct mgmt_addr_info addr; 1.281 ++} __packed; 1.282 ++ 1.283 ++#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F 1.284 ++struct mgmt_cp_user_passkey_neg_reply { 1.285 ++ struct mgmt_addr_info addr; 1.286 ++} __packed; 1.287 ++ 1.288 ++#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020 1.289 ++struct mgmt_rp_read_local_oob_data { 1.290 ++ uint8_t hash[16]; 1.291 ++ uint8_t randomizer[16]; 1.292 ++} __packed; 1.293 ++struct mgmt_rp_read_local_oob_ext_data { 1.294 ++ uint8_t hash192[16]; 1.295 ++ uint8_t randomizer192[16]; 1.296 ++ uint8_t hash256[16]; 1.297 ++ uint8_t randomizer256[16]; 1.298 ++} __packed; 1.299 ++ 1.300 ++#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 1.301 ++struct mgmt_cp_add_remote_oob_data { 1.302 ++ struct mgmt_addr_info addr; 1.303 ++ uint8_t hash[16]; 1.304 ++ uint8_t randomizer[16]; 1.305 ++} __packed; 1.306 ++ 1.307 ++#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 1.308 ++struct mgmt_cp_remove_remote_oob_data { 1.309 ++ struct mgmt_addr_info addr; 1.310 ++} __packed; 1.311 ++ 1.312 ++#define MGMT_OP_START_DISCOVERY 0x0023 1.313 ++struct mgmt_cp_start_discovery { 1.314 ++ uint8_t type; 1.315 ++} __packed; 1.316 ++ 1.317 ++#define MGMT_OP_STOP_DISCOVERY 0x0024 1.318 ++struct mgmt_cp_stop_discovery { 1.319 ++ uint8_t type; 1.320 ++} __packed; 1.321 ++ 1.322 ++#define MGMT_OP_CONFIRM_NAME 0x0025 1.323 ++struct mgmt_cp_confirm_name { 1.324 ++ struct mgmt_addr_info addr; 1.325 ++ uint8_t name_known; 1.326 ++} __packed; 1.327 ++struct mgmt_rp_confirm_name { 1.328 ++ struct mgmt_addr_info addr; 1.329 ++} __packed; 1.330 ++ 1.331 ++#define MGMT_OP_BLOCK_DEVICE 0x0026 1.332 ++struct mgmt_cp_block_device { 1.333 ++ struct mgmt_addr_info addr; 1.334 ++} __packed; 1.335 ++ 1.336 ++#define MGMT_OP_UNBLOCK_DEVICE 0x0027 1.337 ++struct mgmt_cp_unblock_device { 1.338 ++ struct mgmt_addr_info addr; 1.339 ++} __packed; 1.340 ++ 1.341 ++#define MGMT_OP_SET_DEVICE_ID 0x0028 1.342 ++struct mgmt_cp_set_device_id { 1.343 ++ uint16_t source; 1.344 ++ uint16_t vendor; 1.345 ++ uint16_t product; 1.346 ++ uint16_t version; 1.347 ++} __packed; 1.348 ++ 1.349 ++#define MGMT_OP_SET_ADVERTISING 0x0029 1.350 ++ 1.351 ++#define MGMT_OP_SET_BREDR 0x002A 1.352 ++ 1.353 ++#define MGMT_OP_SET_STATIC_ADDRESS 0x002B 1.354 ++struct mgmt_cp_set_static_address { 1.355 ++ bdaddr_t bdaddr; 1.356 ++} __packed; 1.357 ++ 1.358 ++#define MGMT_OP_SET_SCAN_PARAMS 0x002C 1.359 ++struct mgmt_cp_set_scan_params { 1.360 ++ uint16_t interval; 1.361 ++ uint16_t window; 1.362 ++} __packed; 1.363 ++ 1.364 ++#define MGMT_OP_SET_SECURE_CONN 0x002D 1.365 ++ 1.366 ++#define MGMT_OP_SET_DEBUG_KEYS 0x002E 1.367 ++ 1.368 ++struct mgmt_irk_info { 1.369 ++ struct mgmt_addr_info addr; 1.370 ++ uint8_t val[16]; 1.371 ++} __packed; 1.372 ++ 1.373 ++#define MGMT_OP_SET_PRIVACY 0x002F 1.374 ++struct mgmt_cp_set_privacy { 1.375 ++ uint8_t privacy; 1.376 ++ uint8_t irk[16]; 1.377 ++} __packed; 1.378 ++ 1.379 ++#define MGMT_OP_LOAD_IRKS 0x0030 1.380 ++struct mgmt_cp_load_irks { 1.381 ++ uint16_t irk_count; 1.382 ++ struct mgmt_irk_info irks[0]; 1.383 ++} __packed; 1.384 ++ 1.385 ++#define MGMT_OP_GET_CONN_INFO 0x0031 1.386 ++struct mgmt_cp_get_conn_info { 1.387 ++ struct mgmt_addr_info addr; 1.388 ++} __packed; 1.389 ++struct mgmt_rp_get_conn_info { 1.390 ++ struct mgmt_addr_info addr; 1.391 ++ int8_t rssi; 1.392 ++ int8_t tx_power; 1.393 ++ int8_t max_tx_power; 1.394 ++} __packed; 1.395 ++ 1.396 ++#define MGMT_OP_GET_CLOCK_INFO 0x0032 1.397 ++struct mgmt_cp_get_clock_info { 1.398 ++ struct mgmt_addr_info addr; 1.399 ++} __packed; 1.400 ++struct mgmt_rp_get_clock_info { 1.401 ++ struct mgmt_addr_info addr; 1.402 ++ uint32_t local_clock; 1.403 ++ uint32_t piconet_clock; 1.404 ++ uint16_t accuracy; 1.405 ++} __packed; 1.406 ++ 1.407 ++#define MGMT_OP_ADD_DEVICE 0x0033 1.408 ++struct mgmt_cp_add_device { 1.409 ++ struct mgmt_addr_info addr; 1.410 ++ uint8_t action; 1.411 ++} __packed; 1.412 ++struct mgmt_rp_add_device { 1.413 ++ struct mgmt_addr_info addr; 1.414 ++} __packed; 1.415 ++ 1.416 ++#define MGMT_OP_REMOVE_DEVICE 0x0034 1.417 ++struct mgmt_cp_remove_device { 1.418 ++ struct mgmt_addr_info addr; 1.419 ++} __packed; 1.420 ++struct mgmt_rp_remove_device { 1.421 ++ struct mgmt_addr_info addr; 1.422 ++} __packed; 1.423 ++ 1.424 ++struct mgmt_conn_param { 1.425 ++ struct mgmt_addr_info addr; 1.426 ++ uint16_t min_interval; 1.427 ++ uint16_t max_interval; 1.428 ++ uint16_t latency; 1.429 ++ uint16_t timeout; 1.430 ++} __packed; 1.431 ++ 1.432 ++#define MGMT_OP_LOAD_CONN_PARAM 0x0035 1.433 ++struct mgmt_cp_load_conn_param { 1.434 ++ uint16_t param_count; 1.435 ++ struct mgmt_conn_param params[0]; 1.436 ++} __packed; 1.437 ++ 1.438 ++#define MGMT_OP_READ_UNCONF_INDEX_LIST 0x0036 1.439 ++struct mgmt_rp_read_unconf_index_list { 1.440 ++ uint16_t num_controllers; 1.441 ++ uint16_t index[0]; 1.442 ++} __packed; 1.443 ++ 1.444 ++#define MGMT_OPTION_EXTERNAL_CONFIG 0x00000001 1.445 ++#define MGMT_OPTION_PUBLIC_ADDRESS 0x00000002 1.446 ++ 1.447 ++#define MGMT_OP_READ_CONFIG_INFO 0x0037 1.448 ++struct mgmt_rp_read_config_info { 1.449 ++ uint16_t manufacturer; 1.450 ++ uint32_t supported_options; 1.451 ++ uint32_t missing_options; 1.452 ++} __packed; 1.453 ++ 1.454 ++#define MGMT_OP_SET_EXTERNAL_CONFIG 0x0038 1.455 ++struct mgmt_cp_set_external_config { 1.456 ++ uint8_t config; 1.457 ++} __packed; 1.458 ++ 1.459 ++#define MGMT_OP_SET_PUBLIC_ADDRESS 0x0039 1.460 ++struct mgmt_cp_set_public_address { 1.461 ++ bdaddr_t bdaddr; 1.462 ++} __packed; 1.463 ++ 1.464 ++#define MGMT_EV_CMD_COMPLETE 0x0001 1.465 ++struct mgmt_ev_cmd_complete { 1.466 ++ uint16_t opcode; 1.467 ++ uint8_t status; 1.468 ++ uint8_t data[0]; 1.469 ++} __packed; 1.470 ++ 1.471 ++#define MGMT_EV_CMD_STATUS 0x0002 1.472 ++struct mgmt_ev_cmd_status { 1.473 ++ uint16_t opcode; 1.474 ++ uint8_t status; 1.475 ++} __packed; 1.476 ++ 1.477 ++#define MGMT_EV_CONTROLLER_ERROR 0x0003 1.478 ++struct mgmt_ev_controller_error { 1.479 ++ uint8_t error_code; 1.480 ++} __packed; 1.481 ++ 1.482 ++#define MGMT_EV_INDEX_ADDED 0x0004 1.483 ++ 1.484 ++#define MGMT_EV_INDEX_REMOVED 0x0005 1.485 ++ 1.486 ++#define MGMT_EV_NEW_SETTINGS 0x0006 1.487 ++ 1.488 ++#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 1.489 ++struct mgmt_ev_class_of_dev_changed { 1.490 ++ uint8_t class_of_dev[3]; 1.491 ++} __packed; 1.492 ++ 1.493 ++#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 1.494 ++struct mgmt_ev_local_name_changed { 1.495 ++ uint8_t name[MGMT_MAX_NAME_LENGTH]; 1.496 ++ uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 1.497 ++} __packed; 1.498 ++ 1.499 ++#define MGMT_EV_NEW_LINK_KEY 0x0009 1.500 ++struct mgmt_ev_new_link_key { 1.501 ++ uint8_t store_hint; 1.502 ++ struct mgmt_link_key_info key; 1.503 ++} __packed; 1.504 ++ 1.505 ++#define MGMT_EV_NEW_LONG_TERM_KEY 0x000A 1.506 ++struct mgmt_ev_new_long_term_key { 1.507 ++ uint8_t store_hint; 1.508 ++ struct mgmt_ltk_info key; 1.509 ++} __packed; 1.510 ++ 1.511 ++#define MGMT_EV_DEVICE_CONNECTED 0x000B 1.512 ++struct mgmt_ev_device_connected { 1.513 ++ struct mgmt_addr_info addr; 1.514 ++ uint32_t flags; 1.515 ++ uint16_t eir_len; 1.516 ++ uint8_t eir[0]; 1.517 ++} __packed; 1.518 ++ 1.519 ++#define MGMT_DEV_DISCONN_UNKNOWN 0x00 1.520 ++#define MGMT_DEV_DISCONN_TIMEOUT 0x01 1.521 ++#define MGMT_DEV_DISCONN_LOCAL_HOST 0x02 1.522 ++#define MGMT_DEV_DISCONN_REMOTE 0x03 1.523 ++ 1.524 ++#define MGMT_EV_DEVICE_DISCONNECTED 0x000C 1.525 ++struct mgmt_ev_device_disconnected { 1.526 ++ struct mgmt_addr_info addr; 1.527 ++ uint8_t reason; 1.528 ++} __packed; 1.529 ++ 1.530 ++#define MGMT_EV_CONNECT_FAILED 0x000D 1.531 ++struct mgmt_ev_connect_failed { 1.532 ++ struct mgmt_addr_info addr; 1.533 ++ uint8_t status; 1.534 ++} __packed; 1.535 ++ 1.536 ++#define MGMT_EV_PIN_CODE_REQUEST 0x000E 1.537 ++struct mgmt_ev_pin_code_request { 1.538 ++ struct mgmt_addr_info addr; 1.539 ++ uint8_t secure; 1.540 ++} __packed; 1.541 ++ 1.542 ++#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F 1.543 ++struct mgmt_ev_user_confirm_request { 1.544 ++ struct mgmt_addr_info addr; 1.545 ++ uint8_t confirm_hint; 1.546 ++ uint32_t value; 1.547 ++} __packed; 1.548 ++ 1.549 ++#define MGMT_EV_USER_PASSKEY_REQUEST 0x0010 1.550 ++struct mgmt_ev_user_passkey_request { 1.551 ++ struct mgmt_addr_info addr; 1.552 ++} __packed; 1.553 ++ 1.554 ++#define MGMT_EV_AUTH_FAILED 0x0011 1.555 ++struct mgmt_ev_auth_failed { 1.556 ++ struct mgmt_addr_info addr; 1.557 ++ uint8_t status; 1.558 ++} __packed; 1.559 ++ 1.560 ++#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 1.561 ++#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 1.562 ++#define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04 1.563 ++ 1.564 ++#define MGMT_EV_DEVICE_FOUND 0x0012 1.565 ++struct mgmt_ev_device_found { 1.566 ++ struct mgmt_addr_info addr; 1.567 ++ int8_t rssi; 1.568 ++ uint32_t flags; 1.569 ++ uint16_t eir_len; 1.570 ++ uint8_t eir[0]; 1.571 ++} __packed; 1.572 ++ 1.573 ++#define MGMT_EV_DISCOVERING 0x0013 1.574 ++struct mgmt_ev_discovering { 1.575 ++ uint8_t type; 1.576 ++ uint8_t discovering; 1.577 ++} __packed; 1.578 ++ 1.579 ++#define MGMT_EV_DEVICE_BLOCKED 0x0014 1.580 ++struct mgmt_ev_device_blocked { 1.581 ++ struct mgmt_addr_info addr; 1.582 ++} __packed; 1.583 ++ 1.584 ++#define MGMT_EV_DEVICE_UNBLOCKED 0x0015 1.585 ++struct mgmt_ev_device_unblocked { 1.586 ++ struct mgmt_addr_info addr; 1.587 ++} __packed; 1.588 ++ 1.589 ++#define MGMT_EV_DEVICE_UNPAIRED 0x0016 1.590 ++struct mgmt_ev_device_unpaired { 1.591 ++ struct mgmt_addr_info addr; 1.592 ++} __packed; 1.593 ++ 1.594 ++#define MGMT_EV_PASSKEY_NOTIFY 0x0017 1.595 ++struct mgmt_ev_passkey_notify { 1.596 ++ struct mgmt_addr_info addr; 1.597 ++ uint32_t passkey; 1.598 ++ uint8_t entered; 1.599 ++} __packed; 1.600 ++ 1.601 ++#define MGMT_EV_NEW_IRK 0x0018 1.602 ++struct mgmt_ev_new_irk { 1.603 ++ uint8_t store_hint; 1.604 ++ bdaddr_t rpa; 1.605 ++ struct mgmt_irk_info key; 1.606 ++} __packed; 1.607 ++ 1.608 ++struct mgmt_csrk_info { 1.609 ++ struct mgmt_addr_info addr; 1.610 ++ uint8_t master; 1.611 ++ uint8_t val[16]; 1.612 ++} __packed; 1.613 ++ 1.614 ++#define MGMT_EV_NEW_CSRK 0x0019 1.615 ++struct mgmt_ev_new_csrk { 1.616 ++ uint8_t store_hint; 1.617 ++ struct mgmt_csrk_info key; 1.618 ++} __packed; 1.619 ++ 1.620 ++#define MGMT_EV_DEVICE_ADDED 0x001a 1.621 ++struct mgmt_ev_device_added { 1.622 ++ struct mgmt_addr_info addr; 1.623 ++ uint8_t action; 1.624 ++} __packed; 1.625 ++ 1.626 ++#define MGMT_EV_DEVICE_REMOVED 0x001b 1.627 ++struct mgmt_ev_device_removed { 1.628 ++ struct mgmt_addr_info addr; 1.629 ++} __packed; 1.630 ++ 1.631 ++#define MGMT_EV_NEW_CONN_PARAM 0x001c 1.632 ++struct mgmt_ev_new_conn_param { 1.633 ++ struct mgmt_addr_info addr; 1.634 ++ uint8_t store_hint; 1.635 ++ uint16_t min_interval; 1.636 ++ uint16_t max_interval; 1.637 ++ uint16_t latency; 1.638 ++ uint16_t timeout; 1.639 ++} __packed; 1.640 ++ 1.641 ++#define MGMT_EV_UNCONF_INDEX_ADDED 0x001d 1.642 ++ 1.643 ++#define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e 1.644 ++ 1.645 ++#define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f 1.646 ++ 1.647 ++static const char *mgmt_op[] = { 1.648 ++ "<0x0000>", 1.649 ++ "Read Version", 1.650 ++ "Read Commands", 1.651 ++ "Read Index List", 1.652 ++ "Read Controller Info", 1.653 ++ "Set Powered", 1.654 ++ "Set Discoverable", 1.655 ++ "Set Connectable", 1.656 ++ "Set Fast Connectable", /* 0x0008 */ 1.657 ++ "Set Bondable", 1.658 ++ "Set Link Security", 1.659 ++ "Set Secure Simple Pairing", 1.660 ++ "Set High Speed", 1.661 ++ "Set Low Energy", 1.662 ++ "Set Dev Class", 1.663 ++ "Set Local Name", 1.664 ++ "Add UUID", /* 0x0010 */ 1.665 ++ "Remove UUID", 1.666 ++ "Load Link Keys", 1.667 ++ "Load Long Term Keys", 1.668 ++ "Disconnect", 1.669 ++ "Get Connections", 1.670 ++ "PIN Code Reply", 1.671 ++ "PIN Code Neg Reply", 1.672 ++ "Set IO Capability", /* 0x0018 */ 1.673 ++ "Pair Device", 1.674 ++ "Cancel Pair Device", 1.675 ++ "Unpair Device", 1.676 ++ "User Confirm Reply", 1.677 ++ "User Confirm Neg Reply", 1.678 ++ "User Passkey Reply", 1.679 ++ "User Passkey Neg Reply", 1.680 ++ "Read Local OOB Data", /* 0x0020 */ 1.681 ++ "Add Remote OOB Data", 1.682 ++ "Remove Remove OOB Data", 1.683 ++ "Start Discovery", 1.684 ++ "Stop Discovery", 1.685 ++ "Confirm Name", 1.686 ++ "Block Device", 1.687 ++ "Unblock Device", 1.688 ++ "Set Device ID", 1.689 ++ "Set Advertising", 1.690 ++ "Set BR/EDR", 1.691 ++ "Set Static Address", 1.692 ++ "Set Scan Parameters", 1.693 ++ "Set Secure Connections", 1.694 ++ "Set Debug Keys", 1.695 ++ "Set Privacy", 1.696 ++ "Load Identity Resolving Keys", 1.697 ++ "Get Connection Information", 1.698 ++ "Get Clock Information", 1.699 ++ "Add Device", 1.700 ++ "Remove Device", 1.701 ++ "Load Connection Parameters", 1.702 ++ "Read Unconfigured Index List", 1.703 ++ "Read Controller Configuration Information", 1.704 ++ "Set External Configuration", 1.705 ++ "Set Public Address", 1.706 ++}; 1.707 ++ 1.708 ++static const char *mgmt_ev[] = { 1.709 ++ "<0x0000>", 1.710 ++ "Command Complete", 1.711 ++ "Command Status", 1.712 ++ "Controller Error", 1.713 ++ "Index Added", 1.714 ++ "Index Removed", 1.715 ++ "New Settings", 1.716 ++ "Class of Device Changed", 1.717 ++ "Local Name Changed", /* 0x0008 */ 1.718 ++ "New Link Key", 1.719 ++ "New Long Term Key", 1.720 ++ "Device Connected", 1.721 ++ "Device Disconnected", 1.722 ++ "Connect Failed", 1.723 ++ "PIN Code Request", 1.724 ++ "User Confirm Request", 1.725 ++ "User Passkey Request", /* 0x0010 */ 1.726 ++ "Authentication Failed", 1.727 ++ "Device Found", 1.728 ++ "Discovering", 1.729 ++ "Device Blocked", 1.730 ++ "Device Unblocked", 1.731 ++ "Device Unpaired", 1.732 ++ "Passkey Notify", 1.733 ++ "New Identity Resolving Key", 1.734 ++ "New Signature Resolving Key", 1.735 ++ "Device Added", 1.736 ++ "Device Removed", 1.737 ++ "New Connection Parameter", 1.738 ++ "Unconfigured Index Added", 1.739 ++ "Unconfigured Index Removed", 1.740 ++ "New Configuration Options", 1.741 ++}; 1.742 ++ 1.743 ++static const char *mgmt_status[] = { 1.744 ++ "Success", 1.745 ++ "Unknown Command", 1.746 ++ "Not Connected", 1.747 ++ "Failed", 1.748 ++ "Connect Failed", 1.749 ++ "Authentication Failed", 1.750 ++ "Not Paired", 1.751 ++ "No Resources", 1.752 ++ "Timeout", 1.753 ++ "Already Connected", 1.754 ++ "Busy", 1.755 ++ "Rejected", 1.756 ++ "Not Supported", 1.757 ++ "Invalid Parameters", 1.758 ++ "Disconnected", 1.759 ++ "Not Powered", 1.760 ++ "Cancelled", 1.761 ++ "Invalid Index", 1.762 ++ "Blocked through rfkill", 1.763 ++}; 1.764 ++ 1.765 ++#ifndef NELEM 1.766 ++#define NELEM(x) (sizeof(x) / sizeof((x)[0])) 1.767 ++#endif 1.768 ++ 1.769 ++static inline const char *mgmt_opstr(uint16_t op) 1.770 ++{ 1.771 ++ if (op >= NELEM(mgmt_op)) 1.772 ++ return "<unknown opcode>"; 1.773 ++ return mgmt_op[op]; 1.774 ++} 1.775 ++ 1.776 ++static inline const char *mgmt_evstr(uint16_t ev) 1.777 ++{ 1.778 ++ if (ev >= NELEM(mgmt_ev)) 1.779 ++ return "<unknown event>"; 1.780 ++ return mgmt_ev[ev]; 1.781 ++} 1.782 ++ 1.783 ++static inline const char *mgmt_errstr(uint8_t status) 1.784 ++{ 1.785 ++ if (status >= NELEM(mgmt_status)) 1.786 ++ return "<unknown status>"; 1.787 ++ return mgmt_status[status]; 1.788 ++}