]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Add PBC mode activated/disabled events
authorJeffin Mammen <jmammen@qti.qualcomm.com>
Fri, 23 Aug 2013 13:01:30 +0000 (16:01 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 23 Aug 2013 13:52:48 +0000 (16:52 +0300)
This makes it easier to track PBC state on the registrar.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/ap/wps_hostapd.c
src/common/wpa_ctrl.h
src/wps/wps.h
src/wps/wps_common.c
src/wps/wps_i.h
src/wps/wps_registrar.c
wpa_supplicant/wps_supplicant.c

index a3950d3d3438030ebcd91839da1dda18cf753359..b5ecb6bc2194e4924eb8f5f6be30b72f987d02fe 100644 (file)
@@ -775,6 +775,12 @@ static void hostapd_wps_event_cb(void *ctx, enum wps_event event,
        case WPS_EV_PBC_TIMEOUT:
                wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_TIMEOUT);
                break;
+       case WPS_EV_PBC_ACTIVE:
+               wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ACTIVE);
+               break;
+       case WPS_EV_PBC_DISABLE:
+               wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_DISABLE);
+               break;
        case WPS_EV_ER_AP_ADD:
                break;
        case WPS_EV_ER_AP_REMOVE:
index 0ab4b7f5197b24f3e6ea1d55056a7ff3b3352047..af716176dad52eda9552e6c251339021a5052912 100644 (file)
@@ -84,6 +84,10 @@ extern "C" {
 #define WPS_EVENT_SUCCESS "WPS-SUCCESS "
 /** WPS enrollment attempt timed out and was terminated */
 #define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "
+/* PBC mode was activated */
+#define WPS_EVENT_ACTIVE "WPS-PBC-ACTIVE "
+/* PBC mode was disabled */
+#define WPS_EVENT_DISABLE "WPS-PBC-DISABLE "
 
 #define WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN "
 
index a301b51bb171cf005eaa42b56885fb5172f481e1..8d9535b0ce54e238b93d792c2ad0c80f0c471ec6 100644 (file)
@@ -419,6 +419,16 @@ enum wps_event {
         */
        WPS_EV_PBC_TIMEOUT,
 
+       /**
+        * WPS_EV_PBC_ACTIVE - PBC mode was activated
+        */
+       WPS_EV_PBC_ACTIVE,
+
+       /**
+        * WPS_EV_PBC_DISABLE - PBC mode was disabled
+        */
+       WPS_EV_PBC_DISABLE,
+
        /**
         * WPS_EV_ER_AP_ADD - ER: AP added
         */
index 4e4da5ec4e41baa8f67cd5434a5abd2803ed688b..8c54a1533d231f2a26b8634fd805213c76e84e13 100644 (file)
@@ -322,6 +322,24 @@ void wps_pbc_timeout_event(struct wps_context *wps)
 }
 
 
+void wps_pbc_active_event(struct wps_context *wps)
+{
+       if (wps->event_cb == NULL)
+               return;
+
+       wps->event_cb(wps->cb_ctx, WPS_EV_PBC_ACTIVE, NULL);
+}
+
+
+void wps_pbc_disable_event(struct wps_context *wps)
+{
+       if (wps->event_cb == NULL)
+               return;
+
+       wps->event_cb(wps->cb_ctx, WPS_EV_PBC_DISABLE, NULL);
+}
+
+
 #ifdef CONFIG_WPS_OOB
 
 struct wpabuf * wps_get_oob_cred(struct wps_context *wps)
index 413379ba9ab73a158fa546090bff2cde098872ff..17cf396905cc69e7bbc6e031ce21d2b36b9feafb 100644 (file)
@@ -139,6 +139,8 @@ void wps_success_event(struct wps_context *wps);
 void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part);
 void wps_pbc_overlap_event(struct wps_context *wps);
 void wps_pbc_timeout_event(struct wps_context *wps);
+void wps_pbc_active_event(struct wps_context *wps);
+void wps_pbc_disable_event(struct wps_context *wps);
 
 struct wpabuf * wps_build_wsc_ack(struct wps_data *wps);
 struct wpabuf * wps_build_wsc_nack(struct wps_data *wps);
index 48128935a5aa0dee670123b0efaaa7f74367b7cb..c37051cc3d7dfd1067b70329564749ed70187d20 100644 (file)
@@ -1001,6 +1001,7 @@ int wps_registrar_button_pushed(struct wps_registrar *reg,
                                         (u8 *) "\xff\xff\xff\xff\xff\xff");
        wps_registrar_selected_registrar_changed(reg, 0);
 
+       wps_pbc_active_event(reg->wps);
        eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL);
        eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL);
        eloop_register_timeout(WPS_PBC_WALK_TIME, 0, wps_registrar_pbc_timeout,
@@ -1014,6 +1015,7 @@ static void wps_registrar_pbc_completed(struct wps_registrar *reg)
        wpa_printf(MSG_DEBUG, "WPS: PBC completed - stopping PBC mode");
        eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL);
        wps_registrar_stop_pbc(reg);
+       wps_pbc_disable_event(reg->wps);
 }
 
 
index 44b935a3a1d3ff009609d5b00f3434c6676a6f12..452ce8ee6b5a0d6f28cf43f7e21c5c4d6b42b2ea 100644 (file)
@@ -807,6 +807,12 @@ static void wpa_supplicant_wps_event(void *ctx, enum wps_event event,
                break;
        case WPS_EV_PBC_TIMEOUT:
                break;
+       case WPS_EV_PBC_ACTIVE:
+               wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ACTIVE);
+               break;
+       case WPS_EV_PBC_DISABLE:
+               wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_DISABLE);
+               break;
        case WPS_EV_ER_AP_ADD:
                wpa_supplicant_wps_event_er_ap_add(wpa_s, &data->ap);
                break;