~network-manager/network-manager/ubuntu.hardy.07

« back to all changes in this revision

Viewing changes to src/vpn-manager/nm-vpn-connection.c

(merge) RELEASE 0.7~~svn20080928t225540+eni0-0ubuntu1 to ubuntu/intrepid

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        NMActiveConnectionState state;
66
66
 
67
67
        NMVPNConnectionState vpn_state;
 
68
        NMVPNConnectionStateReason failure_reason;
68
69
        gulong device_monitor;
69
70
        DBusGProxy *proxy;
70
71
        guint ipconfig_timeout;
232
233
}
233
234
 
234
235
static void
 
236
plugin_failed (DBusGProxy *proxy,
 
237
                           NMVPNPluginFailure plugin_failure,
 
238
                           gpointer user_data)
 
239
{
 
240
        NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (user_data);
 
241
 
 
242
        nm_info ("VPN plugin failed: %d", plugin_failure);
 
243
 
 
244
        switch (plugin_failure) {
 
245
        case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
 
246
                priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED;
 
247
                break;
 
248
        case NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG:
 
249
                priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID;
 
250
                break;
 
251
        default:
 
252
                priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;
 
253
        }
 
254
}
 
255
 
 
256
static void
235
257
plugin_state_changed (DBusGProxy *proxy,
236
258
                                  NMVPNServiceState state,
237
259
                                  gpointer user_data)
238
260
{
239
261
        NMVPNConnection *connection = NM_VPN_CONNECTION (user_data);
 
262
        NMVPNConnectionPrivate *priv;
240
263
 
241
264
        nm_info ("VPN plugin state changed: %d", state);
242
265
 
249
272
        case NM_VPN_CONNECTION_STATE_CONNECT:
250
273
        case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
251
274
        case NM_VPN_CONNECTION_STATE_ACTIVATED:
 
275
 
 
276
                priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
 
277
 
 
278
                nm_info ("VPN plugin state change reason: %d", priv->failure_reason);
252
279
                nm_vpn_connection_set_vpn_state (connection,
253
280
                                                 NM_VPN_CONNECTION_STATE_FAILED,
254
 
                                                 NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED);
 
281
                                                                                 priv->failure_reason);
 
282
 
 
283
                /* Reset the failure reason */
 
284
                priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;
255
285
                break;
256
286
        default:
257
287
                break;
539
569
                                                 NM_VPN_DBUS_PLUGIN_INTERFACE);
540
570
        g_object_unref (dbus_mgr);
541
571
 
 
572
        dbus_g_proxy_add_signal (priv->proxy, "Failure", G_TYPE_UINT, G_TYPE_INVALID);
 
573
        dbus_g_proxy_connect_signal (priv->proxy, "Failure",
 
574
                                                                 G_CALLBACK (plugin_failed),
 
575
                                                                 connection, NULL);
 
576
 
542
577
        /* StateChanged signal */
543
578
        dbus_g_proxy_add_signal (priv->proxy, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID);
544
579
        dbus_g_proxy_connect_signal (priv->proxy, "StateChanged",