summaryrefslogtreecommitdiff
path: root/gsupplicant/supplicant.c
diff options
context:
space:
mode:
Diffstat (limited to 'gsupplicant/supplicant.c')
-rw-r--r--gsupplicant/supplicant.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 58a8c9f..5ff9b3d 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2609,6 +2609,56 @@ static void signal_wps_event(const char *path, DBusMessageIter *iter)
supplicant_dbus_property_foreach(iter, wps_event_args, interface);
}
+static void signal_station_connected(const char *path, DBusMessageIter *iter)
+{
+ GSupplicantInterface *interface;
+ const char *sta_mac = NULL;
+
+ SUPPLICANT_DBG("path %s %s", path, SUPPLICANT_PATH);
+
+ if (callbacks_pointer->add_station == NULL)
+ return;
+
+ if (g_strcmp0(path, "/") == 0)
+ return;
+
+ interface = g_hash_table_lookup(interface_table, path);
+ if (interface == NULL)
+ return;
+
+ dbus_message_iter_get_basic(iter, &sta_mac);
+ if (sta_mac == NULL)
+ return;
+
+ SUPPLICANT_DBG("New station %s connected", sta_mac);
+ callbacks_pointer->add_station(sta_mac);
+}
+
+static void signal_station_disconnected(const char *path, DBusMessageIter *iter)
+{
+ GSupplicantInterface *interface;
+ const char *sta_mac = NULL;
+
+ SUPPLICANT_DBG("path %s %s", path, SUPPLICANT_PATH);
+
+ if (callbacks_pointer->remove_station == NULL)
+ return;
+
+ if (g_strcmp0(path, "/") == 0)
+ return;
+
+ interface = g_hash_table_lookup(interface_table, path);
+ if (interface == NULL)
+ return;
+
+ dbus_message_iter_get_basic(iter, &sta_mac);
+ if (sta_mac == NULL)
+ return;
+
+ SUPPLICANT_DBG("Station %s disconnected", sta_mac);
+ callbacks_pointer->remove_station(sta_mac);
+}
+
static void create_peer_identifier(GSupplicantPeer *peer)
{
const unsigned char test[ETH_ALEN] = {};
@@ -3171,6 +3221,9 @@ static struct {
{ SUPPLICANT_INTERFACE ".Interface.WPS", "Credentials", signal_wps_credentials },
{ SUPPLICANT_INTERFACE ".Interface.WPS", "Event", signal_wps_event },
+ { SUPPLICANT_INTERFACE".Interface", "StaAuthorized", signal_station_connected },
+ { SUPPLICANT_INTERFACE".Interface", "StaDeauthorized", signal_station_disconnected },
+
{ SUPPLICANT_INTERFACE ".Interface.P2PDevice", "DeviceFound", signal_peer_found },
{ SUPPLICANT_INTERFACE ".Interface.P2PDevice", "DeviceLost", signal_peer_lost },