summaryrefslogtreecommitdiff
path: root/clients/common/nm-meta-setting-access.h
blob: ecedf499b1577ea149ba0a9d294845d25e3ab3aa (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* NetworkManager
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Copyright 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_fuzzyname (const char *setting_name, gboolean use_alias,
                                                                              gboolean fuzzy_match, gboolean *out_unique);
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,
                                                                         gboolean fuzzy_match);
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);

/*****************************************************************************/

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,
                                         NMMetaAccessorGetType get_type,
                                         NMMetaAccessorGetFlags get_flags,
                                         NMMetaAccessorGetOutFlags *out_flags,
                                         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,
                                                  char ***out_to_free);

char **nm_meta_abstract_info_get_property_names (const NMMetaAbstractInfo *abstract_info,
                                                 gpointer target,
                                                 NMMetaAccessorGetPropertyNamesFlags get_property_names_flags);

gboolean nm_meta_abstract_info_set_property (const NMMetaAbstractInfo *abstract_info,
                                             gpointer target,
                                             const char *property_name,
                                             const char *value,
                                             GError **error);

/*****************************************************************************/

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_prefix,
                                                                const char *fields_str,
                                                                gboolean validate_nested,
                                                                GError **error);

NMMetaSelectionResultList *nm_meta_selection_parse_connection_property_name (NMConnection *connection,
                                                                             const char *property_name,
                                                                             GError **error);

#endif /* _NM_META_SETTING_ACCESS_H__ */