summaryrefslogtreecommitdiff
path: root/clients/common/nm-meta-setting-access.h
blob: 8dbd45dd2dfb32cffb6f66a8008e807232392726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* 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.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__ */