#define ZERO_KEY "\x00\x00\x00\x00\x00\x00\x00\x00" \
"\x00\x00\x00\x00\x00\x00\x00\x00"
-struct pending_cmd {
+struct mgmt_pending_cmd {
struct list_head list;
u16 opcode;
int index;
size_t param_len;
struct sock *sk;
void *user_data;
- int (*cmd_complete)(struct pending_cmd *cmd, u8 status);
+ int (*cmd_complete)(struct mgmt_pending_cmd *cmd, u8 status);
};
/* HCI to MGMT error code conversion table */
return ptr;
}
-static struct pending_cmd *mgmt_pending_find(u16 opcode, struct hci_dev *hdev)
+static struct mgmt_pending_cmd *mgmt_pending_find(u16 opcode,
+ struct hci_dev *hdev)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
if (cmd->opcode == opcode)
return NULL;
}
-static struct pending_cmd *mgmt_pending_find_data(u16 opcode,
- struct hci_dev *hdev,
- const void *data)
+static struct mgmt_pending_cmd *mgmt_pending_find_data(u16 opcode,
+ struct hci_dev *hdev,
+ const void *data)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
if (cmd->user_data != data)
static u8 get_adv_discov_flags(struct hci_dev *hdev)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
/* If there's a pending mgmt command the flags will not yet have
* their final values, so check for this first.
static bool get_connectable(struct hci_dev *hdev)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
/* If there's a pending mgmt command the flag will not yet have
* it's final value, so check for this first.
sizeof(rp));
}
-static void mgmt_pending_free(struct pending_cmd *cmd)
+static void mgmt_pending_free(struct mgmt_pending_cmd *cmd)
{
sock_put(cmd->sk);
kfree(cmd->param);
kfree(cmd);
}
-static struct pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
- struct hci_dev *hdev, void *data,
- u16 len)
+static struct mgmt_pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
+ struct hci_dev *hdev,
+ void *data, u16 len)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd)
}
static void mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev,
- void (*cb)(struct pending_cmd *cmd,
+ void (*cb)(struct mgmt_pending_cmd *cmd,
void *data),
void *data)
{
- struct pending_cmd *cmd, *tmp;
+ struct mgmt_pending_cmd *cmd, *tmp;
list_for_each_entry_safe(cmd, tmp, &hdev->mgmt_pending, list) {
if (opcode > 0 && cmd->opcode != opcode)
}
}
-static void mgmt_pending_remove(struct pending_cmd *cmd)
+static void mgmt_pending_remove(struct mgmt_pending_cmd *cmd)
{
list_del(&cmd->list);
mgmt_pending_free(cmd);
u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
int err;
BT_DBG("request for %s", hdev->name);
u8 mgmt_status;
};
-static void settings_rsp(struct pending_cmd *cmd, void *data)
+static void settings_rsp(struct mgmt_pending_cmd *cmd, void *data)
{
struct cmd_lookup *match = data;
mgmt_pending_free(cmd);
}
-static void cmd_status_rsp(struct pending_cmd *cmd, void *data)
+static void cmd_status_rsp(struct mgmt_pending_cmd *cmd, void *data)
{
u8 *status = data;
mgmt_pending_remove(cmd);
}
-static void cmd_complete_rsp(struct pending_cmd *cmd, void *data)
+static void cmd_complete_rsp(struct mgmt_pending_cmd *cmd, void *data)
{
if (cmd->cmd_complete) {
u8 *status = data;
cmd_status_rsp(cmd, data);
}
-static int generic_cmd_complete(struct pending_cmd *cmd, u8 status)
+static int generic_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status)
{
return mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, status,
cmd->param, cmd->param_len);
}
-static int addr_cmd_complete(struct pending_cmd *cmd, u8 status)
+static int addr_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status)
{
return mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, status,
cmd->param, sizeof(struct mgmt_addr_info));
static void set_discoverable_complete(struct hci_dev *hdev, u8 status,
u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct mgmt_mode *cp;
struct hci_request req;
bool changed;
u16 len)
{
struct mgmt_cp_set_discoverable *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
u16 timeout;
u8 scan;
static void set_connectable_complete(struct hci_dev *hdev, u8 status,
u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct mgmt_mode *cp;
bool conn_changed, discov_changed;
u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
u8 scan;
int err;
u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
u8 val, status;
int err;
static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
u8 status;
int err;
{
struct mgmt_mode *cp = data;
struct hci_cp_write_le_host_supported hci_cp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
int err;
u8 val, enabled;
*/
static bool pending_eir_or_class(struct hci_dev *hdev)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
switch (cmd->opcode) {
static void mgmt_class_complete(struct hci_dev *hdev, u16 mgmt_op, u8 status)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
hci_dev_lock(hdev);
static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{
struct mgmt_cp_add_uuid *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
struct bt_uuid *uuid;
int err;
u16 len)
{
struct mgmt_cp_remove_uuid *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct bt_uuid *match, *tmp;
u8 bt_uuid_any[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
struct hci_request req;
u16 len)
{
struct mgmt_cp_set_dev_class *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
int err;
struct mgmt_cp_unpair_device *cp = data;
struct mgmt_rp_unpair_device rp;
struct hci_cp_disconnect dc;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_conn *conn;
int err;
{
struct mgmt_cp_disconnect *cp = data;
struct mgmt_rp_disconnect rp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_conn *conn;
int err;
static int send_pin_code_neg_reply(struct sock *sk, struct hci_dev *hdev,
struct mgmt_cp_pin_code_neg_reply *cp)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
int err;
cmd = mgmt_pending_add(sk, MGMT_OP_PIN_CODE_NEG_REPLY, hdev, cp,
struct hci_conn *conn;
struct mgmt_cp_pin_code_reply *cp = data;
struct hci_cp_pin_code_reply reply;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
int err;
BT_DBG("");
NULL, 0);
}
-static struct pending_cmd *find_pairing(struct hci_conn *conn)
+static struct mgmt_pending_cmd *find_pairing(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
if (cmd->opcode != MGMT_OP_PAIR_DEVICE)
return NULL;
}
-static int pairing_complete(struct pending_cmd *cmd, u8 status)
+static int pairing_complete(struct mgmt_pending_cmd *cmd, u8 status)
{
struct mgmt_rp_pair_device rp;
struct hci_conn *conn = cmd->user_data;
void mgmt_smp_complete(struct hci_conn *conn, bool complete)
{
u8 status = complete ? MGMT_STATUS_SUCCESS : MGMT_STATUS_FAILED;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
cmd = find_pairing(conn);
if (cmd) {
static void pairing_complete_cb(struct hci_conn *conn, u8 status)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status %u", status);
static void le_pairing_complete_cb(struct hci_conn *conn, u8 status)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status %u", status);
{
struct mgmt_cp_pair_device *cp = data;
struct mgmt_rp_pair_device rp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
u8 sec_level, auth_type;
struct hci_conn *conn;
int err;
u16 len)
{
struct mgmt_addr_info *addr = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_conn *conn;
int err;
struct mgmt_addr_info *addr, u16 mgmt_op,
u16 hci_op, __le32 passkey)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_conn *conn;
int err;
static void set_name_complete(struct hci_dev *hdev, u8 status, u16 opcode)
{
struct mgmt_cp_set_local_name *cp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status 0x%02x", status);
u16 len)
{
struct mgmt_cp_set_local_name *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
int err;
static int read_local_oob_data(struct sock *sk, struct hci_dev *hdev,
void *data, u16 data_len)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
int err;
BT_DBG("%s", hdev->name);
static void start_discovery_complete(struct hci_dev *hdev, u8 status,
u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
unsigned long timeout;
BT_DBG("status %d", status);
void *data, u16 len)
{
struct mgmt_cp_start_discovery *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
u8 status;
int err;
return err;
}
-static int service_discovery_cmd_complete(struct pending_cmd *cmd, u8 status)
+static int service_discovery_cmd_complete(struct mgmt_pending_cmd *cmd,
+ u8 status)
{
return mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode, status,
cmd->param, 1);
void *data, u16 len)
{
struct mgmt_cp_start_service_discovery *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
const u16 max_uuid_count = ((U16_MAX - sizeof(*cp)) / 16);
u16 uuid_count, expected_len;
static void stop_discovery_complete(struct hci_dev *hdev, u8 status, u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status %d", status);
u16 len)
{
struct mgmt_cp_stop_discovery *mgmt_cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
int err;
u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
u8 val, enabled, status;
int err;
static void fast_connectable_complete(struct hci_dev *hdev, u8 status,
u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status 0x%02x", status);
void *data, u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
int err;
static void set_bredr_complete(struct hci_dev *hdev, u8 status, u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status 0x%02x", status);
static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
int err;
static void sc_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct mgmt_mode *cp;
BT_DBG("%s status %u", hdev->name, status);
void *data, u16 len)
{
struct mgmt_mode *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
u8 val;
int err;
return err;
}
-static int conn_info_cmd_complete(struct pending_cmd *cmd, u8 status)
+static int conn_info_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status)
{
struct hci_conn *conn = cmd->user_data;
struct mgmt_rp_get_conn_info rp;
u16 opcode)
{
struct hci_cp_read_rssi *cp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_conn *conn;
u16 handle;
u8 status;
struct hci_request req;
struct hci_cp_read_tx_power req_txp_cp;
struct hci_cp_read_rssi req_rssi_cp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
hci_req_init(&req, hdev);
req_rssi_cp.handle = cpu_to_le16(conn->handle);
return err;
}
-static int clock_info_cmd_complete(struct pending_cmd *cmd, u8 status)
+static int clock_info_cmd_complete(struct mgmt_pending_cmd *cmd, u8 status)
{
struct hci_conn *conn = cmd->user_data;
struct mgmt_rp_get_clock_info rp;
static void get_clock_info_complete(struct hci_dev *hdev, u8 status, u16 opcode)
{
struct hci_cp_read_clock *hci_cp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_conn *conn;
BT_DBG("%s status %u", hdev->name, status);
struct mgmt_cp_get_clock_info *cp = data;
struct mgmt_rp_get_clock_info rp;
struct hci_cp_read_clock hci_cp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
struct hci_conn *conn;
int err;
static void add_device_complete(struct hci_dev *hdev, u8 status, u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status 0x%02x", status);
void *data, u16 len)
{
struct mgmt_cp_add_device *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
u8 auto_conn, addr_type;
int err;
static void remove_device_complete(struct hci_dev *hdev, u8 status, u16 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("status 0x%02x", status);
void *data, u16 len)
{
struct mgmt_cp_remove_device *cp = data;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct hci_request req;
int err;
void mgmt_set_powered_failed(struct hci_dev *hdev, int err)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
u8 status;
cmd = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev);
sizeof(*ev) + eir_len, NULL);
}
-static void disconnect_rsp(struct pending_cmd *cmd, void *data)
+static void disconnect_rsp(struct mgmt_pending_cmd *cmd, void *data)
{
struct sock **sk = data;
mgmt_pending_remove(cmd);
}
-static void unpair_device_rsp(struct pending_cmd *cmd, void *data)
+static void unpair_device_rsp(struct mgmt_pending_cmd *cmd, void *data)
{
struct hci_dev *hdev = data;
struct mgmt_cp_unpair_device *cp = cmd->param;
bool mgmt_powering_down(struct hci_dev *hdev)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
struct mgmt_mode *cp;
cmd = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev);
{
u8 bdaddr_type = link_to_bdaddr(link_type, addr_type);
struct mgmt_cp_disconnect *cp;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
mgmt_pending_foreach(MGMT_OP_UNPAIR_DEVICE, hdev, unpair_device_rsp,
hdev);
void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 status)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_REPLY, hdev);
if (!cmd)
void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 status)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, hdev);
if (!cmd)
u8 link_type, u8 addr_type, u8 status,
u8 opcode)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
cmd = mgmt_pending_find(opcode, hdev);
if (!cmd)
void mgmt_auth_failed(struct hci_conn *conn, u8 hci_status)
{
struct mgmt_ev_auth_failed ev;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
u8 status = mgmt_status(hci_status);
bacpy(&ev.addr.bdaddr, &conn->dst);
hci_req_run(&req, NULL);
}
-static void sk_lookup(struct pending_cmd *cmd, void *data)
+static void sk_lookup(struct mgmt_pending_cmd *cmd, void *data)
{
struct cmd_lookup *match = data;
void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status)
{
struct mgmt_cp_set_local_name ev;
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
if (status)
return;
u8 *rand192, u8 *hash256, u8 *rand256,
u8 status)
{
- struct pending_cmd *cmd;
+ struct mgmt_pending_cmd *cmd;
BT_DBG("%s status %u", hdev->name, status);