path: root/src
diff options
authorJouni Malinen <j@w1.fi>2011-12-22 19:04:41 (GMT)
committerJouni Malinen <j@w1.fi>2011-12-22 19:04:41 (GMT)
commitb3bcc0f5195ab9e2dc7c6885afee30bcb66c9e5d (patch)
tree80676c5b626977a02dff46dd1cad1d9150d60723 /src
parenta601f71bc74f38549ed597ae4e30b130892f00c7 (diff)
P2P: Replace p2p_get_peer_info with p2p_peer_known when applicable
p2p_get_peer_info() was used in multiple places just to check whether a specific peer is known. This was not the designed use for the function, so introduce a simpler function for that purpose to make it obvious that the p2p_get_peer_info() function is actually used only in ctrl_iface.c. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
2 files changed, 14 insertions, 0 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 9fcc6ca..a9d5998 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -3216,6 +3216,12 @@ int p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next,
+int p2p_peer_known(struct p2p_data *p2p, const u8 *addr)
+ return p2p_get_device(p2p, addr) != NULL;
void p2p_set_client_discoverability(struct p2p_data *p2p, int enabled)
if (enabled) {
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 3db0ac5..99934bd 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1428,6 +1428,14 @@ int p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next,
char *buf, size_t buflen);
+ * p2p_peer_known - Check whether P2P peer is known
+ * @p2p: P2P module context from p2p_init()
+ * @addr: P2P Device Address of the peer
+ * Returns: 1 if the specified device is in the P2P peer table or 0 if not
+ */
+int p2p_peer_known(struct p2p_data *p2p, const u8 *addr);
* p2p_set_client_discoverability - Set client discoverability capability
* @p2p: P2P module context from p2p_init()
* @enabled: Whether client discoverability will be enabled