[PATCH 5/4] Add DBus state change notification for AuthMode property

Paul Stewart pstew
Fri Mar 11 11:48:52 PST 2011


:-)

Signed-off-by: Paul Stewart <pstew at google.com>
Cc: Dan Williams <dcbw at redhat.com>
---
 wpa_supplicant/dbus/dbus_new.c  |    5 +++++
 wpa_supplicant/dbus/dbus_new.h  |    1 +
 wpa_supplicant/notify.c         |    6 ++++++
 wpa_supplicant/notify.h         |    1 +
 wpa_supplicant/wpa_supplicant.c |    7 ++++++-
 5 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 7562c94..f85fedf 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -695,6 +695,11 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
 		getter = (WPADBusPropertyAccessor) wpas_dbus_getter_bsss;
 		prop = "BSSs";
 		break;
+	case WPAS_DBUS_PROP_CURRENT_AUTH_MODE:
+		getter = (WPADBusPropertyAccessor)
+			wpas_dbus_getter_current_auth_mode;
+		prop = "CurrentAuthMode";
+		break;
 	default:
 		wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
 			   __func__, property);
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index 9cdefcb..377e381 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -30,6 +30,7 @@ enum wpas_dbus_prop {
 	WPAS_DBUS_PROP_STATE,
 	WPAS_DBUS_PROP_CURRENT_BSS,
 	WPAS_DBUS_PROP_CURRENT_NETWORK,
+	WPAS_DBUS_PROP_CURRENT_AUTH_MODE,
 	WPAS_DBUS_PROP_BSSS,
 };
 
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 5e3aaa0..9ee7dc2 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -120,6 +120,12 @@ void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
 }
 
 
+void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
+{
+	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
+}
+
+
 void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
 					 struct wpa_ssid *ssid)
 {
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 4e55bd1..156774a 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -29,6 +29,7 @@ void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
 void wpas_notify_network_changed(struct wpa_supplicant *wpa_s);
 void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s);
 void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s);
+void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s);
 void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
 					 struct wpa_ssid *ssid);
 void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index d334227..4f58f76 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -572,8 +572,13 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
 	}
 	wpa_s->wpa_state = state;
 
-	if (wpa_s->wpa_state != old_state)
+	if (wpa_s->wpa_state != old_state) {
 		wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state);
+
+		if (wpa_s->wpa_state == WPA_COMPLETED ||
+		    old_state == WPA_COMPLETED)
+			wpas_notify_auth_changed(wpa_s);
+	}
 }
 
 
-- 
1.7.3.1




More information about the Hostap mailing list