File indexing completed on 2024-04-14 03:57:43

0001 /*
0002     SPDX-FileCopyrightText: 2017 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_IPTUNNEL_DEVICE_H
0008 #define NETWORKMANAGERQT_IPTUNNEL_DEVICE_H
0009 
0010 #include "device.h"
0011 #include <networkmanagerqt/networkmanagerqt_export.h>
0012 
0013 namespace NetworkManager
0014 {
0015 class IpTunnelDevicePrivate;
0016 
0017 /**
0018  * A Ip Tunnel device interface
0019  */
0020 class NETWORKMANAGERQT_EXPORT IpTunnelDevice : public Device
0021 {
0022     Q_OBJECT
0023     Q_PROPERTY(uchar encapsulationLimit READ encapsulationLimit NOTIFY encapsulationLimitChanged)
0024     Q_PROPERTY(uint flowLabel READ flowLabel NOTIFY flowLabelChanged)
0025     Q_PROPERTY(QString inputKey READ inputKey NOTIFY inputKeyChanged)
0026     Q_PROPERTY(QString local READ local NOTIFY localChanged)
0027     Q_PROPERTY(uint mode READ mode NOTIFY modeChanged)
0028     Q_PROPERTY(QString outputKey READ outputKey NOTIFY outputKeyChanged)
0029     Q_PROPERTY(NetworkManager::Device::Ptr parent READ parent NOTIFY parentChanged)
0030     Q_PROPERTY(bool pathMtuDiscovery READ pathMtuDiscovery NOTIFY pathMtuDiscoveryChanged)
0031     Q_PROPERTY(QString remote READ remote NOTIFY remoteChanged)
0032     Q_PROPERTY(uchar tos READ tos NOTIFY tosChanged)
0033     Q_PROPERTY(uchar ttl READ ttl NOTIFY ttlChanged)
0034 
0035 public:
0036     typedef QSharedPointer<IpTunnelDevice> Ptr;
0037     typedef QList<Ptr> List;
0038     explicit IpTunnelDevice(const QString &path, QObject *parent = nullptr);
0039     ~IpTunnelDevice() override;
0040 
0041     Type type() const override;
0042 
0043     /**
0044      * How many additional levels of encapsulation are permitted to be prepended to packets.
0045      * This property applies only to IPv6 tunnels.
0046      */
0047     uchar encapsulationLimit() const;
0048     /**
0049      * The flow label to assign to tunnel packets. This property applies only to IPv6 tunnels.
0050      */
0051     uint flowLabel() const;
0052     /**
0053      * The key used for incoming packets.
0054      */
0055     QString inputKey() const;
0056     /**
0057      * The local endpoint of the tunnel.
0058      */
0059     QString local() const;
0060     /**
0061      * The tunneling mode.
0062      */
0063     uint mode() const;
0064     /**
0065      * The key used for outgoing packets.
0066      */
0067     QString outputKey() const;
0068     /**
0069      * The object path of the parent device.
0070      */
0071     NetworkManager::Device::Ptr parent() const;
0072     /**
0073      * Whether path MTU discovery is enabled on this tunnel.
0074      */
0075     bool pathMtuDiscovery() const;
0076     /**
0077      * The remote endpoint of the tunnel.
0078      */
0079     QString remote() const;
0080     /**
0081      * The type of service (IPv4) or traffic class (IPv6) assigned to tunneled packets.
0082      */
0083     uchar tos() const;
0084     /**
0085      * The TTL assigned to tunneled packets. 0 is a special value meaning that packets inherit the TTL value
0086      */
0087     uchar ttl() const;
0088 
0089 Q_SIGNALS:
0090     /**
0091      * Emitted when the encapsulation limit has changed
0092      */
0093     void encapsulationLimitChanged(uchar limit);
0094     /**
0095      * Emitted when the flow label has changed
0096      */
0097     void flowLabelChanged(uint flowLabel);
0098     /**
0099      * Emitted when the key used for incoming packets has changed
0100      */
0101     void inputKeyChanged(const QString &inputKey);
0102     /**
0103      * Emitted when the local endpoint of the tunnel has changed
0104      */
0105     void localChanged(const QString &local);
0106     /**
0107      * Emitted when the tunneling mode has changed
0108      */
0109     void modeChanged(uint mode);
0110     /**
0111      * Emitted when the key used for outgoing packets has changed
0112      */
0113     void outputKeyChanged(const QString &outputKey);
0114     /**
0115      * Emitted when the parent of this device has changed
0116      */
0117     void parentChanged(const QString &parent);
0118     /**
0119      * Emitted when the path MTU discovery enablemened has changed
0120      */
0121     void pathMtuDiscoveryChanged(bool pathMtuDiscovery);
0122     /**
0123      * Emitted when the remote endpoint of the tunnel has changed
0124      */
0125     void remoteChanged(const QString &remote);
0126     /**
0127      * Emitted when the type of service or traffic class assigned to tunneled packets has changed
0128      */
0129     void tosChanged(uchar tos);
0130     /**
0131      * Emitted when the TTL assigned to tunneled packets has changed
0132      */
0133     void ttlChanged(uchar ttl);
0134 
0135 private:
0136     Q_DECLARE_PRIVATE(IpTunnelDevice)
0137 };
0138 
0139 }
0140 
0141 #endif