NetworkManagerQt

device.cpp
1/*
2 SPDX-FileCopyrightText: 2008, 2010 Will Stephenson <wstephenson@kde.org>
3 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com>
4 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#include "connection.h"
10#include "device_p.h"
11#include "manager.h"
12#include "manager_p.h"
13#include "nmdebug.h"
14#include "settings.h"
15
16#include <arpa/inet.h>
17
18#include <QDBusMetaType>
19#include <QDBusObjectPath>
20
21// logging category for this framework, default: log stuff >= warning
22Q_LOGGING_CATEGORY(NMQT, "kf.networkmanagerqt", QtWarningMsg)
23
24namespace NetworkManager
25{
26class DeviceStateReasonPrivate
27{
28public:
29 DeviceStateReasonPrivate(Device::State st, Device::StateChangeReason rsn)
30 : state(st)
31 , reason(rsn)
32 {
33 }
34 DeviceStateReasonPrivate()
35 : state(Device::UnknownState)
36 , reason(Device::UnknownReason)
37 {
38 }
39 Device::State state;
41};
42}
43
44NetworkManager::DeviceStateReason::DeviceStateReason(Device::State state, Device::StateChangeReason reason)
45 : d_ptr(new DeviceStateReasonPrivate(state, reason))
46{
47}
48
49NetworkManager::DeviceStateReason::DeviceStateReason(const NetworkManager::DeviceStateReason &other)
50 : d_ptr(new DeviceStateReasonPrivate(*other.d_ptr))
51{
52}
53
54NetworkManager::DeviceStateReason::~DeviceStateReason()
55{
56 delete d_ptr;
57}
58
59NetworkManager::Device::State NetworkManager::DeviceStateReason::state() const
60{
61 Q_D(const DeviceStateReason);
62 return d->state;
63}
64
65NetworkManager::Device::StateChangeReason NetworkManager::DeviceStateReason::reason() const
66{
67 Q_D(const DeviceStateReason);
68 return d->reason;
69}
70
71NetworkManager::DeviceStateReason &NetworkManager::DeviceStateReason::operator=(const NetworkManager::DeviceStateReason &other)
72{
73 if (&other != this) {
74 *d_ptr = *other.d_ptr;
75 }
76 return *this;
77}
78
79NetworkManager::DevicePrivate::DevicePrivate(const QString &path, NetworkManager::Device *q)
80#ifdef NMQT_STATIC
81 : deviceIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::sessionBus())
82#else
83 : deviceIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus())
84#endif
85 , uni(path)
86 , designSpeed(0)
87 , deviceType(Device::UnknownType)
88 , dhcp4Config(nullptr)
89 , dhcp6Config(nullptr)
90 , mtu(0)
91 , q_ptr(q)
92{
93}
94
95NetworkManager::DevicePrivate::~DevicePrivate()
96{
97}
98
99void NetworkManager::DevicePrivate::init()
100{
101 qDBusRegisterMetaType<UIntList>();
102 qDBusRegisterMetaType<UIntListList>();
103 qDBusRegisterMetaType<IpV6DBusAddress>();
104 qDBusRegisterMetaType<IpV6DBusAddressList>();
105 qDBusRegisterMetaType<IpV6DBusNameservers>();
106 qDBusRegisterMetaType<IpV6DBusRoute>();
107 qDBusRegisterMetaType<IpV6DBusRouteList>();
108 qDBusRegisterMetaType<DeviceDBusStateReason>();
109
110 QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
111 uni,
112 NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
113 QLatin1String("PropertiesChanged"),
114 this,
115 SLOT(dbusPropertiesChanged(QString, QVariantMap, QStringList)));
116 QObject::connect(&deviceIface, &OrgFreedesktopNetworkManagerDeviceInterface::StateChanged, this, &DevicePrivate::deviceStateChanged);
117
118
119 // The interfaceFlags will return NM_DEVICE_INTERFACE_FLAG_NONE when runtime NM < 1.22
120 // we initialize the interfaceFlags
122 deviceStatistics = DeviceStatistics::Ptr(new NetworkManager::DeviceStatistics(uni), &QObject::deleteLater);
123
124 // Get all Device's properties at once
125 QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(deviceIface.staticInterfaceName(), uni);
126 if (!initialProperties.isEmpty()) {
127 propertiesChanged(initialProperties);
128 }
129
130}
131
132NetworkManager::Device::MeteredStatus NetworkManager::DevicePrivate::convertMeteredStatus(uint metered)
133{
135 return ourMeteredStatus;
136}
137
138NetworkManager::Device::Capabilities NetworkManager::DevicePrivate::convertCapabilities(uint theirCaps)
139{
141 return ourCaps;
142}
143
144NetworkManager::Device::Interfaceflags NetworkManager::DevicePrivate::convertInterfaceflags(uint flags)
145{
147 return ourFlags;
148}
149
150NetworkManager::Device::State NetworkManager::DevicePrivate::convertState(uint theirState)
151{
152 NetworkManager::Device::State ourState = static_cast<NetworkManager::Device::State>(theirState);
153 return ourState;
154}
155
156NetworkManager::Device::StateChangeReason NetworkManager::DevicePrivate::convertReason(uint theirReason)
157{
159 return ourReason;
160}
161
162NetworkManager::Device::Type NetworkManager::DevicePrivate::convertType(uint type)
163{
164 // These are identical to NM enums
165 if (type <= NM_DEVICE_TYPE_TEAM) {
167 }
168
169 switch (type) {
170 case 16:
171 // NM_DEVICE_TYPE_TUN
173 case 17:
174 // NM_DEVICE_TYPE_IP_TUNNEL
176 case 18:
177 // NM_DEVICE_TYPE_MACVLAN
179 case 19:
180 // NM_DEVICE_TYPE_VXLAN
182 case 20:
183 // NM_DEVICE_TYPE_VETH
185 case 21:
186 // NM_DEVICE_TYPE_MACSEC
188 case 22:
189 // NM_DEVICE_TYPE_DUMMY
191 case 23:
192 // NM_DEVICE_TYPE_PPP
194 case 24:
195 // NM_DEVICE_TYPE_OVS_INTERFACE
197 case 25:
198 // NM_DEVICE_TYPE_OVS_PORT
200 case 26:
201 // NM_DEVICE_TYPE_OVS_BRIDGE
203 case 27:
204 // NM_DEVICE_TYPE_WPAN
206 case 28:
207 // NM_DEVICE_TYPE_6LOWPAN
209 case 29:
210 // NM_DEVICE_TYPE_NM_DEVICE_TYPE_WIREGUARD
212 case 30:
213 // NM_DEVICE_TYPE_WIFI_P2P
215 case 31:
216 // NM_DEVICE_TYPE_VRF
218 case 32:
219 // NM_DEVICE_TYPE_LOOPBACK
221 }
222
224}
225
227 : QObject(parent)
228 , d_ptr(new DevicePrivate(path, this))
229{
230 Q_D(Device);
231
232 d->init();
233}
234
235NetworkManager::Device::Device(DevicePrivate &dd, QObject *parent)
236 : QObject(parent)
237 , d_ptr(&dd)
238{
239 Q_D(Device);
240
241 d->init();
242}
243
244void NetworkManager::DevicePrivate::propertyChanged(const QString &property, const QVariant &value)
245{
246 Q_Q(Device);
247
248 // qCDebug(NMQT) << property << " - " << value;
249 if (property == QLatin1String("ActiveConnection")) {
250 activeConnection = value.value<QDBusObjectPath>().path();
251 Q_EMIT q->activeConnectionChanged();
252 } else if (property == QLatin1String("Autoconnect")) {
253 autoconnect = value.toBool();
254 Q_EMIT q->autoconnectChanged();
255 } else if (property == QLatin1String("AvailableConnections")) {
256 QStringList newAvailableConnections;
257 const QList<QDBusObjectPath> availableConnectionsTmp = qdbus_cast<QList<QDBusObjectPath>>(value);
258 for (const QDBusObjectPath &availableConnection : availableConnectionsTmp) {
259 newAvailableConnections << availableConnection.path();
260 if (!availableConnections.contains(availableConnection.path())) {
261 availableConnections << availableConnection.path();
262 Q_EMIT q->availableConnectionAppeared(availableConnection.path());
263 }
264 }
265 auto it = availableConnections.begin();
266 while (it != availableConnections.end()) {
267 const QString availableConnection = *it;
268 if (!newAvailableConnections.contains(availableConnection)) {
269 it = availableConnections.erase(it);
270 Q_EMIT q->availableConnectionDisappeared(availableConnection);
271 } else {
272 ++it;
273 }
274 }
275 Q_EMIT q->availableConnectionChanged();
276 } else if (property == QLatin1String("Capabilities")) {
277 capabilities = NetworkManager::DevicePrivate::convertCapabilities(value.toUInt());
278 Q_EMIT q->capabilitiesChanged();
279 } else if (property == QLatin1String("DeviceType")) {
280 deviceType = convertType(value.toUInt());
281 } else if (property == QLatin1String("Dhcp4Config")) {
282 QDBusObjectPath dhcp4ConfigPathTmp = value.value<QDBusObjectPath>();
283 if (dhcp4ConfigPathTmp.path().isNull()) {
284 dhcp4Config.clear();
285 dhcp4ConfigPath.clear();
286 } else if (!dhcp4Config || dhcp4Config->path() != dhcp4ConfigPathTmp.path()) {
287 dhcp4Config.clear();
288 dhcp4ConfigPath = dhcp4ConfigPathTmp.path();
289 }
290 Q_EMIT q->dhcp4ConfigChanged();
291 } else if (property == QLatin1String("Dhcp6Config")) {
292 QDBusObjectPath dhcp6ConfigPathTmp = value.value<QDBusObjectPath>();
293 if (dhcp6ConfigPathTmp.path().isNull()) {
294 dhcp6Config.clear();
295 dhcp6ConfigPath.clear();
296 } else if (!dhcp6Config || dhcp6Config->path() != dhcp6ConfigPathTmp.path()) {
297 dhcp6Config.clear();
298 dhcp6ConfigPath = dhcp6ConfigPathTmp.path();
299 }
300 Q_EMIT q->dhcp6ConfigChanged();
301 } else if (property == QLatin1String("Driver")) {
302 driver = value.toString();
303 Q_EMIT q->driverChanged();
304 } else if (property == QLatin1String("DriverVersion")) {
305 driverVersion = value.toString();
306 Q_EMIT q->driverVersionChanged();
307 } else if (property == QLatin1String("FirmwareMissing")) {
308 firmwareMissing = value.toBool();
309 Q_EMIT q->firmwareMissingChanged();
310 } else if (property == QLatin1String("FirmwareVersion")) {
311 firmwareVersion = value.toString();
312 Q_EMIT q->firmwareVersionChanged();
313 } else if (property == QLatin1String("Interface")) {
314 interfaceName = value.toString();
315 Q_EMIT q->interfaceNameChanged();
316 } else if (property == QLatin1String("InterfaceFlags")) {
317 interfaceFlags = NetworkManager::DevicePrivate::convertInterfaceflags(value.toUInt());
318 Q_EMIT q->interfaceFlagsChanged();
319 } else if (property == QLatin1String("Ip4Address")) {
320 ipV4Address = QHostAddress(ntohl(value.toUInt()));
321 Q_EMIT q->ipV4AddressChanged();
322 } else if (property == QLatin1String("Ip4Config")) {
323 QDBusObjectPath ip4ConfigObjectPathTmp = value.value<QDBusObjectPath>();
324 if (ip4ConfigObjectPathTmp.path().isNull() || ip4ConfigObjectPathTmp.path() == QLatin1String("/")) {
325 ipV4ConfigPath.clear();
326 } else {
327 ipV4ConfigPath = ip4ConfigObjectPathTmp.path();
328 }
329 ipV4Config = IpConfig();
330 Q_EMIT q->ipV4ConfigChanged();
331 } else if (property == QLatin1String("Ip6Config")) {
332 QDBusObjectPath ip6ConfigObjectPathTmp = value.value<QDBusObjectPath>();
333 if (ip6ConfigObjectPathTmp.path().isNull() || ip6ConfigObjectPathTmp.path() == QLatin1String("/")) {
334 ipV6ConfigPath.clear();
335 } else {
336 ipV6ConfigPath = ip6ConfigObjectPathTmp.path();
337 }
338 ipV6Config = IpConfig();
339 Q_EMIT q->ipV6ConfigChanged();
340 } else if (property == QLatin1String("IpInterface")) {
341 ipInterface = value.toString();
342 Q_EMIT q->ipInterfaceChanged();
343 } else if (property == QLatin1String("Managed")) {
344 managed = value.toBool();
345 Q_EMIT q->managedChanged();
346 } else if (property == QLatin1String("State")) {
347 connectionState = NetworkManager::DevicePrivate::convertState(value.toUInt());
348 // FIXME NetworkManager 0.9.8 (maybe greater) doesn't
349 // update ActiveConnection when disconnected
350 // This is fixed in NM 73d128bbd17120225bb4986e3f05566f10fab581
351 if (connectionState == NetworkManager::Device::Disconnected && activeConnection != QLatin1String("/")) {
352 activeConnection = QLatin1Char('/');
353 Q_EMIT q->activeConnectionChanged();
354 }
355 Q_EMIT q->connectionStateChanged();
356 } else if (property == QLatin1String("StateReason")) { // just extracting the reason
357 reason = NetworkManager::DevicePrivate::convertReason(qdbus_cast<DeviceDBusStateReason>(value).reason);
358 Q_EMIT q->stateReasonChanged();
359 } else if (property == QLatin1String("Udi")) {
360 udi = value.toString();
361 Q_EMIT q->udiChanged();
362 } else if (property == QLatin1String("PhysicalPortId")) {
363 physicalPortId = value.toString();
364 Q_EMIT q->physicalPortIdChanged();
365 } else if (property == QLatin1String("Mtu")) {
366 mtu = value.toUInt();
367 Q_EMIT q->mtuChanged();
368 } else if (property == QLatin1String("NmPluginMissing")) {
369 nmPluginMissing = value.toBool();
370 Q_EMIT q->nmPluginMissingChanged(nmPluginMissing);
371 } else if (property == QLatin1String("Metered")) {
372 metered = NetworkManager::DevicePrivate::convertMeteredStatus(value.toUInt());
373 Q_EMIT q->meteredChanged(metered);
374 } else {
375 qCDebug(NMQT) << Q_FUNC_INFO << "Unhandled property" << property;
376 }
377}
378
380{
381 Q_D(Device);
382 delete d;
383}
384
385QString NetworkManager::Device::uni() const
386{
387 Q_D(const Device);
388 return d->uni;
389}
390
391QString NetworkManager::Device::interfaceName() const
392{
393 Q_D(const Device);
394 return d->interfaceName;
395}
396
397QString NetworkManager::Device::ipInterfaceName() const
398{
399 Q_D(const Device);
400 return d->ipInterface;
401}
402
403QString NetworkManager::Device::driver() const
404{
405 Q_D(const Device);
406 return d->driver;
407}
408
409QString NetworkManager::Device::driverVersion() const
410{
411 Q_D(const Device);
412 return d->driverVersion;
413}
414
415QString NetworkManager::Device::firmwareVersion() const
416{
417 Q_D(const Device);
418 return d->firmwareVersion;
419}
420
426
428{
429 Q_D(const Device);
430
432 for (const QString &availableConnection : std::as_const(d->availableConnections)) {
433 NetworkManager::Connection::Ptr connection = NetworkManager::findConnection(availableConnection);
434 if (connection) {
435 list << connection;
436 }
437 }
438
439 return list;
440}
441
442bool NetworkManager::Device::firmwareMissing() const
443{
444 Q_D(const Device);
445 return d->firmwareMissing;
446}
447
448bool NetworkManager::Device::autoconnect() const
449{
450 Q_D(const Device);
451 return d->autoconnect;
452}
453
455{
456 Q_D(Device);
457 d->deviceIface.setAutoconnect(autoconnect);
458}
459
460QString NetworkManager::Device::udi() const
461{
462 Q_D(const Device);
463 return d->udi;
464}
465
467{
468 Q_D(const Device);
469 return d->physicalPortId;
470}
471
472QHostAddress NetworkManager::Device::ipV4Address() const
473{
474 Q_D(const Device);
475 return d->ipV4Address;
476}
477
478NetworkManager::DeviceStateReason NetworkManager::Device::stateReason() const
479{
480 Q_D(const Device);
481 return DeviceStateReason(d->connectionState, d->reason);
482}
483
485{
486 Q_D(const Device);
487 if (!d->ipV4Config.isValid() && !d->ipV4ConfigPath.isNull()) {
488 d->ipV4Config.setIPv4Path(d->ipV4ConfigPath);
489 }
490 return d->ipV4Config;
491}
492
494{
495 Q_D(const Device);
496 if (!d->ipV6Config.isValid() && !d->ipV6ConfigPath.isNull()) {
497 d->ipV6Config.setIPv6Path(d->ipV6ConfigPath);
498 }
499 return d->ipV6Config;
500}
501
503{
504 Q_D(const Device);
505 if (!d->dhcp4Config && !d->dhcp4ConfigPath.isNull()) {
506 d->dhcp4Config = NetworkManager::Dhcp4Config::Ptr(new Dhcp4Config(d->dhcp4ConfigPath), &QObject::deleteLater);
507 }
508 return d->dhcp4Config;
509}
510
512{
513 Q_D(const Device);
514 if (!d->dhcp6Config && !d->dhcp6ConfigPath.isNull()) {
515 d->dhcp6Config = NetworkManager::Dhcp6Config::Ptr(new Dhcp6Config(d->dhcp6ConfigPath), &QObject::deleteLater);
516 }
517 return d->dhcp6Config;
518}
519
521{
522 Q_D(const Device);
523 /* clang-format off */
524 return !(d->connectionState == NetworkManager::Device::Unavailable
525 || d->connectionState == NetworkManager::Device::Unmanaged
526 || d->connectionState == NetworkManager::Device::Disconnected
527 || d->connectionState == NetworkManager::Device::Failed);
528 /* clang-format on */
529}
530
532{
533 Q_D(const Device);
534 return d->deviceIface.isValid();
535}
536
537bool NetworkManager::Device::managed() const
538{
539 Q_D(const Device);
540 return d->managed;
541}
542
544{
545 Q_D(const Device);
546 return d->interfaceFlags;
547}
548
549uint NetworkManager::Device::mtu() const
550{
551 Q_D(const Device);
552 return d->mtu;
553}
554
555bool NetworkManager::Device::nmPluginMissing() const
556{
557 Q_D(const Device);
558 return d->nmPluginMissing;
559}
560
561NetworkManager::Device::MeteredStatus NetworkManager::Device::metered() const
562{
563 Q_D(const Device);
564 return d->metered;
565}
566
567QDBusPendingReply<> NetworkManager::Device::reapplyConnection(const NMVariantMapMap &connection, qulonglong version_id, uint flags)
568{
569 Q_D(Device);
570 return d->deviceIface.Reapply(connection, version_id, flags);
571}
572
574{
575 Q_D(Device);
576 return d->deviceIface.Disconnect();
577}
578
580{
581 if (NetworkManager::checkVersion(1, 0, 0)) {
582 Q_D(Device);
583 return d->deviceIface.Delete();
584 } else {
585 return QDBusPendingReply<>();
586 }
587}
588
589NetworkManager::Device::State NetworkManager::Device::state() const
590{
591 Q_D(const Device);
592 return d->connectionState;
593}
594
596{
597 Q_D(const Device);
598 return d->designSpeed;
599}
600
602{
603 Q_D(const Device);
604 return d->capabilities;
605}
606
607QVariant NetworkManager::Device::capabilitiesV() const
608{
609 Q_D(const Device);
610 return QVariant(d->capabilities);
611}
612
613NetworkManager::DeviceStatistics::Ptr NetworkManager::Device::deviceStatistics() const
614{
615 Q_D(const Device);
616 return d->deviceStatistics;
617}
618
619void NetworkManager::DevicePrivate::deviceStateChanged(uint newState, uint oldState, uint reason)
620{
621 Q_Q(Device);
622 connectionState = NetworkManager::DevicePrivate::convertState(newState);
623 reason = NetworkManager::DevicePrivate::convertReason(reason);
624
625 Q_EMIT q->stateChanged(connectionState, NetworkManager::DevicePrivate::convertState(oldState), NetworkManager::DevicePrivate::convertReason(reason));
626}
627
628void NetworkManager::DevicePrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties)
629{
630 Q_UNUSED(invalidatedProperties);
631 if (interfaceName.contains(QLatin1String("org.freedesktop.NetworkManager.Device"))
632 && interfaceName != QLatin1String("org.freedesktop.NetworkManager.Device.Statistics")) {
633 propertiesChanged(properties);
634 }
635}
636
637void NetworkManager::DevicePrivate::propertiesChanged(const QVariantMap &properties)
638{
639 // qCDebug(NMQT) << Q_FUNC_INFO << properties;
640
641 QVariantMap::const_iterator it = properties.constBegin();
642 while (it != properties.constEnd()) {
643 propertyChanged(it.key(), it.value());
644 ++it;
645 }
646
647 // FIXME workaround, we need to get a path to updated IPv[46]Config,
648 // because NM doesn't Q_EMIT the updated value when the device is activated
649 // BUG: https://bugzilla.gnome.org/show_bug.cgi?id=725657
650 if (properties.contains(QLatin1String("State")) && connectionState == NetworkManager::Device::Activated) {
651 propertyChanged(QLatin1String("Ip4Config"), QVariant::fromValue<QDBusObjectPath>(deviceIface.ip4Config()));
652 propertyChanged(QLatin1String("Ip6Config"), QVariant::fromValue<QDBusObjectPath>(deviceIface.ip6Config()));
653 }
654}
655
657{
658 Q_D(const Device);
659 return d->deviceType;
660}
661
662#include "moc_device.cpp"
663#include "moc_device_p.cpp"
Represents device statistics interface.
This class represents a common device interface.
Definition device.h:34
void ipV4ConfigChanged()
Emitted when the IPv4 configuration of this network has changed.
Dhcp4Config::Ptr dhcp4Config() const
Get the DHCP options returned by the DHCP server or a null pointer if the device is not Activated or ...
Definition device.cpp:502
void interfaceFlagsChanged()
Emitted when the up or down state of the device.
bool isActive() const
Retrieves the activation status of this network interface.
Definition device.cpp:520
State
Device connection states describe the possible states of a network connection from the user's point o...
Definition device.h:66
@ Failed
The device is in a failure state following an attempt to activate it.
Definition device.h:79
@ Unmanaged
The device is recognized but not managed by NetworkManager.
Definition device.h:68
@ Disconnected
The device is not connected.
Definition device.h:70
@ Activated
The device is active.
Definition device.h:77
@ Unavailable
The device cannot be used (carrier off, rfkill, etc)
Definition device.h:69
void meteredChanged(MeteredStatus metered)
Emitted when metered property has changed.
void firmwareMissingChanged()
Emitted when the firmware missing state of this network has changed.
void physicalPortIdChanged()
Emitted when the physical port ID changes.
void stateReasonChanged()
Emitted when the state reason of this network has changed.
void activeConnectionChanged()
Emitted when the autoconnect of this network has changed.
void stateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason)
This signal is emitted when the device's link status changed.
Capabilities capabilities() const
Retrieves the capabilities supported by this device.
Definition device.cpp:601
void udiChanged()
Emitted when the Unique Device Identifier of this device has changed.
void connectionStateChanged()
Emitted when the connection state of this network has changed.
void driverVersionChanged()
Emitted when the driver version of this network has changed.
int designSpeed() const
Retrieves the maximum speed as reported by the device.
Definition device.cpp:595
~Device() override
Destroys a device object.
Definition device.cpp:379
QDBusPendingReply reapplyConnection(const NMVariantMapMap &connection, qulonglong version_id, uint flags)
Reapplies connection settings on the interface.
Definition device.cpp:567
void ipInterfaceChanged()
Emitted when the ip interface name of this network has changed.
void ipV6ConfigChanged()
Emitted when the IPv6 configuration of this network has changed.
void dhcp4ConfigChanged()
Emitted when the DHCP configuration for IPv4 of this network has changed.
void availableConnectionAppeared(const QString &connection)
Emitted when a new connection is available.
NetworkManager::ActiveConnection::Ptr activeConnection() const
The current active connection for this device.
Definition device.cpp:421
void interfaceNameChanged()
Emitted when the interface name of this network has changed.
Connection::List availableConnections()
Returns available connections for this device.
Definition device.cpp:427
QString physicalPortId() const
Definition device.cpp:466
void setAutoconnect(bool autoconnect)
If true, indicates the device is allowed to autoconnect.
Definition device.cpp:454
void dhcp6ConfigChanged()
Emitted when the DHCP configuration for IPv6 of this network has changed.
void mtuChanged()
Emitted when the maximum transmission unit has changed.
void driverChanged()
Emitted when the driver of this network has changed.
bool isValid() const
Retrieves the device is valid.
Definition device.cpp:531
void firmwareVersionChanged()
Emitted when the firmware version of this network has changed.
Dhcp6Config::Ptr dhcp6Config() const
Get the DHCP options returned by the DHCP server or a null pointer if the device is not Activated or ...
Definition device.cpp:511
StateChangeReason
Enums describing the reason for a connection state change.
Definition device.h:87
QDBusPendingReply disconnectInterface()
Disconnects a device and prevents the device from automatically activating further connections withou...
Definition device.cpp:573
virtual Type type() const
Retrieves the interface type.
Definition device.cpp:656
void availableConnectionDisappeared(const QString &connection)
Emitted when the connection is no longer available.
QDBusPendingReply deleteInterface()
Deletes a software device from NetworkManager and removes the interface from the system.
Definition device.cpp:579
void nmPluginMissingChanged(bool nmPluginMissing)
Emitted when NmPluginMissing property has changed.
Type
Device type.
Definition device.h:191
@ MacVlan
MacVlan virtual device.
Definition device.h:209
@ OvsBridge
OvsBridge Device.
Definition device.h:219
@ Lowpan
Lowpan Device.
Definition device.h:221
@ Wpan
Wpan Device.
Definition device.h:220
@ WifiP2P
WifiP2P Device.
Definition device.h:223
@ Tun
Tun virtual device.
Definition device.h:210
@ MacSec
MacSec Device.
Definition device.h:214
@ IpTunnel
IP Tunneling Device.
Definition device.h:212
@ OvsPort
OvsPort Device.
Definition device.h:218
@ Veth
Veth virtual device.
Definition device.h:211
@ VRF
VRF (Virtual Routing and Forwarding) Device.
Definition device.h:224
@ UnknownType
Unknown device type.
Definition device.h:192
@ OvsInterface
OvsInterface Device.
Definition device.h:217
@ WireGuard
WireGuard Device.
Definition device.h:222
@ Dummy
Dummy Device.
Definition device.h:215
@ VxLan
Vxlan Device.
Definition device.h:213
@ Loopback
Loopback Device.
Definition device.h:225
@ Ppp
Ppp Device.
Definition device.h:216
Interfaceflags interfaceFlags() const
The up or down flag for the device.
Definition device.cpp:543
void availableConnectionChanged()
Emitted when the list of avaiable connections of this network has changed.
void autoconnectChanged()
Emitted when the autoconnect of this network has changed.
Device(const QString &path, QObject *parent=nullptr)
Creates a new device object.
Definition device.cpp:226
IpConfig ipV4Config() const
Get the current IPv4 configuration of this device.
Definition device.cpp:484
void capabilitiesChanged()
Emitted when the capabilities of this network has changed.
@ None
no flags set
Definition device.h:179
void managedChanged()
Emitted when the managed state of this network has changed.
IpConfig ipV6Config() const
Get the current IPv6 configuration of this device.
Definition device.cpp:493
void ipV4AddressChanged()
Emitted when the IPv4 address of this network has changed.
This class represents dhcp4 configuration.
Definition dhcp4config.h:25
This class represents dhcp4 configuration.
Definition dhcp6config.h:25
This class represents IP configuration.
Definition ipconfig.h:28
Capabilities capabilities()
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
KGuiItem properties()
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition accesspoint.h:21
NETWORKMANAGERQT_EXPORT ActiveConnection::Ptr findActiveConnection(const QString &uni)
Find an ActiveConnection object for an active connection id.
Definition manager.cpp:1030
NETWORKMANAGERQT_EXPORT NetworkManager::Device::MeteredStatus metered()
Definition manager.cpp:1189
NETWORKMANAGERQT_EXPORT NetworkManager::Connection::Ptr findConnection(const QString &path)
Retrieves the connection for the given path, returns null if not found.
Definition settings.cpp:225
NETWORKMANAGERQT_EXPORT bool checkVersion(const int x, const int y, const int z)
Checks if NetworkManager version is at least x.y.z.
Definition manager.cpp:241
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QDBusConnection sessionBus()
QDBusConnection systemBus()
QString path() const const
iterator begin()
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool isNull() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QVariant fromValue(T &&value)
bool toBool() const const
QString toString() const const
uint toUInt(bool *ok) const const
T value() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:55:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.