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.
22 #ifndef __NM_DEVICE_H__
23 #define __NM_DEVICE_H__
25 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
26 #error "Only <NetworkManager.h> can be included directly."
29 #include <nm-object.h>
33 #define NM_TYPE_DEVICE (nm_device_get_type ())
34 #define NM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE, NMDevice))
35 #define NM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE, NMDeviceClass))
36 #define NM_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE))
37 #define NM_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE))
38 #define NM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE, NMDeviceClass))
40 #define NM_DEVICE_DEVICE_TYPE "device-type"
41 #define NM_DEVICE_UDI "udi"
42 #define NM_DEVICE_INTERFACE "interface"
43 #define NM_DEVICE_IP_INTERFACE "ip-interface"
44 #define NM_DEVICE_DRIVER "driver"
45 #define NM_DEVICE_DRIVER_VERSION "driver-version"
46 #define NM_DEVICE_FIRMWARE_VERSION "firmware-version"
47 #define NM_DEVICE_CAPABILITIES "capabilities"
48 #define NM_DEVICE_REAL "real"
49 #define NM_DEVICE_MANAGED "managed"
50 #define NM_DEVICE_AUTOCONNECT "autoconnect"
51 #define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
52 #define NM_DEVICE_NM_PLUGIN_MISSING "nm-plugin-missing"
53 #define NM_DEVICE_IP4_CONFIG "ip4-config"
54 #define NM_DEVICE_DHCP4_CONFIG "dhcp4-config"
55 #define NM_DEVICE_IP6_CONFIG "ip6-config"
56 #define NM_DEVICE_DHCP6_CONFIG "dhcp6-config"
57 #define NM_DEVICE_STATE "state"
58 #define NM_DEVICE_STATE_REASON "state-reason"
59 #define NM_DEVICE_ACTIVE_CONNECTION "active-connection"
60 #define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
61 #define NM_DEVICE_VENDOR "vendor"
62 #define NM_DEVICE_PRODUCT "product"
63 #define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
64 #define NM_DEVICE_MTU "mtu"
65 #define NM_DEVICE_METERED "metered"
66 #define NM_DEVICE_LLDP_NEIGHBORS "lldp-neighbors"
76 void (*state_changed) (NMDevice *device,
77 NMDeviceState new_state,
78 NMDeviceState old_state,
79 NMDeviceStateReason reason);
82 gboolean (*connection_compatible) (NMDevice *device,
83 NMConnection *connection,
86 const char * (*get_type_description) (NMDevice *device);
87 const char * (*get_hw_address) (NMDevice *device);
89 GType (*get_setting_type) (NMDevice *device);
95 typedef struct _NMLldpNeighbor NMLldpNeighbor;
97 GType nm_device_get_type (void);
99 const char * nm_device_get_iface (NMDevice *device);
100 const char * nm_device_get_ip_iface (NMDevice *device);
101 NMDeviceType nm_device_get_device_type (NMDevice *device);
102 const char * nm_device_get_udi (NMDevice *device);
103 const char * nm_device_get_driver (NMDevice *device);
104 const char * nm_device_get_driver_version (NMDevice *device);
105 const char * nm_device_get_firmware_version (NMDevice *device);
106 const char * nm_device_get_type_description (NMDevice *device);
107 const char * nm_device_get_hw_address (NMDevice *device);
108 NMDeviceCapabilities nm_device_get_capabilities (NMDevice *device);
109 gboolean nm_device_get_managed (NMDevice *device);
111 void nm_device_set_managed (NMDevice *device, gboolean managed);
112 gboolean nm_device_get_autoconnect (NMDevice *device);
113 void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect);
114 gboolean nm_device_get_firmware_missing (NMDevice *device);
116 gboolean nm_device_get_nm_plugin_missing (NMDevice *device);
117 NMIPConfig * nm_device_get_ip4_config (NMDevice *device);
118 NMDhcpConfig * nm_device_get_dhcp4_config (NMDevice *device);
119 NMIPConfig * nm_device_get_ip6_config (NMDevice *device);
120 NMDhcpConfig * nm_device_get_dhcp6_config (NMDevice *device);
121 NMDeviceState nm_device_get_state (NMDevice *device);
122 NMDeviceStateReason nm_device_get_state_reason (NMDevice *device);
123 NMActiveConnection * nm_device_get_active_connection(NMDevice *device);
124 const GPtrArray * nm_device_get_available_connections(NMDevice *device);
125 const char * nm_device_get_physical_port_id (NMDevice *device);
126 guint32 nm_device_get_mtu (NMDevice *device);
128 gboolean nm_device_is_real (NMDevice *device);
129 gboolean nm_device_is_software (NMDevice *device);
131 const char * nm_device_get_product (NMDevice *device);
132 const char * nm_device_get_vendor (NMDevice *device);
133 const char * nm_device_get_description (NMDevice *device);
135 NMMetered nm_device_get_metered (NMDevice *device);
137 GPtrArray * nm_device_get_lldp_neighbors (NMDevice *device);
138 char ** nm_device_disambiguate_names (NMDevice **devices,
141 gboolean nm_device_reapply (NMDevice *device,
142 NMConnection *connection,
145 GCancellable *cancellable,
148 void nm_device_reapply_async (NMDevice *device,
149 NMConnection *connection,
152 GCancellable *cancellable,
153 GAsyncReadyCallback callback,
156 gboolean nm_device_reapply_finish (NMDevice *device,
157 GAsyncResult *result,
161 NMConnection *nm_device_get_applied_connection (NMDevice *device,
164 GCancellable *cancellable,
167 void nm_device_get_applied_connection_async (NMDevice *device,
169 GCancellable *cancellable,
170 GAsyncReadyCallback callback,
173 NMConnection *nm_device_get_applied_connection_finish (NMDevice *device,
174 GAsyncResult *result,
178 gboolean nm_device_disconnect (NMDevice *device,
179 GCancellable *cancellable,
181 void nm_device_disconnect_async (NMDevice *device,
182 GCancellable *cancellable,
183 GAsyncReadyCallback callback,
185 gboolean nm_device_disconnect_finish (NMDevice *device,
186 GAsyncResult *result,
189 gboolean nm_device_delete (NMDevice *device,
190 GCancellable *cancellable,
192 void nm_device_delete_async (NMDevice *device,
193 GCancellable *cancellable,
194 GAsyncReadyCallback callback,
196 gboolean nm_device_delete_finish (NMDevice *device,
197 GAsyncResult *result,
200 GPtrArray * nm_device_filter_connections (NMDevice *device,
201 const GPtrArray *connections);
203 gboolean nm_device_connection_valid (NMDevice *device,
204 NMConnection *connection);
206 gboolean nm_device_connection_compatible (NMDevice *device,
207 NMConnection *connection,
210 GType nm_device_get_setting_type (NMDevice *device);
213 GType nm_lldp_neighbor_get_type (void);
215 NMLldpNeighbor *nm_lldp_neighbor_new (void);
217 void nm_lldp_neighbor_ref (NMLldpNeighbor *neighbor);
219 void nm_lldp_neighbor_unref (NMLldpNeighbor *neighbor);
221 char **nm_lldp_neighbor_get_attr_names (NMLldpNeighbor *neighbor);
223 gboolean nm_lldp_neighbor_get_attr_string_value (NMLldpNeighbor *neighbor, char *name,
224 const char **out_value);
226 gboolean nm_lldp_neighbor_get_attr_uint_value (NMLldpNeighbor *neighbor, char *name,
229 const GVariantType *nm_lldp_neighbor_get_attr_type (NMLldpNeighbor *neighbor, char *name);
233 #endif /* __NM_DEVICE_H__ */