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_DEVICE_H
8#define NETWORKMANAGERQT_WIREGUARD_DEVICE_H
9
10#include "device.h"
11#include <networkmanagerqt/networkmanagerqt_export.h>
12
13namespace NetworkManager
14{
15class WireGuardDevicePrivate;
16
17/*!
18 * \class NetworkManager::WireGuardDevice
19 * \inheaderfile NetworkManagerQt/WireGuardDevice
20 * \inmodule NetworkManagerQt
21 *
22 * \brief A WireGuard device interface.
23 */
24class NETWORKMANAGERQT_EXPORT WireGuardDevice : public Device
25{
26 Q_OBJECT
27
28 /*!
29 * \property NetworkManager::WireGuardDevice::publicKey
30 */
31 Q_PROPERTY(QByteArray publicKey READ publicKey NOTIFY publicKeyChanged)
32
33 /*!
34 * \property NetworkManager::WireGuardDevice::listenPort
35 */
36 Q_PROPERTY(uint listenPort READ listenPort NOTIFY listenPortChanged)
37
38 /*!
39 * \property NetworkManager::WireGuardDevice::fwMark
40 */
41 Q_PROPERTY(uint fwMark READ fwMark NOTIFY fwMarkChanged)
42
43public:
44 /*!
45 * \typedef NetworkManager::WireGuardDevice::Ptr
46 */
47 typedef QSharedPointer<WireGuardDevice> Ptr;
48 /*!
49 * \typedef NetworkManager::WireGuardDevice::List
50 */
51 typedef QList<Ptr> List;
52 /*!
53 */
54 explicit WireGuardDevice(const QString &path, QObject *parent = nullptr);
55 ~WireGuardDevice() override;
56
57 Type type() const override;
58
59 /*!
60 * 32-byte public WireGuard key.
61 */
62 QByteArray publicKey() const;
63 /*!
64 * Local UDP listening port.
65 */
66 uint listenPort() const;
67 /*!
68 * Optional 32-bit mark used to set routing policy for outgoing encrypted packets. See: ip-rule(8)
69 */
70 uint fwMark() const;
71
72Q_SIGNALS:
73 /*!
74 * Emitted when the public key of this device has changed
75 */
76 void publicKeyChanged(const QByteArray &publicKey);
77 /*!
78 * Emitted when the listen port of this device has changed
79 */
80 void listenPortChanged(uint listenPort);
81 /*!
82 * Emitted when the fwmark of this device have changed
83 */
84 void fwMarkChanged(uint fwMark);
85
86private:
87 Q_DECLARE_PRIVATE(WireGuardDevice)
88};
89
90}
91
92#endif
93

source code of networkmanager-qt/src/wireguarddevice.h