NetworkManager/libnm-core/nm-keyfile/nm-keyfile-utils.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

96 lines
4.3 KiB
C
Raw Permalink Normal View History

keyfile: relicense the code under LGPL-2.1+ Historically, keyfile read/write code was part of core, and thus GPL-2.0+ licensed. Keyfile is the native file format for NetworkManager connection profiles, and code to handle that should be part of libnm. This would unlock many interesting features, like tools being able to import/export connection profiles in the native file format. However, libnm is LGPL-2.1+ licensed, so this is a problem. The alternative would be to add a separate, GPL licensed library (libnm-keyfile.so or libnm-gpl.so). However that also requires a larger rework, because the current keyfile implementation uses internal API from libnm-core and it would need to be reworked to only use public API of libnm. Relicense the code instead. According to research and "keyfile-history.sh" script, the following individuals and companies possibly hold copyright on the code: <bgalvani(at)redhat.com> <blueowl(at)centrum.cz> <daniel(at)gnoutcheff.name> <danw(at)redhat.com> <dcantrell(at)redhat.com> <dcbw(at)redhat.com> <evan(at)ebroder.net> <fgiudici(at)redhat.com> <floe(at)butterbrot.org> <j(at)bootlab.org> <kmaraas(at)gnome.org> <lkundrak(at)v3.sk> <luzpaz(at)users.noreply.github.com> <martinpitt(at)gnome.org> <michael.i.doherty(at)intel.com> <pavlix(at)pavlix.net> <pmarti(at)warp.es> <rafaelff(at)gnome.org> <rstrode(at)redhat.com> <tambet(at)gmail.com> <tgraf(at)redhat.com> <thaller(at)redhat.com> <walters(at)verbum.org> <yurchor(at)ukr.net> Intel Corporation Novell, Inc. Red Hat, Inc. Ximian, Inc. Most contributors on this list agreed to relicensing according to RELICENSE.md. The following copyright holders did not answer the request for agreeing to relicensing: - <j(at)bootlab.org>: no contributions were made that are related to keyfile implementation. The script just gives a false positive. - <pmarti(at)warp.es>: the contribution is a fix of a spelling error (commit 6029288ffb18435ca7d2cde645be53cd414ae5fa). - <tgraf(at)redhat.com>: the contribution to keyfile code are small (I only identified commit 5b7503e95eb9d84935efea708b9dc326ef14d8ce). Also, Thomas worked for Red Hat at the time. After research, I think it's fair to conclude that everybody who holds non-trivial copyright on the keyfile code agreed to the relicensing.
2020-05-16 14:18:23 +02:00
/* SPDX-License-Identifier: LGPL-2.1+ */
/*
* Copyright (C) 2010 - 2015 Red Hat, Inc.
*/
#ifndef __NM_KEYFILE_UTILS_H__
#define __NM_KEYFILE_UTILS_H__
#if !((NETWORKMANAGER_COMPILATION) &NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
#error Cannot use this header.
#endif
/*****************************************************************************/
#include "nm-glib-aux/nm-shared-utils.h"
/*****************************************************************************/
#define NM_KEYFILE_GROUP_VPN_SECRETS "vpn-secrets"
#define NM_KEYFILE_GROUPPREFIX_WIREGUARD_PEER "wireguard-peer."
#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)
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);
/*****************************************************************************/
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);
void nm_keyfile_plugin_kf_set_integer_list_uint8(GKeyFile * kf,
const char * group,
const char * key,
const guint8 *list,
gsize length);
void nm_keyfile_plugin_kf_set_integer_list_uint(GKeyFile * kf,
const char * group,
const char * key,
const guint *list,
gsize length);
void nm_keyfile_plugin_kf_set_string_list(GKeyFile * kf,
const char * group,
const char * key,
const char *const *list,
gsize length);
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);
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);
char **
nm_keyfile_plugin_kf_get_keys(GKeyFile *kf, const char *group, gsize *out_length, GError **error);
gboolean
nm_keyfile_plugin_kf_has_key(GKeyFile *kf, const char *group, const char *key, GError **error);
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);
#endif /* __NM_KEYFILE_UTILS_H__ */