aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-18 19:58:42 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-18 19:58:42 (GMT)
commit4b68290e771a70f46452bd69f318e91acc9891b7 (patch)
tree5d47975cd0d47cbaf7372744fc81455a18834a87 /wpa_supplicant
parent9be0963605a9fae71e9ef2ba0ccdab3b638be412 (diff)
downloadhostap-06-4b68290e771a70f46452bd69f318e91acc9891b7.zip
hostap-06-4b68290e771a70f46452bd69f318e91acc9891b7.tar.gz
hostap-06-4b68290e771a70f46452bd69f318e91acc9891b7.tar.bz2
WPS: Added event callback and M2D notification
The event callback will be used for various event messages and the M2D notification is the first such message. It is used to notify wpa_gui about Registrar not yet knowing the device password (PIN).
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/wpa_gui-qt4/wpagui.cpp2
-rw-r--r--wpa_supplicant/wps_supplicant.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
index 829e3c1..edf88ea 100644
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
@@ -802,6 +802,8 @@ void WpaGui::processMsg(char *msg)
} else if (str_match(pos, WPA_EVENT_EAP_METHOD)) {
if (strstr(pos, "(WSC)"))
wpsStatusText->setText("Registration started");
+ } else if (str_match(pos, WPS_EVENT_M2D)) {
+ wpsStatusText->setText("Registrar does not yet know PIN");
}
}
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index dcd0724..5f3b29d 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -180,6 +180,27 @@ static int wpa_supplicant_wps_cred(void *ctx,
}
+static void wpa_supplicant_wps_event_m2d(struct wpa_supplicant *wpa_s,
+ struct wps_event_m2d *m2d)
+{
+ wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_M2D
+ "dev_password_id=%d config_error=%d",
+ m2d->dev_password_id, m2d->config_error);
+}
+
+
+static void wpa_supplicant_wps_event(void *ctx, enum wps_event event,
+ union wps_event_data *data)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+ switch (event) {
+ case WPS_EV_M2D:
+ wpa_supplicant_wps_event_m2d(wpa_s, &data->m2d);
+ break;
+ }
+}
+
+
u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
{
if (eap_is_wps_pbc_enrollee(&ssid->eap) ||
@@ -361,6 +382,7 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
return -1;
wps->cred_cb = wpa_supplicant_wps_cred;
+ wps->event_cb = wpa_supplicant_wps_event;
wps->cb_ctx = wpa_s;
wps->dev.device_name = wpa_s->conf->device_name;