NetworkManager/src/nm-device-interface.h
Dan Williams f078992e4d 2008-10-11 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
	  introspection/nm-device.xml
	  include/NetworkManagerVPN.h
		- Add a few more state reasons for the device deactivated state

	* src/nm-device-interface.c
	  src/nm-device-interface.h
		- (nm_device_interface_deactivate): add a 'reason' argument

	* src/nm-device.c
	  src/nm-device.h
		- (nm_device_deactivate, nm_device_take_down): add a 'reason' argument
		- (nm_device_state_changed): pass the state change reason to
			nm_device_take_down()
		- (nm_device_set_managed): take a 'reason' argument, and pass it along
			to the state change function

	* src/nm-manager.c
	  src/nm-manager.h
		- (remove_one_device, handle_unmanaged_devices, sync_devices,
		   impl_manager_sleep): pass a reason code to nm_device_set_managed()
		- (nm_manager_deactivate_connection): add a 'reason' argument and pass
			something reasonable along to VPN deactivation

	* src/vpn-manager/nm-vpn-manager.c
	  src/vpn-manager/nm-vpn-manager.h
		- (nm_vpn_manager_deactivate_connection): add a 'reason' argument and
			pass that along to nm_vpn_connection_disconnect()



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4174 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-11 19:57:45 +00:00

92 lines
3.3 KiB
C

/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
#ifndef NM_DEVICE_INTERFACE_H
#define NM_DEVICE_INTERFACE_H
#include <glib-object.h>
#include "NetworkManager.h"
#include "nm-connection.h"
#include "nm-activation-request.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))
#define NM_IS_DEVICE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_INTERFACE))
#define NM_DEVICE_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_DEVICE_INTERFACE, NMDeviceInterface))
typedef enum
{
NM_DEVICE_INTERFACE_ERROR_CONNECTION_ACTIVATING = 0,
NM_DEVICE_INTERFACE_ERROR_CONNECTION_INVALID,
} NMDeviceInterfaceError;
#define NM_DEVICE_INTERFACE_ERROR (nm_device_interface_error_quark ())
#define NM_TYPE_DEVICE_INTERFACE_ERROR (nm_device_interface_error_get_type ())
#define NM_DEVICE_INTERFACE_UDI "udi"
#define NM_DEVICE_INTERFACE_IFACE "interface"
#define NM_DEVICE_INTERFACE_DRIVER "driver"
#define NM_DEVICE_INTERFACE_CAPABILITIES "capabilities"
#define NM_DEVICE_INTERFACE_IP4_ADDRESS "ip4-address"
#define NM_DEVICE_INTERFACE_IP4_CONFIG "ip4-config"
#define NM_DEVICE_INTERFACE_DHCP4_CONFIG "dhcp4-config"
#define NM_DEVICE_INTERFACE_STATE "state"
#define NM_DEVICE_INTERFACE_DEVICE_TYPE "device-type" /* ugh */
#define NM_DEVICE_INTERFACE_MANAGED "managed"
typedef enum {
NM_DEVICE_INTERFACE_PROP_FIRST = 0x1000,
NM_DEVICE_INTERFACE_PROP_UDI = NM_DEVICE_INTERFACE_PROP_FIRST,
NM_DEVICE_INTERFACE_PROP_IFACE,
NM_DEVICE_INTERFACE_PROP_DRIVER,
NM_DEVICE_INTERFACE_PROP_CAPABILITIES,
NM_DEVICE_INTERFACE_PROP_IP4_ADDRESS,
NM_DEVICE_INTERFACE_PROP_IP4_CONFIG,
NM_DEVICE_INTERFACE_PROP_DHCP4_CONFIG,
NM_DEVICE_INTERFACE_PROP_STATE,
NM_DEVICE_INTERFACE_PROP_DEVICE_TYPE,
NM_DEVICE_INTERFACE_PROP_MANAGED,
} NMDeviceInterfaceProp;
typedef struct _NMDeviceInterface NMDeviceInterface;
struct _NMDeviceInterface {
GTypeInterface g_iface;
/* Methods */
gboolean (*check_connection_compatible) (NMDeviceInterface *device,
NMConnection *connection,
GError **error);
gboolean (*activate) (NMDeviceInterface *device,
NMActRequest *req,
GError **error);
void (*deactivate) (NMDeviceInterface *device, NMDeviceStateReason reason);
/* Signals */
void (*state_changed) (NMDeviceInterface *device,
NMDeviceState new_state,
NMDeviceState old_state,
NMDeviceStateReason reason);
};
GQuark nm_device_interface_error_quark (void);
GType nm_device_interface_error_get_type (void);
GType nm_device_interface_get_type (void);
gboolean nm_device_interface_check_connection_compatible (NMDeviceInterface *device,
NMConnection *connection,
GError **error);
gboolean nm_device_interface_activate (NMDeviceInterface *device,
NMActRequest *req,
GError **error);
void nm_device_interface_deactivate (NMDeviceInterface *device, NMDeviceStateReason reason);
NMDeviceState nm_device_interface_get_state (NMDeviceInterface *device);
#endif /* NM_DEVICE_INTERFACE_H */