diff options
Diffstat (limited to 'src/devices/nm-device-private.h')
| -rw-r--r-- | src/devices/nm-device-private.h | 90 |
1 files changed, 70 insertions, 20 deletions
diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h index 66c715de..6e2372ab 100644 --- a/src/devices/nm-device-private.h +++ b/src/devices/nm-device-private.h @@ -26,6 +26,14 @@ /* This file should only be used by subclasses of NMDevice */ +typedef enum { + NM_DEVICE_IP_STATE_NONE, + NM_DEVICE_IP_STATE_WAIT, + NM_DEVICE_IP_STATE_CONF, + NM_DEVICE_IP_STATE_DONE, + NM_DEVICE_IP_STATE_FAIL, +} NMDeviceIPState; + enum NMActStageReturn { NM_ACT_STAGE_RETURN_FAILURE = 0, /* Hard failure of activation */ NM_ACT_STAGE_RETURN_SUCCESS, /* Activation stage done */ @@ -34,7 +42,7 @@ enum NMActStageReturn { NM_ACT_STAGE_RETURN_IP_DONE, /* IP config stage is done (state IP_DONE), For the ip-config stage, this is similar to NM_ACT_STAGE_RETURN_SUCCESS, except that no - IP config should be commited. */ + IP config should be committed. */ NM_ACT_STAGE_RETURN_IP_FAIL, /* IP config stage failed (state IP_FAIL), activation may proceed */ }; @@ -75,19 +83,51 @@ void nm_device_set_firmware_missing (NMDevice *self, gboolean missing); void nm_device_activate_schedule_stage1_device_prepare (NMDevice *device); void nm_device_activate_schedule_stage2_device_config (NMDevice *device); -void nm_device_activate_schedule_ip4_config_result(NMDevice *device, NMIP4Config *config); -void nm_device_activate_schedule_ip4_config_timeout (NMDevice *device); - -void nm_device_activate_schedule_ip6_config_result (NMDevice *device); -void nm_device_activate_schedule_ip6_config_timeout (NMDevice *device); - -gboolean nm_device_activate_ip4_state_in_conf (NMDevice *device); -gboolean nm_device_activate_ip4_state_in_wait (NMDevice *device); -gboolean nm_device_activate_ip4_state_done (NMDevice *device); - -gboolean nm_device_activate_ip6_state_in_conf (NMDevice *device); -gboolean nm_device_activate_ip6_state_in_wait (NMDevice *device); -gboolean nm_device_activate_ip6_state_done (NMDevice *device); +void nm_device_activate_schedule_ip_config_result (NMDevice *device, + int addr_family, + NMIPConfig *config); + +void nm_device_activate_schedule_ip_config_timeout (NMDevice *device, + int addr_family); + +NMDeviceIPState nm_device_activate_get_ip_state (NMDevice *self, + int addr_family); + +static inline gboolean +nm_device_activate_ip4_state_in_conf (NMDevice *self) +{ + return nm_device_activate_get_ip_state (self, AF_INET) == NM_DEVICE_IP_STATE_CONF; +} + +static inline gboolean +nm_device_activate_ip4_state_in_wait (NMDevice *self) +{ + return nm_device_activate_get_ip_state (self, AF_INET) == NM_DEVICE_IP_STATE_WAIT; +} + +static inline gboolean +nm_device_activate_ip4_state_done (NMDevice *self) +{ + return nm_device_activate_get_ip_state (self, AF_INET) == NM_DEVICE_IP_STATE_DONE; +} + +static inline gboolean +nm_device_activate_ip6_state_in_conf (NMDevice *self) +{ + return nm_device_activate_get_ip_state (self, AF_INET6) == NM_DEVICE_IP_STATE_CONF; +} + +static inline gboolean +nm_device_activate_ip6_state_in_wait (NMDevice *self) +{ + return nm_device_activate_get_ip_state (self, AF_INET6) == NM_DEVICE_IP_STATE_WAIT; +} + +static inline gboolean +nm_device_activate_ip6_state_done (NMDevice *self) +{ + return nm_device_activate_get_ip_state (self, AF_INET6) == NM_DEVICE_IP_STATE_DONE; +} void nm_device_set_dhcp_anycast_address (NMDevice *device, const char *addr); @@ -106,14 +146,24 @@ void nm_device_queue_recheck_available (NMDevice *device, NMDeviceStateReason available_reason, NMDeviceStateReason unavailable_reason); -void nm_device_set_wwan_ip4_config (NMDevice *device, NMIP4Config *config); -void nm_device_set_wwan_ip6_config (NMDevice *device, NMIP6Config *config); +void nm_device_set_dev2_ip_config (NMDevice *device, + int addr_family, + NMIPConfig *config); gboolean nm_device_hw_addr_is_explict (NMDevice *device); -void nm_device_ip_method_failed (NMDevice *self, int family, NMDeviceStateReason reason); +void nm_device_ip_method_failed (NMDevice *self, int addr_family, NMDeviceStateReason reason); + +gboolean nm_device_sysctl_ip_conf_set (NMDevice *self, + int addr_family, + const char *property, + const char *value); + +NMIP4Config *nm_device_ip4_config_new (NMDevice *self); + +NMIP6Config *nm_device_ip6_config_new (NMDevice *self); -gboolean nm_device_ipv6_sysctl_set (NMDevice *self, const char *property, const char *value); +NMIPConfig *nm_device_ip_config_new (NMDevice *self, int addr_family); /*****************************************************************************/ @@ -147,9 +197,9 @@ void nm_device_commit_mtu (NMDevice *self); ) gboolean _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name, - GError **error, const char **whitelist); + GError **error, const char *const*whitelist); #define nm_device_hash_check_invalid_keys(hash, setting_name, error, ...) \ - _nm_device_hash_check_invalid_keys (hash, setting_name, error, ((const char *[]) { __VA_ARGS__, NULL })) + _nm_device_hash_check_invalid_keys (hash, setting_name, error, NM_MAKE_STRV (__VA_ARGS__)) gboolean nm_device_match_parent (NMDevice *device, const char *parent); gboolean nm_device_match_parent_hwaddr (NMDevice *device, |