mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 16:00:12 +01:00
Make NMConnection an interface, and NMRemoteConnection an NMObject (bgo #734746)
This commit is contained in:
commit
9a9c2f4f84
53 changed files with 554 additions and 707 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -1539,7 +1539,7 @@ nmc_setting_new_for_name (const char *name)
|
|||
NMSetting *setting = NULL;
|
||||
|
||||
if (name) {
|
||||
stype = nm_connection_lookup_setting_type (name);
|
||||
stype = nm_setting_lookup_type (name);
|
||||
if (stype != G_TYPE_INVALID) {
|
||||
setting = g_object_new (stype, NULL);
|
||||
g_warn_if_fail (NM_IS_SETTING (setting));
|
||||
|
|
@ -7225,7 +7225,7 @@ setting_details (NMSetting *setting, NmCli *nmc, const char *one_prop)
|
|||
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
|
||||
|
||||
while (iter->sname) {
|
||||
if (nm_connection_lookup_setting_type (iter->sname) == G_OBJECT_TYPE (setting))
|
||||
if (nm_setting_lookup_type (iter->sname) == G_OBJECT_TYPE (setting))
|
||||
return iter->func (setting, nmc, one_prop);
|
||||
iter++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ nm_editor_utils_create_connection (GType type,
|
|||
master_s_con = nm_connection_get_setting_connection (master);
|
||||
master_setting_type = nm_setting_connection_get_connection_type (master_s_con);
|
||||
master_uuid = nm_setting_connection_get_uuid (master_s_con);
|
||||
master_type = nm_connection_lookup_setting_type (master_setting_type);
|
||||
master_type = nm_setting_lookup_type (master_setting_type);
|
||||
}
|
||||
|
||||
types = nm_editor_utils_get_connection_type_list ();
|
||||
|
|
@ -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));
|
||||
|
|
@ -401,7 +401,7 @@ nm_editor_utils_get_connection_type_data (NMConnection *conn)
|
|||
g_return_val_if_fail (s_con != NULL, NULL);
|
||||
|
||||
conn_type = nm_setting_connection_get_connection_type (s_con);
|
||||
conn_gtype = nm_connection_lookup_setting_type (conn_type);
|
||||
conn_gtype = nm_setting_lookup_type (conn_type);
|
||||
g_return_val_if_fail (conn_gtype != G_TYPE_INVALID, NULL);
|
||||
|
||||
types = nm_editor_utils_get_connection_type_list ();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -698,7 +698,7 @@ nmtst_create_minimal_connection (const char *id, const char *uuid, const char *t
|
|||
uuid = uuid_free = nm_utils_uuid_generate ();
|
||||
|
||||
if (type) {
|
||||
GType type_g = nm_connection_lookup_setting_type (type);
|
||||
GType type_g = nm_setting_lookup_type (type);
|
||||
|
||||
g_assert (type_g != G_TYPE_INVALID);
|
||||
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -124,58 +120,6 @@ static NMSettingVerifyResult _nm_connection_verify (NMConnection *connection, GE
|
|||
|
||||
/*************************************************************/
|
||||
|
||||
/**
|
||||
* nm_connection_lookup_setting_type:
|
||||
* @name: a setting name
|
||||
*
|
||||
* Returns the #GType of the setting's class for a given setting name.
|
||||
*
|
||||
* Returns: the #GType of the setting's class
|
||||
**/
|
||||
GType
|
||||
nm_connection_lookup_setting_type (const char *name)
|
||||
{
|
||||
return _nm_setting_lookup_setting_type (name);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_lookup_setting_type_by_quark:
|
||||
* @error_quark: a setting error quark
|
||||
*
|
||||
* Returns the #GType of the setting's class for a given setting error quark.
|
||||
* Useful for figuring out which setting a returned error is for.
|
||||
*
|
||||
* Returns: the #GType of the setting's class
|
||||
**/
|
||||
GType
|
||||
nm_connection_lookup_setting_type_by_quark (GQuark error_quark)
|
||||
{
|
||||
return _nm_setting_lookup_setting_type_by_quark (error_quark);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_create_setting:
|
||||
* @name: a setting name
|
||||
*
|
||||
* Create a new #NMSetting object of the desired type, given a setting name.
|
||||
*
|
||||
* Returns: (transfer full): the new setting object, or %NULL if the setting name was unknown
|
||||
**/
|
||||
NMSetting *
|
||||
nm_connection_create_setting (const char *name)
|
||||
{
|
||||
GType type;
|
||||
NMSetting *setting = NULL;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
type = nm_connection_lookup_setting_type (name);
|
||||
if (type)
|
||||
setting = (NMSetting *) g_object_new (type, NULL);
|
||||
|
||||
return setting;
|
||||
}
|
||||
|
||||
static void
|
||||
setting_changed_cb (NMSetting *setting,
|
||||
GParamSpec *pspec,
|
||||
|
|
@ -282,7 +226,7 @@ nm_connection_get_setting_by_name (NMConnection *connection, const char *name)
|
|||
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
type = nm_connection_lookup_setting_type (name);
|
||||
type = nm_setting_lookup_type (name);
|
||||
|
||||
return type ? nm_connection_get_setting (connection, type) : NULL;
|
||||
}
|
||||
|
|
@ -350,7 +294,7 @@ hash_to_connection (NMConnection *connection, GHashTable *new, GError **error)
|
|||
|
||||
g_hash_table_iter_init (&iter, new);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer) &setting_name, (gpointer) &setting_hash)) {
|
||||
GType type = nm_connection_lookup_setting_type (setting_name);
|
||||
GType type = nm_setting_lookup_type (setting_name);
|
||||
|
||||
if (type) {
|
||||
NMSetting *setting = nm_setting_new_from_hash (type, setting_hash);
|
||||
|
|
@ -987,7 +931,7 @@ nm_connection_update_secrets (NMConnection *connection,
|
|||
*/
|
||||
g_hash_table_iter_init (&iter, secrets);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL)) {
|
||||
if (_nm_setting_lookup_setting_type (key) != G_TYPE_INVALID) {
|
||||
if (nm_setting_lookup_type (key) != G_TYPE_INVALID) {
|
||||
/* @secrets looks like a hashed connection */
|
||||
hashed_connection = TRUE;
|
||||
break;
|
||||
|
|
@ -1420,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
|
||||
|
|
@ -2017,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 */
|
||||
|
||||
/**
|
||||
|
|
@ -2127,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,
|
||||
|
|
@ -2144,9 +1954,10 @@ 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,
|
||||
0, NULL, NULL,
|
||||
G_STRUCT_OFFSET (NMConnectionInterface, secrets_cleared),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
|
|
@ -2160,9 +1971,10 @@ 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,
|
||||
0, NULL, NULL,
|
||||
G_STRUCT_OFFSET (NMConnectionInterface, changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,33 +110,24 @@ 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, const char * setting);
|
||||
void (*secrets_updated) (NMConnection *connection,
|
||||
const char *setting);
|
||||
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);
|
||||
|
||||
NMSetting *nm_connection_create_setting (const char *name);
|
||||
|
||||
void nm_connection_add_setting (NMConnection *connection,
|
||||
NMSetting *setting);
|
||||
|
||||
|
|
@ -211,10 +197,6 @@ GHashTable *nm_connection_to_hash (NMConnection *connection,
|
|||
|
||||
void nm_connection_dump (NMConnection *connection);
|
||||
|
||||
GType nm_connection_lookup_setting_type (const char *name);
|
||||
|
||||
GType nm_connection_lookup_setting_type_by_quark (GQuark error_quark);
|
||||
|
||||
/* Helpers */
|
||||
const char * nm_connection_get_uuid (NMConnection *connection);
|
||||
const char * nm_connection_get_id (NMConnection *connection);
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ void _nm_register_setting (const char *name,
|
|||
|
||||
gboolean _nm_setting_is_base_type (NMSetting *setting);
|
||||
gboolean _nm_setting_type_is_base_type (GType type);
|
||||
GType _nm_setting_lookup_setting_type (const char *name);
|
||||
GType _nm_setting_lookup_setting_type_by_quark (GQuark error_quark);
|
||||
gint _nm_setting_compare_priority (gconstpointer a, gconstpointer b);
|
||||
|
||||
typedef enum NMSettingUpdateSecretResult {
|
||||
|
|
|
|||
|
|
@ -225,8 +225,16 @@ _nm_setting_is_base_type (NMSetting *setting)
|
|||
return _nm_setting_type_is_base_type (G_OBJECT_TYPE (setting));
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_lookup_type:
|
||||
* @name: a setting name
|
||||
*
|
||||
* Returns the #GType of the setting's class for a given setting name.
|
||||
*
|
||||
* Returns: the #GType of the setting's class
|
||||
**/
|
||||
GType
|
||||
_nm_setting_lookup_setting_type (const char *name)
|
||||
nm_setting_lookup_type (const char *name)
|
||||
{
|
||||
SettingInfo *info;
|
||||
|
||||
|
|
@ -238,8 +246,17 @@ _nm_setting_lookup_setting_type (const char *name)
|
|||
return info ? info->type : G_TYPE_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_lookup_type_by_quark:
|
||||
* @error_quark: a setting error quark
|
||||
*
|
||||
* Returns the #GType of the setting's class for a given setting error quark.
|
||||
* Useful for figuring out which setting a returned error is for.
|
||||
*
|
||||
* Returns: the #GType of the setting's class
|
||||
**/
|
||||
GType
|
||||
_nm_setting_lookup_setting_type_by_quark (GQuark error_quark)
|
||||
nm_setting_lookup_type_by_quark (GQuark error_quark)
|
||||
{
|
||||
SettingInfo *info;
|
||||
GHashTableIter iter;
|
||||
|
|
|
|||
|
|
@ -229,6 +229,9 @@ typedef void (*NMSettingValueIterFn) (NMSetting *setting,
|
|||
|
||||
GType nm_setting_get_type (void);
|
||||
|
||||
GType nm_setting_lookup_type (const char *name);
|
||||
GType nm_setting_lookup_type_by_quark (GQuark error_quark);
|
||||
|
||||
/**
|
||||
* NMSettingHashFlags:
|
||||
* @NM_SETTING_HASH_FLAG_ALL: hash all properties (including secrets)
|
||||
|
|
|
|||
110
libnm-core/nm-simple-connection.c
Normal file
110
libnm-core/nm-simple-connection.c
Normal 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)
|
||||
{
|
||||
}
|
||||
61
libnm-core/nm-simple-connection.h
Normal file
61
libnm-core/nm-simple-connection.h
Normal 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__ */
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -76,10 +76,8 @@ global:
|
|||
nm_connection_clear_secrets;
|
||||
nm_connection_clear_secrets_with_flags;
|
||||
nm_connection_compare;
|
||||
nm_connection_create_setting;
|
||||
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,11 +118,7 @@ global:
|
|||
nm_connection_get_virtual_device_description;
|
||||
nm_connection_get_virtual_iface_name;
|
||||
nm_connection_is_type;
|
||||
nm_connection_lookup_setting_type;
|
||||
nm_connection_lookup_setting_type_by_quark;
|
||||
nm_connection_need_secrets;
|
||||
nm_connection_new;
|
||||
nm_connection_new_from_hash;
|
||||
nm_connection_normalize;
|
||||
nm_connection_remove_setting;
|
||||
nm_connection_replace_settings;
|
||||
|
|
@ -344,7 +338,7 @@ global:
|
|||
nm_object_array_get_type;
|
||||
nm_object_error_get_type;
|
||||
nm_object_error_quark;
|
||||
nm_object_get_connection;
|
||||
nm_object_get_dbus_connection;
|
||||
nm_object_get_path;
|
||||
nm_object_get_type;
|
||||
nm_remote_connection_commit_changes;
|
||||
|
|
@ -679,6 +673,8 @@ global:
|
|||
nm_setting_ip6_config_remove_dns_search_by_value;
|
||||
nm_setting_ip6_config_remove_route;
|
||||
nm_setting_ip6_config_remove_route_by_value;
|
||||
nm_setting_lookup_type;
|
||||
nm_setting_lookup_type_by_quark;
|
||||
nm_setting_need_secrets;
|
||||
nm_setting_new_from_hash;
|
||||
nm_setting_olpc_mesh_error_get_type;
|
||||
|
|
@ -868,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;
|
||||
|
|
|
|||
|
|
@ -1660,7 +1660,7 @@ constructor (GType type,
|
|||
const char *dbus_path;
|
||||
|
||||
for (i = 0; i < n_construct_params; i++) {
|
||||
if (strcmp (construct_params[i].pspec->name, NM_OBJECT_DBUS_PATH) == 0) {
|
||||
if (strcmp (construct_params[i].pspec->name, NM_OBJECT_PATH) == 0) {
|
||||
dbus_path = g_value_get_string (construct_params[i].value);
|
||||
if (dbus_path == NULL) {
|
||||
g_value_set_static_string (construct_params[i].value, NM_DBUS_PATH);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ typedef struct {
|
|||
enum {
|
||||
PROP_0,
|
||||
PROP_DBUS_CONNECTION,
|
||||
PROP_DBUS_PATH,
|
||||
PROP_PATH,
|
||||
PROP_NM_RUNNING,
|
||||
|
||||
LAST_PROP
|
||||
|
|
@ -357,7 +357,7 @@ set_property (GObject *object, guint prop_id,
|
|||
/* Construct only */
|
||||
priv->connection = g_value_dup_boxed (value);
|
||||
break;
|
||||
case PROP_DBUS_PATH:
|
||||
case PROP_PATH:
|
||||
/* Construct only */
|
||||
priv->path = g_value_dup_string (value);
|
||||
break;
|
||||
|
|
@ -377,7 +377,7 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_DBUS_CONNECTION:
|
||||
g_value_set_boxed (value, priv->connection);
|
||||
break;
|
||||
case PROP_DBUS_PATH:
|
||||
case PROP_PATH:
|
||||
g_value_set_string (value, priv->path);
|
||||
break;
|
||||
case PROP_NM_RUNNING:
|
||||
|
|
@ -422,11 +422,11 @@ nm_object_class_init (NMObjectClass *nm_object_class)
|
|||
/**
|
||||
* NMObject:path:
|
||||
*
|
||||
* The DBus object path.
|
||||
* The D-Bus object path.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_DBUS_PATH,
|
||||
g_param_spec_string (NM_OBJECT_DBUS_PATH, "", "",
|
||||
(object_class, PROP_PATH,
|
||||
g_param_spec_string (NM_OBJECT_PATH, "", "",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
|
|
@ -481,7 +481,7 @@ nm_object_async_initable_iface_init (GAsyncInitableIface *iface)
|
|||
}
|
||||
|
||||
/**
|
||||
* nm_object_get_connection:
|
||||
* nm_object_get_dbus_connection:
|
||||
* @object: a #NMObject
|
||||
*
|
||||
* Gets the #NMObject's DBusGConnection.
|
||||
|
|
@ -489,7 +489,7 @@ nm_object_async_initable_iface_init (GAsyncInitableIface *iface)
|
|||
* Returns: (transfer none): the connection
|
||||
**/
|
||||
DBusGConnection *
|
||||
nm_object_get_connection (NMObject *object)
|
||||
nm_object_get_dbus_connection (NMObject *object)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_OBJECT (object), NULL);
|
||||
|
||||
|
|
@ -596,7 +596,7 @@ _nm_object_create (GType type, DBusGConnection *connection, const char *path)
|
|||
|
||||
object = g_object_new (type,
|
||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
||||
NM_OBJECT_DBUS_PATH, path,
|
||||
NM_OBJECT_PATH, path,
|
||||
NULL);
|
||||
if (NM_IS_OBJECT (object))
|
||||
_nm_object_cache_add (NM_OBJECT (object));
|
||||
|
|
@ -625,17 +625,6 @@ create_async_complete (GObject *object, NMObjectTypeAsyncData *async_data)
|
|||
g_slice_free (NMObjectTypeAsyncData, async_data);
|
||||
}
|
||||
|
||||
static const char *
|
||||
nm_object_or_connection_get_path (gpointer instance)
|
||||
{
|
||||
if (NM_IS_OBJECT (instance))
|
||||
return nm_object_get_path (instance);
|
||||
else if (NM_IS_CONNECTION (instance))
|
||||
return nm_connection_get_path (instance);
|
||||
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
async_inited (GObject *object, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
|
|
@ -644,7 +633,7 @@ async_inited (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
|
||||
if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, &error)) {
|
||||
dbgmsg ("Could not create object for %s: %s",
|
||||
nm_object_or_connection_get_path (object),
|
||||
nm_object_get_path (NM_OBJECT (object)),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
object = NULL;
|
||||
|
|
@ -678,7 +667,7 @@ async_got_type (GType type, gpointer user_data)
|
|||
|
||||
object = g_object_new (type,
|
||||
NM_OBJECT_DBUS_CONNECTION, async_data->connection,
|
||||
NM_OBJECT_DBUS_PATH, async_data->path,
|
||||
NM_OBJECT_PATH, async_data->path,
|
||||
NULL);
|
||||
if (NM_IS_OBJECT (object))
|
||||
_nm_object_cache_add (NM_OBJECT (object));
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ typedef enum {
|
|||
GQuark nm_object_error_quark (void);
|
||||
|
||||
#define NM_OBJECT_DBUS_CONNECTION "dbus-connection"
|
||||
#define NM_OBJECT_DBUS_PATH "dbus-path"
|
||||
#define NM_OBJECT_PATH "path"
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
|
|
@ -85,8 +85,8 @@ typedef struct {
|
|||
|
||||
GType nm_object_get_type (void);
|
||||
|
||||
DBusGConnection *nm_object_get_connection (NMObject *object);
|
||||
const char *nm_object_get_path (NMObject *object);
|
||||
DBusGConnection *nm_object_get_dbus_connection (NMObject *object);
|
||||
const char *nm_object_get_path (NMObject *object);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -33,22 +33,20 @@
|
|||
#include "nm-glib-compat.h"
|
||||
#include "nm-dbus-helpers-private.h"
|
||||
|
||||
#define NM_REMOTE_CONNECTION_DBUS_CONNECTION "dbus-connection"
|
||||
#define NM_REMOTE_CONNECTION_DBUS_PATH "dbus-path"
|
||||
|
||||
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);
|
||||
static GInitableIface *nm_remote_connection_parent_initable_iface;
|
||||
static GAsyncInitableIface *nm_remote_connection_parent_async_initable_iface;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_CONNECTION,
|
||||
G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_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);
|
||||
)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_BUS,
|
||||
PROP_DBUS_CONNECTION,
|
||||
PROP_DBUS_PATH,
|
||||
PROP_UNSAVED,
|
||||
PROP_VISIBLE,
|
||||
|
||||
|
|
@ -68,9 +66,7 @@ struct RemoteCall {
|
|||
};
|
||||
|
||||
typedef struct {
|
||||
DBusGConnection *bus;
|
||||
DBusGProxy *proxy;
|
||||
DBusGProxy *props_proxy;
|
||||
gboolean proxy_is_destroyed;
|
||||
GSList *calls;
|
||||
|
||||
|
|
@ -498,63 +494,33 @@ updated_cb (DBusGProxy *proxy, gpointer user_data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
properties_changed_cb (DBusGProxy *proxy,
|
||||
GHashTable *properties,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMRemoteConnection *self = NM_REMOTE_CONNECTION (user_data);
|
||||
GHashTableIter iter;
|
||||
const char *key;
|
||||
GValue *value;
|
||||
|
||||
g_hash_table_iter_init (&iter, properties);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) {
|
||||
if (!strcmp (key, "Unsaved")) {
|
||||
NM_REMOTE_CONNECTION_GET_PRIVATE (self)->unsaved = g_value_get_boolean (value);
|
||||
g_object_notify (G_OBJECT (self), NM_REMOTE_CONNECTION_UNSAVED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
static void
|
||||
init_common (NMRemoteConnection *self)
|
||||
init_dbus (NMObject *object)
|
||||
{
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
|
||||
const NMPropertiesInfo property_info[] = {
|
||||
{ NM_REMOTE_CONNECTION_UNSAVED, &priv->unsaved },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
g_assert (priv->bus);
|
||||
g_assert (nm_connection_get_path (NM_CONNECTION (self)));
|
||||
NM_OBJECT_CLASS (nm_remote_connection_parent_class)->init_dbus (object);
|
||||
|
||||
priv->proxy = _nm_dbus_new_proxy_for_connection (priv->bus,
|
||||
nm_connection_get_path (NM_CONNECTION (self)),
|
||||
priv->proxy = _nm_dbus_new_proxy_for_connection (nm_object_get_dbus_connection (object),
|
||||
nm_connection_get_path (NM_CONNECTION (object)),
|
||||
NM_DBUS_INTERFACE_SETTINGS_CONNECTION);
|
||||
g_assert (priv->proxy);
|
||||
dbus_g_proxy_set_default_timeout (priv->proxy, G_MAXINT);
|
||||
|
||||
_nm_object_register_properties (object,
|
||||
priv->proxy,
|
||||
property_info);
|
||||
|
||||
dbus_g_proxy_add_signal (priv->proxy, "Updated", G_TYPE_INVALID);
|
||||
dbus_g_proxy_connect_signal (priv->proxy, "Updated", G_CALLBACK (updated_cb), self, NULL);
|
||||
dbus_g_proxy_connect_signal (priv->proxy, "Updated", G_CALLBACK (updated_cb), object, NULL);
|
||||
|
||||
g_signal_connect (priv->proxy, "destroy", G_CALLBACK (proxy_destroy_cb), self);
|
||||
|
||||
/* Monitor properties */
|
||||
dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE,
|
||||
DBUS_TYPE_G_MAP_OF_VARIANT,
|
||||
G_TYPE_INVALID);
|
||||
dbus_g_proxy_add_signal (priv->proxy, "PropertiesChanged",
|
||||
DBUS_TYPE_G_MAP_OF_VARIANT,
|
||||
G_TYPE_INVALID);
|
||||
dbus_g_proxy_connect_signal (priv->proxy, "PropertiesChanged",
|
||||
G_CALLBACK (properties_changed_cb),
|
||||
self,
|
||||
NULL);
|
||||
|
||||
priv->props_proxy = _nm_dbus_new_proxy_for_connection (priv->bus,
|
||||
nm_connection_get_path (NM_CONNECTION (self)),
|
||||
DBUS_INTERFACE_PROPERTIES);
|
||||
g_assert (priv->props_proxy);
|
||||
g_signal_connect (priv->proxy, "destroy", G_CALLBACK (proxy_destroy_cb), object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -564,7 +530,8 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
|
||||
GHashTable *hash;
|
||||
|
||||
init_common (self);
|
||||
if (!nm_remote_connection_parent_initable_iface->init (initable, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!dbus_g_proxy_call (priv->proxy, "GetSettings", error,
|
||||
G_TYPE_INVALID,
|
||||
|
|
@ -575,17 +542,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
replace_settings (self, hash);
|
||||
g_hash_table_destroy (hash);
|
||||
|
||||
/* Get properties */
|
||||
hash = NULL;
|
||||
if (!dbus_g_proxy_call (priv->props_proxy, "GetAll", error,
|
||||
G_TYPE_STRING, NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
|
||||
G_TYPE_INVALID,
|
||||
DBUS_TYPE_G_MAP_OF_VARIANT, &hash,
|
||||
G_TYPE_INVALID))
|
||||
return FALSE;
|
||||
properties_changed_cb (priv->props_proxy, hash, self);
|
||||
g_hash_table_destroy (hash);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -607,23 +563,6 @@ init_async_complete (NMRemoteConnectionInitData *init_data, GError *error)
|
|||
g_slice_free (NMRemoteConnectionInitData, init_data);
|
||||
}
|
||||
|
||||
static void
|
||||
init_async_got_properties (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
|
||||
{
|
||||
NMRemoteConnectionInitData *init_data = user_data;
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
|
||||
GHashTable *props;
|
||||
GError *error = NULL;
|
||||
|
||||
if (dbus_g_proxy_end_call (proxy, call, &error,
|
||||
DBUS_TYPE_G_MAP_OF_VARIANT, &props,
|
||||
G_TYPE_INVALID)) {
|
||||
properties_changed_cb (priv->props_proxy, props, init_data->connection);
|
||||
g_hash_table_destroy (props);
|
||||
}
|
||||
init_async_complete (init_data, error);
|
||||
}
|
||||
|
||||
static void
|
||||
init_get_settings_cb (DBusGProxy *proxy,
|
||||
DBusGProxyCall *call,
|
||||
|
|
@ -646,10 +585,23 @@ init_get_settings_cb (DBusGProxy *proxy,
|
|||
replace_settings (init_data->connection, settings);
|
||||
g_hash_table_destroy (settings);
|
||||
|
||||
/* Grab properties */
|
||||
dbus_g_proxy_begin_call (priv->props_proxy, "GetAll",
|
||||
init_async_got_properties, init_data, NULL,
|
||||
G_TYPE_STRING, NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
|
||||
init_async_complete (init_data, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
init_async_parent_inited (GObject *source, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
NMRemoteConnectionInitData *init_data = user_data;
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!nm_remote_connection_parent_async_initable_iface->init_finish (G_ASYNC_INITABLE (source), result, &error)) {
|
||||
init_async_complete (init_data, error);
|
||||
return;
|
||||
}
|
||||
|
||||
dbus_g_proxy_begin_call (priv->proxy, "GetSettings",
|
||||
init_get_settings_cb, init_data, NULL,
|
||||
G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
|
|
@ -659,18 +611,14 @@ init_async (GAsyncInitable *initable, int io_priority,
|
|||
gpointer user_data)
|
||||
{
|
||||
NMRemoteConnectionInitData *init_data;
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
|
||||
|
||||
init_data = g_slice_new0 (NMRemoteConnectionInitData);
|
||||
init_data->connection = NM_REMOTE_CONNECTION (initable);
|
||||
init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback,
|
||||
user_data, init_async);
|
||||
|
||||
init_common (init_data->connection);
|
||||
|
||||
dbus_g_proxy_begin_call (priv->proxy, "GetSettings",
|
||||
init_get_settings_cb, init_data, NULL,
|
||||
G_TYPE_INVALID);
|
||||
nm_remote_connection_parent_async_initable_iface->
|
||||
init_async (initable, io_priority, cancellable, init_async_parent_inited, init_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -689,43 +637,6 @@ nm_remote_connection_init (NMRemoteConnection *self)
|
|||
{
|
||||
}
|
||||
|
||||
static GObject *
|
||||
constructor (GType type, guint n_construct_properties,
|
||||
GObjectConstructParam *construct_properties)
|
||||
{
|
||||
static GParamSpec *nm_connection_path = NULL;
|
||||
static GParamSpec *nm_remote_connection_dbus_path = NULL;
|
||||
int i, path_index = -1, dbus_path_index = -1;
|
||||
|
||||
if (!nm_connection_path) {
|
||||
nm_connection_path =
|
||||
g_object_class_find_property (g_type_class_peek (NM_TYPE_CONNECTION),
|
||||
NM_CONNECTION_PATH);
|
||||
nm_remote_connection_dbus_path =
|
||||
g_object_class_find_property (g_type_class_peek (NM_TYPE_REMOTE_CONNECTION),
|
||||
NM_REMOTE_CONNECTION_DBUS_PATH);
|
||||
}
|
||||
|
||||
/* Find the two properties */
|
||||
for (i = 0; i < n_construct_properties; i++) {
|
||||
if (construct_properties[i].pspec == nm_connection_path)
|
||||
path_index = i;
|
||||
else if (construct_properties[i].pspec == nm_remote_connection_dbus_path)
|
||||
dbus_path_index = i;
|
||||
}
|
||||
g_assert (path_index != -1 && dbus_path_index != -1);
|
||||
|
||||
/* If NMRemoteConnection:dbus-path is set, and NMConnection:path
|
||||
* is not, then copy the value of the former to the latter.
|
||||
*/
|
||||
if (g_value_get_string (construct_properties[dbus_path_index].value) &&
|
||||
!g_value_get_string (construct_properties[path_index].value))
|
||||
construct_properties[path_index].value = construct_properties[dbus_path_index].value;
|
||||
|
||||
return G_OBJECT_CLASS (nm_remote_connection_parent_class)->
|
||||
constructor (type, n_construct_properties, construct_properties);
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
|
|
@ -744,32 +655,10 @@ get_property (GObject *object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
constructed (GObject *object)
|
||||
{
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_BUS:
|
||||
case PROP_DBUS_CONNECTION:
|
||||
/* Construct only */
|
||||
/* priv->bus is set from either of two properties so that it (a) remains
|
||||
* backwards compatible with the previous "bus" property, and that (b)
|
||||
* it can be created just like an NMObject using the "dbus-connection",
|
||||
* even though it's not a subclass of NMObject. So don't overwrite the
|
||||
* a valid value that the other property set with NULL, if one of the
|
||||
* properties isn't specified at construction time.
|
||||
*/
|
||||
if (!priv->bus)
|
||||
priv->bus = g_value_dup_boxed (value);
|
||||
break;
|
||||
case PROP_DBUS_PATH:
|
||||
/* Don't need to do anything; see constructor(). */
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
nm_connection_set_path (NM_CONNECTION (object),
|
||||
nm_object_get_path (NM_OBJECT (object)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -784,12 +673,6 @@ dispose (GObject *object)
|
|||
g_signal_handlers_disconnect_by_func (priv->proxy, proxy_destroy_cb, object);
|
||||
g_clear_object (&priv->proxy);
|
||||
}
|
||||
g_clear_object (&priv->props_proxy);
|
||||
|
||||
if (priv->bus) {
|
||||
dbus_g_connection_unref (priv->bus);
|
||||
priv->bus = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (nm_remote_connection_parent_class)->dispose (object);
|
||||
}
|
||||
|
|
@ -798,45 +681,18 @@ static void
|
|||
nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (remote_class);
|
||||
NMObjectClass *nm_object_class = NM_OBJECT_CLASS (remote_class);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMRemoteConnectionPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->constructor = constructor;
|
||||
object_class->constructed = constructed;
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
nm_object_class->init_dbus = init_dbus;
|
||||
|
||||
/* Properties */
|
||||
/**
|
||||
* NMRemoteConnection:bus:
|
||||
*
|
||||
* The #DBusGConnection that the #NMRemoteConnection is connected to.
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_BUS,
|
||||
g_param_spec_boxed (NM_REMOTE_CONNECTION_BUS, "", "",
|
||||
DBUS_TYPE_G_CONNECTION,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/* These are needed so _nm_object_create() can create NMRemoteConnections */
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_DBUS_CONNECTION,
|
||||
g_param_spec_boxed (NM_REMOTE_CONNECTION_DBUS_CONNECTION, "", "",
|
||||
DBUS_TYPE_G_CONNECTION,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_DBUS_PATH,
|
||||
g_param_spec_string (NM_REMOTE_CONNECTION_DBUS_PATH, "", "",
|
||||
NULL,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMRemoteConnection:unsaved:
|
||||
*
|
||||
|
|
@ -869,15 +725,24 @@ 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)
|
||||
{
|
||||
nm_remote_connection_parent_initable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->init = init_sync;
|
||||
}
|
||||
|
||||
static void
|
||||
nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface)
|
||||
{
|
||||
nm_remote_connection_parent_async_initable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->init_async = init_async;
|
||||
iface->init_finish = init_finish;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@
|
|||
#error "Only <NetworkManager.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
||||
#include <nm-connection.h>
|
||||
#include <nm-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
@ -55,16 +53,17 @@ typedef enum {
|
|||
GQuark nm_remote_connection_error_quark (void);
|
||||
|
||||
/* Properties */
|
||||
#define NM_REMOTE_CONNECTION_BUS "bus"
|
||||
#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;
|
||||
NMObject parent;
|
||||
} NMRemoteConnection;
|
||||
|
||||
typedef struct {
|
||||
NMConnectionClass parent_class;
|
||||
NMObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer padding[8];
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
* char *uuid;
|
||||
* gboolean success;
|
||||
*
|
||||
* connection = nm_connection_new ();
|
||||
* connection = nm_simple_connection_new ();
|
||||
*
|
||||
* /* Build up the 'connection' setting */
|
||||
* s_con = (NMSettingConnection *) nm_setting_connection_new ();
|
||||
|
|
@ -887,7 +887,7 @@ constructor (GType type,
|
|||
|
||||
/* Fill in the right D-Bus path if none was specified */
|
||||
for (i = 0; i < n_construct_params; i++) {
|
||||
if (strcmp (construct_params[i].pspec->name, NM_OBJECT_DBUS_PATH) == 0) {
|
||||
if (strcmp (construct_params[i].pspec->name, NM_OBJECT_PATH) == 0) {
|
||||
dbus_path = g_value_get_string (construct_params[i].value);
|
||||
if (dbus_path == NULL) {
|
||||
g_value_set_static_string (construct_params[i].value, NM_DBUS_PATH_SETTINGS);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,13 +525,13 @@ 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,
|
||||
NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,
|
||||
"The connection was invalid: '%s' / '%s' invalid: %d.",
|
||||
g_type_name (nm_connection_lookup_setting_type_by_quark (cnfh_err->domain)),
|
||||
g_type_name (nm_setting_lookup_type_by_quark (cnfh_err->domain)),
|
||||
cnfh_err->message, cnfh_err->code);
|
||||
g_error_free (cnfh_err);
|
||||
return FALSE;
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -52,7 +48,7 @@ test_client_new (void)
|
|||
|
||||
client = g_object_new (NM_TYPE_CLIENT,
|
||||
NM_OBJECT_DBUS_CONNECTION, bus,
|
||||
NM_OBJECT_DBUS_PATH, NM_DBUS_PATH,
|
||||
NM_OBJECT_PATH, NM_DBUS_PATH,
|
||||
NULL);
|
||||
g_assert (client != NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -835,7 +835,7 @@ claim_connection (NMSettings *self,
|
|||
|
||||
if (!nm_connection_normalize (NM_CONNECTION (connection), NULL, NULL, &error)) {
|
||||
nm_log_warn (LOGD_SETTINGS, "plugin provided invalid connection: '%s' / '%s' invalid: %d",
|
||||
g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)),
|
||||
g_type_name (nm_setting_lookup_type_by_quark (error->domain)),
|
||||
error->message, error->code);
|
||||
g_error_free (error);
|
||||
return;
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ update_connection_settings_commit_cb (NMSettingsConnection *orig, GError *error,
|
|||
if (error) {
|
||||
nm_log_warn (LOGD_SETTINGS, "%s: '%s' / '%s' invalid: %d",
|
||||
__func__,
|
||||
error ? g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)) : "(none)",
|
||||
error ? g_type_name (nm_setting_lookup_type_by_quark (error->domain)) : "(none)",
|
||||
(error && error->message) ? error->message : "(none)",
|
||||
error ? error->code : -1);
|
||||
g_clear_error (&error);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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 ());
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1166,12 +1166,17 @@ read_setting (GKeyFile *file, const char *keyfile_path, const char *group)
|
|||
NMSetting *setting;
|
||||
ReadInfo info = { file, keyfile_path };
|
||||
const char *alias;
|
||||
GType type;
|
||||
|
||||
alias = nm_keyfile_plugin_get_setting_name_for_alias (group);
|
||||
setting = nm_connection_create_setting (alias ? alias : group);
|
||||
if (setting)
|
||||
if (alias)
|
||||
group = alias;
|
||||
|
||||
type = nm_setting_lookup_type (group);
|
||||
if (type) {
|
||||
setting = g_object_new (type, NULL);
|
||||
nm_setting_enumerate_values (setting, read_one_setting_value, &info);
|
||||
else
|
||||
} else
|
||||
nm_log_warn (LOGD_SETTINGS, "Invalid setting name '%s'", group);
|
||||
|
||||
return setting;
|
||||
|
|
@ -1254,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++) {
|
||||
|
|
@ -1284,7 +1289,7 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
|
|||
NMSetting *base_setting;
|
||||
GType base_setting_type;
|
||||
|
||||
base_setting_type = nm_connection_lookup_setting_type (ctype);
|
||||
base_setting_type = nm_setting_lookup_type (ctype);
|
||||
if (base_setting_type != G_TYPE_INVALID) {
|
||||
base_setting = (NMSetting *) g_object_new (base_setting_type, NULL);
|
||||
g_assert (base_setting);
|
||||
|
|
@ -1329,7 +1334,7 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
|
|||
if (!nm_connection_verify (connection, &verify_error)) {
|
||||
g_set_error (error, KEYFILE_PLUGIN_ERROR, 0,
|
||||
"invalid or missing connection property '%s/%s'",
|
||||
verify_error ? g_type_name (nm_connection_lookup_setting_type_by_quark (verify_error->domain)) : "(unknown)",
|
||||
verify_error ? g_type_name (nm_setting_lookup_type_by_quark (verify_error->domain)) : "(unknown)",
|
||||
(verify_error && verify_error->message) ? verify_error->message : "(unknown)");
|
||||
g_clear_error (&verify_error);
|
||||
g_object_unref (connection);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue