From 9a6dcbf895f9da01768e64b73cec88c16157d91e Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Tue, 26 Mar 2019 23:25:23 +0100 Subject: New upstream version 1.16.0 --- libnm-core/nm-utils-private.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'libnm-core/nm-utils-private.h') diff --git a/libnm-core/nm-utils-private.h b/libnm-core/nm-utils-private.h index b886730a..46af26ed 100644 --- a/libnm-core/nm-utils-private.h +++ b/libnm-core/nm-utils-private.h @@ -41,6 +41,18 @@ struct _NMVariantAttributeSpec { gboolean _nm_utils_string_slist_validate (GSList *list, const char **valid_values); +gboolean _nm_utils_secret_flags_validate (NMSettingSecretFlags secret_flags, + const char *setting_name, + const char *property_name, + NMSettingSecretFlags disallowed_flags, + GError **error); + +gboolean _nm_utils_wps_method_validate (NMSettingWirelessSecurityWpsMethod wps_method, + const char *setting_name, + const char *property_name, + gboolean wps_required, + GError **error); + /* D-Bus transform funcs */ GVariant *_nm_utils_hwaddr_cloned_get (NMSetting *setting, @@ -56,9 +68,11 @@ gboolean _nm_utils_hwaddr_cloned_not_set (NMSetting *setting, const char *property, NMSettingParseFlags parse_flags, GError **error); -GVariant * _nm_utils_hwaddr_cloned_data_synth (NMSetting *setting, +GVariant * _nm_utils_hwaddr_cloned_data_synth (const NMSettInfoSetting *sett_info, + guint property_idx, NMConnection *connection, - const char *property); + NMSetting *setting, + NMConnectionSerializationFlags flags); gboolean _nm_utils_hwaddr_cloned_data_set (NMSetting *setting, GVariant *connection_dict, const char *property, -- cgit 1.3.0-6-gf8a5 From 85563b7fc7ec2cd21e38debb9b28db342e2e8e7c Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sun, 21 Apr 2019 21:09:51 +0200 Subject: New upstream version 1.18.0 --- libnm-core/nm-utils-private.h | 80 +++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 34 deletions(-) (limited to 'libnm-core/nm-utils-private.h') diff --git a/libnm-core/nm-utils-private.h b/libnm-core/nm-utils-private.h index 46af26ed..a1a1369a 100644 --- a/libnm-core/nm-utils-private.h +++ b/libnm-core/nm-utils-private.h @@ -103,8 +103,31 @@ void _nm_utils_format_variant_attributes_full (GString *str, char key_value_separator); gboolean _nm_sriov_vf_parse_vlans (NMSriovVF *vf, const char *str, GError **error); +GVariant * _nm_utils_bridge_vlans_to_dbus (NMSetting *setting, const char *property); +gboolean _nm_utils_bridge_vlans_from_dbus (NMSetting *setting, + GVariant *connection_dict, + const char *property, + GVariant *value, + NMSettingParseFlags parse_flags, + GError **error); +gboolean _nm_utils_bridge_vlan_verify_list (GPtrArray *vlans, + gboolean check_normalizable, + GError **error, + const char *setting, + const char *property); + /* JSON to GValue conversion macros */ +static inline void +_nm_auto_unset_and_free_gvalue (GValue **ptr) +{ + if (*ptr) { + g_value_unset (*ptr); + g_free (*ptr); + } +} +#define nm_auto_unset_and_free_gvalue nm_auto(_nm_auto_unset_and_free_gvalue) + typedef struct { const char *key1; const char *key2; @@ -121,16 +144,13 @@ _nm_utils_json_extract_int (char *conf, _NMUtilsTeamPropertyKeys key, gboolean is_port) { - gs_free GValue *t_value = NULL; - int ret; + nm_auto_unset_and_free_gvalue GValue *t_value = NULL; t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port); - if (!t_value) + if ( !t_value + || !G_VALUE_HOLDS_INT (t_value)) return key.default_int; - - ret = g_value_get_int (t_value); - g_value_unset (t_value); - return ret; + return g_value_get_int (t_value); } static inline gboolean @@ -138,16 +158,13 @@ _nm_utils_json_extract_boolean (char *conf, _NMUtilsTeamPropertyKeys key, gboolean is_port) { - gs_free GValue *t_value = NULL; - gboolean ret; + nm_auto_unset_and_free_gvalue GValue *t_value = NULL; t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port); - if (!t_value) + if ( !t_value + || !G_VALUE_HOLDS_BOOLEAN (t_value)) return key.default_bool; - - ret = g_value_get_boolean (t_value); - g_value_unset (t_value); - return ret; + return g_value_get_boolean (t_value); } static inline char * @@ -155,16 +172,13 @@ _nm_utils_json_extract_string (char *conf, _NMUtilsTeamPropertyKeys key, gboolean is_port) { - gs_free GValue *t_value = NULL; - char *ret; + nm_auto_unset_and_free_gvalue GValue *t_value = NULL; t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port); - if (!t_value) + if ( !t_value + || !G_VALUE_HOLDS_STRING (t_value)) return g_strdup (key.default_str); - - ret = g_value_dup_string (t_value); - g_value_unset (t_value); - return ret; + return g_value_dup_string (t_value); } static inline char ** @@ -172,39 +186,37 @@ _nm_utils_json_extract_strv (char *conf, _NMUtilsTeamPropertyKeys key, gboolean is_port) { - gs_free GValue *t_value = NULL; - char **ret; + nm_auto_unset_and_free_gvalue GValue *t_value = NULL; t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port); - if (!t_value) + if ( !t_value + || !G_TYPE_CHECK_VALUE_TYPE (t_value, G_TYPE_STRV)) return NULL; - - ret = g_strdupv (g_value_get_boxed (t_value)); - g_value_unset (t_value); - return ret; + return g_strdupv (g_value_get_boxed (t_value)) + ?: g_new0 (char *, 1); } static inline GPtrArray * _nm_utils_json_extract_ptr_array (char *conf, - _NMUtilsTeamPropertyKeys key, - gboolean is_port) + _NMUtilsTeamPropertyKeys key, + gboolean is_port) { - gs_free GValue *t_value = NULL; + nm_auto_unset_and_free_gvalue GValue *t_value = NULL; GPtrArray *data, *ret; guint i; ret = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_team_link_watcher_unref); + t_value = _nm_utils_team_config_get (conf, key.key1, key.key2, key.key3, is_port); - if (!t_value) + if ( !t_value + || !G_TYPE_CHECK_VALUE_TYPE (t_value, G_TYPE_PTR_ARRAY)) return ret; data = g_value_get_boxed (t_value); if (!data) return ret; - for (i = 0; i < data->len; i++) g_ptr_array_add (ret, nm_team_link_watcher_dup (data->pdata[i])); - g_value_unset (t_value); return ret; } -- cgit 1.3.0-6-gf8a5