2019-09-10 11:19:01 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2019-09-25 13:13:40 +02:00
|
|
|
/*
|
2019-10-01 09:20:35 +02:00
|
|
|
* Copyright (C) 2010 - 2015 Red Hat, Inc.
|
2015-02-18 19:59:28 +01:00
|
|
|
*/
|
|
|
|
|
|
2015-02-18 18:59:35 +01:00
|
|
|
#ifndef __NM_KEYFILE_UTILS_H__
|
|
|
|
|
#define __NM_KEYFILE_UTILS_H__
|
2015-02-18 19:59:28 +01:00
|
|
|
|
2020-01-02 07:37:59 +01:00
|
|
|
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
|
2018-01-02 13:37:06 +01:00
|
|
|
#error Cannot use this header.
|
|
|
|
|
#endif
|
2015-02-18 19:59:28 +01:00
|
|
|
|
2020-05-05 08:23:16 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "nm-glib-aux/nm-shared-utils.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-01-30 12:36:13 +01:00
|
|
|
#define NM_KEYFILE_GROUP_VPN_SECRETS "vpn-secrets"
|
|
|
|
|
#define NM_KEYFILE_GROUPPREFIX_WIREGUARD_PEER "wireguard-peer."
|
2015-02-18 19:59:28 +01:00
|
|
|
|
2020-05-05 08:23:16 +02:00
|
|
|
#define nm_keyfile_error_is_not_found(error) \
|
|
|
|
|
nm_g_error_matches (error, \
|
|
|
|
|
G_KEY_FILE_ERROR, \
|
|
|
|
|
G_KEY_FILE_ERROR_GROUP_NOT_FOUND, \
|
|
|
|
|
G_KEY_FILE_ERROR_KEY_NOT_FOUND)
|
|
|
|
|
|
2015-02-18 19:59:28 +01:00
|
|
|
const char *nm_keyfile_plugin_get_alias_for_setting_name (const char *setting_name);
|
|
|
|
|
|
|
|
|
|
const char *nm_keyfile_plugin_get_setting_name_for_alias (const char *alias);
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2015-02-18 19:59:28 +01:00
|
|
|
|
2020-04-28 18:10:55 +02:00
|
|
|
guint *nm_keyfile_plugin_kf_get_integer_list_uint (GKeyFile *kf, const char *group, const char *key, gsize *out_length, GError **error);
|
|
|
|
|
char **nm_keyfile_plugin_kf_get_string_list (GKeyFile *kf, const char *group, const char *key, gsize *out_length, GError **error);
|
|
|
|
|
char *nm_keyfile_plugin_kf_get_string (GKeyFile *kf, const char *group, const char *key, GError **error);
|
|
|
|
|
gboolean nm_keyfile_plugin_kf_get_boolean (GKeyFile *kf, const char *group, const char *key, GError **error);
|
|
|
|
|
char *nm_keyfile_plugin_kf_get_value (GKeyFile *kf, const char *group, const char *key, GError **error);
|
2020-04-28 16:53:01 +02:00
|
|
|
|
2020-04-28 17:29:37 +02:00
|
|
|
void nm_keyfile_plugin_kf_set_integer_list_uint8 (GKeyFile *kf, const char *group, const char *key, const guint8 *list, gsize length);
|
2020-04-28 17:31:33 +02:00
|
|
|
void nm_keyfile_plugin_kf_set_integer_list_uint (GKeyFile *kf, const char *group, const char *key, const guint *list, gsize length);
|
2020-04-28 17:29:37 +02:00
|
|
|
void nm_keyfile_plugin_kf_set_string_list (GKeyFile *kf, const char *group, const char *key, const char *const*list, gsize length);
|
2020-04-28 16:53:01 +02:00
|
|
|
|
|
|
|
|
void nm_keyfile_plugin_kf_set_string (GKeyFile *kf, const char *group, const char *key, const char *value);
|
|
|
|
|
void nm_keyfile_plugin_kf_set_boolean (GKeyFile *kf, const char *group, const char *key, gboolean value);
|
|
|
|
|
void nm_keyfile_plugin_kf_set_value (GKeyFile *kf, const char *group, const char *key, const char *value);
|
|
|
|
|
|
2018-12-30 15:05:14 +01:00
|
|
|
gint64 nm_keyfile_plugin_kf_get_int64 (GKeyFile *kf,
|
|
|
|
|
const char *group,
|
|
|
|
|
const char *key,
|
|
|
|
|
guint base,
|
|
|
|
|
gint64 min,
|
|
|
|
|
gint64 max,
|
|
|
|
|
gint64 fallback,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2020-04-28 16:53:01 +02:00
|
|
|
char **nm_keyfile_plugin_kf_get_keys (GKeyFile *kf,
|
|
|
|
|
const char *group,
|
|
|
|
|
gsize *out_length,
|
|
|
|
|
GError **error);
|
2015-02-18 19:59:28 +01:00
|
|
|
|
2020-04-28 16:53:01 +02:00
|
|
|
gboolean nm_keyfile_plugin_kf_has_key (GKeyFile *kf,
|
|
|
|
|
const char *group,
|
|
|
|
|
const char *key,
|
|
|
|
|
GError **error);
|
2015-02-18 19:59:28 +01:00
|
|
|
|
2017-05-05 12:01:17 +02:00
|
|
|
const char *nm_keyfile_key_encode (const char *name,
|
|
|
|
|
char **out_to_free);
|
|
|
|
|
|
|
|
|
|
const char *nm_keyfile_key_decode (const char *key,
|
|
|
|
|
char **out_to_free);
|
|
|
|
|
|
2015-02-18 18:59:35 +01:00
|
|
|
#endif /* __NM_KEYFILE_UTILS_H__ */
|