2008-11-14 17:41:16 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/*
|
|
|
|
|
* libnm_glib -- Access network status & information from glib applications
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2007 - 2008 Novell, Inc.
|
2012-02-07 10:48:16 +01:00
|
|
|
* Copyright (C) 2007 - 2012 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))
|
|
|
|
|
#define NM_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_DEVICE))
|
|
|
|
|
#define NM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE, NMDeviceClass))
|
|
|
|
|
|
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"
|
|
|
|
|
#define NM_DEVICE_CAPABILITIES "capabilities"
|
2008-04-08 03:58:43 +00:00
|
|
|
#define NM_DEVICE_MANAGED "managed"
|
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"
|
2008-03-24 15:17:30 +00:00
|
|
|
#define NM_DEVICE_VENDOR "vendor"
|
|
|
|
|
#define NM_DEVICE_PRODUCT "product"
|
|
|
|
|
|
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
|
|
|
|
2011-04-25 17:07:38 -05:00
|
|
|
gboolean (*connection_valid) (NMDevice *device,
|
|
|
|
|
NMConnection *connection);
|
2011-03-10 22:27:10 -06:00
|
|
|
|
2009-09-30 09:20:44 -07:00
|
|
|
/* Padding for future expansion */
|
|
|
|
|
void (*_reserved1) (void);
|
|
|
|
|
void (*_reserved2) (void);
|
|
|
|
|
void (*_reserved3) (void);
|
|
|
|
|
void (*_reserved4) (void);
|
|
|
|
|
void (*_reserved5) (void);
|
|
|
|
|
void (*_reserved6) (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);
|
|
|
|
|
NMDeviceCapabilities nm_device_get_capabilities (NMDevice *device);
|
|
|
|
|
gboolean nm_device_get_managed (NMDevice *device);
|
|
|
|
|
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);
|
2011-02-18 11:59:27 -06:00
|
|
|
const char * nm_device_get_product (NMDevice *device);
|
|
|
|
|
const char * nm_device_get_vendor (NMDevice *device);
|
2007-02-16 11:23:49 +00:00
|
|
|
|
2009-09-18 08:38:29 -07:00
|
|
|
typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data);
|
|
|
|
|
|
2011-02-18 11:59:27 -06:00
|
|
|
void nm_device_disconnect (NMDevice *device,
|
|
|
|
|
NMDeviceDeactivateFn callback,
|
|
|
|
|
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);
|
|
|
|
|
|
2007-08-09 09:19:57 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
#endif /* NM_DEVICE_H */
|