Files
NetworkManager/clients/common/nm-meta-setting-access.h
Thomas Haller b13a2b27e9 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.
2021-02-09 12:38:19 +01:00

100 lines
5.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2010 - 2017 Red Hat, Inc.
*/
#ifndef _NM_META_SETTING_ACCESS_H__
#define _NM_META_SETTING_ACCESS_H__
#include "nm-meta-setting-desc.h"
/*****************************************************************************/
NMSetting *nm_meta_setting_info_editor_new_setting(const NMMetaSettingInfoEditor *setting_info,
NMMetaAccessorSettingInitType init_type);
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_name(const char *setting_name,
gboolean use_alias);
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_gtype(GType gtype);
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_setting(NMSetting *setting);
const NMMetaPropertyInfo *
nm_meta_setting_info_editor_get_property_info(const NMMetaSettingInfoEditor *setting_info,
const char * property_name);
const NMMetaPropertyInfo *nm_meta_property_info_find_by_name(const char *setting_name,
const char *property_name);
const NMMetaPropertyInfo *nm_meta_property_info_find_by_setting(NMSetting * setting,
const char *property_name);
gboolean nm_meta_setting_info_editor_has_secrets(const NMMetaSettingInfoEditor *setting_info);
/*****************************************************************************/
const NMMetaSettingInfoEditor *const *nm_meta_setting_infos_editor_p(void);
/*****************************************************************************/
const char *nm_meta_abstract_info_get_name(const NMMetaAbstractInfo *abstract_info,
gboolean for_header);
const NMMetaAbstractInfo *const *
nm_meta_abstract_info_get_nested(const NMMetaAbstractInfo *abstract_info,
guint * out_len,
gpointer * nested_to_free);
gconstpointer nm_meta_abstract_info_get(const NMMetaAbstractInfo * abstract_info,
const NMMetaEnvironment * environment,
gpointer environment_user_data,
gpointer target,
gpointer target_data,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gboolean * out_is_default,
gpointer * out_to_free);
const char *const *nm_meta_abstract_info_complete(const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment * environment,
gpointer environment_user_data,
const NMMetaOperationContext *operation_context,
const char * text,
gboolean *out_complete_filename,
char *** out_to_free);
/*****************************************************************************/
char *nm_meta_abstract_info_get_nested_names_str(const NMMetaAbstractInfo *abstract_info,
const char * name_prefix);
char *nm_meta_abstract_infos_get_names_str(const NMMetaAbstractInfo *const *fields_array,
const char * name_prefix);
/*****************************************************************************/
typedef struct {
const NMMetaAbstractInfo *info;
const char * self_selection;
const char * sub_selection;
guint idx;
} NMMetaSelectionItem;
typedef struct {
const guint num;
const NMMetaSelectionItem items[];
} NMMetaSelectionResultList;
NMMetaSelectionResultList *
nm_meta_selection_create_all(const NMMetaAbstractInfo *const *fields_array);
NMMetaSelectionResultList *
nm_meta_selection_create_parse_one(const NMMetaAbstractInfo *const *fields_array,
const char * fields_prefix,
const char * fields_str,
gboolean validate_nested,
GError ** error);
NMMetaSelectionResultList *
nm_meta_selection_create_parse_list(const NMMetaAbstractInfo *const *fields_array,
const char * fields_str,
gboolean validate_nested,
GError ** error);
#endif /* _NM_META_SETTING_ACCESS_H__ */