summaryrefslogtreecommitdiff
path: root/libnm-util/nm-setting.h
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-util/nm-setting.h')
-rw-r--r--libnm-util/nm-setting.h278
1 files changed, 44 insertions, 234 deletions
diff --git a/libnm-util/nm-setting.h b/libnm-util/nm-setting.h
index cfab40b1a3..2279bf5514 100644
--- a/libnm-util/nm-setting.h
+++ b/libnm-util/nm-setting.h
@@ -3,264 +3,74 @@
#ifndef NM_SETTING_H
#define NM_SETTING_H
-#include <glib.h>
+#include <glib/gtypes.h>
+#include <glib-object.h>
G_BEGIN_DECLS
-typedef struct _NMSetting NMSetting;
+#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))
-typedef NMSetting *(*NMSettingCreateFn) (void);
-typedef gboolean (*NMSettingPopulateFn) (NMSetting *setting,
- GHashTable *hash);
-typedef gboolean (*NMSettingVerifyFn) (NMSetting *setting,
- GHashTable *all_settings);
+#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))
-typedef GHashTable *(*NMSettingToHashFn) (NMSetting *setting);
-
-typedef gboolean (*NMSettingUpdateSecretsFn) (NMSetting *setting,
- GHashTable *secrets);
-
-typedef GPtrArray *(*NMSettingNeedSecretsFn) (NMSetting *setting);
-
-typedef void (*NMSettingClearSecretsFn) (NMSetting *setting);
-
-typedef gboolean (*NMSettingCompareFn) (NMSetting *setting,
- NMSetting *other,
- gboolean two_way);
-
-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
-#define NM_S_TYPE_GVALUE_HASH 6
-#define NM_S_TYPE_UINT64 7
-#define NM_S_TYPE_UINT_ARRAY 8
-
-#define NM_S_TYPE_IP4_ADDRESSES 9
-
-
-typedef struct SettingMember {
- const char *key;
- guint32 type;
- gulong offset;
- gboolean required;
- gboolean secret;
-} SettingMember;
-
-struct _NMSetting {
- char *name;
- SettingMember *_members; /* Private */
-
- NMSettingPopulateFn populate_fn;
- NMSettingVerifyFn verify_fn;
- NMSettingToHashFn hash_fn;
- NMSettingUpdateSecretsFn update_secrets_fn;
- NMSettingNeedSecretsFn need_secrets_fn;
- NMSettingClearSecretsFn clear_secrets_fn;
- NMSettingCompareFn compare_fn;
- NMSettingDestroyFn destroy_fn;
-};
-
-gboolean nm_settings_verify_all (GHashTable *all_settings);
-
-gboolean nm_setting_populate_from_hash (NMSetting *setting, GHashTable *hash);
-gboolean nm_setting_verify (NMSetting *setting);
-gboolean nm_setting_compare (NMSetting *setting, NMSetting *other, gboolean two_way);
-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_clear_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 */
-
-/* Connection */
-
-#define NM_SETTING_CONNECTION "connection"
+#define NM_SETTING_NAME "name"
typedef struct {
- NMSetting parent;
+ GObject parent;
char *name;
- char *type;
- gboolean autoconnect;
- guint64 timestamp;
-} NMSettingConnection;
-
-NMSetting *nm_setting_connection_new (void);
-
-/* IP4 config */
-
-#define NM_SETTING_IP4_CONFIG "ipv4"
+} NMSetting;
typedef struct {
- guint32 address;
- guint32 netmask;
- guint32 gateway;
-} NMSettingIP4Address;
+ GObjectClass parent;
-typedef struct {
- NMSetting parent;
+ /* Virtual functions */
+ gboolean (*verify) (NMSetting *setting,
+ GSList *all_settings);
- gboolean manual;
- GArray *dns;
- GSList *dns_search; /* GSList of strings */
- GSList *addresses; /* GSList of NMSettingIP4Address */
-} NMSettingIP4Config;
+ GPtrArray *(*need_secrets) (NMSetting *setting);
+} NMSettingClass;
-NMSetting *nm_setting_ip4_config_new (void);
+typedef void (*NMSettingValueIterFn) (NMSetting *setting,
+ const char *key,
+ const GValue *value,
+ gboolean secret,
+ gpointer user_data);
-/* Wired device */
-#define NM_SETTING_WIRED "802-3-ethernet"
+GType nm_setting_get_type (void);
-typedef struct {
- NMSetting parent;
+GHashTable *nm_setting_to_hash (NMSetting *setting);
+NMSetting *nm_setting_from_hash (GType setting_type,
+ GHashTable *hash);
- char *port;
- guint32 speed;
- char *duplex;
- gboolean auto_negotiate;
- GByteArray *mac_address;
- guint32 mtu;
-} NMSettingWired;
+const char *nm_setting_get_name (NMSetting *setting);
-NMSetting *nm_setting_wired_new (void);
+gboolean nm_setting_verify (NMSetting *setting,
+ GSList *all_settings);
-/* Wireless device */
-
-#define NM_SETTING_WIRELESS "802-11-wireless"
-
-typedef struct {
- NMSetting parent;
+gboolean nm_setting_compare (NMSetting *setting,
+ NMSetting *other);
- GByteArray *ssid;
- char *mode;
- char *band;
- guint32 channel;
- GByteArray *bssid;
- guint32 rate;
- guint32 tx_power;
- GByteArray *mac_address;
- guint32 mtu;
- GSList *seen_bssids;
- char *security;
-} NMSettingWireless;
-
-NMSetting *nm_setting_wireless_new (void);
-
-/* Wireless security */
-
-#define NM_SETTING_WIRELESS_SECURITY "802-11-wireless-security"
-
-typedef struct {
- NMSetting parent;
-
- char *key_mgmt;
- guint32 wep_tx_keyidx;
- char *auth_alg;
- GSList *proto; /* GSList of strings */
- GSList *pairwise; /* GSList of strings */
- GSList *group; /* GSList of strings */
- GSList *eap; /* GSList of strings */
- char *identity;
- char *anonymous_identity;
- GByteArray *ca_cert;
- char *ca_path;
- GByteArray *client_cert;
- GByteArray *private_key;
- char *phase1_peapver;
- char *phase1_peaplabel;
- char *phase1_fast_provisioning;
- char *phase2_auth;
- char *phase2_autheap;
- GByteArray *phase2_ca_cert;
- char *phase2_ca_path;
- GByteArray *phase2_client_cert;
- GByteArray *phase2_private_key;
- char *nai;
- char *wep_key0;
- char *wep_key1;
- char *wep_key2;
- char *wep_key3;
- char *psk;
- char *password;
- char *pin;
- char *eappsk;
- char *private_key_passwd;
- char *phase2_private_key_passwd;
-} NMSettingWirelessSecurity;
-
-NMSetting *nm_setting_wireless_security_new (void);
-
-/* PPP */
-
-#define NM_SETTING_PPP "ppp"
-
-typedef struct {
- NMSetting parent;
-
- gboolean noauth;
- gboolean refuse_eap;
- gboolean refuse_chap;
- gboolean refuse_mschap;
- gboolean nobsdcomp;
- gboolean nodeflate;
- gboolean require_mppe;
- gboolean require_mppe_128;
- gboolean mppe_stateful;
- gboolean require_mppc;
- gboolean crtscts;
- gboolean usepeerdns;
-
- gint32 baud;
- gint32 mru;
- gint32 mtu;
- gint32 lcp_echo_failure;
- gint32 lcp_echo_interval;
-} NMSettingPPP;
-
-NMSetting *nm_setting_ppp_new (void);
-
-/* VPN */
-
-#define NM_SETTING_VPN "vpn"
-
-typedef struct {
- NMSetting parent;
-
- char *service_type;
- char *user_name;
- GSList *routes;
-} NMSettingVPN;
-
-NMSetting *nm_setting_vpn_new (void);
-
-/* VPN properties */
-
-#define NM_SETTING_VPN_PROPERTIES "vpn-properties"
-
-typedef struct {
- NMSetting parent;
+void nm_setting_enumerate_values (NMSetting *setting,
+ NMSettingValueIterFn func,
+ gpointer user_data);
- GHashTable *data;
-} NMSettingVPNProperties;
+char *nm_setting_to_string (NMSetting *setting);
-NMSetting *nm_setting_vpn_properties_new (void);
+/* 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 */
+