NetworkManager/src/nm-device-interface.c

253 lines
6.7 KiB
C
Raw Normal View History

2007-09-26 15:38:51 +00:00
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#include "nm-marshal.h"
#include "nm-setting-connection.h"
#include "nm-device-interface.h"
#include "nm-utils.h"
#include "nm-device-interface-glue.h"
2007-09-09 Dan Williams <dcbw@redhat.com> * introspection/nm-device.xml - The 'Activate' method now takes 3 arguments, a service name for the settings service (user or system), the object path of the connection to activate, and the specific object to activate, if any * src/nm-device-interface.c - (nm_device_interface_error_quark, nm_device_interface_error_get_type): Add error bits - (impl_device_activate): adapt to new Activate arguments; validate the service name and get the Connection object from the NMManager before starting to activate the device with the specified connection * src/nm-device-802-3-ethernet.c - (real_get_best_connection): find the best connection, or create a default one if no existing connections can be used * src/NetworkManagerPolicy.c - (nm_policy_auto_get_best_device): Get the device's best connection and only pick the device if it has one - (nm_policy_device_change_check): disable wireless bits for now until wireless get_best_connection() can be implemented (replacing "best_ap"); don't create a default connection here as the device subclass will do that if needed * src/nm-manager.h src/nm-manager.c - (nm_manager_get): make NMManager a singleton and expose the getter internally - Rework internal NMManager connection handling to use the same routines for both the system and user settings services. Most calls take a new NMConnectionType argument specifying either system or user connections - (nm_manager_get_connection_by_object_path): new function; get a connection keyed on its object path * src/NetworkManager.c - (main): use nm_manager_get() git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2776 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-09 22:18:42 +00:00
GQuark
nm_device_interface_error_quark (void)
{
static GQuark quark = 0;
if (!quark)
quark = g_quark_from_static_string ("nm-device-interface-error");
return quark;
2007-09-09 Dan Williams <dcbw@redhat.com> * introspection/nm-device.xml - The 'Activate' method now takes 3 arguments, a service name for the settings service (user or system), the object path of the connection to activate, and the specific object to activate, if any * src/nm-device-interface.c - (nm_device_interface_error_quark, nm_device_interface_error_get_type): Add error bits - (impl_device_activate): adapt to new Activate arguments; validate the service name and get the Connection object from the NMManager before starting to activate the device with the specified connection * src/nm-device-802-3-ethernet.c - (real_get_best_connection): find the best connection, or create a default one if no existing connections can be used * src/NetworkManagerPolicy.c - (nm_policy_auto_get_best_device): Get the device's best connection and only pick the device if it has one - (nm_policy_device_change_check): disable wireless bits for now until wireless get_best_connection() can be implemented (replacing "best_ap"); don't create a default connection here as the device subclass will do that if needed * src/nm-manager.h src/nm-manager.c - (nm_manager_get): make NMManager a singleton and expose the getter internally - Rework internal NMManager connection handling to use the same routines for both the system and user settings services. Most calls take a new NMConnectionType argument specifying either system or user connections - (nm_manager_get_connection_by_object_path): new function; get a connection keyed on its object path * src/NetworkManager.c - (main): use nm_manager_get() git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2776 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-09 22:18:42 +00:00
}
/* This should really be standard. */
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
GType
nm_device_interface_error_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
/* Connection is already activating. */
ENUM_ENTRY (NM_DEVICE_INTERFACE_ERROR_CONNECTION_ACTIVATING, "ConnectionActivating"),
/* Connection is invalid for this device. */
ENUM_ENTRY (NM_DEVICE_INTERFACE_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
2007-09-09 Dan Williams <dcbw@redhat.com> * introspection/nm-device.xml - The 'Activate' method now takes 3 arguments, a service name for the settings service (user or system), the object path of the connection to activate, and the specific object to activate, if any * src/nm-device-interface.c - (nm_device_interface_error_quark, nm_device_interface_error_get_type): Add error bits - (impl_device_activate): adapt to new Activate arguments; validate the service name and get the Connection object from the NMManager before starting to activate the device with the specified connection * src/nm-device-802-3-ethernet.c - (real_get_best_connection): find the best connection, or create a default one if no existing connections can be used * src/NetworkManagerPolicy.c - (nm_policy_auto_get_best_device): Get the device's best connection and only pick the device if it has one - (nm_policy_device_change_check): disable wireless bits for now until wireless get_best_connection() can be implemented (replacing "best_ap"); don't create a default connection here as the device subclass will do that if needed * src/nm-manager.h src/nm-manager.c - (nm_manager_get): make NMManager a singleton and expose the getter internally - Rework internal NMManager connection handling to use the same routines for both the system and user settings services. Most calls take a new NMConnectionType argument specifying either system or user connections - (nm_manager_get_connection_by_object_path): new function; get a connection keyed on its object path * src/NetworkManager.c - (main): use nm_manager_get() git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2776 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-09 22:18:42 +00:00
{ 0, 0, 0 }
};
etype = g_enum_register_static ("NMDeviceInterfaceError", values);
}
return etype;
}
static void
nm_device_interface_init (gpointer g_iface)
{
GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
static gboolean initialized = FALSE;
if (initialized)
return;
/* Properties */
g_object_interface_install_property
(g_iface,
g_param_spec_string (NM_DEVICE_INTERFACE_UDI,
"Udi",
"HAL Udi",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_interface_install_property
(g_iface,
g_param_spec_string (NM_DEVICE_INTERFACE_IFACE,
"Interface",
"Interface",
NULL,
2007-11-28 Tambet Ingo <tambet@gmail.com> Merge the beginnings of the new GSM card support. * src/ppp-manager/nm-ppp-manager.c (nm_ppp_manager_stop): Remove * the ppp watch source before killing pppd - If this happens from g_object_unref() then the ppp manager is already destroyed by the time the watch callback runs. * src/nm-hal-manager.c: Add a device_type_name string to the * device creators, so that we can print a nice human readable string when a device is added. * src/nm-umts-device.c (automatic_registration_get_network): * Query for the activated network, not much is done with the result thought. * src/nm-serial-device.c (nm_serial_device_get_reply): * Implement. (ppp_ip4_config): Change the device state to activated here for now. (real_check_connection): Make sure the connection includes ppp setting. * libnm-glib/nm-client.c (get_device): Handle umts devices. * libnm-glib/Makefile.am: Add the new files to build. * libnm-glib/nm-umts-device.c: * libnm-glib/nm-umts-device.h: Implement. 2007-11-26 Tambet Ingo <tambet@gmail.com> * src/nm-umts-device.c (automatic_registration_get_network): For * now, dial immediately, nm_serial_device_get_reply() isn't implemented correctly yet. * src/nm-serial-device.c (wait_for_reply_info_destroy): Don't * try to remove the timeout source - this function is only called when the timeout source has been removed. (nm_serial_device_wait_for_reply): Allocate the duplicate responses array to be big enough to contain the terminating zero element as well. The timeout argument is meant to be in seconds now. (real_deactivate_quickly): Implement. * src/NetworkManager.conf: Allow root to own "org.freedesktop.NetworkManager.PPP", deny it for everybody else. * libnm-util/nm-setting-umts.c: Network type and band properties * are ints, (not unsigned ints). * libnm-util/nm-setting-serial.c (nm_setting_serial_class_init): * Fix a small issue with parity bounds - capital letters have lower ascii codes than lower case letters. * libnm-util/nm-connection.c (register_default_settings): * Register serial and umts settings. 2007-11-22 Tambet Ingo <tambet@gmail.com> Remove the "index" property from devices as not all device types have this. * include/NetworkManager.h (NM_DBUS_PATH_DEVICE): Remove. * src/nm-hal-manager.c (nm_get_device_index_from_hal): Remove. (wired_device_creator): Get the device interface from hal to create the device. (wireless_device_creator): Ditto. * src/nm-device.c (nm_device_init): Remove the index member. (constructor): Remove the checks for index property, make interface property a require constructor property. Use the HAL udi for DBus path for devices. (nm_device_get_index): Remove. (set_property): Remove index handling. (get_property): Ditto. (nm_device_get_dbus_path): Remove. * src/nm-device-interface.c (nm_device_interface_init): Remove * the index property. * src/nm-device-802-3-ethernet.c * (nm_device_802_3_ethernet_link_activated): Access the device index through it's interface. (nm_device_802_3_ethernet_link_deactivated): Ditto. (nm_device_802_3_ethernet_new): Remove the useless argument test_dev. Remove index argument. Add interface argument. * src/nm-device-802-11-wireless.c * (nm_device_802_11_wireless_new): Remove the useless test_dev argument. Remove index argument. Add interface arugment. * src/NetworkManagerSystem.c * (nm_system_device_set_from_ip4_config): Get the device index through interface. (nm_system_set_mtu): Ditto. * introspection/nm-device.xml: Remove the "Index" property. 2007-11-21 Tambet Ingo <tambet@gmail.com> * src/nm-serial-device.c: * src/nm-serial-device.c: * src/nm-umts-device.c: * src/nm-umts-device.h: Implement. * src/nm-hal-manager.c (nm_get_device_driver_name): * libhal_free_string the string allocated by libhal. (modem_device_creator): Implement. (register_built_in_creators): Register the modem creator. * src/nm-device-802-11-wireless.c * (nm_device_802_11_wireless_new): Remove the unused test_dev argument. * src/nm-device-802-3-ethernet.c (nm_device_802_3_ethernet_new): * Ditto. * src/Makefile.am: Add new files to build. Link in ppp-manager. * libnm-util/nm-setting-umts.c: * libnm-util/nm-setting-umts.h: * libnm-util/nm-setting-serial.c: * libnm-util/nm-setting-serial.h: Implement. * libnm-util/Makefile.am: Add new files to build. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3116 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-11-29 14:38:07 +00:00
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_interface_install_property
(g_iface,
g_param_spec_string (NM_DEVICE_INTERFACE_DRIVER,
"Driver",
"Driver",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_interface_install_property
(g_iface,
g_param_spec_uint (NM_DEVICE_INTERFACE_CAPABILITIES,
"Capabilities",
"Capabilities",
0, G_MAXUINT32, NM_DEVICE_CAP_NONE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_interface_install_property
(g_iface,
g_param_spec_uint (NM_DEVICE_INTERFACE_IP4_ADDRESS,
"IP4 address",
"IP4 address",
0, G_MAXUINT32, 0, /* FIXME */
G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_boxed (NM_DEVICE_INTERFACE_IP4_CONFIG,
"IP4 Config",
"IP4 Config",
DBUS_TYPE_G_OBJECT_PATH,
G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_boxed (NM_DEVICE_INTERFACE_DHCP4_CONFIG,
"DHCP4 Config",
"DHCP4 Config",
DBUS_TYPE_G_OBJECT_PATH,
G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_uint (NM_DEVICE_INTERFACE_STATE,
"State",
"State",
0, G_MAXUINT32, NM_DEVICE_STATE_UNKNOWN,
G_PARAM_READABLE));
g_object_interface_install_property
(g_iface,
g_param_spec_uint (NM_DEVICE_INTERFACE_DEVICE_TYPE,
"DeviceType",
"DeviceType",
0, G_MAXUINT32, NM_DEVICE_TYPE_UNKNOWN,
G_PARAM_READABLE));
2008-04-07 Dan Williams <dcbw@redhat.com> * include/NetworkManager.h - Remove the DOWN and CANCELLED device states - Add UNMANAGED and UNAVAILABLE device states - Document the device states * introspection/nm-device.xml src/nm-device-interface.c src/nm-device-interface.h - Add the 'managed' property * test/nm-tool.c - (detail_device): print out device state * src/NetworkManagerSystem.h src/backends/NetworkManagerArch.c src/backends/NetworkManagerDebian.c src/backends/NetworkManagerFrugalware.c src/backends/NetworkManagerGentoo.c src/backends/NetworkManagerMandriva.c src/backends/NetworkManagerPaldo.c src/backends/NetworkManagerRedHat.c src/backends/NetworkManagerSlackware.c src/backends/NetworkManagerSuSE.c - (nm_system_device_get_system_config, nm_system_device_get_disabled nm_system_device_free_system_config): remove; they were unused and their functionality should be re-implemented in each distro's system settings service plugin * src/nm-gsm-device.c src/nm-gsm-device.h src/nm-cdma-device.c src/nm-cdma-device.h - (*_new): take the 'managed' argument * src/nm-device.c - (nm_device_set_address): remove, fold into nm_device_bring_up() - (nm_device_init): start in unmanaged state, not disconnected - (constructor): don't start device until the system settings service has had a chance to figure out if the device is managed or not - (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down): don't set device state here, let callers handle that as appropriate - (nm_device_dispose): don't touch the device if it's not managed - (set_property, get_property, nm_device_class_init): implement the 'managed' property - (nm_device_state_changed): bring the device up if its now managed, and deactivate it if it used to be active - (nm_device_get_managed, nm_device_set_managed): do the right thing with the managed state * src/nm-hal-manager.c - (wired_device_creator, wireless_device_creator, modem_device_creator): take initial managed state and pass it along to device constructors - (create_device_and_add_to_list): get managed state and pass to type creators * src/nm-device-802-11-wireless.c - (real_can_activate): fold in most of nm_device_802_11_wireless_can_activate() - (can_scan): can't scan in UNAVAILABLE or UNMANAGED - (link_timeout_cb): instead of deactivating, change device state and let the device state handler to it - (real_update_hw_address): clean up - (state_changed_cb): when entering UNAVAILABLE state, schedule an idle handler to transition to DISCONNECTED if the device isn't rfkilled * src/nm-device-802-3-ethernet.c - (set_carrier): move above callers and get rid of prototype - (device_state_changed): when entering UNAVAILABLE state, schedule an idle handler to transition to DISCONNECTED if the device has a carrier - (real_update_hw_address): clean up - (link_timeout_cb, ppp_state_changed): change state instead of calling deactivation directly as deactivation doesn't change state anymore * src/NetworkManagerPolicy.c - (schedule_activate_check): yay, remove wireless_enabled hack since the NMManager and wireless devices work that out themselves now - (device_state_changed): change to a switch and update for new device states - (device_carrier_changed): remove; device handles this now through state changes - (device_added): don't care about carrier any more; the initial activation check will happen when the device transitions to DISCONNECTED * src/nm-manager.c - (dispose): clear unmanaged devices - (handle_unmanaged_devices): update unmanaged device list and toggle the managed property on each device when needed - (system_settings_properties_changed_cb): handle signals from the system settings service - (system_settings_get_unmanaged_devices_cb): handle callback from getting the unmanaged device list method call - (query_unmanaged_devices): ask the system settings service for its list of unmanaged devices - (nm_manager_name_owner_changed, initial_get_connections): get unmanaged devices - (manager_set_wireless_enabled): push rfkill state down to wireless devices directly and let them handle the necessary state transitions - (manager_device_state_changed): update for new device states - (nm_manager_add_device): set initial rfkill state on wireless devices - (nm_manager_remove_device): don't touch the device if it's unmanaged - (nm_manager_activate_connection): return error if the device is unmanaged - (nm_manager_sleep): handle new device states correctly; don't change the state of unavailable/unmanaged devices * libnm-glib/nm-device-802-11-wireless.c - (state_changed_cb): update for new device states git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00
g_object_interface_install_property
(g_iface, g_param_spec_boolean (NM_DEVICE_INTERFACE_MANAGED,
"Managed",
"Managed",
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/* Signals */
g_signal_new ("state-changed",
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMDeviceInterface, state_changed),
NULL, NULL,
_nm_marshal_VOID__UINT_UINT_UINT,
G_TYPE_NONE, 3,
G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
dbus_g_object_type_install_info (iface_type,
&dbus_glib_nm_device_interface_object_info);
dbus_g_error_domain_register (NM_DEVICE_INTERFACE_ERROR,
NULL,
NM_TYPE_DEVICE_INTERFACE_ERROR);
initialized = TRUE;
}
GType
nm_device_interface_get_type (void)
{
static GType device_interface_type = 0;
if (!device_interface_type) {
const GTypeInfo device_interface_info = {
sizeof (NMDeviceInterface), /* class_size */
nm_device_interface_init, /* base_init */
NULL, /* base_finalize */
NULL,
NULL, /* class_finalize */
NULL, /* class_data */
0,
0, /* n_preallocs */
NULL
};
device_interface_type = g_type_register_static (G_TYPE_INTERFACE,
"NMDeviceInterface",
&device_interface_info, 0);
g_type_interface_add_prerequisite (device_interface_type, G_TYPE_OBJECT);
}
return device_interface_type;
}
2007-09-26 15:38:51 +00:00
/* FIXME: This should be public and nm_device_get_iface() should be removed. */
static char *
2007-09-26 15:38:51 +00:00
nm_device_interface_get_iface (NMDeviceInterface *device)
{
char *iface = NULL;
2007-09-26 15:38:51 +00:00
g_return_val_if_fail (NM_IS_DEVICE_INTERFACE (device), NULL);
g_object_get (device, NM_DEVICE_INTERFACE_IFACE, &iface, NULL);
return iface;
}
gboolean
nm_device_interface_check_connection_compatible (NMDeviceInterface *device,
NMConnection *connection,
GError **error)
{
g_return_val_if_fail (NM_IS_DEVICE_INTERFACE (device), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
g_return_val_if_fail (error != NULL, FALSE);
g_return_val_if_fail (*error == NULL, FALSE);
if (NM_DEVICE_INTERFACE_GET_INTERFACE (device)->check_connection_compatible)
return NM_DEVICE_INTERFACE_GET_INTERFACE (device)->check_connection_compatible (device, connection, error);
return TRUE;
}
2007-09-28 Tambet Ingo <tambet@gmail.com> * src/nm-manager.c: * src/nm-manager.h: Implement device activation through NMManager. Implement "pending device activation" here - If the connection isn't found, we try to wait for up to 5 seconds for the connection to be provided. Add NMConnectionType argument to "connection-added" and "connection-removed" signals. (nm_manager_get): Remove. Finally. * src/nm-activation-request.c: * src/nm-activation-request.h: Remove all the deferred activation code. * src/nm-device.c: Remove all the deferred activation code. Once * the device activation is started, it's started. Update the activation virtual function signature. * src/nm-device-interface.c: * src/nm-device-interface.h: Device activation now takes only NMActRequest argument. Don't expose device activation directly on dbus, it's supposed to go through NMManager now. * src/NetworkManagerPolicy.c (nm_policy_device_change_check): * Make the code a bit more compact. Use the new device activation methods through NMManager. * introspection/nm-manager-client.xml: * introspection/nm-manager.xml: * libnm-glib/nm-client.c: * libnm-glib/nm-client.h: Add device activation method. * libnm-glib/nm-device.c: * libnm-glib/nm-device.h: * introspection/nm-device.xml: Remove device activation method. It's done through NMManager now. * src/vpn-manager/nm-vpn-manager.c (impl_vpn_manager_connect): * Use the shiny new (nm_manager_get_device_by_path) function, get rid of our own )find_device). git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2915 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-10-01 15:38:39 +00:00
gboolean
nm_device_interface_activate (NMDeviceInterface *device,
NMActRequest *req,
GError **error)
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
2007-05-07 15:17:45 +00:00
{
gboolean success;
NMConnection *connection;
NMSettingConnection *s_con;
char *iface;
2007-09-28 Tambet Ingo <tambet@gmail.com> * src/nm-manager.c: * src/nm-manager.h: Implement device activation through NMManager. Implement "pending device activation" here - If the connection isn't found, we try to wait for up to 5 seconds for the connection to be provided. Add NMConnectionType argument to "connection-added" and "connection-removed" signals. (nm_manager_get): Remove. Finally. * src/nm-activation-request.c: * src/nm-activation-request.h: Remove all the deferred activation code. * src/nm-device.c: Remove all the deferred activation code. Once * the device activation is started, it's started. Update the activation virtual function signature. * src/nm-device-interface.c: * src/nm-device-interface.h: Device activation now takes only NMActRequest argument. Don't expose device activation directly on dbus, it's supposed to go through NMManager now. * src/NetworkManagerPolicy.c (nm_policy_device_change_check): * Make the code a bit more compact. Use the new device activation methods through NMManager. * introspection/nm-manager-client.xml: * introspection/nm-manager.xml: * libnm-glib/nm-client.c: * libnm-glib/nm-client.h: Add device activation method. * libnm-glib/nm-device.c: * libnm-glib/nm-device.h: * introspection/nm-device.xml: Remove device activation method. It's done through NMManager now. * src/vpn-manager/nm-vpn-manager.c (impl_vpn_manager_connect): * Use the shiny new (nm_manager_get_device_by_path) function, get rid of our own )find_device). git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2915 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-10-01 15:38:39 +00:00
g_return_val_if_fail (NM_IS_DEVICE_INTERFACE (device), FALSE);
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
g_assert (s_con);
iface = nm_device_interface_get_iface (device);
nm_info ("Activation (%s) starting connection '%s'", iface, s_con->id);
g_free (iface);
success = NM_DEVICE_INTERFACE_GET_INTERFACE (device)->activate (device, req, error);
if (!success)
g_assert (*error);
return success;
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
2007-05-07 15:17:45 +00:00
}
void
nm_device_interface_deactivate (NMDeviceInterface *device)
{
g_return_if_fail (NM_IS_DEVICE_INTERFACE (device));
NM_DEVICE_INTERFACE_GET_INTERFACE (device)->deactivate (device);
}
NMDeviceState
nm_device_interface_get_state (NMDeviceInterface *device)
{
NMDeviceState state;
g_object_get (G_OBJECT (device), "state", &state, NULL);
return state;
}