diff options
Diffstat (limited to 'src/devices/nm-device.h')
| -rw-r--r-- | src/devices/nm-device.h | 86 |
1 files changed, 55 insertions, 31 deletions
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index e173b2db..9b9edda4 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -103,12 +103,14 @@ typedef enum NMActStageReturn NMActStageReturn; typedef enum { /*< skip >*/ NM_DEVICE_CHECK_CON_AVAILABLE_NONE = 0, - _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER = (1L << 0), - _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_IGNORE_AP = (1L << 1), - NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST = _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER + _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST = (1L << 0), + _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER = (1L << 1), + _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_IGNORE_AP = (1L << 2), + NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST = _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST + | _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER | _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_IGNORE_AP, - NM_DEVICE_CHECK_CON_AVAILABLE_ALL = (1L << 2) - 1, + NM_DEVICE_CHECK_CON_AVAILABLE_ALL = (1L << 3) - 1, } NMDeviceCheckConAvailableFlags; struct _NMDevicePrivate; @@ -324,8 +326,6 @@ typedef void (*NMDeviceAuthRequestFunc) (NMDevice *device, GType nm_device_get_type (void); -void nm_device_finish_init (NMDevice *device); - const char * nm_device_get_udi (NMDevice *dev); const char * nm_device_get_iface (NMDevice *dev); int nm_device_get_ifindex (NMDevice *dev); @@ -375,6 +375,7 @@ NMSettingsConnection * nm_device_get_settings_connection (NMDevice *dev); NMConnection * nm_device_get_applied_connection (NMDevice *dev); gboolean nm_device_has_unmodified_applied_connection (NMDevice *self, NMSettingCompareFlags compare_flags); +NMSetting * nm_device_get_applied_setting (NMDevice *dev, GType setting_type); void nm_device_removed (NMDevice *dev); @@ -421,45 +422,67 @@ RfKillType nm_device_get_rfkill_type (NMDevice *device); /** * NMUnmanagedFlags: * @NM_UNMANAGED_NONE: placeholder value - * @NM_UNMANAGED_INTERNAL: %TRUE when unmanaged by internal decision (ie, - * because NM is sleeping or not managed for some other reason) + * @NM_UNMANAGED_SLEEPING: %TRUE when unmanaged because NM is sleeping. + * @NM_UNMANAGED_QUITTING: %TRUE when unmanaged because NM is shutting down. * @NM_UNMANAGED_PARENT: %TRUE when unmanaged due to parent device being unmanaged * @NM_UNMANAGED_LOOPBACK: %TRUE for unmanaging loopback device * @NM_UNMANAGED_PLATFORM_INIT: %TRUE when unmanaged because platform link not - * yet initialized - * @NM_UNMANAGED_USER: %TRUE when unmanaged by user decision (via unmanaged-specs) - * @NM_UNMANAGED_DEFAULT: %TRUE when unmanaged by default (ie, Generic devices) + * yet initialized. Unrealized device are also unmanaged for this reason. + * @NM_UNMANAGED_USER_EXPLICIT: %TRUE when unmanaged by explicit user decision + * (e.g. via a D-Bus command) + * @NM_UNMANAGED_USER_SETTINGS: %TRUE when unmanaged by user decision via + * the settings plugin (for example keyfile.unmanaged-devices or ifcfg-rh's + * NM_CONTROLLED=no) + * @NM_UNMANAGED_BY_DEFAULT: %TRUE for certain device types where we unmanage + * them by default + * @NM_UNMANAGED_USER_UDEV: %TRUE when unmanaged by user decision (via UDev rule) * @NM_UNMANAGED_EXTERNAL_DOWN: %TRUE when unmanaged because !IFF_UP and not created by NM + * @NM_UNMANAGED_IS_SLAVE: indicates that the device is enslaved. Note that + * setting the NM_UNMANAGED_IS_SLAVE to %TRUE makes no sense, this flag has only + * meaning to set a slave device as managed if the parent is managed too. */ typedef enum { /*< skip >*/ NM_UNMANAGED_NONE = 0, - NM_UNMANAGED_INTERNAL = (1LL << 0), - NM_UNMANAGED_PARENT = (1LL << 1), - NM_UNMANAGED_LOOPBACK = (1LL << 2), - NM_UNMANAGED_PLATFORM_INIT = (1LL << 3), - NM_UNMANAGED_USER = (1LL << 4), - - NM_UNMANAGED_DEFAULT = (1LL << 8), + /* these flags are authorative. If one of them is set, + * the device cannot be managed. */ + NM_UNMANAGED_SLEEPING = (1LL << 0), + NM_UNMANAGED_QUITTING = (1LL << 1), + NM_UNMANAGED_PARENT = (1LL << 2), + NM_UNMANAGED_LOOPBACK = (1LL << 3), + NM_UNMANAGED_PLATFORM_INIT = (1LL << 4), + NM_UNMANAGED_USER_EXPLICIT = (1LL << 5), + NM_UNMANAGED_USER_SETTINGS = (1LL << 6), + + /* These flags can be non-effective and be overwritten + * by other flags. */ + NM_UNMANAGED_BY_DEFAULT = (1LL << 8), + NM_UNMANAGED_USER_UDEV = (1LL << 10), NM_UNMANAGED_EXTERNAL_DOWN = (1LL << 11), + NM_UNMANAGED_IS_SLAVE = (1LL << 12), - /* Boundary value */ - __NM_UNMANAGED_LAST, - NM_UNMANAGED_LAST = __NM_UNMANAGED_LAST - 1, - NM_UNMANAGED_ALL = ((NM_UNMANAGED_LAST << 1) - 1), } NMUnmanagedFlags; -gboolean nm_device_get_managed (NMDevice *device); +typedef enum { + NM_UNMAN_FLAG_OP_SET_MANAGED = FALSE, + NM_UNMAN_FLAG_OP_SET_UNMANAGED = TRUE, + NM_UNMAN_FLAG_OP_FORGET = 2, +} NMUnmanFlagOp; + +const char *nm_unmanaged_flags2str (NMUnmanagedFlags flags, char *buf, gsize len); + +gboolean nm_device_get_managed (NMDevice *device, gboolean for_user_request); NMUnmanagedFlags nm_device_get_unmanaged_flags (NMDevice *device, NMUnmanagedFlags flag); void nm_device_set_unmanaged_flags (NMDevice *device, - NMUnmanagedFlags flag, - gboolean unmanaged, - NMDeviceStateReason reason); -void nm_device_set_unmanaged_flags_by_device_spec (NMDevice *self, const GSList *unmanaged_specs); -void nm_device_set_unmanaged_flags_initial (NMDevice *device, - NMUnmanagedFlags flag, - gboolean unmanaged); -void nm_device_set_unmanaged_quitting (NMDevice *device); + NMUnmanagedFlags flags, + NMUnmanFlagOp set_op); +void nm_device_set_unmanaged_by_flags (NMDevice *device, + NMUnmanagedFlags flags, + NMUnmanFlagOp set_op, + NMDeviceStateReason reason); +void nm_device_set_unmanaged_by_user_config (NMDevice *self, const GSList *unmanaged_specs); +void nm_device_set_unmanaged_by_user_udev (NMDevice *self); +void nm_device_set_unmanaged_by_quitting (NMDevice *device); gboolean nm_device_get_is_nm_owned (NMDevice *device); @@ -481,6 +504,7 @@ gboolean nm_device_unrealize (NMDevice *device, gboolean nm_device_get_autoconnect (NMDevice *device); void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect); +void nm_device_emit_recheck_auto_activate (NMDevice *device); void nm_device_state_changed (NMDevice *device, NMDeviceState state, |