diff --git a/include/bluetooth/hci.h b/include/bluetooth/hci.h index 3a95a21492..4223aea809 100644 --- a/include/bluetooth/hci.h +++ b/include/bluetooth/hci.h @@ -20,6 +20,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -40,6 +41,26 @@ typedef struct { #define BT_ADDR_ANY (&(bt_addr_t) {{0, 0, 0, 0, 0, 0} }) #define BT_ADDR_LE_ANY (&(bt_addr_le_t) { 0, {0, 0, 0, 0, 0, 0} }) +static inline int bt_addr_cmp(const bt_addr_t *a, const bt_addr_t *b) +{ + return memcmp(a, b, sizeof(*a)); +} + +static inline int bt_addr_le_cmp(const bt_addr_le_t *a, const bt_addr_le_t *b) +{ + return memcmp(a, b, sizeof(*a)); +} + +static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src) +{ + memcpy(dst, src, sizeof(*dst)); +} + +static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src) +{ + memcpy(dst, src, sizeof(*dst)); +} + /* HCI Error Codes */ #define BT_HCI_ERR_UNKNOWN_CONN_ID 0x02 #define BT_HCI_ERR_AUTHENTICATION_FAIL 0x05 diff --git a/net/bluetooth/hci_core.h b/net/bluetooth/hci_core.h index 39ad1cbcd4..7b457872bc 100644 --- a/net/bluetooth/hci_core.h +++ b/net/bluetooth/hci_core.h @@ -115,26 +115,6 @@ extern struct bt_dev bt_dev; 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) -{ - return memcmp(a, b, sizeof(*a)); -} - -static inline int bt_addr_le_cmp(const bt_addr_le_t *a, const bt_addr_le_t *b) -{ - return memcmp(a, b, sizeof(*a)); -} - -static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src) -{ - memcpy(dst, src, sizeof(*dst)); -} - -static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src) -{ - memcpy(dst, src, sizeof(*dst)); -} - static inline bool bt_addr_le_is_rpa(const bt_addr_le_t *addr) { if (addr->type != BT_ADDR_LE_RANDOM)