wiphy: add __iwd_device_foreach

This commit is contained in:
Denis Kenzior 2014-10-23 21:47:38 -05:00
parent c13103974c
commit 2d6a50bb27
2 changed files with 23 additions and 0 deletions

View File

@ -91,6 +91,26 @@ bool __iwd_device_append_properties(struct netdev *netdev,
return true;
}
void __iwd_device_foreach(iwd_device_foreach_func func, void *user_data)
{
const struct l_queue_entry *wiphy_entry;
for (wiphy_entry = l_queue_get_entries(wiphy_list); wiphy_entry;
wiphy_entry = wiphy_entry->next) {
struct wiphy *wiphy = wiphy_entry->data;
const struct l_queue_entry *netdev_entry;
netdev_entry = l_queue_get_entries(wiphy->netdev_list);
while (netdev_entry) {
struct netdev *netdev = netdev_entry->data;
func(netdev, user_data);
netdev_entry = netdev_entry->next;
}
}
}
static void device_emit_added(struct netdev *netdev)
{
struct l_dbus *dbus = dbus_get_bus();

View File

@ -25,6 +25,8 @@
struct netdev;
typedef void (*iwd_device_foreach_func)(struct netdev *, void *data);
bool wiphy_init(void);
bool wiphy_exit(void);
@ -34,3 +36,4 @@ void wiphy_set_ssid(const char *ssid);
bool __iwd_device_append_properties(struct netdev *netdev,
struct l_dbus_message_builder *builder);
void __iwd_device_foreach(iwd_device_foreach_func func, void *user_data);