device: Add device_network_find

This commit is contained in:
Denis Kenzior 2016-09-19 20:19:34 -05:00
parent 29d5eeb3ca
commit dc3a6a2f77
2 changed files with 12 additions and 0 deletions

View File

@ -446,6 +446,14 @@ bool device_remove_state_watch(struct device *device, uint32_t id)
return watchlist_remove(&device->state_watches, id);
}
struct network *device_network_find(struct device *device, const char *ssid,
enum security security)
{
const char *path = iwd_network_get_path(device, ssid, security);
return l_hashmap_lookup(device->networks, path);
}
static void device_enter_state(struct device *device, enum device_state state)
{
struct l_dbus *dbus = dbus_get_bus();

View File

@ -22,6 +22,7 @@
#include <stdbool.h>
enum security;
struct scan_bss;
struct wiphy;
struct netdev;
@ -65,6 +66,9 @@ uint32_t device_add_state_watch(struct device *device,
device_destroy_func_t destroy);
bool device_remove_state_watch(struct device *device, uint32_t id);
struct network *device_network_find(struct device *device, const char *ssid,
enum security security);
void device_connect_network(struct device *device, struct network *network,
struct scan_bss *bss,
struct l_dbus_message *message);