2008-11-14 17:41:16 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
* Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
2014-07-04 13:33:18 -04:00
|
|
|
* Copyright 2007 - 2008 Novell, Inc.
|
|
|
|
|
* Copyright 2007 - 2013 Red Hat, Inc.
|
2008-11-14 17:41:16 +00:00
|
|
|
*/
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
#ifndef NM_DEVICE_H
|
|
|
|
|
#define NM_DEVICE_H
|
|
|
|
|
|
2009-01-19 00:16:40 -05:00
|
|
|
#include <glib.h>
|
2007-02-12 09:23:43 +00:00
|
|
|
#include <glib-object.h>
|
|
|
|
|
#include <dbus/dbus-glib.h>
|
2007-06-22 15:09:02 +00:00
|
|
|
#include "nm-object.h"
|
2007-02-12 09:23:43 +00:00
|
|
|
#include "NetworkManager.h"
|
2007-02-16 11:23:49 +00:00
|
|
|
#include "nm-ip4-config.h"
|
2008-08-07 15:26:32 +00:00
|
|
|
#include "nm-dhcp4-config.h"
|
2009-08-20 11:30:52 -05:00
|
|
|
#include "nm-ip6-config.h"
|
2010-01-15 12:40:19 -08:00
|
|
|
#include "nm-dhcp6-config.h"
|
2007-05-07 15:17:45 +00:00
|
|
|
#include "nm-connection.h"
|
2011-05-26 19:39:12 -05:00
|
|
|
#include "nm-active-connection.h"
|
2007-02-12 09:23:43 +00:00
|
|
|
|
2007-08-09 09:19:57 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
#define NM_TYPE_DEVICE (nm_device_get_type ())
|
|
|
|
|
#define NM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE, NMDevice))
|
|
|
|
|
#define NM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE, NMDeviceClass))
|
|
|
|
|
#define NM_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE))
|
2012-07-27 13:15:54 +02:00
|
|
|
#define NM_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE))
|
2007-02-12 09:23:43 +00:00
|
|
|
#define NM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE, NMDeviceClass))
|
|
|
|
|
|
2013-03-11 10:16:24 -04:00
|
|
|
/**
|
|
|
|
|
* NMDeviceError:
|
|
|
|
|
* @NM_DEVICE_ERROR_UNKNOWN: unknown or unclassified error
|
|
|
|
|
* @NM_DEVICE_ERROR_INTERFACE_MISMATCH: the interface names of the connection and the
|
|
|
|
|
* device mismatched
|
|
|
|
|
*/
|
|
|
|
|
typedef enum {
|
|
|
|
|
NM_DEVICE_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
|
|
|
NM_DEVICE_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/
|
|
|
|
|
} NMDeviceError;
|
|
|
|
|
|
|
|
|
|
#define NM_DEVICE_ERROR nm_device_error_quark ()
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-03-11 10:16:24 -04:00
|
|
|
GQuark nm_device_error_quark (void);
|
|
|
|
|
|
2011-02-18 11:57:13 -06:00
|
|
|
#define NM_DEVICE_DEVICE_TYPE "device-type"
|
2008-03-24 15:17:30 +00:00
|
|
|
#define NM_DEVICE_UDI "udi"
|
|
|
|
|
#define NM_DEVICE_INTERFACE "interface"
|
2010-06-10 10:21:19 -07:00
|
|
|
#define NM_DEVICE_IP_INTERFACE "ip-interface"
|
2008-03-24 15:17:30 +00:00
|
|
|
#define NM_DEVICE_DRIVER "driver"
|
2012-06-01 15:49:22 +02:00
|
|
|
#define NM_DEVICE_DRIVER_VERSION "driver-version"
|
|
|
|
|
#define NM_DEVICE_FIRMWARE_VERSION "firmware-version"
|
2008-03-24 15:17:30 +00:00
|
|
|
#define NM_DEVICE_CAPABILITIES "capabilities"
|
2008-04-08 03:58:43 +00:00
|
|
|
#define NM_DEVICE_MANAGED "managed"
|
2012-05-14 17:09:36 +02:00
|
|
|
#define NM_DEVICE_AUTOCONNECT "autoconnect"
|
2010-05-25 10:52:25 -07:00
|
|
|
#define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
|
2008-03-24 15:17:30 +00:00
|
|
|
#define NM_DEVICE_IP4_CONFIG "ip4-config"
|
2008-08-07 15:26:32 +00:00
|
|
|
#define NM_DEVICE_DHCP4_CONFIG "dhcp4-config"
|
2009-08-20 11:30:52 -05:00
|
|
|
#define NM_DEVICE_IP6_CONFIG "ip6-config"
|
2010-01-15 12:40:19 -08:00
|
|
|
#define NM_DEVICE_DHCP6_CONFIG "dhcp6-config"
|
2008-03-24 15:17:30 +00:00
|
|
|
#define NM_DEVICE_STATE "state"
|
2012-02-07 10:48:16 +01:00
|
|
|
#define NM_DEVICE_STATE_REASON "state-reason"
|
2011-05-26 19:39:12 -05:00
|
|
|
#define NM_DEVICE_ACTIVE_CONNECTION "active-connection"
|
2013-02-12 13:11:42 -05:00
|
|
|
#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
|
2008-03-24 15:17:30 +00:00
|
|
|
#define NM_DEVICE_VENDOR "vendor"
|
|
|
|
|
#define NM_DEVICE_PRODUCT "product"
|
2013-10-11 14:59:26 -04:00
|
|
|
#define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
|
2013-12-16 15:44:27 +01:00
|
|
|
#define NM_DEVICE_MTU "mtu"
|
2008-03-24 15:17:30 +00:00
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
typedef struct {
|
2007-06-22 15:09:02 +00:00
|
|
|
NMObject parent;
|
2007-02-12 09:23:43 +00:00
|
|
|
} NMDevice;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2007-06-22 15:09:02 +00:00
|
|
|
NMObjectClass parent;
|
2008-07-11 10:28:53 +00:00
|
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
|
void (*state_changed) (NMDevice *device,
|
|
|
|
|
NMDeviceState new_state,
|
|
|
|
|
NMDeviceState old_state,
|
|
|
|
|
NMDeviceStateReason reason);
|
2009-09-30 09:20:44 -07:00
|
|
|
|
2012-03-14 14:10:03 +01:00
|
|
|
gboolean (*connection_compatible) (NMDevice *device,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
GError **error);
|
2011-03-10 22:27:10 -06:00
|
|
|
|
2013-04-26 11:49:57 -04:00
|
|
|
const char * (*get_type_description) (NMDevice *device);
|
2013-12-16 16:30:59 +01:00
|
|
|
const char * (*get_hw_address) (NMDevice *device);
|
2013-04-26 11:49:57 -04:00
|
|
|
|
2014-02-11 09:55:04 -05:00
|
|
|
GType (*get_setting_type) (NMDevice *device);
|
|
|
|
|
|
2009-09-30 09:20:44 -07:00
|
|
|
/* Padding for future expansion */
|
|
|
|
|
void (*_reserved1) (void);
|
|
|
|
|
void (*_reserved2) (void);
|
|
|
|
|
void (*_reserved3) (void);
|
2007-02-12 09:23:43 +00:00
|
|
|
} NMDeviceClass;
|
|
|
|
|
|
|
|
|
|
GType nm_device_get_type (void);
|
|
|
|
|
|
2008-03-24 15:17:30 +00:00
|
|
|
GObject * nm_device_new (DBusGConnection *connection, const char *path);
|
2007-06-22 15:09:02 +00:00
|
|
|
|
2011-02-18 11:59:27 -06:00
|
|
|
const char * nm_device_get_iface (NMDevice *device);
|
|
|
|
|
const char * nm_device_get_ip_iface (NMDevice *device);
|
|
|
|
|
NMDeviceType nm_device_get_device_type (NMDevice *device);
|
|
|
|
|
const char * nm_device_get_udi (NMDevice *device);
|
|
|
|
|
const char * nm_device_get_driver (NMDevice *device);
|
2012-06-01 15:49:22 +02:00
|
|
|
const char * nm_device_get_driver_version (NMDevice *device);
|
|
|
|
|
const char * nm_device_get_firmware_version (NMDevice *device);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-04-26 11:49:57 -04:00
|
|
|
const char * nm_device_get_type_description (NMDevice *device);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-12-16 16:30:59 +01:00
|
|
|
const char * nm_device_get_hw_address (NMDevice *device);
|
2011-02-18 11:59:27 -06:00
|
|
|
NMDeviceCapabilities nm_device_get_capabilities (NMDevice *device);
|
|
|
|
|
gboolean nm_device_get_managed (NMDevice *device);
|
2012-05-14 17:09:36 +02:00
|
|
|
gboolean nm_device_get_autoconnect (NMDevice *device);
|
|
|
|
|
void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect);
|
2011-02-18 11:59:27 -06:00
|
|
|
gboolean nm_device_get_firmware_missing (NMDevice *device);
|
|
|
|
|
NMIP4Config * nm_device_get_ip4_config (NMDevice *device);
|
|
|
|
|
NMDHCP4Config * nm_device_get_dhcp4_config (NMDevice *device);
|
|
|
|
|
NMIP6Config * nm_device_get_ip6_config (NMDevice *device);
|
|
|
|
|
NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *device);
|
|
|
|
|
NMDeviceState nm_device_get_state (NMDevice *device);
|
2012-02-07 10:48:16 +01:00
|
|
|
NMDeviceState nm_device_get_state_reason (NMDevice *device, NMDeviceStateReason *reason);
|
2011-05-26 19:39:12 -05:00
|
|
|
NMActiveConnection * nm_device_get_active_connection(NMDevice *device);
|
2013-02-12 13:11:42 -05:00
|
|
|
const GPtrArray * nm_device_get_available_connections(NMDevice *device);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-10-11 14:59:26 -04:00
|
|
|
const char * nm_device_get_physical_port_id (NMDevice *device);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-12-16 15:44:27 +01:00
|
|
|
guint32 nm_device_get_mtu (NMDevice *device);
|
2014-06-19 11:21:05 +02:00
|
|
|
NM_AVAILABLE_IN_1_0
|
|
|
|
|
gboolean nm_device_is_software (NMDevice *device);
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2013-12-18 15:15:21 -05:00
|
|
|
const char * nm_device_get_product (NMDevice *device);
|
|
|
|
|
const char * nm_device_get_vendor (NMDevice *device);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-12-18 15:15:21 -05:00
|
|
|
const char * nm_device_get_description (NMDevice *device);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-12-18 15:15:21 -05:00
|
|
|
char ** nm_device_disambiguate_names (NMDevice **devices,
|
|
|
|
|
int num_devices);
|
|
|
|
|
|
2014-06-19 13:15:09 +02:00
|
|
|
typedef void (*NMDeviceCallbackFn) (NMDevice *device, GError *error, gpointer user_data);
|
2009-09-18 08:38:29 -07:00
|
|
|
|
2011-02-18 11:59:27 -06:00
|
|
|
void nm_device_disconnect (NMDevice *device,
|
2014-06-19 13:15:09 +02:00
|
|
|
NMDeviceCallbackFn callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_0
|
|
|
|
|
void nm_device_delete (NMDevice *device,
|
|
|
|
|
NMDeviceCallbackFn callback,
|
2011-02-18 11:59:27 -06:00
|
|
|
gpointer user_data);
|
2009-09-18 01:55:31 +02:00
|
|
|
|
2011-03-10 22:27:10 -06:00
|
|
|
GSList * nm_device_filter_connections (NMDevice *device,
|
|
|
|
|
const GSList *connections);
|
|
|
|
|
|
2011-04-25 17:07:38 -05:00
|
|
|
gboolean nm_device_connection_valid (NMDevice *device,
|
|
|
|
|
NMConnection *connection);
|
|
|
|
|
|
2012-03-14 14:10:03 +01:00
|
|
|
gboolean nm_device_connection_compatible (NMDevice *device,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2014-02-11 09:55:04 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
|
|
|
|
GType nm_device_get_setting_type (NMDevice *device);
|
|
|
|
|
|
2014-06-19 13:15:09 +02:00
|
|
|
/* Deprecated */
|
|
|
|
|
NM_DEPRECATED_IN_1_0
|
|
|
|
|
typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data);
|
|
|
|
|
|
2007-08-09 09:19:57 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
#endif /* NM_DEVICE_H */
|