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 - 2015 Red Hat, Inc.
22 #ifndef __NM_VPN_SERVICE_PLUGIN_H__
23 #define __NM_VPN_SERVICE_PLUGIN_H__
25 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
26 #error "Only <NetworkManager.h> can be included directly."
30 #include <nm-vpn-dbus-interface.h>
31 #include <nm-connection.h>
35 #define NM_TYPE_VPN_SERVICE_PLUGIN (nm_vpn_service_plugin_get_type ())
36 #define NM_VPN_SERVICE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_SERVICE_PLUGIN, NMVpnServicePlugin))
37 #define NM_VPN_SERVICE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_VPN_SERVICE_PLUGIN, NMVpnServicePluginClass))
38 #define NM_IS_VPN_SERVICE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_VPN_SERVICE_PLUGIN))
39 #define NM_IS_VPN_SERVICE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_VPN_SERVICE_PLUGIN))
40 #define NM_VPN_SERVICE_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_VPN_SERVICE_PLUGIN, NMVpnServicePluginClass))
42 #define NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME "service-name"
43 #define NM_VPN_SERVICE_PLUGIN_DBUS_WATCH_PEER "watch-peer"
44 #define NM_VPN_SERVICE_PLUGIN_STATE "state"
49 } NMVpnServicePlugin NM_AVAILABLE_IN_1_2;
57 void (*state_changed) (NMVpnServicePlugin *plugin,
58 NMVpnServiceState state);
61 void (*ip4_config) (NMVpnServicePlugin *plugin,
62 GVariant *ip4_config);
65 void (*login_banner) (NMVpnServicePlugin *plugin,
69 void (*failure) (NMVpnServicePlugin *plugin,
70 NMVpnPluginFailure reason);
73 void (*quit) (NMVpnServicePlugin *plugin);
76 void (*config) (NMVpnServicePlugin *plugin,
80 void (*ip6_config) (NMVpnServicePlugin *plugin,
85 gboolean (*connect) (NMVpnServicePlugin *plugin,
86 NMConnection *connection,
90 gboolean (*need_secrets) (NMVpnServicePlugin *plugin,
91 NMConnection *connection,
92 const char **setting_name,
96 gboolean (*disconnect) (NMVpnServicePlugin *plugin,
100 gboolean (*new_secrets) (NMVpnServicePlugin *plugin,
101 NMConnection *connection,
105 gboolean (*connect_interactive) (NMVpnServicePlugin *plugin,
106 NMConnection *connection,
113 } NMVpnServicePluginClass NM_AVAILABLE_IN_1_2;
116 GType nm_vpn_service_plugin_get_type (void);
119 GDBusConnection *nm_vpn_service_plugin_get_connection (NMVpnServicePlugin *plugin);
122 void nm_vpn_service_plugin_secrets_required (NMVpnServicePlugin *plugin,
127 void nm_vpn_service_plugin_set_login_banner (NMVpnServicePlugin *plugin,
131 void nm_vpn_service_plugin_failure (NMVpnServicePlugin *plugin,
132 NMVpnPluginFailure reason);
135 void nm_vpn_service_plugin_set_config (NMVpnServicePlugin *plugin,
139 void nm_vpn_service_plugin_set_ip4_config (NMVpnServicePlugin *plugin,
140 GVariant *ip4_config);
143 void nm_vpn_service_plugin_set_ip6_config (NMVpnServicePlugin *plugin,
144 GVariant *ip6_config);
147 gboolean nm_vpn_service_plugin_disconnect (NMVpnServicePlugin *plugin,
150 /* Utility functions */
153 gboolean nm_vpn_service_plugin_read_vpn_details (int fd,
154 GHashTable **out_data,
155 GHashTable **out_secrets);
158 gboolean nm_vpn_service_plugin_get_secret_flags (GHashTable *data,
159 const char *secret_name,
160 NMSettingSecretFlags *out_flags);
164 #endif /* __NM_VPN_SERVICE_PLUGIN_H__ */