mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 20:18:39 +00:00
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. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4088 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
75e283e368
commit
b37fc86385
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
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.
|
||||
|
||||
2008-09-18 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Patch from Alexander Sack <asac@ubuntu.com>
|
||||
|
|
|
@ -102,9 +102,16 @@ typedef enum NMVPNConnectionStateReason
|
|||
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"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -36,12 +36,6 @@ typedef enum {
|
|||
#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;
|
||||
|
|
|
@ -65,6 +65,7 @@ typedef struct {
|
|||
NMActiveConnectionState state;
|
||||
|
||||
NMVPNConnectionState vpn_state;
|
||||
NMVPNConnectionStateReason failure_reason;
|
||||
gulong device_monitor;
|
||||
DBusGProxy *proxy;
|
||||
guint ipconfig_timeout;
|
||||
|
@ -231,12 +232,34 @@ nm_vpn_connection_get_service (NMVPNConnection *connection)
|
|||
return setting->service_type;
|
||||
}
|
||||
|
||||
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 @@ plugin_state_changed (DBusGProxy *proxy,
|
|||
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_connection_activate (NMVPNConnection *connection)
|
|||
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",
|
||||
|
|
Loading…
Reference in a new issue