mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 02:30:24 +01:00
2007-09-16 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-connection.c libnm-util/nm-connection.h - (nm_connection_for_each_setting_value): new function; iterate over each setting's value and call a user-provided function with details about that value * libnm-util/nm-setting.c libnm-util/nm-setting.h - (nm_setting_enumerate_values): new function; enumerate the values of a specific NMSetting subclass for a user-provided function with details about that value - Change wep_tx_keyidx to a uint32 - Create settings value tables for each setting defining their type, key name, offset into the NMSetting subclass' structure, and whether they are required and/or a secret - (nm_setting_populate_from_hash): generic function to populate an NMSetting from a GHash table, make all settings use it - (nm_setting_hash): generic function to derive a GHashTable from an NMSetting object, make all settings use it git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2823 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
d237799c68
commit
7535733df5
5 changed files with 397 additions and 577 deletions
22
ChangeLog
22
ChangeLog
|
|
@ -1,3 +1,25 @@
|
|||
2007-09-16 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-connection.c
|
||||
libnm-util/nm-connection.h
|
||||
- (nm_connection_for_each_setting_value): new function; iterate over
|
||||
each setting's value and call a user-provided function with details
|
||||
about that value
|
||||
|
||||
* libnm-util/nm-setting.c
|
||||
libnm-util/nm-setting.h
|
||||
- (nm_setting_enumerate_values): new function; enumerate the values
|
||||
of a specific NMSetting subclass for a user-provided function with
|
||||
details about that value
|
||||
- Change wep_tx_keyidx to a uint32
|
||||
- Create settings value tables for each setting defining their type,
|
||||
key name, offset into the NMSetting subclass' structure, and whether
|
||||
they are required and/or a secret
|
||||
- (nm_setting_populate_from_hash): generic function to populate an
|
||||
NMSetting from a GHash table, make all settings use it
|
||||
- (nm_setting_hash): generic function to derive a GHashTable from
|
||||
an NMSetting object, make all settings use it
|
||||
|
||||
2007-09-14 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Remove unused stuff in libnm-util
|
||||
|
|
|
|||
|
|
@ -229,6 +229,46 @@ nm_connection_to_hash (NMConnection *connection)
|
|||
return connection_hash;
|
||||
}
|
||||
|
||||
typedef struct ForEachValueInfo {
|
||||
NMSettingValueIterFn func;
|
||||
gpointer user_data;
|
||||
} ForEachValueInfo;
|
||||
|
||||
static void
|
||||
for_each_setting (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
ForEachValueInfo *info = (ForEachValueInfo *) user_data;
|
||||
NMSetting *setting = (NMSetting *) value;
|
||||
|
||||
nm_setting_enumerate_values (setting, info->func, info->user_data);
|
||||
}
|
||||
|
||||
void
|
||||
nm_connection_for_each_setting_value (NMConnection *connection,
|
||||
NMSettingValueIterFn func,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMConnectionPrivate *priv;
|
||||
ForEachValueInfo *info;
|
||||
|
||||
g_return_if_fail (NM_IS_CONNECTION (connection));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
priv = NM_CONNECTION_GET_PRIVATE (connection);
|
||||
|
||||
info = g_slice_new0 (ForEachValueInfo);
|
||||
if (!info) {
|
||||
g_warning ("Not enough memory to enumerate values.");
|
||||
return;
|
||||
}
|
||||
info->func = func;
|
||||
info->user_data = user_data;
|
||||
|
||||
g_hash_table_foreach (priv->settings, for_each_setting, info);
|
||||
|
||||
g_slice_free (ForEachValueInfo, info);
|
||||
}
|
||||
|
||||
static char *
|
||||
gvalue_to_string (GValue *val)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ void nm_connection_update_secrets (NMConnection *connection,
|
|||
const char *setting_name,
|
||||
GHashTable *secrets);
|
||||
|
||||
void nm_connection_for_each_setting_value (NMConnection *connection,
|
||||
NMSettingValueIterFn func,
|
||||
gpointer user_data);
|
||||
|
||||
GHashTable *nm_connection_to_hash (NMConnection *connection);
|
||||
void nm_connection_dump (NMConnection *connection);
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -22,8 +22,30 @@ typedef GPtrArray *(*NMSettingNeedSecretsFn) (NMSetting *setting);
|
|||
|
||||
typedef void (*NMSettingDestroyFn) (NMSetting *setting);
|
||||
|
||||
typedef void (*NMSettingValueIterFn) (NMSetting *setting,
|
||||
const char *key,
|
||||
guint32 type,
|
||||
void *value,
|
||||
gboolean secret,
|
||||
gpointer user_data);
|
||||
|
||||
#define NM_S_TYPE_STRING 1
|
||||
#define NM_S_TYPE_UINT32 2
|
||||
#define NM_S_TYPE_BOOL 3
|
||||
#define NM_S_TYPE_BYTE_ARRAY 4
|
||||
#define NM_S_TYPE_STRING_ARRAY 5
|
||||
|
||||
typedef struct SettingMember {
|
||||
const char *key;
|
||||
guint32 type;
|
||||
gulong offset;
|
||||
gboolean required;
|
||||
gboolean secret;
|
||||
} SettingMember;
|
||||
|
||||
struct _NMSetting {
|
||||
char *name;
|
||||
SettingMember *_members; /* Private */
|
||||
|
||||
NMSettingVerifyFn verify_fn;
|
||||
NMSettingToHashFn hash_fn;
|
||||
|
|
@ -37,6 +59,9 @@ GHashTable *nm_setting_to_hash (NMSetting *setting);
|
|||
gboolean nm_setting_update_secrets (NMSetting *setting, GHashTable *secrets);
|
||||
GPtrArray * nm_setting_need_secrets (NMSetting *setting);
|
||||
void nm_setting_destroy (NMSetting *setting);
|
||||
void nm_setting_enumerate_values (NMSetting *setting,
|
||||
NMSettingValueIterFn func,
|
||||
gpointer user_data);
|
||||
|
||||
/* Default, built-in settings */
|
||||
|
||||
|
|
@ -110,7 +135,7 @@ typedef struct {
|
|||
NMSetting parent;
|
||||
|
||||
char *key_mgmt;
|
||||
guint8 wep_tx_keyidx;
|
||||
guint32 wep_tx_keyidx;
|
||||
char *auth_alg;
|
||||
char *proto;
|
||||
GSList *pairwise; /* GSList of strings */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue