
Remove NMAPSecurity objects, they are replaced with flags on the APs for each AP's capabilities, and by NMConnection/NMSettings objects for user defined connections. * include/NetworkManager.h - Redefine 802.11 security properties. There are now device capabilities and AP flags and AP security flags. It was way to unclear before. * src/Makefile.am src/nm-ap-security-leap.h src/nm-ap-security-leap.c src/nm-ap-security-wpa-eap.c src/nm-ap-security-wpa-eap.h src/nm-ap-security-private.h src/nm-ap-security-wpa-psk.c src/nm-ap-security-wpa-psk.h src/nm-ap-security-wep.c src/nm-ap-security-wep.h src/nm-ap-security.c src/nm-ap-security.h - Removed, to be replaced with NMConnection/NMSettings objects * src/nm-dbus-nmi.c src/nm-dbus-nmi.h - Removed, to be replaced by code that talks to the new info daemon interface and gets NMConnection/NMSettings objects * src/backends/NetworkManagerSuSE.c - Remove usage of NMAPSecurity; should be replaced by a system-level info-daemon that does the same thing but talks the new info-daemon D-Bus interface * src/NetworkManagerAP.h src/NetworkManagerAP.c src/NetworkManagerAPList.c libnm-glib/libnm-glib-test.c - Remove usage of NMAPSecurity objects and adjust to new flags for WPA/RSN * libnm-glib/nm-access-point.c libnm-glib/nm-access-point.h introspection/nm-access-point.xml test/nm-tool.c - Adjust to new flags for AP security * utils/nm-utils.c utils/nm-utils.h src/vpn-manager/nm-dbus-vpn.c - Remove D-Bus pending call stuff from nm-utils and put it in the VPN stuff which is the only place it's used * src/nm-device-interface.c src/nm-device-interface.h introspection/nm-device.xml src/nm-activation-request.c src/nm-activation-request.h src/nm-device.c - Add a new 'specific_object' argument that hints to NM what actual AP or other device-specific thing the connection should apply to. NMConnection objects can apply to more than one actual device/AP. * libnm-util/nm-connection.c * libnm-util/nm-connection.h - Add 'have_secrets" call stubs * libnm-util/cipher.h - Move NM_AUTH_TYPE_* defines here for now * src/nm-device-802-11-wireless.c - Remove usage of NMAPSecurity, to be replaced with NMConnection/ NMSettings objects * src/NetworkManagerDbus.c * src/NetworkManagerPolicy.c - Remove usage of update_allowed_networks, should be pushing data in a different manner git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2738 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
182 lines
4.6 KiB
C
182 lines
4.6 KiB
C
#include "nm-access-point.h"
|
|
#include "NetworkManager.h"
|
|
|
|
#include "nm-access-point-bindings.h"
|
|
|
|
G_DEFINE_TYPE (NMAccessPoint, nm_access_point, NM_TYPE_OBJECT)
|
|
|
|
#define NM_ACCESS_POINT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACCESS_POINT, NMAccessPointPrivate))
|
|
|
|
typedef struct {
|
|
DBusGProxy *ap_proxy;
|
|
gint8 strength;
|
|
} NMAccessPointPrivate;
|
|
|
|
enum {
|
|
STRENGTH_CHANGED,
|
|
|
|
LAST_SIGNAL
|
|
};
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
static void strength_changed_proxy (NMAccessPoint *ap, guchar strength);
|
|
|
|
static void
|
|
nm_access_point_init (NMAccessPoint *ap)
|
|
{
|
|
}
|
|
|
|
static GObject*
|
|
constructor (GType type,
|
|
guint n_construct_params,
|
|
GObjectConstructParam *construct_params)
|
|
{
|
|
NMObject *object;
|
|
NMAccessPointPrivate *priv;
|
|
|
|
object = (NMObject *) G_OBJECT_CLASS (nm_access_point_parent_class)->constructor (type,
|
|
n_construct_params,
|
|
construct_params);
|
|
if (!object)
|
|
return NULL;
|
|
|
|
priv = NM_ACCESS_POINT_GET_PRIVATE (object);
|
|
|
|
priv->ap_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (object),
|
|
NM_DBUS_SERVICE,
|
|
nm_object_get_path (object),
|
|
NM_DBUS_INTERFACE_DEVICE);
|
|
|
|
dbus_g_proxy_add_signal (priv->ap_proxy, "StrengthChanged", G_TYPE_UCHAR, G_TYPE_INVALID);
|
|
dbus_g_proxy_connect_signal (priv->ap_proxy,
|
|
"StrengthChanged",
|
|
G_CALLBACK (strength_changed_proxy),
|
|
NULL,
|
|
NULL);
|
|
return G_OBJECT (object);
|
|
}
|
|
|
|
|
|
static void
|
|
nm_access_point_class_init (NMAccessPointClass *ap_class)
|
|
{
|
|
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
|
|
|
|
g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate));
|
|
|
|
/* virtual methods */
|
|
object_class->constructor = constructor;
|
|
|
|
/* signals */
|
|
signals[STRENGTH_CHANGED] =
|
|
g_signal_new ("strength-changed",
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
G_SIGNAL_RUN_FIRST,
|
|
G_STRUCT_OFFSET (NMAccessPointClass, strength_changed),
|
|
NULL, NULL,
|
|
g_cclosure_marshal_VOID__UCHAR,
|
|
G_TYPE_NONE, 1,
|
|
G_TYPE_UCHAR);
|
|
|
|
}
|
|
|
|
NMAccessPoint *
|
|
nm_access_point_new (DBusGConnection *connection, const char *path)
|
|
{
|
|
return (NMAccessPoint *) g_object_new (NM_TYPE_ACCESS_POINT,
|
|
NM_OBJECT_CONNECTION, connection,
|
|
NM_OBJECT_PATH, path,
|
|
NULL);
|
|
}
|
|
|
|
static void
|
|
strength_changed_proxy (NMAccessPoint *ap, guchar strength)
|
|
{
|
|
NMAccessPointPrivate *priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
|
|
|
|
if (priv->strength != strength) {
|
|
priv->strength = strength;
|
|
g_signal_emit (ap, signals[STRENGTH_CHANGED], 0, strength);
|
|
}
|
|
}
|
|
|
|
guint32
|
|
nm_access_point_get_flags (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_FLAGS_NONE);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Flags");
|
|
}
|
|
|
|
guint32
|
|
nm_access_point_get_wpa_flags (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_SEC_NONE);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "WPAFlags");
|
|
}
|
|
|
|
guint32
|
|
nm_access_point_get_rsn_flags (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_SEC_NONE);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "RSNFlags");
|
|
}
|
|
|
|
GByteArray *
|
|
nm_access_point_get_ssid (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL);
|
|
|
|
return nm_object_get_byte_array_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Ssid");
|
|
}
|
|
|
|
gdouble
|
|
nm_access_point_get_frequency (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
|
|
return nm_object_get_double_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Frequency");
|
|
}
|
|
|
|
char *
|
|
nm_access_point_get_hw_address (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL);
|
|
|
|
return nm_object_get_string_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "HwAddress");
|
|
}
|
|
|
|
int
|
|
nm_access_point_get_mode (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
|
|
return nm_object_get_int_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Mode");
|
|
}
|
|
|
|
guint32
|
|
nm_access_point_get_rate (NMAccessPoint *ap)
|
|
{
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Rate");
|
|
}
|
|
|
|
gint8
|
|
nm_access_point_get_strength (NMAccessPoint *ap)
|
|
{
|
|
NMAccessPointPrivate *priv;
|
|
|
|
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
|
|
priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
|
|
|
|
if (priv->strength == 0)
|
|
priv->strength = nm_object_get_byte_property (NM_OBJECT (ap), NM_DBUS_INTERFACE_ACCESS_POINT, "Strength");
|
|
|
|
return priv->strength;
|
|
}
|