21 #include <tqdbusmessage.h>
23 #include "tdeconfig.h"
24 #include "tdehardwaredevices.h"
25 #include "tdenetworkdevice.h"
27 #include "network-manager.h"
28 #include "network-manager_p.h"
32 #define PRINT_ERROR(x) printf("[TDE NM Backend ERROR] [%s:%d] %s\n", __FILE__, __LINE__, x.ascii());
34 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
35 #define PRINT_WARNING(x) printf("[TDE NM Backend WARNING] [%s:%d] %s\n", __FILE__, __LINE__, x.ascii());
37 #define PRINT_WARNING(x)
40 #define UPDATE_STRING_SETTING_IF_VALID(string, key, settingsMap) \
41 if (!string.isNull()) { settingsMap[key] = (TQT_DBusData::fromString(string)).getAsVariantData(); } \
42 else { settingsMap.remove(key); }
44 #define NM_ASYNC_TIMEOUT_MS 1000
46 #define NM_ASYNC_SECRETS_INTERACTION_TIMEOUT_MS (5*60*1000)
49 #define USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS 1
51 TQ_UINT32 reverseIPV4ByteOrder(TQ_UINT32 address) {
53 unsigned char valuearray[4];
54 valuearray[0] = (address & 0xff000000) >> 24;
55 valuearray[1] = (address & 0x00ff0000) >> 16;
56 valuearray[2] = (address & 0x0000ff00) >> 8;
57 valuearray[3] = (address & 0x000000ff) >> 0;
59 ret = ret | (valuearray[0] << 0);
60 ret = ret | (valuearray[1] << 8);
61 ret = ret | (valuearray[2] << 16);
62 ret = ret | (valuearray[3] << 24);
66 void printDBUSObjectStructure(TQT_DBusData
object,
int level=0, TQString mapKey=TQString::null) {
68 TQString levelIndent =
"";
69 for (i=0; i<level; i++) {
70 levelIndent = levelIndent +
" ";
72 TQCString signature =
object.buildDBusSignature();
74 if (
object.type() == TQT_DBusData::String) {
75 printf(
"%s%s\t%s%s'%s'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toString().ascii()); fflush(stdout);
77 else if (
object.type() == TQT_DBusData::Bool) {
78 printf(
"%s%s\t%s%s'%s'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ", (
object.toBool())?
"true":
"false"); fflush(stdout);
80 else if (
object.type() == TQT_DBusData::Byte) {
81 printf(
"%s%s\t%s%s'%d'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toByte()); fflush(stdout);
83 else if (
object.type() == TQT_DBusData::Int16) {
84 printf(
"%s%s\t%s%s'%d'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toInt16()); fflush(stdout);
86 else if (
object.type() == TQT_DBusData::UInt16) {
87 printf(
"%s%s\t%s%s'%d'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toUInt16()); fflush(stdout);
89 else if (
object.type() == TQT_DBusData::Int32) {
90 printf(
"%s%s\t%s%s'%d'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toInt32()); fflush(stdout);
92 else if (
object.type() == TQT_DBusData::UInt32) {
93 printf(
"%s%s\t%s%s'%d'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toUInt32()); fflush(stdout);
95 else if (
object.type() == TQT_DBusData::Int64) {
96 printf(
"%s%s\t%s%s'%lld'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toInt64()); fflush(stdout);
98 else if (
object.type() == TQT_DBusData::UInt64) {
99 printf(
"%s%s\t%s%s'%lld'\n", levelIndent.ascii(), signature.data(), (mapKey.isNull())?
"":mapKey.ascii(), (mapKey.isNull())?
"":
" = ",
object.toUInt64()); fflush(stdout);
102 printf(
"%s%s\n", levelIndent.ascii(), signature.data()); fflush(stdout);
105 if (
object.type() == TQT_DBusData::Map) {
108 TQMap<TQString, TQT_DBusData> outerMap =
object.toStringKeyMap().toTQMap();
109 TQMap<TQString, TQT_DBusData>::const_iterator it;
110 for (it = outerMap.begin(); it != outerMap.end(); ++it) {
111 printDBUSObjectStructure(*it, level+1, it.key());
114 else if (
object.type() == TQT_DBusData::List) {
115 TQT_DBusDataValueList valueList =
object.toTQValueList();
116 TQT_DBusDataValueList::const_iterator it;
117 for (it = valueList.begin(); it != valueList.end(); ++it) {
118 printDBUSObjectStructure(*it, level+1);
121 else if (
object.type() == TQT_DBusData::Variant) {
122 TQT_DBusVariant dataValueVariant =
object.toVariant();
123 TQT_DBusData dataValue = dataValueVariant.value;
124 printDBUSObjectStructure(dataValue, level+1, mapKey);
128 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nmGlobalStateToTDEGlobalState(TQ_UINT32 nmType) {
129 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags ret = TDENetworkGlobalManagerFlags::Unknown;
131 if (nmType == NM_STATE_UNKNOWN) {
132 ret |= TDENetworkGlobalManagerFlags::Unknown;
134 else if (nmType == NM_STATE_ASLEEP) {
135 ret |= TDENetworkGlobalManagerFlags::Disconnected;
136 ret |= TDENetworkGlobalManagerFlags::Sleeping;
138 else if (nmType == NM_STATE_DISCONNECTED) {
139 ret |= TDENetworkGlobalManagerFlags::Disconnected;
141 else if (nmType == NM_STATE_DISCONNECTING) {
142 ret |= TDENetworkGlobalManagerFlags::Connected;
143 ret |= TDENetworkGlobalManagerFlags::DeactivatingLink;
145 else if (nmType == NM_STATE_CONNECTING) {
146 ret |= TDENetworkGlobalManagerFlags::Disconnected;
147 ret |= TDENetworkGlobalManagerFlags::EstablishingLink;
149 else if (nmType == NM_STATE_CONNECTED_LOCAL) {
150 ret |= TDENetworkGlobalManagerFlags::Connected;
151 ret |= TDENetworkGlobalManagerFlags::LinkLocalAccess;
153 else if (nmType == NM_STATE_CONNECTED_SITE) {
154 ret |= TDENetworkGlobalManagerFlags::Connected;
155 ret |= TDENetworkGlobalManagerFlags::SiteLocalAccess;
157 else if (nmType == NM_STATE_CONNECTED_GLOBAL) {
158 ret |= TDENetworkGlobalManagerFlags::Connected;
159 ret |= TDENetworkGlobalManagerFlags::GlobalAccess;
165 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nmVPNStateToTDEGlobalState(TQ_UINT32 nmType) {
166 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags ret = TDENetworkGlobalManagerFlags::Unknown;
168 if (nmType == NM_VPN_STATE_UNKNOWN) {
169 ret |= TDENetworkGlobalManagerFlags::VPNUnknown;
171 else if (nmType == NM_VPN_STATE_PREPARE) {
172 ret |= TDENetworkGlobalManagerFlags::VPNDisconnected;
173 ret |= TDENetworkGlobalManagerFlags::VPNEstablishingLink;
175 else if (nmType == NM_VPN_STATE_NEED_AUTH) {
176 ret |= TDENetworkGlobalManagerFlags::VPNDisconnected;
177 ret |= TDENetworkGlobalManagerFlags::VPNNeedAuthorization;
179 else if (nmType == NM_VPN_STATE_CONNECT) {
180 ret |= TDENetworkGlobalManagerFlags::VPNDisconnected;
181 ret |= TDENetworkGlobalManagerFlags::VPNConfiguringProtocols;
183 else if (nmType == NM_VPN_STATE_IP_CONFIG_GET) {
184 ret |= TDENetworkGlobalManagerFlags::VPNDisconnected;
185 ret |= TDENetworkGlobalManagerFlags::VPNVerifyingProtocols;
187 else if (nmType == NM_VPN_STATE_ACTIVATED) {
188 ret |= TDENetworkGlobalManagerFlags::VPNConnected;
190 else if (nmType == NM_VPN_STATE_FAILED) {
191 ret |= TDENetworkGlobalManagerFlags::VPNDisconnected;
192 ret |= TDENetworkGlobalManagerFlags::VPNFailed;
194 else if (nmType == NM_VPN_STATE_DISCONNECTED) {
195 ret |= TDENetworkGlobalManagerFlags::VPNDisconnected;
201 TDENetworkConnectionStatus::TDENetworkConnectionStatus nmDeviceStateToTDEDeviceState(TQ_UINT32 nmType) {
202 TDENetworkConnectionStatus::TDENetworkConnectionStatus ret = TDENetworkConnectionStatus::None;
204 if (nmType == NM_DEVICE_STATE_UNKNOWN) {
205 ret |= TDENetworkConnectionStatus::Invalid;
207 else if (nmType == NM_DEVICE_STATE_UNMANAGED) {
208 ret |= TDENetworkConnectionStatus::UnManaged;
210 else if (nmType == NM_DEVICE_STATE_UNAVAILABLE) {
211 ret |= TDENetworkConnectionStatus::Disconnected;
212 ret |= TDENetworkConnectionStatus::LinkUnavailable;
214 else if (nmType == NM_DEVICE_STATE_DISCONNECTED) {
215 ret |= TDENetworkConnectionStatus::Disconnected;
217 else if (nmType == NM_DEVICE_STATE_PREPARE) {
218 ret |= TDENetworkConnectionStatus::Disconnected;
219 ret |= TDENetworkConnectionStatus::EstablishingLink;
221 else if (nmType == NM_DEVICE_STATE_CONFIG) {
222 ret |= TDENetworkConnectionStatus::Disconnected;
223 ret |= TDENetworkConnectionStatus::EstablishingLink;
225 else if (nmType == NM_DEVICE_STATE_NEED_AUTH) {
226 ret |= TDENetworkConnectionStatus::Disconnected;
227 ret |= TDENetworkConnectionStatus::NeedAuthorization;
229 else if (nmType == NM_DEVICE_STATE_IP_CONFIG) {
230 ret |= TDENetworkConnectionStatus::Disconnected;
231 ret |= TDENetworkConnectionStatus::ConfiguringProtocols;
233 else if (nmType == NM_DEVICE_STATE_IP_CHECK) {
234 ret |= TDENetworkConnectionStatus::Disconnected;
235 ret |= TDENetworkConnectionStatus::VerifyingProtocols;
237 else if (nmType == NM_DEVICE_STATE_SECONDARIES) {
238 ret |= TDENetworkConnectionStatus::Disconnected;
239 ret |= TDENetworkConnectionStatus::DependencyWait;
241 else if (nmType == NM_DEVICE_STATE_ACTIVATED) {
242 ret |= TDENetworkConnectionStatus::Connected;
244 else if (nmType == NM_DEVICE_STATE_DEACTIVATING) {
245 ret |= TDENetworkConnectionStatus::Connected;
246 ret |= TDENetworkConnectionStatus::DeactivatingLink;
248 else if (nmType == NM_DEVICE_STATE_FAILED) {
249 ret |= TDENetworkConnectionStatus::Disconnected;
250 ret |= TDENetworkConnectionStatus::Failed;
256 TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::nmDeviceTypeToTDEDeviceType(TQ_UINT32 nmType) {
257 TDENetworkDeviceType::TDENetworkDeviceType ret = TDENetworkDeviceType::Other;
259 if (nmType == NM_DEVICE_TYPE_UNKNOWN) {
260 ret = TDENetworkDeviceType::Other;
262 else if (nmType == NM_DEVICE_TYPE_ETHERNET) {
263 ret = TDENetworkDeviceType::WiredEthernet;
265 else if (nmType == NM_DEVICE_TYPE_WIFI) {
266 ret = TDENetworkDeviceType::WiFi;
268 else if (nmType == NM_DEVICE_TYPE_UNUSED1) {
270 else if (nmType == NM_DEVICE_TYPE_UNUSED2) {
272 else if (nmType == NM_DEVICE_TYPE_BT) {
273 ret = TDENetworkDeviceType::Bluetooth;
275 else if (nmType == NM_DEVICE_TYPE_OLPC_MESH) {
276 ret = TDENetworkDeviceType::OLPCMesh;
278 else if (nmType == NM_DEVICE_TYPE_WIMAX) {
279 ret = TDENetworkDeviceType::WiMax;
281 else if (nmType == NM_DEVICE_TYPE_MODEM) {
282 ret = TDENetworkDeviceType::Modem;
284 else if (nmType == NM_DEVICE_TYPE_INFINIBAND) {
285 ret = TDENetworkDeviceType::Infiniband;
287 else if (nmType == NM_DEVICE_TYPE_BOND) {
288 ret = TDENetworkDeviceType::Bond;
290 else if (nmType == NM_DEVICE_TYPE_VLAN) {
291 ret = TDENetworkDeviceType::VLAN;
293 else if (nmType == NM_DEVICE_TYPE_ADSL) {
294 ret = TDENetworkDeviceType::ADSL;
300 TDENetworkConnectionType::TDENetworkConnectionType nmConnectionTypeToTDEConnectionType(TQString nm) {
301 TDENetworkConnectionType::TDENetworkConnectionType ret = TDENetworkConnectionType::Other;
303 if (nm.lower() ==
"802-3-ethernet") {
304 ret = TDENetworkConnectionType::WiredEthernet;
306 else if (nm.lower() ==
"infiniband") {
307 ret = TDENetworkConnectionType::Infiniband;
309 else if (nm.lower() ==
"802-11-wireless") {
310 ret = TDENetworkConnectionType::WiFi;
312 else if (nm.lower() ==
"vpn") {
313 ret = TDENetworkConnectionType::VPN;
315 else if (nm.lower() ==
"wimax") {
316 ret = TDENetworkConnectionType::WiMax;
318 else if (nm.lower() ==
"vlan") {
319 ret = TDENetworkConnectionType::VLAN;
321 else if (nm.lower() ==
"802-11-olpc-mesh") {
322 ret = TDENetworkConnectionType::OLPCMesh;
324 else if (nm.lower() ==
"bluetooth") {
325 ret = TDENetworkConnectionType::Bluetooth;
327 else if (nm.lower() ==
"cdma") {
328 ret = TDENetworkConnectionType::Modem;
330 else if (nm.lower() ==
"gsm") {
331 ret = TDENetworkConnectionType::Modem;
337 TQString tdeConnectionTypeToNMConnectionType(TDENetworkConnectionType::TDENetworkConnectionType type, TDEModemConnectionType::TDEModemConnectionType modemType=TDEModemConnectionType::Other) {
340 if (type == TDENetworkConnectionType::WiredEthernet) {
341 ret =
"802-3-ethernet";
343 else if (type == TDENetworkConnectionType::Infiniband) {
346 else if (type == TDENetworkConnectionType::WiFi) {
347 ret =
"802-11-wireless";
349 else if (type == TDENetworkConnectionType::VPN) {
352 else if (type == TDENetworkConnectionType::WiMax) {
355 else if (type == TDENetworkConnectionType::VLAN) {
358 else if (type == TDENetworkConnectionType::OLPCMesh) {
359 ret =
"802-11-olpc-mesh";
361 else if (type == TDENetworkConnectionType::Bluetooth) {
364 else if (type == TDENetworkConnectionType::Modem) {
365 if (modemType == TDEModemConnectionType::CDMA) {
368 else if (modemType == TDEModemConnectionType::GSM) {
376 TDENetworkIEEE8021xType::TDENetworkIEEE8021xType nmEAPTypeToTDEEAPType(TQString nm) {
377 TDENetworkIEEE8021xType::TDENetworkIEEE8021xType ret = TDENetworkIEEE8021xType::None;
379 if (nm.lower() ==
"") {
380 ret = TDENetworkIEEE8021xType::None;
382 else if (nm.lower() ==
"leap") {
383 ret = TDENetworkIEEE8021xType::LEAP;
385 else if (nm.lower() ==
"md5") {
386 ret = TDENetworkIEEE8021xType::MD5;
388 else if (nm.lower() ==
"pap") {
389 ret = TDENetworkIEEE8021xType::PAP;
391 else if (nm.lower() ==
"chap") {
392 ret = TDENetworkIEEE8021xType::CHAP;
394 else if (nm.lower() ==
"mschap") {
395 ret = TDENetworkIEEE8021xType::MSCHAP;
397 else if (nm.lower() ==
"mschapv2") {
398 ret = TDENetworkIEEE8021xType::MSCHAPV2;
400 else if (nm.lower() ==
"fast") {
401 ret = TDENetworkIEEE8021xType::Fast;
403 else if (nm.lower() ==
"psk") {
404 ret = TDENetworkIEEE8021xType::PSK;
406 else if (nm.lower() ==
"pax") {
407 ret = TDENetworkIEEE8021xType::PAX;
409 else if (nm.lower() ==
"sake") {
410 ret = TDENetworkIEEE8021xType::SAKE;
412 else if (nm.lower() ==
"gpsk") {
413 ret = TDENetworkIEEE8021xType::GPSK;
415 else if (nm.lower() ==
"tls") {
416 ret = TDENetworkIEEE8021xType::TLS;
418 else if (nm.lower() ==
"peap") {
419 ret = TDENetworkIEEE8021xType::PEAP;
421 else if (nm.lower() ==
"ttls") {
422 ret = TDENetworkIEEE8021xType::TTLS;
424 else if (nm.lower() ==
"sim") {
425 ret = TDENetworkIEEE8021xType::SIM;
427 else if (nm.lower() ==
"gtc") {
428 ret = TDENetworkIEEE8021xType::GTC;
430 else if (nm.lower() ==
"otp") {
431 ret = TDENetworkIEEE8021xType::OTP;
434 PRINT_ERROR(TQString(
"unknown EAP type %s requested in existing connection").arg(nm.lower()))
440 TQString tdeEAPTypeToNMEAPType(TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eaptype) {
443 if (eaptype == TDENetworkIEEE8021xType::None) {
446 else if (eaptype == TDENetworkIEEE8021xType::LEAP) {
449 else if (eaptype == TDENetworkIEEE8021xType::MD5) {
452 else if (eaptype == TDENetworkIEEE8021xType::PAP) {
455 else if (eaptype == TDENetworkIEEE8021xType::CHAP) {
458 else if (eaptype == TDENetworkIEEE8021xType::MSCHAP) {
461 else if (eaptype == TDENetworkIEEE8021xType::MSCHAPV2) {
464 else if (eaptype == TDENetworkIEEE8021xType::Fast) {
467 else if (eaptype == TDENetworkIEEE8021xType::PSK) {
470 else if (eaptype == TDENetworkIEEE8021xType::PAX) {
473 else if (eaptype == TDENetworkIEEE8021xType::SAKE) {
476 else if (eaptype == TDENetworkIEEE8021xType::GPSK) {
479 else if (eaptype == TDENetworkIEEE8021xType::TLS) {
482 else if (eaptype == TDENetworkIEEE8021xType::PEAP) {
485 else if (eaptype == TDENetworkIEEE8021xType::TTLS) {
488 else if (eaptype == TDENetworkIEEE8021xType::SIM) {
491 else if (eaptype == TDENetworkIEEE8021xType::GTC) {
494 else if (eaptype == TDENetworkIEEE8021xType::OTP) {
498 PRINT_ERROR(TQString(
"unknown TDE EAP type %d requested in new or updated connection").arg(eaptype))
504 TDENetworkIEEE8021xFastFlags::TDENetworkIEEE8021xFastFlags nmEAPFastFlagsToTDEEAPFastFlags(TQString nm) {
505 TDENetworkIEEE8021xFastFlags::TDENetworkIEEE8021xFastFlags ret = TDENetworkIEEE8021xFastFlags::AllowUnauthenticated | TDENetworkIEEE8021xFastFlags::AllowAuthenticated;
507 unsigned int nm_int = nm.toUInt();
508 if (nm_int == NM_EAP_FAST_PROVISIONING_DISABLED) {
509 ret = TDENetworkIEEE8021xFastFlags::None;
511 else if (nm_int == NM_EAP_FAST_PROVISIONING_UNAUTHONLY) {
512 ret = TDENetworkIEEE8021xFastFlags::AllowUnauthenticated;
514 else if (nm_int == NM_EAP_FAST_PROVISIONING_AUTHONLY) {
515 ret = TDENetworkIEEE8021xFastFlags::AllowAuthenticated;
517 else if (nm_int == NM_EAP_FAST_PROVISIONING_BOTH) {
518 ret = TDENetworkIEEE8021xFastFlags::AllowUnauthenticated | TDENetworkIEEE8021xFastFlags::AllowAuthenticated;
521 PRINT_ERROR(TQString(
"unknown EAP fast flag %s requested in existing connection").arg(nm.lower()))
527 TQString tdeEAPFastFlagsToNMEAPFastFlags(TDENetworkIEEE8021xFastFlags::TDENetworkIEEE8021xFastFlags eaptype) {
530 if ((eaptype & TDENetworkIEEE8021xFastFlags::AllowUnauthenticated) && (eaptype & TDENetworkIEEE8021xFastFlags::AllowAuthenticated)) {
531 ret = TQString(
"%1").arg(NM_EAP_FAST_PROVISIONING_BOTH);
533 else if (eaptype & TDENetworkIEEE8021xFastFlags::AllowAuthenticated) {
534 ret = TQString(
"%1").arg(NM_EAP_FAST_PROVISIONING_AUTHONLY);
536 else if (eaptype & TDENetworkIEEE8021xFastFlags::AllowUnauthenticated) {
537 ret = TQString(
"%1").arg(NM_EAP_FAST_PROVISIONING_UNAUTHONLY);
540 ret = TQString(
"%1").arg(NM_EAP_FAST_PROVISIONING_DISABLED);
546 TDEWiFiMode::TDEWiFiMode nmWiFiModeToTDEWiFiMode(TQString nm) {
547 TDEWiFiMode::TDEWiFiMode ret = TDEWiFiMode::Infrastructure;
549 if (nm.lower() ==
"infrastructure") {
550 ret = TDEWiFiMode::Infrastructure;
552 else if (nm.lower() ==
"adhoc") {
553 ret = TDEWiFiMode::AdHoc;
559 TQString tdeWiFiModeToNMWiFiMode(TDEWiFiMode::TDEWiFiMode mode) {
562 if (mode == TDEWiFiMode::Infrastructure) {
563 ret =
"infrastructure";
565 else if (mode == TDEWiFiMode::AdHoc) {
572 TDEWiFiMode::TDEWiFiMode nmWiFiModeToTDEWiFiMode(TQ_UINT32 nm) {
573 TDEWiFiMode::TDEWiFiMode ret = TDEWiFiMode::Infrastructure;
575 if (nm == NM_802_11_MODE_INFRASTRUCTURE) {
576 ret = TDEWiFiMode::Infrastructure;
578 else if (nm == NM_802_11_MODE_ADHOC) {
579 ret = TDEWiFiMode::AdHoc;
585 TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags tdeWiFiFlagsToNMWiFiFlags(TQ_UINT32 nm) {
586 TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags ret = TDENetworkWiFiClientFlags::None;
588 if (nm & NM_802_11_DEVICE_CAP_CIPHER_WEP40) {
589 ret | TDENetworkWiFiClientFlags::CipherWEP40;
591 if (nm & NM_802_11_DEVICE_CAP_CIPHER_WEP104) {
592 ret | TDENetworkWiFiClientFlags::CipherWEP104;
594 if (nm & NM_802_11_DEVICE_CAP_CIPHER_TKIP) {
595 ret | TDENetworkWiFiClientFlags::CipherTKIP;
597 if (nm & NM_802_11_DEVICE_CAP_CIPHER_CCMP) {
598 ret | TDENetworkWiFiClientFlags::CipherCCMP;
600 if (nm & NM_802_11_DEVICE_CAP_WPA) {
601 ret | TDENetworkWiFiClientFlags::CipherWPA;
603 if (nm & NM_802_11_DEVICE_CAP_RSN) {
604 ret | TDENetworkWiFiClientFlags::CipherRSN;
610 TDEBluetoothConnectionType::TDEBluetoothConnectionType nmBluetoothModeToTDEBluetoothMode(TQString nm) {
611 TDEBluetoothConnectionType::TDEBluetoothConnectionType ret = TDEBluetoothConnectionType::PAN;
613 if (nm.lower() ==
"dun") {
614 ret = TDEBluetoothConnectionType::DUN;
616 else if (nm.lower() ==
"panu") {
617 ret = TDEBluetoothConnectionType::PAN;
623 TQString tdeBluetoothModeToNMBluetoothMode(TDEBluetoothConnectionType::TDEBluetoothConnectionType type) {
626 if (type == TDEBluetoothConnectionType::DUN) {
629 else if (type == TDEBluetoothConnectionType::PAN) {
636 TDEGSMNetworkType::TDEGSMNetworkType nmGSMModeToTDEGSMMode(TQ_INT32 nm) {
637 TDEGSMNetworkType::TDEGSMNetworkType ret = TDEGSMNetworkType::Any;
639 if (nm == NM_GSM_3G_ONLY) {
640 ret = TDEGSMNetworkType::Only3G;
642 else if (nm == NM_GSM_GPRS_EDGE_ONLY) {
643 ret = TDEGSMNetworkType::GPRSEdge;
645 else if (nm == NM_GSM_PREFER_3G) {
646 ret = TDEGSMNetworkType::Prefer3G;
648 else if (nm == NM_GSM_PREFER_2G) {
649 ret = TDEGSMNetworkType::Prefer2G;
655 TQ_INT32 tdeGSMModeToNMGSMMode(TDEGSMNetworkType::TDEGSMNetworkType type) {
658 if (type == TDEGSMNetworkType::Only3G) {
659 ret = NM_GSM_3G_ONLY;
661 else if (type == TDEGSMNetworkType::GPRSEdge) {
662 ret = NM_GSM_GPRS_EDGE_ONLY;
664 else if (type == TDEGSMNetworkType::Prefer3G) {
665 ret = NM_GSM_PREFER_3G;
667 else if (type == TDEGSMNetworkType::Prefer2G) {
668 ret = NM_GSM_PREFER_2G;
674 TDEWiFiFrequencyBand::TDEWiFiFrequencyBand nmWiFiFrequencyBandToTDEWiFiFrequencyBand(TQString nm) {
675 TDEWiFiFrequencyBand::TDEWiFiFrequencyBand ret = TDEWiFiFrequencyBand::Other;
677 if (nm.lower() ==
"") {
678 ret = TDEWiFiFrequencyBand::None;
680 else if (nm.lower() ==
"bg") {
681 ret = TDEWiFiFrequencyBand::Band2_4GHz;
683 else if (nm.lower() ==
"a") {
684 ret = TDEWiFiFrequencyBand::Band5GHz;
690 TQString tdeWiFiFrequencyBandToNMWiFiFrequencyBand(TDEWiFiFrequencyBand::TDEWiFiFrequencyBand mode) {
693 if (mode == TDEWiFiFrequencyBand::None) {
694 ret = TQString::null;
696 else if (mode == TDEWiFiFrequencyBand::Band2_4GHz) {
699 else if (mode == TDEWiFiFrequencyBand::Band5GHz) {
706 TDENetworkWiFiKeyType::TDENetworkWiFiKeyType nmWiFiKeyTypeToTDEWiFiKeyType(TQString nm) {
707 TDENetworkWiFiKeyType::TDENetworkWiFiKeyType ret = TDENetworkWiFiKeyType::Other;
709 if (nm.lower() ==
"none") {
710 ret = TDENetworkWiFiKeyType::WEP;
712 else if (nm.lower() ==
"ieee8021x") {
713 ret = TDENetworkWiFiKeyType::DynamicWEP;
715 else if (nm.lower() ==
"wpa-none") {
716 ret = TDENetworkWiFiKeyType::WPAAdHoc;
718 else if (nm.lower() ==
"wpa-psk") {
719 ret = TDENetworkWiFiKeyType::WPAInfrastructure;
721 else if (nm.lower() ==
"wpa-eap") {
722 ret = TDENetworkWiFiKeyType::WPAEnterprise;
728 TQString tdeWiFiKeyTypeToNMWiFiKeyType(TDENetworkWiFiKeyType::TDENetworkWiFiKeyType type) {
731 if (type == TDENetworkWiFiKeyType::WEP) {
734 else if (type == TDENetworkWiFiKeyType::DynamicWEP) {
737 else if (type == TDENetworkWiFiKeyType::WPAAdHoc) {
740 else if (type == TDENetworkWiFiKeyType::WPAInfrastructure) {
743 else if (type == TDENetworkWiFiKeyType::WPAEnterprise) {
750 TDENetworkWiFiAuthType::TDENetworkWiFiAuthType nmWiFiAuthTypeToTDEWiFiAuthType(TQString nm) {
751 TDENetworkWiFiAuthType::TDENetworkWiFiAuthType ret = TDENetworkWiFiAuthType::Other;
753 if (nm.lower() ==
"open") {
754 ret = TDENetworkWiFiAuthType::Open;
756 else if (nm.lower() ==
"shared") {
757 ret = TDENetworkWiFiAuthType::Shared;
759 else if (nm.lower() ==
"leap") {
760 ret = TDENetworkWiFiAuthType::LEAP;
766 TQString tdeWiFiAuthTypeToNMWiFiAuthType(TDENetworkWiFiAuthType::TDENetworkWiFiAuthType type) {
769 if (type == TDENetworkWiFiAuthType::Open) {
772 else if (type == TDENetworkWiFiAuthType::Shared) {
775 else if (type == TDENetworkWiFiAuthType::LEAP) {
782 TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags nmWiFiWPAVersionToTDEWiFiWPAVersion(TQStringList nm) {
783 TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags ret = TDENetworkWiFiWPAVersionFlags::None;
785 if ((nm.contains(
"wpa") && nm.contains(
"rsn")) || (nm.count() < 1)) {
786 ret |= TDENetworkWiFiWPAVersionFlags::Any;
788 else if (nm.contains(
"wpa")) {
789 ret |= TDENetworkWiFiWPAVersionFlags::WPA;
791 else if (nm.contains(
"rsn")) {
792 ret |= TDENetworkWiFiWPAVersionFlags::RSN;
798 TQStringList tdeWiFiWPAVersionToNMWiFiWPAVersion(TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags type) {
801 if (type & TDENetworkWiFiWPAVersionFlags::WPA) {
804 if (type & TDENetworkWiFiWPAVersionFlags::RSN) {
811 TDENetworkWiFiConnectionCipher::TDENetworkWiFiConnectionCipher nmWiFiCipherToTDEWiFiCipher(TQString nm) {
812 TDENetworkWiFiConnectionCipher::TDENetworkWiFiConnectionCipher ret = TDENetworkWiFiConnectionCipher::None;
814 if (nm.lower() ==
"wep40") {
815 ret = TDENetworkWiFiConnectionCipher::CipherWEP40;
817 else if (nm.lower() ==
"wep104") {
818 ret = TDENetworkWiFiConnectionCipher::CipherWEP104;
820 else if (nm.lower() ==
"tkip") {
821 ret = TDENetworkWiFiConnectionCipher::CipherTKIP;
823 else if (nm.lower() ==
"ccmp") {
824 ret = TDENetworkWiFiConnectionCipher::CipherCCMP;
830 TQString tdeWiFiCipherToNMWiFiCipher(TDENetworkWiFiConnectionCipher::TDENetworkWiFiConnectionCipher cipher) {
833 if (cipher == TDENetworkWiFiConnectionCipher::CipherWEP40) {
836 else if (cipher == TDENetworkWiFiConnectionCipher::CipherWEP104) {
839 else if (cipher == TDENetworkWiFiConnectionCipher::CipherTKIP) {
842 else if (cipher == TDENetworkWiFiConnectionCipher::CipherCCMP) {
849 TDENetworkSlaveDeviceType::TDENetworkSlaveDeviceType nmSlaveTypeToTDESlaveType(TQString nm) {
850 TDENetworkSlaveDeviceType::TDENetworkSlaveDeviceType ret = TDENetworkSlaveDeviceType::None;
852 if (nm.lower() ==
"bond") {
853 ret = TDENetworkSlaveDeviceType::Bond;
859 TQString tdeSlaveTypeToNMSlaveType(TDENetworkSlaveDeviceType::TDENetworkSlaveDeviceType slavetype) {
862 if (slavetype == TDENetworkSlaveDeviceType::Bond) {
869 TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags nmPasswordFlagsToTDEPasswordFlags(
unsigned int nm) {
870 TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags ret = TDENetworkPasswordHandlingFlags::None;
872 if (nm & NM_PASSWORD_SECRET_AGENTOWNED) {
873 ret |= TDENetworkPasswordHandlingFlags::ExternalStorage;
875 if (nm & NM_PASSWORD_SECRET_NOTSAVED) {
876 ret |= TDENetworkPasswordHandlingFlags::NoSave;
878 if (nm & NM_PASSWORD_SECRET_NOTREQUIRED) {
879 ret |= TDENetworkPasswordHandlingFlags::NoPrompt;
885 unsigned int tdePasswordFlagsToNMPasswordFlags(TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags flags) {
886 unsigned int ret = 0;
888 if (flags & TDENetworkPasswordHandlingFlags::ExternalStorage) {
889 ret |= NM_PASSWORD_SECRET_AGENTOWNED;
891 if (flags & TDENetworkPasswordHandlingFlags::NoSave) {
892 ret |= NM_PASSWORD_SECRET_NOTSAVED;
894 if (flags & TDENetworkPasswordHandlingFlags::NoPrompt) {
895 ret |= NM_PASSWORD_SECRET_NOTREQUIRED;
901 TDENetworkVLANFlags::TDENetworkVLANFlags nmVLANFlagsToTDEVLANFlags(
unsigned int nm) {
902 TDENetworkVLANFlags::TDENetworkVLANFlags ret = TDENetworkVLANFlags::None;
904 if (nm & NM_VLAN_REORDER_PACKET_HEADERS) {
905 ret |= TDENetworkVLANFlags::ReorderPacketHeaders;
907 if (nm & NM_VLAN_USE_GVRP) {
908 ret |= TDENetworkVLANFlags::UseGVRP;
910 if (nm & NM_VLAN_LOOSE_BINDING) {
911 ret |= TDENetworkVLANFlags::LooseBinding;
917 unsigned int tdeVLANFlagsToNMVLANFlags(TDENetworkVLANFlags::TDENetworkVLANFlags flags) {
918 unsigned int ret = 0;
920 if (flags & TDENetworkVLANFlags::ReorderPacketHeaders) {
921 ret |= NM_VLAN_REORDER_PACKET_HEADERS;
923 if (flags & TDENetworkVLANFlags::UseGVRP) {
924 ret |= NM_VLAN_USE_GVRP;
926 if (flags & TDENetworkVLANFlags::LooseBinding) {
927 ret |= NM_VLAN_LOOSE_BINDING;
933 TDENetworkParity::TDENetworkParity nmParityToTDEParity(
char nm) {
934 TDENetworkParity::TDENetworkParity ret = TDENetworkParity::None;
937 ret = TDENetworkParity::Even;
939 else if (nm ==
'o') {
940 ret = TDENetworkParity::Odd;
946 char tdeParityToNMParity(TDENetworkParity::TDENetworkParity parity) {
949 if (parity == TDENetworkParity::Even) {
952 else if (parity == TDENetworkParity::Odd) {
959 TDENetworkWepKeyType::TDENetworkWepKeyType nmWepKeyTypeToTDEWepKeyType(
unsigned int nm, TQString key=TQString::null) {
960 TDENetworkWepKeyType::TDENetworkWepKeyType ret = TDENetworkWepKeyType::Hexadecimal;
962 if (nm == NM_WEP_TYPE_HEXADECIMAL) {
964 ret = TDENetworkWepKeyType::Hexadecimal;
967 if ((
key.length() == 10) || (
key.length() == 26)) {
968 ret = TDENetworkWepKeyType::Hexadecimal;
971 ret = TDENetworkWepKeyType::Ascii;
975 else if (nm == NM_WEP_TYPE_PASSPHRASE) {
976 ret = TDENetworkWepKeyType::Passphrase;
982 unsigned int tdeWepKeyTypeToNMWepKeyType(TDENetworkWepKeyType::TDENetworkWepKeyType type) {
983 unsigned int ret = 0;
985 if (type == TDENetworkWepKeyType::Hexadecimal) {
986 ret = NM_WEP_TYPE_HEXADECIMAL;
988 else if (type == TDENetworkWepKeyType::Ascii) {
989 ret = NM_WEP_TYPE_HEXADECIMAL;
991 else if (type == TDENetworkWepKeyType::Passphrase) {
992 ret = NM_WEP_TYPE_PASSPHRASE;
998 TDENetworkDeviceCapabilityFlags::TDENetworkDeviceCapabilityFlags nmCapabilityFlagsToTDECapabilityFlags(
unsigned int nm) {
999 TDENetworkDeviceCapabilityFlags::TDENetworkDeviceCapabilityFlags ret = TDENetworkDeviceCapabilityFlags::None;
1001 if (nm & NM_DEVICE_CAP_NM_SUPPORTED) {
1002 ret |= TDENetworkDeviceCapabilityFlags::Supported;
1004 if (nm & NM_DEVICE_CAP_CARRIER_DETECT) {
1005 ret |= TDENetworkDeviceCapabilityFlags::CanDetectLink;
1011 unsigned int tdeCapabilityFlagsToNMCapabilityFlags(TDENetworkDeviceCapabilityFlags::TDENetworkDeviceCapabilityFlags flags) {
1012 unsigned int ret = 0;
1014 if (flags & TDENetworkDeviceCapabilityFlags::Supported) {
1015 ret |= NM_DEVICE_CAP_NM_SUPPORTED;
1017 if (flags & TDENetworkDeviceCapabilityFlags::CanDetectLink) {
1018 ret |= NM_DEVICE_CAP_CARRIER_DETECT;
1024 TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags nmAPSecFlagsToTDEAPSecFlags(
unsigned int genflags,
unsigned int nm) {
1025 TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags ret = TDENetworkWiFiAPFlags::None;
1027 if (genflags & NM_ACCESS_POINT_CAP_PRIVACY) {
1028 ret |= TDENetworkWiFiAPFlags::PrivacySupport;
1031 if (nm & NM_ACCESS_POINT_SEC_PAIR_WEP40) {
1032 ret |= TDENetworkWiFiAPFlags::PairWEP40;
1034 if (nm & NM_ACCESS_POINT_SEC_PAIR_WEP104) {
1035 ret |= TDENetworkWiFiAPFlags::PairWEP104;
1037 if (nm & NM_ACCESS_POINT_SEC_PAIR_TKIP) {
1038 ret |= TDENetworkWiFiAPFlags::PairTKIP;
1040 if (nm & NM_ACCESS_POINT_SEC_PAIR_CCMP) {
1041 ret |= TDENetworkWiFiAPFlags::PairCCMP;
1043 if (nm & NM_ACCESS_POINT_SEC_GROUP_WEP40) {
1044 ret |= TDENetworkWiFiAPFlags::GroupWEP40;
1046 if (nm & NM_ACCESS_POINT_SEC_GROUP_WEP104) {
1047 ret |= TDENetworkWiFiAPFlags::GroupWEP104;
1049 if (nm & NM_ACCESS_POINT_SEC_GROUP_TKIP) {
1050 ret |= TDENetworkWiFiAPFlags::GroupTKIP;
1052 if (nm & NM_ACCESS_POINT_SEC_GROUP_CCMP) {
1053 ret |= TDENetworkWiFiAPFlags::GroupCCMP;
1055 if (nm & NM_ACCESS_POINT_SEC_KEY_MGMT_PSK) {
1056 ret |= TDENetworkWiFiAPFlags::KeyManagementPSK;
1058 if (nm & NM_ACCESS_POINT_SEC_KEY_MGMT_802_1X) {
1059 ret |= TDENetworkWiFiAPFlags::KeyManagement80211;
1065 unsigned int tdeAPSecFlagsToNMAPGenSecFlags(TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags) {
1066 unsigned int ret = 0;
1068 if (flags & TDENetworkWiFiAPFlags::PrivacySupport) {
1069 ret |= NM_ACCESS_POINT_CAP_PRIVACY;
1075 unsigned int tdeAPSecFlagsToNMAPSecFlags(TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags) {
1076 unsigned int ret = 0;
1078 if (flags & TDENetworkWiFiAPFlags::PairWEP40) {
1079 ret |= NM_ACCESS_POINT_SEC_PAIR_WEP40;
1081 if (flags & TDENetworkWiFiAPFlags::PairWEP104) {
1082 ret |= NM_ACCESS_POINT_SEC_PAIR_WEP104;
1084 if (flags & TDENetworkWiFiAPFlags::PairTKIP) {
1085 ret |= NM_ACCESS_POINT_SEC_PAIR_TKIP;
1087 if (flags & TDENetworkWiFiAPFlags::PairCCMP) {
1088 ret |= NM_ACCESS_POINT_SEC_PAIR_CCMP;
1090 if (flags & TDENetworkWiFiAPFlags::GroupWEP40) {
1091 ret |= NM_ACCESS_POINT_SEC_GROUP_WEP40;
1093 if (flags & TDENetworkWiFiAPFlags::GroupWEP104) {
1094 ret |= NM_ACCESS_POINT_SEC_GROUP_WEP104;
1096 if (flags & TDENetworkWiFiAPFlags::GroupTKIP) {
1097 ret |= NM_ACCESS_POINT_SEC_GROUP_TKIP;
1099 if (flags & TDENetworkWiFiAPFlags::GroupCCMP) {
1100 ret |= NM_ACCESS_POINT_SEC_GROUP_CCMP;
1102 if (flags & TDENetworkWiFiAPFlags::KeyManagementPSK) {
1103 ret |= NM_ACCESS_POINT_SEC_KEY_MGMT_PSK;
1105 if (flags & TDENetworkWiFiAPFlags::KeyManagement80211) {
1106 ret |= NM_ACCESS_POINT_SEC_KEY_MGMT_802_1X;
1112 TDENetworkInfinibandTransportMode::TDENetworkInfinibandTransportMode nmIBTransportToTDEIBTransport(TQString nm) {
1113 TDENetworkInfinibandTransportMode::TDENetworkInfinibandTransportMode ret = TDENetworkInfinibandTransportMode::Other;
1115 if (nm.lower() ==
"datagram") {
1116 ret = TDENetworkInfinibandTransportMode::Datagram;
1118 else if (nm.lower() ==
"connected") {
1119 ret = TDENetworkInfinibandTransportMode::Connected;
1125 TQString tdeIBTransportToNMIBTransport(TDENetworkInfinibandTransportMode::TDENetworkInfinibandTransportMode mode) {
1128 if (mode == TDENetworkInfinibandTransportMode::Datagram) {
1131 else if (mode == TDENetworkInfinibandTransportMode::Connected) {
1138 TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString deviceNode) {
1139 if (d->m_networkManagerProxy) {
1140 TQT_DBusObjectPathList devices;
1141 TQT_DBusError error;
1143 ret = d->m_networkManagerProxy->GetDevices(devices, error);
1145 TQT_DBusObjectPathList::iterator it;
1146 for (it = devices.begin(); it != devices.end(); ++it) {
1147 DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, (*it));
1148 genericDevice.setConnection(TQT_DBusConnection::systemBus());
1149 TQString deviceInterface = genericDevice.getInterface(error);
1150 if (error.isValid()) {
1152 PRINT_ERROR((error.name() +
": " + error.message()))
1155 else if (deviceInterface == deviceNode) {
1159 return TQString::null;
1163 PRINT_ERROR((error.name() +
": " + error.message()))
1164 return TQString::null;
1168 return TQString::null;
1172 TQString tdeDeviceUUIDForGenericDevice(TQT_DBusObjectPath path) {
1173 TQT_DBusError error;
1174 DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, path);
1175 genericDevice.setConnection(TQT_DBusConnection::systemBus());
1176 TQString deviceInterface = genericDevice.getInterface(error);
1177 if (error.isValid()) {
1178 return TQString::null;
1181 TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
1183 return TQString::null;
1186 TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network);
1187 for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) {
1188 TDENetworkDevice* dev =
dynamic_cast<TDENetworkDevice*
>(*it);
1190 if (deviceInterface == dev->deviceNode()) {
1191 return dev->uniqueID();
1196 return TQString::null;
1199 TDENetworkConnectionManager_BackendNM_DBusSignalReceiver::TDENetworkConnectionManager_BackendNM_DBusSignalReceiver(TDENetworkConnectionManager_BackendNMPrivate* parent) : m_parent(parent) {
1203 TDENetworkConnectionManager_BackendNM_DBusSignalReceiver::~TDENetworkConnectionManager_BackendNM_DBusSignalReceiver() {
1207 void TDENetworkConnectionManager_BackendNM_DBusSignalReceiver::dbusSignal(
const TQT_DBusMessage& message) {
1208 if (message.type() == TQT_DBusMessage::SignalMessage) {
1209 TQString
interface = message.interface();
1210 TQString sender = message.sender();
1211 TQString member = message.member();
1212 TQString path = message.path();
1216 if (interface == NM_VPN_DBUS_CONNECTION_SERVICE) {
1217 if (member ==
"VpnStateChanged") {
1219 TQ_UINT32 state = message[0].toUInt32();
1220 TQ_UINT32 reason = message[1].toUInt32();
1221 if (state == NM_VPN_STATE_FAILED) {
1222 m_parent->internalProcessVPNFailure(reason);
1226 else if (interface == NM_DBUS_DEVICE_SERVICE) {
1227 if (path == m_parent->m_dbusDeviceString) {
1228 if (member ==
"StateChanged") {
1230 TQ_UINT32 new_state = message[0].toUInt32();
1231 TQ_UINT32 old_state = message[1].toUInt32();
1232 TQ_UINT32 reason = message[2].toUInt32();
1233 m_parent->internalProcessDeviceStateChanged(new_state, old_state, reason);
1240 TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TDENetworkDevice* networkDevice) : TDENetworkConnectionManager(networkDevice) {
1241 d =
new TDENetworkConnectionManager_BackendNMPrivate(
this);
1244 d->m_networkManagerProxy =
new DBus::NetworkManagerProxy(NM_DBUS_SERVICE, NM_DBUS_PATH);
1245 d->m_networkManagerProxy->setConnection(TQT_DBusConnection::systemBus());
1246 d->m_networkManagerSettings =
new DBus::SettingsInterface(NM_DBUS_SERVICE, NM_DBUS_PATH_SETTINGS);
1247 d->m_networkManagerSettings->setConnection(TQT_DBusConnection::systemBus());
1248 d->m_vpnProxy =
new DBus::VPNPluginProxy(NM_VPN_DBUS_PLUGIN_SERVICE, NM_VPN_DBUS_PLUGIN_PATH);
1249 d->m_vpnProxy->setConnection(TQT_DBusConnection::systemBus());
1251 d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
1252 if (!d->m_dbusDeviceString.isEmpty()) {
1253 d->m_networkDeviceProxy =
new DBus::DeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString);
1254 d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus());
1255 if (deviceType() == TDENetworkDeviceType::WiFi) {
1256 d->m_wiFiDeviceProxy =
new DBus::WiFiDeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString);
1257 d->m_wiFiDeviceProxy->setConnection(TQT_DBusConnection::systemBus());
1262 connect(d->m_networkManagerProxy, TQ_SIGNAL(StateChanged(TQ_UINT32)), d, TQ_SLOT(internalProcessGlobalStateChanged(TQ_UINT32)));
1265 if (d->m_vpnProxy) {
1266 connect(d->m_vpnProxy, TQ_SIGNAL(StateChanged(TQ_UINT32)), d, TQ_SLOT(internalProcessVPNStateChanged(TQ_UINT32)));
1267 connect(d->m_vpnProxy, TQ_SIGNAL(LoginBanner(
const TQString&)), d, TQ_SLOT(internalProcessVPNLoginBanner(
const TQString&)));
1268 connect(d->m_vpnProxy, TQ_SIGNAL(Failure(TQ_UINT32)), d, TQ_SLOT(internalProcessVPNFailure(TQ_UINT32)));
1272 if (d->m_networkDeviceProxy) {
1273 connect(d->m_networkDeviceProxy, TQ_SIGNAL(StateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)), d, TQ_SLOT(internalProcessDeviceStateChanged(TQ_UINT32, TQ_UINT32, TQ_UINT32)));
1275 if (d->m_wiFiDeviceProxy) {
1276 connect(d->m_wiFiDeviceProxy, TQ_SIGNAL(AccessPointAdded(
const TQT_DBusObjectPath&)), d, TQ_SLOT(internalProcessWiFiAccessPointAdded(
const TQT_DBusObjectPath&)));
1277 connect(d->m_wiFiDeviceProxy, TQ_SIGNAL(AccessPointRemoved(
const TQT_DBusObjectPath&)), d, TQ_SLOT(internalProcessWiFiAccessPointRemoved(
const TQT_DBusObjectPath&)));
1278 connect(d->m_wiFiDeviceProxy, TQ_SIGNAL(PropertiesChanged(
const TQMap<TQString, TQT_DBusVariant>&)), d, TQ_SLOT(internalProcessWiFiPropertiesChanged(
const TQMap<TQString, TQT_DBusVariant>&)));
1282 m_connectionList =
new TDENetworkConnectionList;
1283 m_hwNeighborList =
new TDENetworkHWNeighborList;
1289 TDENetworkConnectionManager_BackendNM::~TDENetworkConnectionManager_BackendNM() {
1291 clearTDENetworkConnectionList();
1292 delete m_connectionList;
1293 clearTDENetworkHWNeighborList();
1294 delete m_hwNeighborList;
1297 if (d->m_networkManagerProxy)
delete d->m_networkManagerProxy;
1298 if (d->m_networkManagerSettings)
delete d->m_networkManagerSettings;
1299 if (d->m_networkDeviceProxy)
delete d->m_networkDeviceProxy;
1304 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessGlobalStateChanged(TQ_UINT32 state) {
1305 m_parent->internalNetworkConnectionStateChanged(m_parent->backendStatus());
1308 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessVPNStateChanged(TQ_UINT32 state) {
1309 m_parent->internalNetworkConnectionStateChanged(m_parent->backendStatus());
1312 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessVPNLoginBanner(
const TQString& banner) {
1313 m_parent->internalVpnEvent(TDENetworkVPNEventType::LoginBanner, banner);
1316 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessVPNFailure(TQ_UINT32 reason) {
1319 m_parent->internalVpnEvent(TDENetworkVPNEventType::Failure, TQString(
"VPN connection attempt failed!<br>NetworkManager returned error %1.").arg(reason));
1322 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessDeviceStateChanged(TQ_UINT32 newState, TQ_UINT32 oldState, TQ_UINT32 reason) {
1325 if (m_prevDeviceState == newState)
return;
1326 m_prevDeviceState = newState;
1328 if (newState == NM_DEVICE_STATE_FAILED) {
1329 TQString errorString;
1330 if (reason == NM_DEVICE_STATE_REASON_NONE) {
1331 errorString = TQString(
"Connection attempt failed!");
1333 else if (reason == NM_DEVICE_STATE_REASON_UNKNOWN) {
1334 errorString = TQString(
"Connection attempt failed!<br>Unknown error detected.");
1336 else if (reason == NM_DEVICE_STATE_REASON_NOW_MANAGED) {
1337 errorString = TQString(
"Connection attempt failed!<br>Network device is now managed.");
1339 else if (reason == NM_DEVICE_STATE_REASON_NOW_UNMANAGED) {
1340 errorString = TQString(
"Connection attempt failed!<br>Network device is now unmanaged.");
1342 else if (reason == NM_DEVICE_STATE_REASON_CONFIG_FAILED) {
1343 errorString = TQString(
"Connection attempt failed!<br>Configuration failed.");
1345 else if (reason == NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE) {
1346 errorString = TQString(
"Connection attempt failed!<br>IP configuration unavailable.");
1348 else if (reason == NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED) {
1349 errorString = TQString(
"Connection attempt failed!<br>IP configuration expired.");
1351 else if (reason == NM_DEVICE_STATE_REASON_NO_SECRETS) {
1352 errorString =
i18n(
"Connection attempt failed!<br>Secrets were required to establish a connection, but no secrets were available.");
1354 else if (reason == NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT) {
1355 errorString = TQString(
"Connection attempt failed!<br>The supplicant was disconnected while attempting to establish a wireless connection.");
1357 else if (reason == NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED) {
1358 errorString = TQString(
"Connection attempt failed!<br>Supplicant configuration failed while attempting to establish a wireless connection.");
1360 else if (reason == NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED) {
1361 errorString =
i18n(
"Connection attempt failed!<br>The supplicant failed while attempting to establish a wireless connection.");
1363 else if (reason == NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT) {
1364 errorString =
i18n(
"Connection attempt failed!<br>The supplicant timed out while attempting to establish a wireless connection.");
1366 else if (reason == NM_DEVICE_STATE_REASON_PPP_START_FAILED) {
1367 errorString =
i18n(
"Connection attempt failed!<br>The PPP client failed to start.");
1369 else if (reason == NM_DEVICE_STATE_REASON_PPP_DISCONNECT) {
1370 errorString =
i18n(
"Connection attempt failed!<br>The PPP client was disconnected.");
1372 else if (reason == NM_DEVICE_STATE_REASON_PPP_FAILED) {
1373 errorString =
i18n(
"Connection attempt failed!<br>Unknown PPP failure.");
1375 else if (reason == NM_DEVICE_STATE_REASON_DHCP_START_FAILED) {
1376 errorString =
i18n(
"Connection attempt failed!<br>The DHCP client failed to start.");
1378 else if (reason == NM_DEVICE_STATE_REASON_DHCP_ERROR) {
1379 errorString =
i18n(
"Connection attempt failed!<br>The DHCP client encountered an error.");
1381 else if (reason == NM_DEVICE_STATE_REASON_DHCP_FAILED) {
1382 errorString =
i18n(
"Connection attempt failed!<br>Uknown DHCP failure.");
1384 else if (reason == NM_DEVICE_STATE_REASON_SHARED_START_FAILED) {
1385 errorString =
i18n(
"Connection attempt failed!<br>The connection sharing service failed to start.");
1387 else if (reason == NM_DEVICE_STATE_REASON_SHARED_FAILED) {
1388 errorString =
i18n(
"Connection attempt failed!<br>The connection sharing service encountered an error.");
1390 else if (reason == NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED) {
1391 errorString =
i18n(
"Connection attempt failed!<br>The AutoIP service failed to start.");
1393 else if (reason == NM_DEVICE_STATE_REASON_AUTOIP_ERROR) {
1394 errorString =
i18n(
"Connection attempt failed!<br>The AutoIP service encountered an error.");
1396 else if (reason == NM_DEVICE_STATE_REASON_AUTOIP_FAILED) {
1397 errorString =
i18n(
"Connection attempt failed!<br>Unknown AutoIP failure.");
1399 else if (reason == NM_DEVICE_STATE_REASON_MODEM_BUSY) {
1400 errorString =
i18n(
"Connection attempt failed!<br>Modem was busy.");
1402 else if (reason == NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE) {
1403 errorString =
i18n(
"Connection attempt failed!<br>No dial tone.");
1405 else if (reason == NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER) {
1406 errorString =
i18n(
"Connection attempt failed!<br>No carrier detected.");
1408 else if (reason == NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT) {
1409 errorString =
i18n(
"Connection attempt failed!<br>Modem timed out while dialing.");
1411 else if (reason == NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED) {
1412 errorString =
i18n(
"Connection attempt failed!<br>The modem failed to dial.");
1414 else if (reason == NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED) {
1415 errorString =
i18n(
"Connection attempt failed!<br>Modem initialization failed.");
1417 else if (reason == NM_DEVICE_STATE_REASON_GSM_APN_FAILED) {
1418 errorString =
i18n(
"Connection attempt failed!<br>GSM APN failure.");
1420 else if (reason == NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING) {
1421 errorString =
i18n(
"Connection attempt failed!<br>GSM registration failed to search for networks.");
1423 else if (reason == NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED) {
1424 errorString =
i18n(
"Connection attempt failed!<br>GSM registration attempt was rejected.");
1426 else if (reason == NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT) {
1427 errorString =
i18n(
"Connection attempt failed!<br>GSM registration attempt timed out.");
1429 else if (reason == NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED) {
1430 errorString =
i18n(
"Connection attempt failed!<br>GSM registration attempt failed.");
1432 else if (reason == NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED) {
1433 errorString =
i18n(
"Connection attempt failed!<br>GSM PIN check failed.");
1435 else if (reason == NM_DEVICE_STATE_REASON_FIRMWARE_MISSING) {
1436 errorString =
i18n(
"Connection attempt failed!<br>Network device firmware is missing.");
1438 else if (reason == NM_DEVICE_STATE_REASON_REMOVED) {
1439 errorString =
i18n(
"Connection attempt failed!<br>Network device was removed.");
1441 else if (reason == NM_DEVICE_STATE_REASON_SLEEPING) {
1442 errorString =
i18n(
"Connection attempt failed!<br>Network device is sleeping.");
1444 else if (reason == NM_DEVICE_STATE_REASON_CONNECTION_REMOVED) {
1445 errorString =
i18n(
"Connection attempt failed!<br>Connection was removed.");
1447 else if (reason == NM_DEVICE_STATE_REASON_USER_REQUESTED) {
1448 errorString =
i18n(
"Connection attempt failed!<br>User requested device disconnection.");
1450 else if (reason == NM_DEVICE_STATE_REASON_CARRIER) {
1451 errorString =
i18n(
"Connection attempt failed!<br>Carrier or link status changed.");
1453 else if (reason == NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED) {
1454 errorString =
i18n(
"Connection attempt failed!<br>Device and/or connection already active.");
1456 else if (reason == NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE) {
1457 errorString =
i18n(
"Connection attempt failed!<br>The supplicant is now available.");
1459 else if (reason == NM_DEVICE_STATE_REASON_MODEM_NOT_FOUND) {
1460 errorString =
i18n(
"Connection attempt failed!<br>Requested modem was not found.");
1462 else if (reason == NM_DEVICE_STATE_REASON_BT_FAILED) {
1463 errorString =
i18n(
"Connection attempt failed!<br>Bluetooth connection timeout.");
1465 else if (reason == NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED) {
1466 errorString =
i18n(
"Connection attempt failed!<br>GSM SIM not inserted.");
1468 else if (reason == NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED) {
1469 errorString =
i18n(
"Connection attempt failed!<br>GSM PIN required.");
1471 else if (reason == NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED) {
1472 errorString =
i18n(
"Connection attempt failed!<br>GSM PUK required.");
1474 else if (reason == NM_DEVICE_STATE_REASON_GSM_SIM_WRONG) {
1475 errorString =
i18n(
"Connection attempt failed!<br>GSM SIM incorrect.");
1477 else if (reason == NM_DEVICE_STATE_REASON_INFINIBAND_MODE) {
1478 errorString =
i18n(
"Connection attempt failed!<br>Incorrect Infiniband mode.");
1480 else if (reason == NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED) {
1481 errorString =
i18n(
"Connection attempt failed!<br>Dependency failure.");
1483 else if (reason == NM_DEVICE_STATE_REASON_BR2684_FAILED) {
1484 errorString =
i18n(
"Connection attempt failed!<br>Unknown bridge failure.");
1486 else if (reason == NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE) {
1487 errorString =
i18n(
"Connection attempt failed!<br>ModemManager not available.");
1489 else if (reason == NM_DEVICE_STATE_REASON_SSID_NOT_FOUND) {
1490 errorString =
i18n(
"Connection attempt failed!<br>SSID not found.");
1492 else if (reason == NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED) {
1493 errorString =
i18n(
"Connection attempt failed!<br>Secondary connection failure.");
1498 errorString = TQString(
"Connection attempt failed!<br>NetworkManager returned error %1.").arg(reason);
1500 m_parent->internalNetworkDeviceEvent(TDENetworkDeviceEventType::Failure, errorString);
1503 m_parent->internalNetworkDeviceStateChanged(nmDeviceStateToTDEDeviceState(newState), m_parent->deviceNode());
1506 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointAdded(
const TQT_DBusObjectPath& dbuspath) {
1507 TDENetworkWiFiAPInfo* apInfo = m_parent->getAccessPointDetails(dbuspath);
1509 if (!m_accessPointProxyList.contains(dbuspath)) {
1511 DBus::AccessPointProxy* apProxy =
new DBus::AccessPointProxy(NM_DBUS_SERVICE, dbuspath);
1512 apProxy->setConnection(TQT_DBusConnection::systemBus());
1513 connect(apProxy, TQ_SIGNAL(PropertiesChanged(
const TQMap<TQString, TQT_DBusVariant>&)),
this, TQ_SLOT(internalProcessAPPropertiesChanged(
const TQMap<TQString, TQT_DBusVariant>&)));
1514 m_accessPointProxyList[dbuspath] = (apProxy);
1517 m_parent->internalAccessPointStatusChanged(apInfo->BSSID, TDENetworkAPEventType::Discovered);
1523 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointRemoved(
const TQT_DBusObjectPath& dbuspath) {
1524 TDENetworkWiFiAPInfo* apInfo = m_parent->getAccessPointDetails(dbuspath);
1527 m_parent->internalAccessPointStatusChanged(apInfo->BSSID, TDENetworkAPEventType::Lost);
1531 DBus::AccessPointProxy* apProxy = m_accessPointProxyList[dbuspath];
1532 m_accessPointProxyList.remove(dbuspath);
1539 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiPropertiesChanged(
const TQMap<TQString, TQT_DBusVariant>& props) {
1540 if (m_wiFiDeviceProxy) {
1541 if (props.contains(
"ActiveAccessPoint")) {
1542 TQT_DBusError error;
1543 TDENetworkWiFiAPInfo* apInfo = m_parent->getAccessPointDetails(m_wiFiDeviceProxy->getActiveAccessPoint(error));
1545 m_parent->internalAccessPointStatusChanged(apInfo->BSSID, TDENetworkAPEventType::AccessPointChanged);
1548 else if (props.contains(
"Bitrate")) {
1549 m_parent->internalNetworkDeviceEvent(TDENetworkDeviceEventType::BitRateChanged, TQString::null);
1554 void TDENetworkConnectionManager_BackendNMPrivate::internalProcessAPPropertiesChanged(
const TQMap<TQString, TQT_DBusVariant>& props) {
1555 const DBus::AccessPointProxy* apProxy =
dynamic_cast<const DBus::AccessPointProxy*
>(sender());
1557 TQT_DBusError error;
1558 TDEMACAddress BSSID;
1559 BSSID.fromString(apProxy->getHwAddress(error));
1560 if (props.contains(
"Strength")) {
1561 m_parent->internalAccessPointStatusChanged(BSSID, TDENetworkAPEventType::SignalStrengthChanged);
1566 TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::deviceType() {
1567 if (!m_networkDevice) {
1568 return TDENetworkDeviceType::BackendOnly;
1572 TQT_DBusError error;
1573 d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
1574 if (!d->m_dbusDeviceString.isEmpty()) {
1575 DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
1576 genericDevice.setConnection(TQT_DBusConnection::systemBus());
1577 TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
1578 if (error.isValid()) {
1580 PRINT_ERROR((error.name() +
": " + error.message()))
1581 return TDENetworkDeviceType::Other;
1589 PRINT_ERROR(TQString(
"Invalid empty DBUS device string"))
1590 return TDENetworkDeviceType::Other;
1594 TDENetworkConnectionType::TDENetworkConnectionType TDENetworkConnectionManager_BackendNM::connectionType(TQString dbusPath) {
1595 TDENetworkConnectionType::TDENetworkConnectionType connType = TDENetworkConnectionType::Other;
1597 TQT_DBusError error;
1600 DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, dbusPath);
1601 connectionSettings.setConnection(TQT_DBusConnection::systemBus());
1602 connect(&connectionSettings, TQ_SIGNAL(GetSettingsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)));
1604 ret = connectionSettings.GetSettingsAsync(asyncCallID, error);
1605 if (ret && error.isValid()) {
1607 PRINT_ERROR((error.name() +
": " + error.message()))
1611 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
1612 TQTimer nmCallTimeoutTimer;
1613 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
1614 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
1615 tqApp->processEvents();
1616 if (!nmCallTimeoutTimer.isActive()) {
1617 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
1621 TQT_DBusTQStringDataMap connectionSettingsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
1622 if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
1623 PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() +
": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
1624 d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
1626 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
1627 if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
1628 d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
1632 TQT_DBusTQStringDataMap::const_iterator it2;
1633 for (it2 = connectionSettingsMap.begin(); it2 != connectionSettingsMap.end(); ++it2) {
1634 TQString outerKeyValue = it2.key();
1635 TQT_DBusData dataValue = it2.data();
1637 TQT_DBusTQStringDataMap nestedConnectionSettingsMap = dataValue.toStringKeyMap();
1638 TQT_DBusTQStringDataMap::const_iterator it3;
1639 for (it3 = nestedConnectionSettingsMap.begin(); it3 != nestedConnectionSettingsMap.end(); ++it3) {
1640 TQString keyValue = it3.key();
1641 TQT_DBusData dataValue = it3.data();
1642 if (dataValue.type() == TQT_DBusData::Variant) {
1643 TQT_DBusVariant dataValueVariant = dataValue.toVariant();
1644 TQT_DBusData dataValue2 = dataValueVariant.value;
1645 if (dataValue2.type() != TQT_DBusData::Variant) {
1646 if (outerKeyValue.lower() ==
"connection") {
1647 if (keyValue.lower() ==
"type") {
1648 connType = nmConnectionTypeToTDEConnectionType(dataValue2.toString());
1660 TQString TDENetworkConnectionManager_BackendNM::backendName() {
1661 return i18n(
"NetworkManager");
1664 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags TDENetworkConnectionManager_BackendNM::backendStatus() {
1665 if (d->m_networkManagerProxy) {
1667 TQT_DBusError error;
1668 ret = d->m_networkManagerProxy->getState(error);
1669 if (error.isValid()) {
1671 PRINT_ERROR((error.name() +
": " + error.message()))
1672 return TDENetworkGlobalManagerFlags::BackendUnavailable;
1675 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags globalFlags = nmGlobalStateToTDEGlobalState(ret);
1676 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags vpnFlags = TDENetworkGlobalManagerFlags::Unknown;
1677 if (d->m_vpnProxy) {
1678 ret = d->m_vpnProxy->getState(error);
1679 if (error.isValid()) {
1681 bool print_error =
true;
1682 if (error.name() ==
"org.freedesktop.DBus.Error.ServiceUnknown") {
1683 if (d->vpn_service_error_notified) {
1684 print_error =
false;
1687 d->vpn_service_error_notified =
true;
1691 PRINT_ERROR(TQString(
"Attempting to access the network-manager VPN service returned: %1").arg(error.name() +
": " + error.message()))
1693 vpnFlags = TDENetworkGlobalManagerFlags::VPNUnknown;
1696 vpnFlags = nmVPNStateToTDEGlobalState(ret);
1699 return globalFlags | vpnFlags;
1703 return TDENetworkGlobalManagerFlags::BackendUnavailable;
1707 TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceInformation() {
1708 TQT_DBusError error;
1709 TDENetworkDeviceInformation ret;
1711 if (d->m_networkDeviceProxy) {
1712 ret.statusFlags = nmDeviceStateToTDEDeviceState(d->m_networkDeviceProxy->getState(error));
1713 ret.UUID = d->m_networkDeviceProxy->getUdi(error);
1714 ret.backendDriver = d->m_networkDeviceProxy->getDriver(error);
1715 ret.backendDriverVersion = d->m_networkDeviceProxy->getDriverVersion(error);
1716 ret.firmwareVersion = d->m_networkDeviceProxy->getFirmwareVersion(error);
1717 ret.capabilityFlags = nmCapabilityFlagsToTDECapabilityFlags(d->m_networkDeviceProxy->getCapabilities(error));
1719 ret.managed = d->m_networkDeviceProxy->getManaged(error);
1720 ret.autoConnect = d->m_networkDeviceProxy->getAutoconnect(error);
1721 ret.firmwareMissing = d->m_networkDeviceProxy->getFirmwareMissing(error);
1722 ret.deviceType = nmDeviceTypeToTDEDeviceType(d->m_networkDeviceProxy->getDeviceType(error));
1723 if (error.isValid()) {
1725 bool print_error =
true;
1726 if (error.name() ==
"org.freedesktop.DBus.Error.AccessDenied") {
1727 if (error.message().contains(
"org.freedesktop.NetworkManager.Device")) {
1730 ret.autoConnect =
true;
1731 if (d->device_autoconnect_error_notified) {
1732 print_error =
false;
1735 d->device_autoconnect_error_notified =
true;
1740 PRINT_ERROR((error.name() +
": " + error.message()))
1744 error = TQT_DBusError();
1748 if ((deviceType() == TDENetworkDeviceType::WiFi) && (d->m_wiFiDeviceProxy)) {
1749 ret.wiFiInfo.valid =
true;
1750 ret.wiFiInfo.hwAddress.fromString(d->m_wiFiDeviceProxy->getHwAddress(error));
1751 ret.wiFiInfo.permanentHWAddress.fromString(d->m_wiFiDeviceProxy->getPermHwAddress(error));
1752 ret.wiFiInfo.operatingMode = nmWiFiModeToTDEWiFiMode(d->m_wiFiDeviceProxy->getMode(error));
1753 ret.wiFiInfo.bitrate = d->m_wiFiDeviceProxy->getBitrate(error);
1754 TDENetworkWiFiAPInfo* apInfo = getAccessPointDetails(d->m_wiFiDeviceProxy->getActiveAccessPoint(error));
1755 if (error.isValid()) {
1756 PRINT_ERROR((error.name() +
": " + error.message()))
1759 error = TQT_DBusError();
1762 ret.wiFiInfo.activeAccessPointBSSID = apInfo->BSSID;
1763 TDENetworkWiFiAPInfo* neighborListAPInfo = findAccessPointByBSSID(ret.wiFiInfo.activeAccessPointBSSID);
1764 if (neighborListAPInfo) {
1765 *neighborListAPInfo = *apInfo;
1770 ret.wiFiInfo.activeAccessPointBSSID = TDEMACAddress();
1772 ret.wiFiInfo.wirelessFlags = tdeWiFiFlagsToNMWiFiFlags(d->m_wiFiDeviceProxy->getWirelessCapabilities(error));
1775 ret.wiFiInfo.valid =
false;
1779 TQT_DBusObjectPath connectionPath = d->m_networkDeviceProxy->getActiveConnection(error);
1780 if (!error.isValid()) {
1781 DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, connectionPath);
1782 activeConnection.setConnection(TQT_DBusConnection::systemBus());
1783 ret.activeConnectionUUID = activeConnection.getUuid(error);
1784 if (error.isValid()) {
1785 ret.activeConnectionUUID = TQString::null;
1795 TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceStatus() {
1796 TQT_DBusError error;
1797 TDENetworkDeviceInformation ret;
1799 if (d->m_networkDeviceProxy) {
1800 ret.statusFlags = nmDeviceStateToTDEDeviceState(d->m_networkDeviceProxy->getState(error));
1801 ret.UUID = d->m_networkDeviceProxy->getUdi(error);
1804 TQT_DBusObjectPath connectionPath = d->m_networkDeviceProxy->getActiveConnection(error);
1805 if (!error.isValid()) {
1806 DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, connectionPath);
1807 activeConnection.setConnection(TQT_DBusConnection::systemBus());
1808 ret.activeConnectionUUID = activeConnection.getUuid(error);
1809 if (error.isValid()) {
1810 ret.activeConnectionUUID = TQString::null;
1820 void TDENetworkConnectionManager_BackendNMPrivate::processConnectionSettingsAsyncReply(
int asyncCallId,
const TQT_DBusDataMap<TQString>& settings) {
1821 nmConnectionSettingsAsyncCallWaiting[asyncCallId] =
false;
1822 nmConnectionSettingsAsyncSettingsResponse[asyncCallId] = settings;
1825 void TDENetworkConnectionManager_BackendNMPrivate::processConnectionSettingsUpdateAsyncReply(
int asyncCallId) {
1826 nmConnectionSettingsAsyncCallWaiting[asyncCallId] =
false;
1829 void TDENetworkConnectionManager_BackendNMPrivate::processAddConnectionAsyncReply(
int asyncCallId,
const TQT_DBusObjectPath& path) {
1830 nmConnectionSettingsAsyncCallWaiting[asyncCallId] =
false;
1831 nmAddConnectionAsyncResponse[asyncCallId] = path;
1834 void TDENetworkConnectionManager_BackendNMPrivate::processConnectionSettingsAsyncError(
int asyncCallId,
const TQT_DBusError error) {
1835 nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallId] = error;
1838 void TDENetworkConnectionManager_BackendNMPrivate::processConnectionSettingsUpdateAsyncError(
int asyncCallId,
const TQT_DBusError error) {
1839 nmConnectionSettingsUpdateAsyncSettingsErrorResponse[asyncCallId] = error;
1842 void TDENetworkConnectionManager_BackendNMPrivate::processAddConnectionAsyncError(
int asyncCallId,
const TQT_DBusError error) {
1843 nmAddConnectionAsyncErrorResponse[asyncCallId] = error;
1846 void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
1847 if (d->nonReentrantCallActive)
return;
1849 d->nonReentrantCallActive =
true;
1851 TDEMACAddress deviceMACAddress;
1852 deviceMACAddress.fromString(this->deviceMACAddress());
1854 if (d->m_networkManagerSettings) {
1855 clearTDENetworkConnectionList();
1856 TQT_DBusObjectPathList connections;
1857 TQT_DBusError error;
1860 ret = d->m_networkManagerSettings->ListConnections(connections, error);
1862 TQT_DBusObjectPathList::iterator it;
1863 for (it = connections.begin(); it != connections.end(); ++it) {
1864 TDENetworkConnection* connection;
1865 TDEWiredEthernetConnection* ethernetConnection = NULL;
1866 TDEWiredInfinibandConnection* infinibandConnection = NULL;
1867 TDEWiFiConnection* wiFiConnection = NULL;
1868 TDEVPNConnection* vpnConnection = NULL;
1869 TDEWiMaxConnection* wiMaxConnection = NULL;
1870 TDEVLANConnection* vlanConnection = NULL;
1871 TDEOLPCMeshConnection* olpcMeshConnection = NULL;
1872 TDEBluetoothConnection* bluetoothConnection = NULL;
1873 TDEModemConnection* modemConnection = NULL;
1874 TDENetworkConnectionType::TDENetworkConnectionType connType = connectionType((*it));
1875 if (connType == TDENetworkConnectionType::WiredEthernet) {
1876 connection = ethernetConnection =
new TDEWiredEthernetConnection;
1878 else if (connType == TDENetworkConnectionType::Infiniband) {
1879 connection = infinibandConnection =
new TDEWiredInfinibandConnection;
1881 else if (connType == TDENetworkConnectionType::WiFi) {
1882 connection = wiFiConnection =
new TDEWiFiConnection;
1884 else if (connType == TDENetworkConnectionType::VPN) {
1885 connection = vpnConnection =
new TDEVPNConnection;
1887 else if (connType == TDENetworkConnectionType::WiMax) {
1888 connection = wiMaxConnection =
new TDEWiMaxConnection;
1890 else if (connType == TDENetworkConnectionType::VLAN) {
1891 connection = vlanConnection =
new TDEVLANConnection;
1893 else if (connType == TDENetworkConnectionType::OLPCMesh) {
1894 connection = olpcMeshConnection =
new TDEOLPCMeshConnection;
1896 else if (connType == TDENetworkConnectionType::Bluetooth) {
1897 connection = bluetoothConnection =
new TDEBluetoothConnection;
1899 else if (connType == TDENetworkConnectionType::Modem) {
1900 connection = modemConnection =
new TDEModemConnection;
1903 connection =
new TDENetworkConnection;
1906 connection->ipConfig.connectionFlags = TDENetworkIPConfigurationFlags::IPV4DHCPIP | \
1907 TDENetworkIPConfigurationFlags::IPV4DHCPDNS | \
1908 TDENetworkIPConfigurationFlags::IPV4DHCPRoutes | \
1909 TDENetworkIPConfigurationFlags::IPV4MayUseAsDefaultRoute | \
1910 TDENetworkIPConfigurationFlags::IPV6DHCPIP | \
1911 TDENetworkIPConfigurationFlags::IPV6DHCPDNS | \
1912 TDENetworkIPConfigurationFlags::IPV6DHCPRoutes | \
1913 TDENetworkIPConfigurationFlags::IPV6MayUseAsDefaultRoute;
1918 connection->autoConnect =
true;
1920 if (wiFiConnection) {
1921 wiFiConnection->securitySettings.authType = TDENetworkWiFiAuthType::Open;
1924 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
1925 printf(
"[network-manager comm debug] %s\n", (*it).data()); fflush(stdout);
1929 DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, (*it));
1930 connectionSettings.setConnection(TQT_DBusConnection::systemBus());
1931 connect(&connectionSettings, TQ_SIGNAL(GetSettingsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)));
1932 connect(&connectionSettings, TQ_SIGNAL(AsyncErrorResponseDetected(
int,
const TQT_DBusError)), d, TQ_SLOT(processConnectionSettingsAsyncError(
int,
const TQT_DBusError)));
1934 ret = connectionSettings.GetSettingsAsync(asyncCallID, error);
1935 if (ret && error.isValid()) {
1937 PRINT_ERROR((error.name() +
": " + error.message()))
1941 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
1942 TQTimer nmCallTimeoutTimer;
1943 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
1944 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
1945 tqApp->processEvents();
1946 if (!nmCallTimeoutTimer.isActive()) {
1947 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
1951 TQT_DBusTQStringDataMap connectionSettingsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
1952 if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
1953 PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() +
": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
1954 d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
1956 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
1957 if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
1958 d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
1961 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
1962 printf(
"[network-manager comm debug] received DBUS object structure map follows:\n"); fflush(stdout);
1963 printDBUSObjectStructure(TQT_DBusData::fromStringKeyMap(connectionSettingsMap));
1967 TQT_DBusTQStringDataMap::const_iterator it2;
1968 for (it2 = connectionSettingsMap.begin(); it2 != connectionSettingsMap.end(); ++it2) {
1969 TQString outerKeyValue = it2.key();
1970 TQT_DBusData dataValue = it2.data();
1971 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
1972 printf(
"[network-manager comm debug] [%s]\n", outerKeyValue.ascii()); fflush(stdout);
1974 TQT_DBusTQStringDataMap nestedConnectionSettingsMap = dataValue.toStringKeyMap();
1975 TQT_DBusTQStringDataMap::const_iterator it3;
1976 for (it3 = nestedConnectionSettingsMap.begin(); it3 != nestedConnectionSettingsMap.end(); ++it3) {
1977 TQString keyValue = it3.key();
1978 TQT_DBusData dataValue = it3.data();
1979 if (dataValue.type() != TQT_DBusData::Variant) {
1980 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
1981 printf(
"[network-manager comm debug] %s = %s (type %d(%s))\n", keyValue.ascii(), dataValue.toString().ascii(), dataValue.type(), dataValue.typeName()); fflush(stdout);
1986 TQT_DBusVariant dataValueVariant = dataValue.toVariant();
1987 TQT_DBusData dataValue2 = dataValueVariant.value;
1988 if (dataValue2.type() != TQT_DBusData::Variant) {
1989 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
1990 printf(
"[network-manager comm debug] %s = %s (type %d(%s), signature %s)\n", keyValue.ascii(), dataValue2.toString().ascii(), dataValue2.type(), dataValue2.typeName(), dataValueVariant.signature.ascii()); fflush(stdout);
1993 if (outerKeyValue.lower() ==
"connection") {
1994 if (keyValue.lower() ==
"id") {
1995 connection->friendlyName = dataValue2.toString();
1997 else if (keyValue.lower() ==
"uuid") {
1998 connection->UUID = dataValue2.toString().lower();
2000 else if (keyValue.lower() ==
"permissions") {
2001 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2002 TQT_DBusDataValueList::const_iterator it4;
2003 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2004 TQT_DBusData innerDataValue = *it4;
2005 TQString authString = innerDataValue.toString();
2006 TQStringList pieces = TQStringList::split(
":", authString);
2007 if (pieces[0].lower() ==
"user") {
2008 connection->authorizedUsers.append(pieces[1]);
2012 else if (keyValue.lower() ==
"autoconnect") {
2013 connection->autoConnect = dataValue2.toBool();
2015 else if (keyValue.lower() ==
"read-only") {
2016 connection->readOnly = dataValue2.toBool();
2018 else if (keyValue.lower() ==
"master") {
2019 connection->masterConnectionUUID = dataValue2.toString().lower();
2021 else if (keyValue.lower() ==
"slave-type") {
2022 connection->slaveType = nmSlaveTypeToTDESlaveType(dataValue2.toString());
2024 else if (keyValue.lower() ==
"timestamp") {
2025 connection->lastKnownConnection.setTime_t(dataValue2.toUInt64());
2028 else if (outerKeyValue.lower() ==
"802-1x") {
2029 if (keyValue.lower() ==
"eap") {
2030 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2031 TQT_DBusDataValueList::const_iterator it4;
2033 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2034 TQT_DBusData innerDataValue = *it4;
2037 connection->eapConfig.type = nmEAPTypeToTDEEAPType(innerDataValue.toString());
2042 else if (keyValue.lower() ==
"identity") {
2043 connection->eapConfig.userName = dataValue2.toString();
2045 else if (keyValue.lower() ==
"anonymous-identity") {
2046 connection->eapConfig.anonymousUserName = dataValue2.toString();
2048 else if (keyValue.lower() ==
"pac-file") {
2049 connection->eapConfig.pacFileName = dataValue2.toString();
2051 else if (keyValue.lower() ==
"ca-cert") {
2052 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2053 TQT_DBusDataValueList::const_iterator it4;
2055 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2056 TQT_DBusData innerDataValue = *it4;
2058 connection->eapConfig.caCertificate.resize(count+1);
2059 connection->eapConfig.caCertificate[count] = innerDataValue.toByte();
2062 else if (keyValue.lower() ==
"ca-path") {
2063 connection->eapConfig.additionalCAFilesPath = dataValue2.toString();
2065 else if (keyValue.lower() ==
"subject-match") {
2066 connection->eapConfig.authServerCertSubjectMatch = dataValue2.toString();
2068 else if (keyValue.lower() ==
"altsubject-matches") {
2069 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2070 TQT_DBusDataValueList::const_iterator it4;
2071 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2072 TQT_DBusData innerDataValue = *it4;
2073 connection->eapConfig.alternateAuthServerCertSubjectMatch.append(innerDataValue.toString());
2076 else if (keyValue.lower() ==
"client-cert") {
2077 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2078 TQT_DBusDataValueList::const_iterator it4;
2080 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2081 TQT_DBusData innerDataValue = *it4;
2083 connection->eapConfig.clientCertificate.resize(count+1);
2084 connection->eapConfig.clientCertificate[count] = innerDataValue.toByte();
2087 else if (keyValue.lower() ==
"phase1-peapver") {
2088 connection->eapConfig.forcePEAPVersion = dataValue2.toString();
2090 else if (keyValue.lower() ==
"phase1-peaplabel") {
2091 connection->eapConfig.forcePEAPLabel = dataValue2.toString();
2093 else if (keyValue.lower() ==
"phase1-fast-provisioning") {
2094 connection->eapConfig.fastProvisioningFlags = nmEAPFastFlagsToTDEEAPFastFlags(dataValue2.toString());
2096 else if (keyValue.lower() ==
"phase2-auth") {
2097 connection->eapConfig.phase2NonEAPAuthMethod = nmEAPTypeToTDEEAPType(dataValue2.toString());
2099 else if (keyValue.lower() ==
"phase2-autheap") {
2100 connection->eapConfig.phase2EAPAuthMethod = nmEAPTypeToTDEEAPType(dataValue2.toString());
2102 else if (keyValue.lower() ==
"phase2-ca-cert") {
2103 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2104 TQT_DBusDataValueList::const_iterator it4;
2106 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2107 TQT_DBusData innerDataValue = *it4;
2109 connection->eapConfig.phase2CaCertificate.resize(count+1);
2110 connection->eapConfig.phase2CaCertificate[count] = innerDataValue.toByte();
2113 else if (keyValue.lower() ==
"phase2-ca-path") {
2114 connection->eapConfig.phase2CaFilesPath = dataValue2.toString();
2116 else if (keyValue.lower() ==
"phase2-subject-match") {
2117 connection->eapConfig.phase2AuthServerCertSubjectMatch = dataValue2.toString();
2119 else if (keyValue.lower() ==
"phase2-altsubject-matches") {
2120 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2121 TQT_DBusDataValueList::const_iterator it4;
2122 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2123 TQT_DBusData innerDataValue = *it4;
2124 connection->eapConfig.phase2AlternateAuthServerCertSubjectMatch.append(innerDataValue.toString());
2127 else if (keyValue.lower() ==
"phase2-client-cert") {
2128 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2129 TQT_DBusDataValueList::const_iterator it4;
2131 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2132 TQT_DBusData innerDataValue = *it4;
2134 connection->eapConfig.phase2ClientCertificate.resize(count+1);
2135 connection->eapConfig.phase2ClientCertificate[count] = innerDataValue.toByte();
2138 else if (keyValue.lower() ==
"password-flags") {
2139 connection->eapConfig.passwordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2141 else if (keyValue.lower() ==
"password-raw-flags") {
2142 connection->eapConfig.binaryPasswordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2144 else if (keyValue.lower() ==
"private-key") {
2145 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2146 TQT_DBusDataValueList::const_iterator it4;
2148 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2149 TQT_DBusData innerDataValue = *it4;
2151 connection->eapConfig.privateKey.resize(count+1);
2152 connection->eapConfig.privateKey[count] = innerDataValue.toByte();
2155 else if (keyValue.lower() ==
"private-key-password-flags") {
2156 connection->eapConfig.privateKeyPasswordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2158 else if (keyValue.lower() ==
"phase2-private-key") {
2159 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2160 TQT_DBusDataValueList::const_iterator it4;
2162 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2163 TQT_DBusData innerDataValue = *it4;
2165 connection->eapConfig.phase2PrivateKey.resize(count+1);
2166 connection->eapConfig.phase2PrivateKey[count] = innerDataValue.toByte();
2169 else if (keyValue.lower() ==
"phase2-private-key-password-flags") {
2170 connection->eapConfig.phase2PrivateKeyPasswordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2172 else if (keyValue.lower() ==
"system-ca-certs") {
2173 connection->eapConfig.forceSystemCaCertificates = dataValue2.toBool();
2175 connection->eapConfig.valid =
true;
2177 else if (outerKeyValue.lower() ==
"802-3-ethernet") {
2178 if (keyValue.lower() ==
"duplex") {
2179 connection->fullDuplex = (dataValue2.toString().lower() ==
"full")?
true:
false;
2181 else if (keyValue.lower() ==
"mac-address") {
2182 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2183 TQT_DBusDataValueList::const_iterator it4;
2184 TDENetworkByteList macAddress;
2185 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2186 TQT_DBusData innerDataValue = *it4;
2187 macAddress.append(innerDataValue.toByte());
2189 connection->lockedHWAddress.setAddress(macAddress);
2191 else if (keyValue.lower() ==
"cloned-mac-address") {
2192 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2193 TQT_DBusDataValueList::const_iterator it4;
2194 TDENetworkByteList macAddress;
2195 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2196 TQT_DBusData innerDataValue = *it4;
2197 macAddress.append(innerDataValue.toByte());
2199 connection->manualHWAddress.setAddress(macAddress);
2201 else if (keyValue.lower() ==
"mtu") {
2202 connection->mtu = dataValue2.toUInt32();
2205 else if (outerKeyValue.lower() ==
"infiniband") {
2206 if (keyValue.lower() ==
"mac-address") {
2207 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2208 TQT_DBusDataValueList::const_iterator it4;
2209 TDENetworkByteList macAddress;
2210 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2211 TQT_DBusData innerDataValue = *it4;
2212 macAddress.append(innerDataValue.toByte());
2214 connection->lockedHWAddress.setAddress(macAddress);
2216 else if (keyValue.lower() ==
"mtu") {
2217 connection->mtu = dataValue2.toUInt32();
2219 else if (keyValue.lower() ==
"transport-mode") {
2220 infinibandConnection->transportMode = nmIBTransportToTDEIBTransport(dataValue2.toString());
2223 else if (outerKeyValue.lower() ==
"802-11-wireless") {
2224 if (keyValue.lower() ==
"ssid") {
2225 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2226 TQT_DBusDataValueList::const_iterator it4;
2228 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2229 TQT_DBusData innerDataValue = *it4;
2230 wiFiConnection->SSID.resize(count+1);
2231 wiFiConnection->SSID[count] = innerDataValue.toByte();
2235 else if (keyValue.lower() ==
"mac-address") {
2236 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2237 TQT_DBusDataValueList::const_iterator it4;
2238 TDENetworkByteList macAddress;
2239 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2240 TQT_DBusData innerDataValue = *it4;
2241 macAddress.append(innerDataValue.toByte());
2243 connection->lockedHWAddress.setAddress(macAddress);
2245 else if (keyValue.lower() ==
"cloned-mac-address") {
2246 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2247 TQT_DBusDataValueList::const_iterator it4;
2248 TDENetworkByteList macAddress;
2249 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2250 TQT_DBusData innerDataValue = *it4;
2251 macAddress.append(innerDataValue.toByte());
2253 connection->manualHWAddress.setAddress(macAddress);
2255 else if (keyValue.lower() ==
"mtu") {
2256 connection->mtu = dataValue2.toUInt32();
2258 else if (keyValue.lower() ==
"mode") {
2259 wiFiConnection->operatingMode = nmWiFiModeToTDEWiFiMode(dataValue2.toString());
2261 else if (keyValue.lower() ==
"band") {
2262 wiFiConnection->bandRestriction = nmWiFiFrequencyBandToTDEWiFiFrequencyBand(dataValue2.toString());
2264 else if (keyValue.lower() ==
"channel") {
2265 wiFiConnection->channelRestriction = dataValue2.toUInt32();
2266 if (wiFiConnection->channelRestriction == 0) wiFiConnection->channelRestriction = -1;
2268 else if (keyValue.lower() ==
"rate") {
2269 wiFiConnection->bitRateRestriction = dataValue2.toUInt32()*1000;
2270 if (wiFiConnection->bitRateRestriction == 0) wiFiConnection->bitRateRestriction = -1;
2272 else if (keyValue.lower() ==
"tx-power") {
2273 wiFiConnection->powerRestriction = dataValue2.toUInt32();
2274 if (wiFiConnection->powerRestriction == 0) wiFiConnection->powerRestriction = -1;
2276 else if (keyValue.lower() ==
"bssid") {
2277 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2278 TQT_DBusDataValueList::const_iterator it4;
2279 TDENetworkByteList macAddress;
2280 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2281 TQT_DBusData innerDataValue = *it4;
2282 macAddress.append(innerDataValue.toByte());
2284 wiFiConnection->accessPointRestriction.setAddress(macAddress);
2286 else if (keyValue.lower() ==
"mac-address-blacklist") {
2287 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2288 TQT_DBusDataValueList::const_iterator it4;
2289 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2290 TQT_DBusData innerDataValue = *it4;
2291 TDEMACAddress hwAddress;
2292 hwAddress.fromString(innerDataValue.toString());
2293 wiFiConnection->blacklistedBSSIDs.append(hwAddress);
2296 else if (keyValue.lower() ==
"seen-bssids") {
2297 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2298 TQT_DBusDataValueList::const_iterator it4;
2299 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2300 TQT_DBusData innerDataValue = *it4;
2301 TDEMACAddress hwAddress;
2302 hwAddress.fromString(innerDataValue.toString());
2303 wiFiConnection->heardBSSIDs.append(hwAddress);
2306 else if (keyValue.lower() ==
"security") {
2308 if (setting.lower() ==
"802-11-wireless-security") {
2309 wiFiConnection->securityRequired =
true;
2312 wiFiConnection->securityRequired =
false;
2315 else if (keyValue.lower() ==
"hidden") {
2316 wiFiConnection->isHiddenNetwork = dataValue2.toBool();
2319 else if ((outerKeyValue.lower() ==
"802-11-wireless-security") && (wiFiConnection)) {
2320 if (keyValue.lower() ==
"key-mgmt") {
2321 wiFiConnection->securitySettings.keyType = nmWiFiKeyTypeToTDEWiFiKeyType(dataValue2.toString());
2323 else if (keyValue.lower() ==
"wep-tx-keyidx") {
2324 wiFiConnection->securitySettings.wepKeyIndex = dataValue2.toUInt32();
2326 else if (keyValue.lower() ==
"auth-alg") {
2327 wiFiConnection->securitySettings.authType = nmWiFiAuthTypeToTDEWiFiAuthType(dataValue2.toString());
2329 else if (keyValue.lower() ==
"proto") {
2330 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2331 TQT_DBusDataValueList::const_iterator it4;
2332 TQStringList strings;
2333 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2334 TQT_DBusData innerDataValue = *it4;
2335 strings.append(innerDataValue.toString());
2337 wiFiConnection->securitySettings.wpaVersion = nmWiFiWPAVersionToTDEWiFiWPAVersion(strings);
2339 else if (keyValue.lower() ==
"pairwise") {
2340 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2341 TQT_DBusDataValueList::const_iterator it4;
2342 TQStringList strings;
2343 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2344 TQT_DBusData innerDataValue = *it4;
2345 wiFiConnection->securitySettings.allowedPairWiseCiphers.append(nmWiFiCipherToTDEWiFiCipher(innerDataValue.toString()));
2347 if ((wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40))
2348 || (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104))
2349 || (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP))
2350 || (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP))) {
2351 wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any);
2354 else if (keyValue.lower() ==
"group") {
2355 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2356 TQT_DBusDataValueList::const_iterator it4;
2357 TQStringList strings;
2358 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2359 TQT_DBusData innerDataValue = *it4;
2360 wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(nmWiFiCipherToTDEWiFiCipher(innerDataValue.toString()));
2362 if ((wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40))
2363 || (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104))
2364 || (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP))
2365 || (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP))) {
2366 wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any);
2369 else if (keyValue.lower() ==
"leap-username") {
2370 wiFiConnection->securitySettings.leapUsername = dataValue2.toString();
2372 else if (keyValue.lower() ==
"wep-key-flags") {
2373 wiFiConnection->securitySettings.wepKeyFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2375 else if (keyValue.lower() ==
"wep-key-type") {
2376 wiFiConnection->securitySettings.wepKeyType = nmWepKeyTypeToTDEWepKeyType(dataValue2.toUInt32());
2378 else if (keyValue.lower() ==
"psk-flags") {
2379 wiFiConnection->securitySettings.pskFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2381 else if (keyValue.lower() ==
"leap-password-flags") {
2382 wiFiConnection->securitySettings.leapPasswordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2384 wiFiConnection->securitySettings.valid =
true;
2386 else if (outerKeyValue.lower() ==
"vpn") {
2387 if (keyValue.lower() ==
"service-type") {
2388 TQString plugin = dataValue2.toString();
2389 plugin.replace(
"org.freedesktop.NetworkManager.",
"");
2390 vpnConnection->vpnPluginID = plugin;
2392 else if (keyValue.lower() ==
"user-name") {
2393 vpnConnection->lockedUserName = dataValue2.toString();
2395 else if (keyValue.lower() ==
"data") {
2396 vpnConnection->pluginData.clear();
2397 TQT_DBusTQStringDataMap nestedConnectionSettingsMap = dataValue2.toStringKeyMap();
2398 TQT_DBusTQStringDataMap::const_iterator it4;
2399 for (it4 = nestedConnectionSettingsMap.begin(); it4 != nestedConnectionSettingsMap.end(); ++it4) {
2400 TQString keyValue4 = it4.key();
2401 TQT_DBusData dataValue4 = it4.data();
2402 if (dataValue4.type() == TQT_DBusData::String) {
2403 vpnConnection->pluginData[keyValue4] = dataValue4.toString();
2408 else if (outerKeyValue.lower() ==
"wimax") {
2409 if (keyValue.lower() ==
"mac-address") {
2410 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2411 TQT_DBusDataValueList::const_iterator it4;
2412 TDENetworkByteList macAddress;
2413 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2414 TQT_DBusData innerDataValue = *it4;
2415 macAddress.append(innerDataValue.toByte());
2417 connection->lockedHWAddress.setAddress(macAddress);
2419 else if (keyValue.lower() ==
"network-name") {
2420 wiMaxConnection->networkServiceProvider = dataValue2.toString();
2423 else if (outerKeyValue.lower() ==
"vlan") {
2424 if (keyValue.lower() ==
"interface-name") {
2425 vlanConnection->kernelName = dataValue2.toString();
2427 else if (keyValue.lower() ==
"parent") {
2428 vlanConnection->parentConnectionUUID = dataValue2.toString();
2430 else if (keyValue.lower() ==
"id") {
2431 vlanConnection->vlanID = dataValue2.toUInt32();
2433 else if (keyValue.lower() ==
"flags") {
2434 vlanConnection->vlanFlags = nmVLANFlagsToTDEVLANFlags(dataValue2.toUInt32());
2436 else if (keyValue.lower() ==
"ingress-priority-map") {
2437 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2438 TQT_DBusDataValueList::const_iterator it4;
2439 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2440 TQT_DBusData innerDataValue = *it4;
2441 TQStringList pieces = TQStringList::split(
":", innerDataValue.toString(),
true);
2442 vlanConnection->ingressPriorityMap[pieces[0].toUInt()] = pieces[1].toUInt();;
2445 else if (keyValue.lower() ==
"egress-priority-map") {
2446 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2447 TQT_DBusDataValueList::const_iterator it4;
2448 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2449 TQT_DBusData innerDataValue = *it4;
2450 TQStringList pieces = TQStringList::split(
":", innerDataValue.toString(),
true);
2451 vlanConnection->egressPriorityMap[pieces[0].toUInt()] = pieces[1].toUInt();;
2455 else if (outerKeyValue.lower() ==
"serial") {
2456 if (keyValue.lower() ==
"baud") {
2457 connection->serialConfig.baudRate = dataValue2.toUInt32();
2459 else if (keyValue.lower() ==
"bits") {
2460 connection->serialConfig.byteWidth = dataValue2.toUInt32();
2462 else if (keyValue.lower() ==
"parity") {
2463 connection->serialConfig.parity = nmParityToTDEParity(dataValue2.toByte());
2465 else if (keyValue.lower() ==
"stopbits") {
2466 connection->serialConfig.stopBits = dataValue2.toUInt32();
2468 else if (keyValue.lower() ==
"send-delay") {
2469 connection->serialConfig.txDelay = dataValue2.toUInt64();
2471 connection->serialConfig.valid =
true;
2473 else if (outerKeyValue.lower() ==
"ppp") {
2474 if (keyValue.lower() ==
"noauth") {
2475 connection->pppConfig.requireServerAuthentication = !(dataValue2.toBool());
2477 else if (keyValue.lower() ==
"refuse-eap") {
2478 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableEAP;
2479 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableEAP;
2481 else if (keyValue.lower() ==
"refuse-pap") {
2482 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisablePAP;
2483 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisablePAP;
2485 else if (keyValue.lower() ==
"refuse-chap") {
2486 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableCHAP;
2487 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableCHAP;
2489 else if (keyValue.lower() ==
"refuse-mschap") {
2490 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableMSCHAP;
2491 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableMSCHAP;
2493 else if (keyValue.lower() ==
"refuse-mschapv2") {
2494 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableMSCHAPv2;
2495 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableMSCHAPv2;
2497 else if (keyValue.lower() ==
"nobsdcomp") {
2498 if (dataValue2.toBool()) connection->pppConfig.flags &= ~TDENetworkPPPFlags::AllowBSDCompression;
2499 else connection->pppConfig.flags |= TDENetworkPPPFlags::AllowBSDCompression;
2501 else if (keyValue.lower() ==
"nodeflate") {
2502 if (dataValue2.toBool()) connection->pppConfig.flags &= ~TDENetworkPPPFlags::AllowDeflateCompression;
2503 else connection->pppConfig.flags |= TDENetworkPPPFlags::AllowDeflateCompression;
2505 else if (keyValue.lower() ==
"no-vj-comp") {
2506 if (dataValue2.toBool()) connection->pppConfig.flags &= ~TDENetworkPPPFlags::AllowVJCompression;
2507 else connection->pppConfig.flags |= TDENetworkPPPFlags::AllowVJCompression;
2509 else if (keyValue.lower() ==
"require-mppe") {
2510 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::RequireMPPE;
2511 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::RequireMPPE;
2513 else if (keyValue.lower() ==
"require-mppe-128") {
2514 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::RequireMPPE128;
2515 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::RequireMPPE128;
2517 else if (keyValue.lower() ==
"mppe-stateful") {
2518 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::StatefulMPPE;
2519 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::StatefulMPPE;
2521 else if (keyValue.lower() ==
"crtscts") {
2522 if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::UseHardwareFlowControl;
2523 else connection->pppConfig.flags &= ~TDENetworkPPPFlags::UseHardwareFlowControl;
2525 else if (keyValue.lower() ==
"baud") {
2526 connection->pppConfig.baudRate = dataValue2.toUInt32();
2528 else if (keyValue.lower() ==
"mru") {
2529 connection->pppConfig.mru = dataValue2.toUInt32();
2531 else if (keyValue.lower() ==
"mtu") {
2532 connection->pppConfig.mtu = dataValue2.toUInt32();
2534 else if (keyValue.lower() ==
"lcp-echo-interval") {
2535 connection->pppConfig.lcpEchoPingInterval = dataValue2.toUInt32();
2537 else if (keyValue.lower() ==
"lcp-echo-failure") {
2538 connection->pppConfig.lcpEchoFailureThreshold = dataValue2.toUInt32();
2540 connection->pppConfig.valid =
true;
2542 else if (outerKeyValue.lower() ==
"pppoe") {
2543 if (keyValue.lower() ==
"service") {
2544 connection->pppoeConfig.networkServiceProvider = dataValue2.toString();
2546 else if (keyValue.lower() ==
"username") {
2547 connection->pppoeConfig.username = dataValue2.toString();
2549 else if (keyValue.lower() ==
"password-flags") {
2550 connection->pppoeConfig.passwordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2552 connection->pppoeConfig.secretsValid =
true;
2554 else if ((outerKeyValue.lower() ==
"802-11-olpc-mesh") && (olpcMeshConnection)) {
2555 if (keyValue.lower() ==
"ssid") {
2556 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2557 TQT_DBusDataValueList::const_iterator it4;
2559 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2560 TQT_DBusData innerDataValue = *it4;
2561 olpcMeshConnection->SSID.resize(count+1);
2562 olpcMeshConnection->SSID[count] = innerDataValue.toByte();
2566 else if (keyValue.lower() ==
"channel") {
2567 olpcMeshConnection->channel = dataValue2.toUInt32();
2569 else if (keyValue.lower() ==
"dhcp-anycast-address") {
2570 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2571 TQT_DBusDataValueList::const_iterator it4;
2573 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2574 TQT_DBusData innerDataValue = *it4;
2575 olpcMeshConnection->anycastDHCPHWAddress.resize(count+1);
2576 olpcMeshConnection->anycastDHCPHWAddress[count] = innerDataValue.toByte();
2581 else if ((outerKeyValue.lower() ==
"bluetooth") && (bluetoothConnection)) {
2582 if (keyValue.lower() ==
"bdaddr") {
2583 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2584 TQT_DBusDataValueList::const_iterator it4;
2585 TDENetworkByteList macAddress;
2586 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2587 TQT_DBusData innerDataValue = *it4;
2588 macAddress.append(innerDataValue.toByte());
2590 connection->lockedHWAddress.setAddress(macAddress);
2592 else if (keyValue.lower() ==
"type") {
2593 bluetoothConnection->type = nmBluetoothModeToTDEBluetoothMode(dataValue2.toString());
2596 else if ((outerKeyValue.lower() ==
"cdma") && (modemConnection)) {
2597 if (keyValue.lower() ==
"number") {
2598 modemConnection->cdmaConfig.providerDataNumber = dataValue2.toString();
2600 else if (keyValue.lower() ==
"username") {
2601 modemConnection->cdmaConfig.username = dataValue2.toString();
2603 else if (keyValue.lower() ==
"password-flags") {
2604 modemConnection->cdmaConfig.passwordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2606 modemConnection->type = TDEModemConnectionType::CDMA;
2607 modemConnection->cdmaConfig.valid =
true;
2609 else if ((outerKeyValue.lower() ==
"gsm") && (modemConnection)) {
2610 if (keyValue.lower() ==
"number") {
2611 modemConnection->gsmConfig.providerDataNumber = dataValue2.toString();
2613 else if (keyValue.lower() ==
"username") {
2614 modemConnection->gsmConfig.username = dataValue2.toString();
2616 else if (keyValue.lower() ==
"password-flags") {
2617 modemConnection->gsmConfig.passwordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2619 else if (keyValue.lower() ==
"apn") {
2620 modemConnection->gsmConfig.accessPointName = dataValue2.toString();
2622 else if (keyValue.lower() ==
"network-id") {
2623 modemConnection->gsmConfig.networkID = dataValue2.toString();
2625 else if (keyValue.lower() ==
"network-type") {
2626 modemConnection->gsmConfig.networkType = nmGSMModeToTDEGSMMode(dataValue2.toInt32());
2628 else if (keyValue.lower() ==
"pin-flags") {
2629 modemConnection->gsmConfig.pinFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32());
2631 else if (keyValue.lower() ==
"allowed-bands") {
2632 modemConnection->gsmConfig.allowedFrequencyBands = dataValue2.toUInt32();
2634 else if (keyValue.lower() ==
"home-only") {
2635 modemConnection->gsmConfig.allowRoaming = !dataValue2.toBool();
2637 modemConnection->type = TDEModemConnectionType::GSM;
2638 modemConnection->gsmConfig.valid =
true;
2640 else if (outerKeyValue.lower() ==
"ipv4") {
2641 if (keyValue.lower() ==
"addresses") {
2642 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2643 TQT_DBusDataValueList::const_iterator it4;
2644 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2645 TQT_DBusData innerDataValue = *it4;
2646 TQT_DBusDataValueList innerValueList = innerDataValue.toTQValueList();
2647 TQT_DBusDataValueList::const_iterator it5;
2649 TDENetworkSingleIPConfiguration ipConfig;
2650 for (it5 = innerValueList.begin(); it5 != innerValueList.end(); ++it5) {
2651 TQT_DBusData innerMostDataValue = *it5;
2654 ipConfig.ipAddress = TQHostAddress(reverseIPV4ByteOrder(innerMostDataValue.toUInt32()));
2656 else if (state == 1) {
2658 ipConfig.networkMask.fromCIDRMask(innerMostDataValue.toUInt32());
2660 else if (state == 2) {
2662 ipConfig.gateway = TQHostAddress(reverseIPV4ByteOrder(innerMostDataValue.toUInt32()));
2666 ipConfig.valid =
true;
2667 connection->ipConfig.ipConfigurations.append(ipConfig);
2670 else if (keyValue.lower() ==
"dhcp-client-id") {
2671 connection->ipConfig.dhcpClientIdentifier = dataValue2.toString();
2673 else if (keyValue.lower() ==
"dns") {
2674 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2675 TQT_DBusDataValueList::const_iterator it4;
2676 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2677 TQT_DBusData innerDataValue = *it4;
2678 connection->ipConfig.resolvers.append(TQHostAddress(reverseIPV4ByteOrder(innerDataValue.toUInt32())));
2681 else if (keyValue.lower() ==
"dns-search") {
2682 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2683 TQT_DBusDataValueList::const_iterator it4;
2684 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2685 TQT_DBusData innerDataValue = *it4;
2686 connection->ipConfig.searchDomains.append(TDENetworkSearchDomain(innerDataValue.toString(),
false));
2689 else if (keyValue.lower() ==
"ignore-auto-dns") {
2690 bool nm_static_dns = dataValue2.toBool();
2691 if (nm_static_dns) {
2692 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4DHCPDNS;
2695 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPDNS;
2698 else if (keyValue.lower() ==
"may-fail") {
2699 bool nm_may_fail = dataValue2.toBool();
2700 connection->requireIPV4 = !nm_may_fail;
2702 else if (keyValue.lower() ==
"method") {
2703 TQString nm_method = dataValue2.toString().lower();
2704 if (nm_method ==
"auto") {
2705 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPIP;
2707 else if (nm_method ==
"manual") {
2708 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4DHCPIP;
2710 else if (nm_method ==
"link-local") {
2711 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4LocalOnly;
2713 else if (nm_method ==
"shared") {
2714 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4StartConnectionSharingServer;
2716 else if (nm_method ==
"disabled") {
2717 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4Disabled;
2720 else if (keyValue.lower() ==
"ignore-auto-routes") {
2721 bool nm_static_routes = dataValue2.toBool();
2722 if (nm_static_routes) {
2723 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4DHCPRoutes;
2726 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPRoutes;
2729 else if (keyValue.lower() ==
"never-default") {
2730 bool nm_can_default_route = !dataValue2.toBool();
2731 if (nm_can_default_route) {
2732 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4MayUseAsDefaultRoute;
2735 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4MayUseAsDefaultRoute;
2738 else if (keyValue.lower() ==
"routes") {
2739 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2740 TQT_DBusDataValueList::const_iterator it4;
2741 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2742 TQT_DBusData innerDataValue = *it4;
2743 TQT_DBusDataValueList innerValueList = innerDataValue.toTQValueList();
2744 TQT_DBusDataValueList::const_iterator it5;
2746 TDENetworkSingleRouteConfiguration routeConfig;
2747 for (it5 = innerValueList.begin(); it5 != innerValueList.end(); ++it5) {
2748 TQT_DBusData innerMostDataValue = *it5;
2751 routeConfig.ipAddress = TQHostAddress(reverseIPV4ByteOrder(innerMostDataValue.toUInt32()));
2753 else if (state == 1) {
2755 routeConfig.networkMask.fromCIDRMask(innerMostDataValue.toUInt32());
2757 else if (state == 2) {
2759 routeConfig.gateway = TQHostAddress(reverseIPV4ByteOrder(innerMostDataValue.toUInt32()));
2761 else if (state == 3) {
2763 routeConfig.metric = innerMostDataValue.toUInt32();
2767 routeConfig.valid =
true;
2768 connection->ipConfig.routeConfigurations.append(routeConfig);
2771 connection->ipConfig.valid =
true;
2773 else if (outerKeyValue.lower() ==
"ipv6") {
2774 if (keyValue.lower() ==
"addresses") {
2775 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2776 TQT_DBusDataValueList::const_iterator it4;
2777 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2778 TQT_DBusData innerDataValue = *it4;
2779 TQT_DBusDataValueList innerValueList = innerDataValue.toStruct();
2780 TQT_DBusDataValueList::const_iterator it5;
2781 TDENetworkSingleIPConfiguration ipConfig;
2783 TQT_DBusDataValueList innerMostValueList;
2784 innerMostValueList = innerValueList[0].toTQValueList();
2785 TQ_UINT8 nm_v6address[16];
2786 unsigned char nm_addr_ptr = 0;
2787 memset(nm_v6address, 0,
sizeof(TQ_UINT8)*16);
2788 for (it5 = innerMostValueList.begin(); it5 != innerMostValueList.end(); ++it5) {
2789 TQT_DBusData innerMostDataValue = *it5;
2790 if (nm_addr_ptr < 16) {
2791 nm_v6address[nm_addr_ptr] = innerMostDataValue.toByte();
2795 ipConfig.ipAddress = TQHostAddress(nm_v6address);
2798 ipConfig.networkMask.fromCIDRMask(innerValueList[1].toUInt32(),
true);
2801 memset(nm_v6address, 0,
sizeof(TQ_UINT8)*16);
2802 for (it5 = innerMostValueList.begin(); it5 != innerMostValueList.end(); ++it5) {
2803 TQT_DBusData innerMostDataValue = *it5;
2804 if (nm_addr_ptr < 16) {
2805 nm_v6address[nm_addr_ptr] = innerMostDataValue.toByte();
2809 ipConfig.gateway = TQHostAddress(nm_v6address);
2811 ipConfig.valid =
true;
2812 connection->ipConfig.ipConfigurations.append(ipConfig);
2815 else if (keyValue.lower() ==
"dns") {
2816 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2817 TQT_DBusDataValueList::const_iterator it4;
2818 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2819 TQT_DBusData innerDataValue = *it4;
2820 TQT_DBusDataValueList innerValueList = innerDataValue.toTQValueList();
2821 TQT_DBusDataValueList::const_iterator it5;
2822 TQ_UINT8 nm_v6address[16];
2823 unsigned char nm_addr_ptr = 0;
2824 memset(nm_v6address, 0,
sizeof(TQ_UINT8)*16);
2825 for (it5 = innerValueList.begin(); it5 != innerValueList.end(); ++it5) {
2826 TQT_DBusData innerMostDataValue = *it5;
2827 if (nm_addr_ptr < 16) {
2828 nm_v6address[nm_addr_ptr] = innerMostDataValue.toByte();
2832 connection->ipConfig.resolvers.append(TQHostAddress(nm_v6address));
2835 else if (keyValue.lower() ==
"dns-search") {
2836 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2837 TQT_DBusDataValueList::const_iterator it4;
2838 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2839 TQT_DBusData innerDataValue = *it4;
2840 TQT_DBusDataValueList innerValueList = innerDataValue.toTQValueList();
2841 TQT_DBusDataValueList::const_iterator it5;
2842 connection->ipConfig.searchDomains.append(TDENetworkSearchDomain(innerDataValue.toString(),
true));
2845 else if (keyValue.lower() ==
"ignore-auto-dns") {
2846 bool nm_static_dns = dataValue2.toBool();
2847 if (nm_static_dns) {
2848 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4DHCPDNS;
2851 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPDNS;
2854 else if (keyValue.lower() ==
"may-fail") {
2855 bool nm_may_fail = dataValue2.toBool();
2856 connection->requireIPV6 = !nm_may_fail;
2858 else if (keyValue.lower() ==
"method") {
2859 TQString nm_method = dataValue2.toString().lower();
2860 if (nm_method ==
"auto") {
2861 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV6DHCPIP;
2863 else if (nm_method ==
"manual") {
2864 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV6DHCPIP;
2866 else if (nm_method ==
"link-local") {
2867 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV6LocalOnly;
2869 else if (nm_method ==
"shared") {
2870 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV6StartConnectionSharingServer;
2872 else if (nm_method ==
"ignore") {
2873 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV6Disabled;
2876 else if (keyValue.lower() ==
"ignore-auto-routes") {
2877 bool nm_static_routes = dataValue2.toBool();
2878 if (nm_static_routes) {
2879 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV6DHCPRoutes;
2882 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV6DHCPRoutes;
2885 else if (keyValue.lower() ==
"never-default") {
2886 bool nm_can_default_route = !dataValue2.toBool();
2887 if (nm_can_default_route) {
2888 connection->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV6MayUseAsDefaultRoute;
2891 connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV6MayUseAsDefaultRoute;
2894 else if (keyValue.lower() ==
"routes") {
2895 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
2896 TQT_DBusDataValueList::const_iterator it4;
2897 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
2898 TQT_DBusData innerDataValue = *it4;
2899 TQT_DBusDataValueList innerValueList = innerDataValue.toStruct();
2900 TQT_DBusDataValueList::const_iterator it5;
2901 TDENetworkSingleRouteConfiguration routeConfig;
2903 TQT_DBusDataValueList innerMostValueList;
2904 innerMostValueList = innerValueList[0].toTQValueList();
2905 TQ_UINT8 nm_v6address[16];
2906 unsigned char nm_addr_ptr = 0;
2907 memset(nm_v6address, 0,
sizeof(TQ_UINT8)*16);
2908 for (it5 = innerMostValueList.begin(); it5 != innerMostValueList.end(); ++it5) {
2909 TQT_DBusData innerMostDataValue = *it5;
2910 if (nm_addr_ptr < 16) {
2911 nm_v6address[nm_addr_ptr] = innerMostDataValue.toByte();
2915 routeConfig.ipAddress = TQHostAddress(nm_v6address);
2918 routeConfig.networkMask.fromCIDRMask(innerValueList[1].toUInt32(),
true);
2921 innerMostValueList = innerValueList[2].toTQValueList();
2923 memset(nm_v6address, 0,
sizeof(TQ_UINT8)*16);
2924 for (it5 = innerMostValueList.begin(); it5 != innerMostValueList.end(); ++it5) {
2925 TQT_DBusData innerMostDataValue = *it5;
2926 if (nm_addr_ptr < 16) {
2927 nm_v6address[nm_addr_ptr] = innerMostDataValue.toByte();
2931 routeConfig.gateway = TQHostAddress(nm_v6address);
2934 routeConfig.metric = innerValueList[3].toUInt32();
2936 routeConfig.valid =
true;
2937 connection->ipConfig.routeConfigurations.append(routeConfig);
2940 connection->ipConfig.valid =
true;
2955 if ((deviceMACAddress == connection->lockedHWAddress) || (!connection->lockedHWAddress.isValid()) || (!deviceMACAddress.isValid())) {
2956 loadConnectionAllowedValues(connection);
2957 m_connectionList->append(connection);
2962 PRINT_ERROR((error.name() +
": " + error.message()))
2968 PRINT_ERROR((error.name() +
": " + error.message()))
2970 internalNetworkManagementEvent(TDENetworkGlobalEventType::ConnectionListChanged);
2973 d->nonReentrantCallActive =
false;
2976 void TDENetworkConnectionManager_BackendNM::loadConnectionAllowedValues(TDENetworkConnection* connection) {
2979 connection->eapConfig.allowedPhase2NonEAPMethods.clear();
2980 connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::MD5);
2981 connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::MSCHAPV2);
2982 connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::OTP);
2983 connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::GTC);
2984 connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::TLS);
2986 connection->eapConfig.allowedPhase2EAPMethods.clear();
2987 connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::PAP);
2988 connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::CHAP);
2989 connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::MSCHAP);
2990 connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::MSCHAPV2);
2991 connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::OTP);
2992 connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::GTC);
2993 connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::TLS);
2995 connection->eapConfig.allowedValid =
true;
3002 bool TDENetworkConnectionManager_BackendNM::loadConnectionSecrets(TQString uuid) {
3003 TDENetworkConnection* connection = findConnectionByUUID(uuid);
3005 PRINT_ERROR(TQString(
"Unable to locate connection with uuid '%1' in local database. Did you run loadConnectionInformation() first?"));
3010 TDEWiFiConnection* wiFiConnection =
dynamic_cast<TDEWiFiConnection*
>(connection);
3011 TDEVPNConnection* vpnConnection =
dynamic_cast<TDEVPNConnection*
>(connection);
3016 TDEModemConnection* modemConnection =
dynamic_cast<TDEModemConnection*
>(connection);
3019 ret = ret && loadConnectionSecretsForGroup(uuid,
"802-1x");
3020 if (wiFiConnection) {
3021 ret = ret && loadConnectionSecretsForGroup(uuid,
"802-11-wireless-security");
3023 if (vpnConnection) {
3024 ret = ret && loadConnectionSecretsForGroup(uuid,
"vpn");
3026 ret = ret && loadConnectionSecretsForGroup(uuid,
"pppoe");
3027 if (modemConnection) {
3028 ret = ret && loadConnectionSecretsForGroup(uuid,
"cdma");
3029 ret = ret && loadConnectionSecretsForGroup(uuid,
"gsm");
3034 bool TDENetworkConnectionManager_BackendNM::loadConnectionSecretsForGroup(TQString uuid, TQString group) {
3035 TDENetworkConnection* connection = findConnectionByUUID(uuid);
3037 PRINT_ERROR(TQString(
"Unable to locate connection with uuid '%1' in local database. Did you run loadConnectionInformation() first?"));
3042 TDEWiFiConnection* wiFiConnection =
dynamic_cast<TDEWiFiConnection*
>(connection);
3043 TDEVPNConnection* vpnConnection =
dynamic_cast<TDEVPNConnection*
>(connection);
3048 TDEModemConnection* modemConnection =
dynamic_cast<TDEModemConnection*
>(connection);
3049 TQT_DBusObjectPath existingConnection;
3050 TQT_DBusError error;
3052 TQT_DBusTQStringDataMap connectionSecretsMap(TQT_DBusData::String);
3053 ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error);
3056 DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection);
3057 connectionSettings.setConnection(TQT_DBusConnection::systemBus());
3058 connect(&connectionSettings, TQ_SIGNAL(GetSecretsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)));
3060 ret = connectionSettings.GetSecretsAsync(asyncCallID, group, error);
3061 if (ret && error.isValid()) {
3063 PRINT_ERROR((error.name() +
": " + error.message()))
3067 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
3068 TQTimer nmCallTimeoutTimer;
3069 nmCallTimeoutTimer.start(NM_ASYNC_SECRETS_INTERACTION_TIMEOUT_MS,
true);
3070 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
3071 tqApp->processEvents();
3072 if (!nmCallTimeoutTimer.isActive()) {
3073 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
3077 connectionSecretsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
3078 if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
3079 PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() +
": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
3080 d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
3082 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
3083 if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
3084 d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
3087 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
3088 printf(
"[network-manager comm debug] received DBUS object structure map follows:\n"); fflush(stdout);
3089 printDBUSObjectStructure(TQT_DBusData::fromStringKeyMap(connectionSecretsMap));
3093 TQT_DBusTQStringDataMap::const_iterator it2;
3094 for (it2 = connectionSecretsMap.begin(); it2 != connectionSecretsMap.end(); ++it2) {
3095 TQString outerKeyValue = it2.key();
3096 TQT_DBusData dataValue = it2.data();
3097 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
3098 printf(
"[network-manager comm debug] [%s]\n", outerKeyValue.ascii()); fflush(stdout);
3100 TQT_DBusTQStringDataMap nestedConnectionSettingsMap = dataValue.toStringKeyMap();
3101 TQT_DBusTQStringDataMap::const_iterator it3;
3102 for (it3 = nestedConnectionSettingsMap.begin(); it3 != nestedConnectionSettingsMap.end(); ++it3) {
3103 TQString keyValue = it3.key();
3104 TQT_DBusData dataValue = it3.data();
3105 if (dataValue.type() != TQT_DBusData::Variant) {
3106 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
3107 printf(
"[network-manager comm debug] %s = %s (type %d(%s))\n", keyValue.ascii(), dataValue.toString().ascii(), dataValue.type(), dataValue.typeName()); fflush(stdout);
3112 TQT_DBusVariant dataValueVariant = dataValue.toVariant();
3113 TQT_DBusData dataValue2 = dataValueVariant.value;
3114 if (dataValue2.type() != TQT_DBusData::Variant) {
3115 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
3116 printf(
"[network-manager comm debug] %s = %s (type %d(%s), signature %s)\n", keyValue.ascii(), dataValue2.toString().ascii(), dataValue2.type(), dataValue2.typeName(), dataValueVariant.signature.ascii()); fflush(stdout);
3119 if (outerKeyValue.lower() ==
"802-1x") {
3120 if (keyValue.lower() ==
"password") {
3121 connection->eapConfig.password = dataValue2.toString();
3123 else if (keyValue.lower() ==
"password-raw") {
3124 TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
3125 TQT_DBusDataValueList::const_iterator it4;
3127 for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
3128 TQT_DBusData innerDataValue = *it4;
3130 connection->eapConfig.binaryPassword.resize(count+1);
3131 connection->eapConfig.binaryPassword[count] = innerDataValue.toByte();
3134 else if (keyValue.lower() ==
"private-key-password") {
3135 connection->eapConfig.privateKeyPassword = dataValue2.toString();
3137 else if (keyValue.lower() ==
"phase2-private-key-password") {
3138 connection->eapConfig.phase2PrivateKeyPassword = dataValue2.toString();
3140 connection->eapConfig.secretsValid =
true;
3142 if ((outerKeyValue.lower() ==
"802-11-wireless-security") && (wiFiConnection)) {
3143 if (keyValue.lower() ==
"wep-key0") {
3144 wiFiConnection->securitySettings.wepKey0 = dataValue2.toString();
3145 wiFiConnection->securitySettings.wepKeyType = nmWepKeyTypeToTDEWepKeyType(tdeWepKeyTypeToNMWepKeyType(wiFiConnection->securitySettings.wepKeyType), wiFiConnection->securitySettings.wepKey0);
3147 else if (keyValue.lower() ==
"wep-key1") {
3148 wiFiConnection->securitySettings.wepKey1 = dataValue2.toString();
3149 wiFiConnection->securitySettings.wepKeyType = nmWepKeyTypeToTDEWepKeyType(tdeWepKeyTypeToNMWepKeyType(wiFiConnection->securitySettings.wepKeyType), wiFiConnection->securitySettings.wepKey1);
3151 else if (keyValue.lower() ==
"wep-key2") {
3152 wiFiConnection->securitySettings.wepKey2 = dataValue2.toString();
3153 wiFiConnection->securitySettings.wepKeyType = nmWepKeyTypeToTDEWepKeyType(tdeWepKeyTypeToNMWepKeyType(wiFiConnection->securitySettings.wepKeyType), wiFiConnection->securitySettings.wepKey2);
3155 else if (keyValue.lower() ==
"wep-key3") {
3156 wiFiConnection->securitySettings.wepKey3 = dataValue2.toString();
3157 wiFiConnection->securitySettings.wepKeyType = nmWepKeyTypeToTDEWepKeyType(tdeWepKeyTypeToNMWepKeyType(wiFiConnection->securitySettings.wepKeyType), wiFiConnection->securitySettings.wepKey3);
3159 else if (keyValue.lower() ==
"psk") {
3160 wiFiConnection->securitySettings.psk = dataValue2.toString();
3162 else if (keyValue.lower() ==
"eap-password") {
3163 wiFiConnection->securitySettings.leapPassword = dataValue2.toString();
3166 if ((outerKeyValue.lower() ==
"vpn") && (vpnConnection)) {
3167 if (keyValue.lower() ==
"secrets") {
3168 TQT_DBusTQStringDataMap nestedConnectionSettingsMap = dataValue2.toStringKeyMap();
3169 TQT_DBusTQStringDataMap::const_iterator it4;
3170 for (it4 = nestedConnectionSettingsMap.begin(); it4 != nestedConnectionSettingsMap.end(); ++it4) {
3171 vpnConnection->pluginSecrets.clear();
3172 TQString keyValue4 = it4.key();
3173 TQT_DBusData dataValue4 = it4.data();
3174 if (dataValue4.type() == TQT_DBusData::String) {
3175 vpnConnection->pluginSecrets[keyValue4] = dataValue4.toString();
3178 vpnConnection->secretsValid =
true;
3181 if (outerKeyValue.lower() ==
"pppoe") {
3182 if (keyValue.lower() ==
"password") {
3183 connection->pppoeConfig.password = dataValue2.toString();
3185 connection->pppoeConfig.secretsValid =
true;
3187 if (outerKeyValue.lower() ==
"cdma") {
3188 if (keyValue.lower() ==
"password") {
3189 modemConnection->cdmaConfig.password = dataValue2.toString();
3191 modemConnection->cdmaConfig.secretsValid =
true;
3193 if (outerKeyValue.lower() ==
"gsm") {
3194 if (keyValue.lower() ==
"password") {
3195 modemConnection->gsmConfig.password = dataValue2.toString();
3197 else if (keyValue.lower() ==
"pin") {
3198 modemConnection->gsmConfig.pin = dataValue2.toString();
3200 modemConnection->gsmConfig.secretsValid =
true;
3209 PRINT_ERROR(TQString(
"Unable to load secrets for connection with uuid '%1'").arg(uuid))
3214 PRINT_WARNING(TQString(
"connection for provided uuid '%1' was not found").arg(uuid));
3219 bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* connection) {
3220 bool timed_out =
false;
3221 bool command_failed =
false;
3224 PRINT_ERROR(TQString(
"connection cannot be NULL!"));
3229 if (connection->UUID ==
"") {
3230 bool unique =
false;
3232 connection->UUID = TQUuid::createUuid().toString();
3233 connection->UUID.replace(
"{",
"");
3234 connection->UUID.replace(
"}",
"");
3235 if (!findConnectionByUUID(connection->UUID)) {
3243 TDEWiredEthernetConnection* ethernetConnection =
dynamic_cast<TDEWiredEthernetConnection*
>(connection);
3244 TDEWiredInfinibandConnection* infinibandConnection =
dynamic_cast<TDEWiredInfinibandConnection*
>(connection);
3245 TDEWiFiConnection* wiFiConnection =
dynamic_cast<TDEWiFiConnection*
>(connection);
3246 TDEVPNConnection* vpnConnection =
dynamic_cast<TDEVPNConnection*
>(connection);
3247 TDEWiMaxConnection* wiMaxConnection =
dynamic_cast<TDEWiMaxConnection*
>(connection);
3248 TDEVLANConnection* vlanConnection =
dynamic_cast<TDEVLANConnection*
>(connection);
3249 TDEOLPCMeshConnection* olpcMeshConnection =
dynamic_cast<TDEOLPCMeshConnection*
>(connection);
3250 TDEBluetoothConnection* bluetoothConnection =
dynamic_cast<TDEBluetoothConnection*
>(connection);
3251 TDEModemConnection* modemConnection =
dynamic_cast<TDEModemConnection*
>(connection);
3252 TQT_DBusObjectPath existingConnection;
3253 TQT_DBusError error;
3256 TQT_DBusTQStringDataMap connectionSettingsMap(TQT_DBusData::String);
3258 ret = d->m_networkManagerSettings->GetConnectionByUuid(connection->UUID, existingConnection, error);
3261 DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection);
3262 connectionSettings.setConnection(TQT_DBusConnection::systemBus());
3263 connect(&connectionSettings, TQ_SIGNAL(GetSettingsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)), d, TQ_SLOT(processConnectionSettingsAsyncReply(
int,
const TQT_DBusDataMap<TQString>&)));
3265 ret = connectionSettings.GetSettingsAsync(asyncCallID, error);
3266 if (ret && error.isValid()) {
3268 PRINT_ERROR((error.name() +
": " + error.message()))
3272 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
3273 TQTimer nmCallTimeoutTimer;
3274 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
3275 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
3276 tqApp->processEvents();
3277 if (!nmCallTimeoutTimer.isActive()) {
3278 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
3283 connectionSettingsMap = d->nmConnectionSettingsAsyncSettingsResponse[asyncCallID];
3284 if (d->nmConnectionSettingsAsyncSettingsErrorResponse.contains(asyncCallID)) {
3285 PRINT_ERROR((d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].name() +
": " + d->nmConnectionSettingsAsyncSettingsErrorResponse[asyncCallID].message()));
3286 d->nmConnectionSettingsAsyncSettingsErrorResponse.remove(asyncCallID);
3288 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
3289 if (d->nmConnectionSettingsAsyncSettingsResponse.contains(asyncCallID)) {
3290 d->nmConnectionSettingsAsyncSettingsResponse.remove(asyncCallID);
3299 TQT_DBusData dbusData;
3300 TQT_DBusData innerDbusData;
3301 TQMap<TQString, TQT_DBusData> outerMap = connectionSettingsMap.toTQMap();
3304 dbusData = outerMap[
"connection"];
3306 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3308 settingsMap[
"id"] = (TQT_DBusData::fromString(connection->friendlyName)).getAsVariantData();
3311 if (ethernetConnection) type =
"802-3-ethernet";
3312 else if (infinibandConnection) type =
"infiniband";
3313 else if (wiFiConnection) type =
"802-11-wireless";
3314 else if (vpnConnection) type =
"vpn";
3315 else if (wiMaxConnection) type =
"wimax";
3316 else if (vlanConnection) type =
"vlan";
3317 else if (olpcMeshConnection) type =
"802-11-olpc-mesh";
3318 else if (bluetoothConnection) type =
"bluetooth";
3319 else if (modemConnection) {
3320 if (modemConnection->type == TDEModemConnectionType::CDMA) {
3323 else if (modemConnection->type == TDEModemConnectionType::GSM) {
3327 if (!type.isNull()) settingsMap[
"type"] = (TQT_DBusData::fromString(type)).getAsVariantData();
3329 settingsMap[
"uuid"] = (TQT_DBusData::fromString(connection->UUID)).getAsVariantData();
3331 TQT_DBusDataValueList valueList;
3333 for (TQStringList::Iterator it = connection->authorizedUsers.begin(); it != connection->authorizedUsers.end(); ++it) {
3334 TQString assembledString = TQString(
"user:%1:").arg(*it);
3335 valueList.append(TQT_DBusData::fromString(assembledString));
3338 if (valueList.count() > 0) settingsMap[
"permissions"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3339 else settingsMap.remove(
"permissions");
3341 settingsMap[
"autoconnect"] = (TQT_DBusData::fromBool(connection->autoConnect)).getAsVariantData();
3342 settingsMap[
"read-only"] = (TQT_DBusData::fromBool(connection->readOnly)).getAsVariantData();
3343 UPDATE_STRING_SETTING_IF_VALID(connection->masterConnectionUUID,
"master", settingsMap)
3345 TQString slaveType = tdeSlaveTypeToNMSlaveType(connection->slaveType);
3346 if (slaveType !=
"") settingsMap[
"slave-type"] = (TQT_DBusData::fromString(slaveType)).getAsVariantData();
3347 else settingsMap.remove(
"slave-type");
3351 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3352 groupValid = (settingsMap.count() > 0);
3354 if (groupValid) outerMap.insert(
"connection", dbusData,
true);
else outerMap.remove(
"connection");
3357 dbusData = outerMap[
"802-1x"];
3359 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3361 if (connection->eapConfig.valid) {
3362 TQT_DBusDataValueList valueList;
3366 valueList.append(TQT_DBusData::fromString(tdeEAPTypeToNMEAPType(connection->eapConfig.type)));
3368 settingsMap[
"eap"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3371 settingsMap.remove(
"eap");
3373 if (connection->eapConfig.valid) {
3374 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.userName,
"identity", settingsMap)
3375 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.anonymousUserName,
"anonymous-identity", settingsMap)
3376 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.pacFileName,
"pac-file", settingsMap)
3379 settingsMap.remove(
"identity");
3380 settingsMap.remove(
"anonymous-identity");
3381 settingsMap.remove(
"pac-file");
3383 if (connection->eapConfig.valid) {
3384 TQT_DBusDataValueList valueList;
3387 for (count=0; count<connection->eapConfig.caCertificate.count(); count++) {
3388 valueList.append(TQT_DBusData::fromByte(connection->eapConfig.caCertificate[count]));
3391 if (valueList.count() > 0) settingsMap[
"ca-cert"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3392 else settingsMap.remove(
"ca-cert");
3395 settingsMap.remove(
"ca-cert");
3397 if (connection->eapConfig.valid) {
3398 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.additionalCAFilesPath,
"ca-path", settingsMap)
3399 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.authServerCertSubjectMatch,
"subject-match", settingsMap)
3402 settingsMap.remove(
"ca-path");
3403 settingsMap.remove(
"subject-match");
3405 if (connection->eapConfig.valid) {
3406 TQT_DBusDataValueList valueList;
3408 for (TQStringList::Iterator it = connection->eapConfig.alternateAuthServerCertSubjectMatch.begin(); it != connection->eapConfig.alternateAuthServerCertSubjectMatch.end(); ++it) {
3409 valueList.append(TQT_DBusData::fromString(*it));
3412 if (valueList.count() > 0) settingsMap[
"altsubject-matches"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3413 else settingsMap.remove(
"altsubject-matches");
3416 settingsMap.remove(
"altsubject-matches");
3418 if (connection->eapConfig.valid) {
3419 TQT_DBusDataValueList valueList;
3422 for (count=0; count<connection->eapConfig.clientCertificate.count(); count++) {
3423 valueList.append(TQT_DBusData::fromByte(connection->eapConfig.clientCertificate[count]));
3426 if (valueList.count() > 0) settingsMap[
"client-cert"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3427 else settingsMap.remove(
"client-cert");
3430 settingsMap.remove(
"client-cert");
3432 if (connection->eapConfig.valid) {
3433 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.forcePEAPVersion,
"phase1-peapver", settingsMap)
3434 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.forcePEAPLabel,
"phase1-peaplabel", settingsMap)
3435 UPDATE_STRING_SETTING_IF_VALID(tdeEAPFastFlagsToNMEAPFastFlags(connection->eapConfig.fastProvisioningFlags),
"phase1-fast-provisioning", settingsMap)
3438 settingsMap.remove(
"phase1-peapver");
3439 settingsMap.remove(
"phase1-peaplabel");
3440 settingsMap.remove(
"phase1-fast-provisioning");
3442 if (connection->eapConfig.valid) {
3443 settingsMap[
"phase2-auth"] = (TQT_DBusData::fromString(tdeEAPTypeToNMEAPType(connection->eapConfig.phase2NonEAPAuthMethod))).getAsVariantData();
3444 settingsMap[
"phase2-autheap"] = (TQT_DBusData::fromString(tdeEAPTypeToNMEAPType(connection->eapConfig.phase2EAPAuthMethod))).getAsVariantData();
3447 settingsMap.remove(
"phase2-auth");
3448 settingsMap.remove(
"phase2-autheap");
3450 if (connection->eapConfig.valid) {
3451 TQT_DBusDataValueList valueList;
3454 for (count=0; count<connection->eapConfig.phase2CaCertificate.count(); count++) {
3455 valueList.append(TQT_DBusData::fromByte(connection->eapConfig.phase2CaCertificate[count]));
3458 if (valueList.count() > 0) settingsMap[
"phase2-ca-cert"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3459 else settingsMap.remove(
"phase2-ca-cert");
3462 settingsMap.remove(
"phase2-ca-cert");
3464 if (connection->eapConfig.valid) {
3465 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.phase2CaFilesPath,
"phase2-ca-path", settingsMap)
3466 UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.phase2AuthServerCertSubjectMatch,
"phase2-subject-match", settingsMap)
3469 settingsMap.remove(
"phase2-ca-path");
3470 settingsMap.remove(
"phase2-subject-match");
3472 if (connection->eapConfig.valid) {
3473 TQT_DBusDataValueList valueList;
3475 for (TQStringList::Iterator it = connection->eapConfig.phase2AlternateAuthServerCertSubjectMatch.begin(); it != connection->eapConfig.phase2AlternateAuthServerCertSubjectMatch.end(); ++it) {
3476 valueList.append(TQT_DBusData::fromString(*it));
3479 if (valueList.count() > 0) settingsMap[
"phase2-altsubject-matches"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3480 else settingsMap.remove(
"phase2-altsubject-matches");
3483 settingsMap.remove(
"phase2-altsubject-matches");
3485 if (connection->eapConfig.valid) {
3486 TQT_DBusDataValueList valueList;
3489 for (count=0; count<connection->eapConfig.phase2ClientCertificate.count(); count++) {
3490 valueList.append(TQT_DBusData::fromByte(connection->eapConfig.phase2ClientCertificate[count]));
3493 if (valueList.count() > 0) settingsMap[
"phase2-client-cert"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3494 else settingsMap.remove(
"phase2-client-cert");
3497 settingsMap.remove(
"phase2-client-cert");
3499 if (connection->eapConfig.valid) {
3500 settingsMap[
"password-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(connection->eapConfig.passwordFlags))).getAsVariantData();
3501 settingsMap[
"password-raw-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(connection->eapConfig.binaryPasswordFlags))).getAsVariantData();
3504 settingsMap.remove(
"password-flags");
3505 settingsMap.remove(
"password-raw-flags");
3507 if (connection->eapConfig.valid) {
3508 TQT_DBusDataValueList valueList;
3511 for (count=0; count<connection->eapConfig.privateKey.count(); count++) {
3512 valueList.append(TQT_DBusData::fromByte(connection->eapConfig.privateKey[count]));
3515 if (valueList.count() > 0) settingsMap[
"private-key"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3516 else settingsMap.remove(
"private-key");
3519 settingsMap.remove(
"private-key");
3521 if (connection->eapConfig.valid) {
3522 settingsMap[
"private-key-password-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(connection->eapConfig.privateKeyPasswordFlags))).getAsVariantData();
3525 settingsMap.remove(
"private-key-password-flags");
3527 if (connection->eapConfig.valid) {
3528 TQT_DBusDataValueList valueList;
3531 for (count=0; count<connection->eapConfig.phase2PrivateKey.count(); count++) {
3532 valueList.append(TQT_DBusData::fromByte(connection->eapConfig.phase2PrivateKey[count]));
3535 if (valueList.count() > 0) settingsMap[
"phase2-private-key"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3536 else settingsMap.remove(
"phase2-private-key");
3539 settingsMap.remove(
"phase2-private-key");
3541 if (connection->eapConfig.valid) {
3542 settingsMap[
"phase2-private-key-password-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(connection->eapConfig.phase2PrivateKeyPasswordFlags))).getAsVariantData();
3545 settingsMap.remove(
"phase2-private-key-password-flags");
3547 if (connection->eapConfig.valid) {
3548 settingsMap[
"system-ca-certs"] = (TQT_DBusData::fromBool(connection->eapConfig.forceSystemCaCertificates)).getAsVariantData();
3551 settingsMap.remove(
"system-ca-certs");
3553 if (connection->eapConfig.secretsValid) {
3554 settingsMap[
"password"] = (TQT_DBusData::fromString(connection->eapConfig.password)).getAsVariantData();
3557 settingsMap.remove(
"password");
3559 if (connection->eapConfig.valid) {
3560 TQT_DBusDataValueList valueList;
3563 for (count=0; count<connection->eapConfig.binaryPassword.count(); count++) {
3564 valueList.append(TQT_DBusData::fromByte(connection->eapConfig.binaryPassword[count]));
3567 if (valueList.count() > 0) settingsMap[
"password-raw"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3568 else settingsMap.remove(
"password-raw");
3571 settingsMap.remove(
"password-raw");
3573 if (connection->eapConfig.secretsValid) {
3574 settingsMap[
"private-key-password"] = (TQT_DBusData::fromString(connection->eapConfig.privateKeyPassword)).getAsVariantData();
3575 settingsMap[
"phase2-private-key-password"] = (TQT_DBusData::fromString(connection->eapConfig.phase2PrivateKeyPassword)).getAsVariantData();
3578 settingsMap.remove(
"private-key-password");
3579 settingsMap.remove(
"phase2-private-key-password");
3582 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3583 groupValid = (settingsMap.count() > 0);
3585 if (groupValid) outerMap.insert(
"802-1x", dbusData,
true);
else outerMap.remove(
"802-1x");
3588 dbusData = outerMap[
"802-3-ethernet"];
3589 if (ethernetConnection) {
3590 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3592 settingsMap[
"duplex"] = (TQT_DBusData::fromString((connection->fullDuplex)?
"full":
"half")).getAsVariantData();
3593 if (connection->lockedHWAddress.isValid()) {
3594 TDENetworkByteList address = connection->lockedHWAddress.address();
3595 TQT_DBusDataValueList valueList;
3596 TDENetworkByteList::iterator it;
3597 for (it = address.begin(); it != address.end(); ++it) {
3598 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
3599 valueList.append(innerDataValue);
3601 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
3602 settingsMap[
"mac-address"] = (nmHWAddress).getAsVariantData();
3605 settingsMap.remove(
"mac-address");
3607 if (connection->manualHWAddress.isValid()) {
3608 TDENetworkByteList address = connection->manualHWAddress.address();
3609 TQT_DBusDataValueList valueList;
3610 TDENetworkByteList::iterator it;
3611 for (it = address.begin(); it != address.end(); ++it) {
3612 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
3613 valueList.append(innerDataValue);
3615 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
3616 settingsMap[
"cloned-mac-address"] = (nmHWAddress).getAsVariantData();
3619 settingsMap.remove(
"cloned-mac-address");
3621 if (connection->mtu > 0) {
3622 settingsMap[
"mtu"] = (TQT_DBusData::fromUInt32(connection->mtu)).getAsVariantData();
3625 settingsMap.remove(
"mtu");
3628 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3629 groupValid = (settingsMap.count() > 0);
3631 if (groupValid) outerMap.insert(
"802-3-ethernet", dbusData,
true);
else outerMap.remove(
"802-3-ethernet");
3634 dbusData = outerMap[
"infiniband"];
3635 if (infinibandConnection) {
3636 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3638 if (connection->lockedHWAddress.isValid()) {
3639 TDENetworkByteList address = connection->lockedHWAddress.address();
3640 TQT_DBusDataValueList valueList;
3641 TDENetworkByteList::iterator it;
3642 for (it = address.begin(); it != address.end(); ++it) {
3643 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
3644 valueList.append(innerDataValue);
3646 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
3647 settingsMap[
"mac-address"] = (nmHWAddress).getAsVariantData();
3650 settingsMap.remove(
"mac-address");
3652 if (connection->mtu > 0) {
3653 settingsMap[
"mtu"] = (TQT_DBusData::fromUInt32(connection->mtu)).getAsVariantData();
3656 settingsMap.remove(
"mtu");
3658 UPDATE_STRING_SETTING_IF_VALID(tdeIBTransportToNMIBTransport(infinibandConnection->transportMode),
"transport-mode", settingsMap)
3660 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3661 groupValid = (settingsMap.count() > 0);
3663 if (groupValid) outerMap.insert(
"infiniband", dbusData,
true);
else outerMap.remove(
"infiniband");
3666 dbusData = outerMap[
"802-11-wireless"];
3667 if (wiFiConnection) {
3668 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3672 TQT_DBusDataValueList valueList;
3673 for (i=0; i<wiFiConnection->SSID.count(); i++) {
3674 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(wiFiConnection->SSID[i]);
3675 valueList.append(innerDataValue);
3677 settingsMap[
"ssid"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3679 if (connection->lockedHWAddress.isValid()) {
3680 TDENetworkByteList address = connection->lockedHWAddress.address();
3681 TQT_DBusDataValueList valueList;
3682 TDENetworkByteList::iterator it;
3683 for (it = address.begin(); it != address.end(); ++it) {
3684 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
3685 valueList.append(innerDataValue);
3687 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
3688 settingsMap[
"mac-address"] = (nmHWAddress).getAsVariantData();
3691 settingsMap.remove(
"mac-address");
3693 if (connection->manualHWAddress.isValid()) {
3694 TDENetworkByteList address = connection->manualHWAddress.address();
3695 TQT_DBusDataValueList valueList;
3696 TDENetworkByteList::iterator it;
3697 for (it = address.begin(); it != address.end(); ++it) {
3698 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
3699 valueList.append(innerDataValue);
3701 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
3702 settingsMap[
"cloned-mac-address"] = (nmHWAddress).getAsVariantData();
3705 settingsMap.remove(
"cloned-mac-address");
3707 if (connection->mtu > 0) {
3708 settingsMap[
"mtu"] = (TQT_DBusData::fromUInt32(connection->mtu)).getAsVariantData();
3711 settingsMap.remove(
"mtu");
3713 UPDATE_STRING_SETTING_IF_VALID(tdeWiFiModeToNMWiFiMode(wiFiConnection->operatingMode),
"mode", settingsMap)
3714 UPDATE_STRING_SETTING_IF_VALID(tdeWiFiFrequencyBandToNMWiFiFrequencyBand(wiFiConnection->bandRestriction),
"band", settingsMap)
3715 if (wiFiConnection->channelRestriction > 0) {
3716 settingsMap[
"channel"] = (TQT_DBusData::fromUInt32(wiFiConnection->channelRestriction)).getAsVariantData();
3719 settingsMap.remove(
"channel");
3721 if (wiFiConnection->bitRateRestriction > 0) {
3722 settingsMap[
"rate"] = (TQT_DBusData::fromUInt32(wiFiConnection->bitRateRestriction/1000)).getAsVariantData();
3725 settingsMap.remove(
"rate");
3727 if (wiFiConnection->powerRestriction > 0) {
3728 settingsMap[
"tx-power"] = (TQT_DBusData::fromUInt32(wiFiConnection->powerRestriction)).getAsVariantData();
3731 settingsMap.remove(
"tx-power");
3733 if (wiFiConnection->accessPointRestriction.isValid()) {
3734 TDENetworkByteList address = wiFiConnection->accessPointRestriction.address();
3735 TQT_DBusDataValueList valueList;
3736 TDENetworkByteList::iterator it;
3737 for (it = address.begin(); it != address.end(); ++it) {
3738 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
3739 valueList.append(innerDataValue);
3741 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
3742 settingsMap[
"bssid"] = (nmHWAddress).getAsVariantData();
3745 settingsMap.remove(
"bssid");
3748 TQT_DBusDataValueList valueList;
3749 TDEMACAddressList::iterator it;
3750 for (it = wiFiConnection->blacklistedBSSIDs.begin(); it != wiFiConnection->blacklistedBSSIDs.end(); ++it) {
3751 valueList.append(TQT_DBusData::fromString((*it).toString()));
3753 if (valueList.count() > 0) settingsMap[
"mac-address-blacklist"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3756 TQT_DBusDataValueList valueList;
3757 TDEMACAddressList::iterator it;
3758 for (it = wiFiConnection->heardBSSIDs.begin(); it != wiFiConnection->heardBSSIDs.end(); ++it) {
3759 valueList.append(TQT_DBusData::fromString((*it).toString()));
3761 if (valueList.count() > 0) settingsMap[
"seen-bssids"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3764 if (wiFiConnection->securityRequired) {
3765 settingsMap[
"security"] = (TQT_DBusData::fromString(
"802-11-wireless-security")).getAsVariantData();
3768 settingsMap.remove(
"security");
3772 if (wiFiConnection->isHiddenNetwork) {
3773 settingsMap[
"hidden"] = (TQT_DBusData::fromBool(
true)).getAsVariantData();
3776 settingsMap.remove(
"hidden");
3780 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3781 groupValid = (settingsMap.count() > 0);
3783 if (groupValid) outerMap.insert(
"802-11-wireless", dbusData,
true);
else outerMap.remove(
"802-11-wireless");
3786 dbusData = outerMap[
"802-11-wireless-security"];
3787 if (wiFiConnection) {
3788 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3790 if (wiFiConnection->securityRequired) {
3791 if (wiFiConnection->securityRequired) {
3792 settingsMap[
"key-mgmt"] = (TQT_DBusData::fromString(tdeWiFiKeyTypeToNMWiFiKeyType(wiFiConnection->securitySettings.keyType))).getAsVariantData();
3794 if (wiFiConnection->securitySettings.wepKeyIndex > 0) {
3795 settingsMap[
"wep-tx-keyidx"] = (TQT_DBusData::fromUInt32(wiFiConnection->securitySettings.wepKeyIndex)).getAsVariantData();
3798 settingsMap.remove(
"wep-tx-keyidx");
3800 UPDATE_STRING_SETTING_IF_VALID(tdeWiFiAuthTypeToNMWiFiAuthType(wiFiConnection->securitySettings.authType),
"auth-alg", settingsMap)
3802 TQT_DBusDataValueList valueList;
3804 TQStringList strings = tdeWiFiWPAVersionToNMWiFiWPAVersion(wiFiConnection->securitySettings.wpaVersion);
3805 for (TQStringList::Iterator it = strings.begin(); it != strings.end(); ++it) {
3806 valueList.append(TQT_DBusData::fromString(*it));
3809 if (valueList.count() > 0) settingsMap[
"proto"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3810 else settingsMap.remove(
"proto");
3813 TQT_DBusDataValueList valueList;
3815 if (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any)) {
3816 if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40);
3817 if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104);
3818 if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
3819 if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
3821 for (TDENetworkWiFiConnectionCipherList::Iterator it = wiFiConnection->securitySettings.allowedPairWiseCiphers.begin(); it != wiFiConnection->securitySettings.allowedPairWiseCiphers.end(); ++it) {
3822 valueList.append(TQT_DBusData::fromString(tdeWiFiCipherToNMWiFiCipher(*it)));
3825 if (valueList.count() > 0) settingsMap[
"pairwise"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3826 else settingsMap.remove(
"pairwise");
3829 TQT_DBusDataValueList valueList;
3831 if (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any)) {
3832 if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40);
3833 if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104);
3834 if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
3835 if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
3837 for (TDENetworkWiFiConnectionCipherList::Iterator it = wiFiConnection->securitySettings.allowedGroupWiseCiphers.begin(); it != wiFiConnection->securitySettings.allowedGroupWiseCiphers.end(); ++it) {
3838 valueList.append(TQT_DBusData::fromString(tdeWiFiCipherToNMWiFiCipher(*it)));
3841 if (valueList.count() > 0) settingsMap[
"group"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3842 else settingsMap.remove(
"group");
3844 UPDATE_STRING_SETTING_IF_VALID(wiFiConnection->securitySettings.leapUsername,
"leap-username", settingsMap)
3845 settingsMap[
"wep-key-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(wiFiConnection->securitySettings.wepKeyFlags))).getAsVariantData();
3846 settingsMap[
"wep-key-type"] = (TQT_DBusData::fromUInt32(tdeWepKeyTypeToNMWepKeyType(wiFiConnection->securitySettings.wepKeyType))).getAsVariantData();
3847 settingsMap[
"psk-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(wiFiConnection->securitySettings.pskFlags))).getAsVariantData();
3848 settingsMap[
"leap-password-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(wiFiConnection->securitySettings.leapPasswordFlags))).getAsVariantData();
3849 if (wiFiConnection->securitySettings.secretsValid) {
3850 UPDATE_STRING_SETTING_IF_VALID(wiFiConnection->securitySettings.wepKey0,
"wep-key0", settingsMap)
3851 UPDATE_STRING_SETTING_IF_VALID(wiFiConnection->securitySettings.wepKey1,
"wep-key1", settingsMap)
3852 UPDATE_STRING_SETTING_IF_VALID(wiFiConnection->securitySettings.wepKey2,
"wep-key2", settingsMap)
3853 UPDATE_STRING_SETTING_IF_VALID(wiFiConnection->securitySettings.wepKey3,
"wep-key3", settingsMap)
3854 UPDATE_STRING_SETTING_IF_VALID(wiFiConnection->securitySettings.psk,
"psk", settingsMap)
3855 UPDATE_STRING_SETTING_IF_VALID(wiFiConnection->securitySettings.leapPassword,
"leap-password", settingsMap)
3858 settingsMap.remove(
"wep-key0");
3859 settingsMap.remove(
"wep-key1");
3860 settingsMap.remove(
"wep-key2");
3861 settingsMap.remove(
"wep-key3");
3862 settingsMap.remove(
"psk");
3863 settingsMap.remove(
"leap-password");
3867 settingsMap.remove(
"key-mgmt");
3868 settingsMap.remove(
"wep-tx-keyidx");
3869 settingsMap.remove(
"auth-alg");
3870 settingsMap.remove(
"proto");
3871 settingsMap.remove(
"pairwise");
3872 settingsMap.remove(
"group");
3873 settingsMap.remove(
"leap-username");
3874 settingsMap.remove(
"wep-key-flags");
3875 settingsMap.remove(
"wep-key-type");
3876 settingsMap.remove(
"psk-flags");
3877 settingsMap.remove(
"leap-password-flags");
3878 settingsMap.remove(
"wep-key0");
3879 settingsMap.remove(
"wep-key1");
3880 settingsMap.remove(
"wep-key2");
3881 settingsMap.remove(
"wep-key3");
3882 settingsMap.remove(
"psk");
3883 settingsMap.remove(
"leap-password");
3886 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3887 groupValid = (settingsMap.count() > 0);
3889 if (groupValid) outerMap.insert(
"802-11-wireless-security", dbusData,
true);
else outerMap.remove(
"802-11-wireless-security");
3892 dbusData = outerMap[
"vpn"];
3893 if (vpnConnection) {
3894 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3897 TQString pluginService = vpnConnection->vpnPluginID;
3898 if (pluginService !=
"") {
3899 pluginService =
"org.freedesktop.NetworkManager." + pluginService;
3901 UPDATE_STRING_SETTING_IF_VALID(pluginService,
"service-type", settingsMap)
3903 UPDATE_STRING_SETTING_IF_VALID(vpnConnection->lockedUserName,
"user-name", settingsMap)
3905 TQMap<TQString, TQT_DBusData> nestedConnectionSettingsMap;
3906 TDENetworkSettingsMap::const_iterator it;
3907 for (it = vpnConnection->pluginData.begin(); it != vpnConnection->pluginData.end(); ++it) {
3908 nestedConnectionSettingsMap[it.key()] = TQT_DBusData::fromString(it.data());
3910 if (nestedConnectionSettingsMap.count() > 0) settingsMap[
"data"] = (TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(nestedConnectionSettingsMap))).getAsVariantData();
3911 else settingsMap.remove(
"data");
3913 if (vpnConnection->secretsValid) {
3914 TQMap<TQString, TQT_DBusData> nestedConnectionSettingsMap;
3915 TDENetworkSettingsMap::const_iterator it;
3916 for (it = vpnConnection->pluginSecrets.begin(); it != vpnConnection->pluginSecrets.end(); ++it) {
3917 nestedConnectionSettingsMap[it.key()] = TQT_DBusData::fromString(it.data());
3919 if (nestedConnectionSettingsMap.count() > 0) settingsMap[
"secrets"] = (TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(nestedConnectionSettingsMap))).getAsVariantData();
3920 else settingsMap.remove(
"secrets");
3923 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3924 groupValid = (settingsMap.count() > 0);
3926 if (groupValid) outerMap.insert(
"vpn", dbusData,
true);
else outerMap.remove(
"vpn");
3929 dbusData = outerMap[
"wimax"];
3930 if (wiMaxConnection) {
3931 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3933 if (connection->lockedHWAddress.isValid()) {
3934 TDENetworkByteList address = connection->lockedHWAddress.address();
3935 TQT_DBusDataValueList valueList;
3936 TDENetworkByteList::iterator it;
3937 for (it = address.begin(); it != address.end(); ++it) {
3938 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
3939 valueList.append(innerDataValue);
3941 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
3942 settingsMap[
"mac-address"] = (nmHWAddress).getAsVariantData();
3945 settingsMap.remove(
"mac-address");
3947 UPDATE_STRING_SETTING_IF_VALID(wiMaxConnection->networkServiceProvider,
"network-name", settingsMap)
3949 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3950 groupValid = (settingsMap.count() > 0);
3952 if (groupValid) outerMap.insert(
"wimax", dbusData,
true);
else outerMap.remove(
"wimax");
3955 dbusData = outerMap[
"vlan"];
3956 if (vlanConnection) {
3957 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3959 UPDATE_STRING_SETTING_IF_VALID(vlanConnection->kernelName,
"interface-name", settingsMap)
3960 UPDATE_STRING_SETTING_IF_VALID(vlanConnection->parentConnectionUUID,
"parent", settingsMap)
3961 settingsMap[
"id"] = (TQT_DBusData::fromUInt32(vlanConnection->vlanID)).getAsVariantData();
3962 settingsMap[
"flags"] = (TQT_DBusData::fromUInt32(tdeVLANFlagsToNMVLANFlags(vlanConnection->vlanFlags))).getAsVariantData();
3964 TQT_DBusDataValueList valueList;
3965 TDENetworkPriorityMap::const_iterator it;
3966 for (it = vlanConnection->ingressPriorityMap.begin(); it != vlanConnection->ingressPriorityMap.end(); ++it) {
3967 valueList.append(TQT_DBusData::fromString(TQString(
"%1:%2").arg(it.key()).arg(it.data())));
3969 if (valueList.count() > 0) settingsMap[
"ingress-priority-map"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3972 TQT_DBusDataValueList valueList;
3973 TDENetworkPriorityMap::const_iterator it;
3974 for (it = vlanConnection->egressPriorityMap.begin(); it != vlanConnection->egressPriorityMap.end(); ++it) {
3975 valueList.append(TQT_DBusData::fromString(TQString(
"%1:%2").arg(it.key()).arg(it.data())));
3977 if (valueList.count() > 0) settingsMap[
"egress-priority-map"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
3980 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3981 groupValid = (settingsMap.count() > 0);
3983 if (groupValid) outerMap.insert(
"vlan", dbusData,
true);
else outerMap.remove(
"vlan");
3986 dbusData = outerMap[
"serial"];
3987 if (connection->serialConfig.valid) {
3988 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
3990 settingsMap[
"baud"] = (TQT_DBusData::fromUInt32(connection->serialConfig.baudRate)).getAsVariantData();
3991 settingsMap[
"bits"] = (TQT_DBusData::fromUInt32(connection->serialConfig.byteWidth)).getAsVariantData();
3992 settingsMap[
"parity"] = (TQT_DBusData::fromByte(tdeParityToNMParity(connection->serialConfig.parity))).getAsVariantData();
3993 settingsMap[
"stopbits"] = (TQT_DBusData::fromUInt32(connection->serialConfig.stopBits)).getAsVariantData();
3994 settingsMap[
"send-delay"] = (TQT_DBusData::fromUInt64(connection->serialConfig.txDelay)).getAsVariantData();
3996 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
3997 groupValid = (settingsMap.count() > 0);
3999 if (groupValid) outerMap.insert(
"serial", dbusData,
true);
else outerMap.remove(
"serial");
4002 dbusData = outerMap[
"ppp"];
4003 if (connection->pppConfig.valid) {
4004 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4006 settingsMap[
"noauth"] = (TQT_DBusData::fromBool(!(connection->pppConfig.requireServerAuthentication))).getAsVariantData();
4007 settingsMap[
"refuse-eap"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableEAP)).getAsVariantData();
4008 settingsMap[
"refuse-pap"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisablePAP)).getAsVariantData();
4009 settingsMap[
"refuse-chap"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableCHAP)).getAsVariantData();
4010 settingsMap[
"refuse-mschap"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAP)).getAsVariantData();
4011 settingsMap[
"refuse-mschapv2"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAPv2)).getAsVariantData();
4012 settingsMap[
"nobsdcomp"] = (TQT_DBusData::fromBool(!(connection->pppConfig.flags & TDENetworkPPPFlags::AllowBSDCompression))).getAsVariantData();
4013 settingsMap[
"nodeflate"] = (TQT_DBusData::fromBool(!(connection->pppConfig.flags & TDENetworkPPPFlags::AllowDeflateCompression))).getAsVariantData();
4014 settingsMap[
"no-vj-comp"] = (TQT_DBusData::fromBool(!(connection->pppConfig.flags & TDENetworkPPPFlags::AllowVJCompression))).getAsVariantData();
4015 settingsMap[
"require-mppe"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE)).getAsVariantData();
4016 settingsMap[
"require-mppe-128"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE128)).getAsVariantData();
4017 settingsMap[
"mppe-stateful"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::StatefulMPPE)).getAsVariantData();
4018 settingsMap[
"crtscts"] = (TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::UseHardwareFlowControl)).getAsVariantData();
4019 settingsMap[
"baud"] = (TQT_DBusData::fromUInt32(connection->pppConfig.baudRate)).getAsVariantData();
4020 if (connection->pppConfig.mru > 0) {
4021 settingsMap[
"mru"] = (TQT_DBusData::fromUInt32(connection->pppConfig.mru)).getAsVariantData();
4024 settingsMap.remove(
"mru");
4026 if (connection->pppConfig.mtu > 0) {
4027 settingsMap[
"mtu"] = (TQT_DBusData::fromUInt32(connection->pppConfig.mtu)).getAsVariantData();
4030 settingsMap.remove(
"mtu");
4032 if (connection->pppConfig.mtu > 0) {
4033 settingsMap[
"lcp-echo-interval"] = (TQT_DBusData::fromUInt32(connection->pppConfig.lcpEchoPingInterval)).getAsVariantData();
4036 settingsMap.remove(
"lcp-echo-interval");
4038 if (connection->pppConfig.mtu > 0) {
4039 settingsMap[
"lcp-echo-failure"] = (TQT_DBusData::fromUInt32(connection->pppConfig.lcpEchoFailureThreshold)).getAsVariantData();
4042 settingsMap.remove(
"lcp-echo-failure");
4045 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4046 groupValid = (settingsMap.count() > 0);
4048 if (groupValid) outerMap.insert(
"ppp", dbusData,
true);
else outerMap.remove(
"ppp");
4051 dbusData = outerMap[
"pppoe"];
4052 if (connection->pppoeConfig.valid) {
4053 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4055 UPDATE_STRING_SETTING_IF_VALID(connection->pppoeConfig.networkServiceProvider,
"service", settingsMap)
4056 UPDATE_STRING_SETTING_IF_VALID(connection->pppoeConfig.username,
"username", settingsMap)
4057 if (connection->pppoeConfig.secretsValid) {
4058 UPDATE_STRING_SETTING_IF_VALID(connection->pppoeConfig.password,
"password", settingsMap)
4060 settingsMap[
"password-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(connection->pppoeConfig.passwordFlags))).getAsVariantData();
4062 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4063 groupValid = (settingsMap.count() > 0);
4065 if (groupValid) outerMap.insert(
"pppoe", dbusData,
true);
else outerMap.remove(
"pppoe");
4068 dbusData = outerMap[
"802-11-olpc-mesh"];
4069 if (olpcMeshConnection) {
4070 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4074 TQT_DBusDataValueList valueList;
4075 for (i=0; i<olpcMeshConnection->SSID.count(); i++) {
4076 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(olpcMeshConnection->SSID[i]);
4077 valueList.append(innerDataValue);
4079 settingsMap[
"ssid"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4081 settingsMap[
"channel"] = (TQT_DBusData::fromUInt32(olpcMeshConnection->channel)).getAsVariantData();
4084 TQT_DBusDataValueList valueList;
4085 for (i=0; i<olpcMeshConnection->anycastDHCPHWAddress.count(); i++) {
4086 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(olpcMeshConnection->anycastDHCPHWAddress[i]);
4087 valueList.append(innerDataValue);
4089 settingsMap[
"dhcp-anycast-address"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4092 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4093 groupValid = (settingsMap.count() > 0);
4095 if (groupValid) outerMap.insert(
"802-11-olpc-mesh", dbusData,
true);
else outerMap.remove(
"802-11-olpc-mesh");
4098 dbusData = outerMap[
"bluetooth"];
4099 if (bluetoothConnection) {
4100 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4102 if (connection->lockedHWAddress.isValid()) {
4103 TDENetworkByteList address = connection->lockedHWAddress.address();
4104 TQT_DBusDataValueList valueList;
4105 TDENetworkByteList::iterator it;
4106 for (it = address.begin(); it != address.end(); ++it) {
4107 TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it);
4108 valueList.append(innerDataValue);
4110 TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList);
4111 settingsMap[
"bdaddr"] = (nmHWAddress).getAsVariantData();
4114 settingsMap.remove(
"bdaddr");
4116 UPDATE_STRING_SETTING_IF_VALID(tdeBluetoothModeToNMBluetoothMode(bluetoothConnection->type),
"type", settingsMap)
4118 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4119 groupValid = (settingsMap.count() > 0);
4121 if (groupValid) outerMap.insert(
"bluetooth", dbusData,
true);
else outerMap.remove(
"bluetooth");
4124 dbusData = outerMap[
"cdma"];
4125 if ((modemConnection) && (modemConnection->type == TDEModemConnectionType::CDMA)) {
4126 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4128 UPDATE_STRING_SETTING_IF_VALID(modemConnection->cdmaConfig.providerDataNumber,
"number", settingsMap)
4129 UPDATE_STRING_SETTING_IF_VALID(modemConnection->cdmaConfig.username,
"username", settingsMap)
4130 if (connection->pppoeConfig.secretsValid) {
4131 UPDATE_STRING_SETTING_IF_VALID(modemConnection->cdmaConfig.password,
"password", settingsMap)
4133 settingsMap[
"password-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(modemConnection->cdmaConfig.passwordFlags))).getAsVariantData();
4135 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4136 groupValid = (settingsMap.count() > 0);
4138 if (groupValid) outerMap.insert(
"cdma", dbusData,
true);
else outerMap.remove(
"cdma");
4141 dbusData = outerMap[
"gsm"];
4142 if ((modemConnection) && (modemConnection->type == TDEModemConnectionType::GSM)) {
4143 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4145 UPDATE_STRING_SETTING_IF_VALID(modemConnection->gsmConfig.providerDataNumber,
"number", settingsMap)
4146 UPDATE_STRING_SETTING_IF_VALID(modemConnection->gsmConfig.username,
"username", settingsMap)
4147 if (connection->pppoeConfig.secretsValid) {
4148 UPDATE_STRING_SETTING_IF_VALID(modemConnection->gsmConfig.password,
"password", settingsMap)
4150 settingsMap[
"password-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(modemConnection->gsmConfig.passwordFlags))).getAsVariantData();
4151 UPDATE_STRING_SETTING_IF_VALID(modemConnection->gsmConfig.accessPointName,
"apn", settingsMap)
4152 UPDATE_STRING_SETTING_IF_VALID(modemConnection->gsmConfig.networkID,
"network-id", settingsMap)
4153 settingsMap[
"network-type"] = (TQT_DBusData::fromInt32(tdeGSMModeToNMGSMMode(modemConnection->gsmConfig.networkType))).getAsVariantData();
4154 if (connection->pppoeConfig.secretsValid) {
4155 UPDATE_STRING_SETTING_IF_VALID(modemConnection->gsmConfig.pin,
"pin", settingsMap)
4157 settingsMap[
"pin-flags"] = (TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(modemConnection->gsmConfig.pinFlags))).getAsVariantData();
4158 settingsMap[
"allowed-bands"] = (TQT_DBusData::fromUInt32(modemConnection->gsmConfig.allowedFrequencyBands)).getAsVariantData();
4159 settingsMap[
"home-only"] = (TQT_DBusData::fromBool(!(modemConnection->gsmConfig.allowRoaming))).getAsVariantData();
4161 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4162 groupValid = (settingsMap.count() > 0);
4164 if (groupValid) outerMap.insert(
"gsm", dbusData,
true);
else outerMap.remove(
"gsm");
4167 dbusData = outerMap[
"ipv4"];
4169 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4172 TQT_DBusDataValueList valueList;
4173 TDENetworkSingleIPConfigurationList::iterator it;
4174 for (it = connection->ipConfig.ipConfigurations.begin(); it != connection->ipConfig.ipConfigurations.end(); ++it) {
4175 if ((*it).isIPv4()) {
4176 TQT_DBusDataValueList innerValueList;
4179 innerValueList.append(TQT_DBusData::fromUInt32(reverseIPV4ByteOrder((*it).ipAddress.toIPv4Address())));
4181 innerValueList.append(TQT_DBusData::fromUInt32((*it).networkMask.toCIDRMask()));
4183 innerValueList.append(TQT_DBusData::fromUInt32(reverseIPV4ByteOrder((*it).gateway.toIPv4Address())));
4184 valueList.append(TQT_DBusData::fromTQValueList(innerValueList));
4187 if (valueList.count() <= 0) {
4189 TQT_DBusData valueList;
4190 valueList = TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::UInt32));
4191 settingsMap[
"addresses"] = (TQT_DBusData::fromList(TQT_DBusDataList(valueList))).getAsVariantData();
4194 settingsMap[
"addresses"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4198 if (!connection->ipConfig.dhcpClientIdentifier.isNull()) {
4199 settingsMap[
"dhcp-client-id"] = (TQT_DBusData::fromString(connection->ipConfig.dhcpClientIdentifier)).getAsVariantData();
4203 TQT_DBusDataValueList valueList;
4204 TDENetworkAddressList::iterator it;
4205 for (it = connection->ipConfig.resolvers.begin(); it != connection->ipConfig.resolvers.end(); ++it) {
4206 if ((*it).isIPv4Address()) {
4207 valueList.append(TQT_DBusData::fromUInt32(reverseIPV4ByteOrder((*it).toIPv4Address())));
4210 if (valueList.count() <= 0) {
4212 settingsMap[
"dns"] = (TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::UInt32))).getAsVariantData();
4215 settingsMap[
"dns"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4219 TQT_DBusDataValueList valueList;
4220 TDENetworkSearchDomainList::iterator it;
4221 for (it = connection->ipConfig.searchDomains.begin(); it != connection->ipConfig.searchDomains.end(); ++it) {
4222 if ((*it).isIPv4()) {
4223 valueList.append(TQT_DBusData::fromString((*it).searchDomain()));
4226 if (valueList.count() > 0) settingsMap[
"dns-search"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4229 settingsMap[
"ignore-auto-dns"] = (TQT_DBusData::fromBool(!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPDNS))).getAsVariantData();
4232 settingsMap[
"may-fail"] = (TQT_DBusData::fromBool(!connection->requireIPV4)).getAsVariantData();
4236 if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) {
4239 else if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4LocalOnly) {
4240 method =
"link-local";
4242 else if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4StartConnectionSharingServer) {
4245 else if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4Disabled) {
4246 method =
"disabled";
4251 if (!method.isNull())
4252 settingsMap[
"method"] = (TQT_DBusData::fromString(method)).getAsVariantData();
4255 settingsMap[
"ignore-auto-routes"] = (TQT_DBusData::fromBool(!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPRoutes))).getAsVariantData();
4258 settingsMap[
"never-default"] = (TQT_DBusData::fromBool(!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4MayUseAsDefaultRoute))).getAsVariantData();
4261 TQT_DBusDataValueList valueList;
4262 TDENetworkSingleRouteConfigurationList::iterator it;
4263 for (it = connection->ipConfig.routeConfigurations.begin(); it != connection->ipConfig.routeConfigurations.end(); ++it) {
4264 if ((*it).isIPv4()) {
4265 TQT_DBusDataValueList innerValueList;
4268 innerValueList.append(TQT_DBusData::fromUInt32(reverseIPV4ByteOrder((*it).ipAddress.toIPv4Address())));
4270 innerValueList.append(TQT_DBusData::fromUInt32((*it).networkMask.toCIDRMask()));
4272 innerValueList.append(TQT_DBusData::fromUInt32(reverseIPV4ByteOrder((*it).gateway.toIPv4Address())));
4274 innerValueList.append(TQT_DBusData::fromUInt32((*it).metric));
4275 valueList.append(TQT_DBusData::fromTQValueList(innerValueList));
4278 if (valueList.count() <= 0) {
4280 TQT_DBusData valueList;
4281 valueList = TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::UInt32));
4282 settingsMap[
"routes"] = (TQT_DBusData::fromList(TQT_DBusDataList(valueList))).getAsVariantData();
4285 settingsMap[
"routes"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4289 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4290 groupValid = (settingsMap.count() > 0);
4292 if (groupValid) outerMap.insert(
"ipv4", dbusData,
true);
else outerMap.remove(
"ipv4");
4295 dbusData = outerMap[
"ipv6"];
4297 TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap();
4300 TQT_DBusDataValueList valueList;
4301 TDENetworkSingleIPConfigurationList::iterator it;
4302 for (it = connection->ipConfig.ipConfigurations.begin(); it != connection->ipConfig.ipConfigurations.end(); ++it) {
4303 if ((*it).isIPv6()) {
4305 Q_IPV6ADDR v6address;
4306 TQT_DBusDataValueList innerValueList;
4307 TQT_DBusDataValueList innerMostValueList;
4310 innerMostValueList.clear();
4311 v6address = (*it).ipAddress.toIPv6Address();
4312 for (i=0; i<16; i++) {
4313 innerMostValueList.append(TQT_DBusData::fromByte(v6address.c[i]));
4315 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4317 innerValueList.append(TQT_DBusData::fromUInt32((*it).networkMask.toCIDRMask()));
4319 innerMostValueList.clear();
4320 v6address = (*it).gateway.toIPv6Address();
4321 for (i=0; i<16; i++) {
4322 innerMostValueList.append(TQT_DBusData::fromByte(v6address.c[i]));
4324 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4325 valueList.append(TQT_DBusData::fromStruct(innerValueList));
4328 if (valueList.count() <= 0) {
4330 TQT_DBusDataValueList innerValueList;
4331 TQT_DBusDataValueList innerMostValueList;
4334 innerMostValueList.clear();
4335 innerMostValueList.append(TQT_DBusData::fromByte(0));
4336 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4338 innerValueList.append(TQT_DBusData::fromUInt32(0));
4340 innerMostValueList.clear();
4341 innerMostValueList.append(TQT_DBusData::fromByte(0));
4342 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4343 settingsMap[
"addresses"] = (TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::fromStruct(innerValueList)))).getAsVariantData();
4346 settingsMap[
"addresses"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4350 TQT_DBusDataValueList valueList;
4351 TDENetworkAddressList::iterator it;
4352 for (it = connection->ipConfig.resolvers.begin(); it != connection->ipConfig.resolvers.end(); ++it) {
4353 if ((*it).isIPv6Address()) {
4355 Q_IPV6ADDR v6address;
4356 TQT_DBusDataValueList innerValueList;
4357 v6address = (*it).toIPv6Address();
4358 for (i=0; i<16; i++) {
4359 innerValueList.append(TQT_DBusData::fromByte(v6address.c[i]));
4361 valueList.append(TQT_DBusData::fromTQValueList(innerValueList));
4364 if (valueList.count() <= 0) {
4366 TQT_DBusData valueList;
4367 valueList = TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::Byte));
4368 settingsMap[
"dns"] = (TQT_DBusData::fromList(TQT_DBusDataList(valueList))).getAsVariantData();
4371 settingsMap[
"dns"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4375 TQT_DBusDataValueList valueList;
4376 TDENetworkSearchDomainList::iterator it;
4377 for (it = connection->ipConfig.searchDomains.begin(); it != connection->ipConfig.searchDomains.end(); ++it) {
4378 if ((*it).isIPv6()) {
4379 valueList.append(TQT_DBusData::fromString((*it).searchDomain()));
4382 if (valueList.count() > 0) settingsMap[
"dns-search"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4385 settingsMap[
"ignore-auto-dns"] = (TQT_DBusData::fromBool(!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPDNS))).getAsVariantData();
4388 settingsMap[
"may-fail"] = (TQT_DBusData::fromBool(!connection->requireIPV6)).getAsVariantData();
4392 if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV6DHCPIP) {
4395 else if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV6LocalOnly) {
4396 method =
"link-local";
4398 else if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV6StartConnectionSharingServer) {
4401 else if (connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV6Disabled) {
4407 if (!method.isNull())
4408 settingsMap[
"method"] = (TQT_DBusData::fromString(method)).getAsVariantData();
4411 settingsMap[
"ignore-auto-routes"] = (TQT_DBusData::fromBool(!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV6DHCPRoutes))).getAsVariantData();
4414 settingsMap[
"never-default"] = (TQT_DBusData::fromBool(!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV6MayUseAsDefaultRoute))).getAsVariantData();
4417 TQT_DBusDataValueList valueList;
4418 TDENetworkSingleRouteConfigurationList::iterator it;
4419 for (it = connection->ipConfig.routeConfigurations.begin(); it != connection->ipConfig.routeConfigurations.end(); ++it) {
4420 if ((*it).isIPv6()) {
4422 Q_IPV6ADDR v6address;
4423 TQT_DBusDataValueList innerValueList;
4424 TQT_DBusDataValueList innerMostValueList;
4427 innerMostValueList.clear();
4428 v6address = (*it).ipAddress.toIPv6Address();
4429 for (i=0; i<16; i++) {
4430 innerMostValueList.append(TQT_DBusData::fromByte(v6address.c[i]));
4432 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4434 innerValueList.append(TQT_DBusData::fromUInt32((*it).networkMask.toCIDRMask()));
4436 innerMostValueList.clear();
4437 v6address = (*it).gateway.toIPv6Address();
4438 for (i=0; i<16; i++) {
4439 innerMostValueList.append(TQT_DBusData::fromByte(v6address.c[i]));
4441 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4443 innerValueList.append(TQT_DBusData::fromUInt32((*it).metric));
4444 valueList.append(TQT_DBusData::fromStruct(innerValueList));
4447 if (valueList.count() <= 0) {
4449 TQT_DBusDataValueList innerValueList;
4450 TQT_DBusDataValueList innerMostValueList;
4453 innerMostValueList.clear();
4454 innerMostValueList.append(TQT_DBusData::fromByte(0));
4455 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4457 innerValueList.append(TQT_DBusData::fromUInt32(0));
4459 innerMostValueList.clear();
4460 innerMostValueList.append(TQT_DBusData::fromByte(0));
4461 innerValueList.append(TQT_DBusData::fromTQValueList(innerMostValueList));
4463 innerValueList.append(TQT_DBusData::fromUInt32(0));
4464 settingsMap[
"routes"] = (TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::fromStruct(innerValueList)))).getAsVariantData();
4467 settingsMap[
"routes"] = (TQT_DBusData::fromTQValueList(valueList)).getAsVariantData();
4471 dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
4472 groupValid = (settingsMap.count() > 0);
4474 if (groupValid) outerMap.insert(
"ipv6", dbusData,
true);
else outerMap.remove(
"ipv6");
4476 connectionSettingsMap = TQT_DBusDataMap<TQString>(outerMap);
4483 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
4484 printf(
"[network-manager comm debug] uploaded DBUS object structure map follows:\n"); fflush(stdout);
4485 printDBUSObjectStructure(TQT_DBusData::fromStringKeyMap(connectionSettingsMap));
4489 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
4490 printf(
"[network-manager comm debug] Updating existing connection\n"); fflush(stdout);
4493 DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection);
4494 connectionSettings.setConnection(TQT_DBusConnection::systemBus());
4495 connect(&connectionSettings, TQ_SIGNAL(UpdateAsyncReply(
int)), d, TQ_SLOT(processConnectionSettingsUpdateAsyncReply(
int)));
4497 ret = connectionSettings.UpdateAsync(asyncCallID, connectionSettingsMap, error);
4498 if (ret && error.isValid()) {
4500 PRINT_ERROR((error.name() +
": " + error.message()))
4504 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
4505 TQTimer nmCallTimeoutTimer;
4506 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
4507 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
4508 tqApp->processEvents();
4509 if (!nmCallTimeoutTimer.isActive()) {
4510 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
4515 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
4520 PRINT_ERROR((error.name() +
": " + error.message()))
4525 #ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
4526 printf(
"[network-manager comm debug] Creating new connection\n"); fflush(stdout);
4529 connect(d->m_networkManagerSettings, TQ_SIGNAL(AddConnectionAsyncReply(
int,
const TQT_DBusObjectPath&)), d, TQ_SLOT(processAddConnectionAsyncReply(
int,
const TQT_DBusObjectPath&)));
4530 connect(d->m_networkManagerSettings, TQ_SIGNAL(AsyncErrorResponseDetected(
int,
const TQT_DBusError)), d, TQ_SLOT(processAddConnectionAsyncError(
int,
const TQT_DBusError)));
4532 ret = d->m_networkManagerSettings->AddConnectionAsync(asyncCallID, connectionSettingsMap, error);
4533 if (ret && error.isValid()) {
4535 PRINT_ERROR((error.name() +
": " + error.message()))
4539 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
4540 TQTimer nmCallTimeoutTimer;
4541 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
4542 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
4543 if (!nmCallTimeoutTimer.isActive()) {
4544 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
4548 tqApp->processEvents();
4550 if (d->nmAddConnectionAsyncErrorResponse.contains(asyncCallID)) {
4551 PRINT_ERROR((d->nmAddConnectionAsyncErrorResponse[asyncCallID].name() +
": " + d->nmAddConnectionAsyncErrorResponse[asyncCallID].message()));
4552 d->nmAddConnectionAsyncErrorResponse.remove(asyncCallID);
4554 if (!d->nmAddConnectionAsyncResponse[asyncCallID].ascii()) {
4555 PRINT_ERROR(TQString(
"NetworkManager did not return a new connection object!"))
4556 command_failed = true;
4558 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
4559 if (d->nmAddConnectionAsyncResponse.contains(asyncCallID)) {
4560 d->nmAddConnectionAsyncResponse.remove(asyncCallID);
4562 return ((!timed_out) && (!command_failed));
4566 PRINT_ERROR((error.name() +
": " + error.message()))
4572 bool TDENetworkConnectionManager_BackendNM::deleteConnection(TQString uuid) {
4573 TQT_DBusObjectPath existingConnection;
4574 TQT_DBusError error;
4575 bool timed_out =
false;
4577 if (d->m_networkManagerSettings) {
4578 ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error);
4581 DBus::ConnectionSettingsInterface connectionSettings(NM_DBUS_SERVICE, existingConnection);
4582 connectionSettings.setConnection(TQT_DBusConnection::systemBus());
4583 connect(&connectionSettings, TQ_SIGNAL(DeleteAsyncReply(
int)), d, TQ_SLOT(processConnectionSettingsUpdateAsyncReply(
int)));
4585 ret = connectionSettings.DeleteAsync(asyncCallID, error);
4586 if (ret && error.isValid()) {
4588 PRINT_ERROR((error.name() +
": " + error.message()))
4592 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
4593 TQTimer nmCallTimeoutTimer;
4594 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
4595 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
4596 tqApp->processEvents();
4597 if (!nmCallTimeoutTimer.isActive()) {
4598 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
4603 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
4607 PRINT_ERROR(TQString(
"Unable to remove connection with uuid '%1'").arg(uuid))
4612 PRINT_WARNING(TQString(
"connection for provided uuid '%1' was not found").arg(uuid));
4617 PRINT_ERROR(TQString(
"invalid internal network-manager settings proxy object"));
4622 bool TDENetworkConnectionManager_BackendNM::verifyConnectionSettings(TDENetworkConnection* connection, TDENetworkConnectionErrorFlags::TDENetworkConnectionErrorFlags* type, TDENetworkErrorStringMap* reason) {
4630 if (connection->friendlyName ==
"") {
4631 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidConnectionSetting] =
i18n(
"Connection name is invalid");
4632 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidConnectionSetting;
4636 if (connection->ipConfig.valid) {
4638 TDENetworkSingleIPConfigurationList::iterator it;
4639 for (it = connection->ipConfig.ipConfigurations.begin(); it != connection->ipConfig.ipConfigurations.end(); ++it) {
4640 if ((*it).isIPv4()) {
4641 if (!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP)) {
4642 if (!TDENetworkConnectionManager::validateIPAddress((*it).ipAddress)) {
4643 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidIPv4Setting] =
i18n(
"IPv4 address is invalid");
4644 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidIPv4Setting;
4649 else if ((*it).isIPv6()) {
4650 if (!(connection->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV6DHCPIP)) {
4651 if (!TDENetworkConnectionManager::validateIPAddress((*it).ipAddress)) {
4652 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidIPv6Setting] =
i18n(
"IPv6 address is invalid");
4653 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidIPv6Setting;
4661 TDEWiFiConnection* wiFiConnection =
dynamic_cast<TDEWiFiConnection*
>(connection);
4662 if (wiFiConnection) {
4663 if (wiFiConnection->SSID.count() < 1) {
4664 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessSetting] =
i18n(
"No SSID provided");
4665 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessSetting;
4668 if (wiFiConnection->securityRequired) {
4669 if (wiFiConnection->securitySettings.secretsValid) {
4670 if ((wiFiConnection->securitySettings.keyType == TDENetworkWiFiKeyType::WEP) || ((wiFiConnection->securitySettings.keyType == TDENetworkWiFiKeyType::DynamicWEP) && ((wiFiConnection->securitySettings.authType == TDENetworkWiFiAuthType::Open) || (wiFiConnection->securitySettings.authType == TDENetworkWiFiAuthType::Shared)))) {
4671 if (wiFiConnection->securitySettings.wepKeyType == TDENetworkWepKeyType::Hexadecimal) {
4672 if (wiFiConnection->securitySettings.wepKey0 !=
"") {
4673 if ((wiFiConnection->securitySettings.wepKey0.length() != 10) && (wiFiConnection->securitySettings.wepKey0.length() != 26)) {
4674 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 0 has invalid length");
4675 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4679 if (wiFiConnection->securitySettings.wepKey1 !=
"") {
4680 if ((wiFiConnection->securitySettings.wepKey1.length() != 10) && (wiFiConnection->securitySettings.wepKey1.length() != 26)) {
4681 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 1 has invalid length");
4682 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4686 if (wiFiConnection->securitySettings.wepKey2 !=
"") {
4687 if ((wiFiConnection->securitySettings.wepKey2.length() != 10) && (wiFiConnection->securitySettings.wepKey2.length() != 26)) {
4688 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 2 has invalid length");
4689 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4693 if (wiFiConnection->securitySettings.wepKey3 !=
"") {
4694 if ((wiFiConnection->securitySettings.wepKey3.length() != 10) && (wiFiConnection->securitySettings.wepKey3.length() != 26)) {
4695 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 3 has invalid length");
4696 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4700 if ((wiFiConnection->securitySettings.wepKey0 ==
"") && (wiFiConnection->securitySettings.wepKey1 ==
"") && (wiFiConnection->securitySettings.wepKey2 ==
"") && (wiFiConnection->securitySettings.wepKey3 ==
"")) {
4701 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"No WEP key(s) provided");
4702 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4706 else if (wiFiConnection->securitySettings.wepKeyType == TDENetworkWepKeyType::Ascii) {
4707 if (wiFiConnection->securitySettings.wepKey0 !=
"") {
4708 if ((wiFiConnection->securitySettings.wepKey0.length() != 5) && (wiFiConnection->securitySettings.wepKey0.length() != 13)) {
4709 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 0 has invalid length");
4710 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4714 if (wiFiConnection->securitySettings.wepKey1 !=
"") {
4715 if ((wiFiConnection->securitySettings.wepKey1.length() != 5) && (wiFiConnection->securitySettings.wepKey1.length() != 13)) {
4716 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 1 has invalid length");
4717 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4721 if (wiFiConnection->securitySettings.wepKey2 !=
"") {
4722 if ((wiFiConnection->securitySettings.wepKey2.length() != 5) && (wiFiConnection->securitySettings.wepKey2.length() != 13)) {
4723 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 2 has invalid length");
4724 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4728 if (wiFiConnection->securitySettings.wepKey3 !=
"") {
4729 if ((wiFiConnection->securitySettings.wepKey3.length() != 5) && (wiFiConnection->securitySettings.wepKey3.length() != 13)) {
4730 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"WEP key 3 has invalid length");
4731 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4735 if ((wiFiConnection->securitySettings.wepKey0 ==
"") && (wiFiConnection->securitySettings.wepKey1 ==
"") && (wiFiConnection->securitySettings.wepKey2 ==
"") && (wiFiConnection->securitySettings.wepKey3 ==
"")) {
4736 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"No WEP key(s) provided");
4737 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4741 else if (wiFiConnection->securitySettings.wepKeyType == TDENetworkWepKeyType::Ascii) {
4742 if ((wiFiConnection->securitySettings.wepKey0 ==
"") && (wiFiConnection->securitySettings.wepKey1 ==
"") && (wiFiConnection->securitySettings.wepKey2 ==
"") && (wiFiConnection->securitySettings.wepKey3 ==
"")) {
4743 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"No WEP key(s) provided");
4744 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4749 else if ((wiFiConnection->securitySettings.keyType == TDENetworkWiFiKeyType::DynamicWEP) && (wiFiConnection->securitySettings.authType == TDENetworkWiFiAuthType::LEAP)) {
4750 if ((wiFiConnection->securitySettings.leapUsername.length() < 1) || (wiFiConnection->securitySettings.leapPassword.length() < 1)) {
4751 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"LEAP username and/or password not provided");
4752 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4756 else if ((wiFiConnection->securitySettings.keyType == TDENetworkWiFiKeyType::WPAAdHoc) || (wiFiConnection->securitySettings.keyType == TDENetworkWiFiKeyType::WPAInfrastructure) || (wiFiConnection->securitySettings.keyType == TDENetworkWiFiKeyType::WPAEnterprise)) {
4757 if (wiFiConnection->securitySettings.psk.length() == 64) {
4760 wiFiConnection->securitySettings.psk.toULongLong(&ok, 16);
4762 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"Hexadecimal length PSK contains non-hexadecimal characters");
4763 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4767 else if ((wiFiConnection->securitySettings.psk.length() < 8) || (wiFiConnection->securitySettings.psk.length() > 63)) {
4768 if (reason) (*reason)[TDENetworkConnectionErrorFlags::InvalidWirelessKey] =
i18n(
"No PSK provided");
4769 if (type) *type |= TDENetworkConnectionErrorFlags::InvalidWirelessKey;
4780 TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManager_BackendNM::initiateConnection(TQString uuid) {
4781 TQT_DBusObjectPath existingConnection;
4782 TQT_DBusError error;
4784 if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) {
4785 ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error);
4787 if (!m_networkDevice) {
4788 d->m_dbusDeviceString =
"/";
4791 d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
4793 if (d->m_dbusDeviceString.isEmpty()) {
4794 PRINT_ERROR(TQString(
"Invalid empty DBUS device string"))
4795 return TDENetworkConnectionStatus::Invalid;
4797 #ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
4798 TQT_DBusObjectPath active_connection;
4799 ret = d->m_networkManagerProxy->ActivateConnection(existingConnection, TQT_DBusObjectPath(d->m_dbusDeviceString.ascii()), TQT_DBusObjectPath(
"/"), active_connection, error);
4800 if (ret && error.isValid()) {
4802 PRINT_ERROR((error.name() +
": " + error.message()))
4804 return checkConnectionStatus(uuid);
4806 #ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING
4807 connect(d->m_networkManagerProxy, TQ_SIGNAL(ActivateConnectionAsyncReply(
int,
const TQT_DBusObjectPath&)), d, TQ_SLOT(processAddConnectionAsyncReply(
int,
const TQT_DBusObjectPath&)));
4808 connect(d->m_networkManagerProxy, TQ_SIGNAL(AsyncErrorResponseDetected(
int,
const TQT_DBusError)), d, TQ_SLOT(processAddConnectionAsyncError(
int,
const TQT_DBusError)));
4811 ret = d->m_networkManagerProxy->ActivateConnectionAsync(asyncCallID, existingConnection, TQT_DBusObjectPath(d->m_dbusDeviceString.ascii()), TQT_DBusObjectPath(
"/"), error);
4812 if (ret && error.isValid()) {
4814 PRINT_ERROR((error.name() +
": " + error.message()))
4816 #ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING
4819 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
4820 TQTimer nmCallTimeoutTimer;
4821 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
4822 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
4823 if (!nmCallTimeoutTimer.isActive()) {
4824 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
4827 tqApp->processEvents();
4829 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
4830 if (d->nmAddConnectionAsyncErrorResponse.contains(asyncCallID)) {
4831 PRINT_ERROR((d->nmAddConnectionAsyncErrorResponse[asyncCallID].name() +
": " + d->nmAddConnectionAsyncErrorResponse[asyncCallID].message()));
4832 d->nmAddConnectionAsyncErrorResponse.remove(asyncCallID);
4834 if (!d->nmAddConnectionAsyncResponse[asyncCallID].ascii()) {
4835 PRINT_ERROR(TQString(
"NetworkManager did not return a new connection object!"))
4837 if (d->nmAddConnectionAsyncResponse.contains(asyncCallID)) {
4838 d->nmAddConnectionAsyncResponse.remove(asyncCallID);
4840 return checkConnectionStatus(uuid);
4844 PRINT_ERROR((error.name() +
": " + error.message()))
4845 return checkConnectionStatus(uuid);
4848 return checkConnectionStatus(uuid);
4853 PRINT_WARNING(TQString(
"connection for provided uuid '%1' was not found").arg(uuid));
4854 return TDENetworkConnectionStatus::Invalid;
4858 PRINT_ERROR(TQString(
"invalid internal network-manager settings proxy object"));
4859 return TDENetworkConnectionStatus::Invalid;
4863 TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManager_BackendNM::checkConnectionStatus(TQString uuid) {
4864 TQT_DBusObjectPath existingConnection;
4865 TQT_DBusError error;
4866 if (d->m_networkManagerProxy) {
4867 TQT_DBusObjectPathList activeConnections = d->m_networkManagerProxy->getActiveConnections(error);
4868 TQT_DBusObjectPathList::iterator it;
4869 for (it = activeConnections.begin(); it != activeConnections.end(); ++it) {
4870 DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, (*it));
4871 activeConnection.setConnection(TQT_DBusConnection::systemBus());
4872 if (activeConnection.getUuid(error) == uuid) {
4873 return nmDeviceStateToTDEDeviceState(activeConnection.getState(error));
4876 PRINT_WARNING(TQString(
"active connection for provided uuid '%1' was not found").arg(uuid));
4877 return TDENetworkConnectionStatus::Invalid;
4880 PRINT_ERROR(TQString(
"invalid internal network-manager settings proxy object"));
4881 return TDENetworkConnectionStatus::Invalid;
4885 TQT_DBusObjectPath TDENetworkConnectionManager_BackendNM::getActiveConnectionPath(TQString uuid) {
4886 TQT_DBusObjectPath existingConnection;
4887 TQT_DBusError error;
4888 if (d->m_networkManagerProxy) {
4889 TQT_DBusObjectPathList activeConnections = d->m_networkManagerProxy->getActiveConnections(error);
4890 TQT_DBusObjectPathList::iterator it;
4891 for (it = activeConnections.begin(); it != activeConnections.end(); ++it) {
4892 DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, (*it));
4893 activeConnection.setConnection(TQT_DBusConnection::systemBus());
4894 if (activeConnection.getUuid(error) == uuid) {
4898 PRINT_WARNING(TQString(
"active connection for provided uuid '%1' was not found").arg(uuid));
4899 return TQT_DBusObjectPath();
4902 PRINT_ERROR(TQString(
"invalid internal network-manager settings proxy object"));
4903 return TQT_DBusObjectPath();
4907 TQStringList TDENetworkConnectionManager_BackendNM::connectionPhysicalDeviceUUIDs(TQString uuid) {
4908 if (deviceType() == TDENetworkDeviceType::BackendOnly) {
4909 return TQStringList();
4912 TQT_DBusObjectPath existingConnection;
4913 TQT_DBusError error;
4914 if (d->m_networkManagerProxy) {
4915 TQT_DBusObjectPathList activeConnections = d->m_networkManagerProxy->getActiveConnections(error);
4916 TQT_DBusObjectPathList::iterator it;
4918 for (it = activeConnections.begin(); it != activeConnections.end(); ++it) {
4919 DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, (*it));
4920 activeConnection.setConnection(TQT_DBusConnection::systemBus());
4921 if (activeConnection.getUuid(error) == uuid) {
4922 TQValueList<TQT_DBusObjectPath> deviceList = activeConnection.getDevices(error);
4923 TQT_DBusObjectPathList::iterator it2;
4924 for (it2 = deviceList.begin(); it2 != deviceList.end(); ++it2) {
4925 TQString devUUID = tdeDeviceUUIDForGenericDevice(*it2);
4926 if (devUUID !=
"") {
4927 ret.append(devUUID);
4935 PRINT_ERROR(TQString(
"invalid internal network-manager settings proxy object"));
4936 return TQStringList();
4940 TDENetworkVPNTypeList TDENetworkConnectionManager_BackendNM::availableVPNTypes() {
4941 TDENetworkVPNTypeList ret;
4944 TQDir serviceDir(NM_PLUGIN_SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files);
4945 TQStringList services = serviceDir.entryList ().grep (
".name",
true);
4947 if (services.count () > 0) {
4949 for (TQStringList::Iterator i = services.begin (); i != services.end (); ++i) {
4950 TQString service = NM_PLUGIN_SERVICE_DIR + TQString (
"/") + *i;
4952 tdeconfig->
setGroup (
"VPN Connection");
4954 TQString serviceName = tdeconfig->
readEntry(
"name", TQString());
4955 serviceName = serviceName.lower();
4957 if (serviceName ==
"openvpn") {
4958 ret.append(TDENetworkVPNType::OpenVPN);
4960 if (serviceName ==
"pptp") {
4961 ret.append(TDENetworkVPNType::PPTP);
4963 if (serviceName ==
"strongswan") {
4964 ret.append(TDENetworkVPNType::StrongSwan);
4966 if (serviceName ==
"vpnc") {
4967 ret.append(TDENetworkVPNType::VPNC);
4977 TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManager_BackendNM::deactivateConnection(TQString uuid) {
4978 TQT_DBusObjectPath existingConnection;
4979 TQT_DBusError error;
4981 if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) {
4982 existingConnection = getActiveConnectionPath(uuid);
4983 if (existingConnection.isValid()) {
4984 if (!m_networkDevice) {
4985 d->m_dbusDeviceString =
"/";
4988 d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
4990 if (d->m_dbusDeviceString.isEmpty()) {
4991 PRINT_ERROR(TQString(
"Invalid empty DBUS device string"))
4992 return TDENetworkConnectionStatus::Invalid;
4994 #ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
4995 ret = d->m_networkManagerProxy->DeactivateConnection(existingConnection, error);
4996 if (ret && error.isValid()) {
4998 PRINT_ERROR((error.name() +
": " + error.message()))
5000 return checkConnectionStatus(uuid);
5002 #ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING
5003 connect(d->m_networkManagerProxy, TQ_SIGNAL(DeactivateConnectionAsyncReply(
int)), d, TQ_SLOT(processConnectionSettingsUpdateAsyncReply(
int)));
5006 ret = d->m_networkManagerProxy->DeactivateConnectionAsync(asyncCallID, existingConnection, error);
5007 if (ret && error.isValid()) {
5009 PRINT_ERROR((error.name() +
": " + error.message()))
5011 #ifdef WAIT_FOR_OPERATION_BEFORE_RETURNING
5014 d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] =
true;
5015 TQTimer nmCallTimeoutTimer;
5016 nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS,
true);
5017 while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
5018 if (!nmCallTimeoutTimer.isActive()) {
5019 PRINT_ERROR(TQString(
"DBUS asynchronous call timed out!"))
5022 tqApp->processEvents();
5024 d->nmConnectionSettingsAsyncCallWaiting.remove(asyncCallID);
5025 return checkConnectionStatus(uuid);
5029 PRINT_ERROR((error.name() +
": " + error.message()))
5030 return checkConnectionStatus(uuid);
5033 return checkConnectionStatus(uuid);
5038 PRINT_WARNING(TQString(
"connection for provided uuid '%1' was not found").arg(uuid));
5039 return TDENetworkConnectionStatus::Invalid;
5043 PRINT_ERROR(TQString(
"invalid internal network-manager settings proxy object"));
5044 return TDENetworkConnectionStatus::Invalid;
5048 TQStringList TDENetworkConnectionManager_BackendNM::validSettings() {
5051 ret.append(
"TDENetworkSingleIPConfiguration::ipAddress");
5052 ret.append(
"TDENetworkSingleIPConfiguration::networkMask");
5053 ret.append(
"TDENetworkSingleIPConfiguration::gateway");
5055 ret.append(
"TDENetworkSingleRouteConfiguration::ipAddress");
5056 ret.append(
"TDENetworkSingleRouteConfiguration::networkMask");
5057 ret.append(
"TDENetworkSingleRouteConfiguration::gateway");
5059 ret.append(
"TDENetworkIEEE8021xConfiguration::valid");
5060 ret.append(
"TDENetworkIEEE8021xConfiguration::allowedValid");
5061 ret.append(
"TDENetworkIEEE8021xConfiguration::secretsValid");
5062 ret.append(
"TDENetworkIEEE8021xConfiguration::type");
5063 ret.append(
"TDENetworkIEEE8021xConfiguration::userName");
5064 ret.append(
"TDENetworkIEEE8021xConfiguration::anonymousUserName");
5065 ret.append(
"TDENetworkIEEE8021xConfiguration::pacFileName");
5066 ret.append(
"TDENetworkIEEE8021xConfiguration::caCertificate");
5067 ret.append(
"TDENetworkIEEE8021xConfiguration::additionalCAFilesPath");
5068 ret.append(
"TDENetworkIEEE8021xConfiguration::authServerCertSubjectMatch");
5069 ret.append(
"TDENetworkIEEE8021xConfiguration::alternateAuthServerCertSubjectMatch");
5070 ret.append(
"TDENetworkIEEE8021xConfiguration::clientCertificate");
5071 ret.append(
"TDENetworkIEEE8021xConfiguration::forcePEAPVersion");
5072 ret.append(
"TDENetworkIEEE8021xConfiguration::forcePEAPLabel");
5073 ret.append(
"TDENetworkIEEE8021xConfiguration::fastProvisioningFlags");
5074 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2NonEAPAuthMethod");
5075 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2EAPAuthMethod");
5076 ret.append(
"TDENetworkIEEE8021xConfiguration::allowedPhase2NonEAPMethods");
5077 ret.append(
"TDENetworkIEEE8021xConfiguration::allowedPhase2EAPMethods");
5078 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2CaCertificate");
5079 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2CaFilesPath");
5080 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2AuthServerCertSubjectMatch");
5081 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2AlternateAuthServerCertSubjectMatch");
5082 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2ClientCertificate");
5083 ret.append(
"TDENetworkIEEE8021xConfiguration::password");
5084 ret.append(
"TDENetworkIEEE8021xConfiguration::passwordFlags");
5085 ret.append(
"TDENetworkIEEE8021xConfiguration::binaryPassword");
5086 ret.append(
"TDENetworkIEEE8021xConfiguration::binaryPasswordFlags");
5087 ret.append(
"TDENetworkIEEE8021xConfiguration::privateKey");
5088 ret.append(
"TDENetworkIEEE8021xConfiguration::privateKeyPassword");
5089 ret.append(
"TDENetworkIEEE8021xConfiguration::privateKeyPasswordFlags");
5090 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2PrivateKey");
5091 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2PrivateKeyPassword");
5092 ret.append(
"TDENetworkIEEE8021xConfiguration::phase2PrivateKeyPasswordFlags");
5093 ret.append(
"TDENetworkIEEE8021xConfiguration::forceSystemCaCertificates");
5095 ret.append(
"TDENetworkPPPConfiguration::valid");
5096 ret.append(
"TDENetworkPPPConfiguration::requireServerAuthentication");
5097 ret.append(
"TDENetworkPPPConfiguration::flags");
5098 ret.append(
"TDENetworkPPPConfiguration::baudRate");
5099 ret.append(
"TDENetworkPPPConfiguration::mru");
5100 ret.append(
"TDENetworkPPPConfiguration::mtu");
5101 ret.append(
"TDENetworkPPPConfiguration::lcpEchoPingInterval");
5102 ret.append(
"TDENetworkPPPConfiguration::lcpEchoFailureThreshold");
5104 ret.append(
"TDENetworkPPPOEConfiguration::valid");
5105 ret.append(
"TDENetworkPPPOEConfiguration::secretsValid");
5106 ret.append(
"TDENetworkPPPOEConfiguration::networkServiceProvider");
5107 ret.append(
"TDENetworkPPPOEConfiguration::username");
5108 ret.append(
"TDENetworkPPPOEConfiguration::password");
5109 ret.append(
"TDENetworkPPPOEConfiguration::passwordFlags");
5111 ret.append(
"TDENetworkSerialConfiguration::valid");
5112 ret.append(
"TDENetworkSerialConfiguration::baudRate");
5113 ret.append(
"TDENetworkSerialConfiguration::byteWidth");
5114 ret.append(
"TDENetworkSerialConfiguration::parity");
5115 ret.append(
"TDENetworkSerialConfiguration::stopBits");
5116 ret.append(
"TDENetworkSerialConfiguration::txDelay");
5118 ret.append(
"TDENetworkCDMAConfiguration::valid");
5119 ret.append(
"TDENetworkCDMAConfiguration::secretsValid");
5120 ret.append(
"TDENetworkCDMAConfiguration::providerDataNumber");
5121 ret.append(
"TDENetworkCDMAConfiguration::username");
5122 ret.append(
"TDENetworkCDMAConfiguration::password");
5123 ret.append(
"TDENetworkCDMAConfiguration::passwordFlags");
5125 ret.append(
"TDENetworkGSMConfiguration::valid");
5126 ret.append(
"TDENetworkGSMConfiguration::secretsValid");
5127 ret.append(
"TDENetworkGSMConfiguration::providerDataNumber");
5128 ret.append(
"TDENetworkGSMConfiguration::username");
5129 ret.append(
"TDENetworkGSMConfiguration::password");
5130 ret.append(
"TDENetworkGSMConfiguration::passwordFlags");
5131 ret.append(
"TDENetworkGSMConfiguration::accessPointName");
5132 ret.append(
"TDENetworkGSMConfiguration::networkID");
5133 ret.append(
"TDENetworkGSMConfiguration::networkType");
5134 ret.append(
"TDENetworkGSMConfiguration::pin");
5135 ret.append(
"TDENetworkGSMConfiguration::pinFlags");
5136 ret.append(
"TDENetworkGSMConfiguration::allowedFrequencyBands");
5137 ret.append(
"TDENetworkGSMConfiguration::allowRoaming");
5139 ret.append(
"TDENetworkWiFiSecurityConfiguration::valid");
5140 ret.append(
"TDENetworkWiFiSecurityConfiguration::secretsValid");
5141 ret.append(
"TDENetworkWiFiSecurityConfiguration::keyType");
5142 ret.append(
"TDENetworkWiFiSecurityConfiguration::authType");
5143 ret.append(
"TDENetworkWiFiSecurityConfiguration::wpaVersion");
5144 ret.append(
"TDENetworkWiFiSecurityConfiguration::cipher");
5145 ret.append(
"TDENetworkWiFiSecurityConfiguration::wepKey0");
5146 ret.append(
"TDENetworkWiFiSecurityConfiguration::wepKey1");
5147 ret.append(
"TDENetworkWiFiSecurityConfiguration::wepKey2");
5148 ret.append(
"TDENetworkWiFiSecurityConfiguration::wepKey3");
5149 ret.append(
"TDENetworkWiFiSecurityConfiguration::wepKeyFlags");
5150 ret.append(
"TDENetworkWiFiSecurityConfiguration::wepKeyIndex");
5151 ret.append(
"TDENetworkWiFiSecurityConfiguration::wepKeyType");
5152 ret.append(
"TDENetworkWiFiSecurityConfiguration::allowedPairWiseCiphers");
5153 ret.append(
"TDENetworkWiFiSecurityConfiguration::allowedGroupWiseCiphers");
5154 ret.append(
"TDENetworkWiFiSecurityConfiguration::psk");
5155 ret.append(
"TDENetworkWiFiSecurityConfiguration::pskFlags");
5156 ret.append(
"TDENetworkWiFiSecurityConfiguration::leapUsername");
5157 ret.append(
"TDENetworkWiFiSecurityConfiguration::leapPassword");
5158 ret.append(
"TDENetworkWiFiSecurityConfiguration::leapPasswordFlags");
5160 ret.append(
"TDENetworkIPConfiguration::valid");
5161 ret.append(
"TDENetworkIPConfiguration::connectionFlags");
5162 ret.append(
"TDENetworkIPConfiguration::ipConfigurations");
5163 ret.append(
"TDENetworkIPConfiguration::routeConfigurations");
5164 ret.append(
"TDENetworkIPConfiguration::broadcast");
5165 ret.append(
"TDENetworkIPConfiguration::destination");
5166 ret.append(
"TDENetworkIPConfiguration::resolvers");
5167 ret.append(
"TDENetworkIPConfiguration::searchDomains");
5168 ret.append(
"TDENetworkIPConfiguration::dhcpClientIdentifier");
5170 ret.append(
"TDENetworkConnection::UUID");
5171 ret.append(
"TDENetworkConnection::friendlyName");
5172 ret.append(
"TDENetworkConnection::ipConfig");
5173 ret.append(
"TDENetworkConnection::lockedHWAddress");
5174 ret.append(
"TDENetworkConnection::manualHWAddress");
5175 ret.append(
"TDENetworkConnection::readOnly");
5176 ret.append(
"TDENetworkConnection::autoConnect");
5177 ret.append(
"TDENetworkConnection::fullDuplex");
5178 ret.append(
"TDENetworkConnection::requireIPV4");
5179 ret.append(
"TDENetworkConnection::requireIPV6");
5180 ret.append(
"TDENetworkConnection::mtu");
5181 ret.append(
"TDENetworkConnection::eapConfig");
5182 ret.append(
"TDENetworkConnection::pppConfig");
5183 ret.append(
"TDENetworkConnection::pppoeConfig");
5184 ret.append(
"TDENetworkConnection::serialConfig");
5185 ret.append(
"TDENetworkConnection::authorizedUsers");
5186 ret.append(
"TDENetworkConnection::masterConnectionUUID");
5187 ret.append(
"TDENetworkConnection::slaveType");
5188 ret.append(
"TDENetworkConnection::lastKnownConnection");
5190 ret.append(
"TDEWiFiConnection::SSID");
5191 ret.append(
"TDEWiFiConnection::operatingMode");
5192 ret.append(
"TDEWiFiConnection::bandRestriction");
5193 ret.append(
"TDEWiFiConnection::channelRestriction");
5194 ret.append(
"TDEWiFiConnection::bitRateRestriction");
5195 ret.append(
"TDEWiFiConnection::powerRestriction");
5196 ret.append(
"TDEWiFiConnection::accessPointRestriction");
5197 ret.append(
"TDEWiFiConnection::blacklistedBSSIDs");
5198 ret.append(
"TDEWiFiConnection::heardBSSIDs");
5199 ret.append(
"TDEWiFiConnection::isHiddenNetwork");
5200 ret.append(
"TDEWiFiConnection::securityRequired");
5201 ret.append(
"TDEWiFiConnection::securitySettings");
5203 ret.append(
"TDEWiredInfinibandConnection::transportMode");
5205 ret.append(
"TDEVPNConnection::vpnPluginID");
5206 ret.append(
"TDEVPNConnection::lockedUserName");
5207 ret.append(
"TDEVPNConnection::pluginData");
5208 ret.append(
"TDEVPNConnection::secretsValid");
5209 ret.append(
"TDEVPNConnection::pluginSecrets");
5211 ret.append(
"TDEWiMaxConnection::networkServiceProvider");
5213 ret.append(
"TDEVLANConnection::kernelName");
5214 ret.append(
"TDEVLANConnection::parentConnectionUUID");
5215 ret.append(
"TDEVLANConnection::vlanID");
5216 ret.append(
"TDEVLANConnection::vlanFlags");
5217 ret.append(
"TDEVLANConnection::ingressPriorityMap");
5218 ret.append(
"TDEVLANConnection::egressPriorityMap");
5220 ret.append(
"TDEOLPCMeshConnection::SSID");
5221 ret.append(
"TDEOLPCMeshConnection::channel");
5222 ret.append(
"TDEOLPCMeshConnection::anycastDHCPHWAddress");
5224 ret.append(
"TDEBluetoothConnection::type");
5226 ret.append(
"TDEModemConnection::type");
5227 ret.append(
"TDEModemConnection::cdmaConfig");
5228 ret.append(
"TDEModemConnection::gsmConfig");
5230 ret.append(
"TDEWiredInfinibandConnection::transportMode");
5235 TDENetworkWiFiAPInfo* TDENetworkConnectionManager_BackendNM::getAccessPointDetails(TQString dbusPath) {
5236 if (dbusPath ==
"") {
5240 TDENetworkWiFiAPInfo* apInfo =
new TDENetworkWiFiAPInfo;
5241 TQT_DBusError error;
5243 DBus::AccessPointProxy accessPoint(NM_DBUS_SERVICE, dbusPath);
5244 accessPoint.setConnection(TQT_DBusConnection::systemBus());
5246 TQValueList<TQ_UINT8> nmSSID = accessPoint.getSsid(error);
5247 if (error.isValid()) {
5251 TQValueList<TQ_UINT8>::iterator it;
5253 for (it = nmSSID.begin(); it != nmSSID.end(); ++it) {
5254 apInfo->SSID.resize(index+1);
5255 apInfo->SSID[index] = (*it);
5259 apInfo->wpaFlags = nmAPSecFlagsToTDEAPSecFlags(accessPoint.getFlags(error), accessPoint.getWpaFlags(error));
5260 apInfo->rsnFlags = nmAPSecFlagsToTDEAPSecFlags(accessPoint.getFlags(error), accessPoint.getRsnFlags(error));
5261 apInfo->frequency = accessPoint.getFrequency(error);
5262 apInfo->BSSID.fromString(accessPoint.getHwAddress(error));
5263 apInfo->maxBitrate = accessPoint.getMaxBitrate(error);
5264 apInfo->signalQuality = (accessPoint.getStrength(error)/100.0);
5266 apInfo->valid =
true;
5271 TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() {
5272 TQT_DBusError error;
5275 TDENetworkDeviceType::TDENetworkDeviceType myDeviceType = deviceType();
5276 d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
5277 clearTDENetworkHWNeighborList();
5279 if (myDeviceType == TDENetworkDeviceType::WiFi) {
5280 if (!d->m_dbusDeviceString.isEmpty()) {
5281 DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
5282 wiFiDevice.setConnection(TQT_DBusConnection::systemBus());
5285 TQT_DBusObjectPathList accessPoints;
5286 ret = wiFiDevice.GetAccessPoints(accessPoints, error);
5288 TQT_DBusObjectPathList::iterator it;
5289 for (it = accessPoints.begin(); it != accessPoints.end(); ++it) {
5290 TDENetworkWiFiAPInfo* apInfo = getAccessPointDetails(TQString(*it));
5292 m_hwNeighborList->append(apInfo);
5294 d->internalProcessWiFiAccessPointAdded(*it);
5301 return m_hwNeighborList;
5304 bool TDENetworkConnectionManager_BackendNM::networkingEnabled() {
5305 if (d->m_networkManagerProxy) {
5307 TQT_DBusError error;
5308 ret = d->m_networkManagerProxy->getNetworkingEnabled(error);
5309 if (error.isValid()) {
5311 PRINT_ERROR((error.name() +
": " + error.message()))
5323 bool TDENetworkConnectionManager_BackendNM::wiFiHardwareEnabled() {
5324 if (d->m_networkManagerProxy) {
5326 TQT_DBusError error;
5327 ret = d->m_networkManagerProxy->getWirelessHardwareEnabled(error);
5328 if (error.isValid()) {
5330 PRINT_ERROR((error.name() +
": " + error.message()))
5342 bool TDENetworkConnectionManager_BackendNM::enableNetworking(
bool enable) {
5346 if (d->m_networkManagerProxy) {
5348 TQT_DBusError error;
5349 d->m_networkManagerProxy->SleepAsync(asynccallid, !enable, error);
5350 if (error.isValid()) {
5352 PRINT_ERROR((error.name() +
": " + error.message()))
5366 bool TDENetworkConnectionManager_BackendNM::enableWiFi(
bool enable) {
5367 if (d->m_networkManagerProxy) {
5368 TQT_DBusError error;
5369 d->m_networkManagerProxy->setWirelessEnabled(enable, error);
5370 if (error.isValid()) {
5372 PRINT_ERROR((error.name() +
": " + error.message()))
5384 bool TDENetworkConnectionManager_BackendNM::wiFiEnabled() {
5385 if (d->m_networkManagerProxy) {
5387 TQT_DBusError error;
5388 ret = d->m_networkManagerProxy->getWirelessEnabled(error);
5389 if (error.isValid()) {
5391 PRINT_ERROR((error.name() +
": " + error.message()))
5403 TQStringList TDENetworkConnectionManager_BackendNM::defaultNetworkDevices() {
5407 TQT_DBusObjectPath existingConnection;
5408 TQT_DBusError error;
5409 if (d->m_networkManagerProxy) {
5410 TQT_DBusObjectPathList activeConnections = d->m_networkManagerProxy->getActiveConnections(error);
5411 TQT_DBusObjectPathList::iterator it;
5412 for (it = activeConnections.begin(); it != activeConnections.end(); ++it) {
5413 DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, (*it));
5414 activeConnection.setConnection(TQT_DBusConnection::systemBus());
5415 if (activeConnection.getDefault(error)) {
5417 TQString uuid = activeConnection.getUuid(error);
5418 TQStringList devices = connectionPhysicalDeviceUUIDs(uuid);
5419 for (TQStringList::Iterator it2 = devices.begin(); it2 != devices.end(); ++it2) {
5423 else if (activeConnection.getDefault6(error)) {
5425 TQString uuid = activeConnection.getUuid(error);
5426 TQStringList devices = connectionPhysicalDeviceUUIDs(uuid);
5427 for (TQStringList::Iterator it2 = devices.begin(); it2 != devices.end(); ++it2) {
5435 PRINT_ERROR(TQString(
"invalid internal network-manager settings proxy object"));
5436 return TQStringList();
5440 TDENetworkConnectionManager_BackendNMPrivate::TDENetworkConnectionManager_BackendNMPrivate(TDENetworkConnectionManager_BackendNM* parent) : m_networkManagerProxy(NULL), m_networkManagerSettings(NULL), m_networkDeviceProxy(NULL), m_wiFiDeviceProxy(NULL), m_vpnProxy(NULL), nonReentrantCallActive(false), vpn_service_error_notified(false), device_autoconnect_error_notified(false), m_parent(parent), m_prevDeviceState(-1) {
5442 m_dbusSignalConnection =
new TQT_DBusConnection(TQT_DBusConnection::systemBus());
5443 m_dbusSignalReceiver =
new TDENetworkConnectionManager_BackendNM_DBusSignalReceiver(
this);
5444 m_dbusSignalConnection->connect(m_dbusSignalReceiver, TQ_SLOT(dbusSignal(
const TQT_DBusMessage&)));
5447 TDENetworkConnectionManager_BackendNMPrivate::~TDENetworkConnectionManager_BackendNMPrivate() {
5449 if (m_dbusSignalConnection)
delete m_dbusSignalConnection;
5450 if (m_dbusSignalReceiver)
delete m_dbusSignalReceiver;
5453 TQMap<TQString, DBus::AccessPointProxy*>::iterator it;
5454 for (it = m_accessPointProxyList.begin(); it != m_accessPointProxyList.end(); ++it) {
5455 DBus::AccessPointProxy *apProxy = it.data();
5460 m_accessPointProxyList.clear();
5463 #include "network-manager.moc"
5464 #include "network-manager_p.moc"
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
Reads the value of an entry specified by pKey in the current group.
void setGroup(const TQString &group)
Specifies the group in which keys will be read and written.
Access KDE Configuration entries.
TQString i18n(const char *text)
i18n is the function that does everything you need to translate a string.