aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-06-12 21:31:56 (GMT)
committerJouni Malinen <j@w1.fi>2011-06-12 21:31:56 (GMT)
commitdd8a7e054711c60fda83739ea19313ebab58d986 (patch)
treec419b95cd3faeb9876f796f0723ee1eac621f051
parent349b213cc8babdc0212938714104f7e28d34b335 (diff)
downloadhostap-dd8a7e054711c60fda83739ea19313ebab58d986.zip
hostap-dd8a7e054711c60fda83739ea19313ebab58d986.tar.gz
hostap-dd8a7e054711c60fda83739ea19313ebab58d986.tar.bz2
P2P: Add wpas_notify_p2p_provision_discovery()
Add a notification for P2P provision discovery status/result. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--wpa_supplicant/notify.c21
-rw-r--r--wpa_supplicant/notify.h7
-rw-r--r--wpa_supplicant/p2p_supplicant.c19
3 files changed, 47 insertions, 0 deletions
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 2053c3d..db3419c 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -415,6 +415,27 @@ void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
{
}
+
+/**
+ * wpas_notify_p2p_provision_discovery - Notification of provision discovery
+ * @dev_addr: Who sent the request or responded to our request.
+ * @request: Will be 1 if request, 0 for response.
+ * @status: Valid only in case of response (0 in case of success)
+ * @config_methods: WPS config methods
+ * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
+ *
+ * This can be used to notify:
+ * - Requests or responses
+ * - Various config methods
+ * - Failure condition in case of response
+ */
+void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
+ const u8 *dev_addr, int request,
+ enum p2p_prov_disc_status status,
+ u16 config_methods,
+ unsigned int generated_pin)
+{
+}
#endif /* CONFIG_P2P */
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 6c8fdf7..967aff2 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -15,6 +15,8 @@
#ifndef NOTIFY_H
#define NOTIFY_H
+#include "p2p/p2p.h"
+
struct wps_credential;
struct wps_event_m2d;
struct wps_event_fail;
@@ -101,5 +103,10 @@ void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
const u8 *sa, u16 update_indic,
const u8 *tlvs, size_t tlvs_len);
+void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
+ const u8 *dev_addr, int request,
+ enum p2p_prov_disc_status status,
+ u16 config_methods,
+ unsigned int generated_pin);
#endif /* NOTIFY_H */
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 03d1672..9a73090 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -1893,6 +1893,10 @@ void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
else if (config_methods & WPS_CONFIG_PUSHBUTTON)
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_REQ MACSTR
"%s", MAC2STR(peer), params);
+
+ wpas_notify_p2p_provision_discovery(wpa_s, peer, 1 /* request */,
+ P2P_PROV_DISC_SUCCESS,
+ config_methods, generated_pin);
}
@@ -1910,6 +1914,10 @@ void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_RESP MACSTR,
MAC2STR(peer));
+ wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
+ P2P_PROV_DISC_SUCCESS,
+ config_methods, generated_pin);
+
if (wpa_s->pending_pd_before_join &&
(os_memcmp(peer, wpa_s->pending_join_dev_addr, ETH_ALEN) == 0 ||
os_memcmp(peer, wpa_s->pending_join_iface_addr, ETH_ALEN) == 0)) {
@@ -1921,6 +1929,16 @@ void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
}
+void wpas_prov_disc_fail(void *ctx, const u8 *peer,
+ enum p2p_prov_disc_status status)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+
+ wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
+ status, 0, 0);
+}
+
+
static u8 wpas_invitation_process(void *ctx, const u8 *sa, const u8 *bssid,
const u8 *go_dev_addr, const u8 *ssid,
size_t ssid_len, int *go, u8 *group_bssid,
@@ -2356,6 +2374,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
p2p.sd_response = wpas_sd_response;
p2p.prov_disc_req = wpas_prov_disc_req;
p2p.prov_disc_resp = wpas_prov_disc_resp;
+ p2p.prov_disc_fail = wpas_prov_disc_fail;
p2p.invitation_process = wpas_invitation_process;
p2p.invitation_received = wpas_invitation_received;
p2p.invitation_result = wpas_invitation_result;