1/*
2 SPDX-FileCopyrightText: 2008, 2010 Will Stephenson <wstephenson@kde.org>
3 SPDX-FileCopyrightText: 2011-2013 Lamarque Souza <lamarque@kde.org>
4 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com>
5 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8*/
9
10#include "manager.h"
11#include "manager_p.h"
12
13#include "macros.h"
14
15#undef signals
16#include <libnm/NetworkManager.h>
17#define signals Q_SIGNALS
18
19#include "adsldevice.h"
20#include "bluetoothdevice.h"
21#include "bonddevice.h"
22#include "bridgedevice.h"
23#include "dbus/deviceinterface.h"
24#include "device_p.h"
25#include "genericdevice.h"
26#include "gredevice.h"
27#include "infinibanddevice.h"
28#include "iptunneldevice.h"
29#include "macvlandevice.h"
30#include "modemdevice.h"
31#include "olpcmeshdevice.h"
32#include "settings.h"
33#include "settings_p.h"
34#include "tundevice.h"
35#include "vethdevice.h"
36#include "vlandevice.h"
37#include "vpnconnection.h"
38#include "wimaxdevice.h"
39#include "wireddevice.h"
40#include "wireguarddevice.h"
41#include "wirelessdevice.h"
42
43#include "nmdebug.h"
44
45#include <QDBusMetaType>
46#include <QDBusReply>
47#include <QTimer>
48
49#define DBUS_OBJECT_MANAGER "org.freedesktop.DBus.ObjectManager"
50#define DBUS_PROPERTIES "org.freedesktop.DBus.Properties"
51
52#ifdef NMQT_STATIC
53const QString NetworkManager::NetworkManagerPrivate::DBUS_SERVICE(QString::fromLatin1("org.kde.fakenetwork"));
54const QString NetworkManager::NetworkManagerPrivate::DBUS_DAEMON_PATH(QString::fromLatin1("/org/kde/fakenetwork"));
55const QString NetworkManager::NetworkManagerPrivate::DBUS_DAEMON_INTERFACE(QString::fromLatin1("org.kde.fakenetwork"));
56const QString NetworkManager::NetworkManagerPrivate::DBUS_SETTINGS_PATH(QString::fromLatin1("/org/kde/fakenetwork/Settings"));
57#else
58const QString NetworkManager::NetworkManagerPrivate::DBUS_SERVICE(QString::fromLatin1(NM_DBUS_SERVICE));
59const QString NetworkManager::NetworkManagerPrivate::DBUS_DAEMON_PATH(QString::fromLatin1(NM_DBUS_PATH));
60const QString NetworkManager::NetworkManagerPrivate::DBUS_DAEMON_INTERFACE(QString::fromLatin1(NM_DBUS_INTERFACE));
61const QString NetworkManager::NetworkManagerPrivate::DBUS_SETTINGS_PATH(QString::fromLatin1(NM_DBUS_PATH_SETTINGS));
62#endif
63const QString NetworkManager::NetworkManagerPrivate::FDO_DBUS_PROPERTIES(QString::fromLatin1(DBUS_PROPERTIES));
64const QString NetworkManager::NetworkManagerPrivate::FDO_DBUS_OBJECT_MANAGER(QString::fromLatin1(DBUS_OBJECT_MANAGER));
65
66Q_GLOBAL_STATIC(NetworkManager::NetworkManagerPrivate, globalNetworkManager)
67
68NetworkManager::NetworkManagerPrivate::NetworkManagerPrivate()
69#ifdef NMQT_STATIC
70 : watcher(DBUS_SERVICE, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this)
71 , iface(NetworkManager::NetworkManagerPrivate::DBUS_SERVICE, NetworkManager::NetworkManagerPrivate::DBUS_DAEMON_PATH, QDBusConnection::sessionBus())
72#else
73 : watcher(DBUS_SERVICE, QDBusConnection::systemBus(), QDBusServiceWatcher::WatchForOwnerChange, this)
74 , iface(NetworkManager::NetworkManagerPrivate::DBUS_SERVICE, NetworkManager::NetworkManagerPrivate::DBUS_DAEMON_PATH, QDBusConnection::systemBus())
75#endif
76 , nmState(NetworkManager::Unknown)
77 , m_connectivity(NetworkManager::UnknownConnectivity)
78 , m_isNetworkingEnabled(false)
79 , m_isWimaxEnabled(false)
80 , m_isWimaxHardwareEnabled(false)
81 , m_isWirelessEnabled(false)
82 , m_isWirelessHardwareEnabled(false)
83 , m_isWwanEnabled(false)
84 , m_isWwanHardwareEnabled(false)
85 , m_globalDnsConfiguration(NetworkManager::DnsConfiguration())
86 , m_supportedInterfaceTypes(NetworkManager::Device::UnknownType)
87{
88 connect(sender: &iface, signal: &OrgFreedesktopNetworkManagerInterface::DeviceAdded, context: this, slot: &NetworkManagerPrivate::onDeviceAdded);
89 connect(sender: &iface, signal: &OrgFreedesktopNetworkManagerInterface::DeviceRemoved, context: this, slot: &NetworkManagerPrivate::onDeviceRemoved);
90
91#ifndef NMQT_STATIC
92 QDBusConnection::systemBus().connect(service: NetworkManagerPrivate::DBUS_SERVICE,
93 path: NetworkManagerPrivate::DBUS_DAEMON_PATH,
94 interface: NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
95 name: QLatin1String("PropertiesChanged"),
96 receiver: this,
97 SLOT(dbusPropertiesChanged(QString, QVariantMap, QStringList)));
98#else
99 connect(&iface, &OrgFreedesktopNetworkManagerInterface::PropertiesChanged, this, &NetworkManagerPrivate::propertiesChanged);
100#endif
101
102 // We register two listeners here:
103 // - a ServiceRegistered listener for newer NM versions that connect to the bus when the interfaces
104 // we care about are already initialized
105 // - and an InterfaceAdded listener for older NM versions that connect to the bus early,
106 // and then add interfaces dynamically
107 iface.connection().connect(service: NetworkManagerPrivate::DBUS_SERVICE,
108 path: "/org/freedesktop",
109 interface: NetworkManagerPrivate::FDO_DBUS_OBJECT_MANAGER,
110 name: QLatin1String("InterfacesAdded"),
111 receiver: this,
112 SLOT(dbusInterfacesAdded(QDBusObjectPath, QVariantMap)));
113
114 connect(sender: &watcher, signal: &QDBusServiceWatcher::serviceRegistered, context: this, slot: &NetworkManagerPrivate::daemonRegistered);
115 connect(sender: &watcher, signal: &QDBusServiceWatcher::serviceUnregistered, context: this, slot: &NetworkManagerPrivate::daemonUnregistered);
116
117 init();
118}
119
120void NetworkManager::NetworkManagerPrivate::parseVersion(const QString &version)
121{
122 const QStringList sl = version.split(sep: '.');
123
124 if (sl.size() > 2) {
125 m_x = sl[0].toInt();
126 m_y = sl[1].toInt();
127 m_z = sl[2].toInt();
128 } else {
129 m_x = -1;
130 m_y = -1;
131 m_z = -1;
132 }
133}
134
135void NetworkManager::NetworkManagerPrivate::init()
136{
137 qDBusRegisterMetaType<UIntList>();
138 qDBusRegisterMetaType<UIntListList>();
139 // qDBusRegisterMetaType<IpV6DBusAddress>();
140 // qDBusRegisterMetaType<IpV6DBusAddressList>();
141 // qDBusRegisterMetaType<IpV6DBusNameservers>();
142 // qDBusRegisterMetaType<IpV6DBusRoute>();
143 // qDBusRegisterMetaType<IpV6DBusRouteList>();
144 qDBusRegisterMetaType<QList<QDBusObjectPath>>();
145 qDBusRegisterMetaType<DeviceDBusStateReason>();
146 qDBusRegisterMetaType<NMVariantMapMap>();
147 qDBusRegisterMetaType<NMVariantMapList>();
148 qDBusRegisterMetaType<NMStringMap>();
149
150 m_version = iface.version();
151 parseVersion(version: m_version);
152 /* clang-format off */
153 m_supportedInterfaceTypes = static_cast<NetworkManager::Device::Types>(
154 NetworkManager::Device::Ethernet
155 | NetworkManager::Device::Wifi
156 | NetworkManager::Device::Modem
157 | (checkVersion(x: 1, y: 2, z: 0) ? 0 : NetworkManager::Device::Wimax)
158 | NetworkManager::Device::Bluetooth
159 | NetworkManager::Device::OlpcMesh
160 | NetworkManager::Device::InfiniBand
161 | NetworkManager::Device::Bond
162 | NetworkManager::Device::Vlan
163 | NetworkManager::Device::Adsl
164 | NetworkManager::Device::Bridge
165 | NetworkManager::Device::Generic
166 | NetworkManager::Device::Team
167 | NetworkManager::Device::MacVlan
168 | NetworkManager::Device::Tun
169 | NetworkManager::Device::Veth
170 | NetworkManager::Device::IpTunnel
171 | NetworkManager::Device::WireGuard);
172 /* clang-format on */
173
174 // Get all Manager's properties async
175 QVariantMap initialProperties = retrieveInitialProperties(interfaceName: iface.staticInterfaceName(), path: DBUS_DAEMON_PATH);
176 if (!initialProperties.isEmpty()) {
177 propertiesChanged(changedProperties: initialProperties);
178 }
179
180 QTimer::singleShot(interval: 0, slot: [] {
181 qobject_cast<SettingsPrivate *>(object: settingsNotifier())->init();
182 });
183
184 const QList<QDBusObjectPath> devices = iface.devices();
185 qCDebug(NMQT) << "Device list";
186 for (const QDBusObjectPath &op : devices) {
187 networkInterfaceMap.insert(key: op.path(), value: Device::Ptr());
188 Q_EMIT deviceAdded(uni: op.path());
189 qCDebug(NMQT) << " " << op.path();
190 }
191}
192
193NetworkManager::NetworkManagerPrivate::~NetworkManagerPrivate()
194{
195}
196
197QString NetworkManager::NetworkManagerPrivate::version() const
198{
199 return m_version;
200}
201
202int NetworkManager::NetworkManagerPrivate::compareVersion(const QString &version)
203{
204 int x;
205 int y;
206 int z;
207 const auto sl = QStringView(version).split(sep: '.');
208 if (sl.size() > 2) {
209 x = sl[0].toInt();
210 y = sl[1].toInt();
211 z = sl[2].toInt();
212 } else {
213 x = -1;
214 y = -1;
215 z = -1;
216 }
217
218 return compareVersion(x, y, z);
219}
220
221int NetworkManager::NetworkManagerPrivate::compareVersion(const int x, const int y, const int z) const
222{
223 if (m_x > x) {
224 return 1;
225 } else if (m_x < x) {
226 return -1;
227 } else if (m_y > y) {
228 return 1;
229 } else if (m_y < y) {
230 return -1;
231 } else if (m_z > z) {
232 return 1;
233 } else if (m_z < z) {
234 return -1;
235 }
236 return 0;
237}
238
239bool NetworkManager::NetworkManagerPrivate::checkVersion(const int x, const int y, const int z) const
240{
241 return 0 <= compareVersion(x, y, z);
242}
243
244NetworkManager::Device::Types NetworkManager::NetworkManagerPrivate::supportedInterfaceTypes() const
245{
246 return m_supportedInterfaceTypes;
247}
248
249QVariantMap NetworkManager::NetworkManagerPrivate::retrieveInitialProperties(const QString &interfaceName, const QString &path)
250{
251 QDBusMessage message = QDBusMessage::createMethodCall(destination: DBUS_SERVICE, path, interface: FDO_DBUS_PROPERTIES, method: QLatin1String("GetAll"));
252 message << interfaceName;
253#ifdef NMQT_STATIC
254 QDBusMessage resultMessage = QDBusConnection::sessionBus().call(message);
255#else
256 QDBusMessage resultMessage = QDBusConnection::systemBus().call(message);
257#endif
258 if (resultMessage.type() == QDBusMessage::ReplyMessage) {
259 QVariantMap result;
260 QDBusArgument dbusArgument = resultMessage.arguments().at(i: 0).value<QDBusArgument>();
261 while (!dbusArgument.atEnd()) {
262 dbusArgument >> result;
263 }
264 return result;
265 }
266
267 return QVariantMap();
268}
269
270NetworkManager::Device::Ptr NetworkManager::NetworkManagerPrivate::findRegisteredNetworkInterface(const QString &uni)
271{
272 NetworkManager::Device::Ptr networkInterface;
273 auto it = networkInterfaceMap.constFind(key: uni);
274 if (it != networkInterfaceMap.constEnd()) {
275 if (*it) {
276 networkInterface = *it;
277 } else {
278 networkInterface = createNetworkInterface(uni);
279 networkInterfaceMap[uni] = networkInterface;
280 }
281 }
282 return networkInterface;
283}
284
285NetworkManager::ActiveConnection::Ptr NetworkManager::NetworkManagerPrivate::findRegisteredActiveConnection(const QString &uni)
286{
287 NetworkManager::ActiveConnection::Ptr activeConnection;
288 if (!uni.isEmpty() && uni != QLatin1String("/")) {
289 const auto it = m_activeConnections.constFind(key: uni);
290 const bool contains = it != m_activeConnections.constEnd();
291 if (contains && *it) {
292 activeConnection = *it;
293 } else {
294 activeConnection = NetworkManager::ActiveConnection::Ptr(new NetworkManager::VpnConnection(uni), &QObject::deleteLater);
295 if (activeConnection->connection()) {
296 m_activeConnections[uni] = activeConnection;
297 if (!contains) {
298 Q_EMIT activeConnectionAdded(path: uni);
299 }
300 } else {
301 activeConnection.clear();
302 }
303 }
304 }
305 return activeConnection;
306}
307
308NetworkManager::Device::Ptr NetworkManager::NetworkManagerPrivate::createNetworkInterface(const QString &uni)
309{
310 // qCDebug(NMQT);
311 auto message = QDBusMessage::createMethodCall(destination: DBUS_SERVICE, path: uni, interface: FDO_DBUS_PROPERTIES, QStringLiteral("Get"));
312 message.setArguments({QLatin1String(OrgFreedesktopNetworkManagerDeviceInterface::staticInterfaceName()), QStringLiteral("DeviceType")});
313#ifdef NMQT_STATIC
314 auto bus = QDBusConnection::sessionBus();
315#else
316 auto bus = QDBusConnection::systemBus();
317#endif
318 QDBusReply<QVariant> reply = bus.call(message);
319 Device::Type type = reply.isValid() ? NetworkManager::DevicePrivate::convertType(reply.value().toInt()) : Device::UnknownType;
320 switch (type) {
321 case Device::Ethernet:
322 return Device::Ptr(new NetworkManager::WiredDevice(uni), &QObject::deleteLater);
323 case Device::Wifi:
324 return Device::Ptr(new NetworkManager::WirelessDevice(uni), &QObject::deleteLater);
325 case Device::Modem:
326 return Device::Ptr(new NetworkManager::ModemDevice(uni), &QObject::deleteLater);
327 case Device::Bluetooth:
328 return Device::Ptr(new NetworkManager::BluetoothDevice(uni), &QObject::deleteLater);
329 case Device::Wimax:
330 return Device::Ptr(new NetworkManager::WimaxDevice(uni), &QObject::deleteLater);
331 case Device::OlpcMesh:
332 return Device::Ptr(new NetworkManager::OlpcMeshDevice(uni), &QObject::deleteLater);
333 case Device::InfiniBand:
334 return Device::Ptr(new NetworkManager::InfinibandDevice(uni), &QObject::deleteLater);
335 case Device::Bond:
336 return Device::Ptr(new NetworkManager::BondDevice(uni), &QObject::deleteLater);
337 case Device::Vlan:
338 return Device::Ptr(new NetworkManager::VlanDevice(uni), &QObject::deleteLater);
339 case Device::Adsl:
340 return Device::Ptr(new NetworkManager::AdslDevice(uni), &QObject::deleteLater);
341 case Device::Bridge:
342 return Device::Ptr(new NetworkManager::BridgeDevice(uni), &QObject::deleteLater);
343 // No need to check checkVersion, because we can't get Generic, Gre, MacVlan, Tun & Veth values in incompatible runtime
344 case Device::Generic:
345 return Device::Ptr(new NetworkManager::GenericDevice(uni), &QObject::deleteLater);
346 case Device::Gre:
347 return Device::Ptr(new NetworkManager::GreDevice(uni), &QObject::deleteLater);
348 case Device::MacVlan:
349 return Device::Ptr(new NetworkManager::MacVlanDevice(uni), &QObject::deleteLater);
350 case Device::Tun:
351 return Device::Ptr(new NetworkManager::TunDevice(uni), &QObject::deleteLater);
352 case Device::Veth:
353 return Device::Ptr(new NetworkManager::VethDevice(uni), &QObject::deleteLater);
354 case Device::IpTunnel:
355 return Device::Ptr(new NetworkManager::IpTunnelDevice(uni), &QObject::deleteLater);
356 case Device::WireGuard:
357 return Device::Ptr(new NetworkManager::WireGuardDevice(uni), &QObject::deleteLater);
358 default:
359 if (uni != QLatin1String("any")) { // VPN connections use "any" as uni for the network interface.
360 qCDebug(NMQT) << "Can't create device of type" << type << "for" << uni;
361 }
362 }
363
364 return Device::Ptr(new Device(uni), &QObject::deleteLater);
365}
366
367NetworkManager::Status NetworkManager::NetworkManagerPrivate::status() const
368{
369 return nmState;
370}
371
372NetworkManager::Device::List NetworkManager::NetworkManagerPrivate::networkInterfaces()
373{
374 Device::List list;
375
376 QMap<QString, Device::Ptr>::const_iterator i;
377 for (i = networkInterfaceMap.constBegin(); i != networkInterfaceMap.constEnd(); ++i) {
378 Device::Ptr networkInterface = findRegisteredNetworkInterface(uni: i.key());
379 if (!networkInterface.isNull()) {
380 list.append(t: networkInterface);
381 } else {
382 qCWarning(NMQT) << "warning: null network Interface for" << i.key();
383 }
384 }
385
386 return list;
387}
388
389NetworkManager::Device::Ptr NetworkManager::NetworkManagerPrivate::findDeviceByIpIface(const QString &iface)
390{
391 QMap<QString, Device::Ptr>::const_iterator i;
392 for (i = networkInterfaceMap.constBegin(); i != networkInterfaceMap.constEnd(); ++i) {
393 Device::Ptr networkInterface = findRegisteredNetworkInterface(uni: i.key());
394 if (networkInterface && networkInterface->udi() == iface) {
395 return networkInterface;
396 }
397 }
398
399 return Device::Ptr();
400}
401
402bool NetworkManager::NetworkManagerPrivate::isNetworkingEnabled() const
403{
404 return m_isNetworkingEnabled;
405}
406
407bool NetworkManager::NetworkManagerPrivate::isWirelessEnabled() const
408{
409 return m_isWirelessEnabled;
410}
411
412bool NetworkManager::NetworkManagerPrivate::isWirelessHardwareEnabled() const
413{
414 return m_isWirelessHardwareEnabled;
415}
416
417bool NetworkManager::NetworkManagerPrivate::isWwanEnabled() const
418{
419 return m_isWwanEnabled;
420}
421
422bool NetworkManager::NetworkManagerPrivate::isWwanHardwareEnabled() const
423{
424 return m_isWwanHardwareEnabled;
425}
426
427bool NetworkManager::NetworkManagerPrivate::isWimaxEnabled() const
428{
429 return checkVersion(x: 1, y: 2, z: 0) ? false : m_isWimaxEnabled;
430}
431
432bool NetworkManager::NetworkManagerPrivate::isWimaxHardwareEnabled() const
433{
434 return checkVersion(x: 1, y: 2, z: 0) ? false : m_isWimaxHardwareEnabled;
435}
436
437QDBusPendingReply<QDBusObjectPath>
438NetworkManager::NetworkManagerPrivate::activateConnection(const QString &connectionUni, const QString &interfaceUni, const QString &connectionParameter)
439{
440 QString extra_connection_parameter = connectionParameter;
441 QString extra_interface_parameter = interfaceUni;
442 if (extra_connection_parameter.isEmpty()) {
443 extra_connection_parameter = QLatin1String("/");
444 }
445 if (extra_interface_parameter.isEmpty()) {
446 extra_interface_parameter = QLatin1String("/");
447 }
448 // TODO store error code
449 QDBusObjectPath connPath(connectionUni);
450 QDBusObjectPath interfacePath(interfaceUni);
451 // qCDebug(NMQT) << "Activating connection" << connPath.path() << "on interface" << interfacePath.path() << "with extra" << extra_connection_parameter;
452 return iface.ActivateConnection(connection: connPath, device: QDBusObjectPath(extra_interface_parameter), specific_object: QDBusObjectPath(extra_connection_parameter));
453}
454
455QDBusPendingReply<QDBusObjectPath, QDBusObjectPath> NetworkManager::NetworkManagerPrivate::addAndActivateConnection(const NMVariantMapMap &connection,
456 const QString &interfaceUni,
457 const QString &connectionParameter)
458{
459 QString extra_connection_parameter = connectionParameter;
460 if (extra_connection_parameter.isEmpty()) {
461 extra_connection_parameter = QLatin1String("/");
462 }
463 // TODO store error code
464 QDBusObjectPath interfacePath(interfaceUni);
465 return iface.AddAndActivateConnection(connection, device: interfacePath, specific_object: QDBusObjectPath(extra_connection_parameter));
466}
467
468QDBusPendingReply<QDBusObjectPath, QDBusObjectPath, QVariantMap>
469NetworkManager::NetworkManagerPrivate::addAndActivateConnection2(const NMVariantMapMap &connection,
470 const QString &interfaceUni,
471 const QString &connectionParameter,
472 const QVariantMap &options)
473{
474 QString extra_connection_parameter = connectionParameter;
475 if (extra_connection_parameter.isEmpty()) {
476 extra_connection_parameter = QLatin1String("/");
477 }
478 // TODO store error code
479 QDBusObjectPath interfacePath(interfaceUni);
480 return iface.AddAndActivateConnection2(connection, device: interfacePath, specific_object: QDBusObjectPath(extra_connection_parameter), options);
481}
482
483QDBusPendingReply<> NetworkManager::NetworkManagerPrivate::deactivateConnection(const QString &activeConnectionPath)
484{
485 return iface.DeactivateConnection(active_connection: QDBusObjectPath(activeConnectionPath));
486}
487
488void NetworkManager::NetworkManagerPrivate::setNetworkingEnabled(bool enabled)
489{
490 iface.Enable(enable: enabled);
491}
492
493void NetworkManager::NetworkManagerPrivate::setWirelessEnabled(bool enabled)
494{
495 iface.setWirelessEnabled(enabled);
496}
497
498void NetworkManager::NetworkManagerPrivate::setWwanEnabled(bool enabled)
499{
500 iface.setWwanEnabled(enabled);
501}
502
503void NetworkManager::NetworkManagerPrivate::setWimaxEnabled(bool enabled)
504{
505 if (!checkVersion(x: 1, y: 2, z: 0)) {
506 iface.setWimaxEnabled(enabled);
507 }
508}
509
510void NetworkManager::NetworkManagerPrivate::sleep(bool sleep)
511{
512 iface.Sleep(sleep);
513}
514
515void NetworkManager::NetworkManagerPrivate::setLogging(NetworkManager::LogLevel level, NetworkManager::LogDomains domains)
516{
517 QString logLevel;
518 QStringList logDomains;
519 switch (level) {
520 case NetworkManager::Error:
521 logLevel = QLatin1String("ERR");
522 break;
523 case NetworkManager::Warning:
524 logLevel = QLatin1String("WARN");
525 break;
526 case NetworkManager::Info:
527 logLevel = QLatin1String("INFO");
528 break;
529 case NetworkManager::Debug:
530 logLevel = QLatin1String("DEBUG");
531 break;
532 case NetworkManager::Trace:
533 logLevel = QLatin1String("TRACE");
534 break;
535 }
536 if (!domains.testFlag(flag: NoChange)) {
537 if (domains.testFlag(flag: NetworkManager::None)) {
538 logDomains << QLatin1String("NONE");
539 }
540 if (domains.testFlag(flag: NetworkManager::Hardware)) {
541 logDomains << QLatin1String("PLATFORM");
542 }
543 if (domains.testFlag(flag: NetworkManager::RFKill)) {
544 logDomains << QLatin1String("RFKILL");
545 }
546 if (domains.testFlag(flag: NetworkManager::Ethernet)) {
547 logDomains << QLatin1String("ETHER");
548 }
549 if (domains.testFlag(flag: NetworkManager::WiFi)) {
550 logDomains << QLatin1String("WIFI");
551 }
552 if (domains.testFlag(flag: NetworkManager::Bluetooth)) {
553 logDomains << QLatin1String("BT");
554 }
555 if (domains.testFlag(flag: NetworkManager::MobileBroadBand)) {
556 logDomains << QLatin1String("MB");
557 }
558 if (domains.testFlag(flag: NetworkManager::DHCP4)) {
559 logDomains << QLatin1String("DHCP4");
560 }
561 if (domains.testFlag(flag: NetworkManager::DHCP6)) {
562 logDomains << QLatin1String("DHCP6");
563 }
564 if (domains.testFlag(flag: NetworkManager::PPP)) {
565 logDomains << QLatin1String("PPP");
566 }
567 if (domains.testFlag(flag: NetworkManager::WiFiScan)) {
568 logDomains << QLatin1String("WIFI_SCAN");
569 }
570 if (domains.testFlag(flag: NetworkManager::IPv4)) {
571 logDomains << QLatin1String("IP4");
572 }
573 if (domains.testFlag(flag: NetworkManager::IPv6)) {
574 logDomains << QLatin1String("IP6");
575 }
576 if (domains.testFlag(flag: NetworkManager::AutoIPv4)) {
577 logDomains << QLatin1String("AUTOIP4");
578 }
579 if (domains.testFlag(flag: NetworkManager::DNS)) {
580 logDomains << QLatin1String("DNS");
581 }
582 if (domains.testFlag(flag: NetworkManager::VPN)) {
583 logDomains << QLatin1String("VPN");
584 }
585 if (domains.testFlag(flag: NetworkManager::Sharing)) {
586 logDomains << QLatin1String("SHARING");
587 }
588 if (domains.testFlag(flag: NetworkManager::Supplicant)) {
589 logDomains << QLatin1String("SUPPLICANT");
590 }
591 if (domains.testFlag(flag: NetworkManager::UserSet)) {
592 logDomains << QLatin1String("USER_SET");
593 }
594 if (domains.testFlag(flag: NetworkManager::SysSet)) {
595 logDomains << QLatin1String("SYS_SET");
596 }
597 if (domains.testFlag(flag: NetworkManager::Suspend)) {
598 logDomains << QLatin1String("SUSPEND");
599 }
600 if (domains.testFlag(flag: NetworkManager::Core)) {
601 logDomains << QLatin1String("CORE");
602 }
603 if (domains.testFlag(flag: NetworkManager::Devices)) {
604 logDomains << QLatin1String("DEVICE");
605 }
606 if (domains.testFlag(flag: NetworkManager::OLPC)) {
607 logDomains << QLatin1String("OLPC");
608 }
609 if (domains.testFlag(flag: NetworkManager::Wimax)) {
610 logDomains << QLatin1String("WIMAX");
611 }
612 if (domains.testFlag(flag: NetworkManager::Infiniband)) {
613 logDomains << QLatin1String("INFINIBAND");
614 }
615 if (domains.testFlag(flag: NetworkManager::Firewall)) {
616 logDomains << QLatin1String("FIREWALL");
617 }
618 if (domains.testFlag(flag: NetworkManager::Adsl)) {
619 logDomains << QLatin1String("ADSL");
620 }
621 if (domains.testFlag(flag: NetworkManager::Bond)) {
622 logDomains << QLatin1String("BOND");
623 }
624 if (domains.testFlag(flag: NetworkManager::Vlan)) {
625 logDomains << QLatin1String("VLAN");
626 }
627 if (domains.testFlag(flag: NetworkManager::Agents)) {
628 logDomains << QLatin1String("AGENTS");
629 }
630 if (domains.testFlag(flag: NetworkManager::Settings)) {
631 logDomains << QLatin1String("SETTINGS");
632 }
633 if (domains.testFlag(flag: NetworkManager::DbusProps)) {
634 logDomains << QLatin1String("DBUS_PROPS");
635 }
636 if (domains.testFlag(flag: NetworkManager::Team)) {
637 logDomains << QLatin1String("TEAM");
638 }
639 if (domains.testFlag(flag: NetworkManager::ConCheck)) {
640 logDomains << QLatin1String("CONCHECK");
641 }
642 if (domains.testFlag(flag: NetworkManager::Dcb)) {
643 logDomains << QLatin1String("DCB");
644 }
645 if (domains.testFlag(flag: NetworkManager::Dispatch)) {
646 logDomains << QLatin1String("DISPATCH");
647 }
648 }
649 iface.SetLogging(level: logLevel, domains: logDomains.join(sep: QLatin1Char(',')));
650}
651
652NMStringMap NetworkManager::NetworkManagerPrivate::permissions()
653{
654 return iface.GetPermissions();
655}
656
657NetworkManager::Connectivity NetworkManager::NetworkManagerPrivate::connectivity() const
658{
659 return m_connectivity;
660}
661
662QDBusPendingReply<uint> NetworkManager::NetworkManagerPrivate::checkConnectivity()
663{
664 return iface.CheckConnectivity();
665}
666
667NetworkManager::ActiveConnection::Ptr NetworkManager::NetworkManagerPrivate::primaryConnection()
668{
669 return findRegisteredActiveConnection(uni: m_primaryConnection);
670}
671
672NetworkManager::ActiveConnection::Ptr NetworkManager::NetworkManagerPrivate::activatingConnection()
673{
674 return findRegisteredActiveConnection(uni: m_activatingConnection);
675}
676
677NetworkManager::ConnectionSettings::ConnectionType NetworkManager::NetworkManagerPrivate::primaryConnectionType()
678{
679 return checkVersion(x: 1, y: 0, z: 0) ? m_primaryConnectionType : NetworkManager::ConnectionSettings::Unknown;
680}
681
682bool NetworkManager::NetworkManagerPrivate::isStartingUp() const
683{
684 return iface.startup();
685}
686
687NetworkManager::Device::MeteredStatus NetworkManager::NetworkManagerPrivate::metered() const
688{
689 return checkVersion(x: 1, y: 0, z: 6) ? m_metered : NetworkManager::Device::UnknownStatus;
690}
691
692NetworkManager::DnsConfiguration NetworkManager::NetworkManagerPrivate::globalDnsConfiguration() const
693{
694 return m_globalDnsConfiguration;
695}
696
697void NetworkManager::NetworkManagerPrivate::setGlobalDnsConfiguration(const NetworkManager::DnsConfiguration &configuration)
698{
699 m_globalDnsConfiguration = configuration;
700 iface.setGlobalDnsConfiguration(m_globalDnsConfiguration.toMap());
701}
702
703void NetworkManager::NetworkManagerPrivate::onDeviceAdded(const QDBusObjectPath &objpath)
704{
705 // qCDebug(NMQT);
706 if (!networkInterfaceMap.contains(key: objpath.path())) {
707 networkInterfaceMap.insert(key: objpath.path(), value: Device::Ptr());
708 Q_EMIT deviceAdded(uni: objpath.path());
709 }
710}
711
712void NetworkManager::NetworkManagerPrivate::onDeviceRemoved(const QDBusObjectPath &objpath)
713{
714 // qCDebug(NMQT);
715 networkInterfaceMap.remove(key: objpath.path());
716 Q_EMIT deviceRemoved(uni: objpath.path());
717}
718
719void NetworkManager::NetworkManagerPrivate::connectivityChanged(uint connectivity)
720{
721 NetworkManager::Connectivity newConnectivity = convertConnectivity(connectivity);
722 if (m_connectivity != newConnectivity) {
723 m_connectivity = newConnectivity;
724 Q_EMIT Notifier::connectivityChanged(connectivity: newConnectivity);
725 }
726}
727
728void NetworkManager::NetworkManagerPrivate::stateChanged(uint state)
729{
730 NetworkManager::Status newStatus = convertNMState(state);
731 if (nmState != newStatus) {
732 nmState = newStatus;
733 Q_EMIT Notifier::statusChanged(status: newStatus);
734 }
735}
736
737void NetworkManager::NetworkManagerPrivate::dbusPropertiesChanged(const QString &interfaceName,
738 const QVariantMap &properties,
739 const QStringList &invalidatedProperties)
740{
741 Q_UNUSED(invalidatedProperties);
742 if (interfaceName == QLatin1String("org.freedesktop.NetworkManager")) {
743 propertiesChanged(changedProperties: properties);
744 }
745}
746
747void NetworkManager::NetworkManagerPrivate::propertiesChanged(const QVariantMap &changedProperties)
748{
749 // qCDebug(NMQT) << Q_FUNC_INFO << changedProperties;
750
751 QVariantMap::const_iterator it = changedProperties.constBegin();
752 while (it != changedProperties.constEnd()) {
753 const QString property = it.key();
754 if (property == QLatin1String("ActiveConnections")) {
755 const QList<QDBusObjectPath> activePaths = qdbus_cast<QList<QDBusObjectPath>>(v: *it);
756 if (activePaths.isEmpty()) {
757 QMap<QString, ActiveConnection::Ptr>::const_iterator it = m_activeConnections.constBegin();
758 while (it != m_activeConnections.constEnd()) {
759 Q_EMIT activeConnectionRemoved(path: it.key());
760 ++it;
761 }
762 m_activeConnections.clear();
763 } else {
764 QStringList knownConnections = m_activeConnections.keys();
765 for (const QDBusObjectPath &ac : activePaths) {
766 if (!m_activeConnections.contains(key: ac.path())) {
767 m_activeConnections.insert(key: ac.path(), value: NetworkManager::ActiveConnection::Ptr());
768 Q_EMIT activeConnectionAdded(path: ac.path());
769 } else {
770 knownConnections.removeOne(t: ac.path());
771 }
772 // qCDebug(NMQT) << " " << ac.path();
773 }
774 for (const QString &path : std::as_const(t&: knownConnections)) {
775 m_activeConnections.remove(key: path);
776 Q_EMIT activeConnectionRemoved(path);
777 }
778 }
779 Q_EMIT activeConnectionsChanged();
780 } else if (property == QLatin1String("NetworkingEnabled")) {
781 m_isNetworkingEnabled = it->toBool();
782 qCDebug(NMQT) << property << m_isNetworkingEnabled;
783 Q_EMIT networkingEnabledChanged(m_isNetworkingEnabled);
784 } else if (property == QLatin1String("WirelessHardwareEnabled")) {
785 m_isWirelessHardwareEnabled = it->toBool();
786 qCDebug(NMQT) << property << m_isWirelessHardwareEnabled;
787 Q_EMIT wirelessHardwareEnabledChanged(m_isWirelessHardwareEnabled);
788 } else if (property == QLatin1String("WirelessEnabled")) {
789 m_isWirelessEnabled = it->toBool();
790 qCDebug(NMQT) << property << m_isWirelessEnabled;
791 Q_EMIT wirelessEnabledChanged(m_isWirelessEnabled);
792 } else if (property == QLatin1String("WwanHardwareEnabled")) {
793 m_isWwanHardwareEnabled = it->toBool();
794 qCDebug(NMQT) << property << m_isWwanHardwareEnabled;
795 Q_EMIT wwanHardwareEnabledChanged(m_isWwanHardwareEnabled);
796 } else if (property == QLatin1String("WwanEnabled")) {
797 m_isWwanEnabled = it->toBool();
798 qCDebug(NMQT) << property << m_isWwanEnabled;
799 Q_EMIT wwanEnabledChanged(m_isWwanEnabled);
800 } else if (property == QLatin1String("WimaxHardwareEnabled")) {
801 m_isWimaxHardwareEnabled = it->toBool();
802 qCDebug(NMQT) << property << m_isWimaxHardwareEnabled;
803 Q_EMIT wimaxHardwareEnabledChanged(m_isWimaxHardwareEnabled);
804 } else if (property == QLatin1String("WimaxEnabled")) {
805 m_isWimaxEnabled = it->toBool();
806 qCDebug(NMQT) << property << m_isWimaxEnabled;
807 Q_EMIT wimaxEnabledChanged(m_isWimaxEnabled);
808 } else if (property == QLatin1String("Version")) {
809 m_version = it->toString();
810 parseVersion(version: m_version);
811 } else if (property == QLatin1String("State")) {
812 stateChanged(state: it->toUInt());
813 } else if (property == QLatin1String("Connectivity")) {
814 connectivityChanged(connectivity: it->toUInt());
815 } else if (property == QLatin1String("PrimaryConnection")) {
816 m_primaryConnection = it->value<QDBusObjectPath>().path();
817 Q_EMIT primaryConnectionChanged(uni: m_primaryConnection);
818 } else if (property == QLatin1String("ActivatingConnection")) {
819 m_activatingConnection = it->value<QDBusObjectPath>().path();
820 Q_EMIT activatingConnectionChanged(uni: m_activatingConnection);
821 } else if (property == QLatin1String("PrimaryConnectionType")) {
822 m_primaryConnectionType = NetworkManager::ConnectionSettings::typeFromString(typeString: it->toString());
823 Q_EMIT primaryConnectionTypeChanged(type: m_primaryConnectionType);
824 } else if (property == QLatin1String("Startup")) {
825 Q_EMIT isStartingUpChanged();
826 } else if (property == QLatin1String("Metered")) {
827 m_metered = (NetworkManager::Device::MeteredStatus)it->toUInt();
828 Q_EMIT meteredChanged(metered: m_metered);
829 } else if (property == QLatin1String("GlobalDnsConfiguration")) {
830 m_globalDnsConfiguration.fromMap(map: qdbus_cast<QVariantMap>(v: *it));
831 Q_EMIT globalDnsConfigurationChanged(configuration: m_globalDnsConfiguration);
832 } else {
833 qCDebug(NMQT) << Q_FUNC_INFO << "Unhandled property" << property;
834 }
835 ++it;
836 }
837}
838
839NetworkManager::Connectivity NetworkManager::NetworkManagerPrivate::convertConnectivity(uint connectivity)
840{
841 NetworkManager::Connectivity convertedConnectivity = NetworkManager::UnknownConnectivity;
842 switch (connectivity) {
843 case NM_CONNECTIVITY_UNKNOWN:
844 convertedConnectivity = NetworkManager::UnknownConnectivity;
845 break;
846 case NM_CONNECTIVITY_NONE:
847 convertedConnectivity = NetworkManager::NoConnectivity;
848 break;
849 case NM_CONNECTIVITY_PORTAL:
850 convertedConnectivity = NetworkManager::Portal;
851 break;
852 case NM_CONNECTIVITY_LIMITED:
853 convertedConnectivity = NetworkManager::Limited;
854 break;
855 case NM_CONNECTIVITY_FULL:
856 convertedConnectivity = NetworkManager::Full;
857 break;
858 }
859 return convertedConnectivity;
860}
861
862NetworkManager::Status NetworkManager::NetworkManagerPrivate::convertNMState(uint state)
863{
864 NetworkManager::Status status = NetworkManager::Unknown;
865 switch (state) {
866 case NM_STATE_UNKNOWN:
867 status = NetworkManager::Unknown;
868 break;
869 case NM_STATE_ASLEEP:
870 status = NetworkManager::Asleep;
871 break;
872 case NM_STATE_DISCONNECTED:
873 status = NetworkManager::Disconnected;
874 break;
875 case NM_STATE_DISCONNECTING:
876 status = NetworkManager::Disconnecting;
877 break;
878 case NM_STATE_CONNECTING:
879 status = NetworkManager::Connecting;
880 break;
881 case NM_STATE_CONNECTED_LOCAL:
882 status = NetworkManager::ConnectedLinkLocal;
883 break;
884 case NM_STATE_CONNECTED_SITE:
885 status = NetworkManager::ConnectedSiteOnly;
886 break;
887 case NM_STATE_CONNECTED_GLOBAL:
888 status = NetworkManager::Connected;
889 break;
890 }
891 return status;
892}
893
894void NetworkManager::NetworkManagerPrivate::dbusInterfacesAdded(const QDBusObjectPath &path, const QVariantMap &addedInterfaces)
895{
896 Q_UNUSED(path);
897
898 if (!addedInterfaces.contains(key: NetworkManagerPrivate::DBUS_DAEMON_INTERFACE)) {
899 return;
900 }
901
902 daemonRegistered();
903}
904
905void NetworkManager::NetworkManagerPrivate::daemonRegistered()
906{
907 if (iface.version().isEmpty()) {
908 // If this call fails, we've probably been called from ServiceRegistered on an old NM,
909 // and the interface isn't ready yet. Just exit and hope we get called again on InterfacesAdded.
910 return;
911 }
912
913 init();
914 Q_EMIT serviceAppeared();
915}
916
917void NetworkManager::NetworkManagerPrivate::daemonUnregistered()
918{
919 stateChanged(state: NM_STATE_UNKNOWN);
920 QMap<QString, Device::Ptr>::const_iterator i = networkInterfaceMap.constBegin();
921 while (i != networkInterfaceMap.constEnd()) {
922 Q_EMIT deviceRemoved(uni: i.key());
923 ++i;
924 }
925 networkInterfaceMap.clear();
926
927 QMap<QString, ActiveConnection::Ptr>::const_iterator it = m_activeConnections.constBegin();
928 while (it != m_activeConnections.constEnd()) {
929 Q_EMIT activeConnectionRemoved(path: it.key());
930 ++it;
931 }
932 m_activeConnections.clear();
933
934 qobject_cast<SettingsPrivate *>(object: settingsNotifier())->daemonUnregistered();
935
936 Q_EMIT activeConnectionsChanged();
937 Q_EMIT serviceDisappeared();
938}
939
940NetworkManager::ActiveConnection::List NetworkManager::NetworkManagerPrivate::activeConnections()
941{
942 NetworkManager::ActiveConnection::List list;
943
944 // Take a copy because findRegisteredActiveConnection() may change m_activeConnections.
945 const QStringList keyList = m_activeConnections.keys();
946 for (const QString &key : keyList) {
947 NetworkManager::ActiveConnection::Ptr activeConnection = findRegisteredActiveConnection(uni: key);
948
949 if (activeConnection) {
950 list << activeConnection;
951 }
952 }
953 return list;
954}
955
956QStringList NetworkManager::NetworkManagerPrivate::activeConnectionsPaths() const
957{
958 return m_activeConnections.keys();
959}
960
961QDBusPendingReply<QString, QString> NetworkManager::NetworkManagerPrivate::getLogging()
962{
963 return iface.GetLogging();
964}
965
966QString NetworkManager::version()
967{
968 return globalNetworkManager->version();
969}
970
971int NetworkManager::compareVersion(const QString &version)
972{
973 return globalNetworkManager->compareVersion(version);
974}
975
976int NetworkManager::compareVersion(const int x, const int y, const int z)
977{
978 return globalNetworkManager->compareVersion(x, y, z);
979}
980
981bool NetworkManager::checkVersion(const int x, const int y, const int z)
982{
983 return globalNetworkManager->checkVersion(x, y, z);
984}
985
986NetworkManager::Status NetworkManager::status()
987{
988 return globalNetworkManager->status();
989}
990
991NetworkManager::ActiveConnection::List NetworkManager::activeConnections()
992{
993 return globalNetworkManager->activeConnections();
994}
995
996QStringList NetworkManager::activeConnectionsPaths()
997{
998 return globalNetworkManager->activeConnectionsPaths();
999}
1000
1001NetworkManager::ActiveConnection::Ptr NetworkManager::findActiveConnection(const QString &uni)
1002{
1003 return globalNetworkManager->findRegisteredActiveConnection(uni);
1004}
1005
1006NetworkManager::Device::List NetworkManager::networkInterfaces()
1007{
1008 return globalNetworkManager->networkInterfaces();
1009}
1010
1011bool NetworkManager::isNetworkingEnabled()
1012{
1013 return globalNetworkManager->isNetworkingEnabled();
1014}
1015
1016bool NetworkManager::isWirelessEnabled()
1017{
1018 return globalNetworkManager->isWirelessEnabled();
1019}
1020
1021bool NetworkManager::isWirelessHardwareEnabled()
1022{
1023 return globalNetworkManager->isWirelessHardwareEnabled();
1024}
1025
1026NetworkManager::Device::Ptr NetworkManager::findNetworkInterface(const QString &uni)
1027{
1028 return globalNetworkManager->findRegisteredNetworkInterface(uni);
1029}
1030
1031NetworkManager::Device::Ptr NetworkManager::findDeviceByIpFace(const QString &iface)
1032{
1033 return globalNetworkManager->findDeviceByIpIface(iface);
1034}
1035
1036QDBusPendingReply<QDBusObjectPath, QDBusObjectPath>
1037NetworkManager::addAndActivateConnection(const NMVariantMapMap &connection, const QString &interfaceUni, const QString &connectionParameter)
1038{
1039 return globalNetworkManager->addAndActivateConnection(connection, interfaceUni, connectionParameter);
1040}
1041
1042QDBusPendingReply<QDBusObjectPath, QDBusObjectPath, QVariantMap> NetworkManager::addAndActivateConnection2(const NMVariantMapMap &connection,
1043 const QString &interfaceUni,
1044 const QString &connectionParameter,
1045 const QVariantMap &options)
1046{
1047 if (checkVersion(x: 1, y: 16, z: 0)) {
1048 return globalNetworkManager->addAndActivateConnection2(connection, interfaceUni, connectionParameter, options);
1049 } else {
1050 return globalNetworkManager->addAndActivateConnection(connection, interfaceUni, connectionParameter);
1051 }
1052}
1053
1054QDBusPendingReply<QDBusObjectPath>
1055NetworkManager::activateConnection(const QString &connectionUni, const QString &interfaceUni, const QString &connectionParameter)
1056{
1057 return globalNetworkManager->activateConnection(connectionUni, interfaceUni, connectionParameter);
1058}
1059
1060QDBusPendingReply<> NetworkManager::deactivateConnection(const QString &activeConnectionPath)
1061{
1062 return globalNetworkManager->deactivateConnection(activeConnectionPath);
1063}
1064
1065QDBusPendingReply<QString, QString> NetworkManager::getLogging()
1066{
1067 return globalNetworkManager->getLogging();
1068}
1069
1070void NetworkManager::setNetworkingEnabled(bool enabled)
1071{
1072 globalNetworkManager->setNetworkingEnabled(enabled);
1073}
1074
1075void NetworkManager::setWirelessEnabled(bool enabled)
1076{
1077 globalNetworkManager->setWirelessEnabled(enabled);
1078}
1079
1080bool NetworkManager::isWwanEnabled()
1081{
1082 return globalNetworkManager->isWwanEnabled();
1083}
1084
1085bool NetworkManager::isWwanHardwareEnabled()
1086{
1087 return globalNetworkManager->isWwanHardwareEnabled();
1088}
1089
1090void NetworkManager::setWwanEnabled(bool enabled)
1091{
1092 globalNetworkManager->setWwanEnabled(enabled);
1093}
1094
1095bool NetworkManager::isWimaxEnabled()
1096{
1097 return globalNetworkManager->isWimaxEnabled();
1098}
1099
1100bool NetworkManager::isWimaxHardwareEnabled()
1101{
1102 return globalNetworkManager->isWimaxHardwareEnabled();
1103}
1104
1105void NetworkManager::setWimaxEnabled(bool enabled)
1106{
1107 globalNetworkManager->setWimaxEnabled(enabled);
1108}
1109
1110void NetworkManager::sleep(bool sleep)
1111{
1112 globalNetworkManager->sleep(sleep);
1113}
1114
1115void NetworkManager::setLogging(NetworkManager::LogLevel level, NetworkManager::LogDomains domains)
1116{
1117 globalNetworkManager->setLogging(level, domains);
1118}
1119
1120NMStringMap NetworkManager::permissions()
1121{
1122 return globalNetworkManager->permissions();
1123}
1124
1125NetworkManager::Device::Types NetworkManager::supportedInterfaceTypes()
1126{
1127 return globalNetworkManager->supportedInterfaceTypes();
1128}
1129
1130NetworkManager::Connectivity NetworkManager::connectivity()
1131{
1132 return globalNetworkManager->connectivity();
1133}
1134
1135QDBusPendingReply<uint> NetworkManager::checkConnectivity()
1136{
1137 return globalNetworkManager->checkConnectivity();
1138}
1139
1140NetworkManager::ActiveConnection::Ptr NetworkManager::primaryConnection()
1141{
1142 return globalNetworkManager->primaryConnection();
1143}
1144
1145NetworkManager::ActiveConnection::Ptr NetworkManager::activatingConnection()
1146{
1147 return globalNetworkManager->activatingConnection();
1148}
1149
1150NetworkManager::ConnectionSettings::ConnectionType NetworkManager::primaryConnectionType()
1151{
1152 return globalNetworkManager->primaryConnectionType();
1153}
1154
1155bool NetworkManager::isStartingUp()
1156{
1157 return globalNetworkManager->isStartingUp();
1158}
1159
1160NetworkManager::Device::MeteredStatus NetworkManager::metered()
1161{
1162 return globalNetworkManager->metered();
1163}
1164
1165NetworkManager::DnsConfiguration NetworkManager::globalDnsConfiguration()
1166{
1167 return globalNetworkManager->globalDnsConfiguration();
1168}
1169
1170void NetworkManager::setGlobalDnsConfiguration(const NetworkManager::DnsConfiguration &configuration)
1171{
1172 globalNetworkManager->setGlobalDnsConfiguration(configuration);
1173}
1174
1175NetworkManager::Notifier *NetworkManager::notifier()
1176{
1177 return globalNetworkManager;
1178}
1179
1180#include "moc_manager.cpp"
1181#include "moc_manager_p.cpp"
1182

source code of networkmanager-qt/src/manager.cpp