WPS: Add initial part of External Registrar functionality
[libeap.git] / wpa_supplicant / wps_supplicant.c
index b5be98d..5fd94e2 100644 (file)
@@ -426,6 +426,10 @@ static void wpa_supplicant_wps_event(void *ctx, enum wps_event event,
                break;
        case WPS_EV_PWD_AUTH_FAIL:
                break;
+       case WPS_EV_PBC_OVERLAP:
+               break;
+       case WPS_EV_PBC_TIMEOUT:
+               break;
        }
 }
 
@@ -810,6 +814,9 @@ void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
        os_free(wpa_s->wps->network_key);
        os_free(wpa_s->wps);
        wpa_s->wps = NULL;
+
+       wps_er_deinit(wpa_s->wps_er);
+       wpa_s->wps_er = NULL;
 }
 
 
@@ -1017,3 +1024,30 @@ int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
        wpabuf_free(wps_ie);
        return ret;
 }
+
+
+int wpas_wps_er_start(struct wpa_supplicant *wpa_s)
+{
+#ifdef CONFIG_WPS_ER
+       if (wpa_s->wps_er) {
+               /* TODO: re-send ctrl_iface events for current data? */
+               return 0;
+       }
+       wpa_s->wps_er = wps_er_init(wpa_s->wps, wpa_s->ifname);
+       if (wpa_s->wps_er == NULL)
+               return -1;
+       return 0;
+#else /* CONFIG_WPS_ER */
+       return 0;
+#endif /* CONFIG_WPS_ER */
+}
+
+
+int wpas_wps_er_stop(struct wpa_supplicant *wpa_s)
+{
+#ifdef CONFIG_WPS_ER
+       wps_er_deinit(wpa_s->wps_er);
+       wpa_s->wps_er = NULL;
+#endif /* CONFIG_WPS_ER */
+       return 0;
+}