File indexing completed on 2024-04-21 04:00:08

0001 /*
0002     SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef NETWORKMANAGERQT_WIRELESSSECURITY_SETTING_H
0008 #define NETWORKMANAGERQT_WIRELESSSECURITY_SETTING_H
0009 
0010 #include "setting.h"
0011 #include <networkmanagerqt/networkmanagerqt_export.h>
0012 
0013 #include <QStringList>
0014 
0015 namespace NetworkManager
0016 {
0017 class WirelessSecuritySettingPrivate;
0018 
0019 /**
0020  * Represents wireless security setting
0021  */
0022 class NETWORKMANAGERQT_EXPORT WirelessSecuritySetting : public Setting
0023 {
0024 public:
0025     typedef QSharedPointer<WirelessSecuritySetting> Ptr;
0026     typedef QList<Ptr> List;
0027     enum KeyMgmt {
0028         Unknown = -1,
0029         Wep,
0030         Ieee8021x,
0031         WpaNone,
0032         WpaPsk,
0033         WpaEap,
0034         SAE,
0035         WpaEapSuiteB192,
0036     };
0037     enum AuthAlg {
0038         None,
0039         Open,
0040         Shared,
0041         Leap,
0042     };
0043     enum WpaProtocolVersion {
0044         Wpa,
0045         Rsn,
0046     };
0047     enum WpaEncryptionCapabilities {
0048         Wep40,
0049         Wep104,
0050         Tkip,
0051         Ccmp,
0052     };
0053     enum WepKeyType {
0054         NotSpecified,
0055         Hex,
0056         Passphrase,
0057     };
0058     enum Pmf {
0059         DefaultPmf,
0060         DisablePmf,
0061         OptionalPmf,
0062         RequiredPmf,
0063     };
0064 
0065     WirelessSecuritySetting();
0066     explicit WirelessSecuritySetting(const Ptr &other);
0067     ~WirelessSecuritySetting() override;
0068 
0069     QString name() const override;
0070 
0071     void setKeyMgmt(KeyMgmt mgmt);
0072     KeyMgmt keyMgmt() const;
0073 
0074     void setWepTxKeyindex(quint32 index);
0075     quint32 wepTxKeyindex() const;
0076 
0077     void setAuthAlg(AuthAlg alg);
0078     AuthAlg authAlg() const;
0079 
0080     void setProto(const QList<WpaProtocolVersion> &list);
0081     QList<WpaProtocolVersion> proto() const;
0082 
0083     void setPairwise(const QList<WpaEncryptionCapabilities> &list);
0084     QList<WpaEncryptionCapabilities> pairwise() const;
0085 
0086     void setGroup(const QList<WpaEncryptionCapabilities> &list);
0087     QList<WpaEncryptionCapabilities> group() const;
0088 
0089     void setLeapUsername(const QString &username);
0090     QString leapUsername() const;
0091 
0092     void setWepKey0(const QString key);
0093     QString wepKey0() const;
0094 
0095     void setWepKey1(const QString key);
0096     QString wepKey1() const;
0097 
0098     void setWepKey2(const QString key);
0099     QString wepKey2() const;
0100 
0101     void setWepKey3(const QString key);
0102     QString wepKey3() const;
0103 
0104     void setWepKeyFlags(SecretFlags type);
0105     SecretFlags wepKeyFlags() const;
0106 
0107     void setWepKeyType(WepKeyType type);
0108     WepKeyType wepKeyType() const;
0109 
0110     void setPsk(const QString &key);
0111     QString psk() const;
0112 
0113     void setPskFlags(SecretFlags type);
0114     SecretFlags pskFlags() const;
0115 
0116     void setLeapPassword(const QString &password);
0117     QString leapPassword() const;
0118 
0119     void setLeapPasswordFlags(SecretFlags type);
0120     SecretFlags leapPasswordFlags() const;
0121 
0122     void setPmf(Pmf pmf);
0123     Pmf pmf() const;
0124 
0125     void secretsFromMap(const QVariantMap &secrets) override;
0126 
0127     QVariantMap secretsToMap() const override;
0128 
0129     QStringList needSecrets(bool requestNew = false) const override;
0130 
0131     void fromMap(const QVariantMap &map) override;
0132 
0133     QVariantMap toMap() const override;
0134 
0135 protected:
0136     WirelessSecuritySettingPrivate *d_ptr;
0137 
0138 private:
0139     Q_DECLARE_PRIVATE(WirelessSecuritySetting)
0140 };
0141 
0142 NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const WirelessSecuritySetting &setting);
0143 
0144 }
0145 
0146 #endif // NETWORKMANAGERQT_WIRELESSSECURITY_SETTING_H