diff options
| author | Michael Biebl <biebl@debian.org> | 2018-10-20 01:30:31 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-10-20 01:30:31 +0200 |
| commit | 6518e361171f64bcaaa4bf868139362ed95cc2e0 (patch) | |
| tree | d2d5b53faf80646a40ec2c0c7f2a42b3959612f5 /libnm-core/nm-setting-private.h | |
| parent | e126f3e804c35480c4f075777430419d6ece23da (diff) | |
New upstream version 1.14.2 upstream/1.14.2
Diffstat (limited to 'libnm-core/nm-setting-private.h')
| -rw-r--r-- | libnm-core/nm-setting-private.h | 130 |
1 files changed, 79 insertions, 51 deletions
diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h index 863ea9f3..1e25226e 100644 --- a/libnm-core/nm-setting-private.h +++ b/libnm-core/nm-setting-private.h @@ -31,18 +31,13 @@ #include "nm-core-internal.h" -void _nm_register_setting_impl (const char *name, - GType type, - NMSettingPriority priority); - -#define _nm_register_setting(name, priority) \ - G_STMT_START { \ - _nm_register_setting_impl ("" NM_SETTING_ ## name ## _SETTING_NAME "", g_define_type_id, priority); \ - } G_STMT_END +/*****************************************************************************/ NMSettingPriority _nm_setting_get_base_type_priority (NMSetting *setting); NMSettingPriority _nm_setting_type_get_base_type_priority (GType type); -gint _nm_setting_compare_priority (gconstpointer a, gconstpointer b); +int _nm_setting_compare_priority (gconstpointer a, gconstpointer b); + +/*****************************************************************************/ typedef enum NMSettingUpdateSecretResult { NM_SETTING_UPDATE_SECRET_ERROR = FALSE, @@ -85,10 +80,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting, */ #define NM_SETTING_PARAM_REAPPLY_IMMEDIATELY (1 << (6 + G_PARAM_USER_SHIFT)) -/* Ensure the setting's GType is registered at library load time */ -#define NM_SETTING_REGISTER_TYPE(x) \ -static void __attribute__((constructor)) register_setting (void) \ -{ g_type_ensure (x); } +#define NM_SETTING_PARAM_GENDATA_BACKED (1 << (7 + G_PARAM_USER_SHIFT)) GVariant *_nm_setting_get_deprecated_virtual_interface_name (NMSetting *setting, NMConnection *connection, @@ -115,44 +107,78 @@ NMSetting *_nm_setting_new_from_dbus (GType setting_type, NMSettingParseFlags parse_flags, GError **error); -typedef GVariant * (*NMSettingPropertyGetFunc) (NMSetting *setting, - const char *property); -typedef GVariant * (*NMSettingPropertySynthFunc) (NMSetting *setting, - NMConnection *connection, - const char *property); -typedef gboolean (*NMSettingPropertySetFunc) (NMSetting *setting, - GVariant *connection_dict, - const char *property, - GVariant *value, - NMSettingParseFlags parse_flags, - GError **error); -typedef gboolean (*NMSettingPropertyNotSetFunc) (NMSetting *setting, - GVariant *connection_dict, - const char *property, - NMSettingParseFlags parse_flags, - GError **error); - -void _nm_setting_class_add_dbus_only_property (NMSettingClass *setting_class, - const char *property_name, - const GVariantType *dbus_type, - NMSettingPropertySynthFunc synth_func, - NMSettingPropertySetFunc set_func); - -void _nm_setting_class_override_property (NMSettingClass *setting_class, - const char *property_name, - const GVariantType *dbus_type, - NMSettingPropertyGetFunc get_func, - NMSettingPropertySetFunc set_func, - NMSettingPropertyNotSetFunc not_set_func); - -typedef GVariant * (*NMSettingPropertyTransformToFunc) (const GValue *from); -typedef void (*NMSettingPropertyTransformFromFunc) (GVariant *from, GValue *to); - -void _nm_setting_class_transform_property (NMSettingClass *setting_class, - const char *property_name, - const GVariantType *dbus_type, - NMSettingPropertyTransformToFunc to_dbus, - NMSettingPropertyTransformFromFunc from_dbus); +/*****************************************************************************/ + +static inline GArray * +_nm_sett_info_property_override_create_array (void) +{ + return g_array_new (FALSE, FALSE, sizeof (NMSettInfoProperty)); +} + +GArray *_nm_sett_info_property_override_create_array_ip_config (void); + +void _nm_setting_class_commit_full (NMSettingClass *setting_class, + NMMetaSettingType meta_type, + const NMSettInfoSettDetail *detail, + GArray *properties_override); + +static inline void +_nm_setting_class_commit (NMSettingClass *setting_class, + NMMetaSettingType meta_type) +{ + _nm_setting_class_commit_full (setting_class, meta_type, NULL, NULL); +} + +#define NM_SETT_INFO_SETT_GENDATA(...) \ + ({ \ + static const NMSettInfoSettGendata _g = { \ + __VA_ARGS__ \ + }; \ + \ + &_g; \ + }) + +#define NM_SETT_INFO_SETT_DETAIL(...) \ + (&((const NMSettInfoSettDetail) { \ + __VA_ARGS__ \ + })) + +#define NM_SETT_INFO_PROPERTY(...) \ + (&((const NMSettInfoProperty) { \ + __VA_ARGS__ \ + })) + +void _properties_override_add_struct (GArray *properties_override, + const NMSettInfoProperty *prop_info); + +void _properties_override_add__helper (GArray *properties_override, + NMSettInfoProperty *prop_info); + +#define _properties_override_add(properties_override, \ + ...) \ + (_properties_override_add_struct (properties_override, \ + NM_SETT_INFO_PROPERTY (__VA_ARGS__))) + +void _properties_override_add_dbus_only (GArray *properties_override, + const char *property_name, + const GVariantType *dbus_type, + NMSettingPropertySynthFunc synth_func, + NMSettingPropertySetFunc set_func); + +void _properties_override_add_override (GArray *properties_override, + GParamSpec *param_spec, + const GVariantType *dbus_type, + NMSettingPropertyGetFunc get_func, + NMSettingPropertySetFunc set_func, + NMSettingPropertyNotSetFunc not_set_func); + +void _properties_override_add_transform (GArray *properties_override, + GParamSpec *param_spec, + const GVariantType *dbus_type, + NMSettingPropertyTransformToFunc to_dbus, + NMSettingPropertyTransformFromFunc from_dbus); + +/*****************************************************************************/ gboolean _nm_setting_use_legacy_property (NMSetting *setting, GVariant *connection_dict, @@ -161,4 +187,6 @@ gboolean _nm_setting_use_legacy_property (NMSetting *setting, GPtrArray *_nm_setting_need_secrets (NMSetting *setting); +/*****************************************************************************/ + #endif /* NM_SETTING_PRIVATE_H */ |