NetworkManagerQt

connectionsettings.cpp
1/*
2 SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
3 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com>
4 SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#include "connectionsettings.h"
10#include "connectionsettings_p.h"
11
12#include "adslsetting.h"
13#include "bluetoothsetting.h"
14#include "bondsetting.h"
15#include "bridgeportsetting.h"
16#include "bridgesetting.h"
17#include "cdmasetting.h"
18#include "gsmsetting.h"
19#include "infinibandsetting.h"
20#include "iptunnelsetting.h"
21#include "ipv4setting.h"
22#include "ipv6setting.h"
23#include "olpcmeshsetting.h"
24#include "pppoesetting.h"
25#include "pppsetting.h"
26#include "security8021xsetting.h"
27#include "serialsetting.h"
28#include "tunsetting.h"
29#include "vlansetting.h"
30#include "vpnsetting.h"
31#include "wimaxsetting.h"
32#include "wiredsetting.h"
33#include "wireguardsetting.h"
34#include "wirelesssecuritysetting.h"
35#include "wirelesssetting.h"
36
37#undef signals
38
39#if !NM_CHECK_VERSION(1, 6, 0)
40#define NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES "autoconnect-retries"
41#endif
42
43#if !NM_CHECK_VERSION(1, 12, 0)
44#define NM_SETTING_CONNECTION_MDNS "mdns"
45#endif
46
47#if !NM_CHECK_VERSION(1, 16, 0)
48#define NM_SETTING_WIREGUARD_SETTING_NAME "wireguard"
49#endif
50
51#if !NM_CHECK_VERSION(1, 42, 0)
52#define NM_SETTING_LOOPBACK_SETTING_NAME "loopback"
53#endif
54
55#include "genericsetting.h"
56#include "teamsetting.h"
57
58#include <QUuid>
59
60namespace NetworkManager
61{
62extern bool checkVersion(const int x, const int y, const int z);
63}
64
65NetworkManager::ConnectionSettingsPrivate::ConnectionSettingsPrivate(ConnectionSettings *q)
66 : name(NM_SETTING_CONNECTION_SETTING_NAME)
67 , uuid(QUuid().toString())
68 , type(ConnectionSettings::Wired)
69 , autoconnect(true)
70 , readOnly(false)
71 , gatewayPingTimeout(0)
72 , autoconnectPriority(0)
73 , autoconnectRetries(-1)
74 , autoconnectSlaves(ConnectionSettings::SlavesDefault)
75 , lldp(ConnectionSettings::LldpDefault)
76 , metered(ConnectionSettings::MeteredUnknown)
77 , mdns(ConnectionSettings::MdnsDefault)
78 , q_ptr(q)
79{
80}
81
82void NetworkManager::ConnectionSettingsPrivate::addSetting(const NetworkManager::Setting::Ptr &setting)
83{
84 settings.push_back(setting);
85}
86
87void NetworkManager::ConnectionSettingsPrivate::clearSettings()
88{
89 settings.clear();
90}
91
92void NetworkManager::ConnectionSettingsPrivate::initSettings(NMBluetoothCapabilities bt_cap)
93{
94 clearSettings();
95
96 switch (type) {
97 case ConnectionSettings::Adsl:
98 addSetting(Setting::Ptr(new AdslSetting()));
99 addSetting(Setting::Ptr(new Ipv4Setting()));
100 addSetting(Setting::Ptr(new Ipv6Setting()));
101 break;
102 case ConnectionSettings::Bond:
103 addSetting(Setting::Ptr(new BondSetting()));
104 addSetting(Setting::Ptr(new Ipv4Setting()));
105 addSetting(Setting::Ptr(new Ipv6Setting()));
106 break;
107 case ConnectionSettings::Bluetooth:
108 addSetting(Setting::Ptr(new BluetoothSetting()));
109 addSetting(Setting::Ptr(new Ipv4Setting()));
110 // addSetting(Setting::Ptr(new Ipv6Setting()));
111 if (bt_cap == NM_BT_CAPABILITY_DUN) {
112 addSetting(Setting::Ptr(new GsmSetting()));
113 addSetting(Setting::Ptr(new PppSetting()));
114 addSetting(Setting::Ptr(new SerialSetting()));
115 }
116 break;
117 case ConnectionSettings::Bridge:
118 addSetting(Setting::Ptr(new BridgeSetting()));
119 addSetting(Setting::Ptr(new Ipv4Setting()));
120 addSetting(Setting::Ptr(new Ipv6Setting()));
121 break;
122 case ConnectionSettings::Cdma:
123 addSetting(Setting::Ptr(new CdmaSetting()));
124 addSetting(Setting::Ptr(new Ipv4Setting()));
125 if (NetworkManager::checkVersion(1, 0, 0)) {
126 addSetting(Setting::Ptr(new Ipv6Setting()));
127 }
128 addSetting(Setting::Ptr(new PppSetting()));
129 break;
130 case ConnectionSettings::Gsm:
131 addSetting(Setting::Ptr(new GsmSetting()));
132 addSetting(Setting::Ptr(new Ipv4Setting()));
133 if (NetworkManager::checkVersion(1, 0, 0)) {
134 addSetting(Setting::Ptr(new Ipv6Setting()));
135 }
136 addSetting(Setting::Ptr(new PppSetting()));
137 break;
138 case ConnectionSettings::Infiniband:
139 addSetting(Setting::Ptr(new InfinibandSetting()));
140 addSetting(Setting::Ptr(new Ipv4Setting()));
141 addSetting(Setting::Ptr(new Ipv6Setting()));
142 break;
143 case ConnectionSettings::OLPCMesh:
144 addSetting(Setting::Ptr(new Ipv4Setting()));
145 addSetting(Setting::Ptr(new Ipv6Setting()));
146 addSetting(Setting::Ptr(new OlpcMeshSetting()));
147 break;
148 case ConnectionSettings::Pppoe:
149 addSetting(Setting::Ptr(new Ipv4Setting()));
150 // addSetting(new Ipv6Setting()));
151 addSetting(Setting::Ptr(new PppSetting()));
152 addSetting(Setting::Ptr(new PppoeSetting()));
153 addSetting(Setting::Ptr(new WiredSetting()));
154 break;
155 case ConnectionSettings::Vlan:
156 addSetting(Setting::Ptr(new Ipv4Setting()));
157 addSetting(Setting::Ptr(new Ipv6Setting()));
158 addSetting(Setting::Ptr(new VlanSetting()));
159 break;
160 case ConnectionSettings::Vpn:
161 addSetting(Setting::Ptr(new Ipv4Setting()));
162 addSetting(Setting::Ptr(new Ipv6Setting()));
163 addSetting(Setting::Ptr(new VpnSetting()));
164 break;
165 case ConnectionSettings::Wimax:
166 addSetting(Setting::Ptr(new Ipv4Setting()));
167 addSetting(Setting::Ptr(new Ipv6Setting()));
168 addSetting(Setting::Ptr(new WimaxSetting()));
169 break;
170 case ConnectionSettings::Wired:
171 addSetting(Setting::Ptr(new Ipv4Setting()));
172 addSetting(Setting::Ptr(new Ipv6Setting()));
173 addSetting(Setting::Ptr(new Security8021xSetting()));
174 addSetting(Setting::Ptr(new WiredSetting()));
175 break;
176 case ConnectionSettings::Wireless:
177 addSetting(Setting::Ptr(new Ipv4Setting()));
178 addSetting(Setting::Ptr(new Ipv6Setting()));
179 addSetting(Setting::Ptr(new Security8021xSetting()));
180 addSetting(Setting::Ptr(new WirelessSetting()));
181 addSetting(Setting::Ptr(new WirelessSecuritySetting()));
182 break;
183 case ConnectionSettings::Team:
184 addSetting(Setting::Ptr(new TeamSetting()));
185 addSetting(Setting::Ptr(new Ipv4Setting()));
186 addSetting(Setting::Ptr(new Ipv6Setting()));
187 break;
188 case ConnectionSettings::Generic:
189 addSetting(Setting::Ptr(new GenericSetting()));
190 addSetting(Setting::Ptr(new Ipv4Setting()));
191 addSetting(Setting::Ptr(new Ipv6Setting()));
192 break;
193 case ConnectionSettings::Tun:
194 addSetting(Setting::Ptr(new TunSetting()));
195 addSetting(Setting::Ptr(new Ipv4Setting()));
196 addSetting(Setting::Ptr(new Ipv6Setting()));
197 break;
198 case ConnectionSettings::IpTunnel:
199 addSetting(Setting::Ptr(new IpTunnelSetting()));
200 addSetting(Setting::Ptr(new Ipv4Setting()));
201 addSetting(Setting::Ptr(new Ipv6Setting()));
202 break;
203 case ConnectionSettings::WireGuard:
204 addSetting(Setting::Ptr(new WireGuardSetting()));
205 addSetting(Setting::Ptr(new Ipv4Setting()));
206 addSetting(Setting::Ptr(new Ipv6Setting()));
207 break;
208 case ConnectionSettings::Loopback:
209 addSetting(Setting::Ptr(new Ipv4Setting()));
210 addSetting(Setting::Ptr(new Ipv6Setting()));
211 case ConnectionSettings::Unknown:
212 default:
213 break;
214 }
215}
216
217void NetworkManager::ConnectionSettingsPrivate::initSettings(const NetworkManager::ConnectionSettings::Ptr &connectionSettings)
218{
219 Q_Q(ConnectionSettings);
220
221 clearSettings();
222
223 switch (type) {
224 case ConnectionSettings::Adsl:
225 addSetting(connectionSettings->setting(Setting::Adsl));
226 addSetting(connectionSettings->setting(Setting::Ipv4));
227 addSetting(connectionSettings->setting(Setting::Ipv6));
228 break;
229 case ConnectionSettings::Bond:
230 addSetting(connectionSettings->setting(Setting::Bond));
231 addSetting(connectionSettings->setting(Setting::Ipv4));
232 addSetting(connectionSettings->setting(Setting::Ipv6));
233 break;
234 case ConnectionSettings::Bluetooth:
235 addSetting(connectionSettings->setting(Setting::Bluetooth));
236 addSetting(connectionSettings->setting(Setting::Ipv4));
237 if (NetworkManager::checkVersion(1, 0, 0)) {
238 addSetting(connectionSettings->setting(Setting::Ipv6));
239 }
240 if (q->setting(Setting::Gsm) && q->setting(Setting::Ppp) && q->setting(Setting::Serial)) {
241 addSetting(connectionSettings->setting(Setting::Gsm));
242 addSetting(connectionSettings->setting(Setting::Ppp));
243 addSetting(connectionSettings->setting(Setting::Serial));
244 }
245 break;
246 case ConnectionSettings::Bridge:
247 addSetting(connectionSettings->setting(Setting::Bridge));
248 addSetting(connectionSettings->setting(Setting::Ipv4));
249 addSetting(connectionSettings->setting(Setting::Ipv6));
250 break;
251 case ConnectionSettings::Cdma:
252 addSetting(connectionSettings->setting(Setting::Cdma));
253 addSetting(connectionSettings->setting(Setting::Ipv4));
254 if (NetworkManager::checkVersion(1, 0, 0)) {
255 addSetting(connectionSettings->setting(Setting::Ipv6));
256 }
257 addSetting(connectionSettings->setting(Setting::Ppp));
258 break;
259 case ConnectionSettings::Gsm:
260 addSetting(connectionSettings->setting(Setting::Gsm));
261 addSetting(connectionSettings->setting(Setting::Ipv4));
262 if (NetworkManager::checkVersion(1, 0, 0)) {
263 addSetting(connectionSettings->setting(Setting::Ipv6));
264 }
265 addSetting(connectionSettings->setting(Setting::Ppp));
266 break;
267 case ConnectionSettings::Infiniband:
268 addSetting(connectionSettings->setting(Setting::Infiniband));
269 addSetting(connectionSettings->setting(Setting::Ipv4));
270 addSetting(connectionSettings->setting(Setting::Ipv6));
271 break;
272 case ConnectionSettings::OLPCMesh:
273 addSetting(connectionSettings->setting(Setting::Ipv4));
274 addSetting(connectionSettings->setting(Setting::Ipv6));
275 addSetting(connectionSettings->setting(Setting::OlpcMesh));
276 break;
277 case ConnectionSettings::Pppoe:
278 addSetting(connectionSettings->setting(Setting::Ipv4));
279 // addSetting(Ipv6Setting(connectionSettings->setting(Setting::Ipv6));
280 addSetting(connectionSettings->setting(Setting::Ppp));
281 addSetting(connectionSettings->setting(Setting::Pppoe));
282 addSetting(connectionSettings->setting(Setting::Wired));
283 break;
284 case ConnectionSettings::Vlan:
285 addSetting(connectionSettings->setting(Setting::Ipv4));
286 addSetting(connectionSettings->setting(Setting::Ipv6));
287 addSetting(connectionSettings->setting(Setting::Vlan));
288 break;
289 case ConnectionSettings::Vpn:
290 addSetting(connectionSettings->setting(Setting::Ipv4));
291 addSetting(connectionSettings->setting(Setting::Ipv6));
292 addSetting(connectionSettings->setting(Setting::Vpn));
293 break;
294 case ConnectionSettings::Wimax:
295 addSetting(connectionSettings->setting(Setting::Ipv4));
296 addSetting(connectionSettings->setting(Setting::Ipv6));
297 addSetting(connectionSettings->setting(Setting::Wimax));
298 break;
299 case ConnectionSettings::Wired:
300 addSetting(connectionSettings->setting(Setting::Ipv4));
301 addSetting(connectionSettings->setting(Setting::Ipv6));
302 addSetting(connectionSettings->setting(Setting::Security8021x));
303 addSetting(connectionSettings->setting(Setting::Wired));
304 break;
305 case ConnectionSettings::Wireless:
306 addSetting(connectionSettings->setting(Setting::Ipv4));
307 addSetting(connectionSettings->setting(Setting::Ipv6));
308 addSetting(connectionSettings->setting(Setting::Security8021x));
309 addSetting(connectionSettings->setting(Setting::Wireless));
310 addSetting(connectionSettings->setting(Setting::WirelessSecurity));
311 break;
312 case ConnectionSettings::Team:
313 addSetting(connectionSettings->setting(Setting::Team));
314 addSetting(connectionSettings->setting(Setting::Ipv4));
315 addSetting(connectionSettings->setting(Setting::Ipv6));
316 break;
317 case ConnectionSettings::Generic:
318 addSetting(connectionSettings->setting(Setting::Generic));
319 addSetting(connectionSettings->setting(Setting::Ipv4));
320 addSetting(connectionSettings->setting(Setting::Ipv6));
321 break;
322 case ConnectionSettings::Tun:
323 addSetting(connectionSettings->setting(Setting::Tun));
324 addSetting(connectionSettings->setting(Setting::Ipv4));
325 addSetting(connectionSettings->setting(Setting::Ipv6));
326 break;
327 case ConnectionSettings::IpTunnel:
328 addSetting(connectionSettings->setting(Setting::IpTunnel));
329 addSetting(connectionSettings->setting(Setting::Ipv4));
330 addSetting(connectionSettings->setting(Setting::Ipv6));
331 break;
332 case ConnectionSettings::WireGuard:
333 addSetting(connectionSettings->setting(Setting::WireGuard));
334 addSetting(connectionSettings->setting(Setting::Ipv4));
335 addSetting(connectionSettings->setting(Setting::Ipv6));
336 break;
337 case ConnectionSettings::Loopback:
338 addSetting(connectionSettings->setting(Setting::Ipv4));
339 addSetting(connectionSettings->setting(Setting::Ipv6));
340 break;
341 case ConnectionSettings::Unknown:
342 default:
343 break;
344 }
345}
346
347NetworkManager::ConnectionSettings::ConnectionType NetworkManager::ConnectionSettings::typeFromString(const QString &typeString)
348{
349 ConnectionSettings::ConnectionType type = Wired;
350
351 if (typeString == QLatin1String(NM_SETTING_ADSL_SETTING_NAME)) {
352 type = Adsl;
353 } else if (typeString == QLatin1String(NM_SETTING_BLUETOOTH_SETTING_NAME)) {
354 type = Bluetooth;
355 } else if (typeString == QLatin1String(NM_SETTING_BOND_SETTING_NAME)) {
356 type = Bond;
357 } else if (typeString == QLatin1String(NM_SETTING_BRIDGE_SETTING_NAME)) {
358 type = Bridge;
359 } else if (typeString == QLatin1String(NM_SETTING_CDMA_SETTING_NAME)) {
360 type = Cdma;
361 } else if (typeString == QLatin1String(NM_SETTING_GSM_SETTING_NAME)) {
362 type = Gsm;
363 } else if (typeString == QLatin1String(NM_SETTING_INFINIBAND_SETTING_NAME)) {
364 type = Infiniband;
365 } else if (typeString == QLatin1String(NM_SETTING_OLPC_MESH_SETTING_NAME)) {
366 type = OLPCMesh;
367 } else if (typeString == QLatin1String(NM_SETTING_PPPOE_SETTING_NAME)) {
368 type = Pppoe;
369 } else if (typeString == QLatin1String(NM_SETTING_VLAN_SETTING_NAME)) {
370 type = Vlan;
371 } else if (typeString == QLatin1String(NM_SETTING_VPN_SETTING_NAME)) {
372 type = Vpn;
373 } else if (typeString == QLatin1String(NM_SETTING_WIMAX_SETTING_NAME)) {
374 type = Wimax;
375 } else if (typeString == QLatin1String(NM_SETTING_WIRED_SETTING_NAME)) {
376 type = Wired;
377 } else if (typeString == QLatin1String(NM_SETTING_WIRELESS_SETTING_NAME)) {
378 type = Wireless;
379 } else if (typeString == QLatin1String(NM_SETTING_TEAM_SETTING_NAME)) {
380 type = Team;
381 } else if (typeString == QLatin1String(NM_SETTING_GENERIC_SETTING_NAME)) {
382 type = Generic;
383 } else if (typeString == QLatin1String(NM_SETTING_TUN_SETTING_NAME)) {
384 type = Tun;
385 } else if (typeString == QLatin1String(NM_SETTING_IP_TUNNEL_SETTING_NAME)) {
386 type = IpTunnel;
387 } else if (typeString == QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME)) {
388 type = WireGuard;
389 } else if (typeString == QLatin1String(NM_SETTING_LOOPBACK_SETTING_NAME)) {
390 type = Loopback;
391 }
392
393 return type;
394}
395
396QString NetworkManager::ConnectionSettings::typeAsString(NetworkManager::ConnectionSettings::ConnectionType type)
397{
398 QString typeString;
399
400 switch (type) {
401 case Adsl:
402 typeString = QLatin1String(NM_SETTING_ADSL_SETTING_NAME);
403 break;
404 case Bond:
405 typeString = QLatin1String(NM_SETTING_BOND_SETTING_NAME);
406 break;
407 case Bluetooth:
408 typeString = QLatin1String(NM_SETTING_BLUETOOTH_SETTING_NAME);
409 break;
410 case Bridge:
411 typeString = QLatin1String(NM_SETTING_BRIDGE_SETTING_NAME);
412 break;
413 case Cdma:
414 typeString = QLatin1String(NM_SETTING_CDMA_SETTING_NAME);
415 break;
416 case Gsm:
417 typeString = QLatin1String(NM_SETTING_GSM_SETTING_NAME);
418 break;
419 case Infiniband:
420 typeString = QLatin1String(NM_SETTING_INFINIBAND_SETTING_NAME);
421 break;
422 case OLPCMesh:
423 typeString = QLatin1String(NM_SETTING_OLPC_MESH_SETTING_NAME);
424 break;
425 case Pppoe:
426 typeString = QLatin1String(NM_SETTING_PPPOE_SETTING_NAME);
427 break;
428 case Vlan:
429 typeString = QLatin1String(NM_SETTING_VLAN_SETTING_NAME);
430 break;
431 case Vpn:
432 typeString = QLatin1String(NM_SETTING_VPN_SETTING_NAME);
433 break;
434 case Wimax:
435 typeString = QLatin1String(NM_SETTING_WIMAX_SETTING_NAME);
436 break;
437 case Wired:
438 typeString = QLatin1String(NM_SETTING_WIRED_SETTING_NAME);
439 break;
440 case Wireless:
441 typeString = QLatin1String(NM_SETTING_WIRELESS_SETTING_NAME);
442 break;
443 case Team:
444 typeString = QLatin1String(NM_SETTING_TEAM_SETTING_NAME);
445 break;
446 case Generic:
447 typeString = QLatin1String(NM_SETTING_GENERIC_SETTING_NAME);
448 break;
449 case Tun:
450 typeString = QLatin1String(NM_SETTING_TUN_SETTING_NAME);
451 break;
452 case IpTunnel:
453 typeString = QLatin1String(NM_SETTING_IP_TUNNEL_SETTING_NAME);
454 break;
455 case WireGuard:
456 typeString = QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME);
457 break;
458 case Loopback:
459 typeString = QLatin1String(NM_SETTING_LOOPBACK_SETTING_NAME);
460 break;
461 default:
462 break;
463 };
464
465 return typeString;
466}
467
468QString NetworkManager::ConnectionSettings::createNewUuid()
469{
470 return QUuid::createUuid().toString().mid(1, QUuid::createUuid().toString().length() - 2);
471}
472
473NetworkManager::ConnectionSettings::ConnectionSettings()
474 : d_ptr(new ConnectionSettingsPrivate(this))
475{
476}
477
478NetworkManager::ConnectionSettings::ConnectionSettings(NetworkManager::ConnectionSettings::ConnectionType type, NMBluetoothCapabilities bt_cap)
479 : d_ptr(new ConnectionSettingsPrivate(this))
480{
481 setConnectionType(type, bt_cap);
482}
483
484NetworkManager::ConnectionSettings::ConnectionSettings(const NetworkManager::ConnectionSettings::Ptr &other)
485 : d_ptr(new ConnectionSettingsPrivate(this))
486{
487 Q_D(ConnectionSettings);
488
489 setId(other->id());
490 setUuid(other->uuid());
491 setInterfaceName(other->interfaceName());
492 setConnectionType(other->connectionType());
493 setPermissions(other->permissions());
494 setAutoconnect(other->autoconnect());
495 setAutoconnectPriority(other->autoconnectPriority());
496 setTimestamp(other->timestamp());
497 setReadOnly(other->readOnly());
498 setZone(other->zone());
499 setMaster(other->master());
500 setSlaveType(other->slaveType());
501 setGatewayPingTimeout(other->gatewayPingTimeout());
502 setAutoconnectRetries(other->autoconnectRetries());
503 setAutoconnectSlaves(other->autoconnectSlaves());
504 setLldp(other->lldp());
505 setMetered(other->metered());
506 setMdns(other->mdns());
507 setStableId(other->stableId());
508
509 d->initSettings(other);
510}
511
512NetworkManager::ConnectionSettings::ConnectionSettings(const NMVariantMapMap &map)
513 : d_ptr(new ConnectionSettingsPrivate(this))
514{
515 fromMap(map);
516}
517
518NetworkManager::ConnectionSettings::~ConnectionSettings()
519{
520 d_ptr->clearSettings();
521
522 delete d_ptr;
523}
524
525void NetworkManager::ConnectionSettings::fromMap(const NMVariantMapMap &map)
526{
527 QVariantMap connectionSettings = map.value(QLatin1String(NM_SETTING_CONNECTION_SETTING_NAME));
528
529 setId(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_ID)).toString());
530 setUuid(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_UUID)).toString());
531 setConnectionType(typeFromString(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_TYPE)).toString()));
532
533 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_INTERFACE_NAME))) {
534 setInterfaceName(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_INTERFACE_NAME)).toString());
535 }
536 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_PERMISSIONS))) {
537 const QStringList permissions = connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_PERMISSIONS)).toStringList();
538 for (const QString &permission : permissions) {
539 const QStringList split = permission.split(QLatin1Char(':'), Qt::KeepEmptyParts);
540 addToPermissions(split.at(1), split.at(2));
541 }
542 }
543
544 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT))) {
545 setAutoconnect(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT)).toBool());
546 }
547
548 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY))) {
549 setAutoconnectPriority(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY)).toInt());
550 }
551
552 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_TIMESTAMP))) {
553 const int timestamp = connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_TIMESTAMP)).toInt();
554 setTimestamp(QDateTime::fromSecsSinceEpoch(timestamp));
555 }
556
557 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_READ_ONLY))) {
558 setReadOnly(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_READ_ONLY)).toBool());
559 }
560
561 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_ZONE))) {
562 setZone(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_ZONE)).toString());
563 }
564
565 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_MASTER))) {
566 setMaster(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_MASTER)).toString());
567 }
568
569 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_SLAVE_TYPE))) {
570 setSlaveType(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_SLAVE_TYPE)).toString());
571 }
572
573 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_SECONDARIES))) {
574 setSecondaries(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_SECONDARIES)).toStringList());
575 }
576
577 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT))) {
578 setGatewayPingTimeout(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT)).toUInt());
579 }
580
581 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES))) {
582 setAutoconnectRetries(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES)).toInt());
583 }
584
585 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES))) {
586 setAutoconnectSlaves(
587 (NetworkManager::ConnectionSettings::AutoconnectSlaves)connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES)).toInt());
588 }
589
590 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_LLDP))) {
591 setLldp((NetworkManager::ConnectionSettings::Lldp)connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_LLDP)).toInt());
592 }
593
594 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_METERED))) {
595 setMetered((NetworkManager::ConnectionSettings::Metered)connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_METERED)).toInt());
596 }
597
598 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_MDNS))) {
599 setMdns((NetworkManager::ConnectionSettings::Mdns)connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_MDNS)).toInt());
600 }
601
602 if (connectionSettings.contains(QLatin1String(NM_SETTING_CONNECTION_STABLE_ID))) {
603 setStableId(connectionSettings.value(QLatin1String(NM_SETTING_CONNECTION_STABLE_ID)).toString());
604 }
605
606 const auto settingsList = settings();
607 for (const Setting::Ptr &setting : settingsList) {
608 if (map.contains(setting->name())) {
609 setting->fromMap(map.value(setting->name()));
610 setting->setInitialized(true);
611 } else {
612 setting->setInitialized(false);
613 }
614 }
615}
616
617static struct {
618 const char *name;
619 NetworkManager::Security8021xSetting::EapMethod method;
620} constexpr const eap_methods[] = {
621 {"PEAP", NetworkManager::Security8021xSetting::EapMethodPeap},
622 {"PWD", NetworkManager::Security8021xSetting::EapMethodPwd},
623 {"TLS", NetworkManager::Security8021xSetting::EapMethodTls},
624 {"TTLS", NetworkManager::Security8021xSetting::EapMethodTtls},
625};
626
627static struct {
628 const char *name;
629 NetworkManager::Security8021xSetting::AuthMethod method;
630} constexpr const auth_methods[] = {
631 {"GTC", NetworkManager::Security8021xSetting::AuthMethodGtc},
632 {"MSCHAP", NetworkManager::Security8021xSetting::AuthMethodMschap},
633 {"MSCHAPV2", NetworkManager::Security8021xSetting::AuthMethodMschapv2},
634 {"PAP", NetworkManager::Security8021xSetting::AuthMethodPap},
635};
636
637void NetworkManager::ConnectionSettings::fromMeCard(const QVariantMap &map)
638{
639 const auto ssid = map.value(QLatin1String("S")).toString();
640 setId(ssid);
641
642 auto wifiSetting = setting(Setting::Wireless).dynamicCast<WirelessSetting>();
643 wifiSetting->setInitialized(true);
644 wifiSetting->setSsid(ssid.toUtf8());
645
646 auto wifiSecurity = setting(Setting::WirelessSecurity).dynamicCast<WirelessSecuritySetting>();
647 const auto securityType = map.value(QLatin1String("T")).toString();
648
649 if (!securityType.isEmpty() && securityType != QLatin1String("nopass")) {
650 wifiSecurity->setInitialized(true);
651 }
652
653 if (securityType == QLatin1String("WPA") || securityType == QLatin1String("WEP")) {
654 wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaPsk);
655 wifiSecurity->setPsk(map.value(QLatin1String("P")).toString());
656 wifiSecurity->setPskFlags(NetworkManager::Setting::AgentOwned);
657 } else if (securityType == QLatin1String("SAE")) {
658 wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::SAE);
659 wifiSecurity->setPsk(map.value(QLatin1String("P")).toString());
660 wifiSecurity->setPskFlags(NetworkManager::Setting::AgentOwned);
661 } else if (securityType == QLatin1String("WPA2-EAP")) {
662 wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaEap);
663 auto sec8021x = setting(Setting::Security8021x).dynamicCast<Security8021xSetting>();
664 sec8021x->setAnonymousIdentity(map.value(QLatin1String("A")).toString());
665 sec8021x->setIdentity(map.value(QLatin1String("I")).toString());
666 sec8021x->setPassword(map.value(QLatin1String("P")).toString());
667
668 const auto eapMethod = map.value(QLatin1String("E")).toString();
669 for (const auto &method : eap_methods) {
670 if (eapMethod == QLatin1String(method.name)) {
671 sec8021x->setEapMethods({method.method});
672 break;
673 }
674 }
675 const auto phase2AuthMethod = map.value(QLatin1String("PH2")).toString();
676 for (const auto &method : auth_methods) {
677 if (phase2AuthMethod == QLatin1String(method.name)) {
678 sec8021x->setPhase2AuthMethod(method.method);
679 break;
680 }
681 }
682 }
683}
684
685NMVariantMapMap NetworkManager::ConnectionSettings::toMap() const
686{
687 NMVariantMapMap result;
688 QVariantMap connectionSetting;
689
690 if (!id().isEmpty()) {
691 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_ID), id());
692 }
693
694 if (!uuid().isEmpty()) {
695 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_UUID), uuid());
696 }
697
698 if (connectionType()) {
699 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_TYPE), typeAsString(connectionType()));
700 }
701
702 if (!interfaceName().isEmpty()) {
703 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_INTERFACE_NAME), interfaceName());
704 }
705
706 if (!permissions().isEmpty()) {
707 QStringList perm;
708 QHash<QString, QString> perms = permissions();
710 while (it != perms.constEnd()) {
711 const QString tmp = "user:" + it.key() + ':' + it.value();
712 perm << tmp;
713 ++it;
714 }
715
716 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_PERMISSIONS), perm);
717 }
718
719 if (!autoconnect()) {
720 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT), autoconnect());
721 }
722
723 if (autoconnectPriority()) {
724 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY), autoconnectPriority());
725 }
726
727 if (timestamp().isValid()) {
728 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_TIMESTAMP), timestamp().toSecsSinceEpoch());
729 }
730
731 if (readOnly()) {
732 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_READ_ONLY), readOnly());
733 }
734
735 if (!zone().isEmpty()) {
736 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_ZONE), zone());
737 }
738
739 if (!master().isEmpty()) {
740 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_MASTER), master());
741 }
742
743 if (!slaveType().isEmpty()) {
744 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_SLAVE_TYPE), slaveType());
745 }
746
747 if (!secondaries().isEmpty()) {
748 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_SECONDARIES), secondaries());
749 }
750
751 if (gatewayPingTimeout()) {
752 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT), gatewayPingTimeout());
753 }
754
755 if (autoconnectRetries() >= 0) {
756 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES), autoconnectRetries());
757 }
758
759 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES), autoconnectSlaves());
760 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_LLDP), lldp());
761 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_METERED), metered());
762
763 if (mdns() != MdnsDefault) {
764 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_MDNS), mdns());
765 }
766
767 if (!stableId().isEmpty()) {
768 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_STABLE_ID), stableId());
769 }
770
771 result.insert(QLatin1String(NM_SETTING_CONNECTION_SETTING_NAME), connectionSetting);
772
773 const auto settingsList = settings();
774 for (const Setting::Ptr &setting : settingsList) {
775 QVariantMap map = setting->toMap();
776 if (!setting->isNull()) {
777 result.insert(setting->name(), map);
778 }
779 }
780 return result;
781}
782
783QString NetworkManager::ConnectionSettings::name() const
784{
785 Q_D(const ConnectionSettings);
786
787 return d->name;
788}
789
790void NetworkManager::ConnectionSettings::setId(const QString &id)
791{
792 Q_D(ConnectionSettings);
793
794 d->id = id;
795}
796
797QString NetworkManager::ConnectionSettings::id() const
798{
799 Q_D(const ConnectionSettings);
800
801 return d->id;
802}
803
804void NetworkManager::ConnectionSettings::setUuid(const QString &uuid)
805{
806 Q_D(ConnectionSettings);
807
808 d->uuid = uuid;
809}
810
811QString NetworkManager::ConnectionSettings::uuid() const
812{
813 Q_D(const ConnectionSettings);
814
815 return d->uuid;
816}
817
818void NetworkManager::ConnectionSettings::setInterfaceName(const QString &interfaceName)
819{
820 Q_D(ConnectionSettings);
821
822 d->interfaceName = interfaceName;
823}
824
825QString NetworkManager::ConnectionSettings::interfaceName() const
826{
827 Q_D(const ConnectionSettings);
828
829 return d->interfaceName;
830}
831
832void NetworkManager::ConnectionSettings::setConnectionType(NetworkManager::ConnectionSettings::ConnectionType type, NMBluetoothCapabilities bt_cap)
833{
834 Q_D(ConnectionSettings);
835
836 d->type = type;
837 d->initSettings(bt_cap);
838}
839
840NetworkManager::ConnectionSettings::ConnectionType NetworkManager::ConnectionSettings::connectionType() const
841{
842 Q_D(const ConnectionSettings);
843
844 return d->type;
845}
846
847void NetworkManager::ConnectionSettings::addToPermissions(const QString &user, const QString &type)
848{
849 Q_D(ConnectionSettings);
850
851 d->permissions.insert(user, type);
852}
853
854void NetworkManager::ConnectionSettings::setPermissions(const QHash<QString, QString> &perm)
855{
856 Q_D(ConnectionSettings);
857
858 d->permissions = perm;
859}
860
861QHash<QString, QString> NetworkManager::ConnectionSettings::permissions() const
862{
863 Q_D(const ConnectionSettings);
864
865 return d->permissions;
866}
867
868void NetworkManager::ConnectionSettings::setAutoconnect(bool autoconnect)
869{
870 Q_D(ConnectionSettings);
871
872 d->autoconnect = autoconnect;
873}
874
875bool NetworkManager::ConnectionSettings::autoconnect() const
876{
877 Q_D(const ConnectionSettings);
878
879 return d->autoconnect;
880}
881
882void NetworkManager::ConnectionSettings::setAutoconnectPriority(int priority)
883{
884 Q_D(ConnectionSettings);
885
886 d->autoconnectPriority = priority;
887}
888
889int NetworkManager::ConnectionSettings::autoconnectPriority() const
890{
891 Q_D(const ConnectionSettings);
892
893 return d->autoconnectPriority;
894}
895
896void NetworkManager::ConnectionSettings::setTimestamp(const QDateTime &timestamp)
897{
898 Q_D(ConnectionSettings);
899
900 d->timestamp = timestamp;
901}
902
903QDateTime NetworkManager::ConnectionSettings::timestamp() const
904{
905 Q_D(const ConnectionSettings);
906
907 return d->timestamp;
908}
909
910void NetworkManager::ConnectionSettings::setReadOnly(bool readonly)
911{
912 Q_D(ConnectionSettings);
913
914 d->readOnly = readonly;
915}
916
917bool NetworkManager::ConnectionSettings::readOnly() const
918{
919 Q_D(const ConnectionSettings);
920
921 return d->readOnly;
922}
923
924void NetworkManager::ConnectionSettings::setZone(const QString &zone)
925{
926 Q_D(ConnectionSettings);
927
928 d->zone = zone;
929}
930
931QString NetworkManager::ConnectionSettings::zone() const
932{
933 Q_D(const ConnectionSettings);
934
935 return d->zone;
936}
937
938bool NetworkManager::ConnectionSettings::isSlave() const
939{
940 Q_D(const ConnectionSettings);
941
942 return !d->master.isEmpty() && !d->slaveType.isEmpty();
943}
944
945void NetworkManager::ConnectionSettings::setMaster(const QString &master)
946{
947 Q_D(ConnectionSettings);
948
949 d->master = master;
950}
951
952QString NetworkManager::ConnectionSettings::master() const
953{
954 Q_D(const ConnectionSettings);
955
956 return d->master;
957}
958
959void NetworkManager::ConnectionSettings::setSlaveType(const QString &type)
960{
961 Q_D(ConnectionSettings);
962
963 d->slaveType = type;
964}
965
966QString NetworkManager::ConnectionSettings::slaveType() const
967{
968 Q_D(const ConnectionSettings);
969
970 return d->slaveType;
971}
972
973void NetworkManager::ConnectionSettings::setSecondaries(const QStringList &secondaries)
974{
975 Q_D(ConnectionSettings);
976
977 d->secondaries = secondaries;
978}
979
980QStringList NetworkManager::ConnectionSettings::secondaries() const
981{
982 Q_D(const ConnectionSettings);
983
984 return d->secondaries;
985}
986
987void NetworkManager::ConnectionSettings::setGatewayPingTimeout(quint32 timeout)
988{
989 Q_D(ConnectionSettings);
990
991 d->gatewayPingTimeout = timeout;
992}
993
994quint32 NetworkManager::ConnectionSettings::gatewayPingTimeout() const
995{
996 Q_D(const ConnectionSettings);
997
998 return d->gatewayPingTimeout;
999}
1000
1001int NetworkManager::ConnectionSettings::autoconnectRetries() const
1002{
1003 Q_D(const ConnectionSettings);
1004
1005 return d->autoconnectRetries;
1006}
1007
1008void NetworkManager::ConnectionSettings::setAutoconnectRetries(int retries)
1009{
1010 Q_D(ConnectionSettings);
1011
1012 d->autoconnectRetries = retries;
1013}
1014
1015NetworkManager::ConnectionSettings::AutoconnectSlaves NetworkManager::ConnectionSettings::autoconnectSlaves() const
1016{
1017 Q_D(const ConnectionSettings);
1018
1019 return d->autoconnectSlaves;
1020}
1021
1022void NetworkManager::ConnectionSettings::setAutoconnectSlaves(NetworkManager::ConnectionSettings::AutoconnectSlaves autoconnectSlaves)
1023{
1024 Q_D(ConnectionSettings);
1025
1026 d->autoconnectSlaves = autoconnectSlaves;
1027}
1028
1029NetworkManager::ConnectionSettings::Lldp NetworkManager::ConnectionSettings::lldp() const
1030{
1031 Q_D(const ConnectionSettings);
1032
1033 return d->lldp;
1034}
1035
1036void NetworkManager::ConnectionSettings::setLldp(NetworkManager::ConnectionSettings::Lldp lldp)
1037{
1038 Q_D(ConnectionSettings);
1039
1040 d->lldp = lldp;
1041}
1042
1043NetworkManager::ConnectionSettings::Metered NetworkManager::ConnectionSettings::metered() const
1044{
1045 Q_D(const ConnectionSettings);
1046
1047 return d->metered;
1048}
1049
1050void NetworkManager::ConnectionSettings::setMetered(NetworkManager::ConnectionSettings::Metered metered)
1051{
1052 Q_D(ConnectionSettings);
1053
1054 d->metered = metered;
1055}
1056
1057NetworkManager::ConnectionSettings::Mdns NetworkManager::ConnectionSettings::mdns() const
1058{
1059 Q_D(const ConnectionSettings);
1060
1061 return d->mdns;
1062}
1063
1064void NetworkManager::ConnectionSettings::setMdns(NetworkManager::ConnectionSettings::Mdns mdns)
1065{
1066 Q_D(ConnectionSettings);
1067
1068 d->mdns = mdns;
1069}
1070
1071QString NetworkManager::ConnectionSettings::stableId() const
1072{
1073 Q_D(const ConnectionSettings);
1074
1075 return d->stableId;
1076}
1077
1078void NetworkManager::ConnectionSettings::setStableId(const QString &stableId)
1079{
1080 Q_D(ConnectionSettings);
1081
1082 d->stableId = stableId;
1083}
1084
1085NetworkManager::Setting::Ptr NetworkManager::ConnectionSettings::setting(Setting::SettingType type) const
1086{
1087 const auto settingsList = settings();
1088 for (const Setting::Ptr &setting : settingsList) {
1089 if (setting->type() == type) {
1090 return setting;
1091 }
1092 }
1093
1094 return Setting::Ptr();
1095}
1096
1097NetworkManager::Setting::Ptr NetworkManager::ConnectionSettings::setting(const QString &type) const
1098{
1099 return setting(Setting::typeFromString(type));
1100}
1101
1102NetworkManager::Setting::List NetworkManager::ConnectionSettings::settings() const
1103{
1104 Q_D(const ConnectionSettings);
1105
1106 return d->settings;
1107}
1108
1109QDebug NetworkManager::operator<<(QDebug dbg, const NetworkManager::ConnectionSettings &setting)
1110{
1111 dbg.nospace() << "CONNECTION SETTINGS\n";
1112 dbg.nospace() << "===================\n";
1113
1114 dbg.nospace() << NM_SETTING_CONNECTION_ID << ": " << setting.id() << '\n';
1115 dbg.nospace() << NM_SETTING_CONNECTION_UUID << ": " << setting.uuid() << '\n';
1116 dbg.nospace() << NM_SETTING_CONNECTION_INTERFACE_NAME << ": " << setting.interfaceName() << '\n';
1117 dbg.nospace() << NM_SETTING_CONNECTION_TYPE << ": " << setting.typeAsString(setting.connectionType()) << '\n';
1118 dbg.nospace() << NM_SETTING_CONNECTION_PERMISSIONS << ": " << setting.permissions() << '\n';
1119 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT << ": " << setting.autoconnect() << '\n';
1120 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY << ": " << setting.autoconnectPriority() << '\n';
1121 dbg.nospace() << NM_SETTING_CONNECTION_TIMESTAMP << ": " << setting.timestamp().toSecsSinceEpoch() << '\n';
1122 dbg.nospace() << NM_SETTING_CONNECTION_READ_ONLY << ": " << setting.readOnly() << '\n';
1123 dbg.nospace() << NM_SETTING_CONNECTION_ZONE << ": " << setting.zone() << '\n';
1124 dbg.nospace() << NM_SETTING_CONNECTION_MASTER << ": " << setting.master() << '\n';
1125 dbg.nospace() << NM_SETTING_CONNECTION_SLAVE_TYPE << ": " << setting.slaveType() << '\n';
1126 dbg.nospace() << NM_SETTING_CONNECTION_SECONDARIES << ": " << setting.secondaries() << '\n';
1127 dbg.nospace() << NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT << ": " << setting.gatewayPingTimeout() << '\n';
1128 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES << ": " << setting.autoconnectRetries() << '\n';
1129 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES << ": " << setting.autoconnectSlaves() << '\n';
1130 dbg.nospace() << NM_SETTING_CONNECTION_LLDP << ": " << setting.lldp() << '\n';
1131 dbg.nospace() << NM_SETTING_CONNECTION_METERED << ": " << setting.metered() << '\n';
1132 dbg.nospace() << NM_SETTING_CONNECTION_MDNS << ": " << setting.mdns() << '\n';
1133 dbg.nospace() << NM_SETTING_CONNECTION_STABLE_ID << ": " << setting.stableId() << '\n';
1134 dbg.nospace() << "===================\n";
1135 const auto settingsList = setting.settings();
1136 for (const Setting::Ptr &settingPtr : settingsList) {
1137 dbg.nospace() << settingPtr->typeAsString(settingPtr->type()).toUpper() << " SETTINGS\n";
1138 dbg.nospace() << "---------------------------\n";
1139 switch (settingPtr->type()) {
1140 case Setting::Adsl:
1141 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::AdslSetting>().data());
1142 break;
1143 case Setting::Bond:
1144 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BondSetting>().data());
1145 break;
1146 case Setting::Bluetooth:
1147 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BluetoothSetting>().data());
1148 break;
1149 case Setting::Bridge:
1150 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BridgeSetting>().data());
1151 break;
1152 case Setting::BridgePort:
1153 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BridgePortSetting>().data());
1154 break;
1155 case Setting::Cdma:
1156 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::CdmaSetting>().data());
1157 break;
1158 case Setting::Gsm:
1159 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::GsmSetting>().data());
1160 break;
1161 case Setting::Infiniband:
1162 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::InfinibandSetting>().data());
1163 break;
1164 case Setting::Ipv4:
1165 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::Ipv4Setting>().data());
1166 break;
1167 case Setting::Ipv6:
1168 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::Ipv6Setting>().data());
1169 break;
1170 case Setting::OlpcMesh:
1171 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::OlpcMeshSetting>().data());
1172 break;
1173 case Setting::Ppp:
1174 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::PppSetting>().data());
1175 break;
1176 case Setting::Pppoe:
1177 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::PppoeSetting>().data());
1178 break;
1179 case Setting::Security8021x:
1180 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::Security8021xSetting>().data());
1181 break;
1182 case Setting::Serial:
1183 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::SerialSetting>().data());
1184 break;
1185 case Setting::Vlan:
1186 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::VlanSetting>().data());
1187 break;
1188 case Setting::Vpn:
1189 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::VpnSetting>().data());
1190 break;
1191 case Setting::Wimax:
1192 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WimaxSetting>().data());
1193 break;
1194 case Setting::Wired:
1195 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WiredSetting>().data());
1196 break;
1197 case Setting::Wireless:
1198 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WirelessSetting>().data());
1199 break;
1200 case Setting::WirelessSecurity:
1201 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WirelessSecuritySetting>().data());
1202 break;
1203 case Setting::Team:
1204 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::TeamSetting>().data());
1205 break;
1206 case Setting::Tun:
1207 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::TunSetting>().data());
1208 break;
1209 case Setting::IpTunnel:
1210 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::IpTunnelSetting>().data());
1211 break;
1212 case Setting::WireGuard:
1213 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WireGuardSetting>().data());
1214 break;
1215 default:
1216 dbg.nospace() << *settingPtr.data();
1217 }
1218
1219 dbg.nospace() << '\n';
1220 }
1221 return dbg.maybeSpace();
1222}
Represents adsl setting.
Definition adslsetting.h:23
Represents bluetooth setting.
Represents bond setting.
Definition bondsetting.h:23
Represents bridge port setting.
Represents bridge setting.
Represents cdma setting.
Definition cdmasetting.h:23
Represents collection of all connection settings.
Represents gsm setting.
Definition gsmsetting.h:23
Represents infiniband setting.
Represents IpTunnel setting.
Represents ipv4 setting.
Definition ipv4setting.h:53
Represents ipv6 setting.
Definition ipv6setting.h:71
Represents olpc mesh setting.
Represents ppp setting.
Definition pppsetting.h:23
Represents pppoe setting.
Represents 802.1x wireless security setting.
Represents serial setting.
Represents team setting.
Definition teamsetting.h:23
Represents generic setting.
Definition tunsetting.h:23
Represents vlan setting.
Definition vlansetting.h:23
Represents vpn setting.
Definition vpnsetting.h:23
Represents wimax setting.
Represents generic setting.
Represents wired setting.
Represents wireless security setting.
Represents wireless setting.
Type type(const QSqlDatabase &db)
char * toString(const EngineQuery &query)
bool isValid(QStringView ifopt)
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition accesspoint.h:21
NETWORKMANAGERQT_EXPORT NetworkManager::Device::MeteredStatus metered()
Definition manager.cpp:1197
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
QDateTime fromSecsSinceEpoch(qint64 secs)
qint64 toSecsSinceEpoch() const const
QDebug & maybeSpace()
QDebug & nospace()
const_iterator constBegin() const const
const_iterator constEnd() const const
const_reference at(qsizetype i) const const
iterator insert(const Key &key, const T &value)
T value(const Key &key, const T &defaultValue) const const
QSharedPointer< X > dynamicCast() const const
QString mid(qsizetype position, qsizetype n) const const
KeepEmptyParts
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
QUuid createUuid()
QString toString(StringFormat mode) const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.