diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index d0191e741..48f3aa652 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -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, diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 34734506a..16500a807 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -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 */