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("WPA2-EAP")) {
658 wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaEap);
659 auto sec8021x = setting(Setting::Security8021x).dynamicCast<Security8021xSetting>();
660 sec8021x->setAnonymousIdentity(map.value(QLatin1String("A")).toString());
661 sec8021x->setIdentity(map.value(QLatin1String("I")).toString());
662 sec8021x->setPassword(map.value(QLatin1String("P")).toString());
663
664 const auto eapMethod = map.value(QLatin1String("E")).toString();
665 for (const auto &method : eap_methods) {
666 if (eapMethod == QLatin1String(method.name)) {
667 sec8021x->setEapMethods({method.method});
668 break;
669 }
670 }
671 const auto phase2AuthMethod = map.value(QLatin1String("PH2")).toString();
672 for (const auto &method : auth_methods) {
673 if (phase2AuthMethod == QLatin1String(method.name)) {
674 sec8021x->setPhase2AuthMethod(method.method);
675 break;
676 }
677 }
678 }
679}
680
681NMVariantMapMap NetworkManager::ConnectionSettings::toMap() const
682{
683 NMVariantMapMap result;
684 QVariantMap connectionSetting;
685
686 if (!id().isEmpty()) {
687 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_ID), id());
688 }
689
690 if (!uuid().isEmpty()) {
691 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_UUID), uuid());
692 }
693
694 if (connectionType()) {
695 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_TYPE), typeAsString(connectionType()));
696 }
697
698 if (!interfaceName().isEmpty()) {
699 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_INTERFACE_NAME), interfaceName());
700 }
701
702 if (!permissions().isEmpty()) {
703 QStringList perm;
704 QHash<QString, QString> perms = permissions();
706 while (it != perms.constEnd()) {
707 const QString tmp = "user:" + it.key() + ':' + it.value();
708 perm << tmp;
709 ++it;
710 }
711
712 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_PERMISSIONS), perm);
713 }
714
715 if (!autoconnect()) {
716 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT), autoconnect());
717 }
718
719 if (autoconnectPriority()) {
720 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY), autoconnectPriority());
721 }
722
723 if (timestamp().isValid()) {
724 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_TIMESTAMP), timestamp().toSecsSinceEpoch());
725 }
726
727 if (readOnly()) {
728 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_READ_ONLY), readOnly());
729 }
730
731 if (!zone().isEmpty()) {
732 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_ZONE), zone());
733 }
734
735 if (!master().isEmpty()) {
736 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_MASTER), master());
737 }
738
739 if (!slaveType().isEmpty()) {
740 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_SLAVE_TYPE), slaveType());
741 }
742
743 if (!secondaries().isEmpty()) {
744 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_SECONDARIES), secondaries());
745 }
746
747 if (gatewayPingTimeout()) {
748 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT), gatewayPingTimeout());
749 }
750
751 if (autoconnectRetries() >= 0) {
752 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES), autoconnectRetries());
753 }
754
755 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES), autoconnectSlaves());
756 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_LLDP), lldp());
757 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_METERED), metered());
758
759 if (mdns() != MdnsDefault) {
760 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_MDNS), mdns());
761 }
762
763 if (!stableId().isEmpty()) {
764 connectionSetting.insert(QLatin1String(NM_SETTING_CONNECTION_STABLE_ID), stableId());
765 }
766
767 result.insert(QLatin1String(NM_SETTING_CONNECTION_SETTING_NAME), connectionSetting);
768
769 const auto settingsList = settings();
770 for (const Setting::Ptr &setting : settingsList) {
771 QVariantMap map = setting->toMap();
772 if (!setting->isNull()) {
773 result.insert(setting->name(), map);
774 }
775 }
776 return result;
777}
778
779QString NetworkManager::ConnectionSettings::name() const
780{
781 Q_D(const ConnectionSettings);
782
783 return d->name;
784}
785
786void NetworkManager::ConnectionSettings::setId(const QString &id)
787{
788 Q_D(ConnectionSettings);
789
790 d->id = id;
791}
792
793QString NetworkManager::ConnectionSettings::id() const
794{
795 Q_D(const ConnectionSettings);
796
797 return d->id;
798}
799
800void NetworkManager::ConnectionSettings::setUuid(const QString &uuid)
801{
802 Q_D(ConnectionSettings);
803
804 d->uuid = uuid;
805}
806
807QString NetworkManager::ConnectionSettings::uuid() const
808{
809 Q_D(const ConnectionSettings);
810
811 return d->uuid;
812}
813
814void NetworkManager::ConnectionSettings::setInterfaceName(const QString &interfaceName)
815{
816 Q_D(ConnectionSettings);
817
818 d->interfaceName = interfaceName;
819}
820
821QString NetworkManager::ConnectionSettings::interfaceName() const
822{
823 Q_D(const ConnectionSettings);
824
825 return d->interfaceName;
826}
827
828void NetworkManager::ConnectionSettings::setConnectionType(NetworkManager::ConnectionSettings::ConnectionType type, NMBluetoothCapabilities bt_cap)
829{
830 Q_D(ConnectionSettings);
831
832 d->type = type;
833 d->initSettings(bt_cap);
834}
835
836NetworkManager::ConnectionSettings::ConnectionType NetworkManager::ConnectionSettings::connectionType() const
837{
838 Q_D(const ConnectionSettings);
839
840 return d->type;
841}
842
843void NetworkManager::ConnectionSettings::addToPermissions(const QString &user, const QString &type)
844{
845 Q_D(ConnectionSettings);
846
847 d->permissions.insert(user, type);
848}
849
850void NetworkManager::ConnectionSettings::setPermissions(const QHash<QString, QString> &perm)
851{
852 Q_D(ConnectionSettings);
853
854 d->permissions = perm;
855}
856
857QHash<QString, QString> NetworkManager::ConnectionSettings::permissions() const
858{
859 Q_D(const ConnectionSettings);
860
861 return d->permissions;
862}
863
864void NetworkManager::ConnectionSettings::setAutoconnect(bool autoconnect)
865{
866 Q_D(ConnectionSettings);
867
868 d->autoconnect = autoconnect;
869}
870
871bool NetworkManager::ConnectionSettings::autoconnect() const
872{
873 Q_D(const ConnectionSettings);
874
875 return d->autoconnect;
876}
877
878void NetworkManager::ConnectionSettings::setAutoconnectPriority(int priority)
879{
880 Q_D(ConnectionSettings);
881
882 d->autoconnectPriority = priority;
883}
884
885int NetworkManager::ConnectionSettings::autoconnectPriority() const
886{
887 Q_D(const ConnectionSettings);
888
889 return d->autoconnectPriority;
890}
891
892void NetworkManager::ConnectionSettings::setTimestamp(const QDateTime &timestamp)
893{
894 Q_D(ConnectionSettings);
895
896 d->timestamp = timestamp;
897}
898
899QDateTime NetworkManager::ConnectionSettings::timestamp() const
900{
901 Q_D(const ConnectionSettings);
902
903 return d->timestamp;
904}
905
906void NetworkManager::ConnectionSettings::setReadOnly(bool readonly)
907{
908 Q_D(ConnectionSettings);
909
910 d->readOnly = readonly;
911}
912
913bool NetworkManager::ConnectionSettings::readOnly() const
914{
915 Q_D(const ConnectionSettings);
916
917 return d->readOnly;
918}
919
920void NetworkManager::ConnectionSettings::setZone(const QString &zone)
921{
922 Q_D(ConnectionSettings);
923
924 d->zone = zone;
925}
926
927QString NetworkManager::ConnectionSettings::zone() const
928{
929 Q_D(const ConnectionSettings);
930
931 return d->zone;
932}
933
934bool NetworkManager::ConnectionSettings::isSlave() const
935{
936 Q_D(const ConnectionSettings);
937
938 return !d->master.isEmpty() && !d->slaveType.isEmpty();
939}
940
941void NetworkManager::ConnectionSettings::setMaster(const QString &master)
942{
943 Q_D(ConnectionSettings);
944
945 d->master = master;
946}
947
948QString NetworkManager::ConnectionSettings::master() const
949{
950 Q_D(const ConnectionSettings);
951
952 return d->master;
953}
954
955void NetworkManager::ConnectionSettings::setSlaveType(const QString &type)
956{
957 Q_D(ConnectionSettings);
958
959 d->slaveType = type;
960}
961
962QString NetworkManager::ConnectionSettings::slaveType() const
963{
964 Q_D(const ConnectionSettings);
965
966 return d->slaveType;
967}
968
969void NetworkManager::ConnectionSettings::setSecondaries(const QStringList &secondaries)
970{
971 Q_D(ConnectionSettings);
972
973 d->secondaries = secondaries;
974}
975
976QStringList NetworkManager::ConnectionSettings::secondaries() const
977{
978 Q_D(const ConnectionSettings);
979
980 return d->secondaries;
981}
982
983void NetworkManager::ConnectionSettings::setGatewayPingTimeout(quint32 timeout)
984{
985 Q_D(ConnectionSettings);
986
987 d->gatewayPingTimeout = timeout;
988}
989
990quint32 NetworkManager::ConnectionSettings::gatewayPingTimeout() const
991{
992 Q_D(const ConnectionSettings);
993
994 return d->gatewayPingTimeout;
995}
996
997int NetworkManager::ConnectionSettings::autoconnectRetries() const
998{
999 Q_D(const ConnectionSettings);
1000
1001 return d->autoconnectRetries;
1002}
1003
1004void NetworkManager::ConnectionSettings::setAutoconnectRetries(int retries)
1005{
1006 Q_D(ConnectionSettings);
1007
1008 d->autoconnectRetries = retries;
1009}
1010
1011NetworkManager::ConnectionSettings::AutoconnectSlaves NetworkManager::ConnectionSettings::autoconnectSlaves() const
1012{
1013 Q_D(const ConnectionSettings);
1014
1015 return d->autoconnectSlaves;
1016}
1017
1018void NetworkManager::ConnectionSettings::setAutoconnectSlaves(NetworkManager::ConnectionSettings::AutoconnectSlaves autoconnectSlaves)
1019{
1020 Q_D(ConnectionSettings);
1021
1022 d->autoconnectSlaves = autoconnectSlaves;
1023}
1024
1025NetworkManager::ConnectionSettings::Lldp NetworkManager::ConnectionSettings::lldp() const
1026{
1027 Q_D(const ConnectionSettings);
1028
1029 return d->lldp;
1030}
1031
1032void NetworkManager::ConnectionSettings::setLldp(NetworkManager::ConnectionSettings::Lldp lldp)
1033{
1034 Q_D(ConnectionSettings);
1035
1036 d->lldp = lldp;
1037}
1038
1039NetworkManager::ConnectionSettings::Metered NetworkManager::ConnectionSettings::metered() const
1040{
1041 Q_D(const ConnectionSettings);
1042
1043 return d->metered;
1044}
1045
1046void NetworkManager::ConnectionSettings::setMetered(NetworkManager::ConnectionSettings::Metered metered)
1047{
1048 Q_D(ConnectionSettings);
1049
1050 d->metered = metered;
1051}
1052
1053NetworkManager::ConnectionSettings::Mdns NetworkManager::ConnectionSettings::mdns() const
1054{
1055 Q_D(const ConnectionSettings);
1056
1057 return d->mdns;
1058}
1059
1060void NetworkManager::ConnectionSettings::setMdns(NetworkManager::ConnectionSettings::Mdns mdns)
1061{
1062 Q_D(ConnectionSettings);
1063
1064 d->mdns = mdns;
1065}
1066
1067QString NetworkManager::ConnectionSettings::stableId() const
1068{
1069 Q_D(const ConnectionSettings);
1070
1071 return d->stableId;
1072}
1073
1074void NetworkManager::ConnectionSettings::setStableId(const QString &stableId)
1075{
1076 Q_D(ConnectionSettings);
1077
1078 d->stableId = stableId;
1079}
1080
1081NetworkManager::Setting::Ptr NetworkManager::ConnectionSettings::setting(Setting::SettingType type) const
1082{
1083 const auto settingsList = settings();
1084 for (const Setting::Ptr &setting : settingsList) {
1085 if (setting->type() == type) {
1086 return setting;
1087 }
1088 }
1089
1090 return Setting::Ptr();
1091}
1092
1093NetworkManager::Setting::Ptr NetworkManager::ConnectionSettings::setting(const QString &type) const
1094{
1095 return setting(Setting::typeFromString(type));
1096}
1097
1098NetworkManager::Setting::List NetworkManager::ConnectionSettings::settings() const
1099{
1100 Q_D(const ConnectionSettings);
1101
1102 return d->settings;
1103}
1104
1105QDebug NetworkManager::operator<<(QDebug dbg, const NetworkManager::ConnectionSettings &setting)
1106{
1107 dbg.nospace() << "CONNECTION SETTINGS\n";
1108 dbg.nospace() << "===================\n";
1109
1110 dbg.nospace() << NM_SETTING_CONNECTION_ID << ": " << setting.id() << '\n';
1111 dbg.nospace() << NM_SETTING_CONNECTION_UUID << ": " << setting.uuid() << '\n';
1112 dbg.nospace() << NM_SETTING_CONNECTION_INTERFACE_NAME << ": " << setting.interfaceName() << '\n';
1113 dbg.nospace() << NM_SETTING_CONNECTION_TYPE << ": " << setting.typeAsString(setting.connectionType()) << '\n';
1114 dbg.nospace() << NM_SETTING_CONNECTION_PERMISSIONS << ": " << setting.permissions() << '\n';
1115 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT << ": " << setting.autoconnect() << '\n';
1116 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY << ": " << setting.autoconnectPriority() << '\n';
1117 dbg.nospace() << NM_SETTING_CONNECTION_TIMESTAMP << ": " << setting.timestamp().toSecsSinceEpoch() << '\n';
1118 dbg.nospace() << NM_SETTING_CONNECTION_READ_ONLY << ": " << setting.readOnly() << '\n';
1119 dbg.nospace() << NM_SETTING_CONNECTION_ZONE << ": " << setting.zone() << '\n';
1120 dbg.nospace() << NM_SETTING_CONNECTION_MASTER << ": " << setting.master() << '\n';
1121 dbg.nospace() << NM_SETTING_CONNECTION_SLAVE_TYPE << ": " << setting.slaveType() << '\n';
1122 dbg.nospace() << NM_SETTING_CONNECTION_SECONDARIES << ": " << setting.secondaries() << '\n';
1123 dbg.nospace() << NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT << ": " << setting.gatewayPingTimeout() << '\n';
1124 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES << ": " << setting.autoconnectRetries() << '\n';
1125 dbg.nospace() << NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES << ": " << setting.autoconnectSlaves() << '\n';
1126 dbg.nospace() << NM_SETTING_CONNECTION_LLDP << ": " << setting.lldp() << '\n';
1127 dbg.nospace() << NM_SETTING_CONNECTION_METERED << ": " << setting.metered() << '\n';
1128 dbg.nospace() << NM_SETTING_CONNECTION_MDNS << ": " << setting.mdns() << '\n';
1129 dbg.nospace() << NM_SETTING_CONNECTION_STABLE_ID << ": " << setting.stableId() << '\n';
1130 dbg.nospace() << "===================\n";
1131 const auto settingsList = setting.settings();
1132 for (const Setting::Ptr &settingPtr : settingsList) {
1133 dbg.nospace() << settingPtr->typeAsString(settingPtr->type()).toUpper() << " SETTINGS\n";
1134 dbg.nospace() << "---------------------------\n";
1135 switch (settingPtr->type()) {
1136 case Setting::Adsl:
1137 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::AdslSetting>().data());
1138 break;
1139 case Setting::Bond:
1140 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BondSetting>().data());
1141 break;
1142 case Setting::Bluetooth:
1143 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BluetoothSetting>().data());
1144 break;
1145 case Setting::Bridge:
1146 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BridgeSetting>().data());
1147 break;
1148 case Setting::BridgePort:
1149 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::BridgePortSetting>().data());
1150 break;
1151 case Setting::Cdma:
1152 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::CdmaSetting>().data());
1153 break;
1154 case Setting::Gsm:
1155 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::GsmSetting>().data());
1156 break;
1157 case Setting::Infiniband:
1158 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::InfinibandSetting>().data());
1159 break;
1160 case Setting::Ipv4:
1161 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::Ipv4Setting>().data());
1162 break;
1163 case Setting::Ipv6:
1164 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::Ipv6Setting>().data());
1165 break;
1166 case Setting::OlpcMesh:
1167 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::OlpcMeshSetting>().data());
1168 break;
1169 case Setting::Ppp:
1170 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::PppSetting>().data());
1171 break;
1172 case Setting::Pppoe:
1173 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::PppoeSetting>().data());
1174 break;
1175 case Setting::Security8021x:
1176 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::Security8021xSetting>().data());
1177 break;
1178 case Setting::Serial:
1179 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::SerialSetting>().data());
1180 break;
1181 case Setting::Vlan:
1182 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::VlanSetting>().data());
1183 break;
1184 case Setting::Vpn:
1185 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::VpnSetting>().data());
1186 break;
1187 case Setting::Wimax:
1188 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WimaxSetting>().data());
1189 break;
1190 case Setting::Wired:
1191 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WiredSetting>().data());
1192 break;
1193 case Setting::Wireless:
1194 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WirelessSetting>().data());
1195 break;
1196 case Setting::WirelessSecurity:
1197 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WirelessSecuritySetting>().data());
1198 break;
1199 case Setting::Team:
1200 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::TeamSetting>().data());
1201 break;
1202 case Setting::Tun:
1203 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::TunSetting>().data());
1204 break;
1205 case Setting::IpTunnel:
1206 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::IpTunnelSetting>().data());
1207 break;
1208 case Setting::WireGuard:
1209 dbg.nospace() << *(settingPtr.staticCast<NetworkManager::WireGuardSetting>().data());
1210 break;
1211 default:
1212 dbg.nospace() << *settingPtr.data();
1213 }
1214
1215 dbg.nospace() << '\n';
1216 }
1217 return dbg.maybeSpace();
1218}
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:1160
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:239
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 Fri Jul 19 2024 11:56:22 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.