|
Packit Service |
87a54e |
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
Packit |
5756e2 |
/*
|
|
Packit |
5756e2 |
* Copyright (C) 2008 Novell, Inc.
|
|
Packit |
5756e2 |
* Copyright (C) 2008 - 2015 Red Hat, Inc.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#ifndef __NM_VPN_EDITOR_PLUGIN_H__
|
|
Packit |
5756e2 |
#define __NM_VPN_EDITOR_PLUGIN_H__
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
|
|
Packit Service |
a1bd4f |
#error "Only <NetworkManager.h> can be included directly."
|
|
Packit |
5756e2 |
#endif
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include <glib.h>
|
|
Packit |
5756e2 |
#include <glib-object.h>
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-connection.h"
|
|
Packit |
5756e2 |
#include "nm-utils.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
G_BEGIN_DECLS
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMVpnPluginInfo NMVpnPluginInfo;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMVpnEditorPlugin NMVpnEditorPlugin;
|
|
Packit Service |
a1bd4f |
typedef struct _NMVpnEditor NMVpnEditor;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* Plugin's factory function that returns a GObject that implements
|
|
Packit |
5756e2 |
* NMVpnEditorPlugin.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
#ifndef __GI_SCANNER__
|
|
Packit Service |
a1bd4f |
typedef NMVpnEditorPlugin *(*NMVpnEditorPluginFactory)(GError **error);
|
|
Packit Service |
a1bd4f |
NMVpnEditorPlugin *nm_vpn_editor_plugin_factory(GError **error);
|
|
Packit |
5756e2 |
#endif
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
/* Editor plugin interface */
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NM_TYPE_VPN_EDITOR_PLUGIN (nm_vpn_editor_plugin_get_type())
|
|
Packit Service |
a1bd4f |
#define NM_VPN_EDITOR_PLUGIN(obj) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_VPN_EDITOR_PLUGIN, NMVpnEditorPlugin))
|
|
Packit Service |
a1bd4f |
#define NM_IS_VPN_EDITOR_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_VPN_EDITOR_PLUGIN))
|
|
Packit Service |
a1bd4f |
#define NM_VPN_EDITOR_PLUGIN_GET_INTERFACE(obj) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_INSTANCE_GET_INTERFACE((obj), NM_TYPE_VPN_EDITOR_PLUGIN, NMVpnEditorPluginInterface))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* NMVpnEditorPluginCapability:
|
|
Packit |
5756e2 |
* @NM_VPN_EDITOR_PLUGIN_CAPABILITY_NONE: unknown or no capability
|
|
Packit |
5756e2 |
* @NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT: the plugin can import new connections
|
|
Packit |
5756e2 |
* @NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT: the plugin can export connections
|
|
Packit |
5756e2 |
* @NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6: the plugin supports IPv6 addressing
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Flags that indicate certain capabilities of the plugin to editor programs.
|
|
Packit |
5756e2 |
**/
|
|
Packit |
5756e2 |
typedef enum /*< flags >*/ {
|
|
Packit Service |
a1bd4f |
NM_VPN_EDITOR_PLUGIN_CAPABILITY_NONE = 0x00,
|
|
Packit Service |
a1bd4f |
NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT = 0x01,
|
|
Packit Service |
a1bd4f |
NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT = 0x02,
|
|
Packit Service |
a1bd4f |
NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6 = 0x04
|
|
Packit |
5756e2 |
} NMVpnEditorPluginCapability;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* Short display name of the VPN plugin */
|
|
Packit |
5756e2 |
#define NM_VPN_EDITOR_PLUGIN_NAME "name"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* Longer description of the VPN plugin */
|
|
Packit |
5756e2 |
#define NM_VPN_EDITOR_PLUGIN_DESCRIPTION "description"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* D-Bus service name of the plugin's VPN service */
|
|
Packit |
5756e2 |
#define NM_VPN_EDITOR_PLUGIN_SERVICE "service"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMVpnEditorPluginVT NMVpnEditorPluginVT;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* NMVpnEditorPluginInterface:
|
|
Packit |
5756e2 |
* @g_iface: the parent interface
|
|
Packit |
5756e2 |
* @get_editor: returns an #NMVpnEditor, pre-filled with values from @connection
|
|
Packit |
5756e2 |
* if non-%NULL.
|
|
Packit |
5756e2 |
* @get_capabilities: returns a bitmask of capabilities.
|
|
Packit |
5756e2 |
* @import_from_file: Try to import a connection from the specified path. On
|
|
Packit |
5756e2 |
* success, return a partial #NMConnection object. On error, return %NULL and
|
|
Packit |
5756e2 |
* set @error with additional information. Note that @error can be %NULL, in
|
|
Packit |
5756e2 |
* which case no additional error information should be provided.
|
|
Packit |
5756e2 |
* @export_to_file: Export the given connection to the specified path. Return
|
|
Packit |
5756e2 |
* %TRUE on success. On error, return %FALSE and set @error with additional
|
|
Packit |
5756e2 |
* error information. Note that @error can be %NULL, in which case no
|
|
Packit |
5756e2 |
* additional error information should be provided.
|
|
Packit |
5756e2 |
* @get_suggested_filename: For a given connection, return a suggested file
|
|
Packit |
5756e2 |
* name. Returned value will be %NULL or a suggested file name to be freed by
|
|
Packit |
5756e2 |
* the caller.
|
|
Packit |
5756e2 |
* @notify_plugin_info_set: A callback to be called when the plugin info is set.
|
|
Packit |
5756e2 |
* @get_vt: return a virtual function table to implement further functions in
|
|
Packit |
5756e2 |
* the plugin, without requiring to update libnm. Used by nm_vpn_editor_plugin_get_vt().
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Interface for VPN editor plugins.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
GTypeInterface g_iface;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMVpnEditor *(*get_editor)(NMVpnEditorPlugin *plugin, NMConnection *connection, GError **error);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMVpnEditorPluginCapability (*get_capabilities)(NMVpnEditorPlugin *plugin);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMConnection *(*import_from_file)(NMVpnEditorPlugin *plugin, const char *path, GError **error);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean (*export_to_file)(NMVpnEditorPlugin *plugin,
|
|
Packit Service |
a1bd4f |
const char * path,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
char *(*get_suggested_filename)(NMVpnEditorPlugin *plugin, NMConnection *connection);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void (*notify_plugin_info_set)(NMVpnEditorPlugin *plugin, NMVpnPluginInfo *plugin_info);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const NMVpnEditorPluginVT *(*get_vt)(NMVpnEditorPlugin *plugin, gsize *out_vt_size);
|
|
Packit |
5756e2 |
} NMVpnEditorPluginInterface;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GType nm_vpn_editor_plugin_get_type(void);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMVpnEditor *nm_vpn_editor_plugin_get_editor(NMVpnEditorPlugin *plugin,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMVpnEditorPluginCapability nm_vpn_editor_plugin_get_capabilities(NMVpnEditorPlugin *plugin);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
NM_AVAILABLE_IN_1_4
|
|
Packit Service |
a1bd4f |
gsize
|
|
Packit Service |
a1bd4f |
nm_vpn_editor_plugin_get_vt(NMVpnEditorPlugin *plugin, NMVpnEditorPluginVT *vt, gsize vt_size);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
NMConnection *
|
|
Packit Service |
a1bd4f |
nm_vpn_editor_plugin_import(NMVpnEditorPlugin *plugin, const char *path, GError **error);
|
|
Packit Service |
a1bd4f |
gboolean nm_vpn_editor_plugin_export(NMVpnEditorPlugin *plugin,
|
|
Packit Service |
a1bd4f |
const char * path,
|
|
Packit Service |
a1bd4f |
NMConnection * connection,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit Service |
a1bd4f |
char * nm_vpn_editor_plugin_get_suggested_filename(NMVpnEditorPlugin *plugin,
|
|
Packit Service |
a1bd4f |
NMConnection * connection);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
NM_AVAILABLE_IN_1_2
|
|
Packit Service |
a1bd4f |
NMVpnEditorPlugin *nm_vpn_editor_plugin_load_from_file(const char * plugin_name,
|
|
Packit Service |
a1bd4f |
const char * check_service,
|
|
Packit Service |
a1bd4f |
int check_owner,
|
|
Packit Service |
a1bd4f |
NMUtilsCheckFilePredicate check_file,
|
|
Packit Service |
a1bd4f |
gpointer user_data,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
NM_AVAILABLE_IN_1_4
|
|
Packit Service |
a1bd4f |
NMVpnEditorPlugin *
|
|
Packit Service |
a1bd4f |
nm_vpn_editor_plugin_load(const char *plugin_name, const char *check_service, GError **error);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
NM_AVAILABLE_IN_1_4
|
|
Packit Service |
a1bd4f |
NMVpnPluginInfo *nm_vpn_editor_plugin_get_plugin_info(NMVpnEditorPlugin *plugin);
|
|
Packit |
5756e2 |
NM_AVAILABLE_IN_1_4
|
|
Packit Service |
a1bd4f |
void nm_vpn_editor_plugin_set_plugin_info(NMVpnEditorPlugin *plugin, NMVpnPluginInfo *plugin_info);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-vpn-plugin-info.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
G_END_DECLS
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#endif /* __NM_VPN_EDITOR_PLUGIN_H__ */
|