]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Add wpas_notify_p2p_provision_discovery()
authorJohannes Berg <johannes.berg@intel.com>
Sun, 12 Jun 2011 21:31:56 +0000 (14:31 -0700)
committerJouni Malinen <j@w1.fi>
Sun, 12 Jun 2011 21:31:56 +0000 (14:31 -0700)
Add a notification for P2P provision discovery status/result.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
wpa_supplicant/notify.c
wpa_supplicant/notify.h
wpa_supplicant/p2p_supplicant.c

index 2053c3d20a5d9d13f9d28358ddc6c5fcf8907583..db3419c55f37ac8e1c97c1324388bbb5300da885 100644 (file)
@@ -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 */
 
 
index 6c8fdf7bfafcc04e0f404638703dd85f63169fb5..967aff2681999c2cfa3c39044c2b8199f60826df 100644 (file)
@@ -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 */
index 03d1672bd15f6f63df1a54953bbde58e8fa24f39..9a73090874640a65e6bb730ea7ceb1c80f793620 100644 (file)
@@ -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;