9b9edda49434c1d2189629f7c2f121c4dc8acf03
[NetworkManager.git] / src / devices / nm-device.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* NetworkManager -- Network link manager
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Copyright (C) 2005 - 2013 Red Hat, Inc.
19  * Copyright (C) 2006 - 2008 Novell, Inc.
20  */
21
22 #ifndef __NETWORKMANAGER_DEVICE_H__
23 #define __NETWORKMANAGER_DEVICE_H__
24
25 #include <netinet/in.h>
26
27 #include "nm-exported-object.h"
28 #include "nm-dbus-interface.h"
29 #include "nm-default.h"
30 #include "nm-connection.h"
31 #include "nm-rfkill-manager.h"
32 #include "NetworkManagerUtils.h"
33
34 /* Properties */
35 #define NM_DEVICE_UDI              "udi"
36 #define NM_DEVICE_IFACE            "interface"
37 #define NM_DEVICE_IP_IFACE         "ip-interface"
38 #define NM_DEVICE_DRIVER           "driver"
39 #define NM_DEVICE_DRIVER_VERSION   "driver-version"
40 #define NM_DEVICE_FIRMWARE_VERSION "firmware-version"
41 #define NM_DEVICE_CAPABILITIES     "capabilities"
42 #define NM_DEVICE_CARRIER          "carrier"
43 #define NM_DEVICE_IP4_ADDRESS      "ip4-address"
44 #define NM_DEVICE_IP4_CONFIG       "ip4-config"
45 #define NM_DEVICE_DHCP4_CONFIG     "dhcp4-config"
46 #define NM_DEVICE_IP6_CONFIG       "ip6-config"
47 #define NM_DEVICE_DHCP6_CONFIG     "dhcp6-config"
48 #define NM_DEVICE_STATE            "state"
49 #define NM_DEVICE_STATE_REASON     "state-reason"
50 #define NM_DEVICE_ACTIVE_CONNECTION "active-connection"
51 #define NM_DEVICE_DEVICE_TYPE      "device-type" /* ugh */
52 #define NM_DEVICE_LINK_TYPE        "link-type"
53 #define NM_DEVICE_MANAGED          "managed"
54 #define NM_DEVICE_AUTOCONNECT      "autoconnect"
55 #define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
56 #define NM_DEVICE_NM_PLUGIN_MISSING "nm-plugin-missing"
57 #define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
58 #define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
59 #define NM_DEVICE_MTU              "mtu"
60 #define NM_DEVICE_HW_ADDRESS       "hw-address"
61 #define NM_DEVICE_METERED          "metered"
62 #define NM_DEVICE_LLDP_NEIGHBORS  "lldp-neighbors"
63 #define NM_DEVICE_REAL             "real"
64
65 /* the "slaves" property is internal in the parent class, but exposed
66  * by the derived classes NMDeviceBond, NMDeviceBridge and NMDeviceTeam.
67  * It is thus important that the property name matches. */
68 #define NM_DEVICE_SLAVES           "slaves"         /* partially internal */
69
70 #define NM_DEVICE_TYPE_DESC        "type-desc"      /* Internal only */
71 #define NM_DEVICE_RFKILL_TYPE      "rfkill-type"    /* Internal only */
72 #define NM_DEVICE_IFINDEX          "ifindex"        /* Internal only */
73 #define NM_DEVICE_IS_MASTER        "is-master"      /* Internal only */
74 #define NM_DEVICE_MASTER           "master"         /* Internal only */
75 #define NM_DEVICE_HAS_PENDING_ACTION "has-pending-action" /* Internal only */
76
77 /* Internal signals */
78 #define NM_DEVICE_AUTH_REQUEST          "auth-request"
79 #define NM_DEVICE_IP4_CONFIG_CHANGED    "ip4-config-changed"
80 #define NM_DEVICE_IP6_CONFIG_CHANGED    "ip6-config-changed"
81 #define NM_DEVICE_REMOVED               "removed"
82 #define NM_DEVICE_RECHECK_AUTO_ACTIVATE "recheck-auto-activate"
83 #define NM_DEVICE_RECHECK_ASSUME        "recheck-assume"
84 #define NM_DEVICE_STATE_CHANGED         "state-changed"
85 #define NM_DEVICE_LINK_INITIALIZED      "link-initialized"
86
87 G_BEGIN_DECLS
88
89 #define NM_TYPE_DEVICE                  (nm_device_get_type ())
90 #define NM_DEVICE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE, NMDevice))
91 #define NM_DEVICE_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass),  NM_TYPE_DEVICE, NMDeviceClass))
92 #define NM_IS_DEVICE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE))
93 #define NM_IS_DEVICE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_DEVICE))
94 #define NM_DEVICE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_DEVICE, NMDeviceClass))
95
96 typedef enum NMActStageReturn NMActStageReturn;
97
98 /* These flags affect whether a connection is considered available on a device
99  * (check_connection_available()). The flags should have the meaning of relaxing
100  * a condition, so that adding a flag might make a connection available that would
101  * not be available otherwise. Adding a flag should never make a connection
102  * not available if it would be available otherwise. */
103 typedef enum { /*< skip >*/
104         NM_DEVICE_CHECK_CON_AVAILABLE_NONE                                  = 0,
105
106         _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST                     = (1L << 0),
107         _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER     = (1L << 1),
108         _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_IGNORE_AP           = (1L << 2),
109         NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST                      = _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST
110                                                                             | _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER
111                                                                             | _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_IGNORE_AP,
112
113         NM_DEVICE_CHECK_CON_AVAILABLE_ALL                                   = (1L << 3) - 1,
114 } NMDeviceCheckConAvailableFlags;
115
116 struct _NMDevicePrivate;
117
118 struct _NMDevice {
119         NMExportedObject parent;
120
121         /* private */
122         struct _NMDevicePrivate *priv;
123 };
124
125 /* The flags have an relaxing meaning, that means, specifying more flags, can make
126  * a device appear more available. It can never make a device less available. */
127 typedef enum { /*< skip >*/
128         NM_DEVICE_CHECK_DEV_AVAILABLE_NONE                                  = 0,
129
130         _NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER                       = (1L << 0),
131         NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST                      = _NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER,
132
133         NM_DEVICE_CHECK_DEV_AVAILABLE_ALL                                   = (1L << 1) - 1,
134 } NMDeviceCheckDevAvailableFlags;
135
136 typedef struct {
137         NMExportedObjectClass parent;
138
139         const char *connection_type;
140         const NMLinkType *link_types;
141
142         void (*state_changed) (NMDevice *device,
143                                NMDeviceState new_state,
144                                NMDeviceState old_state,
145                                NMDeviceStateReason reason);
146
147         void            (* link_changed) (NMDevice *self, NMPlatformLink *info);
148
149         /**
150          * create_and_realize():
151          * @self: the #NMDevice
152          * @connection: the #NMConnection being activated
153          * @parent: the parent #NMDevice, if any
154          * @out_plink: on success, a backing kernel network device if one exists.
155          *   The returned pointer is owned by platform and only valid until the
156          *   next platform operation.
157          * @error: location to store error, or %NULL
158          *
159          * Create any backing resources (kernel devices, etc) required for this
160          * device to activate @connection.  If the device is backed by a kernel
161          * network device, that device should be returned in @out_plink after
162          * being created.
163          *
164          * Returns: %TRUE on success, %FALSE on error
165          */
166         gboolean        (*create_and_realize) (NMDevice *self,
167                                                NMConnection *connection,
168                                                NMDevice *parent,
169                                                const NMPlatformLink **out_plink,
170                                                GError **error);
171
172         /**
173          * realize_start_notify():
174          * @self: the #NMDevice
175          * @plink: the #NMPlatformLink if backed by a kernel netdevice
176          *
177          * Hook for derived classes to be notfied during realize_start_setup()
178          * and perform additional setup.
179          */
180         void        (*realize_start_notify) (NMDevice *self, const NMPlatformLink *plink);
181
182         /**
183          * unrealize_notify():
184          * @self: the #NMDevice
185          *
186          * Hook for derived classes to clear any properties that depend on backing resources
187          * (kernel devices, etc). This is called by nm_device_unrealize() during unrealization.
188          */
189         void            (*unrealize_notify)  (NMDevice *self);
190
191         /* Hardware state (IFF_UP) */
192         gboolean        (*can_unmanaged_external_down)  (NMDevice *self);
193         gboolean        (*is_up)                        (NMDevice *self);
194         gboolean        (*bring_up)                     (NMDevice *self, gboolean *no_firmware);
195         gboolean        (*take_down)                    (NMDevice *self);
196
197         /* Carrier state (IFF_LOWER_UP) */
198         void            (*carrier_changed) (NMDevice *, gboolean carrier);
199
200         gboolean    (* get_ip_iface_identifier) (NMDevice *self, NMUtilsIPv6IfaceId *out_iid);
201
202         NMDeviceCapabilities (* get_generic_capabilities) (NMDevice *self);
203
204         gboolean        (* is_available) (NMDevice *self, NMDeviceCheckDevAvailableFlags flags);
205
206         gboolean    (* get_enabled) (NMDevice *self);
207
208         void        (* set_enabled) (NMDevice *self, gboolean enabled);
209
210         gboolean    (* can_auto_connect) (NMDevice *self,
211                                           NMConnection *connection,
212                                           char **specific_object);
213
214         /* Checks whether the connection is compatible with the device using
215          * only the devices type and characteristics.  Does not use any live
216          * network information like WiFi scan lists etc.
217          */
218         gboolean    (* check_connection_compatible) (NMDevice *self, NMConnection *connection);
219
220         /* Checks whether the connection is likely available to be activated,
221          * including any live network information like scan lists.  The connection
222          * is checked against the object defined by @specific_object, if given.
223          * Returns TRUE if the connection is available; FALSE if not.
224          *
225          * The passed @flags affect whether a connection is considered
226          * available or not. Adding more flags, means the connection is
227          * *more* available.
228          *
229          * Specifying @specific_object can only reduce the availability of a connection.
230          */
231         gboolean    (* check_connection_available) (NMDevice *self,
232                                                     NMConnection *connection,
233                                                     NMDeviceCheckConAvailableFlags flags,
234                                                     const char *specific_object);
235
236         gboolean    (* complete_connection)         (NMDevice *self,
237                                                      NMConnection *connection,
238                                                      const char *specific_object,
239                                                      const GSList *existing_connections,
240                                                      GError **error);
241
242         NMActStageReturn        (* act_stage1_prepare)  (NMDevice *self,
243                                                      NMDeviceStateReason *reason);
244         NMActStageReturn        (* act_stage2_config)   (NMDevice *self,
245                                                      NMDeviceStateReason *reason);
246         NMActStageReturn        (* act_stage3_ip4_config_start) (NMDevice *self,
247                                                              NMIP4Config **out_config,
248                                                              NMDeviceStateReason *reason);
249         NMActStageReturn        (* act_stage3_ip6_config_start) (NMDevice *self,
250                                                              NMIP6Config **out_config,
251                                                              NMDeviceStateReason *reason);
252         NMActStageReturn        (* act_stage4_ip4_config_timeout)       (NMDevice *self,
253                                                                  NMDeviceStateReason *reason);
254         NMActStageReturn        (* act_stage4_ip6_config_timeout)       (NMDevice *self,
255                                                                  NMDeviceStateReason *reason);
256
257         /* Called right before IP config is set; use for setting MTU etc */
258         void                (* ip4_config_pre_commit) (NMDevice *self, NMIP4Config *config);
259         void                (* ip6_config_pre_commit) (NMDevice *self, NMIP6Config *config);
260
261         /* Async deactivating (in the DEACTIVATING phase) */
262         void            (* deactivate_async)        (NMDevice *self,
263                                                      GCancellable *cancellable,
264                                                      GAsyncReadyCallback callback,
265                                                      gpointer user_data);
266         gboolean        (* deactivate_async_finish) (NMDevice *self,
267                                                      GAsyncResult *res,
268                                                      GError **error);
269
270         /* Sync deactivating (in the DISCONNECTED phase) */
271         void                    (* deactivate)                  (NMDevice *self);
272
273         const char *(*get_type_description) (NMDevice *self);
274
275         NMMatchSpecMatchType (* spec_match_list)   (NMDevice *self, const GSList *specs);
276
277         /* Update the connection with currently configured L2 settings */
278         void            (* update_connection) (NMDevice *device, NMConnection *connection);
279
280         gboolean (*master_update_slave_connection) (NMDevice *self,
281                                                     NMDevice *slave,
282                                                     NMConnection *connection,
283                                                     GError **error);
284
285         gboolean        (* enslave_slave) (NMDevice *self,
286                                            NMDevice *slave,
287                                            NMConnection *connection,
288                                            gboolean configure);
289
290         void            (* release_slave) (NMDevice *self,
291                                            NMDevice *slave,
292                                            gboolean configure);
293
294         gboolean        (* have_any_ready_slaves) (NMDevice *self,
295                                                    const GSList *slaves);
296
297         void            (* notify_new_device_added) (NMDevice *self, NMDevice *new_device);
298
299         /**
300          * component_added:
301          * @self: the #NMDevice
302          * @component: the component (device, modem, etc) which was added
303          *
304          * Notifies @self that a new component was added to the Manager.  This
305          * may include any kind of %GObject subclass, and the device is expected
306          * to match only specific components they care about, like %NMModem objects
307          * or %NMDevice objects.
308          *
309          * Returns: %TRUE if the component was claimed exclusively and no further
310          * devices should be notified of the new component.  %FALSE to indicate
311          * that the component was not exclusively claimed and other devices should
312          * be notified.
313          */
314         gboolean        (* component_added) (NMDevice *self, GObject *component);
315
316         gboolean        (* owns_iface) (NMDevice *self, const char *iface);
317
318         NMConnection *  (* new_default_connection) (NMDevice *self);
319 } NMDeviceClass;
320
321 typedef void (*NMDeviceAuthRequestFunc) (NMDevice *device,
322                                          GDBusMethodInvocation *context,
323                                          NMAuthSubject *subject,
324                                          GError *error,
325                                          gpointer user_data);
326
327 GType nm_device_get_type (void);
328
329 const char *    nm_device_get_udi               (NMDevice *dev);
330 const char *    nm_device_get_iface             (NMDevice *dev);
331 int             nm_device_get_ifindex   (NMDevice *dev);
332 gboolean        nm_device_is_software   (NMDevice *dev);
333 gboolean        nm_device_is_real       (NMDevice *dev);
334 const char *    nm_device_get_ip_iface  (NMDevice *dev);
335 int             nm_device_get_ip_ifindex(NMDevice *dev);
336 const char *    nm_device_get_driver    (NMDevice *dev);
337 const char *    nm_device_get_driver_version    (NMDevice *dev);
338 const char *    nm_device_get_type_desc (NMDevice *dev);
339 const char *    nm_device_get_type_description (NMDevice *dev);
340 NMDeviceType    nm_device_get_device_type       (NMDevice *dev);
341 NMLinkType      nm_device_get_link_type (NMDevice *dev);
342 NMMetered       nm_device_get_metered   (NMDevice *dev);
343
344 int                     nm_device_get_priority (NMDevice *dev);
345 guint32     nm_device_get_ip4_route_metric (NMDevice *dev);
346 guint32     nm_device_get_ip6_route_metric (NMDevice *dev);
347
348 const char *    nm_device_get_hw_address           (NMDevice *dev);
349 const char *    nm_device_get_permanent_hw_address (NMDevice *dev);
350 const char *    nm_device_get_initial_hw_address   (NMDevice *dev);
351
352 NMDhcp4Config * nm_device_get_dhcp4_config (NMDevice *dev);
353 NMDhcp6Config * nm_device_get_dhcp6_config (NMDevice *dev);
354
355 NMIP4Config *   nm_device_get_ip4_config        (NMDevice *dev);
356 void            nm_device_replace_vpn4_config   (NMDevice *dev,
357                                                  NMIP4Config *old,
358                                                  NMIP4Config *config);
359
360 NMIP6Config *   nm_device_get_ip6_config        (NMDevice *dev);
361 void            nm_device_replace_vpn6_config   (NMDevice *dev,
362                                                  NMIP6Config *old,
363                                                  NMIP6Config *config);
364
365 void            nm_device_capture_initial_config (NMDevice *dev);
366
367 /* Master */
368 gboolean        nm_device_is_master         (NMDevice *dev);
369
370 /* Slave */
371 NMDevice *      nm_device_get_master        (NMDevice *dev);
372
373 NMActRequest *          nm_device_get_act_request               (NMDevice *dev);
374 NMSettingsConnection *  nm_device_get_settings_connection       (NMDevice *dev);
375 NMConnection *          nm_device_get_applied_connection        (NMDevice *dev);
376 gboolean                nm_device_has_unmodified_applied_connection (NMDevice *self,
377                                                                      NMSettingCompareFlags compare_flags);
378 NMSetting *             nm_device_get_applied_setting           (NMDevice *dev, GType setting_type);
379
380 void            nm_device_removed        (NMDevice *dev);
381
382 gboolean        nm_device_is_available   (NMDevice *dev, NMDeviceCheckDevAvailableFlags flags);
383 gboolean        nm_device_has_carrier    (NMDevice *dev);
384
385 NMConnection * nm_device_generate_connection (NMDevice *self, NMDevice *master);
386
387 gboolean nm_device_master_update_slave_connection (NMDevice *master,
388                                                    NMDevice *slave,
389                                                    NMConnection *connection,
390                                                    GError **error);
391
392 gboolean nm_device_can_auto_connect (NMDevice *self,
393                                      NMConnection *connection,
394                                      char **specific_object);
395
396 gboolean nm_device_complete_connection (NMDevice *device,
397                                         NMConnection *connection,
398                                         const char *specific_object,
399                                         const GSList *existing_connection,
400                                         GError **error);
401
402 gboolean nm_device_check_connection_compatible (NMDevice *device, NMConnection *connection);
403 gboolean nm_device_check_slave_connection_compatible (NMDevice *device, NMConnection *connection);
404
405 gboolean nm_device_uses_assumed_connection (NMDevice *device);
406
407 gboolean nm_device_can_assume_active_connection (NMDevice *device);
408
409 gboolean nm_device_spec_match_list (NMDevice *device, const GSList *specs);
410
411 gboolean                nm_device_is_activating         (NMDevice *dev);
412 gboolean                nm_device_autoconnect_allowed   (NMDevice *self);
413
414 NMDeviceState nm_device_get_state (NMDevice *device);
415
416 gboolean nm_device_get_enabled (NMDevice *device);
417
418 void nm_device_set_enabled (NMDevice *device, gboolean enabled);
419
420 RfKillType nm_device_get_rfkill_type (NMDevice *device);
421
422 /**
423  * NMUnmanagedFlags:
424  * @NM_UNMANAGED_NONE: placeholder value
425  * @NM_UNMANAGED_SLEEPING: %TRUE when unmanaged because NM is sleeping.
426  * @NM_UNMANAGED_QUITTING: %TRUE when unmanaged because NM is shutting down.
427  * @NM_UNMANAGED_PARENT: %TRUE when unmanaged due to parent device being unmanaged
428  * @NM_UNMANAGED_LOOPBACK: %TRUE for unmanaging loopback device
429  * @NM_UNMANAGED_PLATFORM_INIT: %TRUE when unmanaged because platform link not
430  *   yet initialized. Unrealized device are also unmanaged for this reason.
431  * @NM_UNMANAGED_USER_EXPLICIT: %TRUE when unmanaged by explicit user decision
432  *   (e.g. via a D-Bus command)
433  * @NM_UNMANAGED_USER_SETTINGS: %TRUE when unmanaged by user decision via
434  *   the settings plugin (for example keyfile.unmanaged-devices or ifcfg-rh's
435  *   NM_CONTROLLED=no)
436  * @NM_UNMANAGED_BY_DEFAULT: %TRUE for certain device types where we unmanage
437  *   them by default
438  * @NM_UNMANAGED_USER_UDEV: %TRUE when unmanaged by user decision (via UDev rule)
439  * @NM_UNMANAGED_EXTERNAL_DOWN: %TRUE when unmanaged because !IFF_UP and not created by NM
440  * @NM_UNMANAGED_IS_SLAVE: indicates that the device is enslaved. Note that
441  *   setting the NM_UNMANAGED_IS_SLAVE to %TRUE makes no sense, this flag has only
442  *   meaning to set a slave device as managed if the parent is managed too.
443  */
444 typedef enum { /*< skip >*/
445         NM_UNMANAGED_NONE          = 0,
446
447         /* these flags are authorative. If one of them is set,
448          * the device cannot be managed. */
449         NM_UNMANAGED_SLEEPING      = (1LL <<  0),
450         NM_UNMANAGED_QUITTING      = (1LL <<  1),
451         NM_UNMANAGED_PARENT        = (1LL <<  2),
452         NM_UNMANAGED_LOOPBACK      = (1LL <<  3),
453         NM_UNMANAGED_PLATFORM_INIT = (1LL <<  4),
454         NM_UNMANAGED_USER_EXPLICIT = (1LL <<  5),
455         NM_UNMANAGED_USER_SETTINGS = (1LL <<  6),
456
457         /* These flags can be non-effective and be overwritten
458          * by other flags. */
459         NM_UNMANAGED_BY_DEFAULT    = (1LL <<  8),
460         NM_UNMANAGED_USER_UDEV     = (1LL << 10),
461         NM_UNMANAGED_EXTERNAL_DOWN = (1LL << 11),
462         NM_UNMANAGED_IS_SLAVE      = (1LL << 12),
463
464 } NMUnmanagedFlags;
465
466 typedef enum {
467         NM_UNMAN_FLAG_OP_SET_MANAGED        = FALSE,
468         NM_UNMAN_FLAG_OP_SET_UNMANAGED      = TRUE,
469         NM_UNMAN_FLAG_OP_FORGET             = 2,
470 } NMUnmanFlagOp;
471
472 const char *nm_unmanaged_flags2str (NMUnmanagedFlags flags, char *buf, gsize len);
473
474 gboolean nm_device_get_managed (NMDevice *device, gboolean for_user_request);
475 NMUnmanagedFlags nm_device_get_unmanaged_flags (NMDevice *device, NMUnmanagedFlags flag);
476 void nm_device_set_unmanaged_flags (NMDevice *device,
477                                     NMUnmanagedFlags flags,
478                                     NMUnmanFlagOp set_op);
479 void nm_device_set_unmanaged_by_flags (NMDevice *device,
480                                        NMUnmanagedFlags flags,
481                                        NMUnmanFlagOp set_op,
482                                        NMDeviceStateReason reason);
483 void nm_device_set_unmanaged_by_user_config (NMDevice *self, const GSList *unmanaged_specs);
484 void nm_device_set_unmanaged_by_user_udev (NMDevice *self);
485 void nm_device_set_unmanaged_by_quitting (NMDevice *device);
486
487 gboolean nm_device_get_is_nm_owned (NMDevice *device);
488
489 gboolean nm_device_has_capability (NMDevice *self, NMDeviceCapabilities caps);
490
491 gboolean nm_device_realize_start      (NMDevice *device,
492                                        const NMPlatformLink *plink,
493                                        gboolean *out_compatible,
494                                        GError **error);
495 void     nm_device_realize_finish     (NMDevice *self,
496                                        const NMPlatformLink *plink);
497 gboolean nm_device_create_and_realize (NMDevice *self,
498                                        NMConnection *connection,
499                                        NMDevice *parent,
500                                        GError **error);
501 gboolean nm_device_unrealize          (NMDevice *device,
502                                        gboolean remove_resources,
503                                        GError **error);
504
505 gboolean nm_device_get_autoconnect (NMDevice *device);
506 void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect);
507 void nm_device_emit_recheck_auto_activate (NMDevice *device);
508
509 void nm_device_state_changed (NMDevice *device,
510                               NMDeviceState state,
511                               NMDeviceStateReason reason);
512
513 void nm_device_queue_state   (NMDevice *self,
514                               NMDeviceState state,
515                               NMDeviceStateReason reason);
516
517 gboolean nm_device_get_firmware_missing (NMDevice *self);
518 gboolean nm_device_get_nm_plugin_missing (NMDevice *self);
519 void     nm_device_set_nm_plugin_missing (NMDevice *self,
520                                           gboolean missing);
521
522 void nm_device_steal_connection (NMDevice *device, NMSettingsConnection *connection);
523
524 void nm_device_queue_activation (NMDevice *device, NMActRequest *req);
525
526 gboolean nm_device_supports_vlans (NMDevice *device);
527
528 gboolean nm_device_add_pending_action    (NMDevice *device, const char *action, gboolean assert_not_yet_pending);
529 gboolean nm_device_remove_pending_action (NMDevice *device, const char *action, gboolean assert_is_pending);
530 gboolean nm_device_has_pending_action    (NMDevice *device);
531
532 GPtrArray *nm_device_get_available_connections (NMDevice *device,
533                                                 const char *specific_object);
534
535 gboolean   nm_device_check_connection_available (NMDevice *device,
536                                                  NMConnection *connection,
537                                                  NMDeviceCheckConAvailableFlags flags,
538                                                  const char *specific_object);
539
540 void     nm_device_notify_new_device_added (NMDevice *self, NMDevice *new_device);
541 gboolean nm_device_notify_component_added (NMDevice *device, GObject *component);
542
543 gboolean nm_device_owns_iface (NMDevice *device, const char *iface);
544
545 NMConnection *nm_device_new_default_connection (NMDevice *self);
546
547 const NMPlatformIP4Route *nm_device_get_ip4_default_route (NMDevice *self, gboolean *out_is_assumed);
548 const NMPlatformIP6Route *nm_device_get_ip6_default_route (NMDevice *self, gboolean *out_is_assumed);
549
550 void nm_device_spawn_iface_helper (NMDevice *self);
551
552 void nm_device_reapply_settings_immediately (NMDevice *self);
553
554 void nm_device_update_firewall_zone (NMDevice *self);
555 void nm_device_update_metered (NMDevice *self);
556 void nm_device_reactivate_ip4_config (NMDevice *device,
557                                       NMSettingIPConfig *s_ip4_old,
558                                       NMSettingIPConfig *s_ip4_new);
559 void nm_device_reactivate_ip6_config (NMDevice *device,
560                                       NMSettingIPConfig *s_ip6_old,
561                                       NMSettingIPConfig *s_ip6_new);
562
563 void nm_device_update_hw_address (NMDevice *self);
564 void nm_device_update_initial_hw_address (NMDevice *self);
565
566 G_END_DECLS
567
568 #endif  /* NM_DEVICE_H */