1 | /* |
2 | SPDX-FileCopyrightText: 2018 Pranav Gade <pranavgade20@gmail.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_IPTUNNEL_SETTING_H |
8 | #define NETWORKMANAGERQT_IPTUNNEL_SETTING_H |
9 | |
10 | #include "setting.h" |
11 | #include <networkmanagerqt/networkmanagerqt_export.h> |
12 | |
13 | namespace NetworkManager |
14 | { |
15 | class IpTunnelSettingPrivate; |
16 | |
17 | /** |
18 | * Represents IpTunnel setting |
19 | */ |
20 | class NETWORKMANAGERQT_EXPORT IpTunnelSetting : public Setting |
21 | { |
22 | public: |
23 | typedef QSharedPointer<IpTunnelSetting> Ptr; |
24 | typedef QList<Ptr> List; |
25 | enum Mode { |
26 | Unknown = NM_IP_TUNNEL_MODE_UNKNOWN, |
27 | Ipip = NM_IP_TUNNEL_MODE_IPIP, |
28 | Gre = NM_IP_TUNNEL_MODE_GRE, |
29 | Sit = NM_IP_TUNNEL_MODE_SIT, |
30 | Isatap = NM_IP_TUNNEL_MODE_ISATAP, |
31 | Vti = NM_IP_TUNNEL_MODE_VTI, |
32 | Ip6ip6 = NM_IP_TUNNEL_MODE_IP6IP6, |
33 | Ipip6 = NM_IP_TUNNEL_MODE_IPIP6, |
34 | Ip6gre = NM_IP_TUNNEL_MODE_IP6GRE, |
35 | Vti6 = NM_IP_TUNNEL_MODE_VTI, |
36 | }; |
37 | |
38 | enum Flag { |
39 | None = 0x0, |
40 | Ip6IgnEncapLimit = 0x1, |
41 | Ip6UseOrigTclass = 0x2, |
42 | Ip6UseOrigFlowlabel = 0x4, |
43 | Ip6Mip6Dev = 0x8, |
44 | Ip6RcvDscpCopy = 0x10, |
45 | Ip6UseOrigFwmark = 0x20, |
46 | }; |
47 | Q_DECLARE_FLAGS(Flags, Flag) |
48 | |
49 | IpTunnelSetting(); |
50 | explicit IpTunnelSetting(const Ptr &other); |
51 | ~IpTunnelSetting() override; |
52 | |
53 | QString name() const override; |
54 | |
55 | void setMode(Mode mode); |
56 | Mode mode() const; |
57 | |
58 | void setPathMtuDiscovery(bool discovery); |
59 | bool pathMtuDiscovery() const; |
60 | |
61 | void setEncapsulationLimit(quint32 limit); |
62 | quint32 encapsulationLimit() const; |
63 | |
64 | void setFlags(Flags flags); |
65 | Flags flags() const; |
66 | |
67 | void setFlowLabel(quint32 label); |
68 | quint32 flowLabel() const; |
69 | |
70 | void setMtu(quint32 mtu); |
71 | quint32 mtu() const; |
72 | |
73 | void setTos(quint32 tos); |
74 | quint32 tos() const; |
75 | |
76 | void setTtl(quint32 ttl); |
77 | quint32 ttl() const; |
78 | |
79 | void setInputKey(const QString &key); |
80 | QString inputKey() const; |
81 | |
82 | void setLocal(const QString &local); |
83 | QString local() const; |
84 | |
85 | void setParent(const QString &parent); |
86 | QString parent() const; |
87 | |
88 | void setOutputKey(const QString &key); |
89 | QString outputKey() const; |
90 | |
91 | void setRemote(const QString &remote); |
92 | QString remote() const; |
93 | |
94 | void fromMap(const QVariantMap &setting) override; |
95 | |
96 | QVariantMap toMap() const override; |
97 | |
98 | protected: |
99 | IpTunnelSettingPrivate *d_ptr; |
100 | |
101 | private: |
102 | Q_DECLARE_PRIVATE(IpTunnelSetting) |
103 | }; |
104 | Q_DECLARE_OPERATORS_FOR_FLAGS(IpTunnelSetting::Flags) |
105 | |
106 | NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const IpTunnelSetting &setting); |
107 | |
108 | } |
109 | |
110 | #endif // NETWORKMANAGERQT_IP_TUNNEL_SETTING_H |
111 | |