1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301 USA.
18 * Copyright 2007 - 2008 Novell, Inc.
19 * Copyright 2007 - 2013 Red Hat, Inc.
22 #ifndef NM_VPN_PLUGIN_H
23 #define NM_VPN_PLUGIN_H
26 #include <glib-object.h>
27 #include <dbus/dbus-glib.h>
28 #include <NetworkManagerVPN.h>
29 #include <nm-connection.h>
33 #define NM_TYPE_VPN_PLUGIN (nm_vpn_plugin_get_type ())
34 #define NM_VPN_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_PLUGIN, NMVPNPlugin))
35 #define NM_VPN_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_VPN_PLUGIN, NMVPNPluginClass))
36 #define NM_IS_VPN_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_VPN_PLUGIN))
37 #define NM_IS_VPN_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_VPN_PLUGIN))
38 #define NM_VPN_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_VPN_PLUGIN, NMVPNPluginClass))
40 #define NM_VPN_PLUGIN_DBUS_SERVICE_NAME "service-name"
41 #define NM_VPN_PLUGIN_STATE "state"
45 * @NM_VPN_PLUGIN_ERROR_GENERAL: general failure
46 * @NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS: the plugin is already starting,
47 * and another connect request was received
48 * @NM_VPN_PLUGIN_ERROR_ALREADY_STARTED: the plugin is already connected, and
49 * another connect request was received
50 * @NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS: the plugin is already stopping,
51 * and another stop request was received
52 * @NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED: the plugin is already stopped, and
53 * another disconnect request was received
54 * @NM_VPN_PLUGIN_ERROR_WRONG_STATE: the operation could not be performed in
56 * @NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS: the operation could not be performed as
57 * the request contained malformed arguments, or arguments of unexpected type.
58 * Usually means that one of the VPN setting data items or secrets was not of
59 * the expected type (ie int, string, bool, etc).
60 * @NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED: a child process failed to launch
61 * @NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID: the operation could not be performed
62 * because the connection was invalid. Usually means that the connection's
63 * VPN setting was missing some required data item or secret.
64 * @NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED: the operation could not be
65 * performed as the plugin does not support interactive operations, such as
66 * ConnectInteractive() or NewSecrets()
68 * Returned by the VPN service plugin to indicate errors.
71 NM_VPN_PLUGIN_ERROR_GENERAL, /*< nick=General >*/
72 NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS, /*< nick=StartingInProgress >*/
73 NM_VPN_PLUGIN_ERROR_ALREADY_STARTED, /*< nick=AlreadyStarted >*/
74 NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS, /*< nick=StoppingInProgress >*/
75 NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED, /*< nick=AlreadyStopped >*/
76 NM_VPN_PLUGIN_ERROR_WRONG_STATE, /*< nick=WrongState >*/
77 NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, /*< nick=BadArguments >*/
78 NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED, /*< nick=LaunchFailed >*/
79 NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/
80 NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED /*< nick=InteractiveNotSupported >*/
83 #define NM_VPN_PLUGIN_ERROR (nm_vpn_plugin_error_quark ())
93 gboolean (*connect) (NMVPNPlugin *plugin,
94 NMConnection *connection,
97 gboolean (*need_secrets) (NMVPNPlugin *plugin,
98 NMConnection *connection,
102 gboolean (*disconnect) (NMVPNPlugin *plugin,
106 void (*state_changed) (NMVPNPlugin *plugin,
107 NMVPNServiceState state);
109 void (*ip4_config) (NMVPNPlugin *plugin,
110 GHashTable *ip4_config);
112 void (*login_banner) (NMVPNPlugin *plugin,
115 void (*failure) (NMVPNPlugin *plugin,
116 NMVPNPluginFailure reason);
118 void (*quit) (NMVPNPlugin *plugin);
120 void (*config) (NMVPNPlugin *plugin,
123 void (*ip6_config) (NMVPNPlugin *plugin,
127 gboolean (*new_secrets) (NMVPNPlugin *plugin,
128 NMConnection *connection,
131 gboolean (*connect_interactive) (NMVPNPlugin *plugin,
132 NMConnection *connection,
136 /* Padding for future expansion */
137 void (*_reserved1) (void);
138 void (*_reserved2) (void);
141 GType nm_vpn_plugin_get_type (void);
142 GQuark nm_vpn_plugin_error_quark (void);
143 GType nm_vpn_plugin_error_get_type (void);
145 DBusGConnection *nm_vpn_plugin_get_connection (NMVPNPlugin *plugin);
146 NMVPNServiceState nm_vpn_plugin_get_state (NMVPNPlugin *plugin);
147 void nm_vpn_plugin_set_state (NMVPNPlugin *plugin,
148 NMVPNServiceState state);
150 NM_AVAILABLE_IN_0_9_10
151 void nm_vpn_plugin_secrets_required (NMVPNPlugin *plugin,
155 void nm_vpn_plugin_set_login_banner (NMVPNPlugin *plugin,
158 void nm_vpn_plugin_failure (NMVPNPlugin *plugin,
159 NMVPNPluginFailure reason);
161 void nm_vpn_plugin_set_config (NMVPNPlugin *plugin,
164 void nm_vpn_plugin_set_ip4_config (NMVPNPlugin *plugin,
165 GHashTable *ip4_config);
167 void nm_vpn_plugin_set_ip6_config (NMVPNPlugin *plugin,
168 GHashTable *ip6_config);
170 gboolean nm_vpn_plugin_disconnect (NMVPNPlugin *plugin,
175 #endif /* NM_VPN_PLUGIN_H */