aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-15 18:09:57 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-15 18:09:57 (GMT)
commita524f05eb3cfefea94fe27f039f78a278a4ff5af (patch)
treedb41d94e0d7a45cc6aa70fd9d67965da12c54992 /wpa_supplicant/wps_supplicant.c
parent484957ae6c88cd33946e8677b1306530657b32b6 (diff)
downloadhostap-06-a524f05eb3cfefea94fe27f039f78a278a4ff5af.zip
hostap-06-a524f05eb3cfefea94fe27f039f78a278a4ff5af.tar.gz
hostap-06-a524f05eb3cfefea94fe27f039f78a278a4ff5af.tar.bz2
WPS: Added control interface notification for available WPS APs
Whenever new scan results include WPS AP(s) and the client is not associated, send a notification message to control interface monitors. This makes it easier for GUIs to notify the user about possible WPS availability without having to go through the scan results.
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 131506f..8c254df 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -21,6 +21,7 @@
#include "eap_peer/eap.h"
#include "wpa_supplicant_i.h"
#include "eloop.h"
+#include "wpa_ctrl.h"
#include "eap_common/eap_wsc_common.h"
#include "wps/wps.h"
#include "wps/wps_defs.h"
@@ -558,3 +559,28 @@ int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
return ret;
}
+
+
+void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
+{
+ size_t i;
+
+ if (wpa_s->disconnected || wpa_s->wpa_state >= WPA_ASSOCIATED)
+ return;
+
+ for (i = 0; i < wpa_s->scan_res->num; i++) {
+ struct wpa_scan_res *bss = wpa_s->scan_res->res[i];
+ struct wpabuf *ie;
+ ie = wpa_scan_get_vendor_ie_multi(bss, WPS_IE_VENDOR_TYPE);
+ if (!ie)
+ continue;
+ if (wps_is_selected_pbc_registrar(ie))
+ wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE_PBC);
+ else if (wps_is_selected_pin_registrar(ie))
+ wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE_PIN);
+ else
+ wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE);
+ wpabuf_free(ie);
+ break;
+ }
+}