NMVpnEditorPlugin: libnm Reference Manual

## NMVpnEditorPlugin

NMVpnEditorPlugin

## Functions

NMVpnEditorPlugin * | (*NMVpnEditorPluginFactory) ()
NMVpnEditorPlugin * | nm_vpn_editor_plugin_factory ()
NMVpnEditor * | nm_vpn_editor_plugin_get_editor ()
NMVpnEditorPluginCapability | nm_vpn_editor_plugin_get_capabilities ()
gsize | nm_vpn_editor_plugin_get_vt ()
NMConnection * | nm_vpn_editor_plugin_import ()
gboolean | nm_vpn_editor_plugin_export ()
char * | nm_vpn_editor_plugin_get_suggested_filename ()
NMVpnEditorPlugin * | nm_vpn_editor_plugin_load_from_file ()
NMVpnEditorPlugin * | nm_vpn_editor_plugin_load ()
NMVpnPluginInfo * | nm_vpn_editor_plugin_get_plugin_info ()
void | nm_vpn_editor_plugin_set_plugin_info ()

## Properties

char * | filename | Read / Write / Construct Only
GKeyFile * | keyfile | Write / Construct Only
char * | name | Read
char * | description | Read
char * | name | Read
char * | service | Read

## Signals

void | changed | Run First

## Types and Values

enum | NMVpnEditorPluginCapability
#define | NM_VPN_EDITOR_PLUGIN_NAME
#define | NM_VPN_EDITOR_PLUGIN_DESCRIPTION
#define | NM_VPN_EDITOR_PLUGIN_SERVICE
| NMVpnEditorPluginInterface
| NMVpnEditor
| NMVpnEditorPluginVT
| NMVpnPluginInfo

## Object Hierarchy

        GFlags
        ╰── NMVpnEditorPluginCapability
        GInterface
        ├── NMVpnEditor
        ╰── NMVpnEditorPlugin
        GObject
        ╰── NMVpnPluginInfo

## Prerequisites

NMVpnEditor requires GObject.

## Implemented Interfaces

NMVpnPluginInfo implements GInitable.

## Description

## Functions

### NMVpnEditorPluginFactory ()

    NMVpnEditorPlugin *
    (*NMVpnEditorPluginFactory) (GError **error);

### nm_vpn_editor_plugin_factory ()

    NMVpnEditorPlugin *
    nm_vpn_editor_plugin_factory (GError **error);

### nm_vpn_editor_plugin_get_editor ()

    NMVpnEditor *
    nm_vpn_editor_plugin_get_editor (NMVpnEditorPlugin *plugin,
                                     NMConnection *connection,
                                     GError **error);

### nm_vpn_editor_plugin_get_capabilities ()

    NMVpnEditorPluginCapability
    nm_vpn_editor_plugin_get_capabilities (NMVpnEditorPlugin *plugin);

### nm_vpn_editor_plugin_get_vt ()

    gsize
    nm_vpn_editor_plugin_get_vt (NMVpnEditorPlugin *plugin,
                                 NMVpnEditorPluginVT *vt,
                                 gsize vt_size);

### nm_vpn_editor_plugin_import ()

    NMConnection *
    nm_vpn_editor_plugin_import (NMVpnEditorPlugin *plugin,
                                 const char *path,
                                 GError **error);

### nm_vpn_editor_plugin_export ()

    gboolean
    nm_vpn_editor_plugin_export (NMVpnEditorPlugin *plugin,
                                 const char *path,
                                 NMConnection *connection,
                                 GError **error);

### nm_vpn_editor_plugin_get_suggested_filename ()

    char *
    nm_vpn_editor_plugin_get_suggested_filename
                                   (NMVpnEditorPlugin *plugin,
                                    NMConnection *connection);

### nm_vpn_editor_plugin_load_from_file ()

    NMVpnEditorPlugin *
    nm_vpn_editor_plugin_load_from_file (const char *plugin_name,
                                         const char *check_service,
                                         int check_owner,
                                         NMUtilsCheckFilePredicate check_file,
                                         gpointer user_data,
                                         GError **error);

### nm_vpn_editor_plugin_load ()

    NMVpnEditorPlugin *
    nm_vpn_editor_plugin_load (const char *plugin_name,
                               const char *check_service,
                               GError **error);

### nm_vpn_editor_plugin_get_plugin_info ()

    NMVpnPluginInfo *
    nm_vpn_editor_plugin_get_plugin_info (NMVpnEditorPlugin *plugin);

### nm_vpn_editor_plugin_set_plugin_info ()

    void
    nm_vpn_editor_plugin_set_plugin_info (NMVpnEditorPlugin *plugin,
                                          NMVpnPluginInfo *plugin_info);

## Types and Values

### enum NMVpnEditorPluginCapability

Flags that indicate certain capabilities of the plugin to editor programs.

#### Members

NM_VPN_EDITOR_PLUGIN_CAPABILITY_NONE | unknown or no capability |
NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT | the plugin can import new connections |
NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT | the plugin can export connections |
NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6 | the plugin supports IPv6 addressing |

### NM_VPN_EDITOR_PLUGIN_NAME

    #define NM_VPN_EDITOR_PLUGIN_NAME "name"

### NM_VPN_EDITOR_PLUGIN_DESCRIPTION

    #define NM_VPN_EDITOR_PLUGIN_DESCRIPTION "description"

### NM_VPN_EDITOR_PLUGIN_SERVICE

    #define NM_VPN_EDITOR_PLUGIN_SERVICE "service"

### NMVpnEditorPluginInterface

    typedef struct {
        GTypeInterface g_iface;

        NMVpnEditor *(*get_editor)(NMVpnEditorPlugin *plugin, NMConnection *connection, GError **error);

        NMVpnEditorPluginCapability (*get_capabilities)(NMVpnEditorPlugin *plugin);

        NMConnection *(*import_from_file)(NMVpnEditorPlugin *plugin, const char *path, GError **error);

        gboolean (*export_to_file)(NMVpnEditorPlugin *plugin,
                                   const char        *path,
                                   NMConnection      *connection,
                                   GError           **error);

        char *(*get_suggested_filename)(NMVpnEditorPlugin *plugin, NMConnection *connection);

        void (*notify_plugin_info_set)(NMVpnEditorPlugin *plugin, NMVpnPluginInfo *plugin_info);

        const NMVpnEditorPluginVT *(*get_vt)(NMVpnEditorPlugin *plugin, gsize *out_vt_size);
    } NMVpnEditorPluginInterface;

Interface for VPN editor plugins.

#### Members

`get_editor` () | returns an NMVpnEditor, pre-filled with values from `connection` if non-`NULL`. |
`get_capabilities` () | returns a bitmask of capabilities. |
`import_from_file` () | Try to import a connection from the specified path. On success, return a partial NMConnection object. On error, return `NULL` and set `error` with additional information. Note that `error` can be `NULL`, in which case no additional error information should be provided. |
`export_to_file` () | Export the given connection to the specified path. Return `TRUE` on success. On error, return `FALSE` and set `error` with additional error information. Note that `error` can be `NULL`, in which case no additional error information should be provided. |
`get_suggested_filename` () | For a given connection, return a suggested file name. Returned value will be `NULL` or a suggested file name to be freed by the caller. |
`notify_plugin_info_set` () | A callback to be called when the plugin info is set. |
`get_vt` () | return a virtual function table to implement further functions in the plugin, without requiring to update libnm. Used by `nm_vpn_editor_plugin_get_vt()`. |

### NMVpnEditor

    typedef struct _NMVpnEditor NMVpnEditor;

### NMVpnEditorPluginVT

    typedef struct _NMVpnEditorPluginVT NMVpnEditorPluginVT;

### NMVpnPluginInfo

    typedef struct _NMVpnPluginInfo NMVpnPluginInfo;

## Property Details

### The `“filename”` property

      “filename”                 char *

Owner: NMVpnPluginInfo

Flags: Read / Write / Construct Only

Default value: NULL

### The `“keyfile”` property

      “keyfile”                  GKeyFile *

Owner: NMVpnPluginInfo

Flags: Write / Construct Only

### The `“name”` property

      “name”                     char *

Owner: NMVpnPluginInfo

Flags: Read

Default value: NULL

### The `“description”` property

      “description”              char *

Owner: NMVpnEditorPlugin

Flags: Read

Default value: NULL

### The `“name”` property

      “name”                     char *

Owner: NMVpnEditorPlugin

Flags: Read

Default value: NULL

### The `“service”` property

      “service”                  char *

Owner: NMVpnEditorPlugin

Flags: Read

Default value: NULL

## Signal Details

### The `“changed”` signal

    void
    user_function (NMVpnEditor *nmvpneditor,
                   gpointer     user_data)

Flags: Run First