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 | |
15 | namespace NetworkManager |
16 | { |
17 | class WirelessSecuritySettingPrivate; |
18 | |
19 | /** |
20 | * Represents wireless security setting |
21 | */ |
22 | class NETWORKMANAGERQT_EXPORT WirelessSecuritySetting : public Setting |
23 | { |
24 | public: |
25 | typedef QSharedPointer<WirelessSecuritySetting> Ptr; |
26 | typedef QList<Ptr> List; |
27 | enum KeyMgmt { |
28 | Unknown = -1, |
29 | Wep, |
30 | Ieee8021x, |
31 | WpaNone, |
32 | WpaPsk, |
33 | WpaEap, |
34 | SAE, |
35 | WpaEapSuiteB192, |
36 | }; |
37 | enum AuthAlg { |
38 | None, |
39 | Open, |
40 | Shared, |
41 | Leap, |
42 | }; |
43 | enum WpaProtocolVersion { |
44 | Wpa, |
45 | Rsn, |
46 | }; |
47 | enum WpaEncryptionCapabilities { |
48 | Wep40, |
49 | Wep104, |
50 | Tkip, |
51 | Ccmp, |
52 | }; |
53 | enum WepKeyType { |
54 | NotSpecified, |
55 | Hex, |
56 | Passphrase, |
57 | }; |
58 | enum Pmf { |
59 | DefaultPmf, |
60 | DisablePmf, |
61 | OptionalPmf, |
62 | RequiredPmf, |
63 | }; |
64 | |
65 | WirelessSecuritySetting(); |
66 | explicit WirelessSecuritySetting(const Ptr &other); |
67 | ~WirelessSecuritySetting() override; |
68 | |
69 | QString name() const override; |
70 | |
71 | void setKeyMgmt(KeyMgmt mgmt); |
72 | KeyMgmt keyMgmt() const; |
73 | |
74 | void setWepTxKeyindex(quint32 index); |
75 | quint32 wepTxKeyindex() const; |
76 | |
77 | void setAuthAlg(AuthAlg alg); |
78 | AuthAlg authAlg() const; |
79 | |
80 | void setProto(const QList<WpaProtocolVersion> &list); |
81 | QList<WpaProtocolVersion> proto() const; |
82 | |
83 | void setPairwise(const QList<WpaEncryptionCapabilities> &list); |
84 | QList<WpaEncryptionCapabilities> pairwise() const; |
85 | |
86 | void setGroup(const QList<WpaEncryptionCapabilities> &list); |
87 | QList<WpaEncryptionCapabilities> group() const; |
88 | |
89 | void setLeapUsername(const QString &username); |
90 | QString leapUsername() const; |
91 | |
92 | void setWepKey0(const QString key); |
93 | QString wepKey0() const; |
94 | |
95 | void setWepKey1(const QString key); |
96 | QString wepKey1() const; |
97 | |
98 | void setWepKey2(const QString key); |
99 | QString wepKey2() const; |
100 | |
101 | void setWepKey3(const QString key); |
102 | QString wepKey3() const; |
103 | |
104 | void setWepKeyFlags(SecretFlags type); |
105 | SecretFlags wepKeyFlags() const; |
106 | |
107 | void setWepKeyType(WepKeyType type); |
108 | WepKeyType wepKeyType() const; |
109 | |
110 | void setPsk(const QString &key); |
111 | QString psk() const; |
112 | |
113 | void setPskFlags(SecretFlags type); |
114 | SecretFlags pskFlags() const; |
115 | |
116 | void setLeapPassword(const QString &password); |
117 | QString leapPassword() const; |
118 | |
119 | void setLeapPasswordFlags(SecretFlags type); |
120 | SecretFlags leapPasswordFlags() const; |
121 | |
122 | void setPmf(Pmf pmf); |
123 | Pmf pmf() const; |
124 | |
125 | void secretsFromMap(const QVariantMap &secrets) override; |
126 | |
127 | QVariantMap secretsToMap() const override; |
128 | |
129 | QStringList needSecrets(bool requestNew = false) const override; |
130 | |
131 | void fromMap(const QVariantMap &map) override; |
132 | |
133 | QVariantMap toMap() const override; |
134 | |
135 | protected: |
136 | WirelessSecuritySettingPrivate *d_ptr; |
137 | |
138 | private: |
139 | Q_DECLARE_PRIVATE(WirelessSecuritySetting) |
140 | }; |
141 | |
142 | NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const WirelessSecuritySetting &setting); |
143 | |
144 | } |
145 | |
146 | #endif // NETWORKMANAGERQT_WIRELESSSECURITY_SETTING_H |
147 | |