NetworkManagerQt

tundevice.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 "manager_p.h"
9#include "tundevice_p.h"
10
11NetworkManager::TunDevicePrivate::TunDevicePrivate(const QString &path, TunDevice *q)
12 : DevicePrivate(path, q)
13#ifdef NMQT_STATIC
14 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
15#else
16 , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
17#endif
18{
19}
20
21NetworkManager::TunDevicePrivate::~TunDevicePrivate()
22{
23}
24
25NetworkManager::TunDevice::TunDevice(const QString &path, QObject *parent)
26 : Device(*new TunDevicePrivate(path, this), parent)
27{
28 Q_D(TunDevice);
29
30 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path);
31 if (!initialProperties.isEmpty()) {
32 d->propertiesChanged(initialProperties);
33 }
34}
35
36NetworkManager::TunDevice::~TunDevice()
37{
38}
39
44
45qlonglong NetworkManager::TunDevice::owner() const
46{
47 Q_D(const TunDevice);
48 return d->owner;
49}
50
51qlonglong NetworkManager::TunDevice::group() const
52{
53 Q_D(const TunDevice);
54 return d->group;
55}
56
57QString NetworkManager::TunDevice::mode() const
58{
59 Q_D(const TunDevice);
60 return d->mode;
61}
62
63bool NetworkManager::TunDevice::multiQueue() const
64{
65 Q_D(const TunDevice);
66 return d->multiQueue;
67}
68
69bool NetworkManager::TunDevice::noPi() const
70{
71 Q_D(const TunDevice);
72 return d->noPi;
73}
74
75bool NetworkManager::TunDevice::vnetHdr() const
76{
77 Q_D(const TunDevice);
78 return d->vnetHdr;
79}
80
81QString NetworkManager::TunDevice::hwAddress() const
82{
83 Q_D(const TunDevice);
84 return d->hwAddress;
85}
86
87void NetworkManager::TunDevicePrivate::propertyChanged(const QString &property, const QVariant &value)
88{
89 Q_Q(TunDevice);
90
91 if (property == QLatin1String("Owner")) {
92 owner = value.toLongLong();
93 Q_EMIT q->ownerChanged(owner);
94 } else if (property == QLatin1String("Group")) {
95 group = value.toLongLong();
96 Q_EMIT q->groupChanged(group);
97 } else if (property == QLatin1String("Mode")) {
98 mode = value.toString();
99 Q_EMIT q->modeChanged(mode);
100 } else if (property == QLatin1String("MultiQueue")) {
101 multiQueue = value.toBool();
102 Q_EMIT q->multiQueueChanged(multiQueue);
103 } else if (property == QLatin1String("NoPi")) {
104 noPi = value.toBool();
105 Q_EMIT q->noPiChanged(noPi);
106 } else if (property == QLatin1String("VnetHdr")) {
107 vnetHdr = value.toBool();
108 Q_EMIT q->vnetHdrChanged(vnetHdr);
109 } else if (property == QLatin1String("HwAddress")) {
110 hwAddress = value.toString();
111 Q_EMIT q->hwAddressChanged(hwAddress);
112 } else {
113 DevicePrivate::propertyChanged(property, value);
114 }
115}
116
117#include "moc_tundevice.cpp"
118#include "moc_tundevice_p.cpp"
Type
Device type.
Definition device.h:191
@ Tun
Tun virtual device.
Definition device.h:210
A tun device interface.
Definition tundevice.h:22
Type type() const override
Retrieves the interface type.
Definition tundevice.cpp:40
QString path(const QString &relativePath)
bool toBool() const const
qlonglong toLongLong(bool *ok) const const
QString toString() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.