1/*
2 SPDX-FileCopyrightText: 2019 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_WIREGUARD_SETTING_H
8#define NETWORKMANAGERQT_WIREGUARD_SETTING_H
9
10#include "setting.h"
11#include <networkmanagerqt/networkmanagerqt_export.h>
12
13#include <QString>
14
15namespace NetworkManager
16{
17class WireGuardSettingPrivate;
18
19/**
20 * Represents generic setting
21 */
22class NETWORKMANAGERQT_EXPORT WireGuardSetting : public Setting
23{
24public:
25 typedef QSharedPointer<WireGuardSetting> Ptr;
26 typedef QList<Ptr> List;
27 WireGuardSetting();
28 explicit WireGuardSetting(const Ptr &other);
29 ~WireGuardSetting() override;
30
31 QString name() const override;
32
33 quint32 fwmark() const;
34 void setFwmark(quint32 fwmark);
35
36 quint32 listenPort() const;
37 void setListenPort(quint32 port);
38
39 quint32 mtu() const;
40 void setMtu(quint32 mtu);
41
42 bool peerRoutes() const;
43 void setPeerRoutes(bool peerRoutes);
44
45 NMVariantMapList peers() const;
46 void setPeers(const NMVariantMapList &peers);
47
48 QString privateKey() const;
49 void setPrivateKey(const QString &key);
50
51 SecretFlags privateKeyFlags() const;
52 void setPrivateKeyFlags(SecretFlags flags);
53
54 void secretsFromMap(const QVariantMap &secrets) override;
55
56 QVariantMap secretsToMap() const override;
57
58 void secretsFromStringMap(const NMStringMap &map) override;
59
60 NMStringMap secretsToStringMap() const override;
61
62 /*
63 * Required "preshared-key" properties from "peers" property will be returned
64 * as strings in format "peers.public-key.preshared-key".
65 */
66 QStringList needSecrets(bool requestNew = false) const override;
67
68 void fromMap(const QVariantMap &setting) override;
69
70 QVariantMap toMap() const override;
71
72protected:
73 WireGuardSettingPrivate *d_ptr;
74
75private:
76 Q_DECLARE_PRIVATE(WireGuardSetting)
77};
78
79NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const WireGuardSetting &setting);
80
81}
82
83#endif // NETWORKMANAGERQT_WIREGUARD_SETTING_H
84

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