Changeset View
Changeset View
Standalone View
Standalone View
src/settings/macsecsetting.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright 2018 Pranav Gade <pranavgade20@gmail.com> | ||||
3 | | ||||
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.1 of the License, or (at your option) version 3, or any | ||||
8 | later version accepted by the membership of KDE e.V. (or its | ||||
9 | successor approved by the membership of KDE e.V.), which shall | ||||
10 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Lesser General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU Lesser General Public | ||||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | #ifndef NETWORKMANAGERQT_MACSECSETTING_H | ||||
22 | #define NETWORKMANAGERQT_MACSECSETTING_H | ||||
23 | | ||||
24 | #include <networkmanagerqt/networkmanagerqt_export.h> | ||||
25 | #include "setting.h" | ||||
26 | | ||||
27 | #include <QString> | ||||
28 | | ||||
29 | namespace NetworkManager | ||||
30 | { | ||||
31 | | ||||
32 | class MacsecSettingPrivate; | ||||
33 | | ||||
34 | /** | ||||
35 | * Represents Macsec setting | ||||
36 | */ | ||||
37 | class NETWORKMANAGERQT_EXPORT MacsecSetting : public Setting | ||||
38 | { | ||||
39 | public: | ||||
40 | typedef QSharedPointer<MacsecSetting> Ptr; | ||||
41 | typedef QList<Ptr> List; | ||||
42 | | ||||
43 | enum Mode{ | ||||
44 | Psk = NM_SETTING_MACSEC_MODE_PSK, | ||||
45 | Eap = NM_SETTING_MACSEC_MODE_EAP | ||||
46 | }; | ||||
47 | | ||||
48 | enum Validation { | ||||
49 | Disable = NM_SETTING_MACSEC_VALIDATION_DISABLE, | ||||
50 | Check = NM_SETTING_MACSEC_VALIDATION_CHECK, | ||||
51 | Strict = NM_SETTING_MACSEC_VALIDATION_STRICT | ||||
jgrulich: In this case you don't need to define the defines above, just list both enums without assigned… | |||||
52 | }; | ||||
53 | | ||||
54 | MacsecSetting(); | ||||
55 | explicit MacsecSetting(const Ptr &other); | ||||
56 | ~MacsecSetting() override; | ||||
57 | | ||||
58 | QString name() const override; | ||||
59 | | ||||
jgrulich: Can be turned into an enum. | |||||
From where can I get the possible values? Because I cannot find them here: https://developer.gnome.org/NetworkManager/stable/settings-macsec.html pranavgade: From where can I get the possible values? Because I cannot find them here: https://developer. | |||||
pranavgade: (I mean the default values to use in the defines) | |||||
You can get it when you clone NetworkManager and go to the header file where these properties are defined. In your case it is in libnm-core/nm-setting-macsec.h. jgrulich: You can get it when you clone NetworkManager and go to the header file where these properties… | |||||
60 | void setEncrypt(bool encrypt); | ||||
61 | bool encrypt() const; | ||||
62 | | ||||
63 | void setMkaCak(QString mkaCak); | ||||
64 | QString mkaCak() const; | ||||
65 | | ||||
66 | void setMkaCkn(QString mkaCkn); | ||||
67 | QString mkaCkn() const; | ||||
68 | | ||||
69 | void setMode(Mode mode); | ||||
70 | Mode mode() const; | ||||
71 | | ||||
jgrulich: Can be turned into an enum. | |||||
jgrulich: const QString &mkaCak | |||||
72 | void setParent(QString parent); | ||||
73 | QString parent() const; | ||||
74 | | ||||
jgrulich: const QString &mkaCkn | |||||
75 | void setPort(qint32 port); | ||||
76 | qint32 port() const; | ||||
77 | | ||||
78 | void setSendSci(bool sendSci); | ||||
79 | bool sendSci() const; | ||||
80 | | ||||
jgrulich: const QString &parent | |||||
81 | void setValidation(Validation validation); | ||||
82 | Validation validation() const; | ||||
83 | | ||||
84 | void setMkaCakFlags(Setting::SecretFlags flags); | ||||
85 | Setting::SecretFlags mkaCakFlags() const; | ||||
86 | | ||||
87 | QStringList needSecrets(bool requestNew = false) const override; | ||||
88 | | ||||
89 | void secretsFromMap(const QVariantMap &secrets) override; | ||||
90 | | ||||
91 | QVariantMap secretsToMap() const override; | ||||
92 | | ||||
93 | void fromMap(const QVariantMap &setting) override; | ||||
94 | | ||||
95 | QVariantMap toMap() const override; | ||||
96 | | ||||
97 | protected: | ||||
98 | MacsecSettingPrivate *d_ptr; | ||||
99 | | ||||
100 | private: | ||||
101 | Q_DECLARE_PRIVATE(MacsecSetting) | ||||
102 | }; | ||||
103 | | ||||
104 | NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const MacsecSetting &setting); | ||||
105 | | ||||
106 | } | ||||
107 | | ||||
108 | #endif // NETWORKMANAGERQT_MACSECSETTING_H | ||||
109 | |
In this case you don't need to define the defines above, just list both enums without assigned values, or you can just assign 0 to the first one to make sure it starts from 0.