diff options
author | Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com> | 2018-11-23 01:36:31 +0200 |
---|---|---|
committer | Daniel Wagner <wagi@monom.org> | 2018-11-23 06:46:44 +0100 |
commit | 651f65a0e84021165e4a87c710321b53335a4625 (patch) | |
tree | f42db8cc3499d6e341ca40e47307d8f83dd2b747 /gsupplicant | |
parent | 3bf49d1a4020fbc9eb459f0765756ff80b0dd357 (diff) | |
download | connman-651f65a0e84021165e4a87c710321b53335a4625.tar.gz |
gsupplicant: Add handling of StaAuthorized and StaDeauthorized signals
Callback this notifications to wifi plugin which can use them to store
list of tethering clients.
Diffstat (limited to 'gsupplicant')
-rw-r--r-- | gsupplicant/gsupplicant.h | 4 | ||||
-rw-r--r-- | gsupplicant/supplicant.c | 62 |
2 files changed, 66 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index db61595b..bfb52db7 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -352,6 +352,10 @@ struct _GSupplicantCallbacks { void (*network_changed) (GSupplicantNetwork *network, const char *property); void (*network_associated) (GSupplicantNetwork *network); + void (*sta_authorized) (GSupplicantInterface *interface, + const char *addr); + void (*sta_deauthorized) (GSupplicantInterface *interface, + const char *addr); void (*peer_found) (GSupplicantPeer *peer); void (*peer_lost) (GSupplicantPeer *peer); void (*peer_changed) (GSupplicantPeer *peer, diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 0cb621b9..be2deaa5 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -614,6 +614,30 @@ static void callback_network_associated(GSupplicantNetwork *network) callbacks_pointer->network_associated(network); } +static void callback_sta_authorized(GSupplicantInterface *interface, + const char *addr) +{ + if (!callbacks_pointer) + return; + + if (!callbacks_pointer->sta_authorized) + return; + + callbacks_pointer->sta_authorized(interface, addr); +} + +static void callback_sta_deauthorized(GSupplicantInterface *interface, + const char *addr) +{ + if (!callbacks_pointer) + return; + + if (!callbacks_pointer->sta_deauthorized) + return; + + callbacks_pointer->sta_deauthorized(interface, addr); +} + static void callback_peer_found(GSupplicantPeer *peer) { if (!callbacks_pointer) @@ -2731,6 +2755,42 @@ static void signal_network_removed(const char *path, DBusMessageIter *iter) interface_network_removed(iter, interface); } +static void signal_sta_authorized(const char *path, DBusMessageIter *iter) +{ + GSupplicantInterface *interface; + const char *addr = NULL; + + SUPPLICANT_DBG(""); + + interface = g_hash_table_lookup(interface_table, path); + if (!interface) + return; + + dbus_message_iter_get_basic(iter, &addr); + if (!addr) + return; + + callback_sta_authorized(interface, addr); +} + +static void signal_sta_deauthorized(const char *path, DBusMessageIter *iter) +{ + GSupplicantInterface *interface; + const char *addr = NULL; + + SUPPLICANT_DBG(""); + + interface = g_hash_table_lookup(interface_table, path); + if (!interface) + return; + + dbus_message_iter_get_basic(iter, &addr); + if (!addr) + return; + + callback_sta_deauthorized(interface, addr); +} + static void signal_bss_changed(const char *path, DBusMessageIter *iter) { GSupplicantInterface *interface; @@ -3505,6 +3565,8 @@ static struct { { SUPPLICANT_INTERFACE ".Interface", "BSSRemoved", signal_bss_removed }, { SUPPLICANT_INTERFACE ".Interface", "NetworkAdded", signal_network_added }, { SUPPLICANT_INTERFACE ".Interface", "NetworkRemoved", signal_network_removed }, + { SUPPLICANT_INTERFACE ".Interface", "StaAuthorized", signal_sta_authorized }, + { SUPPLICANT_INTERFACE ".Interface", "StaDeauthorized", signal_sta_deauthorized }, { SUPPLICANT_INTERFACE ".BSS", "PropertiesChanged", signal_bss_changed }, |