3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-18 18:29:29 +01:00

station: introduce station_network_foreach

Iterates all networks for a given station object.
This commit is contained in:
James Prestwood 2019-08-15 13:15:20 -07:00 committed by Denis Kenzior
parent 630c487534
commit c4771c4c5d
2 changed files with 30 additions and 0 deletions

View File

@ -2932,6 +2932,31 @@ struct station *station_find(uint32_t ifindex)
return NULL;
}
struct network_foreach_data {
station_network_foreach_func_t func;
void *user_data;
};
static void network_foreach(const void *key, void *value, void *user_data)
{
struct network_foreach_data *data = user_data;
struct network *network = value;
data->func(network, data->user_data);
}
void station_network_foreach(struct station *station,
station_network_foreach_func_t func,
void *user_data)
{
struct network_foreach_data data = {
.func = func,
.user_data = user_data,
};
l_hashmap_foreach(station->networks, network_foreach, &data);
}
static struct station *station_create(struct netdev *netdev)
{
struct station *station;

View File

@ -46,6 +46,7 @@ enum station_state {
typedef void (*station_foreach_func_t)(struct station *, void *data);
typedef void (*station_state_watch_func_t)(enum station_state, void *userdata);
typedef void (*station_destroy_func_t)(void *userdata);
typedef void (*station_network_foreach_func_t)(struct network *, void *data);
struct wiphy *station_get_wiphy(struct station *station);
struct netdev *station_get_netdev(struct station *station);
@ -80,3 +81,7 @@ int station_disconnect(struct station *station);
struct station *station_find(uint32_t ifindex);
void station_foreach(station_foreach_func_t func, void *user_data);
void station_network_foreach(struct station *station,
station_network_foreach_func_t func,
void *user_data);