NetworkManager r4088 - in trunk: . include introspection libnm-glib src/vpn-manager
- From: tambeti svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r4088 - in trunk: . include introspection libnm-glib src/vpn-manager
- Date: Mon, 22 Sep 2008 15:29:00 +0000 (UTC)
Author: tambeti
Date: Mon Sep 22 15:29:00 2008
New Revision: 4088
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4088&view=rev
Log:
2008-09-22 Tambet Ingo <tambet gmail com>
* src/vpn-manager/nm-vpn-connection.c: Add a signal handler for the
"Failure" signal from VPN plugins, store the failure reason, and
use it when the state is changed to failure.
* introspection/nm-vpn-plugin.xml: Fix the "Failure" signal's type
description.
* include/NetworkManagerVPN.h (NMVPNConnectionStateReason): Add a new
reason to the end of the list to not break the API.
(NMVPNPluginFailure): Move it here (from libnm-glib/nm-vpn-plugin.h)
so it can be shared by plugins and daemon.
Modified:
trunk/ChangeLog
trunk/include/NetworkManagerVPN.h
trunk/introspection/nm-vpn-plugin.xml
trunk/libnm-glib/nm-vpn-plugin.h
trunk/src/vpn-manager/nm-vpn-connection.c
Modified: trunk/include/NetworkManagerVPN.h
==============================================================================
--- trunk/include/NetworkManagerVPN.h (original)
+++ trunk/include/NetworkManagerVPN.h Mon Sep 22 15:29:00 2008
@@ -102,9 +102,16 @@
NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT,
NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT,
NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED,
- NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS
+ NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS,
+ NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED
} NMVPNConnectionStateReason;
+typedef enum {
+ NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED,
+ NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED,
+ NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG
+} NMVPNPluginFailure;
+
#define NM_VPN_PLUGIN_IP4_CONFIG_GATEWAY "gateway"
#define NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS "address"
#define NM_VPN_PLUGIN_IP4_CONFIG_PTP "ptp"
Modified: trunk/introspection/nm-vpn-plugin.xml
==============================================================================
--- trunk/introspection/nm-vpn-plugin.xml (original)
+++ trunk/introspection/nm-vpn-plugin.xml Mon Sep 22 15:29:00 2008
@@ -122,11 +122,30 @@
<tp:docstring>
Emitted when a failure in the VPN plugin occurs.
</tp:docstring>
- <arg name="reason" type="u" tp:type="NM_VPN_CONNECTION_STATE_REASON">
+ <arg name="reason" type="u" tp:type="NM_VPN_PLUGIN_FAILURE">
<tp:docstring>
Reason code for the failure.
</tp:docstring>
</arg>
</signal>
+
+ <tp:enum name="NM_VPN_PLUGIN_FAILURE" type="u">
+ <tp:enumvalue suffix="LOGIN_FAILED" value="0">
+ <tp:docstring>
+ Login failed.
+ </tp:docstring>
+ </tp:enumvalue>
+ <tp:enumvalue suffix="CONNECT_FAILED" value="1">
+ <tp:docstring>
+ Connect failed.
+ </tp:docstring>
+ </tp:enumvalue>
+ <tp:enumvalue suffix="BAD_IP_CONFIG" value="2">
+ <tp:docstring>
+ Invalid IP configuration returned from the VPN plugin.
+ </tp:docstring>
+ </tp:enumvalue>
+ </tp:enum>
+
</interface>
</node>
Modified: trunk/libnm-glib/nm-vpn-plugin.h
==============================================================================
--- trunk/libnm-glib/nm-vpn-plugin.h (original)
+++ trunk/libnm-glib/nm-vpn-plugin.h Mon Sep 22 15:29:00 2008
@@ -36,12 +36,6 @@
#define NM_VPN_PLUGIN_ERROR (nm_vpn_plugin_error_quark ())
#define NM_TYPE_VPN_PLUGIN_ERROR (nm_vpn_plugin_error_get_type ())
-typedef enum {
- NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED,
- NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED,
- NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG
-} NMVPNPluginFailure;
-
typedef struct {
GObject parent;
} NMVPNPlugin;
Modified: trunk/src/vpn-manager/nm-vpn-connection.c
==============================================================================
--- trunk/src/vpn-manager/nm-vpn-connection.c (original)
+++ trunk/src/vpn-manager/nm-vpn-connection.c Mon Sep 22 15:29:00 2008
@@ -65,6 +65,7 @@
NMActiveConnectionState state;
NMVPNConnectionState vpn_state;
+ NMVPNConnectionStateReason failure_reason;
gulong device_monitor;
DBusGProxy *proxy;
guint ipconfig_timeout;
@@ -232,11 +233,33 @@
}
static void
+plugin_failed (DBusGProxy *proxy,
+ NMVPNPluginFailure plugin_failure,
+ gpointer user_data)
+{
+ NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (user_data);
+
+ nm_info ("VPN plugin failed: %d", plugin_failure);
+
+ switch (plugin_failure) {
+ case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
+ priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED;
+ break;
+ case NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG:
+ priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID;
+ break;
+ default:
+ priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;
+ }
+}
+
+static void
plugin_state_changed (DBusGProxy *proxy,
NMVPNServiceState state,
gpointer user_data)
{
NMVPNConnection *connection = NM_VPN_CONNECTION (user_data);
+ NMVPNConnectionPrivate *priv;
nm_info ("VPN plugin state changed: %d", state);
@@ -249,9 +272,16 @@
case NM_VPN_CONNECTION_STATE_CONNECT:
case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
case NM_VPN_CONNECTION_STATE_ACTIVATED:
+
+ priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
+
+ nm_info ("VPN plugin state change reason: %d", priv->failure_reason);
nm_vpn_connection_set_vpn_state (connection,
NM_VPN_CONNECTION_STATE_FAILED,
- NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED);
+ priv->failure_reason);
+
+ /* Reset the failure reason */
+ priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;
break;
default:
break;
@@ -539,6 +569,11 @@
NM_VPN_DBUS_PLUGIN_INTERFACE);
g_object_unref (dbus_mgr);
+ dbus_g_proxy_add_signal (priv->proxy, "Failure", G_TYPE_UINT, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (priv->proxy, "Failure",
+ G_CALLBACK (plugin_failed),
+ connection, NULL);
+
/* StateChanged signal */
dbus_g_proxy_add_signal (priv->proxy, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->proxy, "StateChanged",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]