Blame libnm-core/nm-setting-private.h

Packit Service 87a54e
/* SPDX-License-Identifier: LGPL-2.1-or-later */
Packit 5756e2
/*
Packit 5756e2
 * Copyright (C) 2011 Red Hat, Inc.
Packit 5756e2
 */
Packit 5756e2
Packit 5756e2
#ifndef __NM_SETTING_PRIVATE_H__
Packit 5756e2
#define __NM_SETTING_PRIVATE_H__
Packit 5756e2
Packit Service a1bd4f
#if !((NETWORKMANAGER_COMPILATION) &NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
Packit Service a1bd4f
    #error Cannot use this header.
Packit 5756e2
#endif
Packit 5756e2
Packit 5756e2
#include "nm-setting.h"
Packit 5756e2
#include "nm-setting-bridge.h"
Packit 5756e2
#include "nm-connection.h"
Packit 5756e2
#include "nm-core-enum-types.h"
Packit 5756e2
Packit 5756e2
#include "nm-core-internal.h"
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit Service a1bd4f
NMSettingPriority _nm_setting_get_base_type_priority(NMSetting *setting);
Packit Service a1bd4f
int               _nm_setting_compare_priority(gconstpointer a, gconstpointer b);
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit Service a1bd4f
void _nm_setting_emit_property_changed(NMSetting *setting);
Packit 5756e2
Packit 5756e2
typedef enum NMSettingUpdateSecretResult {
Packit Service a1bd4f
    NM_SETTING_UPDATE_SECRET_ERROR             = FALSE,
Packit Service a1bd4f
    NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED  = TRUE,
Packit Service a1bd4f
    NM_SETTING_UPDATE_SECRET_SUCCESS_UNCHANGED = 2,
Packit 5756e2
} NMSettingUpdateSecretResult;
Packit 5756e2
Packit Service a1bd4f
NMSettingUpdateSecretResult
Packit Service a1bd4f
         _nm_setting_update_secrets(NMSetting *setting, GVariant *secrets, GError **error);
Packit Service a1bd4f
gboolean _nm_setting_clear_secrets(NMSetting *                      setting,
Packit Service a1bd4f
                                   NMSettingClearSecretsWithFlagsFn func,
Packit Service a1bd4f
                                   gpointer                         user_data);
Packit 5756e2
Packit 5756e2
/* The property of the #NMSetting should be considered during comparisons that
Packit 5756e2
 * use the %NM_SETTING_COMPARE_FLAG_INFERRABLE flag. Properties that don't have
Packit 5756e2
 * this flag, are ignored when doing an infrerrable comparison.  This flag should
Packit 5756e2
 * be set on all properties that are read from the kernel or the system when a
Packit 5756e2
 * connection is generated.  eg, IP addresses/routes can be read from the
Packit 5756e2
 * kernel, but the 'autoconnect' property cannot, so
Packit 5756e2
 * %NM_SETTING_IP4_CONFIG_ADDRESSES gets the INFERRABLE flag, but
Packit 5756e2
 * %NM_SETTING_CONNECTION_AUTOCONNECT would not.
Packit 5756e2
 *
Packit 5756e2
 * This flag should not be used with properties where the default cannot be
Packit 5756e2
 * read separately from the current value, like MTU or wired duplex mode.
Packit 5756e2
 */
Packit 5756e2
#define NM_SETTING_PARAM_INFERRABLE (1 << (4 + G_PARAM_USER_SHIFT))
Packit 5756e2
Packit 5756e2
/* This is a legacy property, which clients should not send to the daemon. */
Packit 5756e2
#define NM_SETTING_PARAM_LEGACY (1 << (5 + G_PARAM_USER_SHIFT))
Packit 5756e2
Packit 5756e2
/* When a connection is active and gets modified, usually the change
Packit 5756e2
 * to the settings-connection does not propagate automatically to the
Packit 5756e2
 * applied-connection of the device. For certain properties like the
Packit 5756e2
 * firewall zone and the metered property, this is different.
Packit 5756e2
 *
Packit 5756e2
 * Such fields can be ignored during nm_connection_compare() with the
Packit 5756e2
 * NMSettingCompareFlag NM_SETTING_COMPARE_FLAG_IGNORE_REAPPLY_IMMEDIATELY.
Packit 5756e2
 */
Packit 5756e2
#define NM_SETTING_PARAM_REAPPLY_IMMEDIATELY (1 << (6 + G_PARAM_USER_SHIFT))
Packit 5756e2
Packit 5756e2
/* property_to_dbus() should ignore the property flags, and instead always calls to_dbus_fcn()
Packit 5756e2
 */
Packit 5756e2
#define NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS (1 << (7 + G_PARAM_USER_SHIFT))
Packit 5756e2
Packit 5756e2
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_interface_name;
Packit 5756e2
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_i;
Packit 5756e2
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u;
Packit 5756e2
Packit 5756e2
extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_i;
Packit 5756e2
extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_u;
Packit 5756e2
Packit Service a1bd4f
NMSettingVerifyResult
Packit Service a1bd4f
_nm_setting_verify(NMSetting *setting, NMConnection *connection, GError **error);
Packit 5756e2
Packit Service a1bd4f
gboolean _nm_setting_verify_secret_string(const char *str,
Packit Service a1bd4f
                                          const char *setting_name,
Packit Service a1bd4f
                                          const char *property,
Packit Service a1bd4f
                                          GError **   error);
Packit 5756e2
Packit Service a1bd4f
gboolean _nm_setting_aggregate(NMSetting *setting, NMConnectionAggregateType type, gpointer arg);
Packit 5756e2
Packit Service a1bd4f
gboolean _nm_setting_slave_type_is_valid(const char *slave_type, const char **out_port_type);
Packit 5756e2
Packit Service a1bd4f
GVariant *_nm_setting_to_dbus(NMSetting *                             setting,
Packit Service a1bd4f
                              NMConnection *                          connection,
Packit Service a1bd4f
                              NMConnectionSerializationFlags          flags,
Packit Service a1bd4f
                              const NMConnectionSerializationOptions *options);
Packit 5756e2
Packit Service a1bd4f
NMSetting *_nm_setting_new_from_dbus(GType               setting_type,
Packit Service a1bd4f
                                     GVariant *          setting_dict,
Packit Service a1bd4f
                                     GVariant *          connection_dict,
Packit Service a1bd4f
                                     NMSettingParseFlags parse_flags,
Packit Service a1bd4f
                                     GError **           error);
Packit 5756e2
Packit Service a1bd4f
gboolean _nm_setting_property_is_regular_secret(NMSetting *setting, const char *secret_name);
Packit Service a1bd4f
gboolean _nm_setting_property_is_regular_secret_flags(NMSetting * setting,
Packit Service a1bd4f
                                                      const char *secret_flags_name);
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit 5756e2
static inline GArray *
Packit Service a1bd4f
_nm_sett_info_property_override_create_array(void)
Packit 5756e2
{
Packit Service a1bd4f
    return g_array_new(FALSE, FALSE, sizeof(NMSettInfoProperty));
Packit 5756e2
}
Packit 5756e2
Packit Service a1bd4f
GArray *_nm_sett_info_property_override_create_array_ip_config(void);
Packit 5756e2
Packit Service a1bd4f
void _nm_setting_class_commit_full(NMSettingClass *            setting_class,
Packit Service a1bd4f
                                   NMMetaSettingType           meta_type,
Packit Service a1bd4f
                                   const NMSettInfoSettDetail *detail,
Packit Service a1bd4f
                                   GArray *                    properties_override);
Packit 5756e2
Packit 5756e2
static inline void
Packit Service a1bd4f
_nm_setting_class_commit(NMSettingClass *setting_class, NMMetaSettingType meta_type)
Packit 5756e2
{
Packit Service a1bd4f
    _nm_setting_class_commit_full(setting_class, meta_type, NULL, NULL);
Packit 5756e2
}
Packit 5756e2
Packit Service a1bd4f
#define NM_SETT_INFO_SETT_GENDATA(...)                         \
Packit Service a1bd4f
    ({                                                         \
Packit Service a1bd4f
        static const NMSettInfoSettGendata _g = {__VA_ARGS__}; \
Packit Service a1bd4f
                                                               \
Packit Service a1bd4f
        &_;;                                                   \
Packit Service a1bd4f
    })
Packit Service a1bd4f
Packit Service a1bd4f
#define NM_SETT_INFO_SETT_DETAIL(...) (&((const NMSettInfoSettDetail){__VA_ARGS__}))
Packit Service a1bd4f
Packit Service a1bd4f
#define NM_SETT_INFO_PROPERT_TYPE(...)                         \
Packit Service a1bd4f
    ({                                                         \
Packit Service a1bd4f
        static const NMSettInfoPropertType _g = {__VA_ARGS__}; \
Packit Service a1bd4f
                                                               \
Packit Service a1bd4f
        &_;;                                                   \
Packit Service a1bd4f
    })
Packit Service a1bd4f
Packit Service a1bd4f
#define NM_SETT_INFO_PROPERTY(...) (&((const NMSettInfoProperty){__VA_ARGS__}))
Packit Service a1bd4f
Packit Service a1bd4f
gboolean _nm_properties_override_assert(const NMSettInfoProperty *prop_info);
Packit 5756e2
Packit 5756e2
static inline void
Packit Service a1bd4f
_nm_properties_override(GArray *properties_override, const NMSettInfoProperty *prop_info)
Packit 5756e2
{
Packit Service a1bd4f
    nm_assert(properties_override);
Packit Service a1bd4f
    nm_assert(_nm_properties_override_assert(prop_info));
Packit Service a1bd4f
    g_array_append_vals(properties_override, prop_info, 1);
Packit 5756e2
}
Packit 5756e2
Packit 5756e2
#define _nm_properties_override_gobj(properties_override, p_param_spec, p_property_type) \
Packit Service a1bd4f
    _nm_properties_override(                                                             \
Packit Service a1bd4f
        (properties_override),                                                           \
Packit Service a1bd4f
        NM_SETT_INFO_PROPERTY(.param_spec = (p_param_spec), .property_type = (p_property_type), ))
Packit 5756e2
Packit 5756e2
#define _nm_properties_override_dbus(properties_override, p_name, p_property_type) \
Packit Service a1bd4f
    _nm_properties_override(                                                       \
Packit Service a1bd4f
        (properties_override),                                                     \
Packit Service a1bd4f
        NM_SETT_INFO_PROPERTY(.name = ("" p_name ""), .property_type = (p_property_type), ))
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit Service a1bd4f
gboolean _nm_setting_use_legacy_property(NMSetting * setting,
Packit Service a1bd4f
                                         GVariant *  connection_dict,
Packit Service a1bd4f
                                         const char *legacy_property,
Packit Service a1bd4f
                                         const char *new_property);
Packit 5756e2
Packit Service a1bd4f
GPtrArray *_nm_setting_need_secrets(NMSetting *setting);
Packit 5756e2
Packit Service a1bd4f
gboolean _nm_setting_should_compare_secret_property(NMSetting *           setting,
Packit Service a1bd4f
                                                    NMSetting *           other,
Packit Service a1bd4f
                                                    const char *          secret_name,
Packit Service a1bd4f
                                                    NMSettingCompareFlags flags);
Packit 5756e2
Packit Service a1bd4f
NMBridgeVlan *_nm_bridge_vlan_dup(const NMBridgeVlan *vlan);
Packit Service a1bd4f
NMBridgeVlan *_nm_bridge_vlan_dup_and_seal(const NMBridgeVlan *vlan);
Packit 5756e2
Packit 5756e2
/*****************************************************************************/
Packit 5756e2
Packit Service a1bd4f
#endif /* NM_SETTING_PRIVATE_H */