From patchwork Tue May 20 11:51:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Bursztyka X-Patchwork-Id: 350672 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5946F140086 for ; Tue, 20 May 2014 21:52:10 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 262CE9D1F4; Tue, 20 May 2014 07:52:08 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eXuPMH3Ct8In; Tue, 20 May 2014 07:52:07 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 6BDFF17C004; Tue, 20 May 2014 07:52:03 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7C3CB17C006 for ; Tue, 20 May 2014 07:52:01 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yGCUOSvQExa0 for ; Tue, 20 May 2014 07:51:54 -0400 (EDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A4BE617C003 for ; Tue, 20 May 2014 07:51:54 -0400 (EDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 20 May 2014 04:51:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,873,1392192000"; d="scan'208";a="534785611" Received: from rd-190.fi.intel.com ([10.237.72.158]) by fmsmga001.fm.intel.com with ESMTP; 20 May 2014 04:51:25 -0700 From: Tomasz Bursztyka To: hostap@lists.shmoo.com Subject: [PATCH 6/7] p2p: Add a utility function to run a method on every known peers Date: Tue, 20 May 2014 14:51:13 +0300 Message-Id: <1400586674-18542-7-git-send-email-tomasz.bursztyka@linux.intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1400586674-18542-1-git-send-email-tomasz.bursztyka@linux.intel.com> References: <1400586674-18542-1-git-send-email-tomasz.bursztyka@linux.intel.com> Cc: eduardoabinader@gmail.com X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com This will be useful in wpa_supplicant part to signal if a peer got its group changed Signed-off-by: Tomasz Bursztyka --- src/p2p/p2p.c | 18 ++++++++++++++++++ src/p2p/p2p.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 7361bac..2a0d028 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -4692,3 +4692,21 @@ void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id, } #endif /* CONFIG_WPS_NFC */ + +void p2p_loop_on_known_peers(struct p2p_data *p2p, + void (*peer_callback)(struct p2p_peer_info *, + void *), + void *user_data) +{ + struct p2p_device *dev, *n; + + if (peer_callback == NULL) + return; + + dl_list_for_each_safe(dev, n, &p2p->devices, struct p2p_device, list) { + if (dev == p2p->go_neg_peer) + continue; + + peer_callback(&dev->info, user_data); + } +} diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 43ac135..8002050 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1954,4 +1954,9 @@ void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id, int go_intent, const u8 *own_interface_addr); +void p2p_loop_on_known_peers(struct p2p_data *p2p, + void (*peer_callback)(struct p2p_peer_info *, + void *), + void *user_data); + #endif /* P2P_H */