|
Packit Service |
a1bd4f |
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
Packit |
5756e2 |
/*
|
|
Packit |
5756e2 |
* Copyright (C) 2007 - 2018 Red Hat, Inc.
|
|
Packit |
5756e2 |
* Copyright (C) 2008 Novell, Inc.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#ifndef __NM_SETTINGS_PLUGIN_H__
|
|
Packit |
5756e2 |
#define __NM_SETTINGS_PLUGIN_H__
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-connection.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-settings-storage.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMSettingsPlugin NMSettingsPlugin;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
typedef void (*NMSettingsPluginConnectionLoadCallback)(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage *storage,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
gpointer user_data);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
const char *filename;
|
|
Packit Service |
a1bd4f |
GError * error;
|
|
Packit Service |
a1bd4f |
bool handled : 1;
|
|
Packit |
5756e2 |
} NMSettingsPluginConnectionLoadEntry;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NM_TYPE_SETTINGS_PLUGIN (nm_settings_plugin_get_type())
|
|
Packit Service |
a1bd4f |
#define NM_SETTINGS_PLUGIN(obj) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTINGS_PLUGIN, NMSettingsPlugin))
|
|
Packit Service |
a1bd4f |
#define NM_SETTINGS_PLUGIN_CLASS(klass) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTINGS_PLUGIN, NMSettingsPluginClass))
|
|
Packit Service |
a1bd4f |
#define NM_IS_SETTINGS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTINGS_PLUGIN))
|
|
Packit Service |
a1bd4f |
#define NM_IS_SETTINGS_PLUGIN_CLASS(klass) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTINGS_PLUGIN))
|
|
Packit Service |
a1bd4f |
#define NM_SETTINGS_PLUGIN_GET_CLASS(obj) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTINGS_PLUGIN, NMSettingsPluginClass))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED "unmanaged-specs-changed"
|
|
Packit |
5756e2 |
#define NM_SETTINGS_PLUGIN_UNRECOGNIZED_SPECS_CHANGED "unrecognized-specs-changed"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMSettingsPlugin {
|
|
Packit Service |
a1bd4f |
GObject parent;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
GObjectClass parent;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/*
|
|
Packit Service |
a1bd4f |
* Return a string list of specifications of devices which NetworkManager
|
|
Packit Service |
a1bd4f |
* should not manage. Returned list will be freed by the system settings
|
|
Packit Service |
a1bd4f |
* service, and each element must be allocated using g_malloc() or its
|
|
Packit Service |
a1bd4f |
* variants (g_strdup, g_strdup_printf, etc).
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Each string in the list must be in one of the formats recognized by
|
|
Packit Service |
a1bd4f |
* nm_device_spec_match_list().
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
GSList *(*get_unmanaged_specs)(NMSettingsPlugin *self);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/*
|
|
Packit Service |
a1bd4f |
* Return a string list of specifications of devices for which at least
|
|
Packit Service |
a1bd4f |
* one non-NetworkManager-based configuration is defined. Returned list
|
|
Packit Service |
a1bd4f |
* will be freed by the system settings service, and each element must be
|
|
Packit Service |
a1bd4f |
* allocated using g_malloc() or its variants (g_strdup, g_strdup_printf,
|
|
Packit Service |
a1bd4f |
* etc).
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Each string in the list must be in one of the formats recognized by
|
|
Packit Service |
a1bd4f |
* nm_device_spec_match_list().
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
GSList *(*get_unrecognized_specs)(NMSettingsPlugin *self);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* Requests that the plugin load/reload a set of filenames.
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
void (*load_connections)(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsPluginConnectionLoadEntry * entries,
|
|
Packit Service |
a1bd4f |
gsize n_entries,
|
|
Packit Service |
a1bd4f |
NMSettingsPluginConnectionLoadCallback callback,
|
|
Packit Service |
a1bd4f |
gpointer user_data);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* Requests that the plugin reload all connection files from disk,
|
|
Packit Service |
a1bd4f |
* and emit signals reflecting new, changed, and removed connections.
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
void (*reload_connections)(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsPluginConnectionLoadCallback callback,
|
|
Packit Service |
a1bd4f |
gpointer user_data);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
void (*load_connections_done)(NMSettingsPlugin *self);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
gboolean (*add_connection)(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage **out_storage,
|
|
Packit Service |
a1bd4f |
NMConnection ** out_connection,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
gboolean (*update_connection)(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage * storage,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage **out_storage,
|
|
Packit Service |
a1bd4f |
NMConnection ** out_connection,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
gboolean (*delete_connection)(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage *storage,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
const char *plugin_name;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
} NMSettingsPluginClass;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GType nm_settings_plugin_get_type(void);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NM_SETTINGS_STORAGE_PRINT_FMT NM_HASH_OBFUSCATE_PTR_FMT "/%s"
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NM_SETTINGS_STORAGE_PRINT_ARG(storage) \
|
|
Packit Service |
a1bd4f |
NM_HASH_OBFUSCATE_PTR(storage), \
|
|
Packit Service |
a1bd4f |
nm_settings_plugin_get_plugin_name(nm_settings_storage_get_plugin(storage))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static inline const char *
|
|
Packit Service |
a1bd4f |
nm_settings_plugin_get_plugin_name(NMSettingsPlugin *self)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NMSettingsPluginClass *klass;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
nm_assert(NM_SETTINGS_PLUGIN(self));
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
klass = NM_SETTINGS_PLUGIN_GET_CLASS(self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
nm_assert(klass && klass->plugin_name && strlen(klass->plugin_name) > 0);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
return klass->plugin_name;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GSList *nm_settings_plugin_get_unmanaged_specs(NMSettingsPlugin *self);
|
|
Packit Service |
a1bd4f |
GSList *nm_settings_plugin_get_unrecognized_specs(NMSettingsPlugin *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nm_settings_plugin_reload_connections(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsPluginConnectionLoadCallback callback,
|
|
Packit Service |
a1bd4f |
gpointer user_data);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMSettingsPluginConnectionLoadEntry *
|
|
Packit Service |
a1bd4f |
nm_settings_plugin_create_connection_load_entries(const char *const *filenames, gsize *out_len);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nm_settings_plugin_load_connections(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsPluginConnectionLoadEntry * entries,
|
|
Packit Service |
a1bd4f |
gsize n_entries,
|
|
Packit Service |
a1bd4f |
NMSettingsPluginConnectionLoadCallback callback,
|
|
Packit Service |
a1bd4f |
gpointer user_data);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nm_settings_plugin_load_connections_done(NMSettingsPlugin *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean nm_settings_plugin_add_connection(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage **out_storage,
|
|
Packit Service |
a1bd4f |
NMConnection ** out_connection,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean nm_settings_plugin_update_connection(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage * storage,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage **out_storage,
|
|
Packit Service |
a1bd4f |
NMConnection ** out_connection,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean nm_settings_plugin_delete_connection(NMSettingsPlugin * self,
|
|
Packit Service |
a1bd4f |
NMSettingsStorage *storage,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
typedef NMSettingsPlugin *(*NMSettingsPluginFactoryFunc)(void);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMSettingsPlugin *nm_settings_plugin_factory(void);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************
|
|
Packit |
5756e2 |
* Internal API
|
|
Packit |
5756e2 |
*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_settings_plugin_emit_signal_unmanaged_specs_changed(NMSettingsPlugin *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_settings_plugin_emit_signal_unrecognized_specs_changed(NMSettingsPlugin *self);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
int nm_settings_plugin_cmp_by_priority(const NMSettingsPlugin *a,
|
|
Packit Service |
a1bd4f |
const NMSettingsPlugin *b,
|
|
Packit Service |
a1bd4f |
const GSList * plugin_list);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* forward declare this function from NMSettings. It's used by the ifcfg-rh plugin,
|
|
Packit |
5756e2 |
* but that shouldn't include all "nm-settings.h" header. */
|
|
Packit Service |
a1bd4f |
NMSettings *nm_settings_get(void);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const char *nm_settings_get_dbus_path_for_uuid(NMSettings *self, const char *uuid);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#endif /* __NM_SETTINGS_PLUGIN_H__ */
|