summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-private.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-03-18 13:42:50 +0100
committerThomas Haller <thaller@redhat.com>2016-03-26 12:10:54 +0100
commit737c8cc532263149f0a6779f542ee54ee22fd6ce (patch)
treefa6461412e2e4e47b5ad37d20fb999e929010e1b /libnm-core/nm-setting-private.h
parent88655999df765373a4808089e26e441d2bfcae14 (diff)
downloadNetworkManager-737c8cc532263149f0a6779f542ee54ee22fd6ce.tar.gz
libnm-core: allow strict and relaxed error behavior for _nm_setting_new_from_dbus()
In some situations, we want strict checking of errors, for example when NetworkManager receives a new connection from a client, the connection must make sense as a whole (and since NetworkManager service is backward compatible to the clients and not the other way around, there is no excuse for sending invalid data to the server). In other situations, we want a best-effort behavior. Like when NetworkManager sends a connection to its clients, those clients want to extract as many properties as they understand, but in order to be forward compatible against newer server versions, invalid or unknown properties must be accepted. Previously, a mixture of both was done. Some issues caused a failure to create a new NMSetting, other invalid parts were just silently ignored or triggered a g_warning() in glib. Now allow for both. When doing strict-validation, be more strict and reject all unknown properties and catch when the user sets an invalid argument. On the other hand, allow for a best-effort mode that effectively cannot fail and will return a new NMSetting instance. For now, add NMSettingParseFlags so that the caller can choose the old behavior, strict parsing, or best effort. This patch doesn't have any externally visible change except that no more g_warnings will be emitted.
Diffstat (limited to 'libnm-core/nm-setting-private.h')
-rw-r--r--libnm-core/nm-setting-private.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h
index cb7ca52e3d..6560c4a296 100644
--- a/libnm-core/nm-setting-private.h
+++ b/libnm-core/nm-setting-private.h
@@ -126,6 +126,7 @@ GVariant *_nm_setting_to_dbus (NMSetting *setting,
NMSetting *_nm_setting_new_from_dbus (GType setting_type,
GVariant *setting_dict,
GVariant *connection_dict,
+ NMSettingParseFlags parse_flags,
GError **error);
typedef GVariant * (*NMSettingPropertyGetFunc) (NMSetting *setting,
@@ -133,13 +134,17 @@ typedef GVariant * (*NMSettingPropertyGetFunc) (NMSetting *setting,
typedef GVariant * (*NMSettingPropertySynthFunc) (NMSetting *setting,
NMConnection *connection,
const char *property);
-typedef void (*NMSettingPropertySetFunc) (NMSetting *setting,
+typedef gboolean (*NMSettingPropertySetFunc) (NMSetting *setting,
GVariant *connection_dict,
const char *property,
- GVariant *value);
-typedef void (*NMSettingPropertyNotSetFunc) (NMSetting *setting,
+ GVariant *value,
+ NMSettingParseFlags parse_flags,
+ GError **error);
+typedef gboolean (*NMSettingPropertyNotSetFunc) (NMSetting *setting,
GVariant *connection_dict,
- const char *property);
+ const char *property,
+ NMSettingParseFlags parse_flags,
+ GError **error);
void _nm_setting_class_add_dbus_only_property (NMSettingClass *setting_class,
const char *property_name,