all: move shared/nm-meta-setting.[hc] to libnm-core and clients

"shared/nm-meta-setting.[hc]" contains meta data about settings.
As such it is similarly used by libnm-core (as internal API) and
by clients (as extension of public API of libnm). However, it must
be compiled twice, because while it defines in both cases a
NMMetaSettingInfo type, these types are different between internal and
public API.
Hence, the files must also be compiled twice (and differently), once
against libnm-core and once against the client helper library.

Previously, the file was under "shared/", but there it's a bit odd
it doesn't clearly belong anywhere.

There are two goals here:

 - copy the file to the two places where it is used. We also have
   a "check-tree" unit test that ensures those files don't diverge in
   the future.

 - we no longer require CFLAGS set during built. Instead, the sources
   should control the build. For that we have new (simple) headers
   "nm-meta-setting-base.h" that define the right behavior for the
   impl files.

There is still an ugliness (among several): the files must be named the
same for libnm-core and clients/common. Preferably, all our sources have
unique names, but that is not possible with this scheme (without
introducing other ugliness). To mitigate that, include the files only at
one exact place.
This commit is contained in:
Thomas Haller 2021-02-07 10:53:44 +01:00
parent 789347e0d6
commit b13a2b27e9
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
18 changed files with 882 additions and 71 deletions

View file

@ -1106,13 +1106,14 @@ libnm_core_lib_h_pub_mkenums = \
libnm-core/nm-core-enum-types.h \
$(NULL)
libnm_core_lib_h_priv = \
shared/nm-meta-setting.h \
libnm-core/nm-connection-private.h \
libnm-core/nm-core-internal.h \
libnm-core/nm-core-types-internal.h \
libnm-core/nm-crypto-impl.h \
libnm-core/nm-crypto.h \
libnm-core/nm-default-libnm-core.h \
libnm-core/nm-meta-setting-base-impl.h \
libnm-core/nm-meta-setting-base.h \
libnm-core/nm-property-compare.h \
libnm-core/nm-setting-private.h \
libnm-core/nm-team-utils.h \
@ -1174,11 +1175,11 @@ libnm_core_lib_c_settings_real = \
$(NULL)
libnm_core_lib_c_real = \
$(libnm_core_lib_c_settings_real) \
shared/nm-meta-setting.c \
libnm-core/nm-connection.c \
libnm-core/nm-crypto.c \
libnm-core/nm-dbus-utils.c \
libnm-core/nm-errors.c \
libnm-core/nm-meta-setting-base-impl.c \
libnm-core/nm-property-compare.c \
libnm-core/nm-setting.c \
libnm-core/nm-simple-connection.c \
@ -4608,8 +4609,9 @@ EXTRA_LTLIBRARIES += clients/common/libnmc.la
endif
clients_common_libnmc_la_SOURCES = \
shared/nm-meta-setting.c \
shared/nm-meta-setting.h \
clients/common/nm-meta-setting-base-impl.c \
clients/common/nm-meta-setting-base-impl.h \
clients/common/nm-meta-setting-base.h \
\
clients/common/nm-meta-setting-desc.c \
clients/common/nm-meta-setting-desc.h \

View file

@ -6,7 +6,6 @@
#ifndef NMC_SETTINGS_H
#define NMC_SETTINGS_H
#include "nm-meta-setting.h"
#include "nm-meta-setting-desc.h"
#include "nmcli.h"

View file

@ -61,8 +61,9 @@ endif
libnmc = static_library(
'nmc',
sources: nm_meta_setting_source + [settings_docs_source] + files(
sources: [settings_docs_source] + files(
'nm-meta-setting-access.c',
'nm-meta-setting-base-impl.c',
'nm-meta-setting-desc.c',
),
dependencies: [

View file

@ -6,7 +6,7 @@
#ifndef __NM_CLIENT_UTILS_H__
#define __NM_CLIENT_UTILS_H__
#include "nm-meta-setting.h"
#include "nm-meta-setting-desc.h"
#include "nm-active-connection.h"
#include "nm-device.h"
#include "nm-libnm-core-intern/nm-libnm-core-utils.h"

View file

@ -6,7 +6,6 @@
#ifndef _NM_META_SETTING_ACCESS_H__
#define _NM_META_SETTING_ACCESS_H__
#include "nm-meta-setting.h"
#include "nm-meta-setting-desc.h"
/*****************************************************************************/

View file

@ -5,7 +5,7 @@
#include "nm-glib-aux/nm-default-glib-i18n-lib.h"
#include "nm-meta-setting.h"
#include "nm-meta-setting-base.h"
#include "nm-setting-6lowpan.h"
#include "nm-setting-8021x.h"
@ -516,8 +516,7 @@ nm_meta_setting_infos_by_name(const char *name)
{
gssize idx;
#if NM_MORE_ASSERTS > 10
{
if (NM_MORE_ASSERTS > 10) {
guint i, j;
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
@ -545,7 +544,6 @@ nm_meta_setting_infos_by_name(const char *name)
}
}
}
#endif
G_STATIC_ASSERT_EXPR(G_STRUCT_OFFSET(NMMetaSettingInfo, setting_name) == 0);
idx = nm_utils_array_find_binary_search(nm_meta_setting_infos,
@ -561,12 +559,7 @@ nm_meta_setting_infos_by_name(const char *name)
const NMMetaSettingInfo *
nm_meta_setting_infos_by_gtype(GType gtype)
{
#if ((NETWORKMANAGER_COMPILATION) &NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
/* FIXME: we no longer define NETWORKMANAGER_COMPILATION via CFLAGS, but it's instead
* defined by our source and which files get included.
*
* For now, this code is unreachable (and we use the slower fallback). Rework how this
* works. */
#if _NM_META_SETTING_BASE_IMPL_LIBNM
nm_auto_unref_gtypeclass GTypeClass *gtypeclass_unref = NULL;
GTypeClass * gtypeclass;
NMSettingClass * klass;
@ -592,20 +585,19 @@ nm_meta_setting_infos_by_gtype(GType gtype)
out_none:
#if NM_MORE_ASSERTS > 10
{
int i;
if (NM_MORE_ASSERTS > 10) {
int i;
/* this might hint to a bug, but it would be expected for NM_TYPE_SETTING
/* this might hint to a bug, but it would be expected for NM_TYPE_SETTING
* and NM_TYPE_SETTING_IP_CONFIG.
*
* Assert that we didn't lookup for a gtype, which we would expect to find.
* An assertion failure here, hints to a bug in nm_setting_*_class_init().
*/
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++)
nm_assert(nm_meta_setting_infos[i].get_setting_gtype() != gtype);
}
#endif
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++)
nm_assert(nm_meta_setting_infos[i].get_setting_gtype() != gtype);
}
return NULL;
#else
guint i;

View file

@ -3,8 +3,8 @@
* Copyright (C) 2017 - 2018 Red Hat, Inc.
*/
#ifndef __NM_META_SETTING_H__
#define __NM_META_SETTING_H__
#ifndef __NM_META_SETTING_BASE_IMPL_H__
#define __NM_META_SETTING_BASE_IMPL_H__
#include "nm-setting-8021x.h"
@ -158,50 +158,21 @@ typedef enum {
_NM_META_SETTING_TYPE_NUM = NM_META_SETTING_TYPE_UNKNOWN,
} NMMetaSettingType;
/* this header is statically linked with both libnm-core.la and libnmc.la.
* Though, there is no stable API/ABI, so whenever on of these components
* accesses NMMetaSettingInfo or NMMetaSettingType, it only has meaning
* inside the same component.
*
* Note how NMSettingClass has field of type "struct _NMMetaSettingInfo".
* It would be a serious bug, if libnmc tries to interpret this pointer
* with the meaning of NMMetaSettingInfo. They might be different, because
* libnm.so (libnm-core.la) might be a newer version than nmcli (libnmc.la).
*
* This define helps to ensure that we don't accidentally use the pointer
* in different contexts. */
#if ((NETWORKMANAGER_COMPILATION) &NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
#define _NMMetaSettingInfoXX _NMMetaSettingInfo
#if _NM_META_SETTING_BASE_IMPL_LIBNM
#define _NMMetaSettingInfo_Alias _NMMetaSettingInfo
#else
#define _NMMetaSettingInfoXX _NMMetaSettingInfoCli
#define _NMMetaSettingInfo_Alias _NMMetaSettingInfoCli
#endif
struct _NMMetaSettingInfoXX {
struct _NMMetaSettingInfo_Alias {
const char *setting_name;
GType (*get_setting_gtype)(void);
NMMetaSettingType meta_type;
NMSettingPriority setting_priority;
};
typedef struct _NMMetaSettingInfoXX NMMetaSettingInfo;
typedef struct _NMMetaSettingInfo_Alias NMMetaSettingInfo;
/* note that we statically link nm-meta-setting.h both to libnm-core.la and
* libnmc.la. That means, there are two versions of nm_meta_setting_infos
* in nmcli. That is not easily avoidable, because at this point, we don't
* want yet to making it public API.
*
* Eventually, this should become public API of libnm, and nmcli/libnmc.la
* should use that version.
*
* Downsides of the current solution:
*
* - duplication of the array in nmcli.
*
* - there is no stable API/ABI. That means, when you have a NMMetaSettingInfo
* pointer, or a NMMetaSettingType value, the value can only be used within
* the current context (libnm-core.la or libnmc.la). In other words, libnmc.la
* (and nmcli) must never access a NMMetaSettingInfo/NMMetaSettingType value,
* that comes from libnm-core.la.
*/
extern const NMMetaSettingInfo nm_meta_setting_infos[_NM_META_SETTING_TYPE_NUM + 1];
const NMMetaSettingInfo *nm_meta_setting_infos_by_name(const char *name);
@ -213,4 +184,4 @@ NMSettingPriority nm_meta_setting_info_get_base_type_priority(const NMMetaSettin
GType gtype);
NMSettingPriority _nm_setting_type_get_base_type_priority(GType type);
#endif /* __NM_META_SETTING_H__ */
#endif /* __NM_META_SETTING_BASE_IMPL_H__ */

View file

@ -0,0 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#ifndef __NM_META_SETTING_BASE_H__
#define __NM_META_SETTING_BASE_H__
#define _NM_META_SETTING_BASE_IMPL_LIBNM 0
#include "nm-meta-setting-base-impl.h"
#endif /* __NM_META_SETTING_BASE_H__ */

View file

@ -7,7 +7,7 @@
#define __NM_META_SETTING_DESC_H__
#include "nm-glib-aux/nm-obj.h"
#include "nm-meta-setting.h"
#include "nm-meta-setting-base.h"
#include "nm-base/nm-ethtool-base.h"
struct _NMDevice;

View file

@ -181,6 +181,7 @@ libnm_core_sources = libnm_core_settings_sources + files(
'nm-crypto.c',
'nm-dbus-utils.c',
'nm-errors.c',
'nm-meta-setting-base-impl.c',
'nm-property-compare.c',
'nm-setting.c',
'nm-simple-connection.c',
@ -192,7 +193,7 @@ libnm_core_sources = libnm_core_settings_sources + files(
libnm_core = static_library(
'nm-core',
sources: libnm_core_sources + libnm_core_enum_sources + nm_meta_setting_source + [nm_version_macro_header],
sources: libnm_core_sources + libnm_core_enum_sources + [nm_version_macro_header],
include_directories: top_inc,
dependencies: [
dl_dep,

View file

@ -24,7 +24,7 @@
#include "nm-connection.h"
#include "nm-core-enum-types.h"
#include "nm-core-types-internal.h"
#include "nm-meta-setting.h"
#include "nm-meta-setting-base.h"
#include "nm-setting-6lowpan.h"
#include "nm-setting-8021x.h"
#include "nm-setting-adsl.h"

View file

@ -19,7 +19,6 @@
#include "nm-setting-8021x.h"
#include "nm-core-internal.h"
#include "nm-meta-setting.h"
/*****************************************************************************/

View file

@ -0,0 +1,641 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2017 - 2018 Red Hat, Inc.
*/
#include "nm-glib-aux/nm-default-glib-i18n-lib.h"
#include "nm-meta-setting-base.h"
#include "nm-setting-6lowpan.h"
#include "nm-setting-8021x.h"
#include "nm-setting-adsl.h"
#include "nm-setting-bluetooth.h"
#include "nm-setting-bond.h"
#include "nm-setting-bridge-port.h"
#include "nm-setting-bridge.h"
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
#include "nm-setting-dcb.h"
#include "nm-setting-dummy.h"
#include "nm-setting-ethtool.h"
#include "nm-setting-generic.h"
#include "nm-setting-gsm.h"
#include "nm-setting-hostname.h"
#include "nm-setting-infiniband.h"
#include "nm-setting-ip-config.h"
#include "nm-setting-ip-tunnel.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-macsec.h"
#include "nm-setting-macvlan.h"
#include "nm-setting-match.h"
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ovs-bridge.h"
#include "nm-setting-ovs-interface.h"
#include "nm-setting-ovs-dpdk.h"
#include "nm-setting-ovs-external-ids.h"
#include "nm-setting-ovs-patch.h"
#include "nm-setting-ovs-port.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-proxy.h"
#include "nm-setting-serial.h"
#include "nm-setting-tc-config.h"
#include "nm-setting-team-port.h"
#include "nm-setting-team.h"
#include "nm-setting-tun.h"
#include "nm-setting-user.h"
#include "nm-setting-veth.h"
#include "nm-setting-vlan.h"
#include "nm-setting-vpn.h"
#include "nm-setting-vrf.h"
#include "nm-setting-vxlan.h"
#include "nm-setting-wifi-p2p.h"
#include "nm-setting-wimax.h"
#include "nm-setting-wired.h"
#include "nm-setting-wireguard.h"
#include "nm-setting-wireless-security.h"
#include "nm-setting-wireless.h"
#include "nm-setting-wpan.h"
/*****************************************************************************/
const NMSetting8021xSchemeVtable nm_setting_8021x_scheme_vtable[] = {
#define _D(_scheme_type, ...) [(_scheme_type)] = {.scheme_type = (_scheme_type), __VA_ARGS__}
_D(NM_SETTING_802_1X_SCHEME_TYPE_UNKNOWN),
_D(NM_SETTING_802_1X_SCHEME_TYPE_CA_CERT,
.setting_key = NM_SETTING_802_1X_CA_CERT,
.scheme_func = nm_setting_802_1x_get_ca_cert_scheme,
.format_func = NULL,
.path_func = nm_setting_802_1x_get_ca_cert_path,
.blob_func = nm_setting_802_1x_get_ca_cert_blob,
.uri_func = nm_setting_802_1x_get_ca_cert_uri,
.passwd_func = nm_setting_802_1x_get_ca_cert_password,
.pwflag_func = nm_setting_802_1x_get_ca_cert_password_flags,
.set_cert_func = nm_setting_802_1x_set_ca_cert,
.file_suffix = "ca-cert", ),
_D(NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_CA_CERT,
.setting_key = NM_SETTING_802_1X_PHASE2_CA_CERT,
.scheme_func = nm_setting_802_1x_get_phase2_ca_cert_scheme,
.format_func = NULL,
.path_func = nm_setting_802_1x_get_phase2_ca_cert_path,
.blob_func = nm_setting_802_1x_get_phase2_ca_cert_blob,
.uri_func = nm_setting_802_1x_get_phase2_ca_cert_uri,
.passwd_func = nm_setting_802_1x_get_phase2_ca_cert_password,
.pwflag_func = nm_setting_802_1x_get_phase2_ca_cert_password_flags,
.set_cert_func = nm_setting_802_1x_set_phase2_ca_cert,
.file_suffix = "inner-ca-cert", ),
_D(NM_SETTING_802_1X_SCHEME_TYPE_CLIENT_CERT,
.setting_key = NM_SETTING_802_1X_CLIENT_CERT,
.scheme_func = nm_setting_802_1x_get_client_cert_scheme,
.format_func = NULL,
.path_func = nm_setting_802_1x_get_client_cert_path,
.blob_func = nm_setting_802_1x_get_client_cert_blob,
.uri_func = nm_setting_802_1x_get_client_cert_uri,
.passwd_func = nm_setting_802_1x_get_client_cert_password,
.pwflag_func = nm_setting_802_1x_get_client_cert_password_flags,
.set_cert_func = nm_setting_802_1x_set_client_cert,
.file_suffix = "client-cert", ),
_D(NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_CLIENT_CERT,
.setting_key = NM_SETTING_802_1X_PHASE2_CLIENT_CERT,
.scheme_func = nm_setting_802_1x_get_phase2_client_cert_scheme,
.format_func = NULL,
.path_func = nm_setting_802_1x_get_phase2_client_cert_path,
.blob_func = nm_setting_802_1x_get_phase2_client_cert_blob,
.uri_func = nm_setting_802_1x_get_phase2_client_cert_uri,
.passwd_func = nm_setting_802_1x_get_phase2_client_cert_password,
.pwflag_func = nm_setting_802_1x_get_phase2_client_cert_password_flags,
.set_cert_func = nm_setting_802_1x_set_phase2_client_cert,
.file_suffix = "inner-client-cert", ),
_D(NM_SETTING_802_1X_SCHEME_TYPE_PRIVATE_KEY,
.setting_key = NM_SETTING_802_1X_PRIVATE_KEY,
.scheme_func = nm_setting_802_1x_get_private_key_scheme,
.format_func = nm_setting_802_1x_get_private_key_format,
.path_func = nm_setting_802_1x_get_private_key_path,
.blob_func = nm_setting_802_1x_get_private_key_blob,
.uri_func = nm_setting_802_1x_get_private_key_uri,
.passwd_func = nm_setting_802_1x_get_private_key_password,
.pwflag_func = nm_setting_802_1x_get_private_key_password_flags,
.set_private_key_func = nm_setting_802_1x_set_private_key,
.file_suffix = "private-key",
.is_secret = TRUE, ),
_D(NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_PRIVATE_KEY,
.setting_key = NM_SETTING_802_1X_PHASE2_PRIVATE_KEY,
.scheme_func = nm_setting_802_1x_get_phase2_private_key_scheme,
.format_func = nm_setting_802_1x_get_phase2_private_key_format,
.path_func = nm_setting_802_1x_get_phase2_private_key_path,
.blob_func = nm_setting_802_1x_get_phase2_private_key_blob,
.uri_func = nm_setting_802_1x_get_phase2_private_key_uri,
.passwd_func = nm_setting_802_1x_get_phase2_private_key_password,
.pwflag_func = nm_setting_802_1x_get_phase2_private_key_password_flags,
.set_private_key_func = nm_setting_802_1x_set_phase2_private_key,
.file_suffix = "inner-private-key",
.is_secret = TRUE, ),
#undef _D
};
/*****************************************************************************/
const NMMetaSettingInfo nm_meta_setting_infos[] = {
[NM_META_SETTING_TYPE_6LOWPAN] =
{
.meta_type = NM_META_SETTING_TYPE_6LOWPAN,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_6LOWPAN_SETTING_NAME,
.get_setting_gtype = nm_setting_6lowpan_get_type,
},
[NM_META_SETTING_TYPE_802_1X] =
{
.meta_type = NM_META_SETTING_TYPE_802_1X,
.setting_priority = NM_SETTING_PRIORITY_HW_AUX,
.setting_name = NM_SETTING_802_1X_SETTING_NAME,
.get_setting_gtype = nm_setting_802_1x_get_type,
},
[NM_META_SETTING_TYPE_ADSL] =
{
.meta_type = NM_META_SETTING_TYPE_ADSL,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_ADSL_SETTING_NAME,
.get_setting_gtype = nm_setting_adsl_get_type,
},
[NM_META_SETTING_TYPE_BLUETOOTH] =
{
.meta_type = NM_META_SETTING_TYPE_BLUETOOTH,
.setting_priority = NM_SETTING_PRIORITY_HW_NON_BASE,
.setting_name = NM_SETTING_BLUETOOTH_SETTING_NAME,
.get_setting_gtype = nm_setting_bluetooth_get_type,
},
[NM_META_SETTING_TYPE_BOND] =
{
.meta_type = NM_META_SETTING_TYPE_BOND,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_BOND_SETTING_NAME,
.get_setting_gtype = nm_setting_bond_get_type,
},
[NM_META_SETTING_TYPE_BRIDGE] =
{
.meta_type = NM_META_SETTING_TYPE_BRIDGE,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_BRIDGE_SETTING_NAME,
.get_setting_gtype = nm_setting_bridge_get_type,
},
[NM_META_SETTING_TYPE_BRIDGE_PORT] =
{
.meta_type = NM_META_SETTING_TYPE_BRIDGE_PORT,
.setting_priority = NM_SETTING_PRIORITY_AUX,
.setting_name = NM_SETTING_BRIDGE_PORT_SETTING_NAME,
.get_setting_gtype = nm_setting_bridge_port_get_type,
},
[NM_META_SETTING_TYPE_CDMA] =
{
.meta_type = NM_META_SETTING_TYPE_CDMA,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_CDMA_SETTING_NAME,
.get_setting_gtype = nm_setting_cdma_get_type,
},
[NM_META_SETTING_TYPE_CONNECTION] =
{
.meta_type = NM_META_SETTING_TYPE_CONNECTION,
.setting_priority = NM_SETTING_PRIORITY_CONNECTION,
.setting_name = NM_SETTING_CONNECTION_SETTING_NAME,
.get_setting_gtype = nm_setting_connection_get_type,
},
[NM_META_SETTING_TYPE_DCB] =
{
.meta_type = NM_META_SETTING_TYPE_DCB,
.setting_priority = NM_SETTING_PRIORITY_HW_AUX,
.setting_name = NM_SETTING_DCB_SETTING_NAME,
.get_setting_gtype = nm_setting_dcb_get_type,
},
[NM_META_SETTING_TYPE_DUMMY] =
{
.meta_type = NM_META_SETTING_TYPE_DUMMY,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_DUMMY_SETTING_NAME,
.get_setting_gtype = nm_setting_dummy_get_type,
},
[NM_META_SETTING_TYPE_ETHTOOL] =
{
.meta_type = NM_META_SETTING_TYPE_ETHTOOL,
.setting_priority = NM_SETTING_PRIORITY_AUX,
.setting_name = NM_SETTING_ETHTOOL_SETTING_NAME,
.get_setting_gtype = nm_setting_ethtool_get_type,
},
[NM_META_SETTING_TYPE_GENERIC] =
{
.meta_type = NM_META_SETTING_TYPE_GENERIC,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_GENERIC_SETTING_NAME,
.get_setting_gtype = nm_setting_generic_get_type,
},
[NM_META_SETTING_TYPE_GSM] =
{
.meta_type = NM_META_SETTING_TYPE_GSM,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_GSM_SETTING_NAME,
.get_setting_gtype = nm_setting_gsm_get_type,
},
[NM_META_SETTING_TYPE_HOSTNAME] =
{
.meta_type = NM_META_SETTING_TYPE_HOSTNAME,
.setting_priority = NM_SETTING_PRIORITY_IP,
.setting_name = NM_SETTING_HOSTNAME_SETTING_NAME,
.get_setting_gtype = nm_setting_hostname_get_type,
},
[NM_META_SETTING_TYPE_INFINIBAND] =
{
.meta_type = NM_META_SETTING_TYPE_INFINIBAND,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_INFINIBAND_SETTING_NAME,
.get_setting_gtype = nm_setting_infiniband_get_type,
},
[NM_META_SETTING_TYPE_IP4_CONFIG] =
{
.meta_type = NM_META_SETTING_TYPE_IP4_CONFIG,
.setting_priority = NM_SETTING_PRIORITY_IP,
.setting_name = NM_SETTING_IP4_CONFIG_SETTING_NAME,
.get_setting_gtype = nm_setting_ip4_config_get_type,
},
[NM_META_SETTING_TYPE_IP6_CONFIG] =
{
.meta_type = NM_META_SETTING_TYPE_IP6_CONFIG,
.setting_priority = NM_SETTING_PRIORITY_IP,
.setting_name = NM_SETTING_IP6_CONFIG_SETTING_NAME,
.get_setting_gtype = nm_setting_ip6_config_get_type,
},
[NM_META_SETTING_TYPE_IP_TUNNEL] =
{
.meta_type = NM_META_SETTING_TYPE_IP_TUNNEL,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_IP_TUNNEL_SETTING_NAME,
.get_setting_gtype = nm_setting_ip_tunnel_get_type,
},
[NM_META_SETTING_TYPE_MACSEC] =
{
.meta_type = NM_META_SETTING_TYPE_MACSEC,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_MACSEC_SETTING_NAME,
.get_setting_gtype = nm_setting_macsec_get_type,
},
[NM_META_SETTING_TYPE_MACVLAN] =
{
.meta_type = NM_META_SETTING_TYPE_MACVLAN,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_MACVLAN_SETTING_NAME,
.get_setting_gtype = nm_setting_macvlan_get_type,
},
[NM_META_SETTING_TYPE_MATCH] =
{
.meta_type = NM_META_SETTING_TYPE_MATCH,
.setting_priority = NM_SETTING_PRIORITY_AUX,
.setting_name = NM_SETTING_MATCH_SETTING_NAME,
.get_setting_gtype = nm_setting_match_get_type,
},
[NM_META_SETTING_TYPE_OLPC_MESH] =
{
.meta_type = NM_META_SETTING_TYPE_OLPC_MESH,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_OLPC_MESH_SETTING_NAME,
.get_setting_gtype = nm_setting_olpc_mesh_get_type,
},
[NM_META_SETTING_TYPE_OVS_BRIDGE] =
{
.meta_type = NM_META_SETTING_TYPE_OVS_BRIDGE,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_OVS_BRIDGE_SETTING_NAME,
.get_setting_gtype = nm_setting_ovs_bridge_get_type,
},
[NM_META_SETTING_TYPE_OVS_DPDK] =
{
.meta_type = NM_META_SETTING_TYPE_OVS_DPDK,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_OVS_DPDK_SETTING_NAME,
.get_setting_gtype = nm_setting_ovs_dpdk_get_type,
},
[NM_META_SETTING_TYPE_OVS_EXTERNAL_IDS] =
{
.meta_type = NM_META_SETTING_TYPE_OVS_EXTERNAL_IDS,
.setting_priority = NM_SETTING_PRIORITY_AUX,
.setting_name = NM_SETTING_OVS_EXTERNAL_IDS_SETTING_NAME,
.get_setting_gtype = nm_setting_ovs_external_ids_get_type,
},
[NM_META_SETTING_TYPE_OVS_INTERFACE] =
{
.meta_type = NM_META_SETTING_TYPE_OVS_INTERFACE,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_OVS_INTERFACE_SETTING_NAME,
.get_setting_gtype = nm_setting_ovs_interface_get_type,
},
[NM_META_SETTING_TYPE_OVS_PATCH] =
{
.meta_type = NM_META_SETTING_TYPE_OVS_PATCH,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_OVS_PATCH_SETTING_NAME,
.get_setting_gtype = nm_setting_ovs_patch_get_type,
},
[NM_META_SETTING_TYPE_OVS_PORT] =
{
.meta_type = NM_META_SETTING_TYPE_OVS_PORT,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_OVS_PORT_SETTING_NAME,
.get_setting_gtype = nm_setting_ovs_port_get_type,
},
[NM_META_SETTING_TYPE_PPPOE] =
{
.meta_type = NM_META_SETTING_TYPE_PPPOE,
.setting_priority = NM_SETTING_PRIORITY_AUX,
.setting_name = NM_SETTING_PPPOE_SETTING_NAME,
.get_setting_gtype = nm_setting_pppoe_get_type,
},
[NM_META_SETTING_TYPE_PPP] =
{
.meta_type = NM_META_SETTING_TYPE_PPP,
.setting_priority = NM_SETTING_PRIORITY_AUX,
.setting_name = NM_SETTING_PPP_SETTING_NAME,
.get_setting_gtype = nm_setting_ppp_get_type,
},
[NM_META_SETTING_TYPE_PROXY] =
{
.meta_type = NM_META_SETTING_TYPE_PROXY,
.setting_priority = NM_SETTING_PRIORITY_IP,
.setting_name = NM_SETTING_PROXY_SETTING_NAME,
.get_setting_gtype = nm_setting_proxy_get_type,
},
[NM_META_SETTING_TYPE_SERIAL] =
{
.meta_type = NM_META_SETTING_TYPE_SERIAL,
.setting_priority = NM_SETTING_PRIORITY_HW_AUX,
.setting_name = NM_SETTING_SERIAL_SETTING_NAME,
.get_setting_gtype = nm_setting_serial_get_type,
},
[NM_META_SETTING_TYPE_SRIOV] =
{
.meta_type = NM_META_SETTING_TYPE_SRIOV,
.setting_priority = NM_SETTING_PRIORITY_HW_AUX,
.setting_name = NM_SETTING_SRIOV_SETTING_NAME,
.get_setting_gtype = nm_setting_sriov_get_type,
},
[NM_META_SETTING_TYPE_TC_CONFIG] =
{
.meta_type = NM_META_SETTING_TYPE_TC_CONFIG,
.setting_priority = NM_SETTING_PRIORITY_IP,
.setting_name = NM_SETTING_TC_CONFIG_SETTING_NAME,
.get_setting_gtype = nm_setting_tc_config_get_type,
},
[NM_META_SETTING_TYPE_TEAM] =
{
.meta_type = NM_META_SETTING_TYPE_TEAM,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_TEAM_SETTING_NAME,
.get_setting_gtype = nm_setting_team_get_type,
},
[NM_META_SETTING_TYPE_TEAM_PORT] =
{
.meta_type = NM_META_SETTING_TYPE_TEAM_PORT,
.setting_priority = NM_SETTING_PRIORITY_AUX,
.setting_name = NM_SETTING_TEAM_PORT_SETTING_NAME,
.get_setting_gtype = nm_setting_team_port_get_type,
},
[NM_META_SETTING_TYPE_TUN] =
{
.meta_type = NM_META_SETTING_TYPE_TUN,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_TUN_SETTING_NAME,
.get_setting_gtype = nm_setting_tun_get_type,
},
[NM_META_SETTING_TYPE_USER] =
{
.meta_type = NM_META_SETTING_TYPE_USER,
.setting_priority = NM_SETTING_PRIORITY_USER,
.setting_name = NM_SETTING_USER_SETTING_NAME,
.get_setting_gtype = nm_setting_user_get_type,
},
[NM_META_SETTING_TYPE_VETH] =
{
.meta_type = NM_META_SETTING_TYPE_VETH,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_VETH_SETTING_NAME,
.get_setting_gtype = nm_setting_veth_get_type,
},
[NM_META_SETTING_TYPE_VLAN] =
{
.meta_type = NM_META_SETTING_TYPE_VLAN,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_VLAN_SETTING_NAME,
.get_setting_gtype = nm_setting_vlan_get_type,
},
[NM_META_SETTING_TYPE_VPN] =
{
.meta_type = NM_META_SETTING_TYPE_VPN,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_VPN_SETTING_NAME,
.get_setting_gtype = nm_setting_vpn_get_type,
},
[NM_META_SETTING_TYPE_VRF] =
{
.meta_type = NM_META_SETTING_TYPE_VRF,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_VRF_SETTING_NAME,
.get_setting_gtype = nm_setting_vrf_get_type,
},
[NM_META_SETTING_TYPE_VXLAN] =
{
.meta_type = NM_META_SETTING_TYPE_VXLAN,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_VXLAN_SETTING_NAME,
.get_setting_gtype = nm_setting_vxlan_get_type,
},
[NM_META_SETTING_TYPE_WIFI_P2P] =
{
.meta_type = NM_META_SETTING_TYPE_WIFI_P2P,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_WIFI_P2P_SETTING_NAME,
.get_setting_gtype = nm_setting_wifi_p2p_get_type,
},
[NM_META_SETTING_TYPE_WIMAX] =
{
.meta_type = NM_META_SETTING_TYPE_WIMAX,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_WIMAX_SETTING_NAME,
.get_setting_gtype = nm_setting_wimax_get_type,
},
[NM_META_SETTING_TYPE_WIRED] =
{
.meta_type = NM_META_SETTING_TYPE_WIRED,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_WIRED_SETTING_NAME,
.get_setting_gtype = nm_setting_wired_get_type,
},
[NM_META_SETTING_TYPE_WIREGUARD] =
{
.meta_type = NM_META_SETTING_TYPE_WIREGUARD,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_WIREGUARD_SETTING_NAME,
.get_setting_gtype = nm_setting_wireguard_get_type,
},
[NM_META_SETTING_TYPE_WIRELESS] =
{
.meta_type = NM_META_SETTING_TYPE_WIRELESS,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_WIRELESS_SETTING_NAME,
.get_setting_gtype = nm_setting_wireless_get_type,
},
[NM_META_SETTING_TYPE_WIRELESS_SECURITY] =
{
.meta_type = NM_META_SETTING_TYPE_WIRELESS_SECURITY,
.setting_priority = NM_SETTING_PRIORITY_HW_AUX,
.setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
.get_setting_gtype = nm_setting_wireless_security_get_type,
},
[NM_META_SETTING_TYPE_WPAN] =
{
.meta_type = NM_META_SETTING_TYPE_WPAN,
.setting_priority = NM_SETTING_PRIORITY_HW_BASE,
.setting_name = NM_SETTING_WPAN_SETTING_NAME,
.get_setting_gtype = nm_setting_wpan_get_type,
},
[NM_META_SETTING_TYPE_UNKNOWN] =
{
.meta_type = NM_META_SETTING_TYPE_UNKNOWN,
},
};
const NMMetaSettingInfo *
nm_meta_setting_infos_by_name(const char *name)
{
gssize idx;
if (NM_MORE_ASSERTS > 10) {
guint i, j;
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
const NMMetaSettingInfo *setting_info = &nm_meta_setting_infos[i];
nm_assert(setting_info->meta_type == (NMMetaSettingType) i);
nm_assert(setting_info->setting_name);
nm_assert(setting_info->setting_name[0]);
nm_assert(setting_info->get_setting_gtype);
nm_assert(setting_info->setting_priority != NM_SETTING_PRIORITY_INVALID);
if (i > 0
&& strcmp(nm_meta_setting_infos[i - 1].setting_name, setting_info->setting_name)
>= 0) {
g_error("nm_meta_setting_infos[%u, \"%s\"] is wrongly sorted before "
"nm_meta_setting_infos[%u, \"%s\"]. Rearange NMMetaSettingType enum",
i - 1,
nm_meta_setting_infos[i - 1].setting_name,
i,
setting_info->setting_name);
}
for (j = 0; j < i; j++) {
const NMMetaSettingInfo *s = &nm_meta_setting_infos[j];
nm_assert(setting_info->get_setting_gtype != s->get_setting_gtype);
}
}
}
G_STATIC_ASSERT_EXPR(G_STRUCT_OFFSET(NMMetaSettingInfo, setting_name) == 0);
idx = nm_utils_array_find_binary_search(nm_meta_setting_infos,
sizeof(NMMetaSettingInfo),
_NM_META_SETTING_TYPE_NUM,
&name,
nm_strcmp_p_with_data,
NULL);
return idx >= 0 ? &nm_meta_setting_infos[idx] : NULL;
}
const NMMetaSettingInfo *
nm_meta_setting_infos_by_gtype(GType gtype)
{
#if _NM_META_SETTING_BASE_IMPL_LIBNM
nm_auto_unref_gtypeclass GTypeClass *gtypeclass_unref = NULL;
GTypeClass * gtypeclass;
NMSettingClass * klass;
if (!g_type_is_a(gtype, NM_TYPE_SETTING))
goto out_none;
gtypeclass = g_type_class_peek(gtype);
if (!gtypeclass)
gtypeclass = gtypeclass_unref = g_type_class_ref(gtype);
nm_assert(NM_IS_SETTING_CLASS(gtypeclass));
klass = (NMSettingClass *) gtypeclass;
if (!klass->setting_info)
goto out_none;
nm_assert(klass->setting_info->get_setting_gtype);
nm_assert(klass->setting_info->get_setting_gtype() == gtype);
return klass->setting_info;
out_none:
if (NM_MORE_ASSERTS > 10) {
int i;
/* this might hint to a bug, but it would be expected for NM_TYPE_SETTING
* and NM_TYPE_SETTING_IP_CONFIG.
*
* Assert that we didn't lookup for a gtype, which we would expect to find.
* An assertion failure here, hints to a bug in nm_setting_*_class_init().
*/
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++)
nm_assert(nm_meta_setting_infos[i].get_setting_gtype() != gtype);
}
return NULL;
#else
guint i;
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
if (nm_meta_setting_infos[i].get_setting_gtype() == gtype)
return &nm_meta_setting_infos[i];
}
return NULL;
#endif
}
/*****************************************************************************/
NMSettingPriority
nm_meta_setting_info_get_base_type_priority(const NMMetaSettingInfo *setting_info, GType gtype)
{
/* Historical oddity: PPPoE is a base-type even though it's not
* priority 1. It needs to be sorted *after* lower-level stuff like
* Wi-Fi security or 802.1x for secrets, but it's still allowed as a
* base type.
*/
if (setting_info) {
if (NM_IN_SET(setting_info->setting_priority,
NM_SETTING_PRIORITY_HW_BASE,
NM_SETTING_PRIORITY_HW_NON_BASE)
|| gtype == NM_TYPE_SETTING_PPPOE)
return setting_info->setting_priority;
}
return NM_SETTING_PRIORITY_INVALID;
}
NMSettingPriority
_nm_setting_type_get_base_type_priority(GType type)
{
return nm_meta_setting_info_get_base_type_priority(nm_meta_setting_infos_by_gtype(type), type);
}
/*****************************************************************************/

View file

@ -0,0 +1,187 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2017 - 2018 Red Hat, Inc.
*/
#ifndef __NM_META_SETTING_BASE_IMPL_H__
#define __NM_META_SETTING_BASE_IMPL_H__
#include "nm-setting-8021x.h"
/*****************************************************************************/
/*
* A setting's priority should roughly follow the OSI layer model, but it also
* controls which settings get asked for secrets first. Thus settings which
* relate to things that must be working first, like hardware, should get a
* higher priority than things which layer on top of the hardware. For example,
* the GSM/CDMA settings should provide secrets before the PPP setting does,
* because a PIN is required to unlock the device before PPP can even start.
* Even settings without secrets should be assigned the right priority.
*
* 0: reserved for invalid
*
* 1: reserved for the Connection setting
*
* 2,3: hardware-related settings like Ethernet, Wi-Fi, InfiniBand, Bridge, etc.
* These priority 1 settings are also "base types", which means that at least
* one of them is required for the connection to be valid, and their name is
* valid in the 'type' property of the Connection setting.
*
* 4: hardware-related auxiliary settings that require a base setting to be
* successful first, like Wi-Fi security, 802.1x, etc.
*
* 5: hardware-independent settings that are required before IP connectivity
* can be established, like PPP, PPPoE, etc.
*
* 6: IP-level stuff
*
* 10: NMSettingUser
*/
typedef enum { /*< skip >*/
NM_SETTING_PRIORITY_INVALID = 0,
NM_SETTING_PRIORITY_CONNECTION = 1,
NM_SETTING_PRIORITY_HW_BASE = 2,
NM_SETTING_PRIORITY_HW_NON_BASE = 3,
NM_SETTING_PRIORITY_HW_AUX = 4,
NM_SETTING_PRIORITY_AUX = 5,
NM_SETTING_PRIORITY_IP = 6,
NM_SETTING_PRIORITY_USER = 10,
} NMSettingPriority;
/*****************************************************************************/
typedef enum {
NM_SETTING_802_1X_SCHEME_TYPE_CA_CERT,
NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_CA_CERT,
NM_SETTING_802_1X_SCHEME_TYPE_CLIENT_CERT,
NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_CLIENT_CERT,
NM_SETTING_802_1X_SCHEME_TYPE_PRIVATE_KEY,
NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_PRIVATE_KEY,
NM_SETTING_802_1X_SCHEME_TYPE_UNKNOWN,
_NM_SETTING_802_1X_SCHEME_TYPE_NUM = NM_SETTING_802_1X_SCHEME_TYPE_UNKNOWN,
} NMSetting8021xSchemeType;
typedef struct {
const char *setting_key;
NMSetting8021xCKScheme (*scheme_func)(NMSetting8021x *setting);
NMSetting8021xCKFormat (*format_func)(NMSetting8021x *setting);
const char *(*path_func)(NMSetting8021x *setting);
GBytes *(*blob_func)(NMSetting8021x *setting);
const char *(*uri_func)(NMSetting8021x *setting);
const char *(*passwd_func)(NMSetting8021x *setting);
NMSettingSecretFlags (*pwflag_func)(NMSetting8021x *setting);
gboolean (*set_cert_func)(NMSetting8021x * setting,
const char * value,
NMSetting8021xCKScheme scheme,
NMSetting8021xCKFormat *out_format,
GError ** error);
gboolean (*set_private_key_func)(NMSetting8021x * setting,
const char * value,
const char * password,
NMSetting8021xCKScheme scheme,
NMSetting8021xCKFormat *out_format,
GError ** error);
const char * file_suffix;
NMSetting8021xSchemeType scheme_type;
bool is_secret : 1;
} NMSetting8021xSchemeVtable;
extern const NMSetting8021xSchemeVtable
nm_setting_8021x_scheme_vtable[_NM_SETTING_802_1X_SCHEME_TYPE_NUM + 1];
/*****************************************************************************/
typedef enum {
/* the enum (and their numeric values) are internal API. Do not assign
* any meaning the numeric values, because they already have one:
*
* they are sorted in a way, that corresponds to the asciibetical sort
* order of the corresponding setting-name. */
NM_META_SETTING_TYPE_6LOWPAN,
NM_META_SETTING_TYPE_OLPC_MESH,
NM_META_SETTING_TYPE_WIRELESS,
NM_META_SETTING_TYPE_WIRELESS_SECURITY,
NM_META_SETTING_TYPE_802_1X,
NM_META_SETTING_TYPE_WIRED,
NM_META_SETTING_TYPE_ADSL,
NM_META_SETTING_TYPE_BLUETOOTH,
NM_META_SETTING_TYPE_BOND,
NM_META_SETTING_TYPE_BRIDGE,
NM_META_SETTING_TYPE_BRIDGE_PORT,
NM_META_SETTING_TYPE_CDMA,
NM_META_SETTING_TYPE_CONNECTION,
NM_META_SETTING_TYPE_DCB,
NM_META_SETTING_TYPE_DUMMY,
NM_META_SETTING_TYPE_ETHTOOL,
NM_META_SETTING_TYPE_GENERIC,
NM_META_SETTING_TYPE_GSM,
NM_META_SETTING_TYPE_HOSTNAME,
NM_META_SETTING_TYPE_INFINIBAND,
NM_META_SETTING_TYPE_IP_TUNNEL,
NM_META_SETTING_TYPE_IP4_CONFIG,
NM_META_SETTING_TYPE_IP6_CONFIG,
NM_META_SETTING_TYPE_MACSEC,
NM_META_SETTING_TYPE_MACVLAN,
NM_META_SETTING_TYPE_MATCH,
NM_META_SETTING_TYPE_OVS_BRIDGE,
NM_META_SETTING_TYPE_OVS_DPDK,
NM_META_SETTING_TYPE_OVS_EXTERNAL_IDS,
NM_META_SETTING_TYPE_OVS_INTERFACE,
NM_META_SETTING_TYPE_OVS_PATCH,
NM_META_SETTING_TYPE_OVS_PORT,
NM_META_SETTING_TYPE_PPP,
NM_META_SETTING_TYPE_PPPOE,
NM_META_SETTING_TYPE_PROXY,
NM_META_SETTING_TYPE_SERIAL,
NM_META_SETTING_TYPE_SRIOV,
NM_META_SETTING_TYPE_TC_CONFIG,
NM_META_SETTING_TYPE_TEAM,
NM_META_SETTING_TYPE_TEAM_PORT,
NM_META_SETTING_TYPE_TUN,
NM_META_SETTING_TYPE_USER,
NM_META_SETTING_TYPE_VETH,
NM_META_SETTING_TYPE_VLAN,
NM_META_SETTING_TYPE_VPN,
NM_META_SETTING_TYPE_VRF,
NM_META_SETTING_TYPE_VXLAN,
NM_META_SETTING_TYPE_WIFI_P2P,
NM_META_SETTING_TYPE_WIMAX,
NM_META_SETTING_TYPE_WIREGUARD,
NM_META_SETTING_TYPE_WPAN,
NM_META_SETTING_TYPE_UNKNOWN,
_NM_META_SETTING_TYPE_NUM = NM_META_SETTING_TYPE_UNKNOWN,
} NMMetaSettingType;
#if _NM_META_SETTING_BASE_IMPL_LIBNM
#define _NMMetaSettingInfo_Alias _NMMetaSettingInfo
#else
#define _NMMetaSettingInfo_Alias _NMMetaSettingInfoCli
#endif
struct _NMMetaSettingInfo_Alias {
const char *setting_name;
GType (*get_setting_gtype)(void);
NMMetaSettingType meta_type;
NMSettingPriority setting_priority;
};
typedef struct _NMMetaSettingInfo_Alias NMMetaSettingInfo;
extern const NMMetaSettingInfo nm_meta_setting_infos[_NM_META_SETTING_TYPE_NUM + 1];
const NMMetaSettingInfo *nm_meta_setting_infos_by_name(const char *name);
const NMMetaSettingInfo *nm_meta_setting_infos_by_gtype(GType gtype);
/*****************************************************************************/
NMSettingPriority nm_meta_setting_info_get_base_type_priority(const NMMetaSettingInfo *setting_info,
GType gtype);
NMSettingPriority _nm_setting_type_get_base_type_priority(GType type);
#endif /* __NM_META_SETTING_BASE_IMPL_H__ */

View file

@ -0,0 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#ifndef __NM_META_SETTING_BASE_H__
#define __NM_META_SETTING_BASE_H__
#define _NM_META_SETTING_BASE_IMPL_LIBNM 1
#include "nm-meta-setting-base-impl.h"
#endif /* __NM_META_SETTING_BASE_H__ */

View file

@ -100,8 +100,6 @@ nm_version_macro_header = configure_file(
configuration: data_conf,
)
nm_meta_setting_source = files('nm-meta-setting.c')
nm_test_utils_impl_source = files('nm-test-utils-impl.c')
nm_vpn_plugin_utils_source = files('nm-utils/nm-vpn-plugin-utils.c')

View file

@ -34,7 +34,6 @@
#include "nm-utils.h"
#include "nm-core-internal.h"
#include "NetworkManagerUtils.h"
#include "nm-meta-setting.h"
#include "nm-base/nm-ethtool-base.h"
#include "nms-ifcfg-rh-common.h"

View file

@ -20,3 +20,5 @@ check_cmp() {
}
check_cmp shared/nm-base/nm-ethtool-utils-base.h libnm/nm-ethtool-utils.h
check_cmp libnm-core/nm-meta-setting-base-impl.h clients/common/nm-meta-setting-base-impl.h
check_cmp libnm-core/nm-meta-setting-base-impl.c clients/common/nm-meta-setting-base-impl.c