libnm-core, libnm, core: make NMConnection an interface

The fact that NMRemoteConnection has to be an NMConnection and
therefore can't be an NMObject means that it needs to reimplement bits
of NMObject functionality (and likewise NMObject needs some special
magic to deal with it). Likewise, we will need a daemon-side
equivalent of NMObject as part of the gdbus port, and we would want
NMSettingsConnection to be able to inherit from this as well.

Solve this problem by making NMConnection into an interface, and
having NMRemoteConnection and NMSettingsConnection implement it. (We
use some hacks to keep the GHashTable of NMSettings objects inside
nm-connection.c rather than having to be implemented by the
implementations.)

Since NMConnection is no longer an instantiable type, this adds
NMSimpleConnection to replace the various non-D-Bus-based uses of
NMConnection throughout the code. nm_connection_new() becomes
nm_simple_connection_new(), nm_connection_new_from_hash() becomes
nm_simple_connection_new_from_hash(), and nm_connection_duplicate()
becomes nm_simple_connection_new_clone().
This commit is contained in:
Dan Winship 2014-08-13 14:34:29 -04:00
parent 5ed054aca9
commit e1ba13a426
45 changed files with 455 additions and 401 deletions

View file

@ -156,7 +156,7 @@ parse_main (GKeyFile *kf,
if (id == NULL)
return FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
s_con = (NMSettingConnection *) nm_setting_connection_new ();
g_assert (s_con);

View file

@ -5252,7 +5252,7 @@ do_connection_add (NmCli *nmc, int argc, char **argv)
}
/* Create a new connection object */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Build up the 'connection' setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -7889,7 +7889,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
/* Duplicate the connection and use that so that we need not
* differentiate existing vs. new later
*/
connection = nm_connection_duplicate (found_con);
connection = nm_simple_connection_new_clone (found_con);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
@ -7926,7 +7926,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
g_free (tmp_str);
/* Create a new connection object */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Build up the 'connection' setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();

View file

@ -2256,7 +2256,7 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
/* If there are some connection data from user, create a connection and
* fill them into proper settings. */
if (con_name || private || bssid2_arr || password)
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
if (con_name || private) {
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -2291,7 +2291,7 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
if (password) {
if (!connection)
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wsec));

View file

@ -345,7 +345,7 @@ nm_editor_utils_create_connection (GType type,
return NULL;
}
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
nm_connection_add_setting (connection, NM_SETTING (s_con));

View file

@ -183,7 +183,7 @@ build_edit_connection (NMConnection *orig_connection)
const char *setting_name;
NmtSyncOp op;
edit_connection = nm_connection_duplicate (orig_connection);
edit_connection = nm_simple_connection_new_clone (orig_connection);
if (!NM_IS_REMOTE_CONNECTION (orig_connection))
return edit_connection;

View file

@ -46,7 +46,7 @@ add_connection (DBusGProxy *proxy, const char *con_name)
GError *error = NULL;
/* Create a new connection object */
connection = (NMConnection *) nm_connection_new ();
connection = (NMConnection *) nm_simple_connection_new ();
/* Build up the 'connection' Setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();

View file

@ -62,7 +62,7 @@ add_connection (NMRemoteSettings *settings, GMainLoop *loop, const char *con_nam
gboolean success;
/* Create a new connection object */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Build up the 'connection' Setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();

View file

@ -66,7 +66,7 @@ print_connection (DBusGConnection *bus, const char *path)
/* Using the raw configuration, create an NMConnection object for it. This
* step also verifies that the data we got from NetworkManager are valid. */
connection = nm_connection_new_from_hash (hash, &error);
connection = nm_simple_connection_new_from_hash (hash, &error);
if (!connection) {
g_warning ("Received invalid connection data: %s", error->message);
g_error_free (error);

View file

@ -680,7 +680,7 @@ nmtst_ip6_config_clone (NMIP6Config *config)
#endif
#ifdef __NM_CONNECTION_H__
#ifdef __NM_SIMPLE_CONNECTION_H__
inline static NMConnection *
nmtst_create_minimal_connection (const char *id, const char *uuid, const char *type, NMSettingConnection **out_s_con)
@ -706,7 +706,7 @@ nmtst_create_minimal_connection (const char *id, const char *uuid, const char *t
g_assert (NM_IS_SETTING (s_base));
}
con = nm_connection_new ();
con = nm_simple_connection_new ();
s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
g_object_set (s_con,

View file

@ -37,6 +37,7 @@ libnm_core_headers = \
$(core)/nm-setting-wireless-security.h \
$(core)/nm-setting-wireless.h \
$(core)/nm-setting.h \
$(core)/nm-simple-connection.h \
$(core)/nm-utils.h \
$(core)/nm-vpn-dbus-interface.h
@ -78,6 +79,7 @@ libnm_core_sources = \
$(core)/nm-setting-wireless-security.c \
$(core)/nm-setting-wireless.c \
$(core)/nm-setting.c \
$(core)/nm-simple-connection.c \
$(core)/nm-utils.c \
$(core)/nm-value-transforms.c

View file

@ -92,22 +92,18 @@ nm_connection_error_quark (void)
}
typedef struct {
NMConnection *self;
GHashTable *settings;
/* D-Bus path of the connection, if any */
char *path;
} NMConnectionPrivate;
#define NM_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_CONNECTION, NMConnectionPrivate))
static NMConnectionPrivate *nm_connection_get_private (NMConnection *connection);
#define NM_CONNECTION_GET_PRIVATE(o) (nm_connection_get_private ((NMConnection *)o))
G_DEFINE_TYPE (NMConnection, nm_connection, G_TYPE_OBJECT)
enum {
PROP_0,
PROP_PATH,
LAST_PROP
};
G_DEFINE_INTERFACE (NMConnection, nm_connection, G_TYPE_OBJECT)
enum {
SECRETS_UPDATED,
@ -1368,78 +1364,6 @@ nm_connection_get_virtual_iface_name (NMConnection *connection)
return nm_setting_get_virtual_iface_name (base);
}
/**
* nm_connection_new:
*
* Creates a new #NMConnection object with no #NMSetting objects.
*
* Returns: the new empty #NMConnection object
**/
NMConnection *
nm_connection_new (void)
{
return (NMConnection *) g_object_new (NM_TYPE_CONNECTION, NULL);
}
/**
* nm_connection_new_from_hash:
* @hash: (element-type utf8 GLib.HashTable): the #GHashTable describing
* the connection
* @error: on unsuccessful return, an error
*
* Creates a new #NMConnection from a hash table describing the connection. See
* nm_connection_to_hash() for a description of the expected hash table.
*
* Returns: the new #NMConnection object, populated with settings created
* from the values in the hash table, or %NULL if the connection failed to
* validate
**/
NMConnection *
nm_connection_new_from_hash (GHashTable *hash, GError **error)
{
NMConnection *connection;
g_return_val_if_fail (hash != NULL, NULL);
if (!validate_permissions_type (hash, error))
return NULL;
connection = nm_connection_new ();
if (!hash_to_connection (connection, hash, error)) {
g_object_unref (connection);
return NULL;
}
return connection;
}
/**
* nm_connection_duplicate:
* @connection: the #NMConnection to duplicate
*
* Duplicates a #NMConnection.
*
* Returns: (transfer full): a new #NMConnection containing the same settings and properties
* as the source #NMConnection
**/
NMConnection *
nm_connection_duplicate (NMConnection *connection)
{
NMConnection *dup;
GHashTableIter iter;
NMSetting *setting;
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
dup = nm_connection_new ();
nm_connection_set_path (dup, nm_connection_get_path (connection));
g_hash_table_iter_init (&iter, NM_CONNECTION_GET_PRIVATE (connection)->settings);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &setting))
nm_connection_add_setting (dup, nm_setting_duplicate (setting));
return dup;
}
/**
* nm_connection_get_uuid:
* @connection: the #NMConnection
@ -1965,103 +1889,41 @@ nm_connection_get_setting_vlan (NMConnection *connection)
/*************************************************************/
static void
nm_connection_init (NMConnection *connection)
nm_connection_private_free (NMConnectionPrivate *priv)
{
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection);
priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
}
static void
dispose (GObject *object)
{
NMConnection *self = NM_CONNECTION (object);
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (self);
NMConnection *self = priv->self;
GHashTableIter iter;
NMSetting *setting;
g_hash_table_iter_init (&iter, priv->settings);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &setting)) {
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &setting))
g_signal_handlers_disconnect_by_func (setting, setting_changed_cb, self);
g_hash_table_iter_remove (&iter);
}
G_OBJECT_CLASS (nm_connection_parent_class)->dispose (object);
}
static void
finalize (GObject *object)
{
NMConnection *connection = NM_CONNECTION (object);
NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection);
g_hash_table_destroy (priv->settings);
g_free (priv->path);
G_OBJECT_CLASS (nm_connection_parent_class)->finalize (object);
g_slice_free (NMConnectionPrivate, priv);
}
static void
set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
static NMConnectionPrivate *
nm_connection_get_private (NMConnection *connection)
{
NMConnection *connection = NM_CONNECTION (object);
NMConnectionPrivate *priv;
switch (prop_id) {
case PROP_PATH:
nm_connection_set_path (connection, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
priv = g_object_get_data (G_OBJECT (connection), "NMConnectionPrivate");
if (!priv) {
priv = g_slice_new0 (NMConnectionPrivate);
g_object_set_data_full (G_OBJECT (connection), "NMConnectionPrivate",
priv, (GDestroyNotify) nm_connection_private_free);
priv->self = connection;
priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
}
return priv;
}
static void
get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
nm_connection_default_init (NMConnectionInterface *iface)
{
NMConnection *connection = NM_CONNECTION (object);
switch (prop_id) {
case PROP_PATH:
g_value_set_string (value, nm_connection_get_path (connection));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
nm_connection_class_init (NMConnectionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (NMConnectionPrivate));
/* virtual methods */
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->dispose = dispose;
object_class->finalize = finalize;
/* Properties */
/**
* NMConnection:path:
*
* The connection's D-Bus path, used only by the calling process as a record
* of the D-Bus path of the connection as provided by a settings service.
**/
g_object_class_install_property
(object_class, PROP_PATH,
g_param_spec_string (NM_CONNECTION_PATH, "", "",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
/* Signals */
/**
@ -2075,9 +1937,9 @@ nm_connection_class_init (NMConnectionClass *klass)
*/
signals[SECRETS_UPDATED] =
g_signal_new (NM_CONNECTION_SECRETS_UPDATED,
G_OBJECT_CLASS_TYPE (object_class),
NM_TYPE_CONNECTION,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionClass, secrets_updated),
G_STRUCT_OFFSET (NMConnectionInterface, secrets_updated),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1,
@ -2092,9 +1954,9 @@ nm_connection_class_init (NMConnectionClass *klass)
*/
signals[SECRETS_CLEARED] =
g_signal_new (NM_CONNECTION_SECRETS_CLEARED,
G_OBJECT_CLASS_TYPE (object_class),
NM_TYPE_CONNECTION,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionClass, secrets_cleared),
G_STRUCT_OFFSET (NMConnectionInterface, secrets_cleared),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@ -2109,9 +1971,9 @@ nm_connection_class_init (NMConnectionClass *klass)
*/
signals[CHANGED] =
g_signal_new (NM_CONNECTION_CHANGED,
G_OBJECT_CLASS_TYPE (object_class),
NM_TYPE_CONNECTION,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionClass, changed),
G_STRUCT_OFFSET (NMConnectionInterface, changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);

View file

@ -60,21 +60,16 @@
G_BEGIN_DECLS
#define NM_TYPE_CONNECTION (nm_connection_get_type ())
#define NM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION, NMConnection))
#define NM_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CONNECTION, NMConnectionClass))
#define NM_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION))
#define NM_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONNECTION))
#define NM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONNECTION, NMConnectionClass))
#define NM_TYPE_CONNECTION (nm_connection_get_type ())
#define NM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION, NMConnection))
#define NM_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION))
#define NM_CONNECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_CONNECTION, NMConnectionClass))
/* Signals */
#define NM_CONNECTION_SECRETS_UPDATED "secrets-updated"
#define NM_CONNECTION_SECRETS_CLEARED "secrets-cleared"
#define NM_CONNECTION_CHANGED "changed"
/* Properties */
#define NM_CONNECTION_PATH "path"
/**
* NMConnectionError:
* @NM_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error
@ -115,15 +110,13 @@ GQuark nm_connection_error_quark (void);
/**
* NMConnection:
*
* The NMConnection struct contains only private data.
* It should only be accessed through the functions described below.
* NMConnection is the interface implemented by #NMRemoteConnection on the
* client side, and #NMSettingsConnection on the daemon side.
*/
typedef struct {
GObject parent;
} NMConnection;
typedef struct _NMConnection NMConnection;
typedef struct {
GObjectClass parent;
GTypeInterface parent;
/* Signals */
void (*secrets_updated) (NMConnection *connection,
@ -131,18 +124,10 @@ typedef struct {
void (*secrets_cleared) (NMConnection *connection);
void (*changed) (NMConnection *connection);
/*< private >*/
gpointer padding[8];
} NMConnectionClass;
} NMConnectionInterface;
GType nm_connection_get_type (void);
NMConnection *nm_connection_new (void);
NMConnection *nm_connection_new_from_hash (GHashTable *hash, GError **error);
NMConnection *nm_connection_duplicate (NMConnection *connection);
void nm_connection_add_setting (NMConnection *connection,
NMSetting *setting);

View file

@ -0,0 +1,110 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2007 - 2008 Novell, Inc.
* Copyright 2007 - 2014 Red Hat, Inc.
*/
#include "nm-simple-connection.h"
static void nm_simple_connection_interface_init (NMConnectionInterface *iface);
G_DEFINE_TYPE_WITH_CODE (NMSimpleConnection, nm_simple_connection, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_simple_connection_interface_init);
)
static void
nm_simple_connection_init (NMSimpleConnection *self)
{
}
/**
* nm_simple_connection_new:
*
* Creates a new #NMSimpleConnection object with no #NMSetting objects. An
* #NMSimpleConnection does not directly represent a D-Bus-exported connection,
* but might be used in the process of creating a new one.
*
* Returns: (transfer full): the new empty #NMConnection object
**/
NMConnection *
nm_simple_connection_new (void)
{
return (NMConnection *) g_object_new (NM_TYPE_SIMPLE_CONNECTION, NULL);
}
/**
* nm_simple_connection_new_from_hash:
* @hash: (element-type utf8 GLib.HashTable): the #GHashTable describing
* the connection
* @error: on unsuccessful return, an error
*
* Creates a new #NMSimpleConnection from a hash table describing the
* connection. See nm_connection_to_hash() for a description of the expected
* hash table.
*
* Returns: (transfer full): the new #NMSimpleConnection object, populated with
* settings created from the values in the hash table, or %NULL if the
* connection failed to validate
**/
NMConnection *
nm_simple_connection_new_from_hash (GHashTable *hash, GError **error)
{
NMConnection *connection;
g_return_val_if_fail (hash != NULL, NULL);
connection = nm_simple_connection_new ();
if (!nm_connection_replace_settings (connection, hash, error)) {
g_object_unref (connection);
return NULL;
}
return connection;
}
/**
* nm_simple_connection_new_clone:
* @connection: the #NMConnection to clone
*
* Clones an #NMConnection as an #NMSimpleConnection.
*
* Returns: (transfer full): a new #NMConnection containing the same settings
* and properties as the source #NMConnection
**/
NMConnection *
nm_simple_connection_new_clone (NMConnection *connection)
{
NMConnection *clone;
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
clone = nm_simple_connection_new ();
nm_connection_set_path (clone, nm_connection_get_path (connection));
nm_connection_replace_settings_from_connection (clone, connection, NULL);
return clone;
}
static void
nm_simple_connection_class_init (NMSimpleConnectionClass *simple_class)
{
}
static void
nm_simple_connection_interface_init (NMConnectionInterface *iface)
{
}

View file

@ -0,0 +1,61 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2014 Red Hat, Inc.
*/
#ifndef __NM_SIMPLE_CONNECTION_H__
#define __NM_SIMPLE_CONNECTION_H__
#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <nm-connection.h>
G_BEGIN_DECLS
#define NM_TYPE_SIMPLE_CONNECTION (nm_simple_connection_get_type ())
#define NM_SIMPLE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SIMPLE_CONNECTION, NMSimpleConnection))
#define NM_SIMPLE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SIMPLE_CONNECTION, NMSimpleConnectionClass))
#define NM_IS_SIMPLE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SIMPLE_CONNECTION))
#define NM_IS_SIMPLE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SIMPLE_CONNECTION))
#define NM_SIMPLE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SIMPLE_CONNECTION, NMSimpleConnectionClass))
typedef struct {
GObject parent;
} NMSimpleConnection;
typedef struct {
GObjectClass parent_class;
/*< private >*/
gpointer padding[4];
} NMSimpleConnectionClass;
GType nm_simple_connection_get_type (void);
NMConnection *nm_simple_connection_new (void);
NMConnection *nm_simple_connection_new_from_hash (GHashTable *hash,
GError **error);
NMConnection *nm_simple_connection_new_clone (NMConnection *connection);
G_END_DECLS
#endif /* __NM_SIMPLE_CONNECTION__ */

View file

@ -32,6 +32,7 @@
#include <linux/if_infiniband.h>
#include "nm-connection.h"
#include "nm-simple-connection.h"
#include "nm-core-enum-types.h"
G_BEGIN_DECLS

View file

@ -191,7 +191,7 @@ test_setting_vpn_update_secrets (void)
const char *val1 = "value1";
const char *val2 = "value2";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
ASSERT (connection != NULL,
"vpn-update-secrets",
"error creating connection");
@ -755,7 +755,7 @@ test_connection_to_hash_setting_name (void)
NMSettingWirelessSecurity *s_wsec;
GHashTable *hash;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_wsec = make_test_wsec_setting ("connection-to-hash-setting-name");
nm_connection_add_setting (connection, NM_SETTING (s_wsec));
@ -799,7 +799,7 @@ new_test_connection (void)
char *uuid;
guint64 timestamp = time (NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
setting = nm_setting_connection_new ();
uuid = nm_utils_uuid_generate ();
@ -944,7 +944,7 @@ test_connection_replace_settings_from_connection ()
connection = new_test_connection ();
g_assert (connection);
replacement = nm_connection_new ();
replacement = nm_simple_connection_new ();
g_assert (replacement);
/* New connection setting */
@ -1006,7 +1006,7 @@ test_connection_new_from_hash ()
g_assert (new_settings);
/* Replace settings and test */
connection = nm_connection_new_from_hash (new_settings, &error);
connection = nm_simple_connection_new_from_hash (new_settings, &error);
g_assert_no_error (error);
g_assert (connection);
@ -1264,7 +1264,7 @@ test_connection_compare_same (void)
NMConnection *a, *b;
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
g_assert (nm_connection_compare (a, b, NM_SETTING_COMPARE_FLAG_EXACT));
g_object_unref (a);
g_object_unref (b);
@ -1277,7 +1277,7 @@ test_connection_compare_key_only_in_a (void)
NMSettingConnection *s_con;
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
s_con = (NMSettingConnection *) nm_connection_get_setting (b, NM_TYPE_SETTING_CONNECTION);
g_assert (s_con);
g_object_set (s_con, NM_SETTING_CONNECTION_TIMESTAMP, (guint64) 0, NULL);
@ -1293,7 +1293,7 @@ test_connection_compare_setting_only_in_a (void)
NMConnection *a, *b;
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
nm_connection_remove_setting (b, NM_TYPE_SETTING_IP4_CONFIG);
g_assert (!nm_connection_compare (a, b, NM_SETTING_COMPARE_FLAG_EXACT));
g_object_unref (a);
@ -1307,7 +1307,7 @@ test_connection_compare_key_only_in_b (void)
NMSettingConnection *s_con;
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
s_con = (NMSettingConnection *) nm_connection_get_setting (b, NM_TYPE_SETTING_CONNECTION);
g_assert (s_con);
g_object_set (s_con, NM_SETTING_CONNECTION_TIMESTAMP, (guint64) 0, NULL);
@ -1323,7 +1323,7 @@ test_connection_compare_setting_only_in_b (void)
NMConnection *a, *b;
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
nm_connection_remove_setting (a, NM_TYPE_SETTING_IP4_CONFIG);
g_assert (!nm_connection_compare (a, b, NM_SETTING_COMPARE_FLAG_EXACT));
g_object_unref (a);
@ -1448,7 +1448,7 @@ test_connection_diff_same (void)
gboolean same;
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
same = nm_connection_diff (a, b, NM_SETTING_COMPARE_FLAG_EXACT, &out_diffs);
g_assert (same == TRUE);
@ -1472,7 +1472,7 @@ test_connection_diff_different (void)
};
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
s_ip4 = nm_connection_get_setting_ip4_config (a);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
@ -1512,7 +1512,7 @@ test_connection_diff_no_secrets (void)
NULL);
nm_connection_add_setting (a, s_pppoe);
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
/* Add a secret to B */
s_pppoe = NM_SETTING (nm_connection_get_setting_pppoe (b));
@ -1557,7 +1557,7 @@ test_connection_diff_inferrable (void)
};
a = new_test_connection ();
b = nm_connection_duplicate (a);
b = nm_simple_connection_new_clone (a);
/* Change the UUID, wired MTU, and set ignore-auto-dns */
s_con = nm_connection_get_setting_connection (a);
@ -1636,7 +1636,7 @@ test_connection_good_base_types (void)
const guint8 bdaddr[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
/* Try a basic wired connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_WIRED_SETTING_NAME);
setting = nm_setting_wired_new ();
nm_connection_add_setting (connection, setting);
@ -1647,7 +1647,7 @@ test_connection_good_base_types (void)
g_object_unref (connection);
/* Try a wired PPPoE connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_PPPOE_SETTING_NAME);
setting = nm_setting_pppoe_new ();
g_object_set (setting, NM_SETTING_PPPOE_USERNAME, "bob smith", NULL);
@ -1659,7 +1659,7 @@ test_connection_good_base_types (void)
g_object_unref (connection);
/* Wifi connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_WIRELESS_SETTING_NAME);
setting = nm_setting_wireless_new ();
@ -1678,7 +1678,7 @@ test_connection_good_base_types (void)
g_object_unref (connection);
/* Bluetooth connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_BLUETOOTH_SETTING_NAME);
setting = nm_setting_bluetooth_new ();
@ -1697,7 +1697,7 @@ test_connection_good_base_types (void)
g_object_unref (connection);
/* WiMAX connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_WIMAX_SETTING_NAME);
setting = nm_setting_wimax_new ();
g_object_set (setting, NM_SETTING_WIMAX_NETWORK_NAME, "CLEAR", NULL);
@ -1709,7 +1709,7 @@ test_connection_good_base_types (void)
g_object_unref (connection);
/* GSM connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_GSM_SETTING_NAME);
setting = nm_setting_gsm_new ();
@ -1720,7 +1720,7 @@ test_connection_good_base_types (void)
nm_connection_add_setting (connection, setting);
/* CDMA connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_CDMA_SETTING_NAME);
setting = nm_setting_cdma_new ();
@ -1749,7 +1749,7 @@ test_connection_bad_base_types (void)
*/
/* Connection setting */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_CONNECTION_SETTING_NAME);
setting = nm_setting_wired_new ();
nm_connection_add_setting (connection, setting);
@ -1761,7 +1761,7 @@ test_connection_bad_base_types (void)
g_clear_error (&error);
/* PPP setting */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_PPP_SETTING_NAME);
setting = nm_setting_wired_new ();
nm_connection_add_setting (connection, setting);
@ -1775,7 +1775,7 @@ test_connection_bad_base_types (void)
g_clear_error (&error);
/* Serial setting */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_SERIAL_SETTING_NAME);
setting = nm_setting_wired_new ();
nm_connection_add_setting (connection, setting);
@ -1789,7 +1789,7 @@ test_connection_bad_base_types (void)
g_clear_error (&error);
/* IP4 setting */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_IP4_CONFIG_SETTING_NAME);
setting = nm_setting_wired_new ();
nm_connection_add_setting (connection, setting);
@ -1801,7 +1801,7 @@ test_connection_bad_base_types (void)
g_clear_error (&error);
/* IP6 setting */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
add_generic_settings (connection, NM_SETTING_IP6_CONFIG_SETTING_NAME);
setting = nm_setting_wired_new ();
nm_connection_add_setting (connection, setting);
@ -2118,7 +2118,7 @@ test_setting_connection_changed_signal (void)
NMSettingConnection *s_con;
char *uuid;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2154,7 +2154,7 @@ test_setting_bond_changed_signal (void)
gboolean changed = FALSE;
NMSettingBond *s_bond;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2179,7 +2179,7 @@ test_setting_ip4_changed_signal (void)
NMIP4Address *addr;
NMIP4Route *route;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2250,7 +2250,7 @@ test_setting_ip6_changed_signal (void)
NMIP6Route *route;
const struct in6_addr t = { { { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 } } };
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2319,7 +2319,7 @@ test_setting_vlan_changed_signal (void)
gboolean changed = FALSE;
NMSettingVlan *s_vlan;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2354,7 +2354,7 @@ test_setting_vpn_changed_signal (void)
gboolean changed = FALSE;
NMSettingVpn *s_vpn;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2381,7 +2381,7 @@ test_setting_wired_changed_signal (void)
gboolean changed = FALSE;
NMSettingWired *s_wired;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2404,7 +2404,7 @@ test_setting_wireless_changed_signal (void)
gboolean changed = FALSE;
NMSettingWireless *s_wifi;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2425,7 +2425,7 @@ test_setting_wireless_security_changed_signal (void)
gboolean changed = FALSE;
NMSettingWirelessSecurity *s_wsec;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2480,7 +2480,7 @@ test_setting_802_1x_changed_signal (void)
gboolean changed = FALSE;
NMSetting8021x *s_8021x;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_signal_connect (connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
@ -2573,7 +2573,7 @@ test_connection_verify_sets_interface_name (void)
NM_SETTING_BOND_INTERFACE_NAME, "bond-x",
NULL);
con = nm_connection_new ();
con = nm_simple_connection_new ();
nm_connection_add_setting (con, NM_SETTING (s_con));
nm_connection_add_setting (con, NM_SETTING (s_bond));
@ -2604,7 +2604,7 @@ test_connection_normalize_virtual_iface_name (void)
const char *IFACE_VIRT = "iface-X";
gboolean modified = FALSE;
con = nm_connection_new ();
con = nm_simple_connection_new ();
setting = nm_setting_ip4_config_new ();
g_object_set (setting,

View file

@ -66,7 +66,7 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme)
gboolean success;
GError *error = NULL;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -232,7 +232,7 @@ make_tls_phase2_connection (const char *detail, NMSetting8021xCKScheme scheme)
gboolean success;
GError *error = NULL;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -401,7 +401,7 @@ wifi_connection_new (void)
char *uuid;
GByteArray *ssid;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */

View file

@ -79,6 +79,7 @@
#include <nm-setting-wireless-security.h>
#include <nm-setting-wireless.h>
#include <nm-setting.h>
#include <nm-simple-connection.h>
#include <nm-types.h>
#include <nm-utils.h>
#include <nm-version.h>

View file

@ -78,7 +78,6 @@ global:
nm_connection_compare;
nm_connection_diff;
nm_connection_dump;
nm_connection_duplicate;
nm_connection_error_get_type;
nm_connection_error_quark;
nm_connection_for_each_setting_value;
@ -120,8 +119,6 @@ global:
nm_connection_get_virtual_iface_name;
nm_connection_is_type;
nm_connection_need_secrets;
nm_connection_new;
nm_connection_new_from_hash;
nm_connection_normalize;
nm_connection_remove_setting;
nm_connection_replace_settings;
@ -867,6 +864,10 @@ global:
nm_setting_wireless_security_remove_proto;
nm_setting_wireless_security_remove_proto_by_value;
nm_setting_wireless_security_set_wep_key;
nm_simple_connection_get_type;
nm_simple_connection_new;
nm_simple_connection_new_clone;
nm_simple_connection_new_from_hash;
nm_ssid_get_type;
nm_state_get_type;
nm_string_array_get_type;

View file

@ -33,10 +33,12 @@
#include "nm-glib-compat.h"
#include "nm-dbus-helpers-private.h"
static void nm_remote_connection_connection_iface_init (NMConnectionInterface *iface);
static void nm_remote_connection_initable_iface_init (GInitableIface *iface);
static void nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_CONNECTION,
G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_remote_connection_connection_iface_init);
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_remote_connection_initable_iface_init);
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_remote_connection_async_initable_iface_init);
)
@ -44,6 +46,7 @@ G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_CONNE
enum {
PROP_0,
PROP_DBUS_CONNECTION,
PROP_PATH,
PROP_UNSAVED,
PROP_VISIBLE,
@ -689,6 +692,9 @@ get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
switch (prop_id) {
case PROP_PATH:
g_value_set_string (value, nm_connection_get_path (NM_CONNECTION (object)));
break;
case PROP_UNSAVED:
g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->unsaved);
break;
@ -712,6 +718,10 @@ set_property (GObject *object, guint prop_id,
/* Construct only */
priv->bus = g_value_dup_boxed (value);
break;
case PROP_PATH:
/* Construct only */
nm_connection_set_path (NM_CONNECTION (object), g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -766,6 +776,19 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* NMRemoteConnection:path:
*
* The D-Bus path of the connection that the #NMRemoteConnection represents.
*/
g_object_class_install_property
(object_class, PROP_PATH,
g_param_spec_string (NM_REMOTE_CONNECTION_PATH, "", "",
NULL,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* NMRemoteConnection:unsaved:
*
@ -798,6 +821,11 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
G_PARAM_STATIC_STRINGS));
}
static void
nm_remote_connection_connection_iface_init (NMConnectionInterface *iface)
{
}
static void
nm_remote_connection_initable_iface_init (GInitableIface *iface)
{

View file

@ -56,15 +56,16 @@ GQuark nm_remote_connection_error_quark (void);
/* Properties */
#define NM_REMOTE_CONNECTION_DBUS_CONNECTION "dbus-connection"
#define NM_REMOTE_CONNECTION_PATH "path"
#define NM_REMOTE_CONNECTION_UNSAVED "unsaved"
#define NM_REMOTE_CONNECTION_VISIBLE "visible"
typedef struct {
NMConnection parent;
GObject parent;
} NMRemoteConnection;
typedef struct {
NMConnectionClass parent_class;
GObjectClass parent_class;
/*< private >*/
gpointer padding[8];

View file

@ -81,7 +81,7 @@
* char *uuid;
* gboolean success;
*
* connection = nm_connection_new ();
* connection = nm_simple_connection_new ();
*
* /&ast; Build up the 'connection' setting &ast;/
* s_con = (NMSettingConnection *) nm_setting_connection_new ();

View file

@ -27,6 +27,7 @@
#include "nm-secret-agent.h"
#include "nm-enum-types.h"
#include "nm-dbus-helpers-private.h"
#include "nm-simple-connection.h"
static void impl_secret_agent_get_secrets (NMSecretAgent *self,
GHashTable *connection_hash,
@ -329,7 +330,7 @@ verify_request (NMSecretAgent *self,
/* Make sure the given connection is valid */
g_assert (out_connection);
connection = nm_connection_new_from_hash (connection_hash, &local);
connection = nm_simple_connection_new_from_hash (connection_hash, &local);
if (connection) {
nm_connection_set_path (connection, connection_path);
*out_connection = connection;

View file

@ -28,7 +28,6 @@
#include "nm-vpn-plugin.h"
#include "nm-vpn-enum-types.h"
#include "nm-utils.h"
#include "nm-connection.h"
#include "nm-dbus-glib-types.h"
static gboolean impl_vpn_plugin_connect (NMVpnPlugin *plugin,
@ -452,7 +451,7 @@ _connect_generic (NMVpnPlugin *plugin,
return FALSE;
}
connection = nm_connection_new_from_hash (properties, &local);
connection = nm_simple_connection_new_from_hash (properties, &local);
if (!connection) {
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
"Invalid connection: (%d) %s",
@ -526,7 +525,7 @@ impl_vpn_plugin_need_secrets (NMVpnPlugin *plugin,
g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE);
g_return_val_if_fail (properties != NULL, FALSE);
connection = nm_connection_new_from_hash (properties, &cnfh_err);
connection = nm_simple_connection_new_from_hash (properties, &cnfh_err);
if (!connection) {
g_set_error (err,
NM_VPN_PLUGIN_ERROR,
@ -581,7 +580,7 @@ impl_vpn_plugin_new_secrets (NMVpnPlugin *plugin,
return FALSE;
}
connection = nm_connection_new_from_hash (properties, &local);
connection = nm_simple_connection_new_from_hash (properties, &local);
if (!connection) {
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
"Invalid connection: (%d) %s",

View file

@ -26,11 +26,7 @@
#include <sys/types.h>
#include <signal.h>
#include "nm-dbus-interface.h"
#include "nm-client.h"
#include "nm-device-wifi.h"
#include "nm-device-ethernet.h"
#include "nm-device-wimax.h"
#include <NetworkManager.h>
#include "nm-glib-compat.h"
#include "common.h"

View file

@ -26,12 +26,8 @@
#include <sys/types.h>
#include <signal.h>
#include <nm-dbus-interface.h>
#include <nm-setting-connection.h>
#include <nm-setting-wired.h>
#include <nm-utils.h>
#include <NetworkManager.h>
#include "nm-remote-settings.h"
#include "common.h"
#include "nm-test-utils.h"

View file

@ -185,7 +185,7 @@ pan_connection_check_create (NMBluezDevice *self)
/* create a new connection */
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Setting: Connection */
uuid = nm_utils_uuid_generate ();

View file

@ -1704,7 +1704,7 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master)
return NULL;
}
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_con = nm_setting_connection_new ();
uuid = nm_utils_uuid_generate ();

View file

@ -225,7 +225,7 @@ create_basic (const char *ssid,
NMSettingWireless *s_wifi = NULL;
GByteArray *tmp;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wifi));
@ -265,7 +265,7 @@ test_lock_bssid (void)
gboolean success;
GError *error = NULL;
src = nm_connection_new ();
src = nm_simple_connection_new ();
success = complete_connection (ssid, bssid,
NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
@ -293,7 +293,7 @@ test_open_ap_empty_connection (void)
* SSID and Infra modes of the given AP details.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
success = complete_connection (ssid, bssid,
NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
@ -322,7 +322,7 @@ test_open_ap_leap_connection_1 (gconstpointer add_wifi)
* the AP to have the Privacy bit set.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
if (add_wifi)
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
@ -353,7 +353,7 @@ test_open_ap_leap_connection_2 (void)
* WEP or LEAP) is rejected when completion is attempted with an open AP.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
@ -387,7 +387,7 @@ test_open_ap_wep_connection (gconstpointer add_wifi)
* attempted with an open AP.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
if (add_wifi)
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
@ -428,7 +428,7 @@ test_ap_wpa_psk_connection_base (const char *key_mgmt,
gboolean success;
GError *error = NULL;
src = nm_connection_new ();
src = nm_simple_connection_new ();
if (add_wifi)
fill_wifi_empty (src);
fill_wsec (src, both_wsec);
@ -534,7 +534,7 @@ test_ap_wpa_eap_connection_base (const char *key_mgmt,
gboolean success;
GError *error = NULL;
src = nm_connection_new ();
src = nm_simple_connection_new ();
if (add_wifi)
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
@ -743,7 +743,7 @@ test_priv_ap_empty_connection (void)
* connection when completed with an AP with the Privacy bit set.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
success = complete_connection (ssid, bssid,
NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_SEC_NONE, NM_802_11_AP_SEC_NONE,
@ -785,7 +785,7 @@ test_priv_ap_leap_connection_1 (gconstpointer add_wifi)
* with an AP with the Privacy bit set.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
if (add_wifi)
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
@ -824,7 +824,7 @@ test_priv_ap_leap_connection_2 (void)
* with an AP with the Privacy bit set.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
success = complete_connection ("blahblah", bssid,
@ -867,7 +867,7 @@ test_priv_ap_dynamic_wep_1 (void)
* Dynamic WEP connection when completed with an AP with the Privacy bit set.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
fill_8021x (src, both_8021x);
@ -914,7 +914,7 @@ test_priv_ap_dynamic_wep_2 (void)
* WEP connection when completed with an AP with the Privacy bit set.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
fill_8021x (src, both_8021x);
@ -955,7 +955,7 @@ test_priv_ap_dynamic_wep_3 (void)
* setting is rejected, as 802.1x is incompatible with 'shared' auth.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
fill_8021x (src, src_8021x);
@ -1066,7 +1066,7 @@ test_wpa_ap_empty_connection (gconstpointer data)
* or RSN flags.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
success = complete_connection (ssid, bssid,
NM_802_11_MODE_INFRA, NM_802_11_AP_FLAGS_PRIVACY,
wpa_flags_for_idx (idx),
@ -1103,7 +1103,7 @@ test_wpa_ap_leap_connection_1 (gconstpointer data)
* rejected since WPA APs (usually) do not support LEAP.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
success = complete_connection (ssid, bssid,
@ -1137,7 +1137,7 @@ test_wpa_ap_leap_connection_2 (gconstpointer data)
* rejected since WPA APs (usually) do not support LEAP.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
success = complete_connection ("blahblah", bssid,
@ -1170,7 +1170,7 @@ test_wpa_ap_dynamic_wep_connection (gconstpointer data)
* rejected since WPA APs (usually) do not support Dynamic WEP.
*/
src = nm_connection_new ();
src = nm_simple_connection_new ();
fill_wifi_empty (src);
fill_wsec (src, src_wsec);
success = complete_connection ("blahblah", bssid,
@ -1197,7 +1197,7 @@ test_wpa_ap_wpa_psk_connection_1 (gconstpointer data)
{ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
{ NULL } };
expected = nm_connection_new ();
expected = nm_simple_connection_new ();
fill_wsec (expected, exp_wsec);
test_ap_wpa_psk_connection_base (NULL, NULL,
NM_802_11_AP_FLAGS_PRIVACY,
@ -1217,7 +1217,7 @@ test_wpa_ap_wpa_psk_connection_2 (gconstpointer data)
{ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
{ NULL } };
expected = nm_connection_new ();
expected = nm_simple_connection_new ();
fill_wsec (expected, exp_wsec);
test_ap_wpa_psk_connection_base (NULL, NULL,
NM_802_11_AP_FLAGS_PRIVACY,
@ -1237,7 +1237,7 @@ test_wpa_ap_wpa_psk_connection_3 (gconstpointer data)
{ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
{ NULL } };
expected = nm_connection_new ();
expected = nm_simple_connection_new ();
fill_wsec (expected, exp_wsec);
test_ap_wpa_psk_connection_base (NULL, "open",
NM_802_11_AP_FLAGS_PRIVACY,
@ -1268,7 +1268,7 @@ test_wpa_ap_wpa_psk_connection_5 (gconstpointer data)
{ NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open", 0 },
{ NULL } };
expected = nm_connection_new ();
expected = nm_simple_connection_new ();
fill_wsec (expected, exp_wsec);
test_ap_wpa_psk_connection_base ("wpa-psk", "open",
NM_802_11_AP_FLAGS_PRIVACY,

View file

@ -3395,7 +3395,7 @@ impl_manager_add_and_activate_connection (NMManager *self,
* specific data being in the connection till then (especially in
* validate_activation_request()).
*/
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
if (settings && g_hash_table_size (settings))
nm_connection_replace_settings (connection, settings, NULL);

View file

@ -39,6 +39,7 @@
#include "nm-auth-subject.h"
#include "nm-dbus-manager.h"
#include "nm-session-monitor.h"
#include "nm-simple-connection.h"
G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, G_TYPE_OBJECT)
@ -907,7 +908,7 @@ get_agent_request_secrets (ConnectionRequest *req, gboolean include_system_secre
Request *parent = (Request *) req;
NMConnection *tmp;
tmp = nm_connection_duplicate (req->connection);
tmp = nm_simple_connection_new_clone (req->connection);
nm_connection_clear_secrets (tmp);
if (include_system_secrets) {
if (req->existing_secrets)
@ -1091,7 +1092,7 @@ get_start (gpointer user_data)
* ask a secret agent for more. This allows admins to provide generic
* secrets but allow additional user-specific ones as well.
*/
tmp = nm_connection_duplicate (req->connection);
tmp = nm_simple_connection_new_clone (req->connection);
g_assert (tmp);
if (!nm_connection_update_secrets (tmp, req->setting_name, req->existing_secrets, &error)) {

View file

@ -34,6 +34,7 @@
#include "nm-glib-compat.h"
#include "nm-logging.h"
#include "nm-auth-subject.h"
#include "nm-simple-connection.h"
G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT)

View file

@ -68,7 +68,11 @@ static void impl_settings_connection_get_secrets (NMSettingsConnection *connecti
#include "nm-settings-connection-glue.h"
G_DEFINE_TYPE (NMSettingsConnection, nm_settings_connection, NM_TYPE_CONNECTION)
static void nm_settings_connection_connection_interface_init (NMConnectionInterface *iface);
G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_settings_connection_connection_interface_init)
)
#define NM_SETTINGS_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
NM_TYPE_SETTINGS_CONNECTION, \
@ -355,7 +359,7 @@ update_system_secrets_cache (NMSettingsConnection *self)
if (priv->system_secrets)
g_object_unref (priv->system_secrets);
priv->system_secrets = nm_connection_duplicate (NM_CONNECTION (self));
priv->system_secrets = nm_simple_connection_new_clone (NM_CONNECTION (self));
/* Clear out non-system-owned and not-saved secrets */
nm_connection_clear_secrets_with_flags (priv->system_secrets,
@ -371,7 +375,7 @@ update_agent_secrets_cache (NMSettingsConnection *self, NMConnection *new)
if (priv->agent_secrets)
g_object_unref (priv->agent_secrets);
priv->agent_secrets = nm_connection_duplicate (new ? new : NM_CONNECTION (self));
priv->agent_secrets = nm_simple_connection_new_clone (new ? new : NM_CONNECTION (self));
/* Clear out non-system-owned secrets */
nm_connection_clear_secrets_with_flags (priv->agent_secrets,
@ -634,7 +638,7 @@ do_delete (NMSettingsConnection *connection,
set_visible (connection, FALSE);
/* Tell agents to remove secrets for this connection */
for_agents = nm_connection_duplicate (NM_CONNECTION (connection));
for_agents = nm_simple_connection_new_clone (NM_CONNECTION (connection));
nm_connection_clear_secrets (for_agents);
nm_agent_manager_delete_secrets (priv->agent_mgr, for_agents);
g_object_unref (for_agents);
@ -1137,7 +1141,7 @@ get_settings_auth_cb (NMSettingsConnection *self,
guint64 timestamp = 0;
GSList *bssid_list;
dupl_con = nm_connection_duplicate (NM_CONNECTION (self));
dupl_con = nm_simple_connection_new_clone (NM_CONNECTION (self));
g_assert (dupl_con);
/* Timestamp is not updated in connection's 'timestamp' property,
@ -1242,7 +1246,7 @@ con_update_cb (NMSettingsConnection *self,
* as agent-owned secrets are the only ones we send back be saved.
* Only send secrets to agents of the same UID that called update too.
*/
for_agent = nm_connection_duplicate (NM_CONNECTION (self));
for_agent = nm_simple_connection_new_clone (NM_CONNECTION (self));
nm_connection_clear_secrets_with_flags (for_agent,
secrets_filter_cb,
GUINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED));
@ -1341,7 +1345,7 @@ impl_settings_connection_update_helper (NMSettingsConnection *self,
/* Check if the settings are valid first */
if (new_settings) {
tmp = nm_connection_new_from_hash (new_settings, &error);
tmp = nm_simple_connection_new_from_hash (new_settings, &error);
if (!tmp) {
g_assert (error);
goto error;
@ -2174,3 +2178,9 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
G_TYPE_FROM_CLASS (class),
&dbus_glib_nm_settings_connection_object_info);
}
static void
nm_settings_connection_connection_interface_init (NMConnectionInterface *iface)
{
}

View file

@ -60,11 +60,11 @@ typedef void (*NMSettingsConnectionDeleteFunc) (NMSettingsConnection *connection
gpointer user_data);
struct _NMSettingsConnection {
NMConnection parent;
GObject parent;
};
struct _NMSettingsConnectionClass {
NMConnectionClass parent;
GObjectClass parent;
/* virtual methods */
void (*commit_changes) (NMSettingsConnection *connection,

View file

@ -997,7 +997,7 @@ send_agent_owned_secrets (NMSettings *self,
* as agent-owned secrets are the only ones we send back to be saved.
* Only send secrets to agents of the same UID that called update too.
*/
for_agent = nm_connection_duplicate (NM_CONNECTION (connection));
for_agent = nm_simple_connection_new_clone (NM_CONNECTION (connection));
nm_connection_clear_secrets_with_flags (for_agent,
secrets_filter_cb,
GUINT_TO_POINTER (NM_SETTING_SECRET_FLAG_AGENT_OWNED));
@ -1223,14 +1223,14 @@ impl_settings_add_connection_helper (NMSettings *self,
NMConnection *connection;
GError *error = NULL;
connection = nm_connection_new_from_hash (settings, &error);
connection = nm_simple_connection_new_from_hash (settings, &error);
if (connection) {
nm_settings_add_connection_dbus (self,
connection,
save_to_disk,
context,
impl_settings_add_connection_add_cb,
NULL);
connection,
save_to_disk,
context,
impl_settings_add_connection_add_cb,
NULL);
g_object_unref (connection);
} else {
g_assert (error);
@ -1609,10 +1609,8 @@ nm_settings_device_added (NMSettings *self, NMDevice *device)
if (!hw_address)
return;
connection = nm_connection_new ();
g_assert (connection);
connection = nm_simple_connection_new ();
setting = nm_setting_connection_new ();
g_assert (setting);
nm_connection_add_setting (connection, setting);
defname = nm_settings_utils_get_default_wired_name (priv->connections);

View file

@ -3756,7 +3756,7 @@ wireless_connection_from_ifcfg (const char *file,
g_return_val_if_fail (error != NULL, NULL);
g_return_val_if_fail (*error == NULL, NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Wireless */
wireless_setting = make_wireless_setting (ifcfg, error);
@ -3997,7 +3997,7 @@ wired_connection_from_ifcfg (const char *file,
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
con_setting = make_connection_setting (file, ifcfg, NM_SETTING_WIRED_SETTING_NAME, NULL, NULL);
if (!con_setting) {
@ -4163,7 +4163,7 @@ infiniband_connection_from_ifcfg (const char *file,
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
con_setting = make_connection_setting (file, ifcfg, NM_SETTING_INFINIBAND_SETTING_NAME, NULL, NULL);
if (!con_setting) {
@ -4280,7 +4280,7 @@ bond_connection_from_ifcfg (const char *file,
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
con_setting = make_connection_setting (file, ifcfg, NM_SETTING_BOND_SETTING_NAME, NULL, _("Bond"));
if (!con_setting) {
@ -4391,7 +4391,7 @@ team_connection_from_ifcfg (const char *file,
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
con_setting = make_connection_setting (file, ifcfg, NM_SETTING_TEAM_SETTING_NAME, NULL, _("Team"));
if (!con_setting) {
@ -4586,7 +4586,7 @@ bridge_connection_from_ifcfg (const char *file,
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
con_setting = make_connection_setting (file, ifcfg, NM_SETTING_BRIDGE_SETTING_NAME, NULL, _("Bridge"));
if (!con_setting) {
@ -4885,7 +4885,7 @@ vlan_connection_from_ifcfg (const char *file,
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
con_setting = make_connection_setting (file, ifcfg, NM_SETTING_VLAN_SETTING_NAME, NULL, "Vlan");
if (!con_setting) {
@ -4939,7 +4939,7 @@ create_unhandled_connection (const char *filename, shvarFile *ifcfg,
g_assert (out_spec != NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Get NAME, UUID, etc. We need to set a connection type (generic) and add
* an empty type-specific setting as well, to make sure it passes

View file

@ -6116,7 +6116,7 @@ test_write_wifi_hidden (void)
GByteArray *ssid;
const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 };
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -6740,7 +6740,7 @@ test_write_wired_static (void)
inet_pton (AF_INET6, "fade:0102:0103::face", &dns6_1);
inet_pton (AF_INET6, "cafe:ffff:eeee:dddd:cccc:bbbb:aaaa:feed", &dns6_2);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -6933,7 +6933,7 @@ test_write_wired_dhcp (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -7162,7 +7162,7 @@ test_write_wired_static_ip6_only (void)
inet_pton (AF_INET6, "1003:1234:abcd::1", &ip6);
inet_pton (AF_INET6, "fade:0102:0103::face", &dns6);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -7310,7 +7310,7 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data)
if (gateway6)
inet_ntop (AF_INET6, gateway6, s_gateway6, sizeof (s_gateway6));
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -7611,7 +7611,7 @@ test_write_wired_static_routes (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -7766,7 +7766,7 @@ test_write_wired_dhcp_8021x_peap_mschapv2 (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -7924,7 +7924,7 @@ test_write_wired_8021x_tls (NMSetting8021xCKScheme scheme,
const char *pw;
char *tmp;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection != NULL);
/* Connection setting */
@ -8142,7 +8142,7 @@ test_write_wired_aliases (void)
shvarFile *ifcfg;
int i, j;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
ASSERT (connection != NULL,
"wired-aliases-write", "failed to allocate new connection");
@ -8335,7 +8335,7 @@ test_write_gateway (void)
struct in_addr ip1, ip2, gw1, gw2;
const guint32 prefix = 24;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -8490,7 +8490,7 @@ test_write_wifi_open (void)
shvarFile *ifcfg;
char *tmp;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -8633,7 +8633,7 @@ test_write_wifi_open_hex_ssid (void)
GByteArray *ssid;
const unsigned char ssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd };
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -8750,7 +8750,7 @@ test_write_wifi_wep (void)
const unsigned char ssid_data[] = "blahblah";
struct stat statbuf;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -8898,7 +8898,7 @@ test_write_wifi_wep_adhoc (void)
const guint32 dns1 = htonl (0x04020201);
const guint32 prefix = 24;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -9044,7 +9044,7 @@ test_write_wifi_wep_passphrase (void)
const unsigned char ssid_data[] = "blahblah";
struct stat statbuf;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -9185,7 +9185,7 @@ test_write_wifi_wep_40_ascii (void)
const unsigned char ssid_data[] = "blahblah40";
struct stat statbuf;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -9328,7 +9328,7 @@ test_write_wifi_wep_104_ascii (void)
const unsigned char ssid_data[] = "blahblah104";
struct stat statbuf;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -9471,7 +9471,7 @@ test_write_wifi_leap (void)
const unsigned char ssid_data[] = "blahblah";
struct stat statbuf;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -9610,7 +9610,7 @@ test_write_wifi_leap_secret_flags (NMSettingSecretFlags flags)
GByteArray *ssid;
const unsigned char ssid_data[] = "blahblah";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -9753,7 +9753,7 @@ test_write_wifi_wpa_psk (const char *name,
g_return_if_fail (psk != NULL);
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -9904,7 +9904,7 @@ test_write_wifi_wpa_psk_adhoc (void)
const guint32 dns1 = htonl (0x04020201);
const guint32 prefix = 24;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -10049,7 +10049,7 @@ test_write_wifi_wpa_eap_tls (void)
GByteArray *ssid;
const char *ssid_data = "blahblah";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -10215,7 +10215,7 @@ test_write_wifi_wpa_eap_ttls_tls (void)
GByteArray *ssid;
const char *ssid_data = "blahblah";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -10399,7 +10399,7 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void)
GByteArray *ssid;
const char *ssid_data = "blahblah";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -10558,7 +10558,7 @@ test_write_wifi_wpa_then_open (void)
* config doesn't leave various WPA-related keys lying around in the ifcfg.
*/
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -10752,7 +10752,7 @@ test_write_wifi_wpa_then_wep_with_perms (void)
* config works and doesn't cause infinite loop or other issues.
*/
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -10956,7 +10956,7 @@ test_write_wifi_dynamic_wep_leap (void)
shvarFile *ifcfg;
char *tmp;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -11501,7 +11501,7 @@ test_write_wired_qeth_dhcp (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -11628,7 +11628,7 @@ test_write_wired_ctc_dhcp (void)
shvarFile *ifcfg;
char *tmp;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -11761,7 +11761,7 @@ test_write_permissions (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -11877,7 +11877,7 @@ test_write_wifi_wep_agent_keys (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection != NULL);
/* Connection setting */
@ -12011,7 +12011,7 @@ test_write_wired_pppoe (void)
GError *error = NULL;
char *testfile = NULL;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -12079,7 +12079,7 @@ test_write_vpn (void)
GError *error = NULL;
char *testfile = NULL;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -12144,7 +12144,7 @@ test_write_mobile_broadband (gboolean gsm)
GError *error = NULL;
char *testfile = NULL;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -12290,7 +12290,7 @@ test_write_bridge_main (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -12458,7 +12458,7 @@ test_write_bridge_component (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -12901,7 +12901,7 @@ test_write_ethernet_missing_ipv6 (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -13080,7 +13080,7 @@ test_write_bond_main (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -13253,7 +13253,7 @@ test_write_bond_slave (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -13444,7 +13444,7 @@ test_write_infiniband (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -13621,7 +13621,7 @@ test_write_bond_slave_ib (void)
char *route6file = NULL;
gboolean ignore_error = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -13793,7 +13793,7 @@ test_write_dcb_basic (void)
const guint traffic_classes[8] = { 3, 4, 7, 2, 1, 0, 5, 6 };
const gboolean pfcs[8] = { TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE };
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_con = (NMSettingConnection *) nm_setting_connection_new ();
nm_connection_add_setting (connection, NM_SETTING (s_con));
@ -14066,7 +14066,7 @@ test_write_fcoe_mode (gconstpointer user_data)
gboolean success, ignore_error;
char *uuid, *testfile;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_con = (NMSettingConnection *) nm_setting_connection_new ();
nm_connection_add_setting (connection, NM_SETTING (s_con));
@ -14189,7 +14189,7 @@ test_write_team_master (void)
const char *escaped_expected_config = "\"{ \\\"device\\\": \\\"team0\\\", \\\"link_watch\\\": { \\\"name\\\": \\\"ethtool\\\" } }\"";
shvarFile *f;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -14309,7 +14309,7 @@ test_write_team_port (void)
const char *escaped_expected_config = "\"{ \\\"p4p1\\\": { \\\"prio\\\": -10, \\\"sticky\\\": true } }\"";
shvarFile *f;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();

View file

@ -1618,7 +1618,7 @@ ifnet_update_connection_from_config_block (const char *conn_name,
gchar *id, *uuid;
gboolean success = FALSE;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
setting = nm_connection_get_setting_connection (connection);
if (!setting) {
setting = NM_SETTING_CONNECTION (nm_setting_connection_new ());

View file

@ -481,7 +481,7 @@ test17_read_static_ipv4 (const char *path)
init_ifparser_with_file (path, file);
block = ifparser_getfirst ();
connection = nm_connection_new();
connection = nm_simple_connection_new();
ifupdown_update_connection_from_if_block(connection, block, &error);
ASSERT (connection != NULL,
@ -659,7 +659,7 @@ test18_read_static_ipv6 (const char *path)
init_ifparser_with_file (path, file);
block = ifparser_getfirst ();
connection = nm_connection_new();
connection = nm_simple_connection_new();
ifupdown_update_connection_from_if_block(connection, block, &error);
ASSERT (connection != NULL,
@ -853,7 +853,7 @@ test19_read_static_ipv4_plen (const char *path)
init_ifparser_with_file (path, file);
block = ifparser_getfirst ();
connection = nm_connection_new();
connection = nm_simple_connection_new();
ifupdown_update_connection_from_if_block(connection, block, &error);
ASSERT (connection != NULL,

View file

@ -1259,7 +1259,7 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
if (!g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, error))
goto out;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
groups = g_key_file_get_groups (key_file, &length);
for (i = 0; i < length; i++) {

View file

@ -561,7 +561,7 @@ test_write_wired_connection (void)
const char *route6_4_nh = "::";
guint64 timestamp = 0x12345678L;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
@ -799,7 +799,7 @@ test_write_ip6_wired_connection (void)
const char *address = "abcd::beef";
const char *gw = "dcba::beef";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
@ -1177,7 +1177,7 @@ test_write_wireless_connection (void)
uid_t owner_uid;
guint64 timestamp = 0x12344433L;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
@ -1314,7 +1314,7 @@ test_write_string_ssid (void)
uid_t owner_uid;
GKeyFile *keyfile;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
@ -1438,7 +1438,7 @@ test_write_intlist_ssid (void)
gint *intlist;
gsize len = 0, i;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -1594,7 +1594,7 @@ test_write_intlike_ssid (void)
GKeyFile *keyfile;
char *tmp;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -1682,7 +1682,7 @@ test_write_intlike_ssid_2 (void)
GKeyFile *keyfile;
char *tmp;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -1929,7 +1929,7 @@ test_write_bt_dun_connection (void)
uid_t owner_uid;
guint64 timestamp = 0x12344433L;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
@ -2175,7 +2175,7 @@ test_write_gsm_connection (void)
uid_t owner_uid;
guint64 timestamp = 0x12344433L;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
@ -2508,7 +2508,7 @@ create_wired_tls_connection (NMSetting8021xCKScheme scheme)
gboolean success;
GError *error = NULL;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection != NULL);
/* Connection setting */
@ -2819,7 +2819,7 @@ test_write_infiniband_connection (void)
pid_t owner_grp;
uid_t owner_uid;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -2947,7 +2947,7 @@ test_write_bridge_main (void)
pid_t owner_grp;
uid_t owner_uid;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -3079,7 +3079,7 @@ test_write_bridge_component (void)
pid_t owner_grp;
uid_t owner_uid;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -3190,7 +3190,7 @@ test_write_new_wired_group_name (void)
char *s;
gint mtu;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
g_assert (connection);
/* Connection setting */
@ -3306,7 +3306,7 @@ test_write_new_wireless_group_names (void)
GKeyFile *kf;
char *s;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */

View file

@ -21,7 +21,7 @@
#include <glib.h>
#include <glib-object.h>
#include <nm-connection.h>
#include <nm-simple-connection.h>
#include <nm-setting-connection.h>
#include "nm-settings-utils.h"
@ -31,7 +31,7 @@ _new_connection (const char *id)
NMConnection *a;
NMSetting *setting;
a = nm_connection_new ();
a = nm_simple_connection_new ();
setting = nm_setting_connection_new ();
g_object_set (setting, NM_SETTING_CONNECTION_ID, id, NULL);
nm_connection_add_setting (a, setting);

View file

@ -126,7 +126,7 @@ test_wifi_open (void)
const unsigned char bssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
const char *bssid_str = "11:22:33:44:55:66";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -227,7 +227,7 @@ test_wifi_wep_key (const char *detail,
const unsigned char bssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
const char *bssid_str = "11:22:33:44:55:66";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();
@ -370,7 +370,7 @@ test_wifi_wpa_psk (const char *detail,
const unsigned char bssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
const char *bssid_str = "11:22:33:44:55:66";
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
/* Connection setting */
s_con = (NMSettingConnection *) nm_setting_connection_new ();

View file

@ -238,7 +238,7 @@ _match_connection_new (void)
NMSettingIP6Config *s_ip6;
char *uuid;
connection = nm_connection_new ();
connection = nm_simple_connection_new ();
s_con = (NMSettingConnection *) nm_setting_connection_new ();
nm_connection_add_setting (connection, (NMSetting *) s_con);
@ -277,7 +277,7 @@ test_connection_match_basic (void)
NMSettingIP4Config *s_ip4;
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
matched = nm_utils_match_connection (connections, orig, TRUE, NULL, NULL);
@ -305,7 +305,7 @@ test_connection_match_ip6_method (void)
NMSettingIP6Config *s_ip6;
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
/* Check that if the generated connection is IPv6 method=link-local, and the
@ -341,7 +341,7 @@ test_connection_match_ip6_method_ignore (void)
NMSettingIP6Config *s_ip6;
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
/* Check that if the generated connection is IPv6 method=link-local, and the
@ -375,7 +375,7 @@ test_connection_match_ip6_method_ignore_auto (void)
NMSettingIP6Config *s_ip6;
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
/* Check that if the generated connection is IPv6 method=auto, and the
@ -410,7 +410,7 @@ test_connection_match_ip4_method (void)
NMSettingIP4Config *s_ip4;
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
/* Check that if the generated connection is IPv4 method=disabled, and the
@ -450,7 +450,7 @@ test_connection_match_interface_name (void)
NMSettingConnection *s_con;
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
/* Check that if the generated connection has an interface name and the
@ -490,7 +490,7 @@ test_connection_match_wired (void)
g_ptr_array_add (subchan_arr, "0.0.8002");
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
mac = nm_utils_hwaddr_atoba ("52:54:00:ab:db:23", ETH_ALEN);
@ -531,7 +531,7 @@ test_connection_no_match_ip4_addr (void)
guint32 addr, gw;
orig = _match_connection_new ();
copy = nm_connection_duplicate (orig);
copy = nm_simple_connection_new_clone (orig);
connections = g_slist_append (connections, copy);
/* Check that if we have two differences, ipv6.method (exception we allow) and

View file

@ -1468,7 +1468,7 @@ _hash_with_username (NMConnection *connection, const char *username)
if (username == NULL || existing)
return nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
dup = nm_connection_duplicate (connection);
dup = nm_simple_connection_new_clone (connection);
g_assert (dup);
s_vpn = nm_connection_get_setting_vpn (dup);
g_assert (s_vpn);