P2P: Allow access to group members

Some new code will require access to P2P group members, so add API to
retrieve the number of members and iterate the members themselves.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2010-12-17 18:34:16 +02:00 committed by Jouni Malinen
parent 0423d090ce
commit 5efa9e2a4b
2 changed files with 40 additions and 0 deletions

View file

@ -1324,4 +1324,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()
* Returns: Number of members in the group
*/
unsigned int p2p_get_group_num_members(struct p2p_group *group);
/**
* p2p_iterate_group_members - Iterate group members
* @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 P2P Interface Address for each call and %NULL for no more members
*/
const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next);
#endif /* P2P_H */

View file

@ -647,3 +647,27 @@ 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;
}