diff options
Diffstat (limited to 'src/libnm-core-impl/nm-setting-private.h')
| -rw-r--r-- | src/libnm-core-impl/nm-setting-private.h | 164 |
1 files changed, 104 insertions, 60 deletions
diff --git a/src/libnm-core-impl/nm-setting-private.h b/src/libnm-core-impl/nm-setting-private.h index 7faf5d1c..7483eaed 100644 --- a/src/libnm-core-impl/nm-setting-private.h +++ b/src/libnm-core-impl/nm-setting-private.h @@ -59,49 +59,49 @@ struct _NMSettingClass { int (*update_one_secret)(NMSetting *setting, const char *key, GVariant *value, GError **error); - gboolean (*get_secret_flags)(NMSetting * setting, - const char * secret_name, + gboolean (*get_secret_flags)(NMSetting *setting, + const char *secret_name, NMSettingSecretFlags *out_flags, - GError ** error); + GError **error); - gboolean (*set_secret_flags)(NMSetting * setting, - const char * secret_name, + gboolean (*set_secret_flags)(NMSetting *setting, + const char *secret_name, NMSettingSecretFlags flags, - GError ** error); + GError **error); gboolean (*clear_secrets)(const struct _NMSettInfoSetting *sett_info, - const NMSettInfoProperty * property_info, - NMSetting * setting, + const NMSettInfoProperty *property_info, + NMSetting *setting, NMSettingClearSecretsWithFlagsFn func, gpointer user_data); void (*padding_1)(void); void (*duplicate_copy_properties)(const struct _NMSettInfoSetting *sett_info, - NMSetting * src, - NMSetting * dst); + NMSetting *src, + NMSetting *dst); void (*enumerate_values)(const struct _NMSettInfoProperty *property_info, - NMSetting * setting, + NMSetting *setting, NMSettingValueIterFn func, gpointer user_data); gboolean (*aggregate)(NMSetting *setting, int type_i, gpointer arg); - void (*for_each_secret)(NMSetting * setting, - const char * secret_name, - GVariant * val, + void (*for_each_secret)(NMSetting *setting, + const char *secret_name, + GVariant *val, gboolean remove_non_secrets, _NMConnectionForEachSecretFunc callback, gpointer callback_data, - GVariantBuilder * setting_builder); + GVariantBuilder *setting_builder); - gboolean (*init_from_dbus)(NMSetting * setting, - GHashTable * keys, - GVariant * setting_dict, - GVariant * connection_dict, + gboolean (*init_from_dbus)(NMSetting *setting, + GHashTable *keys, + GVariant *setting_dict, + GVariant *connection_dict, guint /* NMSettingParseFlags */ parse_flags, - GError ** error); + GError **error); const struct _NMMetaSettingInfo *setting_info; }; @@ -134,18 +134,18 @@ typedef struct { GPtrArray *addresses; /* array of NMIPAddress */ GPtrArray *routes; /* array of NMIPRoute */ GPtrArray *routing_rules; - GArray * dhcp_reject_servers; - char * method; - char * gateway; - char * dhcp_hostname; - char * dhcp_iaid; + GArray *dhcp_reject_servers; + char *method; + char *gateway; + char *dhcp_hostname; + char *dhcp_iaid; gint64 route_metric; - guint dhcp_hostname_flags; - int dns_priority; - int dad_timeout; - int dhcp_timeout; - int required_timeout; + gint32 required_timeout; + gint32 dad_timeout; + gint32 dhcp_timeout; + gint32 dns_priority; guint32 route_table; + guint32 dhcp_hostname_flags; bool ignore_auto_routes; bool ignore_auto_dns; bool dhcp_send_hostname; @@ -226,7 +226,7 @@ typedef enum NMSettingUpdateSecretResult { NMSettingUpdateSecretResult _nm_setting_update_secrets(NMSetting *setting, GVariant *secrets, GError **error); -gboolean _nm_setting_clear_secrets(NMSetting * setting, +gboolean _nm_setting_clear_secrets(NMSetting *setting, NMSettingClearSecretsWithFlagsFn func, gpointer user_data); @@ -236,7 +236,7 @@ gboolean _nm_setting_clear_secrets(NMSetting * setting, /* The property of the #NMSetting should be considered during comparisons that * use the %NM_SETTING_COMPARE_FLAG_INFERRABLE flag. Properties that don't have - * this flag, are ignored when doing an infrerrable comparison. This flag should + * this flag, are ignored when doing an inferrable comparison. This flag should * be set on all properties that are read from the kernel or the system when a * connection is generated. eg, IP addresses/routes can be read from the * kernel, but the 'autoconnect' property cannot, so @@ -270,12 +270,10 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_interfac extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_i; extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u; -extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_i; -extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_u; - extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean; extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_int32; extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_uint32; +extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_int64; extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_uint64; extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_string; extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_bytes; @@ -289,16 +287,16 @@ _nm_setting_verify(NMSetting *setting, NMConnection *connection, GError **error) gboolean _nm_setting_verify_secret_string(const char *str, const char *setting_name, const char *property, - GError ** error); + GError **error); gboolean _nm_setting_aggregate(NMSetting *setting, NMConnectionAggregateType type, gpointer arg); gboolean _nm_setting_slave_type_is_valid(const char *slave_type, const char **out_port_type); -gboolean _nm_setting_compare_flags_check(const GParamSpec * param_spec, +gboolean _nm_setting_compare_flags_check(const GParamSpec *param_spec, NMSettingCompareFlags flags, - NMSetting * set_a, - NMSetting * set_b); + NMSetting *set_a, + NMSetting *set_b); NMTernary _nm_setting_property_compare_fcn_ignore(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil); @@ -306,15 +304,15 @@ NMTernary _nm_setting_property_compare_fcn_direct(_NM_SETT_INFO_PROP_COMPARE_FCN NMTernary _nm_setting_property_compare_fcn_default(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_nil); -void _nm_setting_property_get_property_direct(GObject * object, +void _nm_setting_property_get_property_direct(GObject *object, guint prop_id, - GValue * value, + GValue *value, GParamSpec *pspec); -void _nm_setting_property_set_property_direct(GObject * object, +void _nm_setting_property_set_property_direct(GObject *object, guint prop_id, const GValue *value, - GParamSpec * pspec); + GParamSpec *pspec); GVariant *_nm_setting_property_to_dbus_fcn_ignore(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_nil); @@ -337,26 +335,26 @@ gboolean _nm_setting_property_from_dbus_fcn_direct(_NM_SETT_INFO_PROP_FROM_DBUS_ gboolean _nm_setting_property_from_dbus_fcn_gprop(_NM_SETT_INFO_PROP_FROM_DBUS_FCN_ARGS _nm_nil); -GVariant *_nm_setting_to_dbus(NMSetting * setting, - NMConnection * connection, +GVariant *_nm_setting_to_dbus(NMSetting *setting, + NMConnection *connection, NMConnectionSerializationFlags flags, const NMConnectionSerializationOptions *options); NMSetting *_nm_setting_new_from_dbus(GType setting_type, - GVariant * setting_dict, - GVariant * connection_dict, + GVariant *setting_dict, + GVariant *connection_dict, NMSettingParseFlags parse_flags, - GError ** error); + GError **error); gboolean _nm_setting_property_is_regular_secret(NMSetting *setting, const char *secret_name); -gboolean _nm_setting_property_is_regular_secret_flags(NMSetting * setting, +gboolean _nm_setting_property_is_regular_secret_flags(NMSetting *setting, const char *secret_flags_name); /*****************************************************************************/ const NMSettInfoProperty * _nm_sett_info_property_lookup_by_param_spec(const NMSettInfoSetting *sett_info, - const GParamSpec * param_spec); + const GParamSpec *param_spec); static inline GArray * _nm_sett_info_property_override_create_array_sized(guint reserved_size) @@ -375,10 +373,10 @@ _nm_sett_info_property_override_create_array(void) GArray *_nm_sett_info_property_override_create_array_ip_config(int addr_family); -void _nm_setting_class_commit(NMSettingClass * setting_class, +void _nm_setting_class_commit(NMSettingClass *setting_class, NMMetaSettingType meta_type, const NMSettInfoSettDetail *detail, - GArray * properties_override, + GArray *properties_override, gint16 private_offset); #define NM_SETT_INFO_SETT_GENDATA(...) \ @@ -464,7 +462,7 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p G_STMT_START \ { \ const gboolean _default_value = (default_value); \ - GParamSpec * _param_spec; \ + GParamSpec *_param_spec; \ \ G_STATIC_ASSERT( \ !NM_FLAGS_ANY((param_flags), \ @@ -585,6 +583,52 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p /*****************************************************************************/ +#define _nm_setting_property_define_direct_int64(properties_override, \ + obj_properties, \ + prop_name, \ + prop_id, \ + min_value, \ + max_value, \ + default_value, \ + param_flags, \ + private_struct_type, \ + private_struct_field, \ + ... /* extra NMSettInfoProperty fields */) \ + G_STMT_START \ + { \ + GParamSpec *_param_spec; \ + \ + G_STATIC_ASSERT( \ + !NM_FLAGS_ANY((param_flags), \ + ~(NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE))); \ + G_STATIC_ASSERT((min_value) >= G_MININT64); \ + G_STATIC_ASSERT((min_value) <= (default_value)); \ + G_STATIC_ASSERT((default_value) <= (max_value)); \ + G_STATIC_ASSERT((max_value) <= G_MAXINT64); \ + \ + _param_spec = \ + g_param_spec_int64("" prop_name "", \ + "", \ + "", \ + (min_value), \ + (max_value), \ + (default_value), \ + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \ + \ + (obj_properties)[(prop_id)] = _param_spec; \ + \ + _nm_properties_override_gobj( \ + (properties_override), \ + _param_spec, \ + &nm_sett_info_propert_type_direct_int64, \ + .direct_offset = \ + NM_STRUCT_OFFSET_ENSURE_TYPE(gint64, private_struct_type, private_struct_field), \ + __VA_ARGS__); \ + } \ + G_STMT_END + +/*****************************************************************************/ + #define _nm_setting_property_define_direct_uint64(properties_override, \ obj_properties, \ prop_name, \ @@ -641,12 +685,12 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p ... /* extra NMSettInfoProperty fields */) \ G_STMT_START \ { \ - GParamSpec * _param_spec; \ + GParamSpec *_param_spec; \ const NMSettInfoPropertType *_property_type = (property_type); \ \ G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), \ ~(NM_SETTING_PARAM_SECRET | NM_SETTING_PARAM_FUZZY_IGNORE \ - | NM_SETTING_PARAM_INFERRABLE \ + | NM_SETTING_PARAM_INFERRABLE | NM_SETTING_PARAM_REQUIRED \ | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \ \ nm_assert(_property_type); \ @@ -890,16 +934,16 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p /*****************************************************************************/ -gboolean _nm_setting_use_legacy_property(NMSetting * setting, - GVariant * connection_dict, +gboolean _nm_setting_use_legacy_property(NMSetting *setting, + GVariant *connection_dict, const char *legacy_property, const char *new_property); GPtrArray *_nm_setting_need_secrets(NMSetting *setting); -gboolean _nm_setting_should_compare_secret_property(NMSetting * setting, - NMSetting * other, - const char * secret_name, +gboolean _nm_setting_should_compare_secret_property(NMSetting *setting, + NMSetting *other, + const char *secret_name, NMSettingCompareFlags flags); NMBridgeVlan *_nm_bridge_vlan_dup(const NMBridgeVlan *vlan); |