1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
19 * Copyright 2007 - 2014 Red Hat, Inc.
20 * Copyright 2007 - 2008 Novell, Inc.
23 #ifndef NM_SETTING_WIRELESS_SECURITY_H
24 #define NM_SETTING_WIRELESS_SECURITY_H
26 #include <nm-setting.h>
30 #define NM_TYPE_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_get_type ())
31 #define NM_SETTING_WIRELESS_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_WIRELESS_SECURITY, NMSettingWirelessSecurity))
32 #define NM_SETTING_WIRELESS_SECURITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_WIRELESS_SECURITY, NMSettingWirelessSecurityClass))
33 #define NM_IS_SETTING_WIRELESS_SECURITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_WIRELESS_SECURITY))
34 #define NM_IS_SETTING_WIRELESS_SECURITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_WIRELESS_SECURITY))
35 #define NM_SETTING_WIRELESS_SECURITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_WIRELESS_SECURITY, NMSettingWirelessSecurityClass))
37 #define NM_SETTING_WIRELESS_SECURITY_SETTING_NAME "802-11-wireless-security"
40 * NMSettingWirelessSecurityError:
41 * @NM_SETTING_WIRELESS_SECURITY_ERROR_UNKNOWN: unknown or unclassified error
42 * @NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY: the property was invalid
43 * @NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_PROPERTY: the property was
44 * missing and is required
45 * @NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING: a property contained
46 * a value that requires the connection to contain a #NMSetting8021x setting
47 * @NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X: LEAP authentication
48 * was specified but key management was not set to "8021x"
49 * @NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME: LEAP authentication
50 * was specified but no LEAP username was given
51 * @NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP: Shared Key
52 * authentication was specified but the setting did not specify WEP as the
56 NM_SETTING_WIRELESS_SECURITY_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
57 NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/
58 NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_PROPERTY, /*< nick=MissingProperty >*/
59 NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING, /*< nick=Missing8021xSetting >*/
60 NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X, /*< nick=LEAPRequires8021x >*/
61 NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME, /*< nick=LEAPRequiresUsername >*/
62 NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP /*< nick=SharedKeyRequiresWEP >*/
63 } NMSettingWirelessSecurityError;
65 #define NM_SETTING_WIRELESS_SECURITY_ERROR nm_setting_wireless_security_error_quark ()
66 GQuark nm_setting_wireless_security_error_quark (void);
70 * @NM_WEP_KEY_TYPE_UNKNOWN: unknown WEP key type
71 * @NM_WEP_KEY_TYPE_KEY: indicates a hexadecimal or ASCII formatted WEP key.
72 * Hex keys are either 10 or 26 hexadecimal characters (ie "5f782f2f5f" or
73 * "732f2d712e4a394a375d366931"), while ASCII keys are either 5 or 13 ASCII
74 * characters (ie "abcde" or "blahblah99$*1").
75 * @NM_WEP_KEY_TYPE_PASSPHRASE: indicates a WEP passphrase (ex "I bought a duck
76 * on my way back from the market 235Q&^%^*%") instead of a hexadecimal or ASCII
77 * key. Passphrases are between 8 and 64 characters inclusive and are hashed
78 * the actual WEP key using the MD5 hash algorithm.
79 * @NM_WEP_KEY_TYPE_LAST: placeholder value for bounds-checking
81 * The #NMWepKeyType values specify how any WEP keys present in the setting
82 * are intepreted. There are no standards governing how to hash the various WEP
83 * key/passphrase formats into the actual WEP key. Unfortunately some WEP keys
84 * can be interpreted in multiple ways, requring the setting to specify how to
85 * interpret the any WEP keys. For example, the key "732f2d712e4a394a375d366931"
86 * is both a valid Hexadecimal WEP key and a WEP passphrase. Further, many
87 * ASCII keys are also valid WEP passphrases, but since passphrases and ASCII
88 * keys are hashed differently to determine the actual WEP key the type must be
92 NM_WEP_KEY_TYPE_UNKNOWN = 0,
93 NM_WEP_KEY_TYPE_KEY = 1, /* Hex or ASCII */
94 NM_WEP_KEY_TYPE_PASSPHRASE = 2, /* 104/128-bit Passphrase */
96 NM_WEP_KEY_TYPE_LAST = NM_WEP_KEY_TYPE_PASSPHRASE
99 #define NM_SETTING_WIRELESS_SECURITY_KEY_MGMT "key-mgmt"
100 #define NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX "wep-tx-keyidx"
101 #define NM_SETTING_WIRELESS_SECURITY_AUTH_ALG "auth-alg"
102 #define NM_SETTING_WIRELESS_SECURITY_PROTO "proto"
103 #define NM_SETTING_WIRELESS_SECURITY_PAIRWISE "pairwise"
104 #define NM_SETTING_WIRELESS_SECURITY_GROUP "group"
105 #define NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME "leap-username"
106 #define NM_SETTING_WIRELESS_SECURITY_WEP_KEY0 "wep-key0"
107 #define NM_SETTING_WIRELESS_SECURITY_WEP_KEY1 "wep-key1"
108 #define NM_SETTING_WIRELESS_SECURITY_WEP_KEY2 "wep-key2"
109 #define NM_SETTING_WIRELESS_SECURITY_WEP_KEY3 "wep-key3"
110 #define NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS "wep-key-flags"
111 #define NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE "wep-key-type"
112 #define NM_SETTING_WIRELESS_SECURITY_PSK "psk"
113 #define NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS "psk-flags"
114 #define NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD "leap-password"
115 #define NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS "leap-password-flags"
119 } NMSettingWirelessSecurity;
122 NMSettingClass parent;
124 /* Padding for future expansion */
125 void (*_reserved1) (void);
126 void (*_reserved2) (void);
127 void (*_reserved3) (void);
128 void (*_reserved4) (void);
129 } NMSettingWirelessSecurityClass;
131 GType nm_setting_wireless_security_get_type (void);
133 NMSetting * nm_setting_wireless_security_new (void);
135 const char *nm_setting_wireless_security_get_key_mgmt (NMSettingWirelessSecurity *setting);
137 guint32 nm_setting_wireless_security_get_num_protos (NMSettingWirelessSecurity *setting);
138 const char *nm_setting_wireless_security_get_proto (NMSettingWirelessSecurity *setting, guint32 i);
139 gboolean nm_setting_wireless_security_add_proto (NMSettingWirelessSecurity *setting, const char *proto);
140 void nm_setting_wireless_security_remove_proto (NMSettingWirelessSecurity *setting, guint32 i);
141 NM_AVAILABLE_IN_0_9_10
142 gboolean nm_setting_wireless_security_remove_proto_by_value (NMSettingWirelessSecurity *setting, const char *proto);
143 void nm_setting_wireless_security_clear_protos (NMSettingWirelessSecurity *setting);
145 guint32 nm_setting_wireless_security_get_num_pairwise (NMSettingWirelessSecurity *setting);
146 const char *nm_setting_wireless_security_get_pairwise (NMSettingWirelessSecurity *setting, guint32 i);
147 gboolean nm_setting_wireless_security_add_pairwise (NMSettingWirelessSecurity *setting, const char *pairwise);
148 void nm_setting_wireless_security_remove_pairwise (NMSettingWirelessSecurity *setting, guint32 i);
149 NM_AVAILABLE_IN_0_9_10
150 gboolean nm_setting_wireless_security_remove_pairwise_by_value (NMSettingWirelessSecurity *setting, const char *pairwise);
151 void nm_setting_wireless_security_clear_pairwise (NMSettingWirelessSecurity *setting);
153 guint32 nm_setting_wireless_security_get_num_groups (NMSettingWirelessSecurity *setting);
154 const char *nm_setting_wireless_security_get_group (NMSettingWirelessSecurity *setting, guint32 i);
155 gboolean nm_setting_wireless_security_add_group (NMSettingWirelessSecurity *setting, const char *group);
156 void nm_setting_wireless_security_remove_group (NMSettingWirelessSecurity *setting, guint32 i);
157 NM_AVAILABLE_IN_0_9_10
158 gboolean nm_setting_wireless_security_remove_group_by_value (NMSettingWirelessSecurity *setting, const char *group);
159 void nm_setting_wireless_security_clear_groups (NMSettingWirelessSecurity *setting);
161 const char *nm_setting_wireless_security_get_psk (NMSettingWirelessSecurity *setting);
162 NMSettingSecretFlags nm_setting_wireless_security_get_psk_flags (NMSettingWirelessSecurity *setting);
164 const char *nm_setting_wireless_security_get_leap_username (NMSettingWirelessSecurity *setting);
165 const char *nm_setting_wireless_security_get_leap_password (NMSettingWirelessSecurity *setting);
166 NMSettingSecretFlags nm_setting_wireless_security_get_leap_password_flags (NMSettingWirelessSecurity *setting);
168 const char *nm_setting_wireless_security_get_wep_key (NMSettingWirelessSecurity *setting, guint32 idx);
169 void nm_setting_wireless_security_set_wep_key (NMSettingWirelessSecurity *setting, guint32 idx, const char *key);
170 guint32 nm_setting_wireless_security_get_wep_tx_keyidx (NMSettingWirelessSecurity *setting);
171 const char *nm_setting_wireless_security_get_auth_alg (NMSettingWirelessSecurity *setting);
173 NMSettingSecretFlags nm_setting_wireless_security_get_wep_key_flags (NMSettingWirelessSecurity *setting);
174 NMWepKeyType nm_setting_wireless_security_get_wep_key_type (NMSettingWirelessSecurity *setting);
178 #endif /* NM_SETTING_WIRELESS_SECURITY_H */