summary refs log tree commit diff
path: root/libnm/nm-client.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2018-05-11 22:08:45 +0200
committerMichael Biebl <biebl@debian.org>2018-05-11 22:08:45 +0200
commitee9c73a923909e23a649407be77e25235d769e25 (patch)
treee21c923621fa278e737da693df9eb60ea31a6067 /libnm/nm-client.c
parentf60117b41d5433be1b4a96d82cd11d0c3dce9b63 (diff)
New upstream version 1.10.8 upstream/1.10.8
Diffstat (limited to 'libnm/nm-client.c')
-rw-r--r--libnm/nm-client.c421
1 files changed, 13 insertions, 408 deletions
diff --git a/libnm/nm-client.c b/libnm/nm-client.c
index a31a0845..4653b272 100644
--- a/libnm/nm-client.c
+++ b/libnm/nm-client.c
@@ -50,7 +50,6 @@
 
 #include "nm-access-point.h"
 #include "nm-active-connection.h"
-#include "nm-checkpoint.h"
 #include "nm-device-adsl.h"
 #include "nm-device-bond.h"
 #include "nm-device-bridge.h"
@@ -140,7 +139,6 @@ enum {
 	PROP_DNS_MODE,
 	PROP_DNS_RC_MANAGER,
 	PROP_DNS_CONFIGURATION,
-	PROP_CHECKPOINTS,
 
 	LAST_PROP
 };
@@ -2078,385 +2076,6 @@ dns_notify (GObject *object,
 	}
 }
 
-static void
-checkpoint_create_cb (GObject *object,
-                      GAsyncResult *result,
-                      gpointer user_data)
-{
-	GSimpleAsyncResult *simple = user_data;
-	NMCheckpoint *checkpoint;
-	GError *error = NULL;
-
-	checkpoint = nm_manager_checkpoint_create_finish (NM_MANAGER (object), result, &error);
-	if (checkpoint)
-		g_simple_async_result_set_op_res_gpointer (simple, checkpoint, g_object_unref);
-	else
-		g_simple_async_result_take_error (simple, error);
-
-	g_simple_async_result_complete (simple);
-	g_object_unref (simple);
-}
-
-/**
- * nm_client_get_checkpoints:
- * @client: a #NMClient
- *
- * Gets all the active checkpoints.
- *
- * Returns: (transfer none) (element-type NMCheckpoint): a #GPtrArray
- * containing all the #NMCheckpoint.  The returned array is owned by the
- * #NMClient object and should not be modified.
- *
- * Since: 1.12
- **/
-const GPtrArray *
-nm_client_get_checkpoints (NMClient *client)
-{
-	g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
-
-	if (!nm_client_get_nm_running (client))
-		return &empty;
-
-	return nm_manager_get_checkpoints (NM_CLIENT_GET_PRIVATE (client)->manager);
-}
-
-/**
- * nm_client_checkpoint_create:
- * @client: the %NMClient
- * @devices: (element-type NMDevice): a list of devices for which a
- *   checkpoint should be created.
- * @rollback_timeout: the rollback timeout in seconds
- * @flags: creation flags
- * @cancellable: a #GCancellable, or %NULL
- * @callback: (scope async): callback to be called when the add operation completes
- * @user_data: (closure): caller-specific data passed to @callback
- *
- * Creates a checkpoint of the current networking configuration
- * for given interfaces. An empty @devices argument means all
- * devices. If @rollback_timeout is not zero, a rollback is
- * automatically performed after the given timeout.
- *
- * Since: 1.12
- **/
-void
-nm_client_checkpoint_create (NMClient *client,
-                             const GPtrArray *devices,
-                             guint32 rollback_timeout,
-                             NMCheckpointCreateFlags flags,
-                             GCancellable *cancellable,
-                             GAsyncReadyCallback callback,
-                             gpointer user_data)
-{
-	GSimpleAsyncResult *simple;
-	GError *error = NULL;
-
-	g_return_if_fail (NM_IS_CLIENT (client));
-
-	if (!_nm_client_check_nm_running (client, &error)) {
-		g_simple_async_report_take_gerror_in_idle (G_OBJECT (client), callback, user_data, error);
-		return;
-	}
-
-	simple = g_simple_async_result_new (G_OBJECT (client), callback, user_data,
-	                                    nm_client_checkpoint_create);
-	if (cancellable)
-		g_simple_async_result_set_check_cancellable (simple, cancellable);
-	nm_manager_checkpoint_create (NM_CLIENT_GET_PRIVATE (client)->manager,
-	                              devices, rollback_timeout, flags,
-	                              cancellable, checkpoint_create_cb, simple);
-}
-
-/**
- * nm_client_checkpoint_create_finish:
- * @client: the #NMClient
- * @result: the result passed to the #GAsyncReadyCallback
- * @error: location for a #GError, or %NULL
- *
- * Gets the result of a call to nm_client_checkpoint_create().
- *
- * Returns: (transfer full): the new #NMCheckpoint on success, %NULL on
- *   failure, in which case @error will be set.
- *
- * Since: 1.12
- **/
-NMCheckpoint *
-nm_client_checkpoint_create_finish (NMClient *client,
-                                    GAsyncResult *result,
-                                    GError **error)
-{
-	GSimpleAsyncResult *simple;
-
-	g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
-	g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), NULL);
-
-	simple = G_SIMPLE_ASYNC_RESULT (result);
-	if (g_simple_async_result_propagate_error (simple, error))
-		return NULL;
-	else
-		return g_object_ref (g_simple_async_result_get_op_res_gpointer (simple));
-}
-
-static void
-checkpoint_destroy_cb (GObject *object,
-                       GAsyncResult *result,
-                       gpointer user_data)
-{
-	GSimpleAsyncResult *simple = user_data;
-	GError *error = NULL;
-
-	if (nm_manager_checkpoint_destroy_finish (NM_MANAGER (object), result, &error))
-		g_simple_async_result_set_op_res_gboolean (simple, TRUE);
-	else
-		g_simple_async_result_take_error (simple, error);
-
-	g_simple_async_result_complete (simple);
-	g_object_unref (simple);
-}
-
-/**
- * nm_client_checkpoint_destroy:
- * @client: the %NMClient
- * @checkpoint_path: the D-Bus path for the checkpoint
- * @cancellable: a #GCancellable, or %NULL
- * @callback: (scope async): callback to be called when the add operation completes
- * @user_data: (closure): caller-specific data passed to @callback
- *
- * Destroys an existing checkpoint without performing a rollback.
- *
- * Since: 1.12
- **/
-void
-nm_client_checkpoint_destroy (NMClient *client,
-                              const char *checkpoint_path,
-                              GCancellable *cancellable,
-                              GAsyncReadyCallback callback,
-                              gpointer user_data)
-{
-	GSimpleAsyncResult *simple;
-	GError *error = NULL;
-
-	g_return_if_fail (NM_IS_CLIENT (client));
-	g_return_if_fail (checkpoint_path && checkpoint_path[0] == '/');
-
-	if (!_nm_client_check_nm_running (client, &error)) {
-		g_simple_async_report_take_gerror_in_idle (G_OBJECT (client), callback, user_data, error);
-		return;
-	}
-
-	simple = g_simple_async_result_new (G_OBJECT (client), callback, user_data,
-	                                    nm_client_checkpoint_destroy);
-	if (cancellable)
-		g_simple_async_result_set_check_cancellable (simple, cancellable);
-	nm_manager_checkpoint_destroy (NM_CLIENT_GET_PRIVATE (client)->manager,
-	                               checkpoint_path,
-	                               cancellable, checkpoint_destroy_cb, simple);
-}
-
-/**
- * nm_client_checkpoint_destroy_finish:
- * @client: an #NMClient
- * @result: the result passed to the #GAsyncReadyCallback
- * @error: location for a #GError, or %NULL
- *
- * Gets the result of a call to nm_client_checkpoint_destroy().
- *
- * Returns: %TRUE on success or %FALSE on failure, in which case
- *   @error will be set.
- *
- * Since: 1.12
- **/
-gboolean
-nm_client_checkpoint_destroy_finish (NMClient *client,
-                                     GAsyncResult *result,
-                                     GError **error)
-{
-	GSimpleAsyncResult *simple;
-
-	g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
-
-	simple = G_SIMPLE_ASYNC_RESULT (result);
-	if (g_simple_async_result_propagate_error (simple, error))
-		return FALSE;
-	else
-		return g_simple_async_result_get_op_res_gboolean (simple);
-}
-
-static void
-checkpoint_rollback_cb (GObject *object,
-                        GAsyncResult *result,
-                        gpointer user_data)
-{
-	GSimpleAsyncResult *simple = user_data;
-	GHashTable *hash;
-	GError *error = NULL;
-
-	hash = nm_manager_checkpoint_rollback_finish (NM_MANAGER (object), result, &error);
-	if (hash)
-		g_simple_async_result_set_op_res_gpointer (simple, hash, (GDestroyNotify) g_hash_table_unref);
-	else
-		g_simple_async_result_take_error (simple, error);
-
-	g_simple_async_result_complete (simple);
-	g_object_unref (simple);
-}
-
-/**
- * nm_client_checkpoint_rollback:
- * @client: the %NMClient
- * @checkpoint_path: the D-Bus path to the checkpoint
- * @cancellable: a #GCancellable, or %NULL
- * @callback: (scope async): callback to be called when the add operation completes
- * @user_data: (closure): caller-specific data passed to @callback
- *
- * Performs the rollback of a checkpoint before the timeout is reached.
- *
- * Since: 1.12
- **/
-void
-nm_client_checkpoint_rollback (NMClient *client,
-                               const char *checkpoint_path,
-                               GCancellable *cancellable,
-                               GAsyncReadyCallback callback,
-                               gpointer user_data)
-{
-	GSimpleAsyncResult *simple;
-	GError *error = NULL;
-
-	g_return_if_fail (NM_IS_CLIENT (client));
-	g_return_if_fail (checkpoint_path && checkpoint_path[0] == '/');
-
-	if (!_nm_client_check_nm_running (client, &error)) {
-		g_simple_async_report_take_gerror_in_idle (G_OBJECT (client), callback, user_data, error);
-		return;
-	}
-
-	simple = g_simple_async_result_new (G_OBJECT (client), callback, user_data,
-	                                    nm_client_checkpoint_rollback);
-	if (cancellable)
-		g_simple_async_result_set_check_cancellable (simple, cancellable);
-	nm_manager_checkpoint_rollback (NM_CLIENT_GET_PRIVATE (client)->manager,
-	                                checkpoint_path,
-	                                cancellable, checkpoint_rollback_cb, simple);
-}
-
-/**
- * nm_client_checkpoint_rollback_finish:
- * @client: an #NMClient
- * @result: the result passed to the #GAsyncReadyCallback
- * @error: location for a #GError, or %NULL
- *
- * Gets the result of a call to nm_client_checkpoint_rollback().
- *
- * Returns: (transfer full) (element-type utf8 guint32): an hash table of
- *   devices and results. Devices are represented by their original
- *   D-Bus path; each result is a #NMRollbackResult.
- *
- * Since: 1.12
- **/
-GHashTable *
-nm_client_checkpoint_rollback_finish (NMClient *client,
-                                      GAsyncResult *result,
-                                      GError **error)
-{
-	GSimpleAsyncResult *simple;
-	GHashTable *hash;
-
-	g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
-	g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), NULL);
-
-	simple = G_SIMPLE_ASYNC_RESULT (result);
-	if (g_simple_async_result_propagate_error (simple, error))
-		return NULL;
-	else {
-		hash = g_simple_async_result_get_op_res_gpointer (simple);
-		return g_hash_table_ref (hash);
-	}
-}
-
-static void
-checkpoint_adjust_rollback_timeout_cb (GObject *object,
-                                       GAsyncResult *result,
-                                       gpointer user_data)
-{
-	gs_unref_object GSimpleAsyncResult *simple = user_data;
-	GError *error = NULL;
-
-	if (nm_manager_checkpoint_adjust_rollback_timeout_finish (NM_MANAGER (object), result, &error))
-		g_simple_async_result_set_op_res_gboolean (simple, TRUE);
-	else
-		g_simple_async_result_take_error (simple, error);
-
-	g_simple_async_result_complete (simple);
-}
-
-/**
- * nm_client_checkpoint_adjust_rollback_timeout:
- * @client: the %NMClient
- * @checkpoint_path: a D-Bus path to a checkpoint
- * @add_timeout: the timeout in seconds counting from now.
- *   Set to zero, to disable the timeout.
- * @cancellable: a #GCancellable, or %NULL
- * @callback: (scope async): callback to be called when the add operation completes
- * @user_data: (closure): caller-specific data passed to @callback
- *
- * Resets the timeout for the checkpoint with path @checkpoint_path
- * to @timeout_add.
- *
- * Since: 1.12
- **/
-void
-nm_client_checkpoint_adjust_rollback_timeout (NMClient *client,
-                                              const char *checkpoint_path,
-                                              guint32 add_timeout,
-                                              GCancellable *cancellable,
-                                              GAsyncReadyCallback callback,
-                                              gpointer user_data)
-{
-	GSimpleAsyncResult *simple;
-	GError *error = NULL;
-
-	g_return_if_fail (NM_IS_CLIENT (client));
-	g_return_if_fail (checkpoint_path && checkpoint_path[0] == '/');
-
-	if (!_nm_client_check_nm_running (client, &error)) {
-		g_simple_async_report_take_gerror_in_idle (G_OBJECT (client), callback, user_data, error);
-		return;
-	}
-
-	simple = g_simple_async_result_new (G_OBJECT (client), callback, user_data,
-	                                    nm_client_checkpoint_rollback);
-	if (cancellable)
-		g_simple_async_result_set_check_cancellable (simple, cancellable);
-	nm_manager_checkpoint_adjust_rollback_timeout (NM_CLIENT_GET_PRIVATE (client)->manager,
-	                                               checkpoint_path, add_timeout,
-	                                               cancellable, checkpoint_adjust_rollback_timeout_cb, simple);
-}
-
-/**
- * nm_client_checkpoint_adjust_rollback_timeout_finish:
- * @client: an #NMClient
- * @result: the result passed to the #GAsyncReadyCallback
- * @error: location for a #GError, or %NULL
- *
- * Gets the result of a call to nm_client_checkpoint_adjust_rollback_timeout().
- *
- * Returns: %TRUE on success or %FALSE on failure.
- *
- * Since: 1.12
- **/
-gboolean
-nm_client_checkpoint_adjust_rollback_timeout_finish (NMClient *client,
-                                                     GAsyncResult *result,
-                                                     GError **error)
-{
-	g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
-
-	return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
-	                                               error);
-}
-
 /****************************************************************/
 /* Object Initialization                                        */
 /****************************************************************/
@@ -2587,8 +2206,6 @@ obj_nm_for_gdbus_object (NMClient *self, GDBusObject *object, GDBusObjectManager
 			type = NM_TYPE_VPN_CONNECTION;
 		else if (strcmp (ifname, NM_DBUS_INTERFACE_WIMAX_NSP) == 0)
 			type = NM_TYPE_WIMAX_NSP;
-		else if (strcmp (ifname, NM_DBUS_INTERFACE_CHECKPOINT) == 0)
-			type = NM_TYPE_CHECKPOINT;
 
 		if (type != G_TYPE_INVALID)
 			break;
@@ -3166,12 +2783,6 @@ get_property (GObject *object, guint prop_id,
 	case PROP_ALL_DEVICES:
 		g_value_take_boxed (value, _nm_utils_copy_object_array (nm_client_get_all_devices (self)));
 		break;
-	case PROP_CHECKPOINTS:
-		if (priv->manager)
-			g_object_get_property (G_OBJECT (priv->manager), pspec->name, value);
-		else
-			g_value_take_boxed (value, g_ptr_array_new ());
-		break;
 
 	/* Settings properties. */
 	case PROP_CONNECTIONS:
@@ -3365,9 +2976,11 @@ nm_client_class_init (NMClientClass *client_class)
 		                       G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * NMClient:active-connections: (type GPtrArray(NMActiveConnection))
+	 * NMClient:active-connections:
 	 *
 	 * The active connections.
+	 *
+	 * Element-type: NMActiveConnection
 	 **/
 	g_object_class_install_property
 		(object_class, PROP_ACTIVE_CONNECTIONS,
@@ -3444,9 +3057,11 @@ nm_client_class_init (NMClientClass *client_class)
 		                      G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * NMClient:devices: (type GPtrArray(NMDevice))
+	 * NMClient:devices:
 	 *
 	 * List of real network devices.  Does not include placeholder devices.
+	 *
+	 * Element-type: NMDevice
 	 **/
 	g_object_class_install_property
 		(object_class, PROP_DEVICES,
@@ -3456,9 +3071,11 @@ nm_client_class_init (NMClientClass *client_class)
 		                     G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * NMClient:all-devices: (type GPtrArray(NMDevice))
+	 * NMClient:all-devices:
 	 *
 	 * List of both real devices and device placeholders.
+	 *
+	 * Element-type: NMDevice
 	 * Since: 1.2
 	 **/
 	g_object_class_install_property
@@ -3469,12 +3086,14 @@ nm_client_class_init (NMClientClass *client_class)
 		                     G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * NMClient:connections: (type GPtrArray(NMRemoteConnection))
+	 * NMClient:connections:
 	 *
 	 * The list of configured connections that are available to the user. (Note
 	 * that this differs from the underlying D-Bus property, which may also
 	 * contain the object paths of connections that the user does not have
 	 * permission to read the details of.)
+	 *
+	 * Element-type: NMRemoteConnection
 	 */
 	g_object_class_install_property
 		(object_class, PROP_CONNECTIONS,
@@ -3551,7 +3170,7 @@ nm_client_class_init (NMClientClass *client_class)
 		                      G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * NMClient:dns-configuration: (type GPtrArray(GVariant))
+	 * NMClient:dns-configuration:
 	 *
 	 * The current DNS configuration represented as an array of
 	 * dictionaries.  Each dictionary has the "nameservers",
@@ -3570,20 +3189,6 @@ nm_client_class_init (NMClientClass *client_class)
 		                     G_PARAM_READABLE |
 		                     G_PARAM_STATIC_STRINGS));
 
-	/**
-	 * NMClient:checkpoints: (type GPtrArray(NMCheckpoint))
-	 *
-	 * The list of active checkpoints.
-	 *
-	 * Since: 1.12
-	 */
-	g_object_class_install_property
-		(object_class, PROP_CHECKPOINTS,
-		 g_param_spec_boxed (NM_MANAGER_CHECKPOINTS, "", "",
-		                     G_TYPE_PTR_ARRAY,
-		                     G_PARAM_READABLE |
-		                     G_PARAM_STATIC_STRINGS));
-
 	/* signals */
 
 	/**