2014-07-24 08:53:33 -04:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
* Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2007 - 2008 Novell, Inc.
|
|
|
|
|
* Copyright 2007 - 2008 Red Hat, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <signal.h>
|
2014-05-15 14:25:07 -04:00
|
|
|
|
|
|
|
|
#include <glib/gi18n.h>
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
#include "nm-glib-compat.h"
|
|
|
|
|
#include "nm-vpn-plugin.h"
|
2014-09-10 15:46:46 -04:00
|
|
|
#include "nm-enum-types.h"
|
2014-07-24 08:53:33 -04:00
|
|
|
#include "nm-utils.h"
|
2014-08-16 10:09:48 -04:00
|
|
|
#include "nm-connection.h"
|
2014-09-10 13:51:53 -04:00
|
|
|
#include "nm-dbus-helpers.h"
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
#include "nmdbus-vpn-plugin.h"
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
#define NM_VPN_PLUGIN_QUIT_TIMER 20
|
|
|
|
|
|
2014-05-15 14:25:07 -04:00
|
|
|
static void nm_vpn_plugin_initable_iface_init (GInitableIface *iface);
|
|
|
|
|
|
|
|
|
|
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (NMVpnPlugin, nm_vpn_plugin, G_TYPE_OBJECT,
|
|
|
|
|
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_vpn_plugin_initable_iface_init);
|
|
|
|
|
)
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
typedef struct {
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnServiceState state;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/* DBUS-y stuff */
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusConnection *connection;
|
|
|
|
|
NMDBusVpnPlugin *dbus_vpn_plugin;
|
2014-07-24 08:53:33 -04:00
|
|
|
char *dbus_service_name;
|
|
|
|
|
|
|
|
|
|
/* Temporary stuff */
|
|
|
|
|
guint connect_timer;
|
|
|
|
|
guint quit_timer;
|
|
|
|
|
guint fail_stop_id;
|
|
|
|
|
gboolean interactive;
|
|
|
|
|
|
|
|
|
|
gboolean got_config;
|
|
|
|
|
gboolean has_ip4, got_ip4;
|
|
|
|
|
gboolean has_ip6, got_ip6;
|
|
|
|
|
|
|
|
|
|
/* Config stuff copied from config to ip4config */
|
2014-09-10 13:51:53 -04:00
|
|
|
char *banner, *tundev, *gateway, *mtu;
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
} NMVpnPluginPrivate;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
#define NM_VPN_PLUGIN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_VPN_PLUGIN, NMVpnPluginPrivate))
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
STATE_CHANGED,
|
|
|
|
|
CONFIG,
|
|
|
|
|
IP4_CONFIG,
|
|
|
|
|
IP6_CONFIG,
|
|
|
|
|
LOGIN_BANNER,
|
|
|
|
|
FAILURE,
|
|
|
|
|
QUIT,
|
|
|
|
|
SECRETS_REQUIRED,
|
|
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_DBUS_SERVICE_NAME,
|
|
|
|
|
PROP_STATE,
|
|
|
|
|
|
|
|
|
|
LAST_PROP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GSList *active_plugins = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_set_connection (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusConnection *connection)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
g_clear_object (&priv->connection);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
priv->connection = g_object_ref (connection);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
/**
|
|
|
|
|
* nm_vpn_plugin_get_connection:
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full):
|
|
|
|
|
*/
|
|
|
|
|
GDBusConnection *
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_get_connection (NMVpnPlugin *plugin)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusConnection *connection;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), NULL);
|
|
|
|
|
|
|
|
|
|
connection = NM_VPN_PLUGIN_GET_PRIVATE (plugin)->connection;
|
|
|
|
|
|
|
|
|
|
if (connection)
|
2014-09-10 13:51:53 -04:00
|
|
|
g_object_ref (connection);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
return connection;
|
|
|
|
|
}
|
|
|
|
|
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnServiceState
|
|
|
|
|
nm_vpn_plugin_get_state (NMVpnPlugin *plugin)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), NM_VPN_SERVICE_STATE_UNKNOWN);
|
|
|
|
|
|
|
|
|
|
return NM_VPN_PLUGIN_GET_PRIVATE (plugin)->state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_set_state (NMVpnPlugin *plugin,
|
|
|
|
|
NMVpnServiceState state)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_VPN_PLUGIN (plugin));
|
|
|
|
|
|
|
|
|
|
priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
if (priv->state != state) {
|
|
|
|
|
priv->state = state;
|
|
|
|
|
g_signal_emit (plugin, signals[STATE_CHANGED], 0, state);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_set_login_banner (NMVpnPlugin *plugin,
|
2014-07-24 08:53:33 -04:00
|
|
|
const char *banner)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (NM_IS_VPN_PLUGIN (plugin));
|
|
|
|
|
g_return_if_fail (banner != NULL);
|
|
|
|
|
|
|
|
|
|
g_signal_emit (plugin, signals[LOGIN_BANNER], 0, banner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_failure (NMVpnPlugin *plugin,
|
|
|
|
|
NMVpnPluginFailure reason)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
g_return_if_fail (NM_IS_VPN_PLUGIN (plugin));
|
|
|
|
|
|
|
|
|
|
g_signal_emit (plugin, signals[FAILURE], 0, reason);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_disconnect (NMVpnPlugin *plugin, GError **err)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
gboolean ret = FALSE;
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnServiceState state;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE);
|
|
|
|
|
|
|
|
|
|
state = nm_vpn_plugin_get_state (plugin);
|
|
|
|
|
switch (state) {
|
|
|
|
|
case NM_VPN_SERVICE_STATE_STOPPING:
|
|
|
|
|
g_set_error (err,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS,
|
|
|
|
|
"%s",
|
|
|
|
|
"Could not process the request because the VPN connection is already being stopped.");
|
|
|
|
|
break;
|
|
|
|
|
case NM_VPN_SERVICE_STATE_STOPPED:
|
|
|
|
|
g_set_error (err,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED,
|
|
|
|
|
"%s",
|
|
|
|
|
"Could not process the request because no VPN connection was active.");
|
|
|
|
|
break;
|
|
|
|
|
case NM_VPN_SERVICE_STATE_STARTING:
|
|
|
|
|
case NM_VPN_SERVICE_STATE_STARTED:
|
|
|
|
|
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPING);
|
|
|
|
|
ret = NM_VPN_PLUGIN_GET_CLASS (plugin)->disconnect (plugin, err);
|
|
|
|
|
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED);
|
|
|
|
|
break;
|
|
|
|
|
case NM_VPN_SERVICE_STATE_INIT:
|
|
|
|
|
ret = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
g_warning ("Unhandled VPN service state %d", state);
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_emit_quit (NMVpnPlugin *plugin)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
g_signal_emit (plugin, signals[QUIT], 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
connect_timer_expired (gpointer data)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPlugin *plugin = NM_VPN_PLUGIN (data);
|
2014-07-24 08:53:33 -04:00
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
g_message ("Connect timer expired, disconnecting.");
|
|
|
|
|
nm_vpn_plugin_disconnect (plugin, &err);
|
|
|
|
|
if (err) {
|
|
|
|
|
g_warning ("Disconnect failed: %s", err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
quit_timer_expired (gpointer data)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPlugin *plugin = NM_VPN_PLUGIN (data);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
nm_vpn_plugin_emit_quit (plugin);
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
fail_stop (gpointer data)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPlugin *plugin = NM_VPN_PLUGIN (data);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
schedule_fail_stop (NMVpnPlugin *plugin)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
if (priv->fail_stop_id)
|
|
|
|
|
g_source_remove (priv->fail_stop_id);
|
|
|
|
|
priv->fail_stop_id = g_idle_add (fail_stop, plugin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_set_config (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GVariant *config)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_VPN_PLUGIN (plugin));
|
|
|
|
|
g_return_if_fail (config != NULL);
|
|
|
|
|
|
|
|
|
|
priv->got_config = TRUE;
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
g_variant_lookup (config, NM_VPN_PLUGIN_CONFIG_HAS_IP4, "b", &priv->has_ip4);
|
|
|
|
|
g_variant_lookup (config, NM_VPN_PLUGIN_CONFIG_HAS_IP6, "b", &priv->has_ip6);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_warn_if_fail (priv->has_ip4 || priv->has_ip6);
|
|
|
|
|
|
|
|
|
|
/* Record the items that need to also be inserted into the
|
|
|
|
|
* ip4config, for compatibility with older daemons.
|
|
|
|
|
*/
|
2014-09-10 13:51:53 -04:00
|
|
|
g_clear_pointer (&priv->banner, g_free);
|
|
|
|
|
g_variant_lookup (config, NM_VPN_PLUGIN_CONFIG_BANNER, "&s", &priv->banner);
|
|
|
|
|
g_clear_pointer (&priv->tundev, g_free);
|
|
|
|
|
g_variant_lookup (config, NM_VPN_PLUGIN_CONFIG_TUNDEV, "&s", &priv->tundev);
|
|
|
|
|
g_clear_pointer (&priv->gateway, g_free);
|
|
|
|
|
g_variant_lookup (config, NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY, "&s", &priv->gateway);
|
|
|
|
|
g_clear_pointer (&priv->mtu, g_free);
|
|
|
|
|
g_variant_lookup (config, NM_VPN_PLUGIN_CONFIG_MTU, "&s", &priv->mtu);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_signal_emit (plugin, signals[CONFIG], 0, config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_set_ip4_config (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GVariant *ip4_config)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-09-10 13:51:53 -04:00
|
|
|
GVariant *combined_config;
|
|
|
|
|
GVariantBuilder builder;
|
|
|
|
|
GVariantIter iter;
|
|
|
|
|
const char *key, *value;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_VPN_PLUGIN (plugin));
|
|
|
|
|
g_return_if_fail (ip4_config != NULL);
|
|
|
|
|
|
|
|
|
|
priv->got_ip4 = TRUE;
|
|
|
|
|
|
|
|
|
|
/* Old plugins won't send the "config" signal and thus can't send
|
|
|
|
|
* NM_VPN_PLUGIN_CONFIG_HAS_IP4 either. But since they don't support IPv6,
|
|
|
|
|
* we can safely assume that, if we don't receive a "config" signal but do
|
|
|
|
|
* receive an "ip4-config" signal, the old plugin supports IPv4.
|
|
|
|
|
*/
|
|
|
|
|
if (!priv->got_config)
|
|
|
|
|
priv->has_ip4 = TRUE;
|
|
|
|
|
|
|
|
|
|
/* Older NetworkManager daemons expect all config info to be in
|
|
|
|
|
* the ip4 config, so they won't even notice the "config" signal
|
|
|
|
|
* being emitted. So just copy all of that data into the ip4
|
|
|
|
|
* config too.
|
|
|
|
|
*/
|
2014-09-10 13:51:53 -04:00
|
|
|
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
|
|
|
|
|
g_variant_iter_init (&iter, ip4_config);
|
|
|
|
|
while (g_variant_iter_next (&iter, "{&s&s}", &key, &value))
|
|
|
|
|
g_variant_builder_add (&builder, "{ss}", key, value);
|
|
|
|
|
|
|
|
|
|
if (priv->banner)
|
|
|
|
|
g_variant_builder_add (&builder, "{ss}", NM_VPN_PLUGIN_IP4_CONFIG_BANNER, &priv->banner);
|
|
|
|
|
if (priv->tundev)
|
|
|
|
|
g_variant_builder_add (&builder, "{ss}", NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV, &priv->tundev);
|
|
|
|
|
if (priv->gateway)
|
|
|
|
|
g_variant_builder_add (&builder, "{ss}", NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY, &priv->gateway);
|
|
|
|
|
if (priv->mtu)
|
|
|
|
|
g_variant_builder_add (&builder, "{ss}", NM_VPN_PLUGIN_IP4_CONFIG_MTU, &priv->mtu);
|
|
|
|
|
|
|
|
|
|
combined_config = g_variant_builder_end (&builder);
|
|
|
|
|
g_variant_ref_sink (combined_config);
|
2014-07-24 08:53:33 -04:00
|
|
|
g_signal_emit (plugin, signals[IP4_CONFIG], 0, combined_config);
|
2014-09-10 13:51:53 -04:00
|
|
|
g_variant_unref (combined_config);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
if ( priv->has_ip4 == priv->got_ip4
|
|
|
|
|
&& priv->has_ip6 == priv->got_ip6)
|
|
|
|
|
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STARTED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_set_ip6_config (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GVariant *ip6_config)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_if_fail (NM_IS_VPN_PLUGIN (plugin));
|
|
|
|
|
g_return_if_fail (ip6_config != NULL);
|
|
|
|
|
|
|
|
|
|
priv->got_ip6 = TRUE;
|
|
|
|
|
g_signal_emit (plugin, signals[IP6_CONFIG], 0, ip6_config);
|
|
|
|
|
|
|
|
|
|
if ( priv->has_ip4 == priv->got_ip4
|
|
|
|
|
&& priv->has_ip6 == priv->got_ip6)
|
|
|
|
|
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STARTED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
connect_timer_removed (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
NM_VPN_PLUGIN_GET_PRIVATE (data)->connect_timer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
connect_timer_start (NMVpnPlugin *plugin)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
priv->connect_timer = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
|
|
|
|
|
60,
|
|
|
|
|
connect_timer_expired,
|
|
|
|
|
plugin,
|
|
|
|
|
connect_timer_removed);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
_connect_generic (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *properties,
|
|
|
|
|
GVariant *details)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
NMVpnPluginClass *vpn_class = NM_VPN_PLUGIN_GET_CLASS (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
NMConnection *connection;
|
|
|
|
|
gboolean success = FALSE;
|
2014-09-10 13:51:53 -04:00
|
|
|
GError *error = NULL;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
if (priv->state != NM_VPN_SERVICE_STATE_STOPPED &&
|
|
|
|
|
priv->state != NM_VPN_SERVICE_STATE_INIT) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_error (context,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_WRONG_STATE,
|
|
|
|
|
"Could not start connection: wrong plugin state %d",
|
|
|
|
|
priv->state);
|
|
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
connection = nm_simple_connection_new_from_dbus (properties, &error);
|
2014-07-24 08:53:33 -04:00
|
|
|
if (!connection) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_error (context,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
|
|
|
|
|
"Invalid connection: (%d) %s",
|
|
|
|
|
error->code, error->message);
|
|
|
|
|
g_clear_error (&error);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv->interactive = FALSE;
|
|
|
|
|
if (details && !vpn_class->connect_interactive) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_error (context,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED,
|
|
|
|
|
"Plugin does not implement ConnectInteractive()");
|
|
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STARTING);
|
|
|
|
|
|
|
|
|
|
if (details) {
|
|
|
|
|
priv->interactive = TRUE;
|
2014-09-10 13:51:53 -04:00
|
|
|
success = vpn_class->connect_interactive (plugin, connection, details, &error);
|
2014-07-24 08:53:33 -04:00
|
|
|
} else
|
2014-09-10 13:51:53 -04:00
|
|
|
success = vpn_class->connect (plugin, connection, &error);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
if (success) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context, NULL);
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Add a timer to make sure we do not wait indefinitely for the successful connect. */
|
|
|
|
|
connect_timer_start (plugin);
|
|
|
|
|
} else {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_take_error (context, error);
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Stop the plugin from an idle handler so that the Connect
|
|
|
|
|
* method return gets sent before the STOP StateChanged signal.
|
|
|
|
|
*/
|
|
|
|
|
schedule_fail_stop (plugin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_unref (connection);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_connect (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *connection,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2014-09-10 13:51:53 -04:00
|
|
|
_connect_generic (plugin, context, connection, NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_connect_interactive (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *connection,
|
|
|
|
|
GVariant *details,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2014-09-10 13:51:53 -04:00
|
|
|
_connect_generic (plugin, context, connection, details);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_need_secrets (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *properties,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
NMConnection *connection;
|
2014-09-10 13:51:53 -04:00
|
|
|
char *setting_name;
|
|
|
|
|
gboolean needed;
|
|
|
|
|
GError *error = NULL;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
connection = nm_simple_connection_new_from_dbus (properties, &error);
|
2014-07-24 08:53:33 -04:00
|
|
|
if (!connection) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_error (context,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
2014-10-15 15:27:25 -04:00
|
|
|
NM_VPN_PLUGIN_ERROR_INVALID_CONNECTION,
|
2014-10-13 11:57:35 -04:00
|
|
|
"The connection was invalid: %s",
|
|
|
|
|
error->message);
|
2014-09-10 13:51:53 -04:00
|
|
|
g_error_free (error);
|
|
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!NM_VPN_PLUGIN_GET_CLASS (plugin)->need_secrets) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context,
|
|
|
|
|
g_variant_new ("(s)", ""));
|
|
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
needed = NM_VPN_PLUGIN_GET_CLASS (plugin)->need_secrets (plugin, connection, &setting_name, &error);
|
|
|
|
|
if (error) {
|
|
|
|
|
g_dbus_method_invocation_take_error (context, error);
|
|
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (needed) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_assert (setting_name);
|
|
|
|
|
g_dbus_method_invocation_return_value (context,
|
|
|
|
|
g_variant_new ("(s)", setting_name));
|
|
|
|
|
g_free (setting_name);
|
2014-07-24 08:53:33 -04:00
|
|
|
} else {
|
|
|
|
|
/* No secrets required */
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context,
|
|
|
|
|
g_variant_new ("(s)", ""));
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_new_secrets (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *properties,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
NMConnection *connection;
|
2014-09-10 13:51:53 -04:00
|
|
|
GError *error = NULL;
|
2014-07-24 08:53:33 -04:00
|
|
|
gboolean success;
|
|
|
|
|
|
|
|
|
|
if (priv->state != NM_VPN_SERVICE_STATE_STARTING) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_error (context,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_WRONG_STATE,
|
|
|
|
|
"Could not accept new secrets: wrong plugin state %d",
|
|
|
|
|
priv->state);
|
|
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
connection = nm_simple_connection_new_from_dbus (properties, &error);
|
2014-07-24 08:53:33 -04:00
|
|
|
if (!connection) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_error (context,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
|
|
|
|
|
"Invalid connection: (%d) %s",
|
|
|
|
|
error->code, error->message);
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!NM_VPN_PLUGIN_GET_CLASS (plugin)->new_secrets) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_error (context,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR,
|
|
|
|
|
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED,
|
|
|
|
|
"Could not accept new secrets: plugin cannot process interactive secrets");
|
2014-07-24 08:53:33 -04:00
|
|
|
g_object_unref (connection);
|
2014-09-10 13:51:53 -04:00
|
|
|
return;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
success = NM_VPN_PLUGIN_GET_CLASS (plugin)->new_secrets (plugin, connection, &error);
|
2014-07-24 08:53:33 -04:00
|
|
|
if (success) {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context, NULL);
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Add a timer to make sure we do not wait indefinitely for the successful connect. */
|
|
|
|
|
connect_timer_start (plugin);
|
|
|
|
|
} else {
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_take_error (context, error);
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/* Stop the plugin from and idle handler so that the NewSecrets
|
|
|
|
|
* method return gets sent before the STOP StateChanged signal.
|
|
|
|
|
*/
|
|
|
|
|
schedule_fail_stop (plugin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_unref (connection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_vpn_plugin_secrets_required:
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
* @plugin: the #NMVpnPlugin
|
2014-07-24 08:53:33 -04:00
|
|
|
* @message: an information message about why secrets are required, if any
|
|
|
|
|
* @hints: VPN specific secret names for required new secrets
|
|
|
|
|
*
|
|
|
|
|
* Called by VPN plugin implementations to signal to NetworkManager that secrets
|
|
|
|
|
* are required during the connection process. This signal may be used to
|
|
|
|
|
* request new secrets when the secrets originally provided by NetworkManager
|
|
|
|
|
* are insufficient, or the VPN process indicates that it needs additional
|
|
|
|
|
* information to complete the request.
|
|
|
|
|
*/
|
|
|
|
|
void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_secrets_required (NMVpnPlugin *plugin,
|
2014-07-24 08:53:33 -04:00
|
|
|
const char *message,
|
|
|
|
|
const char **hints)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/* Plugin must be able to accept the new secrets if it calls this method */
|
|
|
|
|
g_return_if_fail (NM_VPN_PLUGIN_GET_CLASS (plugin)->new_secrets);
|
|
|
|
|
|
|
|
|
|
/* Plugin cannot call this method if NetworkManager didn't originally call
|
|
|
|
|
* ConnectInteractive().
|
|
|
|
|
*/
|
|
|
|
|
g_return_if_fail (priv->interactive == TRUE);
|
|
|
|
|
|
|
|
|
|
/* Cancel the connect timer since secrets might take a while. It'll
|
|
|
|
|
* get restarted when the secrets come back via NewSecrets().
|
|
|
|
|
*/
|
|
|
|
|
if (priv->connect_timer)
|
|
|
|
|
g_source_remove (priv->connect_timer);
|
|
|
|
|
|
|
|
|
|
g_signal_emit (plugin, signals[SECRETS_REQUIRED], 0, message, hints);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_disconnect (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2014-09-10 13:51:53 -04:00
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
if (nm_vpn_plugin_disconnect (plugin, &error))
|
|
|
|
|
g_dbus_method_invocation_return_value (context, NULL);
|
|
|
|
|
else
|
|
|
|
|
g_dbus_method_invocation_take_error (context, error);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_set_config (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *config,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
nm_vpn_plugin_set_config (plugin, config);
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context, NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_set_ip4_config (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *config,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
nm_vpn_plugin_set_ip4_config (plugin, config);
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context, NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_set_ip6_config (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
|
|
|
|
GVariant *config,
|
|
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
nm_vpn_plugin_set_ip6_config (plugin, config);
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context, NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
impl_vpn_plugin_set_failure (NMVpnPlugin *plugin,
|
2014-09-10 13:51:53 -04:00
|
|
|
GDBusMethodInvocation *context,
|
2014-07-24 08:53:33 -04:00
|
|
|
char *reason,
|
2014-09-10 13:51:53 -04:00
|
|
|
gpointer user_data)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
nm_vpn_plugin_failure (plugin, NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG);
|
2014-09-10 13:51:53 -04:00
|
|
|
g_dbus_method_invocation_return_value (context, NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sigterm_handler (int signum)
|
|
|
|
|
{
|
|
|
|
|
g_slist_foreach (active_plugins, (GFunc) nm_vpn_plugin_emit_quit, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
setup_unix_signal_handler (void)
|
|
|
|
|
{
|
|
|
|
|
struct sigaction action;
|
|
|
|
|
sigset_t block_mask;
|
|
|
|
|
|
|
|
|
|
action.sa_handler = sigterm_handler;
|
|
|
|
|
sigemptyset (&block_mask);
|
|
|
|
|
action.sa_mask = block_mask;
|
|
|
|
|
action.sa_flags = 0;
|
|
|
|
|
sigaction (SIGINT, &action, NULL);
|
|
|
|
|
sigaction (SIGTERM, &action, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
one_plugin_destroyed (gpointer data,
|
|
|
|
|
GObject *object)
|
|
|
|
|
{
|
|
|
|
|
active_plugins = g_slist_remove (active_plugins, object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_init (NMVpnPlugin *plugin)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
active_plugins = g_slist_append (active_plugins, plugin);
|
|
|
|
|
g_object_weak_ref (G_OBJECT (plugin),
|
|
|
|
|
one_plugin_destroyed,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-15 14:25:07 -04:00
|
|
|
static gboolean
|
|
|
|
|
init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2014-09-10 13:51:53 -04:00
|
|
|
NMVpnPlugin *plugin = NM_VPN_PLUGIN (initable);
|
|
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
GDBusConnection *connection = NULL;
|
|
|
|
|
GDBusProxy *proxy;
|
|
|
|
|
GVariant *ret;
|
|
|
|
|
gboolean success = FALSE;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-05-15 14:25:07 -04:00
|
|
|
if (!priv->dbus_service_name) {
|
|
|
|
|
g_set_error_literal (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
|
|
|
|
|
_("No service name specified"));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
|
2014-07-24 08:53:33 -04:00
|
|
|
if (!connection)
|
2014-05-15 14:25:07 -04:00
|
|
|
return FALSE;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
proxy = g_dbus_proxy_new_sync (connection,
|
|
|
|
|
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
|
|
|
|
|
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
|
|
|
|
|
NULL,
|
|
|
|
|
DBUS_SERVICE_DBUS,
|
|
|
|
|
DBUS_PATH_DBUS,
|
|
|
|
|
DBUS_INTERFACE_DBUS,
|
|
|
|
|
cancellable, error);
|
|
|
|
|
if (!proxy)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
ret = g_dbus_proxy_call_sync (proxy,
|
|
|
|
|
"RequestName",
|
|
|
|
|
g_variant_new ("(s)", priv->dbus_service_name),
|
|
|
|
|
G_DBUS_CALL_FLAGS_NONE, 0,
|
|
|
|
|
cancellable, error);
|
2014-07-24 08:53:33 -04:00
|
|
|
g_object_unref (proxy);
|
2014-09-10 13:51:53 -04:00
|
|
|
if (!ret)
|
|
|
|
|
goto out;
|
|
|
|
|
g_variant_unref (ret);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
priv->dbus_vpn_plugin = nmdbus_vpn_plugin_skeleton_new ();
|
|
|
|
|
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (priv->dbus_vpn_plugin),
|
|
|
|
|
connection,
|
|
|
|
|
NM_VPN_DBUS_PLUGIN_PATH,
|
|
|
|
|
error))
|
|
|
|
|
goto out;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
_nm_dbus_bind_properties (plugin, priv->dbus_vpn_plugin);
|
|
|
|
|
_nm_dbus_bind_methods (plugin, priv->dbus_vpn_plugin,
|
|
|
|
|
"Connect", impl_vpn_plugin_connect,
|
|
|
|
|
"ConnectInteractive", impl_vpn_plugin_connect_interactive,
|
|
|
|
|
"NeedSecrets", impl_vpn_plugin_need_secrets,
|
|
|
|
|
"NewSecrets", impl_vpn_plugin_new_secrets,
|
|
|
|
|
"Disconnect", impl_vpn_plugin_disconnect,
|
|
|
|
|
"SetConfig", impl_vpn_plugin_set_config,
|
|
|
|
|
"SetIp4Config", impl_vpn_plugin_set_ip4_config,
|
|
|
|
|
"SetIp6Config", impl_vpn_plugin_set_ip6_config,
|
|
|
|
|
"SetFailure", impl_vpn_plugin_set_failure,
|
|
|
|
|
NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
nm_vpn_plugin_set_connection (plugin, connection);
|
|
|
|
|
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_INIT);
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
success = TRUE;
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
g_clear_object (&connection);
|
|
|
|
|
|
|
|
|
|
return success;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_property (GObject *object, guint prop_id,
|
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (object);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_DBUS_SERVICE_NAME:
|
|
|
|
|
/* Construct-only */
|
2014-05-15 14:25:07 -04:00
|
|
|
priv->dbus_service_name = g_value_dup_string (value);
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
|
|
|
|
case PROP_STATE:
|
|
|
|
|
nm_vpn_plugin_set_state (NM_VPN_PLUGIN (object),
|
2014-06-26 16:47:46 -04:00
|
|
|
(NMVpnServiceState) g_value_get_enum (value));
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (object);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_DBUS_SERVICE_NAME:
|
|
|
|
|
g_value_set_string (value, priv->dbus_service_name);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_STATE:
|
2014-06-26 16:47:46 -04:00
|
|
|
g_value_set_enum (value, nm_vpn_plugin_get_state (NM_VPN_PLUGIN (object)));
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
dispose (GObject *object)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPlugin *plugin = NM_VPN_PLUGIN (object);
|
|
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
NMVpnServiceState state;
|
2014-07-24 08:53:33 -04:00
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
if (priv->fail_stop_id) {
|
|
|
|
|
g_source_remove (priv->fail_stop_id);
|
|
|
|
|
priv->fail_stop_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state = nm_vpn_plugin_get_state (plugin);
|
|
|
|
|
|
|
|
|
|
if (state == NM_VPN_SERVICE_STATE_STARTED ||
|
|
|
|
|
state == NM_VPN_SERVICE_STATE_STARTING)
|
|
|
|
|
nm_vpn_plugin_disconnect (plugin, &err);
|
|
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
g_warning ("Error disconnecting VPN connection: %s", err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_vpn_plugin_parent_class)->dispose (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finalize (GObject *object)
|
|
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPlugin *plugin = NM_VPN_PLUGIN (object);
|
|
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
nm_vpn_plugin_set_connection (plugin, NULL);
|
|
|
|
|
g_free (priv->dbus_service_name);
|
|
|
|
|
|
2014-09-10 13:51:53 -04:00
|
|
|
g_clear_pointer (&priv->banner, g_free);
|
|
|
|
|
g_clear_pointer (&priv->tundev, g_free);
|
|
|
|
|
g_clear_pointer (&priv->gateway, g_free);
|
|
|
|
|
g_clear_pointer (&priv->mtu, g_free);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_vpn_plugin_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
quit_timer_removed (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
NM_VPN_PLUGIN_GET_PRIVATE (data)->quit_timer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
state_changed (NMVpnPlugin *plugin, NMVpnServiceState state)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
NMVpnPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
|
case NM_VPN_SERVICE_STATE_STARTING:
|
|
|
|
|
/* Remove the quit timer. */
|
|
|
|
|
if (priv->quit_timer)
|
|
|
|
|
g_source_remove (priv->quit_timer);
|
|
|
|
|
|
|
|
|
|
if (priv->fail_stop_id) {
|
|
|
|
|
g_source_remove (priv->fail_stop_id);
|
|
|
|
|
priv->fail_stop_id = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NM_VPN_SERVICE_STATE_STOPPED:
|
|
|
|
|
priv->quit_timer = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
|
|
|
|
|
NM_VPN_PLUGIN_QUIT_TIMER,
|
|
|
|
|
quit_timer_expired,
|
|
|
|
|
plugin,
|
|
|
|
|
quit_timer_removed);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
/* Clean up all timers we might have set up. */
|
|
|
|
|
if (priv->connect_timer)
|
|
|
|
|
g_source_remove (priv->connect_timer);
|
|
|
|
|
|
|
|
|
|
if (priv->quit_timer)
|
|
|
|
|
g_source_remove (priv->quit_timer);
|
|
|
|
|
|
|
|
|
|
if (priv->fail_stop_id) {
|
|
|
|
|
g_source_remove (priv->fail_stop_id);
|
|
|
|
|
priv->fail_stop_id = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
nm_vpn_plugin_class_init (NMVpnPluginClass *plugin_class)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (plugin_class);
|
|
|
|
|
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
g_type_class_add_private (object_class, sizeof (NMVpnPluginPrivate));
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/* virtual methods */
|
|
|
|
|
object_class->set_property = set_property;
|
|
|
|
|
object_class->get_property = get_property;
|
|
|
|
|
object_class->dispose = dispose;
|
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
|
|
|
|
|
plugin_class->state_changed = state_changed;
|
|
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
|
|
|
|
|
|
/**
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
* NMVpnPlugin:service-name:
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* The D-Bus service name of this plugin.
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_DBUS_SERVICE_NAME,
|
|
|
|
|
g_param_spec_string (NM_VPN_PLUGIN_DBUS_SERVICE_NAME, "", "",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT_ONLY |
|
|
|
|
|
G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
|
|
/**
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
* NMVpnPlugin:state:
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* The state of the plugin.
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_STATE,
|
2014-06-26 16:47:46 -04:00
|
|
|
g_param_spec_enum (NM_VPN_PLUGIN_STATE, "", "",
|
|
|
|
|
NM_TYPE_VPN_SERVICE_STATE,
|
2014-07-24 08:53:33 -04:00
|
|
|
NM_VPN_SERVICE_STATE_INIT,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
|
|
/* signals */
|
|
|
|
|
signals[STATE_CHANGED] =
|
|
|
|
|
g_signal_new ("state-changed",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
G_STRUCT_OFFSET (NMVpnPluginClass, state_changed),
|
2014-07-24 08:53:33 -04:00
|
|
|
NULL, NULL,
|
2014-09-10 13:51:53 -04:00
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_UINT);
|
|
|
|
|
|
|
|
|
|
signals[SECRETS_REQUIRED] =
|
|
|
|
|
g_signal_new ("secrets-required",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
0, NULL, NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRV);
|
|
|
|
|
|
|
|
|
|
signals[CONFIG] =
|
|
|
|
|
g_signal_new ("config",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
G_STRUCT_OFFSET (NMVpnPluginClass, config),
|
2014-07-24 08:53:33 -04:00
|
|
|
NULL, NULL,
|
2014-09-10 13:51:53 -04:00
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
G_TYPE_NONE, 1,
|
2014-09-10 13:51:53 -04:00
|
|
|
G_TYPE_VARIANT);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
signals[IP4_CONFIG] =
|
|
|
|
|
g_signal_new ("ip4-config",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
G_STRUCT_OFFSET (NMVpnPluginClass, ip4_config),
|
2014-07-24 08:53:33 -04:00
|
|
|
NULL, NULL,
|
2014-09-10 13:51:53 -04:00
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
G_TYPE_NONE, 1,
|
2014-09-10 13:51:53 -04:00
|
|
|
G_TYPE_VARIANT);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
signals[IP6_CONFIG] =
|
|
|
|
|
g_signal_new ("ip6-config",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
G_STRUCT_OFFSET (NMVpnPluginClass, ip6_config),
|
2014-07-24 08:53:33 -04:00
|
|
|
NULL, NULL,
|
2014-09-10 13:51:53 -04:00
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
G_TYPE_NONE, 1,
|
2014-09-10 13:51:53 -04:00
|
|
|
G_TYPE_VARIANT);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
signals[LOGIN_BANNER] =
|
|
|
|
|
g_signal_new ("login-banner",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
G_STRUCT_OFFSET (NMVpnPluginClass, login_banner),
|
2014-07-24 08:53:33 -04:00
|
|
|
NULL, NULL,
|
2014-09-10 13:51:53 -04:00
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_STRING);
|
|
|
|
|
|
|
|
|
|
signals[FAILURE] =
|
|
|
|
|
g_signal_new ("failure",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
G_STRUCT_OFFSET (NMVpnPluginClass, failure),
|
2014-07-24 08:53:33 -04:00
|
|
|
NULL, NULL,
|
2014-09-10 13:51:53 -04:00
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_UINT);
|
|
|
|
|
|
|
|
|
|
signals[QUIT] =
|
|
|
|
|
g_signal_new ("quit",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-06-26 13:44:36 -04:00
|
|
|
G_STRUCT_OFFSET (NMVpnPluginClass, quit),
|
2014-07-24 08:53:33 -04:00
|
|
|
NULL, NULL,
|
2014-09-10 13:51:53 -04:00
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
G_TYPE_NONE, 0,
|
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
|
|
|
|
|
setup_unix_signal_handler ();
|
|
|
|
|
}
|
2014-05-15 14:25:07 -04:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_vpn_plugin_initable_iface_init (GInitableIface *iface)
|
|
|
|
|
{
|
|
|
|
|
iface->init = init_sync;
|
|
|
|
|
}
|