g_free (id);
nm_connection_add_setting (connection, NM_SETTING (s_con));
- *out_con_hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ *out_con_hash = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
g_object_unref (connection);
*out_con_props = value_hash_create ();
const char *setting_name;
int i = 0;
- settings = nm_connection_to_hash (nmc_tab_completion.connection, NM_SETTING_HASH_FLAG_NO_SECRETS);
+ settings = nm_connection_to_dbus (nmc_tab_completion.connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
words = g_new (char *, g_hash_table_size (settings) + 2);
g_hash_table_iter_init (&iter, settings);
while (g_hash_table_iter_next (&iter, (gpointer) &setting_name, NULL))
if (!NM_IS_REMOTE_CONNECTION (orig_connection))
return edit_connection;
- settings = nm_connection_to_hash (orig_connection, NM_SETTING_HASH_FLAG_NO_SECRETS);
+ settings = nm_connection_to_dbus (orig_connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
g_hash_table_iter_init (&iter, settings);
while (g_hash_table_iter_next (&iter, (gpointer) &setting_name, NULL)) {
nmt_sync_op_init (&op);
NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
- hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ hash = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
/* Call AddConnection with the hash as argument */
if (!dbus_g_proxy_call (proxy, "AddConnection", &error,
/* 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_simple_connection_new_from_hash (hash, &error);
+ connection = nm_simple_connection_new_from_dbus (hash, &error);
if (!connection) {
g_warning ("Received invalid connection data: %s", error->message);
g_error_free (error);
GType type = nm_setting_lookup_type (setting_name);
if (type) {
- NMSetting *setting = _nm_setting_new_from_hash (type, setting_hash);
+ NMSetting *setting = _nm_setting_new_from_dbus (type, setting_hash);
if (setting) {
_nm_connection_add_setting (connection, setting);
* Update the specified setting's secrets, given a hash table of secrets
* intended for that setting (deserialized from D-Bus for example). Will also
* extract the given setting's secrets hash if given a hash of hashes, as would
- * be returned from nm_connection_to_hash(). If @setting_name is %NULL, expects
- * a fully serialized #NMConnection as returned by nm_connection_to_hash() and
+ * be returned from nm_connection_to_dbus(). If @setting_name is %NULL, expects
+ * a fully serialized #NMConnection as returned by nm_connection_to_dbus() and
* will update all secrets from all settings contained in @secrets.
*
* Returns: %TRUE if the secrets were successfully updated, %FALSE if the update
}
/**
- * nm_connection_to_hash:
+ * nm_connection_to_dbus:
* @connection: the #NMConnection
- * @flags: hash flags, e.g. %NM_SETTING_HASH_FLAG_ALL
+ * @flags: serialization flags, e.g. %NM_CONNECTION_SERIALIZE_ALL
*
* Converts the #NMConnection into a #GHashTable describing the connection,
- * suitable for marshalling over D-Bus or serializing. The hash table mapping
- * is string:#GHashTable with each element in the returned hash representing
- * a #NMSetting object. The keys are setting object names, and the values
- * are #GHashTables mapping string:GValue, each of which represents the
+ * suitable for marshalling over D-Bus or otherwise serializing. The hash table
+ * mapping is string:#GHashTable with each element in the returned hash
+ * representing a #NMSetting object. The keys are setting object names, and the
+ * values are #GHashTables mapping string:GValue, each of which represents the
* properties of the #NMSetting object.
*
* Returns: (transfer full) (element-type utf8 GLib.HashTable): a new
* with g_hash_table_unref() when it is no longer needed.
**/
GHashTable *
-nm_connection_to_hash (NMConnection *connection, NMSettingHashFlags flags)
+nm_connection_to_dbus (NMConnection *connection, NMConnectionSerializationFlags flags)
{
NMConnectionPrivate *priv;
GHashTableIter iter;
while (g_hash_table_iter_next (&iter, &key, &data)) {
NMSetting *setting = NM_SETTING (data);
- setting_hash = _nm_setting_to_hash (setting, flags);
+ setting_hash = _nm_setting_to_dbus (setting, flags);
if (setting_hash)
g_hash_table_insert (ret, g_strdup (nm_setting_get_name (setting)), setting_hash);
}
NMSetting *nm_connection_get_setting_by_name (NMConnection *connection,
const char *name);
+/**
+ * NMConnectionSerializationFlags:
+ * @NM_CONNECTION_SERIALIZE_ALL: serialize all properties (including secrets)
+ * @NM_CONNECTION_SERIALIZE_NO_SECRETS: do not include secrets
+ * @NM_CONNECTION_SERIALIZE_ONLY_SECRETS: only serialize secrets
+ *
+ * These flags determine which properties are serialized when calling when
+ * calling nm_connection_to_dbus().
+ **/
+typedef enum { /*< flags >*/
+ NM_CONNECTION_SERIALIZE_ALL = 0x00000000,
+ NM_CONNECTION_SERIALIZE_NO_SECRETS = 0x00000001,
+ NM_CONNECTION_SERIALIZE_ONLY_SECRETS = 0x00000002,
+} NMConnectionSerializationFlags;
+
+GHashTable *nm_connection_to_dbus (NMConnection *connection,
+ NMConnectionSerializationFlags flags);
+
gboolean nm_connection_replace_settings (NMConnection *connection,
GHashTable *new_settings,
GError **error);
NMSettingValueIterFn func,
gpointer user_data);
-GHashTable *nm_connection_to_hash (NMConnection *connection,
- NMSettingHashFlags flags);
-
void nm_connection_dump (NMConnection *connection);
/* Helpers */
#define __NM_SETTING_PRIVATE_H__
#include "nm-setting.h"
+#include "nm-connection.h"
#include "nm-glib-compat.h"
#include "nm-core-internal.h"
gboolean _nm_setting_slave_type_is_valid (const char *slave_type, const char **out_port_type);
const char * _nm_setting_slave_type_detect_from_settings (GSList *all_settings, NMSetting **out_s_port);
-GHashTable *_nm_setting_to_hash (NMSetting *setting,
- NMSettingHashFlags flags);
+GHashTable *_nm_setting_to_dbus (NMSetting *setting,
+ NMConnectionSerializationFlags flags);
-NMSetting *_nm_setting_new_from_hash (GType setting_type,
+NMSetting *_nm_setting_new_from_dbus (GType setting_type,
GHashTable *hash);
#endif /* NM_SETTING_PRIVATE_H */
}
/**
- * _nm_setting_to_hash:
+ * _nm_setting_to_dbus:
* @setting: the #NMSetting
- * @flags: hash flags, e.g. %NM_SETTING_HASH_FLAG_ALL
+ * @flags: hash flags, e.g. %NM_CONNECTION_SERIALIZE_ALL
*
* Converts the #NMSetting into a #GHashTable mapping each setting property
* name to a GValue describing that property, suitable for marshalling over
* describing the setting's properties
**/
GHashTable *
-_nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags)
+_nm_setting_to_dbus (NMSetting *setting, NMConnectionSerializationFlags flags)
{
GHashTable *hash;
GParamSpec **property_specs;
if (strcmp (g_param_spec_get_name (prop_spec), NM_SETTING_NAME) == 0)
continue;
- if ( (flags & NM_SETTING_HASH_FLAG_NO_SECRETS)
+ if ( (flags & NM_CONNECTION_SERIALIZE_NO_SECRETS)
&& (prop_spec->flags & NM_SETTING_PARAM_SECRET))
continue;
- if ( (flags & NM_SETTING_HASH_FLAG_ONLY_SECRETS)
+ if ( (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS)
&& !(prop_spec->flags & NM_SETTING_PARAM_SECRET))
continue;
}
/**
- * _nm_setting_new_from_hash:
+ * _nm_setting_new_from_dbus:
* @setting_type: the #NMSetting type which the hash contains properties for
* @hash: (element-type utf8 GObject.Value): the #GHashTable containing a
* string to GValue mapping of properties that apply to the setting
* hash table, or %NULL on failure
**/
NMSetting *
-_nm_setting_new_from_hash (GType setting_type, GHashTable *hash)
+_nm_setting_new_from_dbus (GType setting_type, GHashTable *hash)
{
GHashTableIter iter;
NMSetting *setting;
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)
- * @NM_SETTING_HASH_FLAG_NO_SECRETS: do not include secrets
- * @NM_SETTING_HASH_FLAG_ONLY_SECRETS: only hash secrets
- *
- * These flags determine which properties are added to the resulting hash
- * when calling nm_setting_to_hash().
- *
- **/
-typedef enum {
- NM_SETTING_HASH_FLAG_ALL = 0x00000000,
- NM_SETTING_HASH_FLAG_NO_SECRETS = 0x00000001,
- NM_SETTING_HASH_FLAG_ONLY_SECRETS = 0x00000002,
-} NMSettingHashFlags;
-
NMSetting *nm_setting_duplicate (NMSetting *setting);
const char *nm_setting_get_name (NMSetting *setting);
}
/**
- * nm_simple_connection_new_from_hash:
+ * nm_simple_connection_new_from_dbus:
* @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
+ * connection. See nm_connection_to_dbus() for a description of the expected
* hash table.
*
* Returns: (transfer full): the new #NMSimpleConnection object, populated with
* connection failed to validate
**/
NMConnection *
-nm_simple_connection_new_from_hash (GHashTable *hash, GError **error)
+nm_simple_connection_new_from_dbus (GHashTable *hash, GError **error)
{
NMConnection *connection;
NMConnection *nm_simple_connection_new (void);
-NMConnection *nm_simple_connection_new_from_hash (GHashTable *hash,
+NMConnection *nm_simple_connection_new_from_dbus (GHashTable *hash,
GError **error);
NMConnection *nm_simple_connection_new_clone (NMConnection *connection);
}
static void
-test_setting_to_hash_all (void)
+test_setting_to_dbus_all (void)
{
NMSettingWirelessSecurity *s_wsec;
GHashTable *hash;
- s_wsec = make_test_wsec_setting ("setting-to-hash-all");
+ s_wsec = make_test_wsec_setting ("setting-to-dbus-all");
- hash = _nm_setting_to_hash (NM_SETTING (s_wsec), NM_SETTING_HASH_FLAG_ALL);
+ hash = _nm_setting_to_dbus (NM_SETTING (s_wsec), NM_CONNECTION_SERIALIZE_ALL);
/* Make sure all keys are there */
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT),
- "setting-to-hash-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
+ "setting-to-dbus-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME),
- "setting-to-hash-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
+ "setting-to-dbus-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_PSK),
- "setting-to-hash-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_PSK);
+ "setting-to-dbus-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_PSK);
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0),
- "setting-to-hash-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
+ "setting-to-dbus-all", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
g_hash_table_destroy (hash);
g_object_unref (s_wsec);
}
static void
-test_setting_to_hash_no_secrets (void)
+test_setting_to_dbus_no_secrets (void)
{
NMSettingWirelessSecurity *s_wsec;
GHashTable *hash;
- s_wsec = make_test_wsec_setting ("setting-to-hash-no-secrets");
+ s_wsec = make_test_wsec_setting ("setting-to-dbus-no-secrets");
- hash = _nm_setting_to_hash (NM_SETTING (s_wsec), NM_SETTING_HASH_FLAG_NO_SECRETS);
+ hash = _nm_setting_to_dbus (NM_SETTING (s_wsec), NM_CONNECTION_SERIALIZE_NO_SECRETS);
/* Make sure non-secret keys are there */
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT),
- "setting-to-hash-no-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
+ "setting-to-dbus-no-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME),
- "setting-to-hash-no-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
+ "setting-to-dbus-no-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
/* Make sure secrets are not there */
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_PSK) == NULL,
- "setting-to-hash-no-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_PSK);
+ "setting-to-dbus-no-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_PSK);
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0) == NULL,
- "setting-to-hash-no-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
+ "setting-to-dbus-no-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
g_hash_table_destroy (hash);
g_object_unref (s_wsec);
}
static void
-test_setting_to_hash_only_secrets (void)
+test_setting_to_dbus_only_secrets (void)
{
NMSettingWirelessSecurity *s_wsec;
GHashTable *hash;
- s_wsec = make_test_wsec_setting ("setting-to-hash-only-secrets");
+ s_wsec = make_test_wsec_setting ("setting-to-dbus-only-secrets");
- hash = _nm_setting_to_hash (NM_SETTING (s_wsec), NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+ hash = _nm_setting_to_dbus (NM_SETTING (s_wsec), NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
/* Make sure non-secret keys are there */
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT) == NULL,
- "setting-to-hash-only-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
+ "setting-to-dbus-only-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME) == NULL,
- "setting-to-hash-only-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
+ "setting-to-dbus-only-secrets", "unexpectedly present " NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME);
/* Make sure secrets are not there */
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_PSK),
- "setting-to-hash-only-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_PSK);
+ "setting-to-dbus-only-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_PSK);
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0),
- "setting-to-hash-only-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
+ "setting-to-dbus-only-secrets", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
g_hash_table_destroy (hash);
g_object_unref (s_wsec);
}
static void
-test_connection_to_hash_setting_name (void)
+test_connection_to_dbus_setting_name (void)
{
NMConnection *connection;
NMSettingWirelessSecurity *s_wsec;
GHashTable *hash;
connection = nm_simple_connection_new ();
- s_wsec = make_test_wsec_setting ("connection-to-hash-setting-name");
+ s_wsec = make_test_wsec_setting ("connection-to-dbus-setting-name");
nm_connection_add_setting (connection, NM_SETTING (s_wsec));
- hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ hash = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
/* Make sure the keys of the first level hash are setting names, not
* the GType name of the setting objects.
*/
ASSERT (g_hash_table_lookup (hash, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) != NULL,
- "connection-to-hash-setting-name", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
+ "connection-to-dbus-setting-name", "unexpectedly missing " NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
g_hash_table_destroy (hash);
g_object_unref (connection);
}
static void
-test_setting_new_from_hash (void)
+test_setting_new_from_dbus (void)
{
NMSettingWirelessSecurity *s_wsec;
GHashTable *hash;
- s_wsec = make_test_wsec_setting ("setting-to-hash-all");
- hash = _nm_setting_to_hash (NM_SETTING (s_wsec), NM_SETTING_HASH_FLAG_ALL);
+ s_wsec = make_test_wsec_setting ("setting-to-dbus-all");
+ hash = _nm_setting_to_dbus (NM_SETTING (s_wsec), NM_CONNECTION_SERIALIZE_ALL);
g_object_unref (s_wsec);
- s_wsec = (NMSettingWirelessSecurity *) _nm_setting_new_from_hash (NM_TYPE_SETTING_WIRELESS_SECURITY, hash);
+ s_wsec = (NMSettingWirelessSecurity *) _nm_setting_new_from_dbus (NM_TYPE_SETTING_WIRELESS_SECURITY, hash);
g_hash_table_destroy (hash);
g_assert (s_wsec);
}
static void
-test_connection_new_from_hash ()
+test_connection_new_from_dbus ()
{
NMConnection *connection;
GHashTable *new_settings;
g_assert (new_settings);
/* Replace settings and test */
- connection = nm_simple_connection_new_from_hash (new_settings, &error);
+ connection = nm_simple_connection_new_from_dbus (new_settings, &error);
g_assert_no_error (error);
g_assert (connection);
g_test_add_func ("/core/general/test_setting_gsm_apn_bad_chars", test_setting_gsm_apn_bad_chars);
g_test_add_func ("/core/general/test_setting_gsm_apn_underscore", test_setting_gsm_apn_underscore);
g_test_add_func ("/core/general/test_setting_gsm_without_number", test_setting_gsm_without_number);
- g_test_add_func ("/core/general/test_setting_to_hash_all", test_setting_to_hash_all);
- g_test_add_func ("/core/general/test_setting_to_hash_no_secrets", test_setting_to_hash_no_secrets);
- g_test_add_func ("/core/general/test_setting_to_hash_only_secrets", test_setting_to_hash_only_secrets);
+ g_test_add_func ("/core/general/test_setting_to_dbus_all", test_setting_to_dbus_all);
+ g_test_add_func ("/core/general/test_setting_to_dbus_no_secrets", test_setting_to_dbus_no_secrets);
+ g_test_add_func ("/core/general/test_setting_to_dbus_only_secrets", test_setting_to_dbus_only_secrets);
g_test_add_func ("/core/general/test_setting_compare_id", test_setting_compare_id);
#define ADD_FUNC(func, secret_flags, comp_flags, remove_secret) \
g_test_add_data_func_full ("/core/general/" G_STRINGIFY (func), \
ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
g_test_add_func ("/core/general/test_setting_old_uuid", test_setting_old_uuid);
- g_test_add_func ("/core/general/test_connection_to_hash_setting_name", test_connection_to_hash_setting_name);
- g_test_add_func ("/core/general/test_setting_new_from_hash", test_setting_new_from_hash);
+ g_test_add_func ("/core/general/test_connection_to_dbus_setting_name", test_connection_to_dbus_setting_name);
+ g_test_add_func ("/core/general/test_setting_new_from_dbus", test_setting_new_from_dbus);
g_test_add_func ("/core/general/test_connection_replace_settings", test_connection_replace_settings);
g_test_add_func ("/core/general/test_connection_replace_settings_from_connection", test_connection_replace_settings_from_connection);
- g_test_add_func ("/core/general/test_connection_new_from_hash", test_connection_new_from_hash);
+ g_test_add_func ("/core/general/test_connection_new_from_dbus", test_connection_new_from_dbus);
g_test_add_func ("/core/general/test_connection_normalize_connection_interface_name", test_connection_normalize_connection_interface_name);
g_test_add_func ("/core/general/test_connection_normalize_virtual_iface_name", test_connection_normalize_virtual_iface_name);
g_test_add_func ("/core/general/test_connection_normalize_type", test_connection_normalize_type);
connection = wifi_connection_new ();
/* Build up the secrets hash */
- secrets = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ secrets = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
wsec_hash = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
g_assert (wsec_hash);
g_hash_table_insert (wsec_hash, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, string_to_gvalue (wepkey));
connection = wifi_connection_new ();
/* Build up the secrets hash */
- secrets = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ secrets = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
wsec_hash = g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
g_assert (wsec_hash);
g_hash_table_insert (wsec_hash, NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, string_to_gvalue (wepkey));
*/
connection = wifi_connection_new ();
- secrets = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+ secrets = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
g_assert_cmpint (g_hash_table_size (secrets), ==, 1);
g_assert (g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SETTING_NAME));
nm_connection_remove_setting;
nm_connection_replace_settings;
nm_connection_replace_settings_from_connection;
+ nm_connection_serialization_flags_get_type;
nm_connection_set_path;
- nm_connection_to_hash;
+ nm_connection_to_dbus;
nm_connection_update_secrets;
nm_connection_verify;
nm_connectivity_state_get_type;
nm_setting_gsm_get_type;
nm_setting_gsm_get_username;
nm_setting_gsm_new;
- nm_setting_hash_flags_get_type;
nm_setting_infiniband_error_get_type;
nm_setting_infiniband_error_quark;
nm_setting_infiniband_get_mac_address;
nm_simple_connection_get_type;
nm_simple_connection_new;
nm_simple_connection_new_clone;
- nm_simple_connection_new_from_hash;
+ nm_simple_connection_new_from_dbus;
nm_ssid_get_type;
nm_state_get_type;
nm_string_array_get_type;
info->client = client;
if (partial)
- hash = nm_connection_to_hash (partial, NM_SETTING_HASH_FLAG_ALL);
+ hash = nm_connection_to_dbus (partial, NM_CONNECTION_SERIALIZE_ALL);
if (!hash)
hash = g_hash_table_new (g_str_hash, g_str_equal);
if (!call)
return;
- settings = nm_connection_to_hash (NM_CONNECTION (self), NM_SETTING_HASH_FLAG_ALL);
+ settings = nm_connection_to_dbus (NM_CONNECTION (self), NM_CONNECTION_SERIALIZE_ALL);
call->call = dbus_g_proxy_begin_call (priv->proxy, "Update",
remote_call_dbus_cb, call, NULL,
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, settings,
if (!call)
return;
- settings = nm_connection_to_hash (NM_CONNECTION (connection), NM_SETTING_HASH_FLAG_ALL);
+ settings = nm_connection_to_dbus (NM_CONNECTION (connection), NM_CONNECTION_SERIALIZE_ALL);
call->call = dbus_g_proxy_begin_call (priv->proxy, "UpdateUnsaved",
remote_call_dbus_cb, call, NULL,
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, settings,
info->callback = callback;
info->callback_data = user_data;
- new_settings = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ new_settings = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
dbus_g_proxy_begin_call (priv->proxy, "AddConnection",
add_connection_done,
info,
info->callback = callback;
info->callback_data = user_data;
- new_settings = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ new_settings = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
dbus_g_proxy_begin_call (priv->proxy, "AddConnectionUnsaved",
add_connection_done,
info,
/* Make sure the given connection is valid */
g_assert (out_connection);
- connection = nm_simple_connection_new_from_hash (connection_hash, &local);
+ connection = nm_simple_connection_new_from_dbus (connection_hash, &local);
if (connection) {
nm_connection_set_path (connection, connection_path);
*out_connection = connection;
* has returned
* @secrets: (element-type utf8 GLib.HashTable): the #GHashTable containing
* the requested secrets in the same format as an #NMConnection hash (as
- * created by nm_connection_to_hash() for example). Each key in @secrets
+ * created by nm_connection_to_dbus() for example). Each key in @secrets
* should be the name of a #NMSetting object (like "802-11-wireless-security")
* and each value should be a #GHashTable. The sub-hashes map string:#GValue
* where the string is the setting property name (like "psk") and the value
* NM_SETTING_WIRELESS_SECURITY_PSK, "my really cool PSK",
* NULL);
* nm_connection_add_setting (secrets, NM_SETTING (s_wsec));
- * secrets_hash = nm_connection_to_hash (secrets, NM_SETTING_HASH_FLAG_ALL);
+ * secrets_hash = nm_connection_to_dbus (secrets, NM_CONNECTION_SERIALIZE_ALL);
*
* (call the NMSecretAgentGetSecretsFunc with secrets_hash)
*
return FALSE;
}
- connection = nm_simple_connection_new_from_hash (properties, &local);
+ connection = nm_simple_connection_new_from_dbus (properties, &local);
if (!connection) {
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
"Invalid connection: (%d) %s",
g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE);
g_return_val_if_fail (properties != NULL, FALSE);
- connection = nm_simple_connection_new_from_hash (properties, &cnfh_err);
+ connection = nm_simple_connection_new_from_dbus (properties, &cnfh_err);
if (!connection) {
g_set_error (err,
NM_VPN_PLUGIN_ERROR,
return FALSE;
}
- connection = nm_simple_connection_new_from_hash (properties, &local);
+ connection = nm_simple_connection_new_from_dbus (properties, &local);
if (!connection) {
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
"Invalid connection: (%d) %s",
}
if (connection) {
- connection_hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_NO_SECRETS);
+ connection_hash = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
connection_props = value_hash_create ();
value_hash_add_object_path (connection_props,
/* NOTE: a few things in the Request handling depend on existing_secrets
* being NULL if there aren't any system-owned secrets for this connection.
- * This in turn depends on nm_connection_to_hash() and nm_setting_to_hash()
+ * This in turn depends on nm_connection_to_dbus() and nm_setting_to_hash()
* both returning NULL if they didn't hash anything.
*/
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
g_return_val_if_fail (priv->proxy != NULL, NULL);
- hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ hash = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
/* Mask off the private ONLY_SYSTEM flag if present */
flags &= ~NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM;
static gpointer
agent_new_save_delete (NMSecretAgent *self,
NMConnection *connection,
- NMSettingHashFlags hash_flags,
+ NMConnectionSerializationFlags flags,
const char *method,
NMSecretAgentCallback callback,
gpointer callback_data)
Request *r;
const char *cpath = nm_connection_get_path (connection);
- hash = nm_connection_to_hash (connection, hash_flags);
+ hash = nm_connection_to_dbus (connection, flags);
r = request_new (self, cpath, NULL, callback, callback_data);
r->call = dbus_g_proxy_begin_call_with_timeout (priv->proxy,
/* Caller should have ensured that only agent-owned secrets exist in 'connection' */
return agent_new_save_delete (self,
connection,
- NM_SETTING_HASH_FLAG_ALL,
+ NM_CONNECTION_SERIALIZE_ALL,
"SaveSecrets",
callback,
callback_data);
/* No secrets sent; agents must be smart enough to track secrets using the UUID or something */
return agent_new_save_delete (self,
connection,
- NM_SETTING_HASH_FLAG_NO_SECRETS,
+ NM_CONNECTION_SERIALIZE_NO_SECRETS,
"DeleteSecrets",
callback,
callback_data);
* in the replacement connection data if it was eg reread from disk.
*/
if (priv->agent_secrets) {
- hash = nm_connection_to_hash (priv->agent_secrets, NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+ hash = nm_connection_to_dbus (priv->agent_secrets, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
if (hash) {
(void) nm_connection_update_secrets (NM_CONNECTION (self), NULL, hash, NULL);
g_hash_table_destroy (hash);
/* Update the connection with our existing secrets from backing storage */
nm_connection_clear_secrets (NM_CONNECTION (self));
- hash = nm_connection_to_hash (priv->system_secrets, NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+ hash = nm_connection_to_dbus (priv->system_secrets, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
if (!hash || nm_connection_update_secrets (NM_CONNECTION (self), setting_name, hash, &local)) {
/* Update the connection with the agent's secrets; by this point if any
* system-owned secrets exist in 'secrets' the agent that provided them
return 0;
}
- existing_secrets = nm_connection_to_hash (priv->system_secrets, NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+ existing_secrets = nm_connection_to_dbus (priv->system_secrets, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
call_id = nm_agent_manager_get_secrets (priv->agent_mgr,
NM_CONNECTION (self),
subject,
* get returned by the GetSecrets method which can be better
* protected against leakage of secrets to unprivileged callers.
*/
- settings = nm_connection_to_hash (NM_CONNECTION (dupl_con), NM_SETTING_HASH_FLAG_NO_SECRETS);
+ settings = nm_connection_to_dbus (NM_CONNECTION (dupl_con), NM_CONNECTION_SERIALIZE_NO_SECRETS);
g_assert (settings);
dbus_g_method_return (context, settings);
g_hash_table_destroy (settings);
/* Check if the settings are valid first */
if (new_settings) {
- tmp = nm_simple_connection_new_from_hash (new_settings, &error);
+ tmp = nm_simple_connection_new_from_dbus (new_settings, &error);
if (!tmp) {
g_assert (error);
goto error;
* secrets from backing storage and those returned from the agent
* by the time we get here.
*/
- hash = nm_connection_to_hash (NM_CONNECTION (self), NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+ hash = nm_connection_to_dbus (NM_CONNECTION (self), NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
if (!hash)
hash = g_hash_table_new (NULL, NULL);
dbus_g_method_return (context, hash);
NMConnection *connection;
GError *error = NULL;
- connection = nm_simple_connection_new_from_hash (settings, &error);
+ connection = nm_simple_connection_new_from_dbus (settings, &error);
if (connection) {
nm_settings_add_connection_dbus (self,
connection,
g_assert (s_vpn);
existing = nm_setting_vpn_get_user_name (s_vpn);
if (username == NULL || existing)
- return nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
+ return nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
dup = nm_simple_connection_new_clone (connection);
g_assert (dup);
s_vpn = nm_connection_get_setting_vpn (dup);
g_assert (s_vpn);
g_object_set (s_vpn, NM_SETTING_VPN_USER_NAME, username, NULL);
- hash = nm_connection_to_hash (dup, NM_SETTING_HASH_FLAG_ALL);
+ hash = nm_connection_to_dbus (dup, NM_CONNECTION_SERIALIZE_ALL);
g_object_unref (dup);
return hash;
}