NetworkManagerQt

gredevice.cpp
1/*
2 SPDX-FileCopyrightText: 2013 Lukáš Tinkl <ltinkl@redhat.com>
3 SPDX-FileCopyrightText: 2014 Jan Grulich <jgrulich@redhat.com>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#include "device_p.h"
9#include "gredevice_p.h"
10#include "manager.h"
11
12NetworkManager::GreDevicePrivate::GreDevicePrivate(const QString &path, GreDevice *q)
13 : DevicePrivate(path, q)
14#ifdef NMQT_STATIC
15 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
16#else
17 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
18#endif
19{
20}
21
22NetworkManager::GreDevicePrivate::~GreDevicePrivate()
23{
24}
25
26NetworkManager::GreDevice::GreDevice(const QString &path, QObject *parent)
27 : Device(*new GreDevicePrivate(path, this), parent)
28{
29 Q_D(GreDevice);
30
31 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path);
32 if (!initialProperties.isEmpty()) {
33 d->propertiesChanged(initialProperties);
34 }
35
36}
37
38NetworkManager::GreDevice::~GreDevice()
39{
40}
41
46
47ushort NetworkManager::GreDevice::inputFlags() const
48{
49 Q_D(const GreDevice);
50 return d->inputFlags;
51}
52
53ushort NetworkManager::GreDevice::outputFlags() const
54{
55 Q_D(const GreDevice);
56 return d->outputFlags;
57}
58
59uint NetworkManager::GreDevice::inputKey() const
60{
61 Q_D(const GreDevice);
62 return d->inputKey;
63}
64
65uint NetworkManager::GreDevice::outputKey() const
66{
67 Q_D(const GreDevice);
68 return d->outputKey;
69}
70
71QString NetworkManager::GreDevice::localEnd() const
72{
73 Q_D(const GreDevice);
74 return d->localEnd;
75}
76
77QString NetworkManager::GreDevice::remoteEnd() const
78{
79 Q_D(const GreDevice);
80 return d->remoteEnd;
81}
82
83QString NetworkManager::GreDevice::parent() const
84{
85 Q_D(const GreDevice);
86 return d->parent;
87}
88
89bool NetworkManager::GreDevice::pathMtuDiscovery() const
90{
91 Q_D(const GreDevice);
92 return d->pathMtuDiscovery;
93}
94
95uchar NetworkManager::GreDevice::tos() const
96{
97 Q_D(const GreDevice);
98 return d->tos;
99}
100
101uchar NetworkManager::GreDevice::ttl() const
102{
103 Q_D(const GreDevice);
104 return d->ttl;
105}
106
107void NetworkManager::GreDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
108{
109 Q_Q(GreDevice);
110
111 if (property == QLatin1String("InputFlags")) {
112 inputFlags = static_cast<ushort>(value.toUInt());
113 Q_EMIT q->inputFlagsChanged(inputFlags);
114 } else if (property == QLatin1String("OutputFlags")) {
115 outputFlags = static_cast<ushort>(value.toUInt());
116 Q_EMIT q->outputFlagsChanged(outputFlags);
117 } else if (property == QLatin1String("InputKey")) {
118 inputKey = value.toUInt();
119 Q_EMIT q->inputKeyChanged(inputKey);
120 } else if (property == QLatin1String("OutputKey")) {
121 outputKey = value.toUInt();
122 Q_EMIT q->outputKeyChanged(outputKey);
123 } else if (property == QLatin1String("Local")) {
124 localEnd = value.toString();
125 Q_EMIT q->localEndChanged(localEnd);
126 } else if (property == QLatin1String("Remote")) {
127 remoteEnd = value.toString();
128 Q_EMIT q->remoteEndChanged(remoteEnd);
129 } else if (property == QLatin1String("Parent")) {
130 parent = value.toString();
131 Q_EMIT q->parentChanged(parent);
132 } else if (property == QLatin1String("PathMtuDiscovery")) {
133 pathMtuDiscovery = value.toBool();
134 Q_EMIT q->pathMtuDiscoveryChanged(pathMtuDiscovery);
135 } else if (property == QLatin1String("Tos")) {
136 tos = static_cast<uchar>(value.toUInt());
137 Q_EMIT q->tosChanged(tos);
138 } else if (property == QLatin1String("Ttl")) {
139 ttl = static_cast<uchar>(value.toUInt());
140 Q_EMIT q->ttlChanged(ttl);
141 } else {
142 DevicePrivate::propertyChanged(property, value);
143 }
144}
145
146#include "moc_gredevice.cpp"
147#include "moc_gredevice_p.cpp"
Type
Device type.
Definition device.h:191
@ Gre
Gre virtual device.
Definition device.h:208
A gre device interface.
Definition gredevice.h:23
Type type() const override
Retrieves the interface type.
Definition gredevice.cpp:42
QString path(const QString &relativePath)
bool toBool() const const
QString toString() const const
uint toUInt(bool *ok) const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.