wifi: convert AP handling to new supplicant interface
This commit is contained in:
@@ -188,18 +188,14 @@ static void supplicant_iface_state_cb (NMSupplicantInterface *iface,
|
|||||||
guint32 old_state,
|
guint32 old_state,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
static void supplicant_iface_scanned_ap_cb (NMSupplicantInterface * iface,
|
static void supplicant_iface_new_bss_cb (NMSupplicantInterface * iface,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
NMDeviceWifi * self);
|
NMDeviceWifi * self);
|
||||||
|
|
||||||
static void supplicant_iface_scan_request_result_cb (NMSupplicantInterface * iface,
|
static void supplicant_iface_scan_done_cb (NMSupplicantInterface * iface,
|
||||||
gboolean success,
|
gboolean success,
|
||||||
NMDeviceWifi * self);
|
NMDeviceWifi * self);
|
||||||
|
|
||||||
static void supplicant_iface_scan_results_cb (NMSupplicantInterface * iface,
|
|
||||||
guint32 num_bssids,
|
|
||||||
NMDeviceWifi * self);
|
|
||||||
|
|
||||||
static void supplicant_iface_notify_scanning_cb (NMSupplicantInterface * iface,
|
static void supplicant_iface_notify_scanning_cb (NMSupplicantInterface * iface,
|
||||||
GParamSpec * pspec,
|
GParamSpec * pspec,
|
||||||
NMDeviceWifi * self);
|
NMDeviceWifi * self);
|
||||||
@@ -646,26 +642,20 @@ supplicant_interface_acquire (NMDeviceWifi *self)
|
|||||||
memset (priv->supplicant.sig_ids, 0, sizeof (priv->supplicant.sig_ids));
|
memset (priv->supplicant.sig_ids, 0, sizeof (priv->supplicant.sig_ids));
|
||||||
|
|
||||||
id = g_signal_connect (priv->supplicant.iface,
|
id = g_signal_connect (priv->supplicant.iface,
|
||||||
"state",
|
NM_SUPPLICANT_INTERFACE_STATE,
|
||||||
G_CALLBACK (supplicant_iface_state_cb),
|
G_CALLBACK (supplicant_iface_state_cb),
|
||||||
self);
|
self);
|
||||||
priv->supplicant.sig_ids[i++] = id;
|
priv->supplicant.sig_ids[i++] = id;
|
||||||
|
|
||||||
id = g_signal_connect (priv->supplicant.iface,
|
id = g_signal_connect (priv->supplicant.iface,
|
||||||
"scanned-ap",
|
NM_SUPPLICANT_INTERFACE_NEW_BSS,
|
||||||
G_CALLBACK (supplicant_iface_scanned_ap_cb),
|
G_CALLBACK (supplicant_iface_new_bss_cb),
|
||||||
self);
|
self);
|
||||||
priv->supplicant.sig_ids[i++] = id;
|
priv->supplicant.sig_ids[i++] = id;
|
||||||
|
|
||||||
id = g_signal_connect (priv->supplicant.iface,
|
id = g_signal_connect (priv->supplicant.iface,
|
||||||
"scan-req-result",
|
NM_SUPPLICANT_INTERFACE_SCAN_DONE,
|
||||||
G_CALLBACK (supplicant_iface_scan_request_result_cb),
|
G_CALLBACK (supplicant_iface_scan_done_cb),
|
||||||
self);
|
|
||||||
priv->supplicant.sig_ids[i++] = id;
|
|
||||||
|
|
||||||
id = g_signal_connect (priv->supplicant.iface,
|
|
||||||
"scan-results",
|
|
||||||
G_CALLBACK (supplicant_iface_scan_results_cb),
|
|
||||||
self);
|
self);
|
||||||
priv->supplicant.sig_ids[i++] = id;
|
priv->supplicant.sig_ids[i++] = id;
|
||||||
|
|
||||||
@@ -1910,28 +1900,19 @@ cancel_pending_scan (NMDeviceWifi *self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
supplicant_iface_scan_request_result_cb (NMSupplicantInterface *iface,
|
supplicant_iface_scan_done_cb (NMSupplicantInterface *iface,
|
||||||
gboolean success,
|
gboolean success,
|
||||||
NMDeviceWifi *self)
|
NMDeviceWifi *self)
|
||||||
{
|
{
|
||||||
nm_log_dbg (LOGD_WIFI_SCAN, "(%s): scan request %s",
|
nm_log_dbg (LOGD_WIFI_SCAN, "(%s): scan %s",
|
||||||
nm_device_get_iface (NM_DEVICE (self)),
|
nm_device_get_iface (NM_DEVICE (self)),
|
||||||
success ? "successful" : "failed");
|
success ? "successful" : "failed");
|
||||||
|
|
||||||
if (check_scanning_allowed (self))
|
if (check_scanning_allowed (self))
|
||||||
schedule_scan (self, TRUE);
|
schedule_scan (self, TRUE);
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
#if 0
|
||||||
supplicant_iface_scan_results_cb (NMSupplicantInterface *iface,
|
|
||||||
guint32 num_results,
|
|
||||||
NMDeviceWifi *self)
|
|
||||||
{
|
|
||||||
nm_log_dbg (LOGD_WIFI_SCAN, "(%s): scan results available (%d APs found)",
|
|
||||||
nm_device_get_iface (NM_DEVICE (self)),
|
|
||||||
num_results);
|
|
||||||
if (num_results == 0) {
|
if (num_results == 0) {
|
||||||
/* ensure that old APs get culled, which otherwise only
|
/* ensure that old APs get culled, which otherwise only
|
||||||
* happens when there are actual scan results to process.
|
* happens when there are actual scan results to process.
|
||||||
@@ -1939,6 +1920,7 @@ supplicant_iface_scan_results_cb (NMSupplicantInterface *iface,
|
|||||||
cull_scan_list (self);
|
cull_scan_list (self);
|
||||||
nm_device_wifi_ap_list_print (self);
|
nm_device_wifi_ap_list_print (self);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -2197,7 +2179,7 @@ set_ap_strength_from_properties (NMDeviceWifi *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
supplicant_iface_scanned_ap_cb (NMSupplicantInterface *iface,
|
supplicant_iface_new_bss_cb (NMSupplicantInterface *iface,
|
||||||
GHashTable *properties,
|
GHashTable *properties,
|
||||||
NMDeviceWifi *self)
|
NMDeviceWifi *self)
|
||||||
{
|
{
|
||||||
@@ -3075,7 +3057,7 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
|
|||||||
|
|
||||||
/* Hook up error signal handler to capture association errors */
|
/* Hook up error signal handler to capture association errors */
|
||||||
id = g_signal_connect (priv->supplicant.iface,
|
id = g_signal_connect (priv->supplicant.iface,
|
||||||
"connection-error",
|
NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR,
|
||||||
G_CALLBACK (supplicant_iface_connection_error_cb),
|
G_CALLBACK (supplicant_iface_connection_error_cb),
|
||||||
self);
|
self);
|
||||||
priv->supplicant.iface_error_id = id;
|
priv->supplicant.iface_error_id = id;
|
||||||
|
@@ -34,24 +34,21 @@
|
|||||||
#include "nm-glib-compat.h"
|
#include "nm-glib-compat.h"
|
||||||
|
|
||||||
#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface"
|
#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface"
|
||||||
#define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID"
|
#define WPAS_DBUS_IFACE_BSS WPAS_DBUS_INTERFACE ".BSS"
|
||||||
#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
|
#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
|
||||||
#define WPAS_ERROR_INVALID_IFACE WPAS_DBUS_INTERFACE ".InvalidInterface"
|
#define WPAS_ERROR_INVALID_IFACE WPAS_DBUS_INTERFACE ".InvalidInterface"
|
||||||
#define WPAS_ERROR_EXISTS_ERROR WPAS_DBUS_INTERFACE ".InterfaceExists"
|
#define WPAS_ERROR_EXISTS_ERROR WPAS_DBUS_INTERFACE ".InterfaceExists"
|
||||||
|
|
||||||
|
|
||||||
static void wpas_iface_handle_state_change (DBusGProxy *proxy,
|
|
||||||
const char *str_new_state,
|
|
||||||
const char *str_old_state,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
static void wpas_iface_handle_scanning (DBusGProxy *proxy,
|
|
||||||
gboolean scanning,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMSupplicantInterface, nm_supplicant_interface, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (NMSupplicantInterface, nm_supplicant_interface, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
static void wpas_iface_properties_changed (DBusGProxy *proxy,
|
||||||
|
GHashTable *props,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
static void wpas_iface_scan_done (DBusGProxy *proxy,
|
||||||
|
gboolean success,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
#define NM_SUPPLICANT_INTERFACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
#define NM_SUPPLICANT_INTERFACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||||
NM_TYPE_SUPPLICANT_INTERFACE, \
|
NM_TYPE_SUPPLICANT_INTERFACE, \
|
||||||
NMSupplicantInterfacePrivate))
|
NMSupplicantInterfacePrivate))
|
||||||
@@ -60,9 +57,8 @@ G_DEFINE_TYPE (NMSupplicantInterface, nm_supplicant_interface, G_TYPE_OBJECT)
|
|||||||
enum {
|
enum {
|
||||||
STATE, /* change in the interface's state */
|
STATE, /* change in the interface's state */
|
||||||
REMOVED, /* interface was removed by the supplicant */
|
REMOVED, /* interface was removed by the supplicant */
|
||||||
SCANNED_AP, /* interface saw a new access point from a scan */
|
NEW_BSS, /* interface saw a new access point from a scan */
|
||||||
SCAN_REQ_RESULT, /* result of a wireless scan request */
|
SCAN_DONE, /* wifi scan is complete */
|
||||||
SCAN_RESULTS, /* scan results returned from supplicant */
|
|
||||||
CONNECTION_ERROR, /* an error occurred during a connection request */
|
CONNECTION_ERROR, /* an error occurred during a connection request */
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
@@ -72,7 +68,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
|||||||
/* Properties */
|
/* Properties */
|
||||||
enum {
|
enum {
|
||||||
PROP_0 = 0,
|
PROP_0 = 0,
|
||||||
PROP_STATE,
|
|
||||||
PROP_SCANNING,
|
PROP_SCANNING,
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
};
|
};
|
||||||
@@ -94,9 +89,9 @@ typedef struct {
|
|||||||
|
|
||||||
DBusGProxy * wpas_proxy;
|
DBusGProxy * wpas_proxy;
|
||||||
DBusGProxy * iface_proxy;
|
DBusGProxy * iface_proxy;
|
||||||
|
DBusGProxy * props_proxy;
|
||||||
DBusGProxy * net_proxy;
|
DBusGProxy * net_proxy;
|
||||||
|
|
||||||
guint scan_results_timeout;
|
|
||||||
guint32 last_scan;
|
guint32 last_scan;
|
||||||
|
|
||||||
NMSupplicantConfig * cfg;
|
NMSupplicantConfig * cfg;
|
||||||
@@ -199,143 +194,80 @@ static void
|
|||||||
bssid_properties_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
bssid_properties_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
||||||
GError *err = NULL;
|
GError *error = NULL;
|
||||||
GHashTable *hash = NULL;
|
GHashTable *props = NULL;
|
||||||
|
|
||||||
if (!dbus_g_proxy_end_call (proxy, call_id, &err,
|
if (dbus_g_proxy_end_call (proxy, call_id, &error,
|
||||||
DBUS_TYPE_G_MAP_OF_VARIANT, &hash,
|
DBUS_TYPE_G_MAP_OF_VARIANT, &props,
|
||||||
G_TYPE_INVALID)) {
|
G_TYPE_INVALID)) {
|
||||||
if (!strstr (err->message, "The BSSID requested was invalid")) {
|
g_signal_emit (info->interface, signals[NEW_BSS], 0, props);
|
||||||
nm_log_warn (LOGD_SUPPLICANT, "Couldn't retrieve BSSID properties: %s.",
|
g_hash_table_destroy (props);
|
||||||
err->message);
|
|
||||||
}
|
|
||||||
g_error_free (err);
|
|
||||||
} else {
|
} else {
|
||||||
g_signal_emit (info->interface, signals[SCANNED_AP], 0, hash);
|
if (!strstr (error->message, "The BSSID requested was invalid")) {
|
||||||
g_hash_table_destroy (hash);
|
nm_log_warn (LOGD_SUPPLICANT, "Couldn't retrieve BSSID properties: %s.",
|
||||||
|
error->message);
|
||||||
|
}
|
||||||
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
request_bssid_properties (NMSupplicantInterface * self,
|
request_bss_properties (NMSupplicantInterface *self,
|
||||||
const char * op)
|
GPtrArray *paths)
|
||||||
{
|
{
|
||||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Fire off a "properties" call for each returned BSSID */
|
||||||
|
for (i = 0; i < paths->len; i++) {
|
||||||
NMSupplicantInfo *info;
|
NMSupplicantInfo *info;
|
||||||
DBusGProxy *proxy;
|
DBusGProxy *proxy;
|
||||||
DBusGProxyCall *call;
|
DBusGProxyCall *call;
|
||||||
|
|
||||||
proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
|
proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
|
||||||
WPAS_DBUS_SERVICE,
|
WPAS_DBUS_SERVICE,
|
||||||
op,
|
g_ptr_array_index (paths, i),
|
||||||
WPAS_DBUS_IFACE_BSSID);
|
DBUS_INTERFACE_PROPERTIES);
|
||||||
info = nm_supplicant_info_new (self, proxy, priv->other_pcalls);
|
info = nm_supplicant_info_new (self, proxy, priv->other_pcalls);
|
||||||
call = dbus_g_proxy_begin_call (proxy, "properties",
|
call = dbus_g_proxy_begin_call (proxy, "GetAll",
|
||||||
bssid_properties_cb,
|
bssid_properties_cb,
|
||||||
info,
|
info,
|
||||||
nm_supplicant_info_destroy,
|
nm_supplicant_info_destroy,
|
||||||
|
G_TYPE_STRING, WPAS_DBUS_IFACE_BSS,
|
||||||
G_TYPE_INVALID);
|
G_TYPE_INVALID);
|
||||||
nm_supplicant_info_set_call (info, call);
|
nm_supplicant_info_set_call (info, call);
|
||||||
g_object_unref (proxy);
|
g_object_unref (proxy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scan_results_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
wpas_iface_bss_added (DBusGProxy *proxy,
|
||||||
|
const char *object_path,
|
||||||
|
GHashTable *props,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GError *err = NULL;
|
g_message ("%s: here op %s props %p", __func__, object_path, props);
|
||||||
GPtrArray *array = NULL;
|
g_signal_emit (NM_SUPPLICANT_INTERFACE (user_data), signals[NEW_BSS], 0, props);
|
||||||
|
|
||||||
if (!dbus_g_proxy_end_call (proxy, call_id, &err,
|
|
||||||
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &array,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
nm_log_warn (LOGD_SUPPLICANT, "could not get scan results: %s.", err->message);
|
|
||||||
g_error_free (err);
|
|
||||||
} else {
|
|
||||||
int i;
|
|
||||||
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
|
||||||
|
|
||||||
/* Notify listeners of the result of the scan */
|
|
||||||
g_signal_emit (info->interface, signals[SCAN_RESULTS], 0, array->len);
|
|
||||||
|
|
||||||
/* Fire off a "properties" call for each returned BSSID */
|
|
||||||
for (i = 0; i < array->len; i++) {
|
|
||||||
char *op = g_ptr_array_index (array, i);
|
|
||||||
|
|
||||||
request_bssid_properties (info->interface, op);
|
|
||||||
g_free (op);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_ptr_array_free (array, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
request_scan_results (gpointer user_data)
|
|
||||||
{
|
|
||||||
NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data);
|
|
||||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
|
||||||
NMSupplicantInfo *info;
|
|
||||||
DBusGProxyCall *call;
|
|
||||||
GTimeVal cur_time;
|
|
||||||
|
|
||||||
priv->scan_results_timeout = 0;
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv->iface_proxy != NULL, FALSE);
|
|
||||||
|
|
||||||
info = nm_supplicant_info_new (self, priv->iface_proxy, priv->other_pcalls);
|
|
||||||
call = dbus_g_proxy_begin_call (priv->iface_proxy, "scanResults",
|
|
||||||
scan_results_cb,
|
|
||||||
info,
|
|
||||||
nm_supplicant_info_destroy,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
nm_supplicant_info_set_call (info, call);
|
|
||||||
|
|
||||||
g_get_current_time (&cur_time);
|
|
||||||
priv->last_scan = cur_time.tv_sec;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
wpas_iface_query_scan_results (DBusGProxy *proxy, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (user_data);
|
|
||||||
GTimeVal cur_time;
|
|
||||||
|
|
||||||
/* Only query scan results if a query is not queued */
|
|
||||||
if (priv->scan_results_timeout)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_get_current_time (&cur_time);
|
|
||||||
|
|
||||||
/* Only fetch scan results every 4s max, but initially do it right away */
|
|
||||||
if (priv->last_scan + 4 < cur_time.tv_sec) {
|
|
||||||
priv->scan_results_timeout = g_idle_add (request_scan_results,
|
|
||||||
user_data);
|
|
||||||
} else {
|
|
||||||
priv->scan_results_timeout =
|
|
||||||
g_timeout_add_seconds ((4 - (cur_time.tv_sec - priv->last_scan)),
|
|
||||||
request_scan_results, user_data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wpas_state_string_to_enum (const char *str_state)
|
wpas_state_string_to_enum (const char *str_state)
|
||||||
{
|
{
|
||||||
if (!strcmp (str_state, "DISCONNECTED"))
|
if (!strcmp (str_state, "disconnected"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED;
|
return NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED;
|
||||||
else if (!strcmp (str_state, "INACTIVE"))
|
else if (!strcmp (str_state, "inactive"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_INACTIVE;
|
return NM_SUPPLICANT_INTERFACE_STATE_INACTIVE;
|
||||||
else if (!strcmp (str_state, "SCANNING"))
|
else if (!strcmp (str_state, "scanning"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_SCANNING;
|
return NM_SUPPLICANT_INTERFACE_STATE_SCANNING;
|
||||||
else if (!strcmp (str_state, "ASSOCIATING"))
|
else if (!strcmp (str_state, "associating"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING;
|
return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING;
|
||||||
else if (!strcmp (str_state, "ASSOCIATED"))
|
else if (!strcmp (str_state, "associated"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED;
|
return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED;
|
||||||
else if (!strcmp (str_state, "4WAY_HANDSHAKE"))
|
else if (!strcmp (str_state, "4way_handshake"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE;
|
return NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE;
|
||||||
else if (!strcmp (str_state, "GROUP_HANDSHAKE"))
|
else if (!strcmp (str_state, "group_handshake"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE;
|
return NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE;
|
||||||
else if (!strcmp (str_state, "COMPLETED"))
|
else if (!strcmp (str_state, "completed"))
|
||||||
return NM_SUPPLICANT_INTERFACE_STATE_COMPLETED;
|
return NM_SUPPLICANT_INTERFACE_STATE_COMPLETED;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -372,18 +304,16 @@ set_state (NMSupplicantInterface *self, guint32 new_state)
|
|||||||
|
|
||||||
if (priv->iface_proxy) {
|
if (priv->iface_proxy) {
|
||||||
dbus_g_proxy_disconnect_signal (priv->iface_proxy,
|
dbus_g_proxy_disconnect_signal (priv->iface_proxy,
|
||||||
"StateChange",
|
"PropertiesChanged",
|
||||||
G_CALLBACK (wpas_iface_handle_state_change),
|
G_CALLBACK (wpas_iface_properties_changed),
|
||||||
self);
|
self);
|
||||||
|
|
||||||
dbus_g_proxy_disconnect_signal (priv->iface_proxy,
|
dbus_g_proxy_disconnect_signal (priv->iface_proxy,
|
||||||
"ScanResultsAvailable",
|
"ScanDone",
|
||||||
G_CALLBACK (wpas_iface_query_scan_results),
|
G_CALLBACK (wpas_iface_scan_done),
|
||||||
self);
|
self);
|
||||||
|
|
||||||
dbus_g_proxy_disconnect_signal (priv->iface_proxy,
|
dbus_g_proxy_disconnect_signal (priv->iface_proxy,
|
||||||
"Scanning",
|
"BSSAdded",
|
||||||
G_CALLBACK (wpas_iface_handle_scanning),
|
G_CALLBACK (wpas_iface_bss_added),
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,103 +322,32 @@ set_state (NMSupplicantInterface *self, guint32 new_state)
|
|||||||
g_signal_emit (self, signals[STATE], 0, priv->state, old_state);
|
g_signal_emit (self, signals[STATE], 0, priv->state, old_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Supplicant state signal handler */
|
|
||||||
static void
|
static void
|
||||||
wpas_iface_handle_state_change (DBusGProxy *proxy,
|
set_state_from_string (NMSupplicantInterface *self, const char *new_state)
|
||||||
const char *str_new_state,
|
|
||||||
const char *str_old_state,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
int enum_state = wpas_state_string_to_enum (str_new_state);
|
int state;
|
||||||
|
|
||||||
g_return_if_fail (enum_state > 0);
|
state = wpas_state_string_to_enum (new_state);
|
||||||
|
g_warn_if_fail (state > 0);
|
||||||
set_state (NM_SUPPLICANT_INTERFACE (user_data), (guint32) enum_state);
|
if (state > 0)
|
||||||
}
|
set_state (self, (guint32) state);
|
||||||
|
|
||||||
/* Explicit state request reply handler */
|
|
||||||
static void
|
|
||||||
iface_state_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
|
||||||
GError *err = NULL;
|
|
||||||
char *state_str = NULL;
|
|
||||||
int enum_state;
|
|
||||||
|
|
||||||
if (!dbus_g_proxy_end_call (proxy, call_id, &err,
|
|
||||||
G_TYPE_STRING, &state_str,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
nm_log_warn (LOGD_SUPPLICANT, "could not get interface state: %s.", err->message);
|
|
||||||
g_error_free (err);
|
|
||||||
} else {
|
|
||||||
enum_state = wpas_state_string_to_enum (state_str);
|
|
||||||
g_warn_if_fail (enum_state > 0);
|
|
||||||
|
|
||||||
if (enum_state > 0)
|
|
||||||
set_state (info->interface, (guint32) enum_state);
|
|
||||||
g_free (state_str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wpas_iface_get_state (NMSupplicantInterface *self)
|
set_scanning (NMSupplicantInterface *self, gboolean new_scanning)
|
||||||
{
|
{
|
||||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
||||||
NMSupplicantInfo *info;
|
GTimeVal cur_time;
|
||||||
DBusGProxyCall *call;
|
|
||||||
|
|
||||||
info = nm_supplicant_info_new (self, priv->iface_proxy, priv->other_pcalls);
|
if (priv->scanning != new_scanning) {
|
||||||
call = dbus_g_proxy_begin_call (priv->iface_proxy, "state",
|
priv->scanning = new_scanning;
|
||||||
iface_state_cb,
|
|
||||||
info,
|
|
||||||
nm_supplicant_info_destroy,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
nm_supplicant_info_set_call (info, call);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
/* Cache time of last scan completion */
|
||||||
iface_scanning_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
if (priv->scanning == FALSE) {
|
||||||
{
|
g_get_current_time (&cur_time);
|
||||||
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
priv->last_scan = cur_time.tv_sec;
|
||||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info->interface);
|
|
||||||
gboolean scanning = FALSE;
|
|
||||||
|
|
||||||
if (dbus_g_proxy_end_call (proxy, call_id, NULL,
|
|
||||||
G_TYPE_BOOLEAN, &scanning,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
if (scanning != priv->scanning) {
|
|
||||||
priv->scanning = scanning;
|
|
||||||
g_object_notify (G_OBJECT (info->interface), "scanning");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
wpas_iface_get_scanning (NMSupplicantInterface *self)
|
|
||||||
{
|
|
||||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
|
||||||
NMSupplicantInfo *info;
|
|
||||||
DBusGProxyCall *call;
|
|
||||||
|
|
||||||
info = nm_supplicant_info_new (self, priv->iface_proxy, priv->other_pcalls);
|
|
||||||
call = dbus_g_proxy_begin_call (priv->iface_proxy, "scanning",
|
|
||||||
iface_scanning_cb,
|
|
||||||
info,
|
|
||||||
nm_supplicant_info_destroy,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
nm_supplicant_info_set_call (info, call);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
wpas_iface_handle_scanning (DBusGProxy *proxy,
|
|
||||||
gboolean scanning,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data);
|
|
||||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
if (scanning != priv->scanning) {
|
|
||||||
priv->scanning = scanning;
|
|
||||||
g_object_notify (G_OBJECT (self), "scanning");
|
g_object_notify (G_OBJECT (self), "scanning");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -508,6 +367,78 @@ nm_supplicant_interface_get_scanning (NMSupplicantInterface *self)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wpas_iface_scan_done (DBusGProxy *proxy,
|
||||||
|
gboolean success,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data);
|
||||||
|
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
||||||
|
GTimeVal cur_time;
|
||||||
|
|
||||||
|
/* Cache last scan completed time */
|
||||||
|
g_get_current_time (&cur_time);
|
||||||
|
priv->last_scan = cur_time.tv_sec;
|
||||||
|
|
||||||
|
g_signal_emit (self, signals[SCAN_DONE], 0, success);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wpas_iface_properties_changed (DBusGProxy *proxy,
|
||||||
|
GHashTable *props,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
NMSupplicantInterface *self = NM_SUPPLICANT_INTERFACE (user_data);
|
||||||
|
GValue *value;
|
||||||
|
|
||||||
|
value = g_hash_table_lookup (props, "Scanning");
|
||||||
|
if (value && G_VALUE_HOLDS_BOOLEAN (value))
|
||||||
|
set_scanning (self, g_value_get_boolean (value));
|
||||||
|
|
||||||
|
value = g_hash_table_lookup (props, "State");
|
||||||
|
if (value && G_VALUE_HOLDS_STRING (value))
|
||||||
|
set_state_from_string (self, g_value_get_string (value));
|
||||||
|
|
||||||
|
value = g_hash_table_lookup (props, "BSSs");
|
||||||
|
if (value && G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH))
|
||||||
|
request_bss_properties (self, g_value_get_boxed (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
iface_get_props_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
||||||
|
{
|
||||||
|
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
||||||
|
GHashTable *props = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (dbus_g_proxy_end_call (proxy, call_id, &error,
|
||||||
|
DBUS_TYPE_G_MAP_OF_VARIANT, &props,
|
||||||
|
G_TYPE_INVALID)) {
|
||||||
|
wpas_iface_properties_changed (NULL, props, info->interface);
|
||||||
|
} else {
|
||||||
|
nm_log_warn (LOGD_SUPPLICANT, "could not get interface properties: %s.",
|
||||||
|
error && error->message ? error->message : "(unknown)");
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wpas_iface_get_props (NMSupplicantInterface *self)
|
||||||
|
{
|
||||||
|
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
||||||
|
NMSupplicantInfo *info;
|
||||||
|
DBusGProxyCall *call;
|
||||||
|
|
||||||
|
info = nm_supplicant_info_new (self, priv->props_proxy, priv->other_pcalls);
|
||||||
|
call = dbus_g_proxy_begin_call (priv->props_proxy, "GetAll",
|
||||||
|
iface_get_props_cb,
|
||||||
|
info,
|
||||||
|
nm_supplicant_info_destroy,
|
||||||
|
G_TYPE_STRING, WPAS_DBUS_IFACE_INTERFACE,
|
||||||
|
G_TYPE_INVALID);
|
||||||
|
nm_supplicant_info_set_call (info, call);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
interface_add_done (NMSupplicantInterface *self, char *path)
|
interface_add_done (NMSupplicantInterface *self, char *path)
|
||||||
{
|
{
|
||||||
@@ -522,31 +453,38 @@ interface_add_done (NMSupplicantInterface *self, char *path)
|
|||||||
path,
|
path,
|
||||||
WPAS_DBUS_IFACE_INTERFACE);
|
WPAS_DBUS_IFACE_INTERFACE);
|
||||||
|
|
||||||
dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_STRING,
|
dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
G_TYPE_STRING, G_TYPE_STRING,
|
DBUS_TYPE_G_MAP_OF_VARIANT,
|
||||||
G_TYPE_INVALID);
|
G_TYPE_INVALID);
|
||||||
dbus_g_proxy_add_signal (priv->iface_proxy, "StateChange", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
|
dbus_g_proxy_add_signal (priv->iface_proxy, "PropertiesChanged",
|
||||||
dbus_g_proxy_connect_signal (priv->iface_proxy, "StateChange",
|
DBUS_TYPE_G_MAP_OF_VARIANT, G_TYPE_INVALID);
|
||||||
G_CALLBACK (wpas_iface_handle_state_change),
|
dbus_g_proxy_connect_signal (priv->iface_proxy, "PropertiesChanged",
|
||||||
|
G_CALLBACK (wpas_iface_properties_changed),
|
||||||
|
self, NULL);
|
||||||
|
|
||||||
|
dbus_g_proxy_add_signal (priv->iface_proxy, "ScanDone", G_TYPE_INVALID);
|
||||||
|
dbus_g_proxy_connect_signal (priv->iface_proxy, "ScanDone",
|
||||||
|
G_CALLBACK (wpas_iface_scan_done),
|
||||||
self,
|
self,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (priv->iface_proxy, "ScanResultsAvailable", G_TYPE_INVALID);
|
dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED,
|
||||||
dbus_g_proxy_connect_signal (priv->iface_proxy, "ScanResultsAvailable",
|
G_TYPE_NONE,
|
||||||
G_CALLBACK (wpas_iface_query_scan_results),
|
G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT,
|
||||||
|
G_TYPE_INVALID);
|
||||||
|
dbus_g_proxy_add_signal (priv->iface_proxy, "BSSAdded", G_TYPE_INVALID);
|
||||||
|
dbus_g_proxy_connect_signal (priv->iface_proxy, "BSSAdded",
|
||||||
|
G_CALLBACK (wpas_iface_bss_added),
|
||||||
self,
|
self,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (priv->iface_proxy, "Scanning", G_TYPE_BOOLEAN, G_TYPE_INVALID);
|
priv->props_proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
|
||||||
dbus_g_proxy_connect_signal (priv->iface_proxy, "Scanning",
|
WPAS_DBUS_SERVICE,
|
||||||
G_CALLBACK (wpas_iface_handle_scanning),
|
path,
|
||||||
self,
|
DBUS_INTERFACE_PROPERTIES);
|
||||||
NULL);
|
/* Get initial properties */
|
||||||
|
wpas_iface_get_props (self);
|
||||||
/* Interface added to the supplicant; get its initial state. */
|
|
||||||
wpas_iface_get_state (self);
|
|
||||||
wpas_iface_get_scanning (self);
|
|
||||||
|
|
||||||
set_state (self, NM_SUPPLICANT_INTERFACE_STATE_READY);
|
set_state (self, NM_SUPPLICANT_INTERFACE_STATE_READY);
|
||||||
}
|
}
|
||||||
@@ -743,7 +681,7 @@ nm_supplicant_interface_disconnect (NMSupplicantInterface * self)
|
|||||||
|
|
||||||
/* Remove any network that was added by NetworkManager */
|
/* Remove any network that was added by NetworkManager */
|
||||||
if (priv->net_proxy) {
|
if (priv->net_proxy) {
|
||||||
dbus_g_proxy_begin_call (priv->iface_proxy, "removeNetwork",
|
dbus_g_proxy_begin_call (priv->iface_proxy, "RemoveNetwork",
|
||||||
remove_network_cb,
|
remove_network_cb,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
DBUS_TYPE_G_OBJECT_PATH, dbus_g_proxy_get_path (priv->net_proxy),
|
DBUS_TYPE_G_OBJECT_PATH, dbus_g_proxy_get_path (priv->net_proxy),
|
||||||
@@ -753,7 +691,7 @@ nm_supplicant_interface_disconnect (NMSupplicantInterface * self)
|
|||||||
priv->net_proxy = NULL;
|
priv->net_proxy = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_g_proxy_begin_call (priv->iface_proxy, "disconnect",
|
dbus_g_proxy_begin_call (priv->iface_proxy, "Disconnect",
|
||||||
disconnect_cb,
|
disconnect_cb,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_TYPE_INVALID);
|
G_TYPE_INVALID);
|
||||||
@@ -789,7 +727,7 @@ set_network_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
|||||||
DBusGProxyCall *call;
|
DBusGProxyCall *call;
|
||||||
|
|
||||||
info = nm_supplicant_info_new (info->interface, priv->iface_proxy, priv->assoc_pcalls);
|
info = nm_supplicant_info_new (info->interface, priv->iface_proxy, priv->assoc_pcalls);
|
||||||
call = dbus_g_proxy_begin_call (priv->iface_proxy, "selectNetwork",
|
call = dbus_g_proxy_begin_call (priv->iface_proxy, "SelectNetwork",
|
||||||
select_network_cb,
|
select_network_cb,
|
||||||
info,
|
info,
|
||||||
nm_supplicant_info_destroy,
|
nm_supplicant_info_destroy,
|
||||||
@@ -1002,17 +940,12 @@ scan_request_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
|
|||||||
{
|
{
|
||||||
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
guint32 success = 0;
|
|
||||||
|
|
||||||
if (!dbus_g_proxy_end_call (proxy, call_id, &err,
|
if (!dbus_g_proxy_end_call (proxy, call_id, &err, G_TYPE_INVALID)) {
|
||||||
G_TYPE_UINT, &success,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
nm_log_warn (LOGD_SUPPLICANT, "Could not get scan request result: %s", err->message);
|
nm_log_warn (LOGD_SUPPLICANT, "Could not get scan request result: %s", err->message);
|
||||||
g_error_free (err);
|
|
||||||
}
|
}
|
||||||
|
g_signal_emit (info->interface, signals[SCAN_DONE], 0, err ? FALSE : TRUE);
|
||||||
/* Notify listeners of the result of the scan */
|
g_clear_error (&err);
|
||||||
g_signal_emit (info->interface, signals[SCAN_REQ_RESULT], 0, !!success);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -1180,9 +1113,6 @@ get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_STATE:
|
|
||||||
g_value_set_uint (value, NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object)->state);
|
|
||||||
break;
|
|
||||||
case PROP_SCANNING:
|
case PROP_SCANNING:
|
||||||
g_value_set_boolean (value, NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object)->scanning);
|
g_value_set_boolean (value, NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object)->scanning);
|
||||||
break;
|
break;
|
||||||
@@ -1210,6 +1140,9 @@ dispose (GObject *object)
|
|||||||
cancel_all_callbacks (priv->assoc_pcalls);
|
cancel_all_callbacks (priv->assoc_pcalls);
|
||||||
nm_call_store_destroy (priv->assoc_pcalls);
|
nm_call_store_destroy (priv->assoc_pcalls);
|
||||||
|
|
||||||
|
if (priv->props_proxy)
|
||||||
|
g_object_unref (priv->props_proxy);
|
||||||
|
|
||||||
if (priv->iface_proxy)
|
if (priv->iface_proxy)
|
||||||
g_object_unref (priv->iface_proxy);
|
g_object_unref (priv->iface_proxy);
|
||||||
|
|
||||||
@@ -1219,9 +1152,6 @@ dispose (GObject *object)
|
|||||||
if (priv->wpas_proxy)
|
if (priv->wpas_proxy)
|
||||||
g_object_unref (priv->wpas_proxy);
|
g_object_unref (priv->wpas_proxy);
|
||||||
|
|
||||||
if (priv->scan_results_timeout)
|
|
||||||
g_source_remove (priv->scan_results_timeout);
|
|
||||||
|
|
||||||
if (priv->smgr) {
|
if (priv->smgr) {
|
||||||
if (priv->smgr_avail_id)
|
if (priv->smgr_avail_id)
|
||||||
g_signal_handler_disconnect (priv->smgr, priv->smgr_avail_id);
|
g_signal_handler_disconnect (priv->smgr, priv->smgr_avail_id);
|
||||||
@@ -1254,15 +1184,6 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
|||||||
object_class->get_property = get_property;
|
object_class->get_property = get_property;
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
g_object_class_install_property (object_class, PROP_STATE,
|
|
||||||
g_param_spec_uint ("state",
|
|
||||||
"State",
|
|
||||||
"State of the supplicant interface",
|
|
||||||
NM_SUPPLICANT_INTERFACE_STATE_INIT,
|
|
||||||
NM_SUPPLICANT_INTERFACE_STATE_LAST - 1,
|
|
||||||
NM_SUPPLICANT_INTERFACE_STATE_INIT,
|
|
||||||
G_PARAM_READABLE));
|
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_SCANNING,
|
g_object_class_install_property (object_class, PROP_SCANNING,
|
||||||
g_param_spec_boolean ("scanning",
|
g_param_spec_boolean ("scanning",
|
||||||
"Scanning",
|
"Scanning",
|
||||||
@@ -1272,7 +1193,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
|||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
signals[STATE] =
|
signals[STATE] =
|
||||||
g_signal_new ("state",
|
g_signal_new (NM_SUPPLICANT_INTERFACE_STATE,
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, state),
|
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, state),
|
||||||
@@ -1281,7 +1202,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
|||||||
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
|
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
|
||||||
|
|
||||||
signals[REMOVED] =
|
signals[REMOVED] =
|
||||||
g_signal_new ("removed",
|
g_signal_new (NM_SUPPLICANT_INTERFACE_REMOVED,
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, removed),
|
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, removed),
|
||||||
@@ -1289,35 +1210,26 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
|||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
signals[SCANNED_AP] =
|
signals[NEW_BSS] =
|
||||||
g_signal_new ("scanned-ap",
|
g_signal_new (NM_SUPPLICANT_INTERFACE_NEW_BSS,
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, scanned_ap),
|
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, new_bss),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__POINTER,
|
g_cclosure_marshal_VOID__POINTER,
|
||||||
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
||||||
|
|
||||||
signals[SCAN_REQ_RESULT] =
|
signals[SCAN_DONE] =
|
||||||
g_signal_new ("scan-req-result",
|
g_signal_new (NM_SUPPLICANT_INTERFACE_SCAN_DONE,
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, scan_req_result),
|
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, scan_done),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__BOOLEAN,
|
g_cclosure_marshal_VOID__BOOLEAN,
|
||||||
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
|
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
|
||||||
|
|
||||||
signals[SCAN_RESULTS] =
|
|
||||||
g_signal_new ("scan-results",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, scan_results),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__UINT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
|
||||||
|
|
||||||
signals[CONNECTION_ERROR] =
|
signals[CONNECTION_ERROR] =
|
||||||
g_signal_new ("connection-error",
|
g_signal_new (NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR,
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, connection_error),
|
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, connection_error),
|
||||||
|
@@ -53,6 +53,12 @@ enum {
|
|||||||
#define NM_IS_SUPPLICANT_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SUPPLICANT_INTERFACE))
|
#define NM_IS_SUPPLICANT_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SUPPLICANT_INTERFACE))
|
||||||
#define NM_SUPPLICANT_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SUPPLICANT_INTERFACE, NMSupplicantInterfaceClass))
|
#define NM_SUPPLICANT_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SUPPLICANT_INTERFACE, NMSupplicantInterfaceClass))
|
||||||
|
|
||||||
|
#define NM_SUPPLICANT_INTERFACE_STATE "state"
|
||||||
|
#define NM_SUPPLICANT_INTERFACE_REMOVED "removed"
|
||||||
|
#define NM_SUPPLICANT_INTERFACE_NEW_BSS "new-bss"
|
||||||
|
#define NM_SUPPLICANT_INTERFACE_SCAN_DONE "scan-done"
|
||||||
|
#define NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR "connection-error"
|
||||||
|
|
||||||
struct _NMSupplicantInterface {
|
struct _NMSupplicantInterface {
|
||||||
GObject parent;
|
GObject parent;
|
||||||
};
|
};
|
||||||
@@ -70,18 +76,14 @@ typedef struct {
|
|||||||
/* interface was removed by the supplicant */
|
/* interface was removed by the supplicant */
|
||||||
void (*removed) (NMSupplicantInterface * iface);
|
void (*removed) (NMSupplicantInterface * iface);
|
||||||
|
|
||||||
/* interface saw a new access point from a scan */
|
/* interface saw a new BSS */
|
||||||
void (*scanned_ap) (NMSupplicantInterface * iface,
|
void (*new_bss) (NMSupplicantInterface *iface,
|
||||||
DBusMessage * message);
|
GHashTable *props);
|
||||||
|
|
||||||
/* result of a wireless scan request */
|
/* wireless scan is done */
|
||||||
void (*scan_req_result) (NMSupplicantInterface * iface,
|
void (*scan_done) (NMSupplicantInterface *iface,
|
||||||
gboolean success);
|
gboolean success);
|
||||||
|
|
||||||
/* scan results returned from supplicant */
|
|
||||||
void (*scan_results) (NMSupplicantInterface * iface,
|
|
||||||
guint num_bssids);
|
|
||||||
|
|
||||||
/* an error occurred during a connection request */
|
/* an error occurred during a connection request */
|
||||||
void (*connection_error) (NMSupplicantInterface * iface,
|
void (*connection_error) (NMSupplicantInterface * iface,
|
||||||
const char * name,
|
const char * name,
|
||||||
|
Reference in New Issue
Block a user