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 * A WireGuard device interface
19 */
20class NETWORKMANAGERQT_EXPORT WireGuardDevice : public Device
21{
22 Q_OBJECT
23 Q_PROPERTY(QByteArray publicKey READ publicKey NOTIFY publicKeyChanged)
24 Q_PROPERTY(uint listenPort READ listenPort NOTIFY listenPortChanged)
25 Q_PROPERTY(uint fwMark READ fwMark NOTIFY fwMarkChanged)
26
27public:
28 typedef QSharedPointer<WireGuardDevice> Ptr;
29 typedef QList<Ptr> List;
30 explicit WireGuardDevice(const QString &path, QObject *parent = nullptr);
31 ~WireGuardDevice() override;
32
33 Type type() const override;
34
35 /**
36 * 32-byte public WireGuard key.
37 */
38 QByteArray publicKey() const;
39 /**
40 * Local UDP listening port.
41 */
42 uint listenPort() const;
43 /**
44 * Optional 32-bit mark used to set routing policy for outgoing encrypted packets. See: ip-rule(8)
45 */
46 uint fwMark() const;
47
48Q_SIGNALS:
49 /**
50 * Emitted when the public key of this device has changed
51 */
52 void publicKeyChanged(const QByteArray &publicKey);
53 /**
54 * Emitted when the listen port of this device has changed
55 */
56 void listenPortChanged(uint listenPort);
57 /**
58 * Emitted when the fwmark of this device have changed
59 */
60 void fwMarkChanged(uint fwMark);
61
62private:
63 Q_DECLARE_PRIVATE(WireGuardDevice)
64};
65
66}
67
68#endif
69

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