mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 22:10:14 +01:00
2007-10-01 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.h - Add a 'timestamp' option to NMSettingConnection - Add a UINT64 type * libnm-util/nm-setting.c - (uint64_to_gvalue): new function - (nm_setting_populate_from_hash, nm_setting_hash, default_setting_clear_secrets): handle UINT64 type - con_table: add 'timestamp' member git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2923 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
ee3f96cfd9
commit
b7e5539b8c
3 changed files with 36 additions and 0 deletions
12
ChangeLog
12
ChangeLog
|
|
@ -1,3 +1,15 @@
|
|||
2007-10-01 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-setting.h
|
||||
- Add a 'timestamp' option to NMSettingConnection
|
||||
- Add a UINT64 type
|
||||
|
||||
* libnm-util/nm-setting.c
|
||||
- (uint64_to_gvalue): new function
|
||||
- (nm_setting_populate_from_hash, nm_setting_hash,
|
||||
default_setting_clear_secrets): handle UINT64 type
|
||||
- con_table: add 'timestamp' member
|
||||
|
||||
2007-10-01 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-manager.c
|
||||
|
|
|
|||
|
|
@ -195,6 +195,18 @@ uint_to_gvalue (guint32 i)
|
|||
return val;
|
||||
}
|
||||
|
||||
static GValue *
|
||||
uint64_to_gvalue (guint64 i)
|
||||
{
|
||||
GValue *val;
|
||||
|
||||
val = g_slice_new0 (GValue);
|
||||
g_value_init (val, G_TYPE_UINT64);
|
||||
g_value_set_uint64 (val, i);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static GValue *
|
||||
byte_to_gvalue (guchar c)
|
||||
{
|
||||
|
|
@ -316,6 +328,9 @@ nm_setting_populate_from_hash (NMSetting *setting, GHashTable *table)
|
|||
} else if ((m->type == NM_S_TYPE_UINT32) && G_VALUE_HOLDS_UINT (value)) {
|
||||
guint32 *val = (guint32 *) G_STRUCT_MEMBER_P (setting, m->offset);
|
||||
*val = g_value_get_uint (value);
|
||||
} else if ((m->type == NM_S_TYPE_UINT64) && G_VALUE_HOLDS_UINT64 (value)) {
|
||||
guint64 *val = (guint64 *) G_STRUCT_MEMBER_P (setting, m->offset);
|
||||
*val = g_value_get_uint64 (value);
|
||||
} else if ((m->type == NM_S_TYPE_BYTE_ARRAY) && G_VALUE_HOLDS_BOXED (value)) {
|
||||
GByteArray **val = (GByteArray **) G_STRUCT_MEMBER_P (setting, m->offset);
|
||||
*val = convert_array_to_byte_array ((GArray *) g_value_get_boxed (value));
|
||||
|
|
@ -365,6 +380,7 @@ nm_setting_hash (NMSetting *setting)
|
|||
ADD_MEMBER(NM_S_TYPE_STRING, char *, m->key, string_to_gvalue)
|
||||
ADD_MEMBER(NM_S_TYPE_BOOL, gboolean, m->key, boolean_to_gvalue)
|
||||
ADD_MEMBER(NM_S_TYPE_UINT32, guint32, m->key, uint_to_gvalue)
|
||||
ADD_MEMBER(NM_S_TYPE_UINT64, guint64, m->key, uint64_to_gvalue)
|
||||
ADD_MEMBER(NM_S_TYPE_BYTE_ARRAY, GByteArray *, m->key, byte_array_to_gvalue)
|
||||
ADD_MEMBER_EXTRA(NM_S_TYPE_STRING_ARRAY, GSList *, m->key, slist_to_gvalue, G_TYPE_STRING)
|
||||
default:
|
||||
|
|
@ -409,6 +425,11 @@ default_setting_clear_secrets (NMSetting *setting)
|
|||
*val = 0;
|
||||
break;
|
||||
}
|
||||
case NM_S_TYPE_UINT64: {
|
||||
guint64 *val = (guint64 *) G_STRUCT_MEMBER_P (setting, m->offset);
|
||||
*val = 0;
|
||||
break;
|
||||
}
|
||||
case NM_S_TYPE_BYTE_ARRAY: {
|
||||
GByteArray **val = (GByteArray **) G_STRUCT_MEMBER_P (setting, m->offset);
|
||||
g_byte_array_free (*val, TRUE);
|
||||
|
|
@ -459,6 +480,7 @@ static SettingMember con_table[] = {
|
|||
{ "name", NM_S_TYPE_STRING, G_STRUCT_OFFSET (NMSettingConnection, name), TRUE, FALSE },
|
||||
{ "type", NM_S_TYPE_STRING, G_STRUCT_OFFSET (NMSettingConnection, type), TRUE, FALSE },
|
||||
{ "autoconnect", NM_S_TYPE_BOOL, G_STRUCT_OFFSET (NMSettingConnection, autoconnect), FALSE, FALSE },
|
||||
{ "timestamp", NM_S_TYPE_UINT64, G_STRUCT_OFFSET (NMSettingConnection, timestamp), FALSE, FALSE },
|
||||
{ NULL, 0, 0 },
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ typedef void (*NMSettingValueIterFn) (NMSetting *setting,
|
|||
#define NM_S_TYPE_BYTE_ARRAY 4
|
||||
#define NM_S_TYPE_STRING_ARRAY 5
|
||||
#define NM_S_TYPE_GVALUE_HASH 6
|
||||
#define NM_S_TYPE_UINT64 7
|
||||
|
||||
typedef struct SettingMember {
|
||||
const char *key;
|
||||
|
|
@ -80,6 +81,7 @@ typedef struct {
|
|||
char *name;
|
||||
char *type;
|
||||
gboolean autoconnect;
|
||||
guint64 timestamp;
|
||||
} NMSettingConnection;
|
||||
|
||||
NMSetting *nm_setting_connection_new (void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue