mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-25 23:30:39 +01:00
2007-08-29 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.h libnm-util/nm-setting.c libnm-util/nm-connection.c src/NetworkManagerPolicy.c - 'info' settings object should be 'connection' says the spec at NetworkManagerConfigurationSpecification git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2746 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
3e4d340871
commit
9aab44b772
5 changed files with 39 additions and 30 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2007-08-29 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-setting.h
|
||||
libnm-util/nm-setting.c
|
||||
libnm-util/nm-connection.c
|
||||
src/NetworkManagerPolicy.c
|
||||
- 'info' settings object should be 'connection' says the spec
|
||||
at NetworkManagerConfigurationSpecification
|
||||
|
||||
2007-08-29 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-glib/nm-settings.c
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ register_default_creators (void)
|
|||
const char *name;
|
||||
NMSettingCreateFn fn;
|
||||
} default_map[] = {
|
||||
{ "info", nm_setting_info_new_from_hash },
|
||||
{ "connection", nm_setting_connection_new_from_hash },
|
||||
{ "802-3-ethernet", nm_setting_wired_new_from_hash },
|
||||
{ "802-11-wireless", nm_setting_wireless_new_from_hash },
|
||||
{ "ipv4", nm_setting_ip4_config_new_from_hash },
|
||||
|
|
|
|||
|
|
@ -221,12 +221,12 @@ string_slist_validate (GSList *list, const char **valid_values)
|
|||
|
||||
/***********************************************************************/
|
||||
|
||||
/* Info */
|
||||
/* Connection */
|
||||
|
||||
static gboolean
|
||||
setting_info_verify (NMSetting *setting, GHashTable *all_settings)
|
||||
setting_connection_verify (NMSetting *setting, GHashTable *all_settings)
|
||||
{
|
||||
NMSettingInfo *self = (NMSettingInfo *) setting;
|
||||
NMSettingConnection *self = (NMSettingConnection *) setting;
|
||||
|
||||
/* Make sure the corresponding 'devtype' item is present */
|
||||
if (!g_hash_table_lookup (all_settings, self->devtype))
|
||||
|
|
@ -236,9 +236,9 @@ setting_info_verify (NMSetting *setting, GHashTable *all_settings)
|
|||
}
|
||||
|
||||
static GHashTable *
|
||||
setting_info_hash (NMSetting *setting)
|
||||
setting_connection_hash (NMSetting *setting)
|
||||
{
|
||||
NMSettingInfo *self = (NMSettingInfo *) setting;
|
||||
NMSettingConnection *self = (NMSettingConnection *) setting;
|
||||
GHashTable *hash;
|
||||
|
||||
hash = setting_hash_new ();
|
||||
|
|
@ -250,48 +250,48 @@ setting_info_hash (NMSetting *setting)
|
|||
}
|
||||
|
||||
static void
|
||||
setting_info_destroy (NMSetting *setting)
|
||||
setting_connection_destroy (NMSetting *setting)
|
||||
{
|
||||
NMSettingInfo *self = (NMSettingInfo *) setting;
|
||||
NMSettingConnection *self = (NMSettingConnection *) setting;
|
||||
|
||||
g_free (self->name);
|
||||
g_free (self->devtype);
|
||||
|
||||
g_slice_free (NMSettingInfo, self);
|
||||
g_slice_free (NMSettingConnection, self);
|
||||
}
|
||||
|
||||
NMSetting *
|
||||
nm_setting_info_new (void)
|
||||
nm_setting_connection_new (void)
|
||||
{
|
||||
NMSetting *setting;
|
||||
|
||||
setting = (NMSetting *) g_slice_new0 (NMSettingInfo);
|
||||
setting = (NMSetting *) g_slice_new0 (NMSettingConnection);
|
||||
|
||||
setting->name = g_strdup ("info");
|
||||
setting->verify_fn = setting_info_verify;
|
||||
setting->hash_fn = setting_info_hash;
|
||||
setting->destroy_fn = setting_info_destroy;
|
||||
setting->name = g_strdup ("connection");
|
||||
setting->verify_fn = setting_connection_verify;
|
||||
setting->hash_fn = setting_connection_hash;
|
||||
setting->destroy_fn = setting_connection_destroy;
|
||||
|
||||
return setting;
|
||||
}
|
||||
|
||||
NMSetting *
|
||||
nm_setting_info_new_from_hash (GHashTable *settings)
|
||||
nm_setting_connection_new_from_hash (GHashTable *settings)
|
||||
{
|
||||
NMSettingInfo *self;
|
||||
NMSettingConnection *self;
|
||||
NMSetting *setting;
|
||||
GValue *value;
|
||||
|
||||
g_return_val_if_fail (settings != NULL, NULL);
|
||||
|
||||
setting = nm_setting_info_new ();
|
||||
self = (NMSettingInfo *) setting;
|
||||
setting = nm_setting_connection_new ();
|
||||
self = (NMSettingConnection *) setting;
|
||||
|
||||
value = (GValue *) g_hash_table_lookup (settings, "name");
|
||||
if (value && G_VALUE_HOLDS_STRING (value))
|
||||
self->name = g_strdup (g_value_get_string (value));
|
||||
else {
|
||||
g_warning ("Missing or invalid info name");
|
||||
g_warning ("Missing or invalid connection name");
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ nm_setting_info_new_from_hash (GHashTable *settings)
|
|||
return setting;
|
||||
|
||||
err:
|
||||
setting_info_destroy (setting);
|
||||
setting_connection_destroy (setting);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void nm_setting_destroy (NMSetting *setting);
|
|||
|
||||
/* Default, built-in settings */
|
||||
|
||||
/* Info */
|
||||
/* Connection */
|
||||
|
||||
typedef struct {
|
||||
NMSetting parent;
|
||||
|
|
@ -39,10 +39,10 @@ typedef struct {
|
|||
char *name;
|
||||
char *devtype;
|
||||
gboolean autoconnect;
|
||||
} NMSettingInfo;
|
||||
} NMSettingConnection;
|
||||
|
||||
NMSetting *nm_setting_info_new (void);
|
||||
NMSetting *nm_setting_info_new_from_hash (GHashTable *settings);
|
||||
NMSetting *nm_setting_connection_new (void);
|
||||
NMSetting *nm_setting_connection_new_from_hash (GHashTable *settings);
|
||||
|
||||
/* IP4 config */
|
||||
|
||||
|
|
|
|||
|
|
@ -185,15 +185,15 @@ create_connection (NMDevice *device, NMAccessPoint *ap)
|
|||
}
|
||||
|
||||
if (setting) {
|
||||
NMSettingInfo *info;
|
||||
NMSettingConnection *scon;
|
||||
|
||||
connection = nm_connection_new ();
|
||||
nm_connection_add_setting (connection, setting);
|
||||
|
||||
info = (NMSettingInfo *) nm_setting_info_new ();
|
||||
info->name = g_strdup ("Auto");
|
||||
info->devtype = g_strdup (setting->name);
|
||||
nm_connection_add_setting (connection, (NMSetting *) info);
|
||||
scon = (NMSettingConnection *) nm_setting_connection_new ();
|
||||
scon->name = g_strdup ("Auto");
|
||||
scon->devtype = g_strdup (setting->name);
|
||||
nm_connection_add_setting (connection, (NMSetting *) scon);
|
||||
}
|
||||
|
||||
return connection;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue