device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-core / nm-keyfile-utils.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* NetworkManager system settings service
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * (C) Copyright 2010-2015 Red Hat, Inc.
19  */
20
21 #ifndef __NM_KEYFILE_UTILS_H__
22 #define __NM_KEYFILE_UTILS_H__
23
24 #include <glib.h>
25
26 #define NM_KEYFILE_GROUP_VPN_SECRETS "vpn-secrets"
27
28 const char *nm_keyfile_plugin_get_alias_for_setting_name (const char *setting_name);
29
30 const char *nm_keyfile_plugin_get_setting_name_for_alias (const char *alias);
31
32 /*********************************************************/
33
34 /* List helpers */
35 #define DEFINE_KF_LIST_WRAPPER_PROTO(stype, get_ctype, set_ctype) \
36 get_ctype nm_keyfile_plugin_kf_get_##stype##_list (GKeyFile *kf, \
37                                                    const char *group, \
38                                                    const char *key, \
39                                                    gsize *out_length, \
40                                                    GError **error); \
41 \
42 void nm_keyfile_plugin_kf_set_##stype##_list  (GKeyFile *kf, \
43                                                const char *group, \
44                                                const char *key, \
45                                                set_ctype list[], \
46                                                gsize length);
47 DEFINE_KF_LIST_WRAPPER_PROTO(integer, gint*, gint)
48 DEFINE_KF_LIST_WRAPPER_PROTO(string, gchar**, const gchar* const)
49
50 /* Single-value helpers */
51 #define DEFINE_KF_WRAPPER_PROTO(stype, get_ctype, set_ctype) \
52 get_ctype nm_keyfile_plugin_kf_get_##stype (GKeyFile *kf, \
53                                             const char *group, \
54                                             const char *key, \
55                                             GError **error); \
56 \
57 void nm_keyfile_plugin_kf_set_##stype (GKeyFile *kf, \
58                                        const char *group, \
59                                        const char *key, \
60                                        set_ctype value);
61 DEFINE_KF_WRAPPER_PROTO(string, gchar*, const gchar*)
62 DEFINE_KF_WRAPPER_PROTO(integer, gint, gint)
63 DEFINE_KF_WRAPPER_PROTO(uint64, guint64, guint64)
64 DEFINE_KF_WRAPPER_PROTO(boolean, gboolean, gboolean)
65 DEFINE_KF_WRAPPER_PROTO(value, gchar*, const gchar*)
66
67 /* Misc */
68 gchar ** nm_keyfile_plugin_kf_get_keys    (GKeyFile *kf,
69                                            const char *group,
70                                            gsize *out_length,
71                                            GError **error);
72
73 gboolean nm_keyfile_plugin_kf_has_key     (GKeyFile *kf,
74                                            const char *group,
75                                            const char *key,
76                                            GError **error);
77
78 #endif  /* __NM_KEYFILE_UTILS_H__ */
79