aboutsummaryrefslogtreecommitdiffstats
path: root/src/wps
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-19 20:34:18 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-19 20:34:18 (GMT)
commitad5302a1cac57b28cba1147c7fc90807e0959c48 (patch)
tree759700568e79555ccb8b965006f7ef9ba8bc613d /src/wps
parent469fc3a41f6ca46c7e46d6fd5762e9aa03369f1f (diff)
downloadhostap-06-ad5302a1cac57b28cba1147c7fc90807e0959c48.zip
hostap-06-ad5302a1cac57b28cba1147c7fc90807e0959c48.tar.gz
hostap-06-ad5302a1cac57b28cba1147c7fc90807e0959c48.tar.bz2
WPS: Added event callback for successfully completed registration
Diffstat (limited to 'src/wps')
-rw-r--r--src/wps/wps.h3
-rw-r--r--src/wps/wps_common.c9
-rw-r--r--src/wps/wps_enrollee.c8
-rw-r--r--src/wps/wps_i.h1
-rw-r--r--src/wps/wps_registrar.c2
5 files changed, 21 insertions, 2 deletions
diff --git a/src/wps/wps.h b/src/wps/wps.h
index d61db68..7d78a53 100644
--- a/src/wps/wps.h
+++ b/src/wps/wps.h
@@ -97,7 +97,8 @@ struct wps_registrar_config {
enum wps_event {
WPS_EV_M2D,
- WPS_EV_FAIL
+ WPS_EV_FAIL,
+ WPS_EV_SUCCESS
};
union wps_event_data {
diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c
index 99f6eb9..9273d37 100644
--- a/src/wps/wps_common.c
+++ b/src/wps/wps_common.c
@@ -311,3 +311,12 @@ void wps_fail_event(struct wps_context *wps, enum wps_msg_type msg)
data.fail.msg = msg;
wps->event_cb(wps->cb_ctx, WPS_EV_FAIL, &data);
}
+
+
+void wps_success_event(struct wps_context *wps)
+{
+ if (wps->event_cb == NULL)
+ return;
+
+ wps->event_cb(wps->cb_ctx, WPS_EV_SUCCESS, NULL);
+}
diff --git a/src/wps/wps_enrollee.c b/src/wps/wps_enrollee.c
index 18967cd..a63a578 100644
--- a/src/wps/wps_enrollee.c
+++ b/src/wps/wps_enrollee.c
@@ -326,7 +326,12 @@ static struct wpabuf * wps_build_wsc_done(struct wps_data *wps)
return NULL;
}
- wps->state = wps->authenticator ? RECV_ACK : WPS_FINISHED;
+ if (wps->authenticator)
+ wps->state = RECV_ACK;
+ else {
+ wps_success_event(wps->wps);
+ wps->state = WPS_FINISHED;
+ }
return msg;
}
@@ -1020,6 +1025,7 @@ static enum wps_process_res wps_process_wsc_ack(struct wps_data *wps,
if (wps->state == RECV_ACK && wps->authenticator) {
wpa_printf(MSG_DEBUG, "WPS: External Registrar registration "
"completed successfully");
+ wps_success_event(wps->wps);
wps->state = WPS_FINISHED;
return WPS_DONE;
}
diff --git a/src/wps/wps_i.h b/src/wps/wps_i.h
index 3ae53b8..35130b1 100644
--- a/src/wps/wps_i.h
+++ b/src/wps/wps_i.h
@@ -166,6 +166,7 @@ void wps_derive_psk(struct wps_data *wps, const u8 *dev_passwd,
struct wpabuf * wps_decrypt_encr_settings(struct wps_data *wps, const u8 *encr,
size_t encr_len);
void wps_fail_event(struct wps_context *wps, enum wps_msg_type msg);
+void wps_success_event(struct wps_context *wps);
/* wps_attr_parse.c */
int wps_parse_msg(const struct wpabuf *msg, struct wps_parse_attr *attr);
diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index cd53c74..4d5e0c3 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -2077,6 +2077,8 @@ static enum wps_process_res wps_process_wsc_done(struct wps_data *wps,
wps_registrar_pbc_completed(wps->registrar);
}
+ wps_success_event(wps->wps);
+
return WPS_DONE;
}