summary refs log tree commit diff
path: root/src/vpn-manager
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-03-18 20:17:47 +0100
committerMichael Biebl <biebl@debian.org>2011-03-18 20:17:47 +0100
commite22c6e05e9ebc6cce941762020c5710b8014677b (patch)
tree7e9fd7f8ae24a94b03f683e0cef9a346968e1e8b /src/vpn-manager
parenta6b89d35fabd9f5934b84d7cde22e9268f92c3d3 (diff)
Imported Upstream version 0.8.3.998 upstream/0.8.3.998
Diffstat (limited to 'src/vpn-manager')
-rw-r--r--src/vpn-manager/Makefile.am18
-rw-r--r--src/vpn-manager/Makefile.in31
-rw-r--r--src/vpn-manager/nm-vpn-connection-base.c199
-rw-r--r--src/vpn-manager/nm-vpn-connection-base.h54
-rw-r--r--src/vpn-manager/nm-vpn-connection.c185
-rw-r--r--src/vpn-manager/nm-vpn-connection.h5
6 files changed, 325 insertions, 167 deletions
diff --git a/src/vpn-manager/Makefile.am b/src/vpn-manager/Makefile.am
index b0692d70..3b206617 100644
--- a/src/vpn-manager/Makefile.am
+++ b/src/vpn-manager/Makefile.am
@@ -11,12 +11,14 @@ INCLUDES = \
 
 noinst_LTLIBRARIES = libvpn-manager.la
 
-libvpn_manager_la_SOURCES =	\
-	nm-vpn-manager.c	\
-	nm-vpn-manager.h	\
-	nm-vpn-service.c	\
-	nm-vpn-service.h	\
-	nm-vpn-connection.c	\
+libvpn_manager_la_SOURCES = \
+	nm-vpn-manager.c \
+	nm-vpn-manager.h \
+	nm-vpn-service.c \
+	nm-vpn-service.h \
+	nm-vpn-connection-base.c \
+	nm-vpn-connection-base.h \
+	nm-vpn-connection.c \
 	nm-vpn-connection.h
 
 libvpn_manager_la_CPPFLAGS =	\
@@ -31,6 +33,9 @@ libvpn_manager_la_LIBADD = \
 	$(DBUS_LIBS) \
 	$(GLIB_LIBS)
 
+nm-vpn-connection-base-glue.h: $(top_srcdir)/introspection/nm-active-connection.xml
+	$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_connection_base --mode=glib-server --output=$@ $<
+
 nm-vpn-connection-glue.h: $(top_srcdir)/introspection/nm-vpn-connection.xml
 	$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_connection --mode=glib-server --output=$@ $<
 
@@ -39,6 +44,7 @@ nm-vpn-plugin-bindings.h: $(top_srcdir)/introspection/nm-vpn-plugin.xml
 
 
 BUILT_SOURCES = \
+	nm-vpn-connection-base-glue.h \
 	nm-vpn-connection-glue.h \
 	nm-vpn-plugin-bindings.h
 
diff --git a/src/vpn-manager/Makefile.in b/src/vpn-manager/Makefile.in
index e0a4f4ed..a1d72bbe 100644
--- a/src/vpn-manager/Makefile.in
+++ b/src/vpn-manager/Makefile.in
@@ -58,6 +58,7 @@ libvpn_manager_la_DEPENDENCIES =  \
 	$(am__DEPENDENCIES_1)
 am_libvpn_manager_la_OBJECTS = libvpn_manager_la-nm-vpn-manager.lo \
 	libvpn_manager_la-nm-vpn-service.lo \
+	libvpn_manager_la-nm-vpn-connection-base.lo \
 	libvpn_manager_la-nm-vpn-connection.lo
 libvpn_manager_la_OBJECTS = $(am_libvpn_manager_la_OBJECTS)
 AM_V_lt = $(am__v_lt_$(V))
@@ -186,6 +187,10 @@ MSGFMT_OPTS = @MSGFMT_OPTS@
 MSGMERGE = @MSGMERGE@
 NM = @NM@
 NMEDIT = @NMEDIT@
+NM_MAJOR_VERSION = @NM_MAJOR_VERSION@
+NM_MICRO_VERSION = @NM_MICRO_VERSION@
+NM_MINOR_VERSION = @NM_MINOR_VERSION@
+NM_VERSION = @NM_VERSION@
 NSS_CFLAGS = @NSS_CFLAGS@
 NSS_LIBS = @NSS_LIBS@
 OBJDUMP = @OBJDUMP@
@@ -200,6 +205,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKGCONFIG_PATH = @PKGCONFIG_PATH@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
@@ -287,11 +293,13 @@ INCLUDES = \
 
 noinst_LTLIBRARIES = libvpn-manager.la
 libvpn_manager_la_SOURCES = \
-	nm-vpn-manager.c	\
-	nm-vpn-manager.h	\
-	nm-vpn-service.c	\
-	nm-vpn-service.h	\
-	nm-vpn-connection.c	\
+	nm-vpn-manager.c \
+	nm-vpn-manager.h \
+	nm-vpn-service.c \
+	nm-vpn-service.h \
+	nm-vpn-connection-base.c \
+	nm-vpn-connection-base.h \
+	nm-vpn-connection.c \
 	nm-vpn-connection.h
 
 libvpn_manager_la_CPPFLAGS = \
@@ -307,6 +315,7 @@ libvpn_manager_la_LIBADD = \
 	$(GLIB_LIBS)
 
 BUILT_SOURCES = \
+	nm-vpn-connection-base-glue.h \
 	nm-vpn-connection-glue.h \
 	nm-vpn-plugin-bindings.h
 
@@ -364,6 +373,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvpn_manager_la-nm-vpn-connection-base.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvpn_manager_la-nm-vpn-connection.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvpn_manager_la-nm-vpn-manager.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvpn_manager_la-nm-vpn-service.Plo@am__quote@
@@ -411,6 +421,14 @@ libvpn_manager_la-nm-vpn-service.lo: nm-vpn-service.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvpn_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libvpn_manager_la-nm-vpn-service.lo `test -f 'nm-vpn-service.c' || echo '$(srcdir)/'`nm-vpn-service.c
 
+libvpn_manager_la-nm-vpn-connection-base.lo: nm-vpn-connection-base.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvpn_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libvpn_manager_la-nm-vpn-connection-base.lo -MD -MP -MF $(DEPDIR)/libvpn_manager_la-nm-vpn-connection-base.Tpo -c -o libvpn_manager_la-nm-vpn-connection-base.lo `test -f 'nm-vpn-connection-base.c' || echo '$(srcdir)/'`nm-vpn-connection-base.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libvpn_manager_la-nm-vpn-connection-base.Tpo $(DEPDIR)/libvpn_manager_la-nm-vpn-connection-base.Plo
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nm-vpn-connection-base.c' object='libvpn_manager_la-nm-vpn-connection-base.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvpn_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libvpn_manager_la-nm-vpn-connection-base.lo `test -f 'nm-vpn-connection-base.c' || echo '$(srcdir)/'`nm-vpn-connection-base.c
+
 libvpn_manager_la-nm-vpn-connection.lo: nm-vpn-connection.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvpn_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libvpn_manager_la-nm-vpn-connection.lo -MD -MP -MF $(DEPDIR)/libvpn_manager_la-nm-vpn-connection.Tpo -c -o libvpn_manager_la-nm-vpn-connection.lo `test -f 'nm-vpn-connection.c' || echo '$(srcdir)/'`nm-vpn-connection.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libvpn_manager_la-nm-vpn-connection.Tpo $(DEPDIR)/libvpn_manager_la-nm-vpn-connection.Plo
@@ -627,6 +645,9 @@ uninstall-am:
 	pdf pdf-am ps ps-am tags uninstall uninstall-am
 
 
+nm-vpn-connection-base-glue.h: $(top_srcdir)/introspection/nm-active-connection.xml
+	$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_connection_base --mode=glib-server --output=$@ $<
+
 nm-vpn-connection-glue.h: $(top_srcdir)/introspection/nm-vpn-connection.xml
 	$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_connection --mode=glib-server --output=$@ $<
 
diff --git a/src/vpn-manager/nm-vpn-connection-base.c b/src/vpn-manager/nm-vpn-connection-base.c
new file mode 100644
index 00000000..8a6fb2be
--- /dev/null
+++ b/src/vpn-manager/nm-vpn-connection-base.c
@@ -0,0 +1,199 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2005 - 2011 Red Hat, Inc.
+ * Copyright (C) 2007 - 2008 Novell, Inc.
+ */
+
+#include "NetworkManager.h"
+#include "nm-vpn-connection-base.h"
+#include "nm-active-connection.h"
+#include "nm-vpn-connection-base-glue.h"
+#include "nm-dbus-manager.h"
+
+G_DEFINE_ABSTRACT_TYPE (NMVpnConnectionBase, nm_vpn_connection_base, G_TYPE_OBJECT)
+
+#define NM_VPN_CONNECTION_BASE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+                                               NM_TYPE_VPN_CONNECTION_BASE, \
+                                               NMVpnConnectionBasePrivate))
+
+typedef struct {
+	gboolean disposed;
+
+	NMConnection *connection;
+	char *ac_path;
+	gboolean is_default;
+	gboolean is_default6;
+	NMActiveConnectionState state;
+} NMVpnConnectionBasePrivate;
+
+enum {
+	PROP_0,
+	PROP_SERVICE_NAME,
+	PROP_CONNECTION,
+	PROP_SPECIFIC_OBJECT,
+	PROP_DEVICES,
+	PROP_STATE,
+	PROP_DEFAULT,
+	PROP_DEFAULT6,
+	PROP_VPN,
+
+	LAST_PROP
+};
+
+/****************************************************************/
+
+void
+nm_vpn_connection_base_set_state (NMVpnConnectionBase *self,
+                                  NMVPNConnectionState vpn_state)
+{
+	NMVpnConnectionBasePrivate *priv = NM_VPN_CONNECTION_BASE_GET_PRIVATE (self);
+	NMActiveConnectionState new_ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
+
+	/* Set the NMActiveConnection state based on VPN state */
+	switch (vpn_state) {
+	case NM_VPN_CONNECTION_STATE_PREPARE:
+	case NM_VPN_CONNECTION_STATE_NEED_AUTH:
+	case NM_VPN_CONNECTION_STATE_CONNECT:
+	case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
+		new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING;
+		break;
+	case NM_VPN_CONNECTION_STATE_ACTIVATED:
+		new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
+		break;
+	default:
+		break;
+	}
+
+	if (new_ac_state != priv->state) {
+		priv->state = new_ac_state;
+		g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE);
+	}
+}
+
+const char *
+nm_vpn_connection_base_get_ac_path (NMVpnConnectionBase *self)
+{
+	return NM_VPN_CONNECTION_BASE_GET_PRIVATE (self)->ac_path;
+}
+
+void
+nm_vpn_connection_base_export (NMVpnConnectionBase *self,
+                               NMConnection *connection)
+{
+	NMVpnConnectionBasePrivate *priv = NM_VPN_CONNECTION_BASE_GET_PRIVATE (self);
+	NMDBusManager *dbus_mgr;
+
+	g_return_if_fail (priv->connection == NULL);
+
+	priv->connection = g_object_ref (connection);
+
+	dbus_mgr = nm_dbus_manager_get ();
+	dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (dbus_mgr),
+	                                     priv->ac_path, G_OBJECT (self));
+	g_object_unref (dbus_mgr);
+}
+
+/****************************************************************/
+
+static void
+nm_vpn_connection_base_init (NMVpnConnectionBase *self)
+{
+	NMVpnConnectionBasePrivate *priv = NM_VPN_CONNECTION_BASE_GET_PRIVATE (self);
+
+	priv->state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
+	priv->ac_path = nm_active_connection_get_next_object_path ();
+}
+
+static void
+dispose (GObject *object)
+{
+	NMVpnConnectionBasePrivate *priv = NM_VPN_CONNECTION_BASE_GET_PRIVATE (object);
+
+	if (!priv->disposed) {
+		priv->disposed = TRUE;
+
+		g_free (priv->ac_path);
+		g_object_unref (priv->connection);
+	}
+
+	G_OBJECT_CLASS (nm_vpn_connection_base_parent_class)->dispose (object);
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+			  GValue *value, GParamSpec *pspec)
+{
+	NMVpnConnectionBasePrivate *priv = NM_VPN_CONNECTION_BASE_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_SERVICE_NAME:
+		nm_active_connection_scope_to_value (priv->connection, value);
+		break;
+	case PROP_CONNECTION:
+		g_value_set_boxed (value, nm_connection_get_path (priv->connection));
+		break;
+	case PROP_SPECIFIC_OBJECT:
+		g_value_set_boxed (value, priv->ac_path);
+		break;
+	case PROP_DEVICES:
+		g_value_take_boxed (value, g_ptr_array_new ());
+		break;
+	case PROP_STATE:
+		g_value_set_uint (value, priv->state);
+		break;
+	case PROP_DEFAULT:
+		g_value_set_boolean (value, priv->is_default);
+		break;
+	case PROP_DEFAULT6:
+		g_value_set_boolean (value, priv->is_default6);
+		break;
+	case PROP_VPN:
+		g_value_set_boolean (value, TRUE);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+nm_vpn_connection_base_class_init (NMVpnConnectionBaseClass *vpn_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (vpn_class);
+
+	g_type_class_add_private (vpn_class, sizeof (NMVpnConnectionBasePrivate));
+
+	/* virtual methods */
+	object_class->get_property = get_property;
+	object_class->dispose = dispose;
+
+	/* properties */
+    nm_active_connection_install_properties (object_class,
+                                             PROP_SERVICE_NAME,
+                                             PROP_CONNECTION,
+                                             PROP_SPECIFIC_OBJECT,
+                                             PROP_DEVICES,
+                                             PROP_STATE,
+                                             PROP_DEFAULT,
+                                             PROP_DEFAULT6,
+                                             PROP_VPN);
+
+	dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (vpn_class),
+									 &dbus_glib_nm_vpn_connection_base_object_info);
+}
+
diff --git a/src/vpn-manager/nm-vpn-connection-base.h b/src/vpn-manager/nm-vpn-connection-base.h
new file mode 100644
index 00000000..0c17d9e8
--- /dev/null
+++ b/src/vpn-manager/nm-vpn-connection-base.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * (C) Copyright 2005 - 2011 Red Hat, Inc.
+ */
+
+#ifndef NM_VPN_CONNECTION_BASE_H
+#define NM_VPN_CONNECTION_BASE_H
+
+#include <glib-object.h>
+#include "NetworkManagerVPN.h"
+#include "nm-connection.h"
+
+#define NM_TYPE_VPN_CONNECTION_BASE            (nm_vpn_connection_base_get_type ())
+#define NM_VPN_CONNECTION_BASE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_CONNECTION_BASE, NMVpnConnectionBase))
+#define NM_VPN_CONNECTION_BASE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_VPN_CONNECTION_BASE, NMVpnConnectionBaseClass))
+#define NM_IS_VPN_CONNECTION_BASE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_VPN_CONNECTION_BASE))
+#define NM_IS_VPN_CONNECTION_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_VPN_CONNECTION_BASE))
+#define NM_VPN_CONNECTION_BASE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_VPN_CONNECTION_BASE, NMVpnConnectionBaseClass))
+
+typedef struct {
+	GObject parent;
+} NMVpnConnectionBase;
+
+typedef struct {
+	GObjectClass parent;
+} NMVpnConnectionBaseClass;
+
+GType nm_vpn_connection_base_get_type (void);
+
+const char *nm_vpn_connection_base_get_ac_path (NMVpnConnectionBase *self);
+
+void nm_vpn_connection_base_export (NMVpnConnectionBase *self,
+                                    NMConnection *connection);
+
+void nm_vpn_connection_base_set_state (NMVpnConnectionBase *self,
+                                       NMVPNConnectionState vpn_state);
+
+#endif /* NM_VPN_CONNECTION_BASE_H */
+
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index cf844992..03e213ff 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -52,7 +52,7 @@
 
 static void secrets_provider_interface_init (NMSecretsProviderInterface *sp_interface_class);
 
-G_DEFINE_TYPE_EXTENDED (NMVPNConnection, nm_vpn_connection, G_TYPE_OBJECT, 0,
+G_DEFINE_TYPE_EXTENDED (NMVPNConnection, nm_vpn_connection, NM_TYPE_VPN_CONNECTION_BASE, 0,
                         G_IMPLEMENT_INTERFACE (NM_TYPE_SECRETS_PROVIDER_INTERFACE,
                                                secrets_provider_interface_init))
 
@@ -62,16 +62,11 @@ typedef struct {
 	NMConnection *connection;
 
 	NMActRequest *act_request;
-	char *ac_path;
 
 	NMDevice *parent_dev;
 	gulong device_monitor;
 	gulong device_ip4;
 
-	gboolean is_default;
-	gboolean is_default6;
-	NMActiveConnectionState state;
-
 	NMVPNConnectionState vpn_state;
 	NMVPNConnectionStateReason failure_reason;
 	DBusGProxy *proxy;
@@ -97,14 +92,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
 
 enum {
 	PROP_0,
-	PROP_SERVICE_NAME,
-	PROP_CONNECTION,
-	PROP_SPECIFIC_OBJECT,
-	PROP_DEVICES,
-	PROP_STATE,
-	PROP_DEFAULT,
-	PROP_DEFAULT6,
-	PROP_VPN,
 	PROP_VPN_STATE,
 	PROP_BANNER,
 
@@ -117,7 +104,6 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection,
                                  NMVPNConnectionStateReason reason)
 {
 	NMVPNConnectionPrivate *priv;
-	NMActiveConnectionState new_ac_state;
 	NMVPNConnectionState old_vpn_state;
 	char *ip_iface;
 
@@ -131,32 +117,14 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection,
 	old_vpn_state = priv->vpn_state;
 	priv->vpn_state = vpn_state;
 
+	/* Update active connection base class state */
+	nm_vpn_connection_base_set_state (NM_VPN_CONNECTION_BASE (connection), vpn_state);
+
 	/* Save ip_iface since when the VPN goes down it may get freed
 	 * before we're done with it.
 	 */
 	ip_iface = g_strdup (priv->ip_iface);
 
-	/* Set the NMActiveConnection state based on VPN state */
-	switch (vpn_state) {
-	case NM_VPN_CONNECTION_STATE_PREPARE:
-	case NM_VPN_CONNECTION_STATE_NEED_AUTH:
-	case NM_VPN_CONNECTION_STATE_CONNECT:
-	case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
-		new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING;
-		break;
-	case NM_VPN_CONNECTION_STATE_ACTIVATED:
-		new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
-		break;
-	default:
-		new_ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
-		break;
-	}
-
-	if (new_ac_state != priv->state) {
-		priv->state = new_ac_state;
-		g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_STATE);
-	}
-
 	/* The connection gets destroyed by the VPN manager when it enters the
 	 * disconnected/failed state, but we need to keep it around for a bit
 	 * to send out signals and handle the dispatcher.  So ref it.
@@ -259,6 +227,9 @@ nm_vpn_connection_new (NMConnection *connection,
 	priv->device_ip4 = g_signal_connect (parent_device, "notify::" NM_DEVICE_INTERFACE_IP4_CONFIG,
 	                                     G_CALLBACK (device_ip4_config_changed),
 	                                     self);
+
+	nm_vpn_connection_base_export (NM_VPN_CONNECTION_BASE (self), connection);
+
 	return self;
 }
 
@@ -623,6 +594,7 @@ static void
 really_activate (NMVPNConnection *connection)
 {
 	NMVPNConnectionPrivate *priv;
+	GHashTable *hash;
 
 	g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
 	g_return_if_fail (nm_vpn_connection_get_vpn_state (connection) == NM_VPN_CONNECTION_STATE_NEED_AUTH);
@@ -639,10 +611,12 @@ really_activate (NMVPNConnection *connection)
 						    G_CALLBACK (nm_vpn_connection_ip4_config_get),
 						    connection, NULL);
 
+	hash = nm_connection_to_hash (priv->connection);
 	org_freedesktop_NetworkManager_VPN_Plugin_connect_async (priv->proxy,
-												  nm_connection_to_hash (priv->connection),
-												  nm_vpn_connection_connect_cb,
-												  connection);
+	                                                         hash,
+	                                                         nm_vpn_connection_connect_cb,
+	                                                         connection);
+	g_hash_table_destroy (hash);
 
 	nm_vpn_connection_set_vpn_state (connection,
 	                                 NM_VPN_CONNECTION_STATE_CONNECT,
@@ -688,7 +662,7 @@ nm_vpn_connection_get_active_connection_path (NMVPNConnection *connection)
 {
 	g_return_val_if_fail (NM_IS_VPN_CONNECTION (connection), NULL);
 
-	return NM_VPN_CONNECTION_GET_PRIVATE (connection)->ac_path;
+	return nm_vpn_connection_base_get_ac_path (NM_VPN_CONNECTION_BASE (connection));
 }
 
 const char *
@@ -979,20 +953,9 @@ connection_state_changed (NMVPNConnection *connection,
 }
 
 static void
-nm_vpn_connection_init (NMVPNConnection *connection)
+nm_vpn_connection_init (NMVPNConnection *self)
 {
-	NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
-	NMDBusManager *dbus_mgr;
-
-	priv->state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
-	priv->vpn_state = NM_VPN_CONNECTION_STATE_PREPARE;
-	priv->ac_path = nm_active_connection_get_next_object_path ();
-
-	dbus_mgr = nm_dbus_manager_get ();
-	dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (dbus_mgr),
-								  priv->ac_path,
-								  G_OBJECT (connection));
-	g_object_unref (dbus_mgr);
+	NM_VPN_CONNECTION_GET_PRIVATE (self)->vpn_state = NM_VPN_CONNECTION_STATE_PREPARE;
 }
 
 static void
@@ -1039,7 +1002,6 @@ finalize (GObject *object)
 
 	g_free (priv->banner);
 	g_free (priv->ip_iface);
-	g_free (priv->ac_path);
 
 	G_OBJECT_CLASS (nm_vpn_connection_parent_class)->finalize (object);
 }
@@ -1051,30 +1013,6 @@ get_property (GObject *object, guint prop_id,
 	NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object);
 
 	switch (prop_id) {
-	case PROP_SERVICE_NAME:
-		nm_active_connection_scope_to_value (priv->connection, value);
-		break;
-	case PROP_CONNECTION:
-		g_value_set_boxed (value, nm_connection_get_path (priv->connection));
-		break;
-	case PROP_SPECIFIC_OBJECT:
-		g_value_set_boxed (value, nm_act_request_get_active_connection_path (priv->act_request));
-		break;
-	case PROP_DEVICES:
-		g_value_take_boxed (value, g_ptr_array_new ());
-		break;
-	case PROP_STATE:
-		g_value_set_uint (value, priv->state);
-		break;
-	case PROP_DEFAULT:
-		g_value_set_boolean (value, priv->is_default);
-		break;
-	case PROP_DEFAULT6:
-		g_value_set_boolean (value, priv->is_default6);
-		break;
-	case PROP_VPN:
-		g_value_set_boolean (value, TRUE);
-		break;
 	case PROP_VPN_STATE:
 		g_value_set_uint (value, priv->vpn_state);
 		break;
@@ -1101,82 +1039,21 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
 	object_class->finalize = finalize;
 
 	/* properties */
-	g_object_class_install_property
-		(object_class, PROP_SERVICE_NAME,
-		 g_param_spec_string (NM_ACTIVE_CONNECTION_SERVICE_NAME,
-							  "Service name",
-							  "Service name",
-							  NULL,
-							  G_PARAM_READABLE));
-	g_object_class_install_property
-		(object_class, PROP_CONNECTION,
-		 g_param_spec_boxed (NM_ACTIVE_CONNECTION_CONNECTION,
-							  "Connection",
-							  "Connection",
-							  DBUS_TYPE_G_OBJECT_PATH,
-							  G_PARAM_READABLE));
-	g_object_class_install_property
-		(object_class, PROP_SPECIFIC_OBJECT,
-		 g_param_spec_boxed (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT,
-							  "Specific object",
-							  "Specific object",
-							  DBUS_TYPE_G_OBJECT_PATH,
-							  G_PARAM_READABLE));
-	g_object_class_install_property
-		(object_class, PROP_DEVICES,
-		 g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES,
-							  "Devices",
-							  "Devices",
-							  DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
-							  G_PARAM_READABLE));
-	g_object_class_install_property
-		(object_class, PROP_STATE,
-		 g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE,
-							  "State",
-							  "State",
-							  NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
-							  NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
-							  NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
-							  G_PARAM_READABLE));
-	g_object_class_install_property
-		(object_class, PROP_DEFAULT,
-		 g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT,
-							   "Default",
-							   "Is the default IPv4 active connection",
-							   FALSE,
-							   G_PARAM_READABLE));
-	g_object_class_install_property
-		(object_class, PROP_DEFAULT6,
-		 g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6,
-							   "Default6",
-							   "Is the default IPv6 active connection",
-							   FALSE,
-							   G_PARAM_READABLE));
-	g_object_class_install_property
-		(object_class, PROP_VPN,
-		 g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN,
-							   "VPN",
-							   "Is a VPN connection",
-							   TRUE,
-							   G_PARAM_READABLE));
-
-	g_object_class_install_property
-		(object_class, PROP_VPN_STATE,
-		 g_param_spec_uint (NM_VPN_CONNECTION_VPN_STATE,
-						"VpnState",
-						"Current VPN state",
-						NM_VPN_CONNECTION_STATE_UNKNOWN,
-						NM_VPN_CONNECTION_STATE_DISCONNECTED,
-						NM_VPN_CONNECTION_STATE_UNKNOWN,
-						G_PARAM_READABLE));
-
-	g_object_class_install_property
-		(object_class, PROP_BANNER,
-		 g_param_spec_string (NM_VPN_CONNECTION_BANNER,
-						  "Banner",
-						  "Login Banner",
-						  NULL,
-						  G_PARAM_READABLE));
+	g_object_class_install_property (object_class, PROP_VPN_STATE,
+		g_param_spec_uint (NM_VPN_CONNECTION_VPN_STATE,
+		                   "VpnState",
+		                   "Current VPN state",
+		                   NM_VPN_CONNECTION_STATE_UNKNOWN,
+		                   NM_VPN_CONNECTION_STATE_DISCONNECTED,
+		                   NM_VPN_CONNECTION_STATE_UNKNOWN,
+		                   G_PARAM_READABLE));
+
+	g_object_class_install_property (object_class, PROP_BANNER,
+		g_param_spec_string (NM_VPN_CONNECTION_BANNER,
+		                     "Banner",
+		                     "Login Banner",
+		                     NULL,
+		                     G_PARAM_READABLE));
 
 	/* signals */
 	signals[VPN_STATE_CHANGED] =
diff --git a/src/vpn-manager/nm-vpn-connection.h b/src/vpn-manager/nm-vpn-connection.h
index d69674db..ab880b17 100644
--- a/src/vpn-manager/nm-vpn-connection.h
+++ b/src/vpn-manager/nm-vpn-connection.h
@@ -28,6 +28,7 @@
 #include "nm-device.h"
 #include "nm-activation-request.h"
 #include "nm-secrets-provider-interface.h"
+#include "nm-vpn-connection-base.h"
 
 #define NM_TYPE_VPN_CONNECTION            (nm_vpn_connection_get_type ())
 #define NM_VPN_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_CONNECTION, NMVPNConnection))
@@ -40,11 +41,11 @@
 #define NM_VPN_CONNECTION_BANNER "banner"
 
 typedef struct {
-	GObject parent;
+	NMVpnConnectionBase parent;
 } NMVPNConnection;
 
 typedef struct {
-	GObjectClass parent;
+	NMVpnConnectionBaseClass parent;
 
 	/* Signals */
 	void (*vpn_state_changed) (NMVPNConnection *connection,