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:
@@ -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
|
||||
|
Reference in New Issue
Block a user