diff --git a/drivers/nble/conn.c b/drivers/nble/conn.c index a6021339fd7..a07f9836e46 100644 --- a/drivers/nble/conn.c +++ b/drivers/nble/conn.c @@ -74,22 +74,22 @@ int bt_le_set_auto_conn(bt_addr_le_t *addr, return -ENOSYS; } -int bt_auth_cb_register(const struct bt_auth_cb *cb) +int bt_conn_auth_cb_register(const struct bt_conn_auth_cb *cb) { return -ENOSYS; } -int bt_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey) +int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey) { return -ENOSYS; } -int bt_auth_cancel(struct bt_conn *conn) +int bt_conn_auth_cancel(struct bt_conn *conn) { return -ENOSYS; } -int bt_auth_passkey_confirm(struct bt_conn *conn, bool match) +int bt_conn_auth_passkey_confirm(struct bt_conn *conn, bool match) { return -ENOSYS; } diff --git a/include/bluetooth/conn.h b/include/bluetooth/conn.h index 94fa32d9625..b931de097b9 100644 --- a/include/bluetooth/conn.h +++ b/include/bluetooth/conn.h @@ -254,7 +254,7 @@ void bt_conn_cb_register(struct bt_conn_cb *cb); #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) /** Authenticated pairing callback structure */ -struct bt_auth_cb { +struct bt_conn_auth_cb { void (*passkey_display)(struct bt_conn *conn, unsigned int passkey); void (*passkey_entry)(struct bt_conn *conn); void (*passkey_confirm)(struct bt_conn *conn, unsigned int passkey); @@ -273,19 +273,19 @@ struct bt_auth_cb { * * @return Zero on success or negative error code otherwise */ -int bt_auth_cb_register(const struct bt_auth_cb *cb); +int bt_conn_auth_cb_register(const struct bt_conn_auth_cb *cb); /** @brief Reply with entered passkey. * * This function should be called only after passkey_entry callback from - * bt_auth_cb structure was called. + * bt_conn_auth_cb structure was called. * * @param conn Connection object. * @param passkey Entered passkey. * * @return Zero on success or negative error code otherwise */ -int bt_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey); +int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey); /** @brief Cancel ongoing authenticated pairing. * @@ -295,33 +295,33 @@ int bt_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey); * * @return Zero on success or negative error code otherwise */ -int bt_auth_cancel(struct bt_conn *conn); +int bt_conn_auth_cancel(struct bt_conn *conn); /** @brief Reply if passkey was confirmed by user. * * This function should be called only after passkey_confirm callback from - * bt_auth_cb structure was called. If passkey is confirmed to match then match - * should be true. Otherwise match should be false. + * bt_conn_auth_cb structure was called. If passkey is confirmed to match + * then match should be true. Otherwise match should be false. * * @param conn Connection object. * @param match True if passkey was confirmed to match, false otherwise. * * @return Zero on success or negative error code otherwise */ -int bt_auth_passkey_confirm(struct bt_conn *conn, bool match); +int bt_conn_auth_passkey_confirm(struct bt_conn *conn, bool match); #if defined(CONFIG_BLUETOOTH_BREDR) /** @brief Reply with entered PIN code. * * This function should be called only after PIN code callback from - * bt_auth_cb structure was called. It's for legacy 2.0 devices. + * bt_conn_auth_cb structure was called. It's for legacy 2.0 devices. * * @param conn Connection object. * @param pin Entered PIN code. * * @return Zero on success or negative error code otherwise */ -int bt_auth_pincode_entry(struct bt_conn *conn, const char *pin); +int bt_conn_auth_pincode_entry(struct bt_conn *conn, const char *pin); #endif /* CONFIG_BLUETOOTH_BREDR */ #endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */ diff --git a/net/bluetooth/conn.c b/net/bluetooth/conn.c index a1ac99d58d4..0128a364537 100644 --- a/net/bluetooth/conn.c +++ b/net/bluetooth/conn.c @@ -56,7 +56,7 @@ static NET_BUF_POOL(dummy_pool, CONFIG_BLUETOOTH_MAX_CONN, 0, &dummy, NULL, 0); #define CONN_TIMEOUT (3 * sys_clock_ticks_per_sec) #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) -const struct bt_auth_cb *bt_auth; +const struct bt_conn_auth_cb *bt_auth; #endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */ static struct bt_conn conns[CONFIG_BLUETOOTH_MAX_CONN]; @@ -1013,7 +1013,7 @@ struct net_buf *bt_conn_create_pdu(struct nano_fifo *fifo, size_t reserve) } #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) -int bt_auth_cb_register(const struct bt_auth_cb *cb) +int bt_conn_auth_cb_register(const struct bt_conn_auth_cb *cb) { if (!cb) { bt_auth = NULL; @@ -1073,7 +1073,7 @@ static int pin_code_reply(struct bt_conn *conn, const char *pin, uint8_t len) return bt_hci_cmd_send_sync(BT_HCI_OP_PIN_CODE_REPLY, buf, NULL); } -int bt_auth_pincode_entry(struct bt_conn *conn, const char *pin) +int bt_conn_auth_pincode_entry(struct bt_conn *conn, const char *pin) { size_t len; @@ -1116,7 +1116,7 @@ void bt_conn_pin_code_req(struct bt_conn *conn) } #endif /* CONFIG_BLUETOOTH_BREDR */ -int bt_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey) +int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey) { if (!bt_auth) { return -EINVAL; @@ -1131,7 +1131,7 @@ int bt_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey) return -EINVAL; } -int bt_auth_passkey_confirm(struct bt_conn *conn, bool match) +int bt_conn_auth_passkey_confirm(struct bt_conn *conn, bool match) { if (!bt_auth) { return -EINVAL; @@ -1145,7 +1145,7 @@ int bt_auth_passkey_confirm(struct bt_conn *conn, bool match) return -EINVAL; } -int bt_auth_cancel(struct bt_conn *conn) +int bt_conn_auth_cancel(struct bt_conn *conn) { if (!bt_auth) { return -EINVAL; diff --git a/net/bluetooth/hci_core.h b/net/bluetooth/hci_core.h index c37aee28182..60cac8bc919 100644 --- a/net/bluetooth/hci_core.h +++ b/net/bluetooth/hci_core.h @@ -112,7 +112,7 @@ struct bt_dev { extern struct bt_dev bt_dev; #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) -extern const struct bt_auth_cb *bt_auth; +extern const struct bt_conn_auth_cb *bt_auth; #endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */ static inline int bt_addr_cmp(const bt_addr_t *a, const bt_addr_t *b) diff --git a/samples/bluetooth/nble/src/main.c b/samples/bluetooth/nble/src/main.c index ef7bf89b522..365bac6b396 100644 --- a/samples/bluetooth/nble/src/main.c +++ b/samples/bluetooth/nble/src/main.c @@ -452,7 +452,7 @@ static void auth_cancel(struct bt_conn *conn) printk("Pairing cancelled: %s\n", addr); } -static struct bt_auth_cb auth_cb_display = { +static struct bt_conn_auth_cb auth_cb_display = { .passkey_display = auth_passkey_display, .passkey_entry = NULL, .cancel = auth_cancel, @@ -478,7 +478,7 @@ void main(void) bt_gatt_register(attrs, ARRAY_SIZE(attrs)); bt_conn_cb_register(&conn_callbacks); - bt_auth_cb_register(&auth_cb_display); + bt_conn_auth_cb_register(&auth_cb_display); /* Implement notification. At the moment there is no suitable way * of starting delayed work so we do it here diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index c1f6e0c5db2..638e0b0e909 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -450,7 +450,7 @@ static void auth_cancel(struct bt_conn *conn) printk("Pairing cancelled: %s\n", addr); } -static struct bt_auth_cb auth_cb_display = { +static struct bt_conn_auth_cb auth_cb_display = { .passkey_display = auth_passkey_display, .passkey_entry = NULL, .cancel = auth_cancel, @@ -476,7 +476,7 @@ void main(void) bt_gatt_register(attrs, ARRAY_SIZE(attrs)); bt_conn_cb_register(&conn_callbacks); - bt_auth_cb_register(&auth_cb_display); + bt_conn_auth_cb_register(&auth_cb_display); /* Implement notification. At the moment there is no suitable way * of starting delayed work so we do it here diff --git a/samples/bluetooth/peripheral_sc_only/src/main.c b/samples/bluetooth/peripheral_sc_only/src/main.c index 363415928cf..9f7fb0735c8 100644 --- a/samples/bluetooth/peripheral_sc_only/src/main.c +++ b/samples/bluetooth/peripheral_sc_only/src/main.c @@ -145,7 +145,7 @@ static void auth_cancel(struct bt_conn *conn) printk("Pairing cancelled: %s\n", addr); } -static struct bt_auth_cb auth_cb_display = { +static struct bt_conn_auth_cb auth_cb_display = { .passkey_display = auth_passkey_display, .passkey_entry = NULL, .cancel = auth_cancel, @@ -169,7 +169,7 @@ void main(void) bt_gatt_register(attrs, ARRAY_SIZE(attrs)); - bt_auth_cb_register(&auth_cb_display); + bt_conn_auth_cb_register(&auth_cb_display); bt_conn_cb_register(&conn_callbacks); err = bt_le_adv_start(BT_LE_ADV(BT_LE_ADV_IND), ad, ARRAY_SIZE(ad), diff --git a/samples/bluetooth/shell/src/main.c b/samples/bluetooth/shell/src/main.c index 9609134f185..e2bb2cf2788 100644 --- a/samples/bluetooth/shell/src/main.c +++ b/samples/bluetooth/shell/src/main.c @@ -1113,7 +1113,7 @@ static void auth_pincode_entry(struct bt_conn *conn, bool highsec) } } -static struct bt_auth_cb auth_cb_display = { +static struct bt_conn_auth_cb auth_cb_display = { .passkey_display = auth_passkey_display, .passkey_entry = NULL, .passkey_confirm = NULL, @@ -1121,7 +1121,7 @@ static struct bt_auth_cb auth_cb_display = { .cancel = auth_cancel, }; -static struct bt_auth_cb auth_cb_display_yes_no = { +static struct bt_conn_auth_cb auth_cb_display_yes_no = { .passkey_display = auth_passkey_display, .passkey_entry = NULL, .passkey_confirm = auth_passkey_confirm, @@ -1129,7 +1129,7 @@ static struct bt_auth_cb auth_cb_display_yes_no = { .cancel = auth_cancel, }; -static struct bt_auth_cb auth_cb_input = { +static struct bt_conn_auth_cb auth_cb_input = { .passkey_display = NULL, .passkey_entry = auth_passkey_entry, .passkey_confirm = NULL, @@ -1137,7 +1137,7 @@ static struct bt_auth_cb auth_cb_input = { .cancel = auth_cancel, }; -static struct bt_auth_cb auth_cb_all = { +static struct bt_conn_auth_cb auth_cb_all = { .passkey_display = auth_passkey_display, .passkey_entry = auth_passkey_entry, .passkey_confirm = auth_passkey_confirm, @@ -1154,15 +1154,15 @@ static void cmd_auth(int argc, char *argv[]) } if (!strcmp(argv[1], "all")) { - bt_auth_cb_register(&auth_cb_all); + bt_conn_auth_cb_register(&auth_cb_all); } else if (!strcmp(argv[1], "input")) { - bt_auth_cb_register(&auth_cb_input); + bt_conn_auth_cb_register(&auth_cb_input); } else if (!strcmp(argv[1], "display")) { - bt_auth_cb_register(&auth_cb_display); + bt_conn_auth_cb_register(&auth_cb_display); } else if (!strcmp(argv[1], "yesno")) { - bt_auth_cb_register(&auth_cb_display_yes_no); + bt_conn_auth_cb_register(&auth_cb_display_yes_no); } else if (!strcmp(argv[1], "none")) { - bt_auth_cb_register(NULL); + bt_conn_auth_cb_register(NULL); } else { printk("auth [display, yesno, input, all, none] " "parameter required\n"); @@ -1186,7 +1186,7 @@ static void cmd_auth_cancel(int argc, char *argv[]) return; } - bt_auth_cancel(conn); + bt_conn_auth_cancel(conn); } static void cmd_auth_passkey_confirm(int argc, char *argv[]) @@ -1205,7 +1205,7 @@ static void cmd_auth_passkey_confirm(int argc, char *argv[]) match = !strcmp(argv[1], "true"); - bt_auth_passkey_confirm(default_conn, match); + bt_conn_auth_passkey_confirm(default_conn, match); } static void cmd_auth_passkey(int argc, char *argv[]) @@ -1228,7 +1228,7 @@ static void cmd_auth_passkey(int argc, char *argv[]) return; } - bt_auth_passkey_entry(default_conn, passkey); + bt_conn_auth_passkey_entry(default_conn, passkey); } static void cmd_auth_pincode(int argc, char *argv[]) @@ -1262,7 +1262,7 @@ static void cmd_auth_pincode(int argc, char *argv[]) printk("PIN code \"%s\" applied\n", argv[1]); - bt_auth_pincode_entry(conn, argv[1]); + bt_conn_auth_pincode_entry(conn, argv[1]); } diff --git a/samples/bluetooth/tester/src/gap.c b/samples/bluetooth/tester/src/gap.c index da48fbe17a4..0592fcc9d78 100644 --- a/samples/bluetooth/tester/src/gap.c +++ b/samples/bluetooth/tester/src/gap.c @@ -35,7 +35,7 @@ #define CONTROLLER_ADDR (&(bt_addr_t) {{1, 2, 3, 4, 5, 6}}) static atomic_t current_settings; -struct bt_auth_cb cb; +struct bt_conn_auth_cb cb; static void le_connected(struct bt_conn *conn, uint8_t err) { @@ -372,7 +372,7 @@ static void set_io_cap(const uint8_t *data, uint16_t len) /* Reset io cap requirements */ memset(&cb, 0, sizeof(cb)); - bt_auth_cb_register(NULL); + bt_conn_auth_cb_register(NULL); switch (cmd->io_cap) { case GAP_IO_CAP_DISPLAY_ONLY: @@ -397,7 +397,7 @@ static void set_io_cap(const uint8_t *data, uint16_t len) goto rsp; } - if (bt_auth_cb_register(&cb)) { + if (bt_conn_auth_cb_register(&cb)) { status = BTP_STATUS_FAILED; goto rsp; } @@ -445,7 +445,7 @@ static void passkey_entry(const uint8_t *data, uint16_t len) goto rsp; } - bt_auth_passkey_entry(conn, sys_le32_to_cpu(cmd->passkey)); + bt_conn_auth_passkey_entry(conn, sys_le32_to_cpu(cmd->passkey)); bt_conn_unref(conn); status = BTP_STATUS_SUCCESS;