mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
libnm-core: add vpn.timeout property for establishing connections
[1] https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00007.html
This commit is contained in:
parent
5d36910d16
commit
ffe16c958f
|
@ -80,6 +80,9 @@ typedef struct {
|
|||
* freed with g_free(). Should contain secrets only.
|
||||
*/
|
||||
GHashTable *secrets;
|
||||
|
||||
/* Timeout for the VPN service to establish the connection */
|
||||
guint32 timeout;
|
||||
} NMSettingVpnPrivate;
|
||||
|
||||
enum {
|
||||
|
@ -89,6 +92,7 @@ enum {
|
|||
PROP_PERSISTENT,
|
||||
PROP_DATA,
|
||||
PROP_SECRETS,
|
||||
PROP_TIMEOUT,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
@ -387,6 +391,22 @@ nm_setting_vpn_foreach_secret (NMSettingVpn *setting,
|
|||
foreach_item_helper (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, func, user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_vpn_get_timeout:
|
||||
* @setting: the #NMSettingVpn
|
||||
*
|
||||
* Returns: the #NMSettingVpn:timeout property of the setting
|
||||
*
|
||||
* Since: 1.2
|
||||
**/
|
||||
guint32
|
||||
nm_setting_vpn_get_timeout (NMSettingVpn *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_VPN (setting), 0);
|
||||
|
||||
return NM_SETTING_VPN_GET_PRIVATE (setting)->timeout;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify (NMSetting *setting, NMConnection *connection, GError **error)
|
||||
{
|
||||
|
@ -753,6 +773,9 @@ set_property (GObject *object, guint prop_id,
|
|||
g_hash_table_unref (priv->secrets);
|
||||
priv->secrets = _nm_utils_copy_strdict (g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_TIMEOUT:
|
||||
priv->timeout = g_value_get_uint (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -782,6 +805,9 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_SECRETS:
|
||||
g_value_take_boxed (value, _nm_utils_copy_strdict (priv->secrets));
|
||||
break;
|
||||
case PROP_TIMEOUT:
|
||||
g_value_set_uint (value, nm_setting_vpn_get_timeout (setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -909,4 +935,22 @@ nm_setting_vpn_class_init (NMSettingVpnClass *setting_class)
|
|||
G_VARIANT_TYPE ("a{ss}"),
|
||||
_nm_utils_strdict_to_dbus,
|
||||
_nm_utils_strdict_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSettingVpn:timeout:
|
||||
*
|
||||
* Timeout for the VPN service to establish the connection. Some services
|
||||
* may take quite a long time to connect.
|
||||
* Value of 0 means a default timeout, which is 60 seconds (unless overriden
|
||||
* by vpn.timeout in configuration file). Values greater than zero mean
|
||||
* timeout in seconds.
|
||||
*
|
||||
* Since: 1.2
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_TIMEOUT,
|
||||
g_param_spec_uint (NM_SETTING_VPN_TIMEOUT, "", "",
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ G_BEGIN_DECLS
|
|||
#define NM_SETTING_VPN_PERSISTENT "persistent"
|
||||
#define NM_SETTING_VPN_DATA "data"
|
||||
#define NM_SETTING_VPN_SECRETS "secrets"
|
||||
#define NM_SETTING_VPN_TIMEOUT "timeout"
|
||||
|
||||
struct _NMSettingVpn {
|
||||
NMSetting parent;
|
||||
|
@ -96,6 +97,8 @@ gboolean nm_setting_vpn_remove_secret (NMSettingVpn *setting,
|
|||
void nm_setting_vpn_foreach_secret (NMSettingVpn *setting,
|
||||
NMVpnIterFunc func,
|
||||
gpointer user_data);
|
||||
NM_AVAILABLE_IN_1_2
|
||||
guint32 nm_setting_vpn_get_timeout (NMSettingVpn *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -876,6 +876,7 @@ global:
|
|||
nm_setting_ip_config_has_dns_options;
|
||||
nm_setting_ip_config_remove_dns_option;
|
||||
nm_setting_ip_config_remove_dns_option_by_value;
|
||||
nm_setting_vpn_get_timeout;
|
||||
nm_setting_wired_get_wake_on_lan;
|
||||
nm_setting_wired_get_wake_on_lan_password;
|
||||
nm_setting_wired_wake_on_lan_get_type;
|
||||
|
|
Loading…
Reference in a new issue