P2P: Add a utility function to run a method on every known peer

This will be useful in wpa_supplicant part to signal if a peer got its
group changed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2014-06-02 17:42:07 +03:00 committed by Jouni Malinen
parent bf035663c9
commit 36716eef89
2 changed files with 18 additions and 0 deletions

View file

@ -4494,6 +4494,19 @@ void p2p_err(struct p2p_data *p2p, const char *fmt, ...)
}
void p2p_loop_on_known_peers(struct p2p_data *p2p,
void (*peer_callback)(struct p2p_peer_info *peer,
void *user_data),
void *user_data)
{
struct p2p_device *dev, *n;
dl_list_for_each_safe(dev, n, &p2p->devices, struct p2p_device, list) {
peer_callback(&dev->info, user_data);
}
}
#ifdef CONFIG_WPS_NFC
static struct wpabuf * p2p_build_nfc_handover(struct p2p_data *p2p,

View file

@ -1990,4 +1990,9 @@ void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id,
int p2p_set_passphrase_len(struct p2p_data *p2p, unsigned int len);
void p2p_loop_on_known_peers(struct p2p_data *p2p,
void (*peer_callback)(struct p2p_peer_info *peer,
void *user_data),
void *user_data);
#endif /* P2P_H */