[PATCH] P2P: allow access to group members
Johannes Berg
johannes
Fri Dec 17 06:37:00 PST 2010
From: Johannes Berg <johannes.berg at intel.com>
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
src/p2p/p2p.h | 16 ++++++++++++++++
src/p2p/p2p_group.c | 22 ++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 35e3a4b..56b4f3d 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1329,4 +1329,20 @@ void p2p_set_best_channels(struct p2p_data *p2p, int freq_24, int freq_5,
const u8 * p2p_get_go_neg_peer(struct p2p_data *p2p);
+/**
+ * p2p_get_group_num_members - get number of members in group
+ * @group: P2P group context from p2p_group_init()
+ */
+unsigned int p2p_get_group_num_members(struct p2p_group *group);
+
+/**
+ * p2p_iterate_group_members - iterate the members belonging to the provided group
+ * @group: P2P group context from p2p_group_init()
+ * @next: iteration pointer, must be a pointer to a void * that is set to %NULL
+ * on the first call and not modified later
+ * Returns a device address for each call
+ */
+const u8 *p2p_iterate_group_members(struct p2p_group *group,
+ void **next);
+
#endif /* P2P_H */
diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c
index 7d25885..0f5cc94 100644
--- a/src/p2p/p2p_group.c
+++ b/src/p2p/p2p_group.c
@@ -647,3 +647,25 @@ u8 p2p_group_presence_req(struct p2p_group *group,
return P2P_SC_SUCCESS;
}
+
+unsigned int p2p_get_group_num_members(struct p2p_group *group)
+{
+ return group->num_members;
+}
+
+const u8 *p2p_iterate_group_members(struct p2p_group *group, void **next)
+{
+ struct p2p_group_member *iter = *next;
+
+ if (!iter)
+ iter = group->members;
+ else
+ iter = iter->next;
+
+ *next = iter;
+
+ if (!iter)
+ return NULL;
+
+ return iter->addr;
+}
--
1.7.2.3
More information about the Hostap
mailing list