mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 02:04:17 +00:00
2007-05-07 Tambet Ingo <tambet@ximian.com>
* libnm-glib/Makefile.am: Link with libnm-util to gain access to NMConnection. * libnm-glib/nm-device-802-11-wireless.c: (nm_device_802_3_ethernet_activate): Remove. * libnm-glib/nm-device-802-3-ethernet.c (nm_device_802_3_ethernet_activate): Remove. * libnm-glib/nm-device.c (nm_device_activate): Implement. * src/nm-device-802-3-ethernet.c: Implement the new activation using NMConnection. * src/nm-device-802-11-wireless.c: Store an activation AP once the activation has started. Implement the new activation using NMConnection. * src/nm-activation-request.c: Store a generic connection object instead of a wireless-specific AP. * src/NetworkManagerPolicy.c (create_connection): Implement. Depending on device type, create a device specific connection object suitable for device activation. * src/nm-device.c (nm_device_activate): Re-implement. Call the device specific check to validate the connection and on success start the activation. * src/nm-device-interface.h: Add a activate virtual function to the interface definition. * src/nm-device-interface.c (nm_device_interface_activate): Implement. (impl_device_activate): Implement. * introspection/nm-device.xml: Add a generic device activation interface that accepts an abstract NMConnection structure that has device-specific information in it. * introspection/nm-device-802-3-ethernet.xml: Remove the wired-specific activation interface. * introspection/nm-device-802-11-wireless.xml: Remove the wireless-specific activation interface. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2569 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
6c51badc69
commit
ff0fd77b08
45
ChangeLog
45
ChangeLog
|
@ -1,5 +1,50 @@
|
|||
2007-05-07 Tambet Ingo <tambet@ximian.com>
|
||||
|
||||
* libnm-glib/Makefile.am: Link with libnm-util to gain access to
|
||||
NMConnection.
|
||||
|
||||
* libnm-glib/nm-device-802-11-wireless.c:
|
||||
(nm_device_802_3_ethernet_activate): Remove.
|
||||
|
||||
* libnm-glib/nm-device-802-3-ethernet.c
|
||||
(nm_device_802_3_ethernet_activate): Remove.
|
||||
|
||||
* libnm-glib/nm-device.c (nm_device_activate): Implement.
|
||||
|
||||
* src/nm-device-802-3-ethernet.c: Implement the new activation using
|
||||
NMConnection.
|
||||
|
||||
* src/nm-device-802-11-wireless.c: Store an activation AP once the
|
||||
activation has started.
|
||||
Implement the new activation using NMConnection.
|
||||
|
||||
* src/nm-activation-request.c: Store a generic connection object instead
|
||||
of a wireless-specific AP.
|
||||
|
||||
* src/NetworkManagerPolicy.c (create_connection): Implement. Depending
|
||||
on device type, create a device specific connection object suitable for
|
||||
device activation.
|
||||
|
||||
* src/nm-device.c (nm_device_activate): Re-implement. Call the device
|
||||
specific check to validate the connection and on success start the
|
||||
activation.
|
||||
|
||||
* src/nm-device-interface.h: Add a activate virtual function to the
|
||||
interface definition.
|
||||
|
||||
* src/nm-device-interface.c (nm_device_interface_activate): Implement.
|
||||
(impl_device_activate): Implement.
|
||||
|
||||
* introspection/nm-device.xml: Add a generic device activation interface
|
||||
that accepts an abstract NMConnection structure that has device-specific
|
||||
information in it.
|
||||
|
||||
* introspection/nm-device-802-3-ethernet.xml: Remove the wired-specific
|
||||
activation interface.
|
||||
|
||||
* introspection/nm-device-802-11-wireless.xml: Remove the wireless-specific
|
||||
activation interface.
|
||||
|
||||
* libnm-util/nm-connection.c:
|
||||
* libnm-util/nm-connection.h:
|
||||
* libnm-util/nm-setting.c:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/include
|
||||
INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/include -I$(top_srcdir)/libnm-glib -I$(top_srcdir)/libnm-util
|
||||
|
||||
|
||||
NULL=
|
||||
|
||||
|
@ -7,7 +8,6 @@ sbin_PROGRAMS = NetworkManagerDispatcher
|
|||
NetworkManagerDispatcher_CPPFLAGS = \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(GTHREAD_CFLAGS) \
|
||||
-I$(top_builddir)/libnm-glib \
|
||||
-Wall \
|
||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
||||
-DBINDIR=\"$(bindir)\" \
|
||||
|
|
|
@ -2,13 +2,6 @@
|
|||
|
||||
<node name="/">
|
||||
<interface name="org.freedesktop.NetworkManager.Device.Wireless">
|
||||
|
||||
<method name="Activate">
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_activate"/>
|
||||
<arg name="access_point" type="o" direction="in"/>
|
||||
<arg name="user_requested" type="b" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="GetActiveNetworks">
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_get_active_networks"/>
|
||||
<arg name="networks" type="ao" direction="out"/>
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
<node name="/">
|
||||
<interface name="org.freedesktop.NetworkManager.Device.Wired">
|
||||
<method name="Activate">
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_802_3_ethernet_activate"/>
|
||||
<arg name="user_requested" type="b" direction="in"/>
|
||||
</method>
|
||||
|
||||
<property name="HwAddress" type="s" access="read"/>
|
||||
<property name="Speed" type="i" access="read"/>
|
||||
</interface>
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
<node name="/">
|
||||
<interface name="org.freedesktop.NetworkManager.Device">
|
||||
<method name="Activate">
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_activate"/>
|
||||
<arg name="connection" type="a{sa{sv}}" direction="in"/>
|
||||
</method>
|
||||
<method name="Deactivate">
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_deactivate"/>
|
||||
</method>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
INCLUDES = -I$(top_srcdir)/include
|
||||
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/libnm-util
|
||||
|
||||
BUILT_SOURCES = \
|
||||
nm-client-bindings.h \
|
||||
|
@ -39,7 +39,7 @@ libnm_glib_la_SOURCES = \
|
|||
nm-vpn-connection.c \
|
||||
nm-marshal-main.c
|
||||
|
||||
libnm_glib_la_LDFLAGS = $(GLIB_LIBS) $(DBUS_LIBS)
|
||||
libnm_glib_la_LDFLAGS = $(GLIB_LIBS) $(DBUS_LIBS) $(top_srcdir)/libnm-util/libnm-util.la
|
||||
|
||||
noinst_PROGRAMS = libnm-glib-test
|
||||
|
||||
|
|
|
@ -273,31 +273,6 @@ device_state_changed (NMDevice *device, NMDeviceState state, gpointer user_data)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
do_stuff (gpointer user_data)
|
||||
{
|
||||
NMClient *client = NM_CLIENT (user_data);
|
||||
GSList *list, *iter;
|
||||
|
||||
list = nm_client_get_devices (client);
|
||||
for (iter = list; iter; iter = iter->next) {
|
||||
if (NM_IS_DEVICE_802_3_ETHERNET (iter->data)) {
|
||||
NMDevice8023Ethernet *device = NM_DEVICE_802_3_ETHERNET (iter->data);
|
||||
|
||||
g_signal_connect (device, "state-changed",
|
||||
G_CALLBACK (device_state_changed),
|
||||
NULL);
|
||||
|
||||
nm_device_802_3_ethernet_activate (device, TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_slist_free (list);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
manager_running (NMClient *client, gboolean running, gpointer user_data)
|
||||
{
|
||||
|
@ -306,8 +281,6 @@ manager_running (NMClient *client, gboolean running, gpointer user_data)
|
|||
/* test_wireless_enabled (client); */
|
||||
test_get_state (client);
|
||||
test_devices (client);
|
||||
|
||||
/* g_idle_add (do_stuff, client); */
|
||||
} else
|
||||
g_print ("NM disappeared\n");
|
||||
}
|
||||
|
|
|
@ -273,25 +273,6 @@ nm_device_802_11_wireless_get_networks (NMDevice80211Wireless *device)
|
|||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_802_11_wireless_activate (NMDevice80211Wireless *device,
|
||||
NMAccessPoint *ap,
|
||||
gboolean user_requested)
|
||||
{
|
||||
GError *err = NULL;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device));
|
||||
g_return_if_fail (NM_IS_ACCESS_POINT (ap));
|
||||
|
||||
if (!org_freedesktop_NetworkManager_Device_Wireless_activate
|
||||
(NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device)->wireless_proxy,
|
||||
dbus_g_proxy_get_path (DBUS_G_PROXY (ap)), user_requested, &err)) {
|
||||
|
||||
g_warning ("Error in wireless_activate: %s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
network_added_proxy (DBusGProxy *proxy, char *path, gpointer user_data)
|
||||
{
|
||||
|
|
|
@ -38,8 +38,5 @@ NMAccessPoint *nm_device_802_11_wireless_get_network_by_path (NMDevice802
|
|||
const char *object_path);
|
||||
|
||||
GSList *nm_device_802_11_wireless_get_networks (NMDevice80211Wireless *device);
|
||||
void nm_device_802_11_wireless_activate (NMDevice80211Wireless *device,
|
||||
NMAccessPoint *ap,
|
||||
gboolean user_requested);
|
||||
|
||||
#endif /* NM_DEVICE_802_11_WIRELESS_H */
|
||||
|
|
|
@ -102,18 +102,3 @@ nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device)
|
|||
return nm_dbus_get_string_property (nm_device_get_properties_proxy (NM_DEVICE (device)),
|
||||
NM_DBUS_INTERFACE_DEVICE_WIRED, "HwAddress");
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_802_3_ethernet_activate (NMDevice8023Ethernet *device, gboolean user_requested)
|
||||
{
|
||||
GError *err = NULL;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE_802_3_ETHERNET (device));
|
||||
|
||||
if (!org_freedesktop_NetworkManager_Device_Wired_activate
|
||||
(NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (device)->ethernet_proxy, user_requested, &err)) {
|
||||
|
||||
g_warning ("Activation failed: %s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,5 @@ NMDevice8023Ethernet *nm_device_802_3_ethernet_new (DBusGConnection *con
|
|||
const char *path);
|
||||
int nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *device);
|
||||
char *nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device);
|
||||
void nm_device_802_3_ethernet_activate (NMDevice8023Ethernet *device,
|
||||
gboolean user_requested);
|
||||
|
||||
#endif /* NM_DEVICE_802_3_ETHERNET_H */
|
||||
|
|
|
@ -218,6 +218,22 @@ nm_device_new (DBusGConnection *connection, const char *path)
|
|||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_activate (NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
GError *err = NULL;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE (device));
|
||||
g_return_if_fail (connection != NULL);
|
||||
|
||||
if (!org_freedesktop_NetworkManager_Device_activate (NM_DEVICE_GET_PRIVATE (device)->device_proxy,
|
||||
nm_connection_to_hash (connection),
|
||||
&err)) {
|
||||
g_warning ("Cannot deactivate device: %s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_deactivate (NMDevice *device)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <dbus/dbus-glib.h>
|
||||
#include "NetworkManager.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
#define NM_TYPE_DEVICE (nm_device_get_type ())
|
||||
#define NM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE, NMDevice))
|
||||
|
@ -31,7 +32,8 @@ typedef struct {
|
|||
GType nm_device_get_type (void);
|
||||
|
||||
NMDevice *nm_device_new (DBusGConnection *connection, const char *path);
|
||||
|
||||
|
||||
void nm_device_activate (NMDevice *device, NMConnection *connection);
|
||||
void nm_device_deactivate (NMDevice *device);
|
||||
|
||||
char *nm_device_get_iface (NMDevice *device);
|
||||
|
|
|
@ -63,15 +63,15 @@ NetworkManager_SOURCES = \
|
|||
nm-ap-security-private.h \
|
||||
nm-ap-security-wep.c \
|
||||
nm-ap-security-wep.h \
|
||||
nm-ap-security-wpa-eap.c \
|
||||
nm-ap-security-wpa-eap.h \
|
||||
nm-ap-security-wpa-psk.c \
|
||||
nm-ap-security-wpa-psk.h \
|
||||
nm-ap-security-leap.c \
|
||||
nm-ap-security-leap.h \
|
||||
nm-marshal-main.c \
|
||||
kernel-types.h \
|
||||
wpa.c \
|
||||
nm-ap-security-wpa-eap.c \
|
||||
nm-ap-security-wpa-eap.h \
|
||||
nm-ap-security-wpa-psk.c \
|
||||
nm-ap-security-wpa-psk.h \
|
||||
nm-ap-security-leap.c \
|
||||
nm-ap-security-leap.h \
|
||||
nm-marshal-main.c \
|
||||
kernel-types.h \
|
||||
wpa.c \
|
||||
wpa.h
|
||||
|
||||
nm-marshal.h: Makefile.am nm-marshal.list
|
||||
|
|
|
@ -156,6 +156,44 @@ static NMDevice * nm_policy_auto_get_best_device (NMPolicy *policy, NMAccessPoin
|
|||
return highest_priority_dev;
|
||||
}
|
||||
|
||||
static NMConnection *
|
||||
create_connection (NMDevice *device, NMAccessPoint *ap)
|
||||
{
|
||||
NMConnection *connection = NULL;
|
||||
NMSetting *setting = NULL;
|
||||
|
||||
if (NM_IS_DEVICE_802_3_ETHERNET (device)) {
|
||||
nm_info ("Will activate connection '%s'.", nm_device_get_iface (device));
|
||||
setting = nm_setting_wired_new ();
|
||||
} else if (NM_IS_DEVICE_802_11_WIRELESS (device) && ap) {
|
||||
NMSettingWireless *wireless;
|
||||
|
||||
nm_info ("Will activate connection '%s/%s'.",
|
||||
nm_device_get_iface (device),
|
||||
nm_ap_get_essid (ap));
|
||||
|
||||
setting = nm_setting_wireless_new ();
|
||||
wireless = (NMSettingWireless *) setting;
|
||||
|
||||
wireless->ssid = g_strdup (nm_ap_get_essid (ap));
|
||||
wireless->mode = 1;
|
||||
} else
|
||||
nm_warning ("Unhandled device type '%s'", G_OBJECT_CLASS_NAME (device));
|
||||
|
||||
if (setting) {
|
||||
NMSettingInfo *info;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
nm_connection_add_setting (connection, setting);
|
||||
|
||||
info = (NMSettingInfo *) nm_setting_info_new ();
|
||||
info->name = g_strdup ("Auto");
|
||||
info->devtype = g_strdup (setting->name);
|
||||
nm_connection_add_setting (connection, (NMSetting *) info);
|
||||
}
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
/*
|
||||
* nm_policy_device_change_check
|
||||
|
@ -251,7 +289,7 @@ nm_policy_device_change_check (gpointer user_data)
|
|||
} else if (NM_IS_DEVICE_802_11_WIRELESS (old_dev)) {
|
||||
/* Only switch if the old device's wireless config is invalid */
|
||||
if (NM_IS_DEVICE_802_11_WIRELESS (new_dev)) {
|
||||
NMAccessPoint *old_ap = nm_act_request_get_ap (old_act_req);
|
||||
NMAccessPoint *old_ap = nm_device_802_11_wireless_get_activation_ap (NM_DEVICE_802_11_WIRELESS (old_dev));
|
||||
const char * old_essid = nm_ap_get_essid (old_ap);
|
||||
int old_mode = nm_ap_get_mode (old_ap);
|
||||
const char * new_essid = nm_ap_get_essid (ap);
|
||||
|
@ -290,17 +328,12 @@ nm_policy_device_change_check (gpointer user_data)
|
|||
}
|
||||
|
||||
if (do_switch) {
|
||||
if (NM_IS_DEVICE_802_3_ETHERNET (new_dev)) {
|
||||
nm_info ("Will activate connection '%s'.",
|
||||
nm_device_get_iface (new_dev));
|
||||
nm_device_802_3_ethernet_activate (NM_DEVICE_802_3_ETHERNET (new_dev), FALSE);
|
||||
} else if (NM_IS_DEVICE_802_11_WIRELESS (new_dev) && ap) {
|
||||
nm_info ("Will activate connection '%s/%s'.",
|
||||
nm_device_get_iface (new_dev),
|
||||
nm_ap_get_essid (ap));
|
||||
nm_device_802_11_wireless_activate (NM_DEVICE_802_11_WIRELESS (new_dev), ap, FALSE);
|
||||
} else
|
||||
nm_warning ("Unhandled device activation");
|
||||
NMConnection *connection;
|
||||
|
||||
connection = create_connection (new_dev, ap);
|
||||
if (connection)
|
||||
nm_device_interface_activate (NM_DEVICE_INTERFACE (new_dev),
|
||||
connection, FALSE);
|
||||
}
|
||||
|
||||
if (ap)
|
||||
|
@ -532,6 +565,14 @@ state_changed (NMManager *manager, NMState state, gpointer user_data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
connections_changed (NMManager *manager, GSList *connections, gpointer user_data)
|
||||
{
|
||||
NMPolicy *policy = (NMPolicy *) user_data;
|
||||
|
||||
nm_info ("policy got %d connections", g_slist_length (connections));
|
||||
}
|
||||
|
||||
NMPolicy *
|
||||
nm_policy_new (NMManager *manager)
|
||||
{
|
||||
|
@ -553,6 +594,9 @@ nm_policy_new (NMManager *manager)
|
|||
g_signal_connect (manager, "state-change",
|
||||
G_CALLBACK (state_changed), policy);
|
||||
|
||||
g_signal_connect (manager, "connections-changed",
|
||||
G_CALLBACK (connections_changed), policy);
|
||||
|
||||
global_policy = policy;
|
||||
|
||||
return policy;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
INCLUDES = -I${top_srcdir} \
|
||||
-I${top_srcdir}/include \
|
||||
-I${top_srcdir}/utils \
|
||||
-I${top_srcdir}/libnm-util \
|
||||
-I${top_srcdir}/src \
|
||||
-I${top_srcdir}/src/named-manager
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
INCLUDES = -I${top_srcdir}/utils -I${top_srcdir}/src -I${top_srcdir}/include
|
||||
INCLUDES = -I${top_srcdir}/utils -I${top_srcdir}/libnm-util -I${top_srcdir}/src -I${top_srcdir}/include
|
||||
|
||||
noinst_LTLIBRARIES = libnamed-manager.la
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ struct NMActRequest
|
|||
{
|
||||
int refcount;
|
||||
NMDevice * dev;
|
||||
NMAccessPoint * ap;
|
||||
NMConnection *connection;
|
||||
NMIP4Config * ip4_config;
|
||||
|
||||
gboolean user_requested;
|
||||
|
@ -42,22 +42,18 @@ struct NMActRequest
|
|||
DBusPendingCall * user_key_pcall;
|
||||
};
|
||||
|
||||
|
||||
NMActRequest * nm_act_request_new (NMDevice *dev, NMAccessPoint *ap, gboolean user_requested)
|
||||
NMActRequest * nm_act_request_new (NMDevice *dev, NMConnection *connection, gboolean user_requested)
|
||||
{
|
||||
NMActRequest * req;
|
||||
|
||||
g_return_val_if_fail (dev != NULL, NULL);
|
||||
g_return_val_if_fail (connection != NULL, NULL);
|
||||
|
||||
if (NM_IS_DEVICE_802_11_WIRELESS (dev))
|
||||
g_return_val_if_fail (ap != NULL, NULL);
|
||||
|
||||
req = g_malloc0 (sizeof (NMActRequest));
|
||||
req = g_slice_new0 (NMActRequest);
|
||||
req->refcount = 1;
|
||||
|
||||
g_object_ref (G_OBJECT (dev));
|
||||
req->dev = dev;
|
||||
req->ap = ap ? g_object_ref (ap) : NULL;
|
||||
req->dev = g_object_ref (G_OBJECT (dev));
|
||||
req->connection = connection;
|
||||
req->user_requested = user_requested;
|
||||
|
||||
return req;
|
||||
|
@ -78,11 +74,8 @@ void nm_act_request_unref (NMActRequest *req)
|
|||
req->refcount--;
|
||||
if (req->refcount <= 0) {
|
||||
g_object_unref (G_OBJECT (req->dev));
|
||||
if (req->ap)
|
||||
g_object_unref (req->ap);
|
||||
|
||||
memset (req, 0, sizeof (NMActRequest));
|
||||
g_free (req);
|
||||
/* FIXME: destroy connection? */
|
||||
g_slice_free (NMActRequest, req);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,11 +87,11 @@ NMDevice * nm_act_request_get_dev (NMActRequest *req)
|
|||
}
|
||||
|
||||
|
||||
NMAccessPoint * nm_act_request_get_ap (NMActRequest *req)
|
||||
NMConnection * nm_act_request_get_connection (NMActRequest *req)
|
||||
{
|
||||
g_return_val_if_fail (req != NULL, NULL);
|
||||
|
||||
return req->ap;
|
||||
return req->connection;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,17 +27,15 @@
|
|||
#include "NetworkManager.h"
|
||||
#include "NetworkManagerMain.h"
|
||||
#include "nm-device.h"
|
||||
#include "NetworkManagerAP.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
|
||||
|
||||
NMActRequest * nm_act_request_new (NMDevice *dev, NMAccessPoint *ap, gboolean user_requested);
|
||||
NMActRequest * nm_act_request_new (NMDevice *dev, NMConnection *connection, gboolean user_requested);
|
||||
void nm_act_request_ref (NMActRequest *req);
|
||||
void nm_act_request_unref (NMActRequest *req);
|
||||
|
||||
NMDevice * nm_act_request_get_dev (NMActRequest *req);
|
||||
NMAccessPoint * nm_act_request_get_ap (NMActRequest *req);
|
||||
NMConnection * nm_act_request_get_connection (NMActRequest *req);
|
||||
gboolean nm_act_request_get_user_requested (NMActRequest *req);
|
||||
|
||||
NMIP4Config * nm_act_request_get_ip4_config (NMActRequest *req);
|
||||
|
|
|
@ -58,7 +58,7 @@ nm_dbus_get_user_key_for_network_cb (DBusPendingCall *pcall,
|
|||
data = nm_device_get_app_data (dev);
|
||||
g_assert (data);
|
||||
|
||||
ap = nm_act_request_get_ap (req);
|
||||
ap = nm_device_802_11_wireless_get_activation_ap (NM_DEVICE_802_11_WIRELESS (dev));
|
||||
g_assert (ap);
|
||||
|
||||
nm_dbus_send_with_callback_replied (pcall, __func__);
|
||||
|
@ -105,8 +105,8 @@ nm_dbus_get_user_key_for_network_cb (DBusPendingCall *pcall,
|
|||
|
||||
dbus_message_iter_init (reply, &iter);
|
||||
if ((security = nm_ap_security_new_deserialize (&iter))) {
|
||||
nm_ap_set_security (ap, security);
|
||||
nm_device_activate_schedule_stage1_device_prepare (req);
|
||||
nm_ap_set_security (ap, security);
|
||||
nm_device_activate_schedule_stage2_device_config (req);
|
||||
}
|
||||
nm_act_request_set_user_key_pending_call (req, NULL);
|
||||
|
||||
|
@ -151,7 +151,7 @@ nm_dbus_get_user_key_for_network (NMActRequest *req,
|
|||
dev = nm_act_request_get_dev (req);
|
||||
g_assert (dev);
|
||||
|
||||
ap = nm_act_request_get_ap (req);
|
||||
ap = nm_device_802_11_wireless_get_activation_ap (NM_DEVICE_802_11_WIRELESS (dev));
|
||||
g_assert (ap);
|
||||
|
||||
essid = nm_ap_get_essid (ap);
|
||||
|
|
|
@ -48,11 +48,6 @@
|
|||
#include "cipher.h"
|
||||
#include "dbus-dict-helpers.h"
|
||||
|
||||
static gboolean impl_device_activate (NMDevice80211Wireless *device,
|
||||
const char *ap_path,
|
||||
gboolean user_requested,
|
||||
GError **err);
|
||||
|
||||
static gboolean impl_device_get_active_networks (NMDevice80211Wireless *device,
|
||||
GPtrArray **networks,
|
||||
GError **err);
|
||||
|
@ -134,6 +129,9 @@ struct _NMDevice80211WirelessPrivate
|
|||
guint periodic_source_id;
|
||||
guint link_timeout_id;
|
||||
|
||||
/* Set when activating or activated */
|
||||
NMAccessPoint *activation_ap;
|
||||
|
||||
/* Static options from driver */
|
||||
guint8 we_version;
|
||||
guint32 capabilities;
|
||||
|
@ -201,7 +199,6 @@ network_removed (NMDevice80211Wireless *device, NMAccessPoint *ap)
|
|||
g_signal_emit (device, signals[NETWORK_REMOVED], 0, ap);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_device_802_11_wireless_update_bssid
|
||||
*
|
||||
|
@ -543,21 +540,17 @@ out:
|
|||
static gboolean
|
||||
nm_device_802_11_periodic_update (gpointer data)
|
||||
{
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (data);
|
||||
NMDevice80211Wireless *self = NM_DEVICE_802_11_WIRELESS (data);
|
||||
|
||||
/* BSSID and signal strength have meaningful values only if the device
|
||||
is activated and not scanning */
|
||||
if (nm_device_get_state (NM_DEVICE (self)) == NM_DEVICE_STATE_ACTIVATED &&
|
||||
!NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self)->scanning) {
|
||||
|
||||
NMActRequest *req;
|
||||
NMAccessPoint *ap;
|
||||
NMAccessPoint *ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
|
||||
req = nm_device_get_act_request (NM_DEVICE (self));
|
||||
if (req && (ap = nm_act_request_get_ap (req))) {
|
||||
nm_device_802_11_wireless_update_signal_strength (self, ap);
|
||||
nm_device_802_11_wireless_update_bssid (self, ap);
|
||||
}
|
||||
nm_device_802_11_wireless_update_signal_strength (self, ap);
|
||||
nm_device_802_11_wireless_update_bssid (self, ap);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -638,7 +631,6 @@ real_deactivate_quickly (NMDevice *dev)
|
|||
nm_device_802_11_wireless_disable_encryption (self);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
real_deactivate (NMDevice *dev)
|
||||
{
|
||||
|
@ -649,49 +641,12 @@ real_deactivate (NMDevice *dev)
|
|||
/* nm_device_802_11_wireless_set_scan_interval (app_data, self, NM_WIRELESS_SCAN_INTERVAL_ACTIVE); */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nm_device_802_11_wireless_activate (NMDevice80211Wireless *self,
|
||||
NMAccessPoint *ap,
|
||||
gboolean user_requested)
|
||||
{
|
||||
NMDevice *device;
|
||||
NMActRequest *req;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE_802_11_WIRELESS (self));
|
||||
g_return_if_fail (ap != NULL);
|
||||
|
||||
device = NM_DEVICE (self);
|
||||
req = nm_act_request_new (device,
|
||||
ap,
|
||||
user_requested);
|
||||
|
||||
nm_device_activate (device, req);
|
||||
nm_act_request_unref (req);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
impl_device_activate (NMDevice80211Wireless *device,
|
||||
const char *ap_path,
|
||||
gboolean user_requested,
|
||||
GError **err)
|
||||
real_check_connection (NMDevice *dev, NMConnection *connection)
|
||||
{
|
||||
NMAccessPoint *ap;
|
||||
|
||||
ap = nm_device_802_11_wireless_ap_list_get_ap_by_obj_path (device, ap_path);
|
||||
if (!ap) {
|
||||
g_set_error (err, 0, 0, /* FIXME */
|
||||
"Invalid Access Point");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nm_device_802_11_wireless_activate (device, ap, user_requested);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_device_copy_allowed_to_dev_list
|
||||
*
|
||||
|
@ -918,7 +873,7 @@ nm_device_802_11_wireless_get_best_ap (NMDevice80211Wireless *self)
|
|||
*/
|
||||
if ((req = nm_device_get_act_request (NM_DEVICE (self))))
|
||||
{
|
||||
if ((cur_ap = nm_act_request_get_ap (req)))
|
||||
if ((cur_ap = nm_device_802_11_wireless_get_activation_ap (self)))
|
||||
{
|
||||
const char * essid = nm_ap_get_essid (cur_ap);
|
||||
gboolean keep = FALSE;
|
||||
|
@ -982,16 +937,8 @@ nm_device_802_11_wireless_get_best_ap (NMDevice80211Wireless *self)
|
|||
return best_ap;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_device_802_11_wireless_get_activation_ap
|
||||
*
|
||||
* Return an access point suitable for use in the device activation
|
||||
* request.
|
||||
*
|
||||
*/
|
||||
NMAccessPoint *
|
||||
nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *self,
|
||||
static gboolean
|
||||
nm_device_802_11_wireless_set_activation_ap (NMDevice80211Wireless *self,
|
||||
const char *essid,
|
||||
NMAPSecurity *security)
|
||||
{
|
||||
|
@ -999,9 +946,6 @@ nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *self,
|
|||
NMData * app_data;
|
||||
NMAccessPointList * dev_ap_list;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
g_return_val_if_fail (essid != NULL, NULL);
|
||||
|
||||
app_data = nm_device_get_app_data (NM_DEVICE (self));
|
||||
g_assert (app_data);
|
||||
|
||||
|
@ -1020,7 +964,7 @@ nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *self,
|
|||
{
|
||||
nm_warning ("%s: tried to manually connect to network '%s' without "
|
||||
"providing security information!", __func__, essid);
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* User chose a network we haven't seen in a scan, so create a
|
||||
|
@ -1053,7 +997,9 @@ nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *self,
|
|||
nm_ap_set_security (ap, security);
|
||||
nm_ap_add_capabilities_from_security (ap, security);
|
||||
|
||||
return ap;
|
||||
NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self)->activation_ap = ap;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1184,13 +1130,8 @@ impl_device_get_active_networks (NMDevice80211Wireless *device,
|
|||
NMAccessPoint *ap;
|
||||
|
||||
while ((ap = nm_ap_list_iter_next (list_iter))) {
|
||||
if (nm_ap_get_essid (ap)) {
|
||||
/* FIXME: In theory, it should be possible to use something like:
|
||||
g_ptr_array_add (*networks, ap);
|
||||
and let dbus-glib get the already registered object path, but it crashes
|
||||
NM currently. Figure it out. */
|
||||
g_ptr_array_add (*networks, g_strdup (g_object_get_data (ap, "dbus_glib_object_path")));
|
||||
}
|
||||
if (nm_ap_get_essid (ap))
|
||||
g_ptr_array_add (*networks, g_strdup (nm_ap_get_dbus_path (ap)));
|
||||
}
|
||||
nm_ap_list_iter_free (list_iter);
|
||||
}
|
||||
|
@ -2206,8 +2147,7 @@ link_timeout_cb (gpointer user_data)
|
|||
}
|
||||
|
||||
req = nm_device_get_act_request (dev);
|
||||
if (req)
|
||||
ap = nm_act_request_get_ap (req);
|
||||
ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
if (req == NULL || ap == NULL) {
|
||||
nm_warning ("couldn't get activation request or activation AP.");
|
||||
nm_device_set_active_link (dev, FALSE);
|
||||
|
@ -2360,7 +2300,7 @@ supplicant_iface_connection_state_cb_handler (gpointer user_data)
|
|||
* schedule the next activation stage.
|
||||
*/
|
||||
if (nm_device_get_state (dev) == NM_DEVICE_STATE_CONFIG) {
|
||||
NMAccessPoint * ap = nm_act_request_get_ap (req);
|
||||
NMAccessPoint *ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
|
||||
nm_info ("Activation (%s/wireless) Stage 2 of 5 (Device Configure) "
|
||||
"successful. Connected to wireless network '%s'.",
|
||||
|
@ -2593,10 +2533,8 @@ supplicant_connection_timeout_cb (gpointer user_data)
|
|||
NMDevice * dev = NM_DEVICE (user_data);
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (user_data);
|
||||
NMActRequest * req = nm_device_get_act_request (dev);
|
||||
NMAccessPoint * ap = nm_act_request_get_ap (req);
|
||||
NMAccessPoint * ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
gboolean has_key;
|
||||
|
||||
g_assert (self);
|
||||
|
||||
cleanup_association_attempt (self, TRUE);
|
||||
|
||||
|
@ -2672,7 +2610,7 @@ build_supplicant_config (NMDevice80211Wireless *self,
|
|||
g_return_val_if_fail (self != NULL, NULL);
|
||||
g_return_val_if_fail (req != NULL, NULL);
|
||||
|
||||
ap = nm_act_request_get_ap (req);
|
||||
ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
g_assert (ap);
|
||||
|
||||
config = nm_supplicant_config_new (nm_device_get_iface (NM_DEVICE (self)));
|
||||
|
@ -2740,12 +2678,29 @@ real_set_hw_address (NMDevice *dev)
|
|||
}
|
||||
|
||||
|
||||
static NMActStageReturn
|
||||
real_act_stage1_prepare (NMDevice *dev,
|
||||
NMActRequest *req)
|
||||
{
|
||||
NMDevice80211Wireless *self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
NMSettingWireless *setting;
|
||||
gboolean success;
|
||||
|
||||
setting = (NMSettingWireless *) nm_connection_get_setting (nm_act_request_get_connection (req),
|
||||
"802-11-wireless");
|
||||
g_assert (setting);
|
||||
success = nm_device_802_11_wireless_set_activation_ap (self, setting->ssid, NULL);
|
||||
|
||||
return success ? NM_ACT_STAGE_RETURN_SUCCESS : NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
static NMActStageReturn
|
||||
real_act_stage2_config (NMDevice *dev,
|
||||
NMActRequest *req)
|
||||
{
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
NMAccessPoint * ap = nm_act_request_get_ap (req);
|
||||
NMAccessPoint * ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
const char * iface = nm_device_get_iface (dev);
|
||||
gboolean ask_user = FALSE;
|
||||
|
@ -2809,7 +2764,7 @@ real_act_stage3_ip_config_start (NMDevice *dev,
|
|||
NMActRequest *req)
|
||||
{
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
NMAccessPoint * ap = nm_act_request_get_ap (req);
|
||||
NMAccessPoint * ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
g_assert (ap);
|
||||
|
@ -2840,7 +2795,7 @@ real_act_stage4_get_ip4_config (NMDevice *dev,
|
|||
NMIP4Config **config)
|
||||
{
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
NMAccessPoint * ap = nm_act_request_get_ap (req);
|
||||
NMAccessPoint * ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
NMIP4Config * real_config = NULL;
|
||||
|
||||
|
@ -2875,7 +2830,7 @@ real_act_stage4_ip_config_timeout (NMDevice *dev,
|
|||
NMIP4Config **config)
|
||||
{
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
NMAccessPoint * ap = nm_act_request_get_ap (req);
|
||||
NMAccessPoint * ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
NMIP4Config * real_config = NULL;
|
||||
NMAPSecurity * security;
|
||||
|
@ -2934,7 +2889,7 @@ activation_success_handler (NMDevice *dev)
|
|||
gboolean automatic;
|
||||
|
||||
req = nm_device_get_act_request (dev);
|
||||
ap = nm_act_request_get_ap (req);
|
||||
ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||
|
||||
/* Cache details in the info-daemon since the connect was successful */
|
||||
automatic = !nm_act_request_get_user_requested (req);
|
||||
|
@ -2967,7 +2922,7 @@ activation_failure_handler (NMDevice *dev)
|
|||
app_data = nm_device_get_app_data (dev);
|
||||
g_assert (app_data);
|
||||
|
||||
if ((ap = nm_act_request_get_ap (req)))
|
||||
if ((ap = nm_device_802_11_wireless_get_activation_ap (self)))
|
||||
{
|
||||
if (nm_ap_get_artificial (ap))
|
||||
{
|
||||
|
@ -3061,8 +3016,6 @@ get_property (GObject *object, guint prop_id,
|
|||
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
||||
struct ether_addr hw_addr;
|
||||
char hw_addr_buf[20];
|
||||
NMAccessPoint *ap;
|
||||
NMActRequest *req;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_HW_ADDRESS:
|
||||
|
@ -3081,13 +3034,8 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_set_uint (value, priv->capabilities);
|
||||
break;
|
||||
case PROP_ACTIVE_NETWORK:
|
||||
req = nm_device_get_act_request (NM_DEVICE (device));
|
||||
if (req && (ap = nm_act_request_get_ap (req))) {
|
||||
NMAccessPoint *tmp_ap;
|
||||
|
||||
if ((tmp_ap = nm_device_802_11_wireless_ap_list_get_ap_by_essid (device, nm_ap_get_essid (ap))))
|
||||
g_value_set_object (value, tmp_ap);
|
||||
}
|
||||
if (priv->activation_ap)
|
||||
g_value_set_object (value, priv->activation_ap);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -3114,7 +3062,9 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass)
|
|||
parent_class->bring_down = real_bring_down;
|
||||
parent_class->update_link = real_update_link;
|
||||
parent_class->set_hw_address = real_set_hw_address;
|
||||
parent_class->check_connection = real_check_connection;
|
||||
|
||||
parent_class->act_stage1_prepare = real_act_stage1_prepare;
|
||||
parent_class->act_stage2_config = real_act_stage2_config;
|
||||
parent_class->act_stage3_ip_config_start = real_act_stage3_ip_config_start;
|
||||
parent_class->act_stage4_get_ip4_config = real_act_stage4_get_ip4_config;
|
||||
|
@ -3198,6 +3148,8 @@ state_changed_cb (NMDevice *device, NMDeviceState state, gpointer user_data)
|
|||
case NM_DEVICE_STATE_FAILED:
|
||||
activation_failure_handler (device);
|
||||
break;
|
||||
case NM_DEVICE_STATE_DISCONNECTED:
|
||||
NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device)->activation_ap = NULL;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3232,3 +3184,11 @@ nm_device_802_11_wireless_new (const char *iface,
|
|||
return NM_DEVICE_802_11_WIRELESS (obj);
|
||||
|
||||
}
|
||||
|
||||
NMAccessPoint *
|
||||
nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (self), NULL);
|
||||
|
||||
return NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self)->activation_ap;
|
||||
}
|
||||
|
|
|
@ -83,10 +83,6 @@ NMDevice80211Wireless *nm_device_802_11_wireless_new (const char *iface,
|
|||
gboolean test_dev,
|
||||
NMData *app_data);
|
||||
|
||||
void nm_device_802_11_wireless_activate (NMDevice80211Wireless *device,
|
||||
NMAccessPoint *ap,
|
||||
gboolean user_requested);
|
||||
|
||||
void nm_device_802_11_wireless_set_essid (NMDevice80211Wireless *self,
|
||||
const char *essid);
|
||||
|
||||
|
@ -104,11 +100,7 @@ gboolean nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self,
|
|||
int nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *self);
|
||||
|
||||
NMAccessPoint * nm_device_802_11_wireless_get_best_ap (NMDevice80211Wireless *dev);
|
||||
|
||||
NMAccessPoint * nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *dev,
|
||||
const char *essid,
|
||||
NMAPSecurity *security);
|
||||
|
||||
NMAccessPoint * nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *dev);
|
||||
void nm_device_802_11_wireless_reset_scan_interval (NMDevice80211Wireless *dev);
|
||||
|
||||
void nm_device_802_11_wireless_copy_allowed_to_dev_list (NMDevice80211Wireless *self,
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
#include "nm-netlink-monitor.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
static gboolean impl_device_802_3_ethernet_activate (NMDevice8023Ethernet *device,
|
||||
gboolean user_requested,
|
||||
GError **err);
|
||||
|
||||
#include "nm-device-802-3-ethernet-glue.h"
|
||||
|
||||
|
||||
|
@ -258,36 +254,6 @@ nm_device_802_3_ethernet_new (const char *iface,
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
nm_device_802_3_ethernet_activate (NMDevice8023Ethernet *self,
|
||||
gboolean user_requested)
|
||||
{
|
||||
NMDevice *device;
|
||||
NMActRequest *req;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE_802_3_ETHERNET (self));
|
||||
|
||||
device = NM_DEVICE (self);
|
||||
req = nm_act_request_new (device,
|
||||
NULL,
|
||||
user_requested);
|
||||
|
||||
nm_device_activate (device, req);
|
||||
nm_act_request_unref (req);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
impl_device_802_3_ethernet_activate (NMDevice8023Ethernet *device,
|
||||
gboolean user_requested,
|
||||
GError **err)
|
||||
{
|
||||
nm_device_802_3_ethernet_activate (device, user_requested);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_device_802_3_ethernet_get_address
|
||||
*
|
||||
|
@ -362,6 +328,12 @@ real_can_interrupt_activation (NMDevice *dev)
|
|||
return interrupt;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
real_check_connection (NMDevice *dev, NMConnection *connection)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
nm_device_802_3_ethernet_finalize (GObject *object)
|
||||
{
|
||||
|
@ -417,6 +389,7 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass)
|
|||
parent_class->update_link = real_update_link;
|
||||
parent_class->can_interrupt_activation = real_can_interrupt_activation;
|
||||
parent_class->set_hw_address = real_set_hw_address;
|
||||
parent_class->check_connection = real_check_connection;
|
||||
|
||||
/* properties */
|
||||
g_object_class_install_property
|
||||
|
|
|
@ -58,9 +58,6 @@ NMDevice8023Ethernet *nm_device_802_3_ethernet_new (const char *iface,
|
|||
gboolean test_dev,
|
||||
NMData *app_data);
|
||||
|
||||
void nm_device_802_3_ethernet_activate (NMDevice8023Ethernet *self,
|
||||
gboolean user_requested);
|
||||
|
||||
void nm_device_802_3_ethernet_get_address (NMDevice8023Ethernet *dev,
|
||||
struct ether_addr *addr);
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
#include "nm-device-interface.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
static gboolean impl_device_activate (NMDeviceInterface *device,
|
||||
GHashTable *connection_hash,
|
||||
GError **err);
|
||||
|
||||
static gboolean impl_device_deactivate (NMDeviceInterface *device, GError **err);
|
||||
|
||||
#include "nm-device-interface-glue.h"
|
||||
|
@ -141,6 +145,31 @@ nm_device_interface_get_type (void)
|
|||
return device_interface_type;
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_interface_activate (NMDeviceInterface *device,
|
||||
NMConnection *connection,
|
||||
gboolean user_requested)
|
||||
{
|
||||
g_return_if_fail (NM_IS_DEVICE_INTERFACE (device));
|
||||
g_return_if_fail (connection != NULL);
|
||||
|
||||
NM_DEVICE_INTERFACE_GET_INTERFACE (device)->activate (device, connection, user_requested);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_device_activate (NMDeviceInterface *device,
|
||||
GHashTable *connection_hash,
|
||||
GError **err)
|
||||
{
|
||||
NMConnection *connection;
|
||||
|
||||
connection = nm_connection_new_from_hash (connection_hash);
|
||||
|
||||
nm_device_interface_activate (device, connection, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_interface_deactivate (NMDeviceInterface *device)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <glib-object.h>
|
||||
#include "NetworkManager.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
#define NM_TYPE_DEVICE_INTERFACE (nm_device_interface_get_type ())
|
||||
#define NM_DEVICE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_INTERFACE, NMDeviceInterface))
|
||||
|
@ -42,6 +43,7 @@ struct _NMDeviceInterface {
|
|||
GTypeInterface g_iface;
|
||||
|
||||
/* Methods */
|
||||
void (*activate) (NMDeviceInterface *device, NMConnection *connection, gboolean user_requested);
|
||||
void (*deactivate) (NMDeviceInterface *device);
|
||||
|
||||
/* Signals */
|
||||
|
@ -51,6 +53,10 @@ struct _NMDeviceInterface {
|
|||
|
||||
GType nm_device_interface_get_type (void);
|
||||
|
||||
void nm_device_interface_activate (NMDeviceInterface *device,
|
||||
NMConnection *connection,
|
||||
gboolean user_requested);
|
||||
|
||||
void nm_device_interface_deactivate (NMDeviceInterface *device);
|
||||
|
||||
#endif /* NM_DEVICE_INTERFACE_H */
|
||||
|
|
|
@ -31,8 +31,6 @@ NMIP4Config * nm_device_new_ip4_autoip_config (NMDevice *self);
|
|||
|
||||
void nm_device_activate_schedule_stage3_ip_config_start (struct NMActRequest *req);
|
||||
|
||||
void nm_device_activate (NMDevice *device, NMActRequest *req);
|
||||
|
||||
void nm_device_state_changed (NMDevice *device, NMDeviceState state);
|
||||
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include <netinet/in.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nm-device.h"
|
||||
#include "nm-device-interface.h"
|
||||
#include "nm-device.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "NetworkManagerDbus.h"
|
||||
#include "NetworkManagerPolicy.h"
|
||||
|
@ -74,7 +74,11 @@ struct _NMDevicePrivate
|
|||
gulong dhcp_signal_id;
|
||||
};
|
||||
|
||||
static void nm_device_activate_schedule_stage5_ip_config_commit (NMActRequest *req);
|
||||
static void nm_device_activate (NMDeviceInterface *device,
|
||||
NMConnection *connection,
|
||||
gboolean user_requested);
|
||||
|
||||
static void nm_device_activate_schedule_stage5_ip_config_commit (NMActRequest *req);
|
||||
static void nm_device_deactivate (NMDeviceInterface *device);
|
||||
|
||||
static void
|
||||
|
@ -88,6 +92,7 @@ static void
|
|||
device_interface_init (NMDeviceInterface *device_interface_class)
|
||||
{
|
||||
/* interface implementation */
|
||||
device_interface_class->activate = nm_device_activate;
|
||||
device_interface_class->deactivate = nm_device_deactivate;
|
||||
}
|
||||
|
||||
|
@ -348,35 +353,6 @@ nm_device_set_active_link (NMDevice *self,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_device_activation_start
|
||||
*
|
||||
* Tell the device to begin activation.
|
||||
*/
|
||||
void
|
||||
nm_device_activate (NMDevice *device,
|
||||
NMActRequest *req)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE (device));
|
||||
g_return_if_fail (req != NULL);
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (device);
|
||||
|
||||
if (priv->state != NM_DEVICE_STATE_DISCONNECTED)
|
||||
/* Already activating or activated */
|
||||
return;
|
||||
|
||||
nm_info ("Activation (%s) started...", nm_device_get_iface (device));
|
||||
|
||||
nm_act_request_ref (req);
|
||||
priv->act_request = req;
|
||||
|
||||
nm_device_activate_schedule_stage1_device_prepare (req);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_device_activate_stage1_device_prepare
|
||||
*
|
||||
|
@ -1071,6 +1047,26 @@ nm_device_deactivate (NMDeviceInterface *device)
|
|||
nm_device_state_changed (self, NM_DEVICE_STATE_DISCONNECTED);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_device_activate (NMDeviceInterface *device,
|
||||
NMConnection *connection,
|
||||
gboolean user_requested)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE (device);
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
if (priv->state != NM_DEVICE_STATE_DISCONNECTED)
|
||||
/* Already activating or activated */
|
||||
return;
|
||||
|
||||
if (!NM_DEVICE_GET_CLASS (self)->check_connection (self, connection))
|
||||
/* connection is invalid */
|
||||
return;
|
||||
|
||||
nm_info ("Activating device %s", nm_device_get_iface (self));
|
||||
priv->act_request = nm_act_request_new (self, connection, user_requested);
|
||||
nm_device_activate_schedule_stage1_device_prepare (priv->act_request);
|
||||
}
|
||||
|
||||
/*
|
||||
* nm_device_is_activating
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "NetworkManager.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
#if 0
|
||||
# define IOCTL_DEBUG 1
|
||||
|
@ -89,6 +90,8 @@ struct _NMDeviceClass
|
|||
guint32 (* get_type_capabilities) (NMDevice *self);
|
||||
guint32 (* get_generic_capabilities) (NMDevice *self);
|
||||
|
||||
gboolean (* check_connection) (NMDevice *self, NMConnection *connection);
|
||||
|
||||
NMActStageReturn (* act_stage1_prepare) (NMDevice *self, struct NMActRequest *req);
|
||||
NMActStageReturn (* act_stage2_config) (NMDevice *self, struct NMActRequest *req);
|
||||
NMActStageReturn (* act_stage3_ip_config_start)(NMDevice *self,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
SUBDIRS=test-common libnm-util
|
||||
|
||||
INCLUDES = -I${top_srcdir} \
|
||||
-I${top_srcdir}/libnm-util \
|
||||
-I${top_srcdir}/libnm-glib \
|
||||
-I${top_srcdir}/gnome/libnm_glib \
|
||||
-I${top_srcdir}/utils \
|
||||
|
@ -24,7 +25,8 @@ noinst_PROGRAMS = nm-tool \
|
|||
|
||||
nm_tool_SOURCES = nm-tool.c
|
||||
nm_tool_LDADD = $(DBUS_LIBS) $(GTHREAD_LIBS) $(HAL_LIBS) \
|
||||
$(top_builddir)/libnm-glib/libnm-glib.la
|
||||
$(top_builddir)/libnm-glib/libnm-glib.la \
|
||||
$(top_builddir)/libnm-util/libnm-util.la
|
||||
|
||||
nm_online_SOURCES = nm-online.c
|
||||
nm_online_LDADD = $(DBUS_LIBS) $(GTHREAD_LIBS) $(HAL_LIBS) \
|
||||
|
@ -41,7 +43,8 @@ nmtestdevices_LDADD = $(DBUS_LIBS) $(GTHREAD_LIBS) \
|
|||
libnm_glib_test_SOURCES = libnm_glib_test.c
|
||||
libnm_glib_test_LDADD = $(DBUS_LIBS) $(GTHREAD_LIBS) \
|
||||
$(top_builddir)/utils/libnmutils.la \
|
||||
$(top_builddir)/gnome/libnm_glib/libnm_glib.la
|
||||
$(top_builddir)/gnome/libnm_glib/libnm_glib.la \
|
||||
$(top_builddir)/libnm-util/libnm-util.la
|
||||
|
||||
nm_supplicant_test_SOURCES = nm-supplicant-test.c
|
||||
nm_supplicant_test_LDADD = $(GLIB_LIBS) $(GTHREAD_LIBS)
|
||||
|
|
Loading…
Reference in a new issue