[PATCH 02/10] wpa_supplicant: add P2P device driver priv

dvdspndl at gmail.com dvdspndl
Mon Feb 18 12:30:28 PST 2013


From: David Spinadel <david.spinadel at intel.com>

Add driver priv for P2P device in wpa_supplicant structure.
Add P2P dedicated wrappers for the driver API, and use p2p_drv_priv
instead of drv_priv.

Signed-off-by: David Spinadel <david.spinadel at intel.com>
---
 wpa_supplicant/driver_i.h         |   64 +++++++++++++++++++++++++++++++++++++
 wpa_supplicant/wpa_supplicant_i.h |    2 ++
 2 files changed, 66 insertions(+)

diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 847600d..29113ff 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -689,4 +689,68 @@ static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
 				       buf_len);
 }
 
+static inline void *wpa_p2p_get_priv(struct wpa_supplicant *wpa_s)
+{
+	return wpa_s->p2p_drv_priv ? wpa_s->p2p_drv_priv : wpa_s->drv_priv;
+}
+
+static inline int wpa_drv_p2p_scan(struct wpa_supplicant *wpa_s,
+				   struct wpa_driver_scan_params *params)
+{
+	if (wpa_s->driver->scan2)
+		return wpa_s->driver->scan2(wpa_p2p_get_priv(wpa_s), params);
+	return -1;
+}
+
+static inline int wpa_drv_p2p_send_mlme(struct wpa_supplicant *wpa_s,
+					const u8 *data, size_t data_len,
+					int noack)
+{
+	if (wpa_s->driver->send_mlme)
+		return wpa_s->driver->send_mlme(wpa_p2p_get_priv(wpa_s), data,
+						data_len, noack);
+	return -1;
+}
+
+static inline int wpa_drv_p2p_send_action(struct wpa_supplicant *wpa_s,
+					  unsigned int freq,
+					  unsigned int wait,
+					  const u8 *dst, const u8 *src,
+					  const u8 *bssid,
+					  const u8 *data, size_t data_len,
+					  int no_cck)
+{
+	if (wpa_s->driver->send_action)
+		return wpa_s->driver->send_action(wpa_p2p_get_priv(wpa_s), freq,
+						  wait, dst, src, bssid,
+						  data, data_len, no_cck);
+	return -1;
+}
+
+static inline void
+wpa_drv_p2p_send_action_cancel_wait(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->send_action_cancel_wait)
+		wpa_s->driver->send_action_cancel_wait(wpa_p2p_get_priv(wpa_s));
+}
+
+static inline int wpa_drv_p2p_remain_on_channel(struct wpa_supplicant *wpa_s,
+						unsigned int freq,
+						unsigned int duration)
+{
+	if (wpa_s->driver->remain_on_channel)
+		return wpa_s->driver->remain_on_channel(wpa_p2p_get_priv(wpa_s),
+							freq, duration);
+	return -1;
+}
+
+static inline int
+wpa_drv_p2p_cancel_remain_on_channel(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->cancel_remain_on_channel)
+		return wpa_s->driver->cancel_remain_on_channel(
+						wpa_p2p_get_priv(wpa_s));
+	return -1;
+}
+
 #endif /* DRIVER_I_H */
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index bdba45d..eff5f71 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -623,6 +623,8 @@ struct wpa_supplicant {
 	int p2p_go_intent;
 	int p2p_connect_freq;
 	struct os_time p2p_auto_started;
+
+	void *p2p_drv_priv; /* private data used by driver_ops for p2p device*/
 #endif /* CONFIG_P2P */
 
 	struct wpa_ssid *bgscan_ssid;
-- 
1.7.10.msysgit.1




More information about the Hostap mailing list