diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-02-24 22:05:22 +0200 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2011-02-24 22:05:22 +0200 |
commit | c165d81eea6f794deddf77915f2d2cb8b1ac8dc5 (patch) | |
tree | 4701fe3ba91ce942dea59b61eb0c7294ebc35417 /src/p2p/p2p.c | |
parent | 8fd7dc1b1cb8bceae0b493fa724b5e076d45a42d (diff) | |
download | external_wpa_supplicant_8_ti-c165d81eea6f794deddf77915f2d2cb8b1ac8dc5.zip external_wpa_supplicant_8_ti-c165d81eea6f794deddf77915f2d2cb8b1ac8dc5.tar.gz external_wpa_supplicant_8_ti-c165d81eea6f794deddf77915f2d2cb8b1ac8dc5.tar.bz2 |
P2P: Add p2p_get_peer_found to get peer info
This will only retrieve information about peers that have been fully
discovered, not peers that are only half-discovered based on their Probe
Request frames.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'src/p2p/p2p.c')
-rw-r--r-- | src/p2p/p2p.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index d422499..76cdf27 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -3239,3 +3239,44 @@ const u8 * p2p_get_go_neg_peer(struct p2p_data *p2p) return NULL; return p2p->go_neg_peer->info.p2p_device_addr; } + + +const struct p2p_peer_info * +p2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next) +{ + struct p2p_device *dev; + + if (addr) { + dev = p2p_get_device(p2p, addr); + if (!dev) + return NULL; + + if (!next) { + if (dev->flags & P2P_DEV_PROBE_REQ_ONLY) + return NULL; + + return &dev->info; + } else { + do { + dev = dl_list_first(&dev->list, + struct p2p_device, + list); + if (&dev->list == &p2p->devices) + return NULL; + } while (dev->flags & P2P_DEV_PROBE_REQ_ONLY); + } + } else { + dev = dl_list_first(&p2p->devices, struct p2p_device, list); + if (!dev) + return NULL; + while (dev->flags & P2P_DEV_PROBE_REQ_ONLY) { + dev = dl_list_first(&dev->list, + struct p2p_device, + list); + if (&dev->list == &p2p->devices) + return NULL; + } + } + + return &dev->info; +} |