7#include "iptunnelsetting.h"
8#include "iptunnelsetting_p.h"
12#if !NM_CHECK_VERSION(1, 12, 0)
13#define NM_SETTING_IP_TUNNEL_FLAGS "flags"
16NetworkManager::IpTunnelSettingPrivate::IpTunnelSettingPrivate()
17 : name(NM_SETTING_IP_TUNNEL_SETTING_NAME)
18 , mode(IpTunnelSetting::
Unknown)
19 , pathMtuDiscovery(true)
20 , encapsulationLimit(0)
21 , flags(IpTunnelSetting::
None)
29NetworkManager::IpTunnelSetting::IpTunnelSetting()
30 : Setting(Setting::IpTunnel)
31 , d_ptr(new IpTunnelSettingPrivate())
35NetworkManager::IpTunnelSetting::IpTunnelSetting(
const Ptr &other)
37 , d_ptr(new IpTunnelSettingPrivate())
39 setMode(other->mode());
40 setPathMtuDiscovery(other->pathMtuDiscovery());
41 setEncapsulationLimit(other->encapsulationLimit());
43 setFlowLabel(other->flowLabel());
47 setInputKey(other->inputKey());
48 setLocal(other->local());
49 setOutputKey(other->outputKey());
50 setParent(other->parent());
51 setRemote(other->remote());
54NetworkManager::IpTunnelSetting::~IpTunnelSetting()
66void NetworkManager::IpTunnelSetting::setMode(NetworkManager::IpTunnelSetting::Mode mode)
73NetworkManager::IpTunnelSetting::Mode NetworkManager::IpTunnelSetting::mode()
const
75 Q_D(
const IpTunnelSetting);
80void NetworkManager::IpTunnelSetting::setPathMtuDiscovery(
bool discovery)
84 d->pathMtuDiscovery = discovery;
87bool NetworkManager::IpTunnelSetting::pathMtuDiscovery()
const
89 Q_D(
const IpTunnelSetting);
91 return d->pathMtuDiscovery;
94void NetworkManager::IpTunnelSetting::setEncapsulationLimit(quint32 limit)
98 d->encapsulationLimit = limit;
101quint32 NetworkManager::IpTunnelSetting::encapsulationLimit()
const
103 Q_D(
const IpTunnelSetting);
105 return d->encapsulationLimit;
110 Q_D(IpTunnelSetting);
117 Q_D(
const IpTunnelSetting);
122void NetworkManager::IpTunnelSetting::setFlowLabel(quint32 label)
124 Q_D(IpTunnelSetting);
126 d->flowLabel =
label;
129quint32 NetworkManager::IpTunnelSetting::flowLabel()
const
131 Q_D(
const IpTunnelSetting);
136void NetworkManager::IpTunnelSetting::setMtu(quint32 mtu)
138 Q_D(IpTunnelSetting);
143quint32 NetworkManager::IpTunnelSetting::mtu()
const
145 Q_D(
const IpTunnelSetting);
150void NetworkManager::IpTunnelSetting::setTos(quint32 tos)
152 Q_D(IpTunnelSetting);
157quint32 NetworkManager::IpTunnelSetting::tos()
const
159 Q_D(
const IpTunnelSetting);
164void NetworkManager::IpTunnelSetting::setTtl(quint32 ttl)
166 Q_D(IpTunnelSetting);
171quint32 NetworkManager::IpTunnelSetting::ttl()
const
173 Q_D(
const IpTunnelSetting);
178void NetworkManager::IpTunnelSetting::setInputKey(
const QString &key)
180 Q_D(IpTunnelSetting);
185QString NetworkManager::IpTunnelSetting::inputKey()
const
187 Q_D(
const IpTunnelSetting);
192void NetworkManager::IpTunnelSetting::setLocal(
const QString &local)
194 Q_D(IpTunnelSetting);
199QString NetworkManager::IpTunnelSetting::local()
const
201 Q_D(
const IpTunnelSetting);
206void NetworkManager::IpTunnelSetting::setParent(
const QString &parent)
208 Q_D(IpTunnelSetting);
213QString NetworkManager::IpTunnelSetting::parent()
const
215 Q_D(
const IpTunnelSetting);
220void NetworkManager::IpTunnelSetting::setOutputKey(
const QString &key)
222 Q_D(IpTunnelSetting);
227QString NetworkManager::IpTunnelSetting::outputKey()
const
229 Q_D(
const IpTunnelSetting);
234void NetworkManager::IpTunnelSetting::setRemote(
const QString &remote)
236 Q_D(IpTunnelSetting);
241QString NetworkManager::IpTunnelSetting::remote()
const
243 Q_D(
const IpTunnelSetting);
250 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_MODE))) {
251 setMode((Mode)setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_MODE)).toUInt());
254 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY))) {
255 setPathMtuDiscovery(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY)).toBool());
258 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT))) {
259 setEncapsulationLimit(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT)).toUInt());
262 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_FLAGS))) {
263 setFlags((Flag)setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_FLAGS)).toUInt());
266 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_FLOW_LABEL))) {
267 setFlowLabel(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_FLOW_LABEL)).toUInt());
270 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_MTU))) {
271 setMtu(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_MTU)).toUInt());
274 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_TOS))) {
275 setTos(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_TOS)).toUInt());
278 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_TTL))) {
279 setTtl(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_TTL)).toUInt());
282 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_INPUT_KEY))) {
283 setInputKey(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_INPUT_KEY)).toString());
286 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_LOCAL))) {
287 setLocal(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_LOCAL)).toString());
290 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_PARENT))) {
291 setParent(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_PARENT)).toString());
294 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_OUTPUT_KEY))) {
295 setOutputKey(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_OUTPUT_KEY)).toString());
298 if (setting.contains(
QLatin1String(NM_SETTING_IP_TUNNEL_REMOTE))) {
299 setRemote(setting.value(
QLatin1String(NM_SETTING_IP_TUNNEL_REMOTE)).toString());
307 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY), pathMtuDiscovery());
310 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_MODE), (
int)mode());
313 if (encapsulationLimit() > 0) {
314 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT), encapsulationLimit());
317 if (flags() > None) {
318 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_FLAGS), (
int)flags());
321 if (flowLabel() > 0) {
322 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_FLOW_LABEL), flowLabel());
326 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_MTU), mtu());
330 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_TOS), tos());
334 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_TTL), ttl());
337 if (!inputKey().isEmpty()) {
338 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_INPUT_KEY), inputKey());
341 if (!local().isEmpty()) {
342 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_LOCAL), local());
345 if (!parent().isEmpty()) {
346 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_PARENT), parent());
349 if (!outputKey().isEmpty()) {
350 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_OUTPUT_KEY), outputKey());
353 if (!remote().isEmpty()) {
354 setting.insert(
QLatin1String(NM_SETTING_IP_TUNNEL_REMOTE), remote());
362 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
363 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
365 dbg.
nospace() << NM_SETTING_IP_TUNNEL_MODE <<
": " << setting.mode() <<
'\n';
366 dbg.
nospace() << NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY <<
": " << setting.pathMtuDiscovery() <<
'\n';
367 dbg.
nospace() << NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT <<
": " << setting.encapsulationLimit() <<
'\n';
368 dbg.
nospace() << NM_SETTING_IP_TUNNEL_FLAGS <<
": " << setting.flags() <<
'\n';
369 dbg.
nospace() << NM_SETTING_IP_TUNNEL_FLOW_LABEL <<
": " << setting.flowLabel() <<
'\n';
370 dbg.
nospace() << NM_SETTING_IP_TUNNEL_MTU <<
": " << setting.mtu() <<
'\n';
371 dbg.
nospace() << NM_SETTING_IP_TUNNEL_TOS <<
": " << setting.tos() <<
'\n';
372 dbg.
nospace() << NM_SETTING_IP_TUNNEL_TTL <<
": " << setting.ttl() <<
'\n';
373 dbg.
nospace() << NM_SETTING_IP_TUNNEL_INPUT_KEY <<
": " << setting.inputKey() <<
'\n';
374 dbg.
nospace() << NM_SETTING_IP_TUNNEL_LOCAL <<
": " << setting.local() <<
'\n';
375 dbg.
nospace() << NM_SETTING_IP_TUNNEL_PARENT <<
": " << setting.parent() <<
'\n';
376 dbg.
nospace() << NM_SETTING_IP_TUNNEL_OUTPUT_KEY <<
": " << setting.outputKey() <<
'\n';
377 dbg.
nospace() << NM_SETTING_IP_TUNNEL_REMOTE <<
": " << setting.remote() <<
'\n';
Represents IpTunnel setting.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
KCRASH_EXPORT void setFlags(KCrash::CrashFlags flags)
QString label(StandardShortcut id)
@ Unknown
the networking system is not active or unable to report its status - proceed with caution