summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChengyi Zhao <chengyi1.zhao@archermind.com>2013-07-10 07:37:50 (GMT)
committerZhang zhengguang <zhengguang.zhang@intel.com>2014-07-17 05:01:05 (GMT)
commite578f4758b7f33a8e6202c141aa415812d6475d0 (patch)
tree80d4584e4aa91a1c392e21e42fdb9e4cd98f265c
parent0ef3b5af5dbdd32325f3e5c9dc1dd773963e1f2e (diff)
downloadconnman-e578f4758b7f33a8e6202c141aa415812d6475d0.zip
connman-e578f4758b7f33a8e6202c141aa415812d6475d0.tar.gz
connman-e578f4758b7f33a8e6202c141aa415812d6475d0.tar.bz2
Tethering: Add handling for wpa_supplicant authorized/deauthorized signals
Change-Id: Iff022e257ee9d2c5227585bf0b84e726914cc62b
-rw-r--r--gsupplicant/gsupplicant.h2
-rw-r--r--gsupplicant/supplicant.c53
2 files changed, 55 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index bcff96c..83cb485 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -280,6 +280,8 @@ struct _GSupplicantCallbacks {
void (*network_removed) (GSupplicantNetwork *network);
void (*network_changed) (GSupplicantNetwork *network,
const char *property);
+ void (*add_station) (const char *mac);
+ void (*remove_station) (const char *mac);
void (*peer_found) (GSupplicantPeer *peer);
void (*peer_lost) (GSupplicantPeer *peer);
void (*debug) (const char *str);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 9d8f107..b6f3cd3 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2447,6 +2447,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[6] = {};
@@ -2594,6 +2644,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 },