Bluetooth: Add helper to iterate all key objects
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
b452d6f348
commit
3993814e94
|
@ -50,6 +50,18 @@ struct bt_keys *bt_keys_get_addr(const bt_addr_le_t *addr)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void bt_keys_foreach(int type, void (*func)(struct bt_keys *keys))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(key_pool); i++) {
|
||||
if ((key_pool[i].keys & type)) {
|
||||
func(&key_pool[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct bt_keys *bt_keys_find(int type, const bt_addr_le_t *addr)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -59,6 +59,8 @@ struct bt_keys {
|
|||
#endif /* CONFIG_BT_SMP_SC_ONLY */
|
||||
};
|
||||
|
||||
void bt_keys_foreach(int type, void (*func)(struct bt_keys *keys));
|
||||
|
||||
struct bt_keys *bt_keys_get_addr(const bt_addr_le_t *addr);
|
||||
struct bt_keys *bt_keys_get_type(int type, const bt_addr_le_t *addr);
|
||||
struct bt_keys *bt_keys_find(int type, const bt_addr_le_t *addr);
|
||||
|
|
Loading…
Reference in a new issue