1/*
2 SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef NETWORKMANAGERQT_WIRELESSSECURITY_SETTING_H
8#define NETWORKMANAGERQT_WIRELESSSECURITY_SETTING_H
9
10#include "setting.h"
11#include <networkmanagerqt/networkmanagerqt_export.h>
12
13#include <QStringList>
14
15namespace NetworkManager
16{
17class WirelessSecuritySettingPrivate;
18
19/*!
20 * \class NetworkManager::WirelessSecuritySetting
21 * \inheaderfile NetworkManagerQt/WirelessSecuritySetting
22 * \inmodule NetworkManagerQt
23 *
24 * \brief Represents wireless security setting.
25 */
26class NETWORKMANAGERQT_EXPORT WirelessSecuritySetting : public Setting
27{
28public:
29 /*!
30 * \typedef NetworkManager::WirelessSecuritySetting::Ptr
31 */
32 typedef QSharedPointer<WirelessSecuritySetting> Ptr;
33 /*!
34 * \typedef NetworkManager::WirelessSecuritySetting::List
35 */
36 typedef QList<Ptr> List;
37 /*!
38 *
39 * \value Unknown
40 * \value Wep
41 * \value Ieee8021x
42 * \value WpaNone
43 * \value WpaPsk
44 * \value WpaEap
45 * \value SAE
46 * \value WpaEapSuiteB192
47 * \value OWE
48 */
49 enum KeyMgmt {
50 Unknown = -1,
51 Wep,
52 Ieee8021x,
53 WpaNone,
54 WpaPsk,
55 WpaEap,
56 SAE,
57 WpaEapSuiteB192,
58 OWE,
59 };
60 /*!
61 *
62 * \value None
63 * \value Open
64 * \value Shared
65 * \value Leap
66 */
67 enum AuthAlg {
68 None,
69 Open,
70 Shared,
71 Leap,
72 };
73 /*!
74 *
75 * \value Wpa
76 * \value Rsn
77 */
78 enum WpaProtocolVersion {
79 Wpa,
80 Rsn,
81 };
82 /*!
83 *
84 * \value Wep40
85 * \value Wep104
86 * \value Tkip
87 * \value Ccmp
88 */
89 enum WpaEncryptionCapabilities {
90 Wep40,
91 Wep104,
92 Tkip,
93 Ccmp,
94 };
95 /*!
96 *
97 * \value NotSpecified
98 * \value Hex
99 * \value Passphrase
100 */
101 enum WepKeyType {
102 NotSpecified,
103 Hex,
104 Passphrase,
105 };
106 /*!
107 *
108 * \value DefaultPmf
109 * \value DisablePmf
110 * \value OptionalPmf
111 * \value RequiredPmf
112 */
113 enum Pmf {
114 DefaultPmf,
115 DisablePmf,
116 OptionalPmf,
117 RequiredPmf,
118 };
119
120 /*!
121 */
122 WirelessSecuritySetting();
123 /*!
124 */
125 explicit WirelessSecuritySetting(const Ptr &other);
126 ~WirelessSecuritySetting() override;
127
128 QString name() const override;
129
130 /*!
131 */
132 void setKeyMgmt(KeyMgmt mgmt);
133 /*!
134 */
135 KeyMgmt keyMgmt() const;
136
137 /*!
138 */
139 void setWepTxKeyindex(quint32 index);
140 /*!
141 */
142 quint32 wepTxKeyindex() const;
143
144 /*!
145 */
146 void setAuthAlg(AuthAlg alg);
147 /*!
148 */
149 AuthAlg authAlg() const;
150
151 /*!
152 */
153 void setProto(const QList<WpaProtocolVersion> &list);
154 /*!
155 */
156 QList<WpaProtocolVersion> proto() const;
157
158 /*!
159 */
160 void setPairwise(const QList<WpaEncryptionCapabilities> &list);
161 /*!
162 */
163 QList<WpaEncryptionCapabilities> pairwise() const;
164
165 /*!
166 */
167 void setGroup(const QList<WpaEncryptionCapabilities> &list);
168 /*!
169 */
170 QList<WpaEncryptionCapabilities> group() const;
171
172 /*!
173 */
174 void setLeapUsername(const QString &username);
175 /*!
176 */
177 QString leapUsername() const;
178
179 /*!
180 */
181 void setWepKey0(const QString key);
182 /*!
183 */
184 QString wepKey0() const;
185
186 /*!
187 */
188 void setWepKey1(const QString key);
189 /*!
190 */
191 QString wepKey1() const;
192
193 /*!
194 */
195 void setWepKey2(const QString key);
196 /*!
197 */
198 QString wepKey2() const;
199
200 /*!
201 */
202 void setWepKey3(const QString key);
203 /*!
204 */
205 QString wepKey3() const;
206
207 /*!
208 */
209 void setWepKeyFlags(SecretFlags type);
210 /*!
211 */
212 SecretFlags wepKeyFlags() const;
213
214 /*!
215 */
216 void setWepKeyType(WepKeyType type);
217 /*!
218 */
219 WepKeyType wepKeyType() const;
220
221 /*!
222 */
223 void setPsk(const QString &key);
224 /*!
225 */
226 QString psk() const;
227
228 /*!
229 */
230 void setPskFlags(SecretFlags type);
231 /*!
232 */
233 SecretFlags pskFlags() const;
234
235 /*!
236 */
237 void setLeapPassword(const QString &password);
238 /*!
239 */
240 QString leapPassword() const;
241
242 /*!
243 */
244 void setLeapPasswordFlags(SecretFlags type);
245 /*!
246 */
247 SecretFlags leapPasswordFlags() const;
248
249 /*!
250 */
251 void setPmf(Pmf pmf);
252 /*!
253 */
254 Pmf pmf() const;
255
256 void secretsFromMap(const QVariantMap &secrets) override;
257
258 QVariantMap secretsToMap() const override;
259
260 QStringList needSecrets(bool requestNew = false) const override;
261
262 void fromMap(const QVariantMap &map) override;
263
264 QVariantMap toMap() const override;
265
266protected:
267 WirelessSecuritySettingPrivate *d_ptr;
268
269private:
270 Q_DECLARE_PRIVATE(WirelessSecuritySetting)
271};
272
273NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const WirelessSecuritySetting &setting);
274
275}
276
277#endif // NETWORKMANAGERQT_WIRELESSSECURITY_SETTING_H
278

source code of networkmanager-qt/src/settings/wirelesssecuritysetting.h