NetworkManager/libnm-util/nm-setting.h

206 lines
4.8 KiB
C
Raw Normal View History

/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#ifndef NM_SETTING_H
#define NM_SETTING_H
#include <glib.h>
G_BEGIN_DECLS
typedef struct _NMSetting NMSetting;
typedef NMSetting *(*NMSettingCreateFn) (GHashTable *settings);
typedef gboolean (*NMSettingVerifyFn) (NMSetting *setting,
GHashTable *all_settings);
typedef GHashTable *(*NMSettingToHashFn) (NMSetting *setting);
2007-09-11 Dan Williams <dcbw@redhat.com> * libnm-util/nm-setting.c libnm-util/nm-setting.h - (nm_setting_update_secrets): new function; add a virtual function that subclasses can implement to update their secrets - (setting_wireless_security_update_secrets): implement that function for the 802-11-wireless-security subclass * libnm-util/nm-connection.c libnm-util/nm-connection.h - (nm_connection_update_secrets): update secrets for a Setting and emit a signal on success * src/nm-manager.c src/nm-manager.h src/nm-marshal.list - (connection_get_settings_cb): enable system settings bits - (nm_manager_get_connection_secrets, get_secrets_cb): add function to request secrets from the settings dbus service and to push those secrets to the NMConnection itself * src/nm-activation-request.c src/nm-activation-request.h - Attach to the 'secrets-updated' signal of the NMConnection that's currently being activated, and proxy that signal to other listeners. Goes through the activation request because the activation request is the thing that manages the lifetime of the NMConnection that's being activated. * src/nm-device-802-11-wireless.c - (real_connection_secrets_updated): implement the connection secrets updated notification and restart activation when secrets are received - (real_act_stage2_config): request secrets from the settings dbus service if secrets are needed * src/nm-device.c src/nm-device.h - (clear_act_request, nm_device_activation_cancel, nm_device_deactivate_quickly, nm_device_dispose): consolidate places where the activation request is cleared - (nm_device_activate, connection_secrets_updated_cb): attach to the updated secrets signal of activation request and add a function that subclasses can override to handle it easily git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2782 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-11 18:02:27 +00:00
typedef gboolean (*NMSettingUpdateSecretsFn) (NMSetting *setting,
GHashTable *secrets);
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;
2007-09-11 Dan Williams <dcbw@redhat.com> * libnm-util/nm-setting.c libnm-util/nm-setting.h - (nm_setting_update_secrets): new function; add a virtual function that subclasses can implement to update their secrets - (setting_wireless_security_update_secrets): implement that function for the 802-11-wireless-security subclass * libnm-util/nm-connection.c libnm-util/nm-connection.h - (nm_connection_update_secrets): update secrets for a Setting and emit a signal on success * src/nm-manager.c src/nm-manager.h src/nm-marshal.list - (connection_get_settings_cb): enable system settings bits - (nm_manager_get_connection_secrets, get_secrets_cb): add function to request secrets from the settings dbus service and to push those secrets to the NMConnection itself * src/nm-activation-request.c src/nm-activation-request.h - Attach to the 'secrets-updated' signal of the NMConnection that's currently being activated, and proxy that signal to other listeners. Goes through the activation request because the activation request is the thing that manages the lifetime of the NMConnection that's being activated. * src/nm-device-802-11-wireless.c - (real_connection_secrets_updated): implement the connection secrets updated notification and restart activation when secrets are received - (real_act_stage2_config): request secrets from the settings dbus service if secrets are needed * src/nm-device.c src/nm-device.h - (clear_act_request, nm_device_activation_cancel, nm_device_deactivate_quickly, nm_device_dispose): consolidate places where the activation request is cleared - (nm_device_activate, connection_secrets_updated_cb): attach to the updated secrets signal of activation request and add a function that subclasses can override to handle it easily git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2782 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-11 18:02:27 +00:00
NMSettingUpdateSecretsFn update_secrets_fn;
NMSettingNeedSecretsFn need_secrets_fn;
NMSettingDestroyFn destroy_fn;
};
gboolean nm_settings_verify (GHashTable *all_settings);
GHashTable *nm_setting_to_hash (NMSetting *setting);
2007-09-11 Dan Williams <dcbw@redhat.com> * libnm-util/nm-setting.c libnm-util/nm-setting.h - (nm_setting_update_secrets): new function; add a virtual function that subclasses can implement to update their secrets - (setting_wireless_security_update_secrets): implement that function for the 802-11-wireless-security subclass * libnm-util/nm-connection.c libnm-util/nm-connection.h - (nm_connection_update_secrets): update secrets for a Setting and emit a signal on success * src/nm-manager.c src/nm-manager.h src/nm-marshal.list - (connection_get_settings_cb): enable system settings bits - (nm_manager_get_connection_secrets, get_secrets_cb): add function to request secrets from the settings dbus service and to push those secrets to the NMConnection itself * src/nm-activation-request.c src/nm-activation-request.h - Attach to the 'secrets-updated' signal of the NMConnection that's currently being activated, and proxy that signal to other listeners. Goes through the activation request because the activation request is the thing that manages the lifetime of the NMConnection that's being activated. * src/nm-device-802-11-wireless.c - (real_connection_secrets_updated): implement the connection secrets updated notification and restart activation when secrets are received - (real_act_stage2_config): request secrets from the settings dbus service if secrets are needed * src/nm-device.c src/nm-device.h - (clear_act_request, nm_device_activation_cancel, nm_device_deactivate_quickly, nm_device_dispose): consolidate places where the activation request is cleared - (nm_device_activate, connection_secrets_updated_cb): attach to the updated secrets signal of activation request and add a function that subclasses can override to handle it easily git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2782 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-09-11 18:02:27 +00:00
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 */
/* Connection */
typedef struct {
NMSetting parent;
char *name;
char *devtype;
gboolean autoconnect;
} NMSettingConnection;
NMSetting *nm_setting_connection_new (void);
NMSetting *nm_setting_connection_new_from_hash (GHashTable *settings);
/* IP4 config */
typedef struct {
NMSetting parent;
gboolean manual;
guint32 address;
guint32 netmask;
guint32 gateway;
} NMSettingIP4Config;
NMSetting *nm_setting_ip4_config_new (void);
NMSetting *nm_setting_ip4_config_new_from_hash (GHashTable *settings);
/* Wired device */
typedef struct {
NMSetting parent;
char *port;
guint32 speed;
char *duplex;
gboolean auto_negotiate;
GByteArray *mac_address;
guint32 mtu;
} NMSettingWired;
NMSetting *nm_setting_wired_new (void);
NMSetting *nm_setting_wired_new_from_hash (GHashTable *settings);
/* Wireless device */
typedef struct {
NMSetting parent;
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);
NMSetting *nm_setting_wireless_new_from_hash (GHashTable *settings);
/* Wireless security */
typedef struct {
NMSetting parent;
char *key_mgmt;
guint32 wep_tx_keyidx;
char *auth_alg;
char *proto;
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);
NMSetting *nm_setting_wireless_security_new_from_hash (GHashTable *settings);
/* 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);
NMSetting *nm_setting_ppp_new_from_hash (GHashTable *settings);
G_END_DECLS
#endif /* NM_SETTING_H */