diff options
| author | Michael Biebl <biebl@debian.org> | 2016-03-01 16:55:22 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-03-01 16:55:22 +0100 |
| commit | c2de0d98ba39e0a1a970d066fd19be786092f376 (patch) | |
| tree | 3838363c06a6019db6cf1f882ea34ebded63c38b /src/nm-active-connection.c | |
| parent | 494f296a3baab08522617b24b1f126d8f9a17502 (diff) | |
Imported Upstream version 1.1.91 upstream/1.1.91
Diffstat (limited to 'src/nm-active-connection.c')
| -rw-r--r-- | src/nm-active-connection.c | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index ad6b08b3..f275b3ef 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -18,9 +18,8 @@ * Copyright (C) 2008 - 2014 Red Hat, Inc. */ -#include "config.h" - #include "nm-default.h" + #include "nm-active-connection.h" #include "nm-dbus-interface.h" #include "nm-device.h" @@ -46,6 +45,8 @@ typedef struct { char *specific_object; NMDevice *device; + guint64 version_id; + char *pending_activation_id; gboolean is_default; @@ -121,14 +122,15 @@ static void _device_cleanup (NMActiveConnection *self); /****************************************************************/ -NM_UTILS_STRING_LOOKUP_TABLE_DEFINE_STATIC (_state_to_string, NMActiveConnectionState, NULL, - [NM_ACTIVE_CONNECTION_STATE_UNKNOWN] = "unknown", - [NM_ACTIVE_CONNECTION_STATE_ACTIVATING] = "activating", - [NM_ACTIVE_CONNECTION_STATE_ACTIVATED] = "activated", - [NM_ACTIVE_CONNECTION_STATE_DEACTIVATING] = "deactivating", - [NM_ACTIVE_CONNECTION_STATE_DEACTIVATED] = "deactivated", +NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_state_to_string, NMActiveConnectionState, + NM_UTILS_LOOKUP_DEFAULT (NULL), + NM_UTILS_LOOKUP_STR_ITEM (NM_ACTIVE_CONNECTION_STATE_UNKNOWN, "unknown"), + NM_UTILS_LOOKUP_STR_ITEM (NM_ACTIVE_CONNECTION_STATE_ACTIVATING, "activating"), + NM_UTILS_LOOKUP_STR_ITEM (NM_ACTIVE_CONNECTION_STATE_ACTIVATED, "activated"), + NM_UTILS_LOOKUP_STR_ITEM (NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, "deactivating"), + NM_UTILS_LOOKUP_STR_ITEM (NM_ACTIVE_CONNECTION_STATE_DEACTIVATED, "deactivated"), ); -#define state_to_string(state) NM_UTILS_STRING_LOOKUP_TABLE (_state_to_string, state) +#define state_to_string(state) NM_UTILS_LOOKUP_STR (_state_to_string, state) /****************************************************************/ @@ -795,10 +797,45 @@ nm_active_connection_authorize (NMActiveConnection *self, /****************************************************************/ +static guint64 +_version_id_new (void) +{ + static guint64 id = 0; + + return ++id; +} + +guint64 +nm_active_connection_version_id_get (NMActiveConnection *self) +{ + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), 0); + + return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->version_id; +} + +guint64 +nm_active_connection_version_id_bump (NMActiveConnection *self) +{ + NMActiveConnectionPrivate *priv; + + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), 0); + + priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); + priv->version_id = _version_id_new (); + _LOGT ("new version-id %llu", (long long unsigned) priv->version_id); + return priv->version_id; +} + +/****************************************************************/ + static void nm_active_connection_init (NMActiveConnection *self) { + NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); + _LOGT ("creating"); + + priv->version_id = _version_id_new (); } static void @@ -809,7 +846,7 @@ constructed (GObject *object) G_OBJECT_CLASS (nm_active_connection_parent_class)->constructed (object); - _LOGD ("constructed (%s)", G_OBJECT_TYPE_NAME (self)); + _LOGD ("constructed (%s, version-id %llu)", G_OBJECT_TYPE_NAME (self), (long long unsigned) priv->version_id); g_return_if_fail (priv->subject); } |