1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301 USA.
18 * Copyright 2011 Red Hat, Inc.
21 #ifndef NM_SETTING_PRIVATE_H
22 #define NM_SETTING_PRIVATE_H
24 #include "nm-default.h"
26 #define NM_SETTING_SECRET_FLAGS_ALL \
27 (NM_SETTING_SECRET_FLAG_NONE | \
28 NM_SETTING_SECRET_FLAG_AGENT_OWNED | \
29 NM_SETTING_SECRET_FLAG_NOT_SAVED | \
30 NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
33 * NMSettingVerifyResult:
34 * @NM_SETTING_VERIFY_SUCCESS: the setting verifies successfully
35 * @NM_SETTING_VERIFY_ERROR: the setting has a serious misconfiguration
36 * @NM_SETTING_VERIFY_NORMALIZABLE: the setting is valid but has properties
37 * that should be normalized
38 * @NM_SETTING_VERIFY_NORMALIZABLE_ERROR: the setting is invalid but the
39 * errors can be fixed by nm_connection_normalize().
42 NM_SETTING_VERIFY_SUCCESS = TRUE,
43 NM_SETTING_VERIFY_ERROR = FALSE,
44 NM_SETTING_VERIFY_NORMALIZABLE = 2,
45 NM_SETTING_VERIFY_NORMALIZABLE_ERROR = 3,
46 } NMSettingVerifyResult;
48 void _nm_register_setting (const char *name,
50 const guint32 priority,
51 const GQuark error_quark);
53 /* Ensure, that name is a compile time constant string. Put the function name in parenthesis to suppress expansion. */
54 #define _nm_register_setting(name, type, priority, error_quark) _nm_register_setting ((name ""), type, priority, error_quark)
56 gboolean _nm_setting_is_base_type (NMSetting *setting);
57 gboolean _nm_setting_type_is_base_type (GType type);
58 guint32 _nm_setting_get_setting_priority (NMSetting *setting);
59 GType _nm_setting_lookup_setting_type (const char *name);
60 GType _nm_setting_lookup_setting_type_by_quark (GQuark error_quark);
61 gint _nm_setting_compare_priority (gconstpointer a, gconstpointer b);
63 gboolean _nm_setting_get_property (NMSetting *setting, const char *name, GValue *value);
65 typedef enum NMSettingUpdateSecretResult {
66 NM_SETTING_UPDATE_SECRET_ERROR = FALSE,
67 NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED = TRUE,
68 NM_SETTING_UPDATE_SECRET_SUCCESS_UNCHANGED = 2,
69 } NMSettingUpdateSecretResult;
71 NMSettingUpdateSecretResult _nm_setting_update_secrets (NMSetting *setting,
74 gboolean _nm_setting_clear_secrets (NMSetting *setting);
75 gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
76 NMSettingClearSecretsWithFlagsFn func,
80 /* NM_SETTING_COMPARE_FLAG_INFERRABLE: check whether a device-generated
81 * connection can be replaced by a already-defined connection. This flag only
82 * takes into account properties marked with the %NM_SETTING_PARAM_INFERRABLE
85 #define NM_SETTING_COMPARE_FLAG_INFERRABLE 0x80000000
87 /* The property of the #NMSetting should be considered during comparisons that
88 * use the %NM_SETTING_COMPARE_FLAG_INFERRABLE flag. Properties that don't have
89 * this flag, are ignored when doing an infrerrable comparison. This flag should
90 * be set on all properties that are read from the kernel or the system when a
91 * connection is generated. eg, IP addresses/routes can be read from the
92 * kernel, but the 'autoconnect' property cannot, so
93 * %NM_SETTING_IP4_CONFIG_ADDRESSES gets the INFERRABLE flag, but
94 * %NM_SETTING_CONNECTION_AUTOCONNECT would not.
96 * This flag should not be used with properties where the default cannot be
97 * read separately from the current value, like MTU or wired duplex mode.
99 #define NM_SETTING_PARAM_INFERRABLE (1 << (4 + G_PARAM_USER_SHIFT))
101 /* Ensure the setting's GType is registered at library load time */
102 #define NM_SETTING_REGISTER_TYPE(x) \
103 static void __attribute__((constructor)) register_setting (void) \
104 { nm_g_type_init (); g_type_ensure (x); }
106 NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name);
108 NMSettingVerifyResult _nm_setting_verify_deprecated_virtual_iface_name (const char *interface_name,
109 gboolean allow_missing,
110 const char *setting_name,
111 const char *setting_property,
113 gint e_invalid_property,
114 gint e_missing_property,
115 GSList *all_settings,
118 NMSettingVerifyResult _nm_setting_verify (NMSetting *setting,
119 GSList *all_settings,
122 #endif /* NM_SETTING_PRIVATE_H */