linux/net/bluetooth/mgmt.c

/*
   BlueZ - Bluetooth protocol stack for Linux

   Copyright (C) 2010  Nokia Corporation
   Copyright (C) 2011-2012 Intel Corporation

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2 as
   published by the Free Software Foundation;

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
   SOFTWARE IS DISCLAIMED.
*/

/* Bluetooth HCI Management interface */

#include <linux/module.h>
#include <asm/unaligned.h>

#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/hci_sock.h>
#include <net/bluetooth/l2cap.h>
#include <net/bluetooth/mgmt.h>

#include "smp.h"
#include "mgmt_util.h"
#include "mgmt_config.h"
#include "msft.h"
#include "eir.h"
#include "aosp.h"

#define MGMT_VERSION
#define MGMT_REVISION

static const u16 mgmt_commands[] =;

static const u16 mgmt_events[] =;

static const u16 mgmt_untrusted_commands[] =;

static const u16 mgmt_untrusted_events[] =;

#define CACHE_TIMEOUT

#define ZERO_KEY

/* HCI to MGMT error code conversion table */
static const u8 mgmt_status_table[] =;

static u8 mgmt_errno_status(int err)
{}

static u8 mgmt_status(int err)
{}

static int mgmt_index_event(u16 event, struct hci_dev *hdev, void *data,
			    u16 len, int flag)
{}

static int mgmt_limited_event(u16 event, struct hci_dev *hdev, void *data,
			      u16 len, int flag, struct sock *skip_sk)
{}

static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 len,
		      struct sock *skip_sk)
{}

static int mgmt_event_skb(struct sk_buff *skb, struct sock *skip_sk)
{}

static u8 le_addr_type(u8 mgmt_addr_type)
{}

void mgmt_fill_version_info(void *ver)
{}

static int read_version(struct sock *sk, struct hci_dev *hdev, void *data,
			u16 data_len)
{}

static int read_commands(struct sock *sk, struct hci_dev *hdev, void *data,
			 u16 data_len)
{}

static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,
			   u16 data_len)
{}

static int read_unconf_index_list(struct sock *sk, struct hci_dev *hdev,
				  void *data, u16 data_len)
{}

static int read_ext_index_list(struct sock *sk, struct hci_dev *hdev,
			       void *data, u16 data_len)
{}

static bool is_configured(struct hci_dev *hdev)
{}

static __le32 get_missing_options(struct hci_dev *hdev)
{}

static int new_options(struct hci_dev *hdev, struct sock *skip)
{}

static int send_options_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev)
{}

static int read_config_info(struct sock *sk, struct hci_dev *hdev,
			    void *data, u16 data_len)
{}

static u32 get_supported_phys(struct hci_dev *hdev)
{}

static u32 get_selected_phys(struct hci_dev *hdev)
{}

static u32 get_configurable_phys(struct hci_dev *hdev)
{}

static u32 get_supported_settings(struct hci_dev *hdev)
{}

static u32 get_current_settings(struct hci_dev *hdev)
{}

static struct mgmt_pending_cmd *pending_find(u16 opcode, struct hci_dev *hdev)
{}

u8 mgmt_get_adv_discov_flags(struct hci_dev *hdev)
{}

bool mgmt_get_connectable(struct hci_dev *hdev)
{}

static int service_cache_sync(struct hci_dev *hdev, void *data)
{}

static void service_cache_off(struct work_struct *work)
{}

static int rpa_expired_sync(struct hci_dev *hdev, void *data)
{}

static void rpa_expired(struct work_struct *work)
{}

static int set_discoverable_sync(struct hci_dev *hdev, void *data);

static void discov_off(struct work_struct *work)
{}

static int send_settings_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev);

static void mesh_send_complete(struct hci_dev *hdev,
			       struct mgmt_mesh_tx *mesh_tx, bool silent)
{}

static int mesh_send_done_sync(struct hci_dev *hdev, void *data)
{}

static int mesh_send_sync(struct hci_dev *hdev, void *data);
static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err);
static void mesh_next(struct hci_dev *hdev, void *data, int err)
{}

static void mesh_send_done(struct work_struct *work)
{}

static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev)
{}

static int read_controller_info(struct sock *sk, struct hci_dev *hdev,
				void *data, u16 data_len)
{}

static u16 append_eir_data_to_buf(struct hci_dev *hdev, u8 *eir)
{}

static int read_ext_controller_info(struct sock *sk, struct hci_dev *hdev,
				    void *data, u16 data_len)
{}

static int ext_info_changed(struct hci_dev *hdev, struct sock *skip)
{}

static int send_settings_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev)
{}

void mgmt_advertising_added(struct sock *sk, struct hci_dev *hdev, u8 instance)
{}

void mgmt_advertising_removed(struct sock *sk, struct hci_dev *hdev,
			      u8 instance)
{}

static void cancel_adv_timeout(struct hci_dev *hdev)
{}

/* This function requires the caller holds hdev->lock */
static void restart_le_actions(struct hci_dev *hdev)
{}

static int new_settings(struct hci_dev *hdev, struct sock *skip)
{}

static void mgmt_set_powered_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_powered_sync(struct hci_dev *hdev, void *data)
{}

static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,
		       u16 len)
{}

int mgmt_new_settings(struct hci_dev *hdev)
{}

struct cmd_lookup {};

static void settings_rsp(struct mgmt_pending_cmd *cmd, void *data)
{}

static void cmd_status_rsp(struct mgmt_pending_cmd *cmd, void *data)
{}

static void cmd_complete_rsp(struct mgmt_pending_cmd *cmd, void *data)
{}

static int generic_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status)
{}

static int addr_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status)
{}

static u8 mgmt_bredr_support(struct hci_dev *hdev)
{}

static u8 mgmt_le_support(struct hci_dev *hdev)
{}

static void mgmt_set_discoverable_complete(struct hci_dev *hdev, void *data,
					   int err)
{}

static int set_discoverable_sync(struct hci_dev *hdev, void *data)
{}

static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
			    u16 len)
{}

static void mgmt_set_connectable_complete(struct hci_dev *hdev, void *data,
					  int err)
{}

static int set_connectable_update_settings(struct hci_dev *hdev,
					   struct sock *sk, u8 val)
{}

static int set_connectable_sync(struct hci_dev *hdev, void *data)
{}

static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
			   u16 len)
{}

static int set_bondable(struct sock *sk, struct hci_dev *hdev, void *data,
			u16 len)
{}

static int set_link_security(struct sock *sk, struct hci_dev *hdev, void *data,
			     u16 len)
{}

static void set_ssp_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_ssp_sync(struct hci_dev *hdev, void *data)
{}

static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{}

static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{}

static void set_le_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_le_sync(struct hci_dev *hdev, void *data)
{}

static void set_mesh_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_mesh_sync(struct hci_dev *hdev, void *data)
{}

static int set_mesh(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{}

static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err)
{}

static int mesh_send_sync(struct hci_dev *hdev, void *data)
{}

static void send_count(struct mgmt_mesh_tx *mesh_tx, void *data)
{}

static int mesh_features(struct sock *sk, struct hci_dev *hdev,
			 void *data, u16 len)
{}

static int send_cancel(struct hci_dev *hdev, void *data)
{}

static int mesh_send_cancel(struct sock *sk, struct hci_dev *hdev,
			    void *data, u16 len)
{}

static int mesh_send(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{}

static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{}

/* This is a helper function to test for pending mgmt commands that can
 * cause CoD or EIR HCI commands. We can only allow one such pending
 * mgmt command at a time since otherwise we cannot easily track what
 * the current values are, will be, and based on that calculate if a new
 * HCI command needs to be sent and if yes with what value.
 */
static bool pending_eir_or_class(struct hci_dev *hdev)
{}

static const u8 bluetooth_base_uuid[] =;

static u8 get_uuid_size(const u8 *uuid)
{}

static void mgmt_class_complete(struct hci_dev *hdev, void *data, int err)
{}

static int add_uuid_sync(struct hci_dev *hdev, void *data)
{}

static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{}

static bool enable_service_cache(struct hci_dev *hdev)
{}

static int remove_uuid_sync(struct hci_dev *hdev, void *data)
{}

static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
		       u16 len)
{}

static int set_class_sync(struct hci_dev *hdev, void *data)
{}

static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
			 u16 len)
{}

static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
			  u16 len)
{}

static int device_unpaired(struct hci_dev *hdev, bdaddr_t *bdaddr,
			   u8 addr_type, struct sock *skip_sk)
{}

static void unpair_device_complete(struct hci_dev *hdev, void *data, int err)
{}

static int unpair_device_sync(struct hci_dev *hdev, void *data)
{}

static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
			 u16 len)
{}

static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
		      u16 len)
{}

static u8 link_to_bdaddr(u8 link_type, u8 addr_type)
{}

static int get_connections(struct sock *sk, struct hci_dev *hdev, void *data,
			   u16 data_len)
{}

static int send_pin_code_neg_reply(struct sock *sk, struct hci_dev *hdev,
				   struct mgmt_cp_pin_code_neg_reply *cp)
{}

static int pin_code_reply(struct sock *sk, struct hci_dev *hdev, void *data,
			  u16 len)
{}

static int set_io_capability(struct sock *sk, struct hci_dev *hdev, void *data,
			     u16 len)
{}

static struct mgmt_pending_cmd *find_pairing(struct hci_conn *conn)
{}

static int pairing_complete(struct mgmt_pending_cmd *cmd, u8 status)
{}

void mgmt_smp_complete(struct hci_conn *conn, bool complete)
{}

static void pairing_complete_cb(struct hci_conn *conn, u8 status)
{}

static void le_pairing_complete_cb(struct hci_conn *conn, u8 status)
{}

static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
		       u16 len)
{}

static int cancel_pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
			      u16 len)
{}

static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
			     struct mgmt_addr_info *addr, u16 mgmt_op,
			     u16 hci_op, __le32 passkey)
{}

static int pin_code_neg_reply(struct sock *sk, struct hci_dev *hdev,
			      void *data, u16 len)
{}

static int user_confirm_reply(struct sock *sk, struct hci_dev *hdev, void *data,
			      u16 len)
{}

static int user_confirm_neg_reply(struct sock *sk, struct hci_dev *hdev,
				  void *data, u16 len)
{}

static int user_passkey_reply(struct sock *sk, struct hci_dev *hdev, void *data,
			      u16 len)
{}

static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev,
				  void *data, u16 len)
{}

static int adv_expire_sync(struct hci_dev *hdev, u32 flags)
{}

static int name_changed_sync(struct hci_dev *hdev, void *data)
{}

static void set_name_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_name_sync(struct hci_dev *hdev, void *data)
{}

static int set_local_name(struct sock *sk, struct hci_dev *hdev, void *data,
			  u16 len)
{}

static int appearance_changed_sync(struct hci_dev *hdev, void *data)
{}

static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data,
			  u16 len)
{}

static int get_phy_configuration(struct sock *sk, struct hci_dev *hdev,
				 void *data, u16 len)
{}

int mgmt_phy_configuration_changed(struct hci_dev *hdev, struct sock *skip)
{}

static void set_default_phy_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_default_phy_sync(struct hci_dev *hdev, void *data)
{}

static int set_phy_configuration(struct sock *sk, struct hci_dev *hdev,
				 void *data, u16 len)
{}

static int set_blocked_keys(struct sock *sk, struct hci_dev *hdev, void *data,
			    u16 len)
{}

static int set_wideband_speech(struct sock *sk, struct hci_dev *hdev,
			       void *data, u16 len)
{}

static int read_controller_cap(struct sock *sk, struct hci_dev *hdev,
			       void *data, u16 data_len)
{}

#ifdef CONFIG_BT_FEATURE_DEBUG
/* d4992530-b9ec-469f-ab01-6c481c47da1c */
static const u8 debug_uuid[16] = {
	0x1c, 0xda, 0x47, 0x1c, 0x48, 0x6c, 0x01, 0xab,
	0x9f, 0x46, 0xec, 0xb9, 0x30, 0x25, 0x99, 0xd4,
};
#endif

/* 330859bc-7506-492d-9370-9a6f0614037f */
static const u8 quality_report_uuid[16] =;

/* a6695ace-ee7f-4fb9-881a-5fac66c629af */
static const u8 offload_codecs_uuid[16] =;

/* 671b10b5-42c0-4696-9227-eb28d1b049d6 */
static const u8 le_simultaneous_roles_uuid[16] =;

/* 15c0a148-c273-11ea-b3de-0242ac130004 */
static const u8 rpa_resolution_uuid[16] =;

/* 6fbaf188-05e0-496a-9885-d6ddfdb4e03e */
static const u8 iso_socket_uuid[16] =;

/* 2ce463d7-7a03-4d8d-bf05-5f24e8f36e76 */
static const u8 mgmt_mesh_uuid[16] =;

static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
				  void *data, u16 data_len)
{}

static int exp_ll_privacy_feature_changed(bool enabled, struct hci_dev *hdev,
					  struct sock *skip)
{}

static int exp_feature_changed(struct hci_dev *hdev, const u8 *uuid,
			       bool enabled, struct sock *skip)
{}

#define EXP_FEAT(_uuid, _set_func)

/* The zero key uuid is special. Multiple exp features are set through it. */
static int set_zero_key_func(struct sock *sk, struct hci_dev *hdev,
			     struct mgmt_cp_set_exp_feature *cp, u16 data_len)
{}

#ifdef CONFIG_BT_FEATURE_DEBUG
static int set_debug_func(struct sock *sk, struct hci_dev *hdev,
			  struct mgmt_cp_set_exp_feature *cp, u16 data_len)
{
	struct mgmt_rp_set_exp_feature rp;

	bool val, changed;
	int err;

	/* Command requires to use the non-controller index */
	if (hdev)
		return mgmt_cmd_status(sk, hdev->id,
				       MGMT_OP_SET_EXP_FEATURE,
				       MGMT_STATUS_INVALID_INDEX);

	/* Parameters are limited to a single octet */
	if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1)
		return mgmt_cmd_status(sk, MGMT_INDEX_NONE,
				       MGMT_OP_SET_EXP_FEATURE,
				       MGMT_STATUS_INVALID_PARAMS);

	/* Only boolean on/off is supported */
	if (cp->param[0] != 0x00 && cp->param[0] != 0x01)
		return mgmt_cmd_status(sk, MGMT_INDEX_NONE,
				       MGMT_OP_SET_EXP_FEATURE,
				       MGMT_STATUS_INVALID_PARAMS);

	val = !!cp->param[0];
	changed = val ? !bt_dbg_get() : bt_dbg_get();
	bt_dbg_set(val);

	memcpy(rp.uuid, debug_uuid, 16);
	rp.flags = cpu_to_le32(val ? BIT(0) : 0);

	hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS);

	err = mgmt_cmd_complete(sk, MGMT_INDEX_NONE,
				MGMT_OP_SET_EXP_FEATURE, 0,
				&rp, sizeof(rp));

	if (changed)
		exp_feature_changed(hdev, debug_uuid, val, sk);

	return err;
}
#endif

static int set_mgmt_mesh_func(struct sock *sk, struct hci_dev *hdev,
			      struct mgmt_cp_set_exp_feature *cp, u16 data_len)
{}

static int set_rpa_resolution_func(struct sock *sk, struct hci_dev *hdev,
				   struct mgmt_cp_set_exp_feature *cp,
				   u16 data_len)
{}

static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev,
				   struct mgmt_cp_set_exp_feature *cp,
				   u16 data_len)
{}

static int set_offload_codec_func(struct sock *sk, struct hci_dev *hdev,
				  struct mgmt_cp_set_exp_feature *cp,
				  u16 data_len)
{}

static int set_le_simultaneous_roles_func(struct sock *sk, struct hci_dev *hdev,
					  struct mgmt_cp_set_exp_feature *cp,
					  u16 data_len)
{}

#ifdef CONFIG_BT_LE
static int set_iso_socket_func(struct sock *sk, struct hci_dev *hdev,
			       struct mgmt_cp_set_exp_feature *cp, u16 data_len)
{}
#endif

static const struct mgmt_exp_feature {} exp_features[] =;

static int set_exp_feature(struct sock *sk, struct hci_dev *hdev,
			   void *data, u16 data_len)
{}

static u32 get_params_flags(struct hci_dev *hdev,
			    struct hci_conn_params *params)
{}

static int get_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
			    u16 data_len)
{}

static void device_flags_changed(struct sock *sk, struct hci_dev *hdev,
				 bdaddr_t *bdaddr, u8 bdaddr_type,
				 u32 supported_flags, u32 current_flags)
{}

static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
			    u16 len)
{}

static void mgmt_adv_monitor_added(struct sock *sk, struct hci_dev *hdev,
				   u16 handle)
{}

void mgmt_adv_monitor_removed(struct hci_dev *hdev, u16 handle)
{}

static int read_adv_mon_features(struct sock *sk, struct hci_dev *hdev,
				 void *data, u16 len)
{}

static void mgmt_add_adv_patterns_monitor_complete(struct hci_dev *hdev,
						   void *data, int status)
{}

static int mgmt_add_adv_patterns_monitor_sync(struct hci_dev *hdev, void *data)
{}

static int __add_adv_patterns_monitor(struct sock *sk, struct hci_dev *hdev,
				      struct adv_monitor *m, u8 status,
				      void *data, u16 len, u16 op)
{}

static void parse_adv_monitor_rssi(struct adv_monitor *m,
				   struct mgmt_adv_rssi_thresholds *rssi)
{}

static u8 parse_adv_monitor_pattern(struct adv_monitor *m, u8 pattern_count,
				    struct mgmt_adv_pattern *patterns)
{}

static int add_adv_patterns_monitor(struct sock *sk, struct hci_dev *hdev,
				    void *data, u16 len)
{}

static int add_adv_patterns_monitor_rssi(struct sock *sk, struct hci_dev *hdev,
					 void *data, u16 len)
{}

static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
					     void *data, int status)
{}

static int mgmt_remove_adv_monitor_sync(struct hci_dev *hdev, void *data)
{}

static int remove_adv_monitor(struct sock *sk, struct hci_dev *hdev,
			      void *data, u16 len)
{}

static void read_local_oob_data_complete(struct hci_dev *hdev, void *data, int err)
{}

static int read_local_oob_data_sync(struct hci_dev *hdev, void *data)
{}

static int read_local_oob_data(struct sock *sk, struct hci_dev *hdev,
			       void *data, u16 data_len)
{}

static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
			       void *data, u16 len)
{}

static int remove_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
				  void *data, u16 len)
{}

void mgmt_start_discovery_complete(struct hci_dev *hdev, u8 status)
{}

static bool discovery_type_is_valid(struct hci_dev *hdev, uint8_t type,
				    uint8_t *mgmt_status)
{}

static void start_discovery_complete(struct hci_dev *hdev, void *data, int err)
{}

static int start_discovery_sync(struct hci_dev *hdev, void *data)
{}

static int start_discovery_internal(struct sock *sk, struct hci_dev *hdev,
				    u16 op, void *data, u16 len)
{}

static int start_discovery(struct sock *sk, struct hci_dev *hdev,
			   void *data, u16 len)
{}

static int start_limited_discovery(struct sock *sk, struct hci_dev *hdev,
				   void *data, u16 len)
{}

static int start_service_discovery(struct sock *sk, struct hci_dev *hdev,
				   void *data, u16 len)
{}

void mgmt_stop_discovery_complete(struct hci_dev *hdev, u8 status)
{}

static void stop_discovery_complete(struct hci_dev *hdev, void *data, int err)
{}

static int stop_discovery_sync(struct hci_dev *hdev, void *data)
{}

static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
			  u16 len)
{}

static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
			u16 len)
{}

static int block_device(struct sock *sk, struct hci_dev *hdev, void *data,
			u16 len)
{}

static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data,
			  u16 len)
{}

static int set_device_id_sync(struct hci_dev *hdev, void *data)
{}

static int set_device_id(struct sock *sk, struct hci_dev *hdev, void *data,
			 u16 len)
{}

static void enable_advertising_instance(struct hci_dev *hdev, int err)
{}

static void set_advertising_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_adv_sync(struct hci_dev *hdev, void *data)
{}

static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data,
			   u16 len)
{}

static int set_static_address(struct sock *sk, struct hci_dev *hdev,
			      void *data, u16 len)
{}

static int set_scan_params(struct sock *sk, struct hci_dev *hdev,
			   void *data, u16 len)
{}

static void fast_connectable_complete(struct hci_dev *hdev, void *data, int err)
{}

static int write_fast_connectable_sync(struct hci_dev *hdev, void *data)
{}

static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev,
				void *data, u16 len)
{}

static void set_bredr_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_bredr_sync(struct hci_dev *hdev, void *data)
{}

static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{}

static void set_secure_conn_complete(struct hci_dev *hdev, void *data, int err)
{}

static int set_secure_conn_sync(struct hci_dev *hdev, void *data)
{}

static int set_secure_conn(struct sock *sk, struct hci_dev *hdev,
			   void *data, u16 len)
{}

static int set_debug_keys(struct sock *sk, struct hci_dev *hdev,
			  void *data, u16 len)
{}

static int set_privacy(struct sock *sk, struct hci_dev *hdev, void *cp_data,
		       u16 len)
{}

static bool irk_is_valid(struct mgmt_irk_info *irk)
{}

static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data,
		     u16 len)
{}

static bool ltk_is_valid(struct mgmt_ltk_info *key)
{}

static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
			       void *cp_data, u16 len)
{}

static void get_conn_info_complete(struct hci_dev *hdev, void *data, int err)
{}

static int get_conn_info_sync(struct hci_dev *hdev, void *data)
{}

static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data,
			 u16 len)
{}

static void get_clock_info_complete(struct hci_dev *hdev, void *data, int err)
{}

static int get_clock_info_sync(struct hci_dev *hdev, void *data)
{}

static int get_clock_info(struct sock *sk, struct hci_dev *hdev, void *data,
								u16 len)
{}

static bool is_connected(struct hci_dev *hdev, bdaddr_t *addr, u8 type)
{}

/* This function requires the caller holds hdev->lock */
static int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr,
			       u8 addr_type, u8 auto_connect)
{}

static void device_added(struct sock *sk, struct hci_dev *hdev,
			 bdaddr_t *bdaddr, u8 type, u8 action)
{}

static int add_device_sync(struct hci_dev *hdev, void *data)
{}

static int add_device(struct sock *sk, struct hci_dev *hdev,
		      void *data, u16 len)
{}

static void device_removed(struct sock *sk, struct hci_dev *hdev,
			   bdaddr_t *bdaddr, u8 type)
{}

static int remove_device_sync(struct hci_dev *hdev, void *data)
{}

static int remove_device(struct sock *sk, struct hci_dev *hdev,
			 void *data, u16 len)
{}

static int conn_update_sync(struct hci_dev *hdev, void *data)
{}

static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
			   u16 len)
{}

static int set_external_config(struct sock *sk, struct hci_dev *hdev,
			       void *data, u16 len)
{}

static int set_public_address(struct sock *sk, struct hci_dev *hdev,
			      void *data, u16 len)
{}

static void read_local_oob_ext_data_complete(struct hci_dev *hdev, void *data,
					     int err)
{}

static int read_local_ssp_oob_req(struct hci_dev *hdev, struct sock *sk,
				  struct mgmt_cp_read_local_oob_ext_data *cp)
{}

static int read_local_oob_ext_data(struct sock *sk, struct hci_dev *hdev,
				   void *data, u16 data_len)
{}

static u32 get_supported_adv_flags(struct hci_dev *hdev)
{}

static int read_adv_features(struct sock *sk, struct hci_dev *hdev,
			     void *data, u16 data_len)
{}

static u8 calculate_name_len(struct hci_dev *hdev)
{}

static u8 tlv_data_max_len(struct hci_dev *hdev, u32 adv_flags,
			   bool is_adv_data)
{}

static bool flags_managed(u32 adv_flags)
{}

static bool tx_power_managed(u32 adv_flags)
{}

static bool name_managed(u32 adv_flags)
{}

static bool appearance_managed(u32 adv_flags)
{}

static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,
			      u8 len, bool is_adv_data)
{}

static bool requested_adv_flags_are_valid(struct hci_dev *hdev, u32 adv_flags)
{}

static bool adv_busy(struct hci_dev *hdev)
{}

static void add_adv_complete(struct hci_dev *hdev, struct sock *sk, u8 instance,
			     int err)
{}

static void add_advertising_complete(struct hci_dev *hdev, void *data, int err)
{}

static int add_advertising_sync(struct hci_dev *hdev, void *data)
{}

static int add_advertising(struct sock *sk, struct hci_dev *hdev,
			   void *data, u16 data_len)
{}

static void add_ext_adv_params_complete(struct hci_dev *hdev, void *data,
					int err)
{}

static int add_ext_adv_params_sync(struct hci_dev *hdev, void *data)
{}

static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev,
			      void *data, u16 data_len)
{}

static void add_ext_adv_data_complete(struct hci_dev *hdev, void *data, int err)
{}

static int add_ext_adv_data_sync(struct hci_dev *hdev, void *data)
{}

static int add_ext_adv_data(struct sock *sk, struct hci_dev *hdev, void *data,
			    u16 data_len)
{}

static void remove_advertising_complete(struct hci_dev *hdev, void *data,
					int err)
{}

static int remove_advertising_sync(struct hci_dev *hdev, void *data)
{}

static int remove_advertising(struct sock *sk, struct hci_dev *hdev,
			      void *data, u16 data_len)
{}

static int get_adv_size_info(struct sock *sk, struct hci_dev *hdev,
			     void *data, u16 data_len)
{}

static const struct hci_mgmt_handler mgmt_handlers[] =;

void mgmt_index_added(struct hci_dev *hdev)
{}

void mgmt_index_removed(struct hci_dev *hdev)
{}

void mgmt_power_on(struct hci_dev *hdev, int err)
{}

void __mgmt_power_off(struct hci_dev *hdev)
{}

void mgmt_set_powered_failed(struct hci_dev *hdev, int err)
{}

void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
		       bool persistent)
{}

static u8 mgmt_ltk_type(struct smp_ltk *ltk)
{}

void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent)
{}

void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk, bool persistent)
{}

void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
		   bool persistent)
{}

void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
			 u8 bdaddr_type, u8 store_hint, u16 min_interval,
			 u16 max_interval, u16 latency, u16 timeout)
{}

void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
			   u8 *name, u8 name_len)
{}

static void disconnect_rsp(struct mgmt_pending_cmd *cmd, void *data)
{}

static void unpair_device_rsp(struct mgmt_pending_cmd *cmd, void *data)
{}

bool mgmt_powering_down(struct hci_dev *hdev)
{}

void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
			      u8 link_type, u8 addr_type, u8 reason,
			      bool mgmt_connected)
{}

void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
			    u8 link_type, u8 addr_type, u8 status)
{}

void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
			 u8 addr_type, u8 status)
{}

void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure)
{}

void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
				  u8 status)
{}

void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
				      u8 status)
{}

int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
			      u8 link_type, u8 addr_type, u32 value,
			      u8 confirm_hint)
{}

int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
			      u8 link_type, u8 addr_type)
{}

static int user_pairing_resp_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
				      u8 link_type, u8 addr_type, u8 status,
				      u8 opcode)
{}

int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
				     u8 link_type, u8 addr_type, u8 status)
{}

int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
					 u8 link_type, u8 addr_type, u8 status)
{}

int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
				     u8 link_type, u8 addr_type, u8 status)
{}

int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
					 u8 link_type, u8 addr_type, u8 status)
{}

int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
			     u8 link_type, u8 addr_type, u32 passkey,
			     u8 entered)
{}

void mgmt_auth_failed(struct hci_conn *conn, u8 hci_status)
{}

void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)
{}

static void sk_lookup(struct mgmt_pending_cmd *cmd, void *data)
{}

void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
				    u8 status)
{}

void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status)
{}

static inline bool has_uuid(u8 *uuid, u16 uuid_count, u8 (*uuids)[16])
{}

static bool eir_has_uuids(u8 *eir, u16 eir_len, u16 uuid_count, u8 (*uuids)[16])
{}

static bool is_filter_match(struct hci_dev *hdev, s8 rssi, u8 *eir,
			    u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len)
{}

void mgmt_adv_monitor_device_lost(struct hci_dev *hdev, u16 handle,
				  bdaddr_t *bdaddr, u8 addr_type)
{}

static void mgmt_send_adv_monitor_device_found(struct hci_dev *hdev,
					       struct sk_buff *skb,
					       struct sock *skip_sk,
					       u16 handle)
{}

static void mgmt_adv_monitor_device_found(struct hci_dev *hdev,
					  bdaddr_t *bdaddr, bool report_device,
					  struct sk_buff *skb,
					  struct sock *skip_sk)
{}

static void mesh_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr,
			      u8 addr_type, s8 rssi, u32 flags, u8 *eir,
			      u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len,
			      u64 instant)
{}

void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
		       u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
		       u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len,
		       u64 instant)
{}

void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
		      u8 addr_type, s8 rssi, u8 *name, u8 name_len)
{}

void mgmt_discovering(struct hci_dev *hdev, u8 discovering)
{}

void mgmt_suspending(struct hci_dev *hdev, u8 state)
{}

void mgmt_resuming(struct hci_dev *hdev, u8 reason, bdaddr_t *bdaddr,
		   u8 addr_type)
{}

static struct hci_mgmt_chan chan =;

int mgmt_init(void)
{}

void mgmt_exit(void)
{}

void mgmt_cleanup(struct sock *sk)
{}