1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301 USA.
18 * Copyright 2007 - 2008 Novell, Inc.
19 * Copyright 2007 - 2013 Red Hat, Inc.
26 #include <glib-object.h>
27 #include <dbus/dbus-glib.h>
28 #include "nm-object.h"
29 #include "NetworkManager.h"
30 #include "nm-ip4-config.h"
31 #include "nm-dhcp4-config.h"
32 #include "nm-ip6-config.h"
33 #include "nm-dhcp6-config.h"
34 #include "nm-connection.h"
35 #include "nm-active-connection.h"
39 #define NM_TYPE_DEVICE (nm_device_get_type ())
40 #define NM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE, NMDevice))
41 #define NM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE, NMDeviceClass))
42 #define NM_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE))
43 #define NM_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE))
44 #define NM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE, NMDeviceClass))
48 * @NM_DEVICE_ERROR_UNKNOWN: unknown or unclassified error
49 * @NM_DEVICE_ERROR_INTERFACE_MISMATCH: the interface names of the connection and the
53 NM_DEVICE_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
54 NM_DEVICE_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/
57 #define NM_DEVICE_ERROR nm_device_error_quark ()
58 NM_AVAILABLE_IN_0_9_10
59 GQuark nm_device_error_quark (void);
61 #define NM_DEVICE_DEVICE_TYPE "device-type"
62 #define NM_DEVICE_UDI "udi"
63 #define NM_DEVICE_INTERFACE "interface"
64 #define NM_DEVICE_IP_INTERFACE "ip-interface"
65 #define NM_DEVICE_DRIVER "driver"
66 #define NM_DEVICE_DRIVER_VERSION "driver-version"
67 #define NM_DEVICE_FIRMWARE_VERSION "firmware-version"
68 #define NM_DEVICE_CAPABILITIES "capabilities"
69 #define NM_DEVICE_REAL "real"
70 #define NM_DEVICE_MANAGED "managed"
71 #define NM_DEVICE_AUTOCONNECT "autoconnect"
72 #define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
73 #define NM_DEVICE_IP4_CONFIG "ip4-config"
74 #define NM_DEVICE_DHCP4_CONFIG "dhcp4-config"
75 #define NM_DEVICE_IP6_CONFIG "ip6-config"
76 #define NM_DEVICE_DHCP6_CONFIG "dhcp6-config"
77 #define NM_DEVICE_STATE "state"
78 #define NM_DEVICE_STATE_REASON "state-reason"
79 #define NM_DEVICE_ACTIVE_CONNECTION "active-connection"
80 #define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
81 #define NM_DEVICE_VENDOR "vendor"
82 #define NM_DEVICE_PRODUCT "product"
83 #define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
84 #define NM_DEVICE_MTU "mtu"
94 void (*state_changed) (NMDevice *device,
95 NMDeviceState new_state,
96 NMDeviceState old_state,
97 NMDeviceStateReason reason);
99 gboolean (*connection_compatible) (NMDevice *device,
100 NMConnection *connection,
103 const char * (*get_type_description) (NMDevice *device);
104 const char * (*get_hw_address) (NMDevice *device);
106 GType (*get_setting_type) (NMDevice *device);
108 /* Padding for future expansion */
109 void (*_reserved1) (void);
110 void (*_reserved2) (void);
111 void (*_reserved3) (void);
114 GType nm_device_get_type (void);
116 GObject * nm_device_new (DBusGConnection *connection, const char *path);
118 const char * nm_device_get_iface (NMDevice *device);
119 const char * nm_device_get_ip_iface (NMDevice *device);
120 NMDeviceType nm_device_get_device_type (NMDevice *device);
121 const char * nm_device_get_udi (NMDevice *device);
122 const char * nm_device_get_driver (NMDevice *device);
123 const char * nm_device_get_driver_version (NMDevice *device);
124 const char * nm_device_get_firmware_version (NMDevice *device);
125 NM_AVAILABLE_IN_0_9_10
126 const char * nm_device_get_type_description (NMDevice *device);
127 NM_AVAILABLE_IN_0_9_10
128 const char * nm_device_get_hw_address (NMDevice *device);
129 NMDeviceCapabilities nm_device_get_capabilities (NMDevice *device);
130 gboolean nm_device_get_managed (NMDevice *device);
132 void nm_device_set_managed (NMDevice *device, gboolean managed);
133 gboolean nm_device_get_autoconnect (NMDevice *device);
134 void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect);
135 gboolean nm_device_get_firmware_missing (NMDevice *device);
136 NMIP4Config * nm_device_get_ip4_config (NMDevice *device);
137 NMDHCP4Config * nm_device_get_dhcp4_config (NMDevice *device);
138 NMIP6Config * nm_device_get_ip6_config (NMDevice *device);
139 NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *device);
140 NMDeviceState nm_device_get_state (NMDevice *device);
141 NMDeviceState nm_device_get_state_reason (NMDevice *device, NMDeviceStateReason *reason);
142 NMActiveConnection * nm_device_get_active_connection(NMDevice *device);
143 const GPtrArray * nm_device_get_available_connections(NMDevice *device);
144 NM_AVAILABLE_IN_0_9_10
145 const char * nm_device_get_physical_port_id (NMDevice *device);
146 NM_AVAILABLE_IN_0_9_10
147 guint32 nm_device_get_mtu (NMDevice *device);
149 gboolean nm_device_is_software (NMDevice *device);
151 gboolean nm_device_is_real (NMDevice *device);
153 const char * nm_device_get_product (NMDevice *device);
154 const char * nm_device_get_vendor (NMDevice *device);
155 NM_AVAILABLE_IN_0_9_10
156 const char * nm_device_get_description (NMDevice *device);
157 NM_AVAILABLE_IN_0_9_10
158 char ** nm_device_disambiguate_names (NMDevice **devices,
161 typedef void (*NMDeviceCallbackFn) (NMDevice *device, GError *error, gpointer user_data);
163 void nm_device_disconnect (NMDevice *device,
164 NMDeviceCallbackFn callback,
168 void nm_device_delete (NMDevice *device,
169 NMDeviceCallbackFn callback,
172 GSList * nm_device_filter_connections (NMDevice *device,
173 const GSList *connections);
175 gboolean nm_device_connection_valid (NMDevice *device,
176 NMConnection *connection);
178 gboolean nm_device_connection_compatible (NMDevice *device,
179 NMConnection *connection,
182 NM_AVAILABLE_IN_0_9_10
183 GType nm_device_get_setting_type (NMDevice *device);
187 typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data);
191 #endif /* NM_DEVICE_H */