mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 07:20:14 +01:00
Rework NMSetting structures: Move each setting to it's own file.
Convert to GObject. Remove home grown setting types and use
GTypes.
Use GObject property introspection for hash conversion,
enumerating
properties, etc.
* libnm-util/nm-setting-connection.[ch]
* libnm-util/nm-setting-ip4-config.[ch]
* libnm-util/nm-setting-ppp.[ch]
* libnm-util/nm-setting-vpn.[ch]
* libnm-util/nm-setting-vpn-properties.[ch]
* libnm-util/nm-setting-wired.[ch]
* libnm-util/nm-setting-wireless.[ch]
* libnm-util/nm-setting-wireless-security.[ch]
New files, each containing a setting.
* libnm-util/nm-setting-template.[ch]: A template for creating
* new
settings. To use it, just replace 'template' with the new
setting
name, and you're half-way done.
* libnm-util/nm-setting.c: Convert to GObject and use GObject
introspection instead of internal types and tables.
* libnm-util/nm-connection.c: Adapt the new NMSetting work.
* libnm-util/nm-param-spec-specialized.[ch]: Implement. Handles
GValue types defined by dbus-glib for composed types like
collections,
structures and maps.
* src/*: The API of NMSetting and NMConnection changed a bit:
* Getting
a setting from connection takes the setting type now. Also,
since
the settings are in multiple files, include relevant settings.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3068 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
76 lines
2.3 KiB
C
76 lines
2.3 KiB
C
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
|
|
|
#ifndef NM_SETTING_H
|
|
#define NM_SETTING_H
|
|
|
|
#include <glib/gtypes.h>
|
|
#include <glib-object.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define NM_TYPE_SETTING (nm_setting_get_type ())
|
|
#define NM_SETTING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING, NMSetting))
|
|
#define NM_SETTING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING, NMSettingClass))
|
|
#define NM_IS_SETTING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING))
|
|
#define NM_IS_SETTING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SETTING))
|
|
#define NM_SETTING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING, NMSettingClass))
|
|
|
|
#define NM_SETTING_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT))
|
|
#define NM_SETTING_PARAM_REQUIRED (1 << (1 + G_PARAM_USER_SHIFT))
|
|
#define NM_SETTING_PARAM_SECRET (1 << (2 + G_PARAM_USER_SHIFT))
|
|
|
|
#define NM_SETTING_NAME "name"
|
|
|
|
typedef struct {
|
|
GObject parent;
|
|
|
|
char *name;
|
|
} NMSetting;
|
|
|
|
typedef struct {
|
|
GObjectClass parent;
|
|
|
|
/* Virtual functions */
|
|
gboolean (*verify) (NMSetting *setting,
|
|
GSList *all_settings);
|
|
|
|
GPtrArray *(*need_secrets) (NMSetting *setting);
|
|
} NMSettingClass;
|
|
|
|
typedef void (*NMSettingValueIterFn) (NMSetting *setting,
|
|
const char *key,
|
|
const GValue *value,
|
|
gboolean secret,
|
|
gpointer user_data);
|
|
|
|
|
|
GType nm_setting_get_type (void);
|
|
|
|
GHashTable *nm_setting_to_hash (NMSetting *setting);
|
|
NMSetting *nm_setting_from_hash (GType setting_type,
|
|
GHashTable *hash);
|
|
|
|
const char *nm_setting_get_name (NMSetting *setting);
|
|
|
|
gboolean nm_setting_verify (NMSetting *setting,
|
|
GSList *all_settings);
|
|
|
|
gboolean nm_setting_compare (NMSetting *setting,
|
|
NMSetting *other);
|
|
|
|
void nm_setting_enumerate_values (NMSetting *setting,
|
|
NMSettingValueIterFn func,
|
|
gpointer user_data);
|
|
|
|
char *nm_setting_to_string (NMSetting *setting);
|
|
|
|
/* Secrets */
|
|
void nm_setting_clear_secrets (NMSetting *setting);
|
|
GPtrArray *nm_setting_need_secrets (NMSetting *setting);
|
|
void nm_setting_update_secrets (NMSetting *setting,
|
|
GHashTable *secrets);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* NM_SETTING_H */
|
|
|