WPS: Add PBC mode activated/disabled events

This makes it easier to track PBC state on the registrar.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jeffin Mammen 2013-08-23 16:01:30 +03:00 committed by Jouni Malinen
parent 961750c1e8
commit 50396e29da
7 changed files with 48 additions and 0 deletions

View 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:

View 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 "

View 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
*/

View 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)

View 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);

View 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);
}

View 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;