162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci   BlueZ - Bluetooth protocol stack for Linux
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci   Copyright (C) 2010  Nokia Corporation
562306a36Sopenharmony_ci   Copyright (C) 2011-2012  Intel Corporation
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci   This program is free software; you can redistribute it and/or modify
862306a36Sopenharmony_ci   it under the terms of the GNU General Public License version 2 as
962306a36Sopenharmony_ci   published by the Free Software Foundation;
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1262306a36Sopenharmony_ci   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1362306a36Sopenharmony_ci   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
1462306a36Sopenharmony_ci   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
1562306a36Sopenharmony_ci   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
1662306a36Sopenharmony_ci   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1762306a36Sopenharmony_ci   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1862306a36Sopenharmony_ci   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
2162306a36Sopenharmony_ci   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
2262306a36Sopenharmony_ci   SOFTWARE IS DISCLAIMED.
2362306a36Sopenharmony_ci*/
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define MGMT_INDEX_NONE			0xFFFF
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define MGMT_STATUS_SUCCESS		0x00
2862306a36Sopenharmony_ci#define MGMT_STATUS_UNKNOWN_COMMAND	0x01
2962306a36Sopenharmony_ci#define MGMT_STATUS_NOT_CONNECTED	0x02
3062306a36Sopenharmony_ci#define MGMT_STATUS_FAILED		0x03
3162306a36Sopenharmony_ci#define MGMT_STATUS_CONNECT_FAILED	0x04
3262306a36Sopenharmony_ci#define MGMT_STATUS_AUTH_FAILED		0x05
3362306a36Sopenharmony_ci#define MGMT_STATUS_NOT_PAIRED		0x06
3462306a36Sopenharmony_ci#define MGMT_STATUS_NO_RESOURCES	0x07
3562306a36Sopenharmony_ci#define MGMT_STATUS_TIMEOUT		0x08
3662306a36Sopenharmony_ci#define MGMT_STATUS_ALREADY_CONNECTED	0x09
3762306a36Sopenharmony_ci#define MGMT_STATUS_BUSY		0x0a
3862306a36Sopenharmony_ci#define MGMT_STATUS_REJECTED		0x0b
3962306a36Sopenharmony_ci#define MGMT_STATUS_NOT_SUPPORTED	0x0c
4062306a36Sopenharmony_ci#define MGMT_STATUS_INVALID_PARAMS	0x0d
4162306a36Sopenharmony_ci#define MGMT_STATUS_DISCONNECTED	0x0e
4262306a36Sopenharmony_ci#define MGMT_STATUS_NOT_POWERED		0x0f
4362306a36Sopenharmony_ci#define MGMT_STATUS_CANCELLED		0x10
4462306a36Sopenharmony_ci#define MGMT_STATUS_INVALID_INDEX	0x11
4562306a36Sopenharmony_ci#define MGMT_STATUS_RFKILLED		0x12
4662306a36Sopenharmony_ci#define MGMT_STATUS_ALREADY_PAIRED	0x13
4762306a36Sopenharmony_ci#define MGMT_STATUS_PERMISSION_DENIED	0x14
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_cistruct mgmt_hdr {
5062306a36Sopenharmony_ci	__le16	opcode;
5162306a36Sopenharmony_ci	__le16	index;
5262306a36Sopenharmony_ci	__le16	len;
5362306a36Sopenharmony_ci} __packed;
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_cistruct mgmt_tlv {
5662306a36Sopenharmony_ci	__le16 type;
5762306a36Sopenharmony_ci	__u8   length;
5862306a36Sopenharmony_ci	__u8   value[];
5962306a36Sopenharmony_ci} __packed;
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cistruct mgmt_addr_info {
6262306a36Sopenharmony_ci	bdaddr_t	bdaddr;
6362306a36Sopenharmony_ci	__u8		type;
6462306a36Sopenharmony_ci} __packed;
6562306a36Sopenharmony_ci#define MGMT_ADDR_INFO_SIZE		7
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define MGMT_OP_READ_VERSION		0x0001
6862306a36Sopenharmony_ci#define MGMT_READ_VERSION_SIZE		0
6962306a36Sopenharmony_cistruct mgmt_rp_read_version {
7062306a36Sopenharmony_ci	__u8	version;
7162306a36Sopenharmony_ci	__le16	revision;
7262306a36Sopenharmony_ci} __packed;
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define MGMT_OP_READ_COMMANDS		0x0002
7562306a36Sopenharmony_ci#define MGMT_READ_COMMANDS_SIZE		0
7662306a36Sopenharmony_cistruct mgmt_rp_read_commands {
7762306a36Sopenharmony_ci	__le16	num_commands;
7862306a36Sopenharmony_ci	__le16	num_events;
7962306a36Sopenharmony_ci	__le16	opcodes[];
8062306a36Sopenharmony_ci} __packed;
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define MGMT_OP_READ_INDEX_LIST		0x0003
8362306a36Sopenharmony_ci#define MGMT_READ_INDEX_LIST_SIZE	0
8462306a36Sopenharmony_cistruct mgmt_rp_read_index_list {
8562306a36Sopenharmony_ci	__le16	num_controllers;
8662306a36Sopenharmony_ci	__le16	index[];
8762306a36Sopenharmony_ci} __packed;
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* Reserve one extra byte for names in management messages so that they
9062306a36Sopenharmony_ci * are always guaranteed to be nul-terminated */
9162306a36Sopenharmony_ci#define MGMT_MAX_NAME_LENGTH		(HCI_MAX_NAME_LENGTH + 1)
9262306a36Sopenharmony_ci#define MGMT_MAX_SHORT_NAME_LENGTH	(HCI_MAX_SHORT_NAME_LENGTH + 1)
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#define MGMT_SETTING_POWERED		BIT(0)
9562306a36Sopenharmony_ci#define MGMT_SETTING_CONNECTABLE	BIT(1)
9662306a36Sopenharmony_ci#define MGMT_SETTING_FAST_CONNECTABLE	BIT(2)
9762306a36Sopenharmony_ci#define MGMT_SETTING_DISCOVERABLE	BIT(3)
9862306a36Sopenharmony_ci#define MGMT_SETTING_BONDABLE		BIT(4)
9962306a36Sopenharmony_ci#define MGMT_SETTING_LINK_SECURITY	BIT(5)
10062306a36Sopenharmony_ci#define MGMT_SETTING_SSP		BIT(6)
10162306a36Sopenharmony_ci#define MGMT_SETTING_BREDR		BIT(7)
10262306a36Sopenharmony_ci#define MGMT_SETTING_HS			BIT(8)
10362306a36Sopenharmony_ci#define MGMT_SETTING_LE			BIT(9)
10462306a36Sopenharmony_ci#define MGMT_SETTING_ADVERTISING	BIT(10)
10562306a36Sopenharmony_ci#define MGMT_SETTING_SECURE_CONN	BIT(11)
10662306a36Sopenharmony_ci#define MGMT_SETTING_DEBUG_KEYS		BIT(12)
10762306a36Sopenharmony_ci#define MGMT_SETTING_PRIVACY		BIT(13)
10862306a36Sopenharmony_ci#define MGMT_SETTING_CONFIGURATION	BIT(14)
10962306a36Sopenharmony_ci#define MGMT_SETTING_STATIC_ADDRESS	BIT(15)
11062306a36Sopenharmony_ci#define MGMT_SETTING_PHY_CONFIGURATION	BIT(16)
11162306a36Sopenharmony_ci#define MGMT_SETTING_WIDEBAND_SPEECH	BIT(17)
11262306a36Sopenharmony_ci#define MGMT_SETTING_CIS_CENTRAL	BIT(18)
11362306a36Sopenharmony_ci#define MGMT_SETTING_CIS_PERIPHERAL	BIT(19)
11462306a36Sopenharmony_ci#define MGMT_SETTING_ISO_BROADCASTER	BIT(20)
11562306a36Sopenharmony_ci#define MGMT_SETTING_ISO_SYNC_RECEIVER	BIT(21)
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci#define MGMT_OP_READ_INFO		0x0004
11862306a36Sopenharmony_ci#define MGMT_READ_INFO_SIZE		0
11962306a36Sopenharmony_cistruct mgmt_rp_read_info {
12062306a36Sopenharmony_ci	bdaddr_t	bdaddr;
12162306a36Sopenharmony_ci	__u8		version;
12262306a36Sopenharmony_ci	__le16		manufacturer;
12362306a36Sopenharmony_ci	__le32		supported_settings;
12462306a36Sopenharmony_ci	__le32		current_settings;
12562306a36Sopenharmony_ci	__u8		dev_class[3];
12662306a36Sopenharmony_ci	__u8		name[MGMT_MAX_NAME_LENGTH];
12762306a36Sopenharmony_ci	__u8		short_name[MGMT_MAX_SHORT_NAME_LENGTH];
12862306a36Sopenharmony_ci} __packed;
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_cistruct mgmt_mode {
13162306a36Sopenharmony_ci	__u8 val;
13262306a36Sopenharmony_ci} __packed;
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define MGMT_SETTING_SIZE		1
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define MGMT_OP_SET_POWERED		0x0005
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci#define MGMT_OP_SET_DISCOVERABLE	0x0006
13962306a36Sopenharmony_cistruct mgmt_cp_set_discoverable {
14062306a36Sopenharmony_ci	__u8	val;
14162306a36Sopenharmony_ci	__le16	timeout;
14262306a36Sopenharmony_ci} __packed;
14362306a36Sopenharmony_ci#define MGMT_SET_DISCOVERABLE_SIZE	3
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define MGMT_OP_SET_CONNECTABLE		0x0007
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define MGMT_OP_SET_FAST_CONNECTABLE	0x0008
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci#define MGMT_OP_SET_BONDABLE		0x0009
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci#define MGMT_OP_SET_LINK_SECURITY	0x000A
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci#define MGMT_OP_SET_SSP			0x000B
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci#define MGMT_OP_SET_HS			0x000C
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci#define MGMT_OP_SET_LE			0x000D
15862306a36Sopenharmony_ci#define MGMT_OP_SET_DEV_CLASS		0x000E
15962306a36Sopenharmony_cistruct mgmt_cp_set_dev_class {
16062306a36Sopenharmony_ci	__u8	major;
16162306a36Sopenharmony_ci	__u8	minor;
16262306a36Sopenharmony_ci} __packed;
16362306a36Sopenharmony_ci#define MGMT_SET_DEV_CLASS_SIZE		2
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci#define MGMT_OP_SET_LOCAL_NAME		0x000F
16662306a36Sopenharmony_cistruct mgmt_cp_set_local_name {
16762306a36Sopenharmony_ci	__u8	name[MGMT_MAX_NAME_LENGTH];
16862306a36Sopenharmony_ci	__u8	short_name[MGMT_MAX_SHORT_NAME_LENGTH];
16962306a36Sopenharmony_ci} __packed;
17062306a36Sopenharmony_ci#define MGMT_SET_LOCAL_NAME_SIZE	260
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci#define MGMT_OP_ADD_UUID		0x0010
17362306a36Sopenharmony_cistruct mgmt_cp_add_uuid {
17462306a36Sopenharmony_ci	__u8	uuid[16];
17562306a36Sopenharmony_ci	__u8	svc_hint;
17662306a36Sopenharmony_ci} __packed;
17762306a36Sopenharmony_ci#define MGMT_ADD_UUID_SIZE		17
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci#define MGMT_OP_REMOVE_UUID		0x0011
18062306a36Sopenharmony_cistruct mgmt_cp_remove_uuid {
18162306a36Sopenharmony_ci	__u8	uuid[16];
18262306a36Sopenharmony_ci} __packed;
18362306a36Sopenharmony_ci#define MGMT_REMOVE_UUID_SIZE		16
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_cistruct mgmt_link_key_info {
18662306a36Sopenharmony_ci	struct mgmt_addr_info addr;
18762306a36Sopenharmony_ci	__u8	type;
18862306a36Sopenharmony_ci	__u8	val[16];
18962306a36Sopenharmony_ci	__u8	pin_len;
19062306a36Sopenharmony_ci} __packed;
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci#define MGMT_OP_LOAD_LINK_KEYS		0x0012
19362306a36Sopenharmony_cistruct mgmt_cp_load_link_keys {
19462306a36Sopenharmony_ci	__u8	debug_keys;
19562306a36Sopenharmony_ci	__le16	key_count;
19662306a36Sopenharmony_ci	struct	mgmt_link_key_info keys[];
19762306a36Sopenharmony_ci} __packed;
19862306a36Sopenharmony_ci#define MGMT_LOAD_LINK_KEYS_SIZE	3
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci#define MGMT_LTK_UNAUTHENTICATED	0x00
20162306a36Sopenharmony_ci#define MGMT_LTK_AUTHENTICATED		0x01
20262306a36Sopenharmony_ci#define MGMT_LTK_P256_UNAUTH		0x02
20362306a36Sopenharmony_ci#define MGMT_LTK_P256_AUTH		0x03
20462306a36Sopenharmony_ci#define MGMT_LTK_P256_DEBUG		0x04
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_cistruct mgmt_ltk_info {
20762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
20862306a36Sopenharmony_ci	__u8	type;
20962306a36Sopenharmony_ci	__u8	initiator;
21062306a36Sopenharmony_ci	__u8	enc_size;
21162306a36Sopenharmony_ci	__le16	ediv;
21262306a36Sopenharmony_ci	__le64	rand;
21362306a36Sopenharmony_ci	__u8	val[16];
21462306a36Sopenharmony_ci} __packed;
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci#define MGMT_OP_LOAD_LONG_TERM_KEYS	0x0013
21762306a36Sopenharmony_cistruct mgmt_cp_load_long_term_keys {
21862306a36Sopenharmony_ci	__le16	key_count;
21962306a36Sopenharmony_ci	struct	mgmt_ltk_info keys[];
22062306a36Sopenharmony_ci} __packed;
22162306a36Sopenharmony_ci#define MGMT_LOAD_LONG_TERM_KEYS_SIZE	2
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci#define MGMT_OP_DISCONNECT		0x0014
22462306a36Sopenharmony_cistruct mgmt_cp_disconnect {
22562306a36Sopenharmony_ci	struct mgmt_addr_info addr;
22662306a36Sopenharmony_ci} __packed;
22762306a36Sopenharmony_ci#define MGMT_DISCONNECT_SIZE		MGMT_ADDR_INFO_SIZE
22862306a36Sopenharmony_cistruct mgmt_rp_disconnect {
22962306a36Sopenharmony_ci	struct mgmt_addr_info addr;
23062306a36Sopenharmony_ci} __packed;
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci#define MGMT_OP_GET_CONNECTIONS		0x0015
23362306a36Sopenharmony_ci#define MGMT_GET_CONNECTIONS_SIZE	0
23462306a36Sopenharmony_cistruct mgmt_rp_get_connections {
23562306a36Sopenharmony_ci	__le16 conn_count;
23662306a36Sopenharmony_ci	struct mgmt_addr_info addr[];
23762306a36Sopenharmony_ci} __packed;
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci#define MGMT_OP_PIN_CODE_REPLY		0x0016
24062306a36Sopenharmony_cistruct mgmt_cp_pin_code_reply {
24162306a36Sopenharmony_ci	struct mgmt_addr_info addr;
24262306a36Sopenharmony_ci	__u8	pin_len;
24362306a36Sopenharmony_ci	__u8	pin_code[16];
24462306a36Sopenharmony_ci} __packed;
24562306a36Sopenharmony_ci#define MGMT_PIN_CODE_REPLY_SIZE	(MGMT_ADDR_INFO_SIZE + 17)
24662306a36Sopenharmony_cistruct mgmt_rp_pin_code_reply {
24762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
24862306a36Sopenharmony_ci} __packed;
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci#define MGMT_OP_PIN_CODE_NEG_REPLY	0x0017
25162306a36Sopenharmony_cistruct mgmt_cp_pin_code_neg_reply {
25262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
25362306a36Sopenharmony_ci} __packed;
25462306a36Sopenharmony_ci#define MGMT_PIN_CODE_NEG_REPLY_SIZE	MGMT_ADDR_INFO_SIZE
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci#define MGMT_OP_SET_IO_CAPABILITY	0x0018
25762306a36Sopenharmony_cistruct mgmt_cp_set_io_capability {
25862306a36Sopenharmony_ci	__u8	io_capability;
25962306a36Sopenharmony_ci} __packed;
26062306a36Sopenharmony_ci#define MGMT_SET_IO_CAPABILITY_SIZE	1
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci#define MGMT_OP_PAIR_DEVICE		0x0019
26362306a36Sopenharmony_cistruct mgmt_cp_pair_device {
26462306a36Sopenharmony_ci	struct mgmt_addr_info addr;
26562306a36Sopenharmony_ci	__u8	io_cap;
26662306a36Sopenharmony_ci} __packed;
26762306a36Sopenharmony_ci#define MGMT_PAIR_DEVICE_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
26862306a36Sopenharmony_cistruct mgmt_rp_pair_device {
26962306a36Sopenharmony_ci	struct mgmt_addr_info addr;
27062306a36Sopenharmony_ci} __packed;
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci#define MGMT_OP_CANCEL_PAIR_DEVICE	0x001A
27362306a36Sopenharmony_ci#define MGMT_CANCEL_PAIR_DEVICE_SIZE	MGMT_ADDR_INFO_SIZE
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci#define MGMT_OP_UNPAIR_DEVICE		0x001B
27662306a36Sopenharmony_cistruct mgmt_cp_unpair_device {
27762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
27862306a36Sopenharmony_ci	__u8 disconnect;
27962306a36Sopenharmony_ci} __packed;
28062306a36Sopenharmony_ci#define MGMT_UNPAIR_DEVICE_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
28162306a36Sopenharmony_cistruct mgmt_rp_unpair_device {
28262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
28362306a36Sopenharmony_ci};
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci#define MGMT_OP_USER_CONFIRM_REPLY	0x001C
28662306a36Sopenharmony_cistruct mgmt_cp_user_confirm_reply {
28762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
28862306a36Sopenharmony_ci} __packed;
28962306a36Sopenharmony_ci#define MGMT_USER_CONFIRM_REPLY_SIZE	MGMT_ADDR_INFO_SIZE
29062306a36Sopenharmony_cistruct mgmt_rp_user_confirm_reply {
29162306a36Sopenharmony_ci	struct mgmt_addr_info addr;
29262306a36Sopenharmony_ci} __packed;
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci#define MGMT_OP_USER_CONFIRM_NEG_REPLY	0x001D
29562306a36Sopenharmony_cistruct mgmt_cp_user_confirm_neg_reply {
29662306a36Sopenharmony_ci	struct mgmt_addr_info addr;
29762306a36Sopenharmony_ci} __packed;
29862306a36Sopenharmony_ci#define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci#define MGMT_OP_USER_PASSKEY_REPLY	0x001E
30162306a36Sopenharmony_cistruct mgmt_cp_user_passkey_reply {
30262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
30362306a36Sopenharmony_ci	__le32	passkey;
30462306a36Sopenharmony_ci} __packed;
30562306a36Sopenharmony_ci#define MGMT_USER_PASSKEY_REPLY_SIZE	(MGMT_ADDR_INFO_SIZE + 4)
30662306a36Sopenharmony_cistruct mgmt_rp_user_passkey_reply {
30762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
30862306a36Sopenharmony_ci} __packed;
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci#define MGMT_OP_USER_PASSKEY_NEG_REPLY	0x001F
31162306a36Sopenharmony_cistruct mgmt_cp_user_passkey_neg_reply {
31262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
31362306a36Sopenharmony_ci} __packed;
31462306a36Sopenharmony_ci#define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci#define MGMT_OP_READ_LOCAL_OOB_DATA	0x0020
31762306a36Sopenharmony_ci#define MGMT_READ_LOCAL_OOB_DATA_SIZE	0
31862306a36Sopenharmony_cistruct mgmt_rp_read_local_oob_data {
31962306a36Sopenharmony_ci	__u8	hash192[16];
32062306a36Sopenharmony_ci	__u8	rand192[16];
32162306a36Sopenharmony_ci	__u8	hash256[16];
32262306a36Sopenharmony_ci	__u8	rand256[16];
32362306a36Sopenharmony_ci} __packed;
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci#define MGMT_OP_ADD_REMOTE_OOB_DATA	0x0021
32662306a36Sopenharmony_cistruct mgmt_cp_add_remote_oob_data {
32762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
32862306a36Sopenharmony_ci	__u8	hash[16];
32962306a36Sopenharmony_ci	__u8	rand[16];
33062306a36Sopenharmony_ci} __packed;
33162306a36Sopenharmony_ci#define MGMT_ADD_REMOTE_OOB_DATA_SIZE	(MGMT_ADDR_INFO_SIZE + 32)
33262306a36Sopenharmony_cistruct mgmt_cp_add_remote_oob_ext_data {
33362306a36Sopenharmony_ci	struct mgmt_addr_info addr;
33462306a36Sopenharmony_ci	__u8	hash192[16];
33562306a36Sopenharmony_ci	__u8	rand192[16];
33662306a36Sopenharmony_ci	__u8	hash256[16];
33762306a36Sopenharmony_ci	__u8	rand256[16];
33862306a36Sopenharmony_ci} __packed;
33962306a36Sopenharmony_ci#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci#define MGMT_OP_REMOVE_REMOTE_OOB_DATA	0x0022
34262306a36Sopenharmony_cistruct mgmt_cp_remove_remote_oob_data {
34362306a36Sopenharmony_ci	struct mgmt_addr_info addr;
34462306a36Sopenharmony_ci} __packed;
34562306a36Sopenharmony_ci#define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci#define MGMT_OP_START_DISCOVERY		0x0023
34862306a36Sopenharmony_cistruct mgmt_cp_start_discovery {
34962306a36Sopenharmony_ci	__u8 type;
35062306a36Sopenharmony_ci} __packed;
35162306a36Sopenharmony_ci#define MGMT_START_DISCOVERY_SIZE	1
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci#define MGMT_OP_STOP_DISCOVERY		0x0024
35462306a36Sopenharmony_cistruct mgmt_cp_stop_discovery {
35562306a36Sopenharmony_ci	__u8 type;
35662306a36Sopenharmony_ci} __packed;
35762306a36Sopenharmony_ci#define MGMT_STOP_DISCOVERY_SIZE	1
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci#define MGMT_OP_CONFIRM_NAME		0x0025
36062306a36Sopenharmony_cistruct mgmt_cp_confirm_name {
36162306a36Sopenharmony_ci	struct mgmt_addr_info addr;
36262306a36Sopenharmony_ci	__u8	name_known;
36362306a36Sopenharmony_ci} __packed;
36462306a36Sopenharmony_ci#define MGMT_CONFIRM_NAME_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
36562306a36Sopenharmony_cistruct mgmt_rp_confirm_name {
36662306a36Sopenharmony_ci	struct mgmt_addr_info addr;
36762306a36Sopenharmony_ci} __packed;
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci#define MGMT_OP_BLOCK_DEVICE		0x0026
37062306a36Sopenharmony_cistruct mgmt_cp_block_device {
37162306a36Sopenharmony_ci	struct mgmt_addr_info addr;
37262306a36Sopenharmony_ci} __packed;
37362306a36Sopenharmony_ci#define MGMT_BLOCK_DEVICE_SIZE		MGMT_ADDR_INFO_SIZE
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ci#define MGMT_OP_UNBLOCK_DEVICE		0x0027
37662306a36Sopenharmony_cistruct mgmt_cp_unblock_device {
37762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
37862306a36Sopenharmony_ci} __packed;
37962306a36Sopenharmony_ci#define MGMT_UNBLOCK_DEVICE_SIZE	MGMT_ADDR_INFO_SIZE
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci#define MGMT_OP_SET_DEVICE_ID		0x0028
38262306a36Sopenharmony_cistruct mgmt_cp_set_device_id {
38362306a36Sopenharmony_ci	__le16	source;
38462306a36Sopenharmony_ci	__le16	vendor;
38562306a36Sopenharmony_ci	__le16	product;
38662306a36Sopenharmony_ci	__le16	version;
38762306a36Sopenharmony_ci} __packed;
38862306a36Sopenharmony_ci#define MGMT_SET_DEVICE_ID_SIZE		8
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci#define MGMT_OP_SET_ADVERTISING		0x0029
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ci#define MGMT_OP_SET_BREDR		0x002A
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ci#define MGMT_OP_SET_STATIC_ADDRESS	0x002B
39562306a36Sopenharmony_cistruct mgmt_cp_set_static_address {
39662306a36Sopenharmony_ci	bdaddr_t bdaddr;
39762306a36Sopenharmony_ci} __packed;
39862306a36Sopenharmony_ci#define MGMT_SET_STATIC_ADDRESS_SIZE	6
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ci#define MGMT_OP_SET_SCAN_PARAMS		0x002C
40162306a36Sopenharmony_cistruct mgmt_cp_set_scan_params {
40262306a36Sopenharmony_ci	__le16	interval;
40362306a36Sopenharmony_ci	__le16	window;
40462306a36Sopenharmony_ci} __packed;
40562306a36Sopenharmony_ci#define MGMT_SET_SCAN_PARAMS_SIZE	4
40662306a36Sopenharmony_ci
40762306a36Sopenharmony_ci#define MGMT_OP_SET_SECURE_CONN		0x002D
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci#define MGMT_OP_SET_DEBUG_KEYS		0x002E
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ci#define MGMT_OP_SET_PRIVACY		0x002F
41262306a36Sopenharmony_cistruct mgmt_cp_set_privacy {
41362306a36Sopenharmony_ci	__u8 privacy;
41462306a36Sopenharmony_ci	__u8 irk[16];
41562306a36Sopenharmony_ci} __packed;
41662306a36Sopenharmony_ci#define MGMT_SET_PRIVACY_SIZE		17
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_cistruct mgmt_irk_info {
41962306a36Sopenharmony_ci	struct mgmt_addr_info addr;
42062306a36Sopenharmony_ci	__u8 val[16];
42162306a36Sopenharmony_ci} __packed;
42262306a36Sopenharmony_ci
42362306a36Sopenharmony_ci#define MGMT_OP_LOAD_IRKS		0x0030
42462306a36Sopenharmony_cistruct mgmt_cp_load_irks {
42562306a36Sopenharmony_ci	__le16 irk_count;
42662306a36Sopenharmony_ci	struct mgmt_irk_info irks[];
42762306a36Sopenharmony_ci} __packed;
42862306a36Sopenharmony_ci#define MGMT_LOAD_IRKS_SIZE		2
42962306a36Sopenharmony_ci
43062306a36Sopenharmony_ci#define MGMT_OP_GET_CONN_INFO		0x0031
43162306a36Sopenharmony_cistruct mgmt_cp_get_conn_info {
43262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
43362306a36Sopenharmony_ci} __packed;
43462306a36Sopenharmony_ci#define MGMT_GET_CONN_INFO_SIZE		MGMT_ADDR_INFO_SIZE
43562306a36Sopenharmony_cistruct mgmt_rp_get_conn_info {
43662306a36Sopenharmony_ci	struct mgmt_addr_info addr;
43762306a36Sopenharmony_ci	__s8	rssi;
43862306a36Sopenharmony_ci	__s8	tx_power;
43962306a36Sopenharmony_ci	__s8	max_tx_power;
44062306a36Sopenharmony_ci} __packed;
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ci#define MGMT_OP_GET_CLOCK_INFO		0x0032
44362306a36Sopenharmony_cistruct mgmt_cp_get_clock_info {
44462306a36Sopenharmony_ci	struct mgmt_addr_info addr;
44562306a36Sopenharmony_ci} __packed;
44662306a36Sopenharmony_ci#define MGMT_GET_CLOCK_INFO_SIZE	MGMT_ADDR_INFO_SIZE
44762306a36Sopenharmony_cistruct mgmt_rp_get_clock_info {
44862306a36Sopenharmony_ci	struct mgmt_addr_info addr;
44962306a36Sopenharmony_ci	__le32  local_clock;
45062306a36Sopenharmony_ci	__le32  piconet_clock;
45162306a36Sopenharmony_ci	__le16  accuracy;
45262306a36Sopenharmony_ci} __packed;
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ci#define MGMT_OP_ADD_DEVICE		0x0033
45562306a36Sopenharmony_cistruct mgmt_cp_add_device {
45662306a36Sopenharmony_ci	struct mgmt_addr_info addr;
45762306a36Sopenharmony_ci	__u8	action;
45862306a36Sopenharmony_ci} __packed;
45962306a36Sopenharmony_ci#define MGMT_ADD_DEVICE_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci#define MGMT_OP_REMOVE_DEVICE		0x0034
46262306a36Sopenharmony_cistruct mgmt_cp_remove_device {
46362306a36Sopenharmony_ci	struct mgmt_addr_info addr;
46462306a36Sopenharmony_ci} __packed;
46562306a36Sopenharmony_ci#define MGMT_REMOVE_DEVICE_SIZE		MGMT_ADDR_INFO_SIZE
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_cistruct mgmt_conn_param {
46862306a36Sopenharmony_ci	struct mgmt_addr_info addr;
46962306a36Sopenharmony_ci	__le16 min_interval;
47062306a36Sopenharmony_ci	__le16 max_interval;
47162306a36Sopenharmony_ci	__le16 latency;
47262306a36Sopenharmony_ci	__le16 timeout;
47362306a36Sopenharmony_ci} __packed;
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci#define MGMT_OP_LOAD_CONN_PARAM		0x0035
47662306a36Sopenharmony_cistruct mgmt_cp_load_conn_param {
47762306a36Sopenharmony_ci	__le16 param_count;
47862306a36Sopenharmony_ci	struct mgmt_conn_param params[];
47962306a36Sopenharmony_ci} __packed;
48062306a36Sopenharmony_ci#define MGMT_LOAD_CONN_PARAM_SIZE	2
48162306a36Sopenharmony_ci
48262306a36Sopenharmony_ci#define MGMT_OP_READ_UNCONF_INDEX_LIST	0x0036
48362306a36Sopenharmony_ci#define MGMT_READ_UNCONF_INDEX_LIST_SIZE 0
48462306a36Sopenharmony_cistruct mgmt_rp_read_unconf_index_list {
48562306a36Sopenharmony_ci	__le16	num_controllers;
48662306a36Sopenharmony_ci	__le16	index[];
48762306a36Sopenharmony_ci} __packed;
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci#define MGMT_OPTION_EXTERNAL_CONFIG	0x00000001
49062306a36Sopenharmony_ci#define MGMT_OPTION_PUBLIC_ADDRESS	0x00000002
49162306a36Sopenharmony_ci
49262306a36Sopenharmony_ci#define MGMT_OP_READ_CONFIG_INFO	0x0037
49362306a36Sopenharmony_ci#define MGMT_READ_CONFIG_INFO_SIZE	0
49462306a36Sopenharmony_cistruct mgmt_rp_read_config_info {
49562306a36Sopenharmony_ci	__le16	manufacturer;
49662306a36Sopenharmony_ci	__le32	supported_options;
49762306a36Sopenharmony_ci	__le32	missing_options;
49862306a36Sopenharmony_ci} __packed;
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ci#define MGMT_OP_SET_EXTERNAL_CONFIG	0x0038
50162306a36Sopenharmony_cistruct mgmt_cp_set_external_config {
50262306a36Sopenharmony_ci	__u8 config;
50362306a36Sopenharmony_ci} __packed;
50462306a36Sopenharmony_ci#define MGMT_SET_EXTERNAL_CONFIG_SIZE	1
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ci#define MGMT_OP_SET_PUBLIC_ADDRESS	0x0039
50762306a36Sopenharmony_cistruct mgmt_cp_set_public_address {
50862306a36Sopenharmony_ci	bdaddr_t bdaddr;
50962306a36Sopenharmony_ci} __packed;
51062306a36Sopenharmony_ci#define MGMT_SET_PUBLIC_ADDRESS_SIZE	6
51162306a36Sopenharmony_ci
51262306a36Sopenharmony_ci#define MGMT_OP_START_SERVICE_DISCOVERY	0x003A
51362306a36Sopenharmony_cistruct mgmt_cp_start_service_discovery {
51462306a36Sopenharmony_ci	__u8 type;
51562306a36Sopenharmony_ci	__s8 rssi;
51662306a36Sopenharmony_ci	__le16 uuid_count;
51762306a36Sopenharmony_ci	__u8 uuids[][16];
51862306a36Sopenharmony_ci} __packed;
51962306a36Sopenharmony_ci#define MGMT_START_SERVICE_DISCOVERY_SIZE 4
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_ci#define MGMT_OP_READ_LOCAL_OOB_EXT_DATA	0x003B
52262306a36Sopenharmony_cistruct mgmt_cp_read_local_oob_ext_data {
52362306a36Sopenharmony_ci	__u8 type;
52462306a36Sopenharmony_ci} __packed;
52562306a36Sopenharmony_ci#define MGMT_READ_LOCAL_OOB_EXT_DATA_SIZE 1
52662306a36Sopenharmony_cistruct mgmt_rp_read_local_oob_ext_data {
52762306a36Sopenharmony_ci	__u8    type;
52862306a36Sopenharmony_ci	__le16	eir_len;
52962306a36Sopenharmony_ci	__u8	eir[];
53062306a36Sopenharmony_ci} __packed;
53162306a36Sopenharmony_ci
53262306a36Sopenharmony_ci#define MGMT_OP_READ_EXT_INDEX_LIST	0x003C
53362306a36Sopenharmony_ci#define MGMT_READ_EXT_INDEX_LIST_SIZE	0
53462306a36Sopenharmony_cistruct mgmt_rp_read_ext_index_list {
53562306a36Sopenharmony_ci	__le16	num_controllers;
53662306a36Sopenharmony_ci	struct {
53762306a36Sopenharmony_ci		__le16 index;
53862306a36Sopenharmony_ci		__u8   type;
53962306a36Sopenharmony_ci		__u8   bus;
54062306a36Sopenharmony_ci	} entry[];
54162306a36Sopenharmony_ci} __packed;
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci#define MGMT_OP_READ_ADV_FEATURES	0x0003D
54462306a36Sopenharmony_ci#define MGMT_READ_ADV_FEATURES_SIZE	0
54562306a36Sopenharmony_cistruct mgmt_rp_read_adv_features {
54662306a36Sopenharmony_ci	__le32 supported_flags;
54762306a36Sopenharmony_ci	__u8   max_adv_data_len;
54862306a36Sopenharmony_ci	__u8   max_scan_rsp_len;
54962306a36Sopenharmony_ci	__u8   max_instances;
55062306a36Sopenharmony_ci	__u8   num_instances;
55162306a36Sopenharmony_ci	__u8   instance[];
55262306a36Sopenharmony_ci} __packed;
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_ci#define MGMT_OP_ADD_ADVERTISING		0x003E
55562306a36Sopenharmony_cistruct mgmt_cp_add_advertising {
55662306a36Sopenharmony_ci	__u8	instance;
55762306a36Sopenharmony_ci	__le32	flags;
55862306a36Sopenharmony_ci	__le16	duration;
55962306a36Sopenharmony_ci	__le16	timeout;
56062306a36Sopenharmony_ci	__u8	adv_data_len;
56162306a36Sopenharmony_ci	__u8	scan_rsp_len;
56262306a36Sopenharmony_ci	__u8	data[];
56362306a36Sopenharmony_ci} __packed;
56462306a36Sopenharmony_ci#define MGMT_ADD_ADVERTISING_SIZE	11
56562306a36Sopenharmony_cistruct mgmt_rp_add_advertising {
56662306a36Sopenharmony_ci	__u8	instance;
56762306a36Sopenharmony_ci} __packed;
56862306a36Sopenharmony_ci
56962306a36Sopenharmony_ci#define MGMT_ADV_FLAG_CONNECTABLE	BIT(0)
57062306a36Sopenharmony_ci#define MGMT_ADV_FLAG_DISCOV		BIT(1)
57162306a36Sopenharmony_ci#define MGMT_ADV_FLAG_LIMITED_DISCOV	BIT(2)
57262306a36Sopenharmony_ci#define MGMT_ADV_FLAG_MANAGED_FLAGS	BIT(3)
57362306a36Sopenharmony_ci#define MGMT_ADV_FLAG_TX_POWER		BIT(4)
57462306a36Sopenharmony_ci#define MGMT_ADV_FLAG_APPEARANCE	BIT(5)
57562306a36Sopenharmony_ci#define MGMT_ADV_FLAG_LOCAL_NAME	BIT(6)
57662306a36Sopenharmony_ci#define MGMT_ADV_FLAG_SEC_1M 		BIT(7)
57762306a36Sopenharmony_ci#define MGMT_ADV_FLAG_SEC_2M 		BIT(8)
57862306a36Sopenharmony_ci#define MGMT_ADV_FLAG_SEC_CODED 	BIT(9)
57962306a36Sopenharmony_ci#define MGMT_ADV_FLAG_CAN_SET_TX_POWER	BIT(10)
58062306a36Sopenharmony_ci#define MGMT_ADV_FLAG_HW_OFFLOAD	BIT(11)
58162306a36Sopenharmony_ci#define MGMT_ADV_PARAM_DURATION		BIT(12)
58262306a36Sopenharmony_ci#define MGMT_ADV_PARAM_TIMEOUT		BIT(13)
58362306a36Sopenharmony_ci#define MGMT_ADV_PARAM_INTERVALS	BIT(14)
58462306a36Sopenharmony_ci#define MGMT_ADV_PARAM_TX_POWER		BIT(15)
58562306a36Sopenharmony_ci#define MGMT_ADV_PARAM_SCAN_RSP		BIT(16)
58662306a36Sopenharmony_ci
58762306a36Sopenharmony_ci#define MGMT_ADV_FLAG_SEC_MASK	(MGMT_ADV_FLAG_SEC_1M | MGMT_ADV_FLAG_SEC_2M | \
58862306a36Sopenharmony_ci				 MGMT_ADV_FLAG_SEC_CODED)
58962306a36Sopenharmony_ci
59062306a36Sopenharmony_ci#define MGMT_OP_REMOVE_ADVERTISING	0x003F
59162306a36Sopenharmony_cistruct mgmt_cp_remove_advertising {
59262306a36Sopenharmony_ci	__u8	instance;
59362306a36Sopenharmony_ci} __packed;
59462306a36Sopenharmony_ci#define MGMT_REMOVE_ADVERTISING_SIZE	1
59562306a36Sopenharmony_cistruct mgmt_rp_remove_advertising {
59662306a36Sopenharmony_ci	__u8	instance;
59762306a36Sopenharmony_ci} __packed;
59862306a36Sopenharmony_ci
59962306a36Sopenharmony_ci#define MGMT_OP_GET_ADV_SIZE_INFO	0x0040
60062306a36Sopenharmony_cistruct mgmt_cp_get_adv_size_info {
60162306a36Sopenharmony_ci	__u8	instance;
60262306a36Sopenharmony_ci	__le32	flags;
60362306a36Sopenharmony_ci} __packed;
60462306a36Sopenharmony_ci#define MGMT_GET_ADV_SIZE_INFO_SIZE	5
60562306a36Sopenharmony_cistruct mgmt_rp_get_adv_size_info {
60662306a36Sopenharmony_ci	__u8	instance;
60762306a36Sopenharmony_ci	__le32	flags;
60862306a36Sopenharmony_ci	__u8	max_adv_data_len;
60962306a36Sopenharmony_ci	__u8	max_scan_rsp_len;
61062306a36Sopenharmony_ci} __packed;
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_ci#define MGMT_OP_START_LIMITED_DISCOVERY	0x0041
61362306a36Sopenharmony_ci
61462306a36Sopenharmony_ci#define MGMT_OP_READ_EXT_INFO		0x0042
61562306a36Sopenharmony_ci#define MGMT_READ_EXT_INFO_SIZE		0
61662306a36Sopenharmony_cistruct mgmt_rp_read_ext_info {
61762306a36Sopenharmony_ci	bdaddr_t bdaddr;
61862306a36Sopenharmony_ci	__u8     version;
61962306a36Sopenharmony_ci	__le16   manufacturer;
62062306a36Sopenharmony_ci	__le32   supported_settings;
62162306a36Sopenharmony_ci	__le32   current_settings;
62262306a36Sopenharmony_ci	__le16   eir_len;
62362306a36Sopenharmony_ci	__u8     eir[];
62462306a36Sopenharmony_ci} __packed;
62562306a36Sopenharmony_ci
62662306a36Sopenharmony_ci#define MGMT_OP_SET_APPEARANCE		0x0043
62762306a36Sopenharmony_cistruct mgmt_cp_set_appearance {
62862306a36Sopenharmony_ci	__le16	appearance;
62962306a36Sopenharmony_ci} __packed;
63062306a36Sopenharmony_ci#define MGMT_SET_APPEARANCE_SIZE	2
63162306a36Sopenharmony_ci
63262306a36Sopenharmony_ci#define MGMT_OP_GET_PHY_CONFIGURATION	0x0044
63362306a36Sopenharmony_cistruct mgmt_rp_get_phy_configuration {
63462306a36Sopenharmony_ci	__le32	supported_phys;
63562306a36Sopenharmony_ci	__le32	configurable_phys;
63662306a36Sopenharmony_ci	__le32	selected_phys;
63762306a36Sopenharmony_ci} __packed;
63862306a36Sopenharmony_ci#define MGMT_GET_PHY_CONFIGURATION_SIZE	0
63962306a36Sopenharmony_ci
64062306a36Sopenharmony_ci#define MGMT_PHY_BR_1M_1SLOT		BIT(0)
64162306a36Sopenharmony_ci#define MGMT_PHY_BR_1M_3SLOT		BIT(1)
64262306a36Sopenharmony_ci#define MGMT_PHY_BR_1M_5SLOT		BIT(2)
64362306a36Sopenharmony_ci#define MGMT_PHY_EDR_2M_1SLOT		BIT(3)
64462306a36Sopenharmony_ci#define MGMT_PHY_EDR_2M_3SLOT		BIT(4)
64562306a36Sopenharmony_ci#define MGMT_PHY_EDR_2M_5SLOT		BIT(5)
64662306a36Sopenharmony_ci#define MGMT_PHY_EDR_3M_1SLOT		BIT(6)
64762306a36Sopenharmony_ci#define MGMT_PHY_EDR_3M_3SLOT		BIT(7)
64862306a36Sopenharmony_ci#define MGMT_PHY_EDR_3M_5SLOT		BIT(8)
64962306a36Sopenharmony_ci#define MGMT_PHY_LE_1M_TX		BIT(9)
65062306a36Sopenharmony_ci#define MGMT_PHY_LE_1M_RX		BIT(10)
65162306a36Sopenharmony_ci#define MGMT_PHY_LE_2M_TX		BIT(11)
65262306a36Sopenharmony_ci#define MGMT_PHY_LE_2M_RX		BIT(12)
65362306a36Sopenharmony_ci#define MGMT_PHY_LE_CODED_TX		BIT(13)
65462306a36Sopenharmony_ci#define MGMT_PHY_LE_CODED_RX		BIT(14)
65562306a36Sopenharmony_ci
65662306a36Sopenharmony_ci#define MGMT_PHY_BREDR_MASK (MGMT_PHY_BR_1M_1SLOT | MGMT_PHY_BR_1M_3SLOT | \
65762306a36Sopenharmony_ci			     MGMT_PHY_BR_1M_5SLOT | MGMT_PHY_EDR_2M_1SLOT | \
65862306a36Sopenharmony_ci			     MGMT_PHY_EDR_2M_3SLOT | MGMT_PHY_EDR_2M_5SLOT | \
65962306a36Sopenharmony_ci			     MGMT_PHY_EDR_3M_1SLOT | MGMT_PHY_EDR_3M_3SLOT | \
66062306a36Sopenharmony_ci			     MGMT_PHY_EDR_3M_5SLOT)
66162306a36Sopenharmony_ci#define MGMT_PHY_LE_MASK (MGMT_PHY_LE_1M_TX | MGMT_PHY_LE_1M_RX | \
66262306a36Sopenharmony_ci			  MGMT_PHY_LE_2M_TX | MGMT_PHY_LE_2M_RX | \
66362306a36Sopenharmony_ci			  MGMT_PHY_LE_CODED_TX | MGMT_PHY_LE_CODED_RX)
66462306a36Sopenharmony_ci#define MGMT_PHY_LE_TX_MASK (MGMT_PHY_LE_1M_TX | MGMT_PHY_LE_2M_TX | \
66562306a36Sopenharmony_ci			     MGMT_PHY_LE_CODED_TX)
66662306a36Sopenharmony_ci#define MGMT_PHY_LE_RX_MASK (MGMT_PHY_LE_1M_RX | MGMT_PHY_LE_2M_RX | \
66762306a36Sopenharmony_ci			     MGMT_PHY_LE_CODED_RX)
66862306a36Sopenharmony_ci
66962306a36Sopenharmony_ci#define MGMT_OP_SET_PHY_CONFIGURATION	0x0045
67062306a36Sopenharmony_cistruct mgmt_cp_set_phy_configuration {
67162306a36Sopenharmony_ci	__le32	selected_phys;
67262306a36Sopenharmony_ci} __packed;
67362306a36Sopenharmony_ci#define MGMT_SET_PHY_CONFIGURATION_SIZE	4
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci#define MGMT_OP_SET_BLOCKED_KEYS	0x0046
67662306a36Sopenharmony_ci
67762306a36Sopenharmony_ci#define HCI_BLOCKED_KEY_TYPE_LINKKEY	0x00
67862306a36Sopenharmony_ci#define HCI_BLOCKED_KEY_TYPE_LTK	0x01
67962306a36Sopenharmony_ci#define HCI_BLOCKED_KEY_TYPE_IRK	0x02
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_cistruct mgmt_blocked_key_info {
68262306a36Sopenharmony_ci	__u8 type;
68362306a36Sopenharmony_ci	__u8 val[16];
68462306a36Sopenharmony_ci} __packed;
68562306a36Sopenharmony_ci
68662306a36Sopenharmony_cistruct mgmt_cp_set_blocked_keys {
68762306a36Sopenharmony_ci	__le16 key_count;
68862306a36Sopenharmony_ci	struct mgmt_blocked_key_info keys[];
68962306a36Sopenharmony_ci} __packed;
69062306a36Sopenharmony_ci#define MGMT_OP_SET_BLOCKED_KEYS_SIZE 2
69162306a36Sopenharmony_ci
69262306a36Sopenharmony_ci#define MGMT_OP_SET_WIDEBAND_SPEECH	0x0047
69362306a36Sopenharmony_ci
69462306a36Sopenharmony_ci#define MGMT_CAP_SEC_FLAGS		0x01
69562306a36Sopenharmony_ci#define MGMT_CAP_MAX_ENC_KEY_SIZE	0x02
69662306a36Sopenharmony_ci#define MGMT_CAP_SMP_MAX_ENC_KEY_SIZE	0x03
69762306a36Sopenharmony_ci#define MGMT_CAP_LE_TX_PWR		0x04
69862306a36Sopenharmony_ci
69962306a36Sopenharmony_ci#define MGMT_OP_READ_CONTROLLER_CAP	0x0048
70062306a36Sopenharmony_ci#define MGMT_READ_CONTROLLER_CAP_SIZE	0
70162306a36Sopenharmony_cistruct mgmt_rp_read_controller_cap {
70262306a36Sopenharmony_ci	__le16   cap_len;
70362306a36Sopenharmony_ci	__u8     cap[];
70462306a36Sopenharmony_ci} __packed;
70562306a36Sopenharmony_ci
70662306a36Sopenharmony_ci#define MGMT_OP_READ_EXP_FEATURES_INFO	0x0049
70762306a36Sopenharmony_ci#define MGMT_READ_EXP_FEATURES_INFO_SIZE 0
70862306a36Sopenharmony_cistruct mgmt_rp_read_exp_features_info {
70962306a36Sopenharmony_ci	__le16 feature_count;
71062306a36Sopenharmony_ci	struct {
71162306a36Sopenharmony_ci		__u8   uuid[16];
71262306a36Sopenharmony_ci		__le32 flags;
71362306a36Sopenharmony_ci	} features[];
71462306a36Sopenharmony_ci} __packed;
71562306a36Sopenharmony_ci
71662306a36Sopenharmony_ci#define MGMT_OP_SET_EXP_FEATURE		0x004a
71762306a36Sopenharmony_cistruct mgmt_cp_set_exp_feature {
71862306a36Sopenharmony_ci	__u8   uuid[16];
71962306a36Sopenharmony_ci	__u8   param[];
72062306a36Sopenharmony_ci} __packed;
72162306a36Sopenharmony_ci#define MGMT_SET_EXP_FEATURE_SIZE	16
72262306a36Sopenharmony_cistruct mgmt_rp_set_exp_feature {
72362306a36Sopenharmony_ci	__u8   uuid[16];
72462306a36Sopenharmony_ci	__le32 flags;
72562306a36Sopenharmony_ci} __packed;
72662306a36Sopenharmony_ci
72762306a36Sopenharmony_ci#define MGMT_OP_READ_DEF_SYSTEM_CONFIG	0x004b
72862306a36Sopenharmony_ci#define MGMT_READ_DEF_SYSTEM_CONFIG_SIZE	0
72962306a36Sopenharmony_ci
73062306a36Sopenharmony_ci#define MGMT_OP_SET_DEF_SYSTEM_CONFIG	0x004c
73162306a36Sopenharmony_ci#define MGMT_SET_DEF_SYSTEM_CONFIG_SIZE		0
73262306a36Sopenharmony_ci
73362306a36Sopenharmony_ci#define MGMT_OP_READ_DEF_RUNTIME_CONFIG	0x004d
73462306a36Sopenharmony_ci#define MGMT_READ_DEF_RUNTIME_CONFIG_SIZE	0
73562306a36Sopenharmony_ci
73662306a36Sopenharmony_ci#define MGMT_OP_SET_DEF_RUNTIME_CONFIG	0x004e
73762306a36Sopenharmony_ci#define MGMT_SET_DEF_RUNTIME_CONFIG_SIZE	0
73862306a36Sopenharmony_ci
73962306a36Sopenharmony_ci#define MGMT_OP_GET_DEVICE_FLAGS	0x004F
74062306a36Sopenharmony_ci#define MGMT_GET_DEVICE_FLAGS_SIZE	7
74162306a36Sopenharmony_cistruct mgmt_cp_get_device_flags {
74262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
74362306a36Sopenharmony_ci} __packed;
74462306a36Sopenharmony_cistruct mgmt_rp_get_device_flags {
74562306a36Sopenharmony_ci	struct mgmt_addr_info addr;
74662306a36Sopenharmony_ci	__le32 supported_flags;
74762306a36Sopenharmony_ci	__le32 current_flags;
74862306a36Sopenharmony_ci} __packed;
74962306a36Sopenharmony_ci
75062306a36Sopenharmony_ci#define MGMT_OP_SET_DEVICE_FLAGS	0x0050
75162306a36Sopenharmony_ci#define MGMT_SET_DEVICE_FLAGS_SIZE	11
75262306a36Sopenharmony_cistruct mgmt_cp_set_device_flags {
75362306a36Sopenharmony_ci	struct mgmt_addr_info addr;
75462306a36Sopenharmony_ci	__le32 current_flags;
75562306a36Sopenharmony_ci} __packed;
75662306a36Sopenharmony_cistruct mgmt_rp_set_device_flags {
75762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
75862306a36Sopenharmony_ci} __packed;
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ci#define MGMT_ADV_MONITOR_FEATURE_MASK_OR_PATTERNS    BIT(0)
76162306a36Sopenharmony_ci
76262306a36Sopenharmony_ci#define MGMT_OP_READ_ADV_MONITOR_FEATURES	0x0051
76362306a36Sopenharmony_ci#define MGMT_READ_ADV_MONITOR_FEATURES_SIZE	0
76462306a36Sopenharmony_cistruct mgmt_rp_read_adv_monitor_features {
76562306a36Sopenharmony_ci	__le32 supported_features;
76662306a36Sopenharmony_ci	__le32 enabled_features;
76762306a36Sopenharmony_ci	__le16 max_num_handles;
76862306a36Sopenharmony_ci	__u8 max_num_patterns;
76962306a36Sopenharmony_ci	__le16 num_handles;
77062306a36Sopenharmony_ci	__le16 handles[];
77162306a36Sopenharmony_ci}  __packed;
77262306a36Sopenharmony_ci
77362306a36Sopenharmony_cistruct mgmt_adv_pattern {
77462306a36Sopenharmony_ci	__u8 ad_type;
77562306a36Sopenharmony_ci	__u8 offset;
77662306a36Sopenharmony_ci	__u8 length;
77762306a36Sopenharmony_ci	__u8 value[31];
77862306a36Sopenharmony_ci} __packed;
77962306a36Sopenharmony_ci
78062306a36Sopenharmony_ci#define MGMT_OP_ADD_ADV_PATTERNS_MONITOR	0x0052
78162306a36Sopenharmony_cistruct mgmt_cp_add_adv_patterns_monitor {
78262306a36Sopenharmony_ci	__u8 pattern_count;
78362306a36Sopenharmony_ci	struct mgmt_adv_pattern patterns[];
78462306a36Sopenharmony_ci} __packed;
78562306a36Sopenharmony_ci#define MGMT_ADD_ADV_PATTERNS_MONITOR_SIZE	1
78662306a36Sopenharmony_cistruct mgmt_rp_add_adv_patterns_monitor {
78762306a36Sopenharmony_ci	__le16 monitor_handle;
78862306a36Sopenharmony_ci} __packed;
78962306a36Sopenharmony_ci
79062306a36Sopenharmony_ci#define MGMT_OP_REMOVE_ADV_MONITOR		0x0053
79162306a36Sopenharmony_cistruct mgmt_cp_remove_adv_monitor {
79262306a36Sopenharmony_ci	__le16 monitor_handle;
79362306a36Sopenharmony_ci} __packed;
79462306a36Sopenharmony_ci#define MGMT_REMOVE_ADV_MONITOR_SIZE		2
79562306a36Sopenharmony_cistruct mgmt_rp_remove_adv_monitor {
79662306a36Sopenharmony_ci	__le16 monitor_handle;
79762306a36Sopenharmony_ci} __packed;
79862306a36Sopenharmony_ci
79962306a36Sopenharmony_ci#define MGMT_OP_ADD_EXT_ADV_PARAMS		0x0054
80062306a36Sopenharmony_cistruct mgmt_cp_add_ext_adv_params {
80162306a36Sopenharmony_ci	__u8	instance;
80262306a36Sopenharmony_ci	__le32	flags;
80362306a36Sopenharmony_ci	__le16	duration;
80462306a36Sopenharmony_ci	__le16	timeout;
80562306a36Sopenharmony_ci	__le32	min_interval;
80662306a36Sopenharmony_ci	__le32	max_interval;
80762306a36Sopenharmony_ci	__s8	tx_power;
80862306a36Sopenharmony_ci} __packed;
80962306a36Sopenharmony_ci#define MGMT_ADD_EXT_ADV_PARAMS_MIN_SIZE	18
81062306a36Sopenharmony_cistruct mgmt_rp_add_ext_adv_params {
81162306a36Sopenharmony_ci	__u8	instance;
81262306a36Sopenharmony_ci	__s8	tx_power;
81362306a36Sopenharmony_ci	__u8	max_adv_data_len;
81462306a36Sopenharmony_ci	__u8	max_scan_rsp_len;
81562306a36Sopenharmony_ci} __packed;
81662306a36Sopenharmony_ci
81762306a36Sopenharmony_ci#define MGMT_OP_ADD_EXT_ADV_DATA		0x0055
81862306a36Sopenharmony_cistruct mgmt_cp_add_ext_adv_data {
81962306a36Sopenharmony_ci	__u8	instance;
82062306a36Sopenharmony_ci	__u8	adv_data_len;
82162306a36Sopenharmony_ci	__u8	scan_rsp_len;
82262306a36Sopenharmony_ci	__u8	data[];
82362306a36Sopenharmony_ci} __packed;
82462306a36Sopenharmony_ci#define MGMT_ADD_EXT_ADV_DATA_SIZE	3
82562306a36Sopenharmony_cistruct mgmt_rp_add_ext_adv_data {
82662306a36Sopenharmony_ci	__u8	instance;
82762306a36Sopenharmony_ci} __packed;
82862306a36Sopenharmony_ci
82962306a36Sopenharmony_cistruct mgmt_adv_rssi_thresholds {
83062306a36Sopenharmony_ci	__s8	high_threshold;
83162306a36Sopenharmony_ci	__le16	high_threshold_timeout;
83262306a36Sopenharmony_ci	__s8	low_threshold;
83362306a36Sopenharmony_ci	__le16	low_threshold_timeout;
83462306a36Sopenharmony_ci	__u8	sampling_period;
83562306a36Sopenharmony_ci} __packed;
83662306a36Sopenharmony_ci
83762306a36Sopenharmony_ci#define MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI	0x0056
83862306a36Sopenharmony_cistruct mgmt_cp_add_adv_patterns_monitor_rssi {
83962306a36Sopenharmony_ci	struct mgmt_adv_rssi_thresholds rssi;
84062306a36Sopenharmony_ci	__u8	pattern_count;
84162306a36Sopenharmony_ci	struct mgmt_adv_pattern patterns[];
84262306a36Sopenharmony_ci} __packed;
84362306a36Sopenharmony_ci#define MGMT_ADD_ADV_PATTERNS_MONITOR_RSSI_SIZE	8
84462306a36Sopenharmony_ci#define MGMT_OP_SET_MESH_RECEIVER		0x0057
84562306a36Sopenharmony_cistruct mgmt_cp_set_mesh {
84662306a36Sopenharmony_ci	__u8   enable;
84762306a36Sopenharmony_ci	__le16 window;
84862306a36Sopenharmony_ci	__le16 period;
84962306a36Sopenharmony_ci	__u8   num_ad_types;
85062306a36Sopenharmony_ci	__u8   ad_types[];
85162306a36Sopenharmony_ci} __packed;
85262306a36Sopenharmony_ci#define MGMT_SET_MESH_RECEIVER_SIZE	6
85362306a36Sopenharmony_ci
85462306a36Sopenharmony_ci#define MGMT_OP_MESH_READ_FEATURES	0x0058
85562306a36Sopenharmony_ci#define MGMT_MESH_READ_FEATURES_SIZE	0
85662306a36Sopenharmony_ci#define MESH_HANDLES_MAX	3
85762306a36Sopenharmony_cistruct mgmt_rp_mesh_read_features {
85862306a36Sopenharmony_ci	__le16	index;
85962306a36Sopenharmony_ci	__u8   max_handles;
86062306a36Sopenharmony_ci	__u8   used_handles;
86162306a36Sopenharmony_ci	__u8   handles[MESH_HANDLES_MAX];
86262306a36Sopenharmony_ci} __packed;
86362306a36Sopenharmony_ci
86462306a36Sopenharmony_ci#define MGMT_OP_MESH_SEND		0x0059
86562306a36Sopenharmony_cistruct mgmt_cp_mesh_send {
86662306a36Sopenharmony_ci	struct mgmt_addr_info addr;
86762306a36Sopenharmony_ci	__le64  instant;
86862306a36Sopenharmony_ci	__le16  delay;
86962306a36Sopenharmony_ci	__u8   cnt;
87062306a36Sopenharmony_ci	__u8   adv_data_len;
87162306a36Sopenharmony_ci	__u8   adv_data[];
87262306a36Sopenharmony_ci} __packed;
87362306a36Sopenharmony_ci#define MGMT_MESH_SEND_SIZE		19
87462306a36Sopenharmony_ci
87562306a36Sopenharmony_ci#define MGMT_OP_MESH_SEND_CANCEL	0x005A
87662306a36Sopenharmony_cistruct mgmt_cp_mesh_send_cancel {
87762306a36Sopenharmony_ci	__u8  handle;
87862306a36Sopenharmony_ci} __packed;
87962306a36Sopenharmony_ci#define MGMT_MESH_SEND_CANCEL_SIZE	1
88062306a36Sopenharmony_ci
88162306a36Sopenharmony_ci#define MGMT_EV_CMD_COMPLETE		0x0001
88262306a36Sopenharmony_cistruct mgmt_ev_cmd_complete {
88362306a36Sopenharmony_ci	__le16	opcode;
88462306a36Sopenharmony_ci	__u8	status;
88562306a36Sopenharmony_ci	__u8	data[];
88662306a36Sopenharmony_ci} __packed;
88762306a36Sopenharmony_ci
88862306a36Sopenharmony_ci#define MGMT_EV_CMD_STATUS		0x0002
88962306a36Sopenharmony_cistruct mgmt_ev_cmd_status {
89062306a36Sopenharmony_ci	__le16	opcode;
89162306a36Sopenharmony_ci	__u8	status;
89262306a36Sopenharmony_ci} __packed;
89362306a36Sopenharmony_ci
89462306a36Sopenharmony_ci#define MGMT_EV_CONTROLLER_ERROR	0x0003
89562306a36Sopenharmony_cistruct mgmt_ev_controller_error {
89662306a36Sopenharmony_ci	__u8	error_code;
89762306a36Sopenharmony_ci} __packed;
89862306a36Sopenharmony_ci
89962306a36Sopenharmony_ci#define MGMT_EV_INDEX_ADDED		0x0004
90062306a36Sopenharmony_ci
90162306a36Sopenharmony_ci#define MGMT_EV_INDEX_REMOVED		0x0005
90262306a36Sopenharmony_ci
90362306a36Sopenharmony_ci#define MGMT_EV_NEW_SETTINGS		0x0006
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_ci#define MGMT_EV_CLASS_OF_DEV_CHANGED	0x0007
90662306a36Sopenharmony_cistruct mgmt_ev_class_of_dev_changed {
90762306a36Sopenharmony_ci	__u8	dev_class[3];
90862306a36Sopenharmony_ci};
90962306a36Sopenharmony_ci
91062306a36Sopenharmony_ci#define MGMT_EV_LOCAL_NAME_CHANGED	0x0008
91162306a36Sopenharmony_cistruct mgmt_ev_local_name_changed {
91262306a36Sopenharmony_ci	__u8	name[MGMT_MAX_NAME_LENGTH];
91362306a36Sopenharmony_ci	__u8	short_name[MGMT_MAX_SHORT_NAME_LENGTH];
91462306a36Sopenharmony_ci} __packed;
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci#define MGMT_EV_NEW_LINK_KEY		0x0009
91762306a36Sopenharmony_cistruct mgmt_ev_new_link_key {
91862306a36Sopenharmony_ci	__u8	store_hint;
91962306a36Sopenharmony_ci	struct mgmt_link_key_info key;
92062306a36Sopenharmony_ci} __packed;
92162306a36Sopenharmony_ci
92262306a36Sopenharmony_ci#define MGMT_EV_NEW_LONG_TERM_KEY	0x000A
92362306a36Sopenharmony_cistruct mgmt_ev_new_long_term_key {
92462306a36Sopenharmony_ci	__u8	store_hint;
92562306a36Sopenharmony_ci	struct mgmt_ltk_info key;
92662306a36Sopenharmony_ci} __packed;
92762306a36Sopenharmony_ci
92862306a36Sopenharmony_ci#define MGMT_EV_DEVICE_CONNECTED	0x000B
92962306a36Sopenharmony_cistruct mgmt_ev_device_connected {
93062306a36Sopenharmony_ci	struct mgmt_addr_info addr;
93162306a36Sopenharmony_ci	__le32	flags;
93262306a36Sopenharmony_ci	__le16	eir_len;
93362306a36Sopenharmony_ci	__u8	eir[];
93462306a36Sopenharmony_ci} __packed;
93562306a36Sopenharmony_ci
93662306a36Sopenharmony_ci#define MGMT_DEV_DISCONN_UNKNOWN	0x00
93762306a36Sopenharmony_ci#define MGMT_DEV_DISCONN_TIMEOUT	0x01
93862306a36Sopenharmony_ci#define MGMT_DEV_DISCONN_LOCAL_HOST	0x02
93962306a36Sopenharmony_ci#define MGMT_DEV_DISCONN_REMOTE		0x03
94062306a36Sopenharmony_ci#define MGMT_DEV_DISCONN_AUTH_FAILURE	0x04
94162306a36Sopenharmony_ci#define MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND	0x05
94262306a36Sopenharmony_ci
94362306a36Sopenharmony_ci#define MGMT_EV_DEVICE_DISCONNECTED	0x000C
94462306a36Sopenharmony_cistruct mgmt_ev_device_disconnected {
94562306a36Sopenharmony_ci	struct mgmt_addr_info addr;
94662306a36Sopenharmony_ci	__u8	reason;
94762306a36Sopenharmony_ci} __packed;
94862306a36Sopenharmony_ci
94962306a36Sopenharmony_ci#define MGMT_EV_CONNECT_FAILED		0x000D
95062306a36Sopenharmony_cistruct mgmt_ev_connect_failed {
95162306a36Sopenharmony_ci	struct mgmt_addr_info addr;
95262306a36Sopenharmony_ci	__u8	status;
95362306a36Sopenharmony_ci} __packed;
95462306a36Sopenharmony_ci
95562306a36Sopenharmony_ci#define MGMT_EV_PIN_CODE_REQUEST	0x000E
95662306a36Sopenharmony_cistruct mgmt_ev_pin_code_request {
95762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
95862306a36Sopenharmony_ci	__u8	secure;
95962306a36Sopenharmony_ci} __packed;
96062306a36Sopenharmony_ci
96162306a36Sopenharmony_ci#define MGMT_EV_USER_CONFIRM_REQUEST	0x000F
96262306a36Sopenharmony_cistruct mgmt_ev_user_confirm_request {
96362306a36Sopenharmony_ci	struct mgmt_addr_info addr;
96462306a36Sopenharmony_ci	__u8	confirm_hint;
96562306a36Sopenharmony_ci	__le32	value;
96662306a36Sopenharmony_ci} __packed;
96762306a36Sopenharmony_ci
96862306a36Sopenharmony_ci#define MGMT_EV_USER_PASSKEY_REQUEST	0x0010
96962306a36Sopenharmony_cistruct mgmt_ev_user_passkey_request {
97062306a36Sopenharmony_ci	struct mgmt_addr_info addr;
97162306a36Sopenharmony_ci} __packed;
97262306a36Sopenharmony_ci
97362306a36Sopenharmony_ci#define MGMT_EV_AUTH_FAILED		0x0011
97462306a36Sopenharmony_cistruct mgmt_ev_auth_failed {
97562306a36Sopenharmony_ci	struct mgmt_addr_info addr;
97662306a36Sopenharmony_ci	__u8	status;
97762306a36Sopenharmony_ci} __packed;
97862306a36Sopenharmony_ci
97962306a36Sopenharmony_ci#define MGMT_DEV_FOUND_CONFIRM_NAME		BIT(0)
98062306a36Sopenharmony_ci#define MGMT_DEV_FOUND_LEGACY_PAIRING		BIT(1)
98162306a36Sopenharmony_ci#define MGMT_DEV_FOUND_NOT_CONNECTABLE		BIT(2)
98262306a36Sopenharmony_ci#define MGMT_DEV_FOUND_INITIATED_CONN		BIT(3)
98362306a36Sopenharmony_ci#define MGMT_DEV_FOUND_NAME_REQUEST_FAILED	BIT(4)
98462306a36Sopenharmony_ci#define MGMT_DEV_FOUND_SCAN_RSP			BIT(5)
98562306a36Sopenharmony_ci
98662306a36Sopenharmony_ci#define MGMT_EV_DEVICE_FOUND		0x0012
98762306a36Sopenharmony_cistruct mgmt_ev_device_found {
98862306a36Sopenharmony_ci	struct mgmt_addr_info addr;
98962306a36Sopenharmony_ci	__s8	rssi;
99062306a36Sopenharmony_ci	__le32	flags;
99162306a36Sopenharmony_ci	__le16	eir_len;
99262306a36Sopenharmony_ci	__u8	eir[];
99362306a36Sopenharmony_ci} __packed;
99462306a36Sopenharmony_ci
99562306a36Sopenharmony_ci#define MGMT_EV_DISCOVERING		0x0013
99662306a36Sopenharmony_cistruct mgmt_ev_discovering {
99762306a36Sopenharmony_ci	__u8	type;
99862306a36Sopenharmony_ci	__u8	discovering;
99962306a36Sopenharmony_ci} __packed;
100062306a36Sopenharmony_ci
100162306a36Sopenharmony_ci#define MGMT_EV_DEVICE_BLOCKED		0x0014
100262306a36Sopenharmony_cistruct mgmt_ev_device_blocked {
100362306a36Sopenharmony_ci	struct mgmt_addr_info addr;
100462306a36Sopenharmony_ci} __packed;
100562306a36Sopenharmony_ci
100662306a36Sopenharmony_ci#define MGMT_EV_DEVICE_UNBLOCKED	0x0015
100762306a36Sopenharmony_cistruct mgmt_ev_device_unblocked {
100862306a36Sopenharmony_ci	struct mgmt_addr_info addr;
100962306a36Sopenharmony_ci} __packed;
101062306a36Sopenharmony_ci
101162306a36Sopenharmony_ci#define MGMT_EV_DEVICE_UNPAIRED		0x0016
101262306a36Sopenharmony_cistruct mgmt_ev_device_unpaired {
101362306a36Sopenharmony_ci	struct mgmt_addr_info addr;
101462306a36Sopenharmony_ci} __packed;
101562306a36Sopenharmony_ci
101662306a36Sopenharmony_ci#define MGMT_EV_PASSKEY_NOTIFY		0x0017
101762306a36Sopenharmony_cistruct mgmt_ev_passkey_notify {
101862306a36Sopenharmony_ci	struct mgmt_addr_info addr;
101962306a36Sopenharmony_ci	__le32	passkey;
102062306a36Sopenharmony_ci	__u8	entered;
102162306a36Sopenharmony_ci} __packed;
102262306a36Sopenharmony_ci
102362306a36Sopenharmony_ci#define MGMT_EV_NEW_IRK			0x0018
102462306a36Sopenharmony_cistruct mgmt_ev_new_irk {
102562306a36Sopenharmony_ci	__u8     store_hint;
102662306a36Sopenharmony_ci	bdaddr_t rpa;
102762306a36Sopenharmony_ci	struct mgmt_irk_info irk;
102862306a36Sopenharmony_ci} __packed;
102962306a36Sopenharmony_ci
103062306a36Sopenharmony_ci#define MGMT_CSRK_LOCAL_UNAUTHENTICATED		0x00
103162306a36Sopenharmony_ci#define MGMT_CSRK_REMOTE_UNAUTHENTICATED	0x01
103262306a36Sopenharmony_ci#define MGMT_CSRK_LOCAL_AUTHENTICATED		0x02
103362306a36Sopenharmony_ci#define MGMT_CSRK_REMOTE_AUTHENTICATED		0x03
103462306a36Sopenharmony_ci
103562306a36Sopenharmony_cistruct mgmt_csrk_info {
103662306a36Sopenharmony_ci	struct mgmt_addr_info addr;
103762306a36Sopenharmony_ci	__u8 type;
103862306a36Sopenharmony_ci	__u8 val[16];
103962306a36Sopenharmony_ci} __packed;
104062306a36Sopenharmony_ci
104162306a36Sopenharmony_ci#define MGMT_EV_NEW_CSRK		0x0019
104262306a36Sopenharmony_cistruct mgmt_ev_new_csrk {
104362306a36Sopenharmony_ci	__u8 store_hint;
104462306a36Sopenharmony_ci	struct mgmt_csrk_info key;
104562306a36Sopenharmony_ci} __packed;
104662306a36Sopenharmony_ci
104762306a36Sopenharmony_ci#define MGMT_EV_DEVICE_ADDED		0x001a
104862306a36Sopenharmony_cistruct mgmt_ev_device_added {
104962306a36Sopenharmony_ci	struct mgmt_addr_info addr;
105062306a36Sopenharmony_ci	__u8 action;
105162306a36Sopenharmony_ci} __packed;
105262306a36Sopenharmony_ci
105362306a36Sopenharmony_ci#define MGMT_EV_DEVICE_REMOVED		0x001b
105462306a36Sopenharmony_cistruct mgmt_ev_device_removed {
105562306a36Sopenharmony_ci	struct mgmt_addr_info addr;
105662306a36Sopenharmony_ci} __packed;
105762306a36Sopenharmony_ci
105862306a36Sopenharmony_ci#define MGMT_EV_NEW_CONN_PARAM		0x001c
105962306a36Sopenharmony_cistruct mgmt_ev_new_conn_param {
106062306a36Sopenharmony_ci	struct mgmt_addr_info addr;
106162306a36Sopenharmony_ci	__u8 store_hint;
106262306a36Sopenharmony_ci	__le16 min_interval;
106362306a36Sopenharmony_ci	__le16 max_interval;
106462306a36Sopenharmony_ci	__le16 latency;
106562306a36Sopenharmony_ci	__le16 timeout;
106662306a36Sopenharmony_ci} __packed;
106762306a36Sopenharmony_ci
106862306a36Sopenharmony_ci#define MGMT_EV_UNCONF_INDEX_ADDED	0x001d
106962306a36Sopenharmony_ci
107062306a36Sopenharmony_ci#define MGMT_EV_UNCONF_INDEX_REMOVED	0x001e
107162306a36Sopenharmony_ci
107262306a36Sopenharmony_ci#define MGMT_EV_NEW_CONFIG_OPTIONS	0x001f
107362306a36Sopenharmony_ci
107462306a36Sopenharmony_cistruct mgmt_ev_ext_index {
107562306a36Sopenharmony_ci	__u8 type;
107662306a36Sopenharmony_ci	__u8 bus;
107762306a36Sopenharmony_ci} __packed;
107862306a36Sopenharmony_ci
107962306a36Sopenharmony_ci#define MGMT_EV_EXT_INDEX_ADDED		0x0020
108062306a36Sopenharmony_ci
108162306a36Sopenharmony_ci#define MGMT_EV_EXT_INDEX_REMOVED	0x0021
108262306a36Sopenharmony_ci
108362306a36Sopenharmony_ci#define MGMT_EV_LOCAL_OOB_DATA_UPDATED	0x0022
108462306a36Sopenharmony_cistruct mgmt_ev_local_oob_data_updated {
108562306a36Sopenharmony_ci	__u8    type;
108662306a36Sopenharmony_ci	__le16	eir_len;
108762306a36Sopenharmony_ci	__u8	eir[];
108862306a36Sopenharmony_ci} __packed;
108962306a36Sopenharmony_ci
109062306a36Sopenharmony_ci#define MGMT_EV_ADVERTISING_ADDED	0x0023
109162306a36Sopenharmony_cistruct mgmt_ev_advertising_added {
109262306a36Sopenharmony_ci	__u8    instance;
109362306a36Sopenharmony_ci} __packed;
109462306a36Sopenharmony_ci
109562306a36Sopenharmony_ci#define MGMT_EV_ADVERTISING_REMOVED	0x0024
109662306a36Sopenharmony_cistruct mgmt_ev_advertising_removed {
109762306a36Sopenharmony_ci	__u8    instance;
109862306a36Sopenharmony_ci} __packed;
109962306a36Sopenharmony_ci
110062306a36Sopenharmony_ci#define MGMT_EV_EXT_INFO_CHANGED	0x0025
110162306a36Sopenharmony_cistruct mgmt_ev_ext_info_changed {
110262306a36Sopenharmony_ci	__le16	eir_len;
110362306a36Sopenharmony_ci	__u8	eir[];
110462306a36Sopenharmony_ci} __packed;
110562306a36Sopenharmony_ci
110662306a36Sopenharmony_ci#define MGMT_EV_PHY_CONFIGURATION_CHANGED	0x0026
110762306a36Sopenharmony_cistruct mgmt_ev_phy_configuration_changed {
110862306a36Sopenharmony_ci	__le32	selected_phys;
110962306a36Sopenharmony_ci} __packed;
111062306a36Sopenharmony_ci
111162306a36Sopenharmony_ci#define MGMT_EV_EXP_FEATURE_CHANGED	0x0027
111262306a36Sopenharmony_cistruct mgmt_ev_exp_feature_changed {
111362306a36Sopenharmony_ci	__u8	uuid[16];
111462306a36Sopenharmony_ci	__le32	flags;
111562306a36Sopenharmony_ci} __packed;
111662306a36Sopenharmony_ci
111762306a36Sopenharmony_ci#define MGMT_EV_DEVICE_FLAGS_CHANGED		0x002a
111862306a36Sopenharmony_cistruct mgmt_ev_device_flags_changed {
111962306a36Sopenharmony_ci	struct mgmt_addr_info addr;
112062306a36Sopenharmony_ci	__le32 supported_flags;
112162306a36Sopenharmony_ci	__le32 current_flags;
112262306a36Sopenharmony_ci} __packed;
112362306a36Sopenharmony_ci
112462306a36Sopenharmony_ci#define MGMT_EV_ADV_MONITOR_ADDED	0x002b
112562306a36Sopenharmony_cistruct mgmt_ev_adv_monitor_added {
112662306a36Sopenharmony_ci	__le16 monitor_handle;
112762306a36Sopenharmony_ci}  __packed;
112862306a36Sopenharmony_ci
112962306a36Sopenharmony_ci#define MGMT_EV_ADV_MONITOR_REMOVED	0x002c
113062306a36Sopenharmony_cistruct mgmt_ev_adv_monitor_removed {
113162306a36Sopenharmony_ci	__le16 monitor_handle;
113262306a36Sopenharmony_ci}  __packed;
113362306a36Sopenharmony_ci
113462306a36Sopenharmony_ci#define MGMT_EV_CONTROLLER_SUSPEND		0x002d
113562306a36Sopenharmony_cistruct mgmt_ev_controller_suspend {
113662306a36Sopenharmony_ci	__u8	suspend_state;
113762306a36Sopenharmony_ci} __packed;
113862306a36Sopenharmony_ci
113962306a36Sopenharmony_ci#define MGMT_EV_CONTROLLER_RESUME		0x002e
114062306a36Sopenharmony_cistruct mgmt_ev_controller_resume {
114162306a36Sopenharmony_ci	__u8	wake_reason;
114262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
114362306a36Sopenharmony_ci} __packed;
114462306a36Sopenharmony_ci
114562306a36Sopenharmony_ci#define MGMT_WAKE_REASON_NON_BT_WAKE		0x0
114662306a36Sopenharmony_ci#define MGMT_WAKE_REASON_UNEXPECTED		0x1
114762306a36Sopenharmony_ci#define MGMT_WAKE_REASON_REMOTE_WAKE		0x2
114862306a36Sopenharmony_ci
114962306a36Sopenharmony_ci#define MGMT_EV_ADV_MONITOR_DEVICE_FOUND	0x002f
115062306a36Sopenharmony_cistruct mgmt_ev_adv_monitor_device_found {
115162306a36Sopenharmony_ci	__le16 monitor_handle;
115262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
115362306a36Sopenharmony_ci	__s8   rssi;
115462306a36Sopenharmony_ci	__le32 flags;
115562306a36Sopenharmony_ci	__le16 eir_len;
115662306a36Sopenharmony_ci	__u8   eir[];
115762306a36Sopenharmony_ci} __packed;
115862306a36Sopenharmony_ci
115962306a36Sopenharmony_ci#define MGMT_EV_ADV_MONITOR_DEVICE_LOST		0x0030
116062306a36Sopenharmony_cistruct mgmt_ev_adv_monitor_device_lost {
116162306a36Sopenharmony_ci	__le16 monitor_handle;
116262306a36Sopenharmony_ci	struct mgmt_addr_info addr;
116362306a36Sopenharmony_ci} __packed;
116462306a36Sopenharmony_ci
116562306a36Sopenharmony_ci#define MGMT_EV_MESH_DEVICE_FOUND	0x0031
116662306a36Sopenharmony_cistruct mgmt_ev_mesh_device_found {
116762306a36Sopenharmony_ci	struct mgmt_addr_info addr;
116862306a36Sopenharmony_ci	__s8	rssi;
116962306a36Sopenharmony_ci	__le64	instant;
117062306a36Sopenharmony_ci	__le32	flags;
117162306a36Sopenharmony_ci	__le16	eir_len;
117262306a36Sopenharmony_ci	__u8	eir[];
117362306a36Sopenharmony_ci} __packed;
117462306a36Sopenharmony_ci
117562306a36Sopenharmony_ci
117662306a36Sopenharmony_ci#define MGMT_EV_MESH_PACKET_CMPLT		0x0032
117762306a36Sopenharmony_cistruct mgmt_ev_mesh_pkt_cmplt {
117862306a36Sopenharmony_ci	__u8	handle;
117962306a36Sopenharmony_ci} __packed;
1180