19 #include "tdehardwaredevices.h"
20 #include "tdenetworkconnections.h"
26 #include "tdenetworkdevice.h"
31 #ifdef WITH_NETWORK_MANAGER_BACKEND
32 #include "network-manager.h"
35 #define SET_BIT(x, y) (x |= 1 << y)
36 #define TEST_BIT(x, y) ((x & (1 << y)) >> y)
44 TDE_EXPORT TDEGlobalNetworkManager* create_tdeGlobalNetworkManager()
46 return new TDEGlobalNetworkManager();
50 TDENetworkSearchDomain::TDENetworkSearchDomain() {
54 TDENetworkSearchDomain::TDENetworkSearchDomain(TQString domain,
bool ipv6) {
59 TDENetworkSearchDomain::~TDENetworkSearchDomain() {
63 TQString TDENetworkSearchDomain::searchDomain() {
67 void TDENetworkSearchDomain::setSearchDomain(TQString domain,
bool ipv6) {
72 bool TDENetworkSearchDomain::isIPv4() {
76 bool TDENetworkSearchDomain::isIPv6() {
84 TDENetMask::TDENetMask() {
89 TDENetMask::TDENetMask(TQ_UINT32 netmask) {
90 m_ipv4NetMask = netmask;
94 TDENetMask::TDENetMask(TQ_UINT8* netmask) {
95 m_ipv6NetMask = TQHostAddress(netmask);
99 TDENetMask::~TDENetMask() {
103 void TDENetMask::fromCIDRMask(
unsigned char mask,
bool ipv6) {
106 unsigned int internalMask = mask;
109 for (i=32; i>(32-internalMask); ) {
111 SET_BIT(m_ipv4NetMask, i);
116 Q_IPV6ADDR maskarray;
118 unsigned int byteno=0;
119 memset(maskarray.c, 0, 16);
120 for (i=128; i>(128-internalMask); ) {
122 SET_BIT(maskarray.c[byteno], (i-((15-byteno)*8)));
129 m_ipv6NetMask = TQHostAddress(maskarray);
134 unsigned char TDENetMask::toCIDRMask() {
138 for (i=0; i<32; i++) {
139 if (TEST_BIT(m_ipv4NetMask, i)) {
146 Q_IPV6ADDR mask = m_ipv6NetMask.toIPv6Address();
148 for (j=0; j<16; ++j) {
149 for (i=0; i<8; i++) {
150 if (!TEST_BIT(mask.c[j], i)) {
161 void TDENetMask::fromString(TQString mask) {
162 if (mask.contains(
".")) {
165 TQStringList pieces = TQStringList::split(
".", mask);
167 chunk = pieces[0].toUShort();
168 m_ipv4NetMask = m_ipv4NetMask | (chunk << 24);
169 chunk = pieces[1].toUShort();
170 m_ipv4NetMask = m_ipv4NetMask | (chunk << 16);
171 chunk = pieces[2].toUShort();
172 m_ipv4NetMask = m_ipv4NetMask | (chunk << 8);
173 chunk = pieces[3].toUShort();
174 m_ipv4NetMask = m_ipv4NetMask | (chunk << 0);
176 else if (mask.contains(
":")) {
178 m_ipv6NetMask.setAddress(mask);
182 TQString TDENetMask::toString() {
184 return TQString(
"%1.%2.%3.%4").arg((m_ipv4NetMask & 0xff000000) >> 24).arg((m_ipv4NetMask & 0x00ff0000) >> 16).arg((m_ipv4NetMask & 0x0000ff00) >> 8).arg((m_ipv4NetMask & 0x000000ff) >> 0);
187 return m_ipv6NetMask.toString();
191 bool TDENetMask::isIPv4() {
195 bool TDENetMask::isIPv6() {
203 TDEMACAddress::TDEMACAddress() {
204 m_macAddress.clear();
208 TDEMACAddress::TDEMACAddress(TDENetworkByteList address) {
209 m_macAddress = address;
213 TDEMACAddress::~TDEMACAddress() {
217 TDENetworkByteList TDEMACAddress::address() {
221 void TDEMACAddress::setAddress(TDENetworkByteList address) {
222 m_macAddress = address;
226 bool TDEMACAddress::isValid() {
231 if (m_macAddress.count() > 0) {
239 void TDEMACAddress::fromString(TQString address) {
240 TQStringList pieces = TQStringList::split(
":", address);
241 m_macAddress.clear();
242 for (TQStringList::Iterator it = pieces.begin(); it != pieces.end(); ++it) {
243 m_macAddress.append((*it).toUShort(0, 16));
248 TQString TDEMACAddress::toString() {
250 TDENetworkByteList::iterator it;
251 for (it = m_macAddress.begin(); it != m_macAddress.end(); ++it) {
255 ret.append(TQString().sprintf(
"%02x", *it));
260 bool operator==(
const TDEMACAddress &a1,
const TDEMACAddress &a2) {
261 if (a1.m_macAddress.count() != a2.m_macAddress.count()) {
266 for (i=0; i<a1.m_macAddress.count(); i++) {
267 if (a1.m_macAddress[i] != a2.m_macAddress[i]) {
275 bool operator<(
const TDEMACAddress &a1,
const TDEMACAddress &a2) {
276 if (a1.m_macAddress.count() < a2.m_macAddress.count()) {
281 for (i=0; i<a1.m_macAddress.count(); i++) {
282 if (a1.m_macAddress[i] < a2.m_macAddress[i]) {
285 if (a1.m_macAddress[i] > a2.m_macAddress[i]) {
297 TDENetworkSingleIPConfiguration::TDENetworkSingleIPConfiguration() {
301 TDENetworkSingleIPConfiguration::~TDENetworkSingleIPConfiguration() {
305 bool TDENetworkSingleIPConfiguration::isIPv4() {
306 return ipAddress.isIPv4Address() & valid;
309 bool TDENetworkSingleIPConfiguration::isIPv6() {
310 return ipAddress.isIPv6Address() & valid;
317 TDENetworkSingleRouteConfiguration::TDENetworkSingleRouteConfiguration() {
321 TDENetworkSingleRouteConfiguration::~TDENetworkSingleRouteConfiguration() {
325 bool TDENetworkSingleRouteConfiguration::isIPv4() {
326 return ipAddress.isIPv4Address() & valid;
329 bool TDENetworkSingleRouteConfiguration::isIPv6() {
330 return ipAddress.isIPv6Address() & valid;
337 TDENetworkIEEE8021xConfiguration::TDENetworkIEEE8021xConfiguration() {
339 allowedValid =
false;
340 secretsValid =
false;
341 type = TDENetworkIEEE8021xType::None;
342 fastProvisioningFlags = TDENetworkIEEE8021xFastFlags::None;
343 phase2NonEAPAuthMethod = TDENetworkIEEE8021xType::None;
344 phase2EAPAuthMethod = TDENetworkIEEE8021xType::None;
345 passwordFlags = TDENetworkPasswordHandlingFlags::None;
346 binaryPasswordFlags = TDENetworkPasswordHandlingFlags::None;
347 privateKeyPasswordFlags = TDENetworkPasswordHandlingFlags::None;
348 phase2PrivateKeyPasswordFlags = TDENetworkPasswordHandlingFlags::None;
349 forceSystemCaCertificates =
false;
352 TDENetworkIEEE8021xConfiguration::~TDENetworkIEEE8021xConfiguration() {
360 TDENetworkPPPConfiguration::TDENetworkPPPConfiguration() {
362 requireServerAuthentication =
false;
363 flags = TDENetworkPPPFlags::None;
367 lcpEchoPingInterval = 0;
368 lcpEchoFailureThreshold = 0;
371 TDENetworkPPPConfiguration::~TDENetworkPPPConfiguration() {
379 TDENetworkPPPOEConfiguration::TDENetworkPPPOEConfiguration() {
381 secretsValid =
false;
382 passwordFlags = TDENetworkPasswordHandlingFlags::None;
385 TDENetworkPPPOEConfiguration::~TDENetworkPPPOEConfiguration() {
393 TDENetworkSerialConfiguration::TDENetworkSerialConfiguration() {
397 parity = TDENetworkParity::None;
402 TDENetworkSerialConfiguration::~TDENetworkSerialConfiguration() {
410 TDENetworkCDMAConfiguration::TDENetworkCDMAConfiguration() {
412 secretsValid =
false;
413 passwordFlags = TDENetworkPasswordHandlingFlags::None;
416 TDENetworkCDMAConfiguration::~TDENetworkCDMAConfiguration() {
424 TDENetworkGSMConfiguration::TDENetworkGSMConfiguration() {
426 secretsValid =
false;
427 passwordFlags = TDENetworkPasswordHandlingFlags::None;
428 networkType = TDEGSMNetworkType::Any;
429 pinFlags = TDENetworkPasswordHandlingFlags::None;
430 allowRoaming =
false;
433 TDENetworkGSMConfiguration::~TDENetworkGSMConfiguration() {
441 TDENetworkIPConfiguration::TDENetworkIPConfiguration() {
443 connectionFlags = TDENetworkIPConfigurationFlags::IPV4DHCPIP | \
444 TDENetworkIPConfigurationFlags::IPV4DHCPDNS | \
445 TDENetworkIPConfigurationFlags::IPV4DHCPRoutes | \
446 TDENetworkIPConfigurationFlags::IPV4MayUseAsDefaultRoute | \
447 TDENetworkIPConfigurationFlags::IPV6DHCPIP | \
448 TDENetworkIPConfigurationFlags::IPV6DHCPDNS | \
449 TDENetworkIPConfigurationFlags::IPV6DHCPRoutes | \
450 TDENetworkIPConfigurationFlags::IPV6MayUseAsDefaultRoute;
453 TDENetworkIPConfiguration::~TDENetworkIPConfiguration() {
461 TDENetworkWiFiSecurityConfiguration::TDENetworkWiFiSecurityConfiguration() {
463 secretsValid =
false;
464 keyType = TDENetworkWiFiKeyType::Other;
465 authType = TDENetworkWiFiAuthType::Other;
466 wpaVersion = TDENetworkWiFiWPAVersionFlags::Any;
467 cipher = TDENetworkWiFiConnectionCipher::None;
468 wepKeyFlags = TDENetworkPasswordHandlingFlags::None;
470 wepKeyType = TDENetworkWepKeyType::Hexadecimal;
471 pskFlags = TDENetworkPasswordHandlingFlags::None;
472 leapPasswordFlags = TDENetworkPasswordHandlingFlags::None;
475 TDENetworkWiFiSecurityConfiguration::~TDENetworkWiFiSecurityConfiguration() {
483 TDENetworkWiFiDeviceInfo::TDENetworkWiFiDeviceInfo() {
487 TDENetworkWiFiDeviceInfo::~TDENetworkWiFiDeviceInfo() {
495 TDENetworkDeviceInformation::TDENetworkDeviceInformation() {
497 statusFlags = TDENetworkConnectionStatus::Invalid;
498 capabilityFlags = TDENetworkDeviceCapabilityFlags::None;
501 TDENetworkDeviceInformation::~TDENetworkDeviceInformation() {
509 TDENetworkHWNeighbor::TDENetworkHWNeighbor() {
513 TDENetworkHWNeighbor::~TDENetworkHWNeighbor() {
521 TDENetworkWiFiAPInfo::TDENetworkWiFiAPInfo() : TDENetworkHWNeighbor() {
525 TDENetworkWiFiAPInfo::~TDENetworkWiFiAPInfo() {
529 TQString TDENetworkWiFiAPInfo::friendlySSID()
const {
532 ret = TQString(SSID);
534 ret =
"<" +
i18n(
"hidden") +
">";
544 TDENetworkConnection::TDENetworkConnection() {
553 TDENetworkConnection::~TDENetworkConnection() {
557 TDENetworkConnectionType::TDENetworkConnectionType TDENetworkConnection::type() {
558 if (
dynamic_cast<TDEWiredEthernetConnection*
>(
this)) {
559 return TDENetworkConnectionType::WiredEthernet;
561 else if (
dynamic_cast<TDEWiredInfinibandConnection*
>(
this)) {
562 return TDENetworkConnectionType::Infiniband;
564 else if (
dynamic_cast<TDEVPNConnection*
>(
this)) {
565 return TDENetworkConnectionType::VPN;
567 else if (
dynamic_cast<TDEWiMaxConnection*
>(
this)) {
568 return TDENetworkConnectionType::WiMax;
570 else if (
dynamic_cast<TDEVLANConnection*
>(
this)) {
571 return TDENetworkConnectionType::VLAN;
573 else if (
dynamic_cast<TDEOLPCMeshConnection*
>(
this)) {
574 return TDENetworkConnectionType::OLPCMesh;
576 else if (
dynamic_cast<TDEBluetoothConnection*
>(
this)) {
577 return TDENetworkConnectionType::Bluetooth;
579 else if (
dynamic_cast<TDEModemConnection*
>(
this)) {
580 return TDENetworkConnectionType::Modem;
582 else if (
dynamic_cast<TDEWiFiConnection*
>(
this)) {
583 return TDENetworkConnectionType::WiFi;
586 return TDENetworkConnectionType::Other;
594 TDEWiredEthernetConnection::TDEWiredEthernetConnection() : TDENetworkConnection() {
598 TDEWiredEthernetConnection::~TDEWiredEthernetConnection() {
606 TDEWiredInfinibandConnection::TDEWiredInfinibandConnection() : TDENetworkConnection() {
610 TDEWiredInfinibandConnection::~TDEWiredInfinibandConnection() {
618 TDEVPNConnection::TDEVPNConnection() : TDENetworkConnection() {
619 secretsValid =
false;
622 TDEVPNConnection::~TDEVPNConnection() {
630 TDEWiMaxConnection::TDEWiMaxConnection() : TDENetworkConnection() {
634 TDEWiMaxConnection::~TDEWiMaxConnection() {
642 TDEVLANConnection::TDEVLANConnection() : TDENetworkConnection() {
646 TDEVLANConnection::~TDEVLANConnection() {
654 TDEOLPCMeshConnection::TDEOLPCMeshConnection() : TDENetworkConnection() {
658 TDEOLPCMeshConnection::~TDEOLPCMeshConnection() {
666 TDEBluetoothConnection::TDEBluetoothConnection() : TDENetworkConnection() {
667 type = TDEBluetoothConnectionType::Other;
670 TDEBluetoothConnection::~TDEBluetoothConnection() {
678 TDEModemConnection::TDEModemConnection() : TDENetworkConnection() {
679 type = TDEModemConnectionType::Other;
682 TDEModemConnection::~TDEModemConnection() {
690 TDEWiFiConnection::TDEWiFiConnection() : TDENetworkConnection() {
691 operatingMode = TDEWiFiMode::Other;
692 bandRestriction = TDEWiFiFrequencyBand::None;
693 channelRestriction = -1;
694 bitRateRestriction = -1;
695 powerRestriction = -1;
696 isHiddenNetwork =
false;
697 securityRequired =
false;
700 TDEWiFiConnection::~TDEWiFiConnection() {
708 TDENetworkConnectionManager::TDENetworkConnectionManager(TDENetworkDevice *networkDevice) : TQObject(), m_connectionList(NULL), m_hwNeighborList(NULL), m_networkDevice(networkDevice), m_prevConnectionStatus(TDENetworkGlobalManagerFlags::Unknown) {
709 m_emissionTimer =
new TQTimer();
710 connect(m_emissionTimer, TQ_SIGNAL(timeout()),
this, TQ_SLOT(emitQueuedSignals()));
711 if (!m_emissionTimer->isActive()) m_emissionTimer->start(0,
true);
714 TDENetworkConnectionManager::~TDENetworkConnectionManager() {
715 m_emissionTimer->stop();
716 delete m_emissionTimer;
719 TQString TDENetworkConnectionManager::deviceNode() {
720 return m_networkDevice ? m_networkDevice->deviceNode() : TQString();
723 TQString TDENetworkConnectionManager::deviceMACAddress() {
724 return m_networkDevice ? m_networkDevice->macAddress() : TQString();
727 TDENetworkConnectionList* TDENetworkConnectionManager::connections() {
728 return m_connectionList;
731 TDENetworkConnection* TDENetworkConnectionManager::findConnectionByUUID(TQString uuid) {
732 TDENetworkConnection *connection;
733 for (connection = m_connectionList->first(); connection; connection = m_connectionList->next()) {
734 if (connection->UUID == uuid) {
741 TDENetworkDevice* TDENetworkConnectionManager::findDeviceByUUID(TQString uuid) {
742 TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
743 if (!hwdevices)
return NULL;
745 TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network);
746 for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it)
748 TDENetworkDevice* dev =
dynamic_cast<TDENetworkDevice*
>(*it);
750 TDENetworkConnectionManager* deviceConnectionManager = dev->connectionManager();
751 if (deviceConnectionManager) {
752 if (deviceConnectionManager->deviceInformation().UUID == uuid) {
762 TDENetworkWiFiAPInfo* TDENetworkConnectionManager::findAccessPointByBSSID(TDEMACAddress bssid) {
763 if (!bssid.isValid()) {
767 TDENetworkHWNeighbor *neighbor;
768 for (neighbor = m_hwNeighborList->first(); neighbor; neighbor = m_hwNeighborList->next()) {
769 TDENetworkWiFiAPInfo* apInfo =
dynamic_cast<TDENetworkWiFiAPInfo*
>(neighbor);
773 if (apInfo->BSSID == bssid) {
780 TQString TDENetworkConnectionManager::friendlyConnectionTypeName(TDENetworkConnectionType::TDENetworkConnectionType type) {
781 if (type == TDENetworkConnectionType::WiredEthernet) {
782 return i18n(
"Wired Ethernet");
784 else if (type == TDENetworkConnectionType::WiFi) {
785 return i18n(
"802.11 WiFi");
787 else if (type == TDENetworkConnectionType::Bluetooth) {
788 return i18n(
"Bluetooth");
790 else if (type == TDENetworkConnectionType::OLPCMesh) {
791 return i18n(
"OLPC Mesh");
793 else if (type == TDENetworkConnectionType::WiMax) {
794 return i18n(
"WiMax");
796 else if (type == TDENetworkConnectionType::Modem) {
797 return i18n(
"Cellular Modem");
799 else if (type == TDENetworkConnectionType::Infiniband) {
800 return i18n(
"Infiniband");
802 else if (type == TDENetworkConnectionType::Bond) {
805 else if (type == TDENetworkConnectionType::VLAN) {
806 return i18n(
"Virtual LAN");
808 else if (type == TDENetworkConnectionType::ADSL) {
811 else if (type == TDENetworkConnectionType::VPN) {
812 return i18n(
"Virtual Private Network");
814 else if (type == TDENetworkConnectionType::Other) {
815 return i18n(
"Other");
818 return TQString::null;
822 bool TDENetworkConnectionManager::validateIPAddress(TQHostAddress address) {
823 if (address.isIPv4Address()) {
824 TQ_UINT32 rawaddress = address.toIPv4Address();
825 if ((((rawaddress & 0xff000000) >> 24) == 0) || ((rawaddress & 0x000000ff) == 0) || ((rawaddress & 0x000000ff) == 255)) {
829 else if (address.isIPv6Address()) {
830 Q_IPV6ADDR rawaddress = address.toIPv6Address();
831 if (rawaddress.c[0] == 0xff) {
838 bool TDENetworkConnectionManager::validateIPNeworkMask(TQHostAddress netmask) {
843 void TDENetworkConnectionManager::clearTDENetworkConnectionList() {
844 TDENetworkConnection *connection;
845 for (connection = m_connectionList->first(); connection; connection = m_connectionList->next()) {
848 m_connectionList->clear();
851 void TDENetworkConnectionManager::clearTDENetworkHWNeighborList() {
852 TDENetworkHWNeighbor *neighbor;
853 for (neighbor = m_hwNeighborList->first(); neighbor; neighbor = m_hwNeighborList->next()) {
856 m_hwNeighborList->clear();
859 void TDENetworkConnectionManager::internalNetworkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState) {
861 queuedEvent.eventType = 0;
862 queuedEvent.newState = newState;
863 queuedEvent.previousState = m_prevConnectionStatus;
864 m_globalEventQueueEventList.append(queuedEvent);
865 if (!m_emissionTimer->isActive()) m_emissionTimer->start(0,
true);
867 m_prevConnectionStatus = newState;
870 void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString deviceNodeName) {
871 if (!m_prevDeviceStatus.contains(deviceNodeName)) {
872 m_prevDeviceStatus[deviceNodeName] = TDENetworkConnectionStatus::Invalid;
876 queuedEvent.eventType = 1;
877 queuedEvent.newConnStatus = newState;
878 queuedEvent.previousConnStatus = m_prevDeviceStatus[deviceNodeName];
879 queuedEvent.deviceNode = deviceNodeName;
880 m_globalEventQueueEventList.append(queuedEvent);
881 if (!m_emissionTimer->isActive()) m_emissionTimer->start(0,
true);
883 m_prevDeviceStatus[deviceNodeName] = newState;
886 void TDENetworkConnectionManager::internalAccessPointStatusChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) {
888 queuedEvent.eventType = 2;
889 queuedEvent.BSSID = BSSID;
890 queuedEvent.apevent =
event;
891 m_globalEventQueueEventList.append(queuedEvent);
892 if (!m_emissionTimer->isActive()) m_emissionTimer->start(0,
true);
895 void TDENetworkConnectionManager::internalNetworkDeviceEvent(TDENetworkDeviceEventType::TDENetworkDeviceEventType event, TQString message) {
897 queuedEvent.eventType = 3;
898 queuedEvent.ndevent =
event;
899 queuedEvent.message = message;
900 m_globalEventQueueEventList.append(queuedEvent);
901 if (!m_emissionTimer->isActive()) m_emissionTimer->start(0,
true);
904 void TDENetworkConnectionManager::internalVpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType event, TQString message) {
906 queuedEvent.eventType = 4;
907 queuedEvent.vpnevent =
event;
908 queuedEvent.message = message;
909 m_globalEventQueueEventList.append(queuedEvent);
910 if (!m_emissionTimer->isActive()) m_emissionTimer->start(0,
true);
913 void TDENetworkConnectionManager::internalNetworkManagementEvent(TDENetworkGlobalEventType::TDENetworkGlobalEventType event) {
915 queuedEvent.eventType = 5;
916 queuedEvent.globalevent =
event;
917 m_globalEventQueueEventList.append(queuedEvent);
918 if (!m_emissionTimer->isActive()) m_emissionTimer->start(0,
true);
921 void TDENetworkConnectionManager::emitQueuedSignals() {
922 if (!m_globalEventQueueEventList.isEmpty()) {
923 #ifdef DEBUG_SIGNAL_QUEUE
924 kdDebug() <<
"TDENetworkConnectionManager::emitQueuedSignals: Going to dequeue " << m_globalEventQueueEventList.count() <<
" events..." <<
endl;
926 TDENetworkEventQueueEvent_PrivateList::Iterator it;
927 it = m_globalEventQueueEventList.begin();
928 while (it != m_globalEventQueueEventList.end()) {
930 it = m_globalEventQueueEventList.remove(it);
931 if (
event.eventType == 0) {
932 emit(networkConnectionStateChanged(
event.newState,
event.previousState));
934 else if (
event.eventType == 1) {
935 emit(networkDeviceStateChanged(
event.newConnStatus,
event.previousConnStatus,
event.deviceNode));
937 else if (
event.eventType == 2) {
938 emit(accessPointStatusChanged(
event.BSSID,
event.apevent));
940 else if (
event.eventType == 3) {
941 emit(networkDeviceEvent(
event.ndevent,
event.message));
943 else if (
event.eventType == 4) {
944 emit(vpnEvent(
event.vpnevent,
event.message));
946 else if (
event.eventType == 5) {
947 emit(networkManagementEvent(
event.globalevent));
950 #ifdef DEBUG_SIGNAL_QUEUE
951 kdDebug() <<
"TDENetworkConnectionManager::emitQueuedSignals: " << m_globalEventQueueEventList.count() <<
" events remain in queue" <<
endl;
960 TDEGlobalNetworkManager::TDEGlobalNetworkManager() : m_internalConnectionManager(NULL) {
961 #ifdef WITH_NETWORK_MANAGER_BACKEND
962 m_internalConnectionManager =
new TDENetworkConnectionManager_BackendNM(NULL);
964 if (m_internalConnectionManager) {
965 connect(m_internalConnectionManager, TQ_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)),
this, TQ_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)));
966 connect(m_internalConnectionManager, TQ_SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)),
this, TQ_SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)));
967 connect(m_internalConnectionManager, TQ_SIGNAL(networkManagementEvent(TDENetworkGlobalEventType::TDENetworkGlobalEventType)),
this, TQ_SIGNAL(networkManagementEvent(TDENetworkGlobalEventType::TDENetworkGlobalEventType)));
971 TDEGlobalNetworkManager::~TDEGlobalNetworkManager() {
972 delete m_internalConnectionManager;
975 TQString TDEGlobalNetworkManager::backendName() {
976 if (!m_internalConnectionManager)
return TQString::null;
977 return m_internalConnectionManager->backendName();
980 TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags TDEGlobalNetworkManager::backendStatus() {
981 if (!m_internalConnectionManager)
return TDENetworkGlobalManagerFlags::BackendUnavailable;
982 return m_internalConnectionManager->backendStatus();
985 void TDEGlobalNetworkManager::loadConnectionInformation() {
986 if (!m_internalConnectionManager)
return;
987 return m_internalConnectionManager->loadConnectionInformation();
990 void TDEGlobalNetworkManager::loadConnectionAllowedValues(TDENetworkConnection* connection) {
991 if (!m_internalConnectionManager)
return;
992 return m_internalConnectionManager->loadConnectionAllowedValues(connection);
995 bool TDEGlobalNetworkManager::loadConnectionSecrets(TQString uuid) {
996 if (!m_internalConnectionManager)
return false;
997 return m_internalConnectionManager->loadConnectionSecrets(uuid);
1000 bool TDEGlobalNetworkManager::saveConnection(TDENetworkConnection* connection) {
1001 if (!m_internalConnectionManager)
return false;
1002 return m_internalConnectionManager->saveConnection(connection);
1005 bool TDEGlobalNetworkManager::deleteConnection(TQString uuid) {
1006 if (!m_internalConnectionManager)
return false;
1007 return m_internalConnectionManager->deleteConnection(uuid);
1010 bool TDEGlobalNetworkManager::verifyConnectionSettings(TDENetworkConnection* connection, TDENetworkConnectionErrorFlags::TDENetworkConnectionErrorFlags* type, TDENetworkErrorStringMap* reason) {
1011 if (!m_internalConnectionManager)
return false;
1012 return m_internalConnectionManager->verifyConnectionSettings(connection, type, reason);
1015 TDENetworkConnectionStatus::TDENetworkConnectionStatus TDEGlobalNetworkManager::initiateConnection(TQString uuid) {
1016 if (!m_internalConnectionManager)
return TDENetworkConnectionStatus::Invalid;
1017 return m_internalConnectionManager->initiateConnection(uuid);
1020 TDENetworkConnectionStatus::TDENetworkConnectionStatus TDEGlobalNetworkManager::checkConnectionStatus(TQString uuid) {
1021 if (!m_internalConnectionManager)
return TDENetworkConnectionStatus::Invalid;
1022 return m_internalConnectionManager->checkConnectionStatus(uuid);
1025 TDENetworkConnectionStatus::TDENetworkConnectionStatus TDEGlobalNetworkManager::deactivateConnection(TQString uuid) {
1026 if (!m_internalConnectionManager)
return TDENetworkConnectionStatus::Invalid;
1027 return m_internalConnectionManager->deactivateConnection(uuid);
1030 TQStringList TDEGlobalNetworkManager::validSettings() {
1031 if (!m_internalConnectionManager)
return TQStringList();
1032 return m_internalConnectionManager->validSettings();
1035 TDENetworkHWNeighborList* TDEGlobalNetworkManager::siteSurvey() {
1036 if (!m_internalConnectionManager)
return NULL;
1037 return m_internalConnectionManager->siteSurvey();
1040 TQStringList TDEGlobalNetworkManager::connectionPhysicalDeviceUUIDs(TQString uuid) {
1041 if (!m_internalConnectionManager)
return TQStringList();
1042 return m_internalConnectionManager->connectionPhysicalDeviceUUIDs(uuid);
1045 TDENetworkVPNTypeList TDEGlobalNetworkManager::availableVPNTypes() {
1046 if (!m_internalConnectionManager)
return TDENetworkVPNTypeList();
1047 return m_internalConnectionManager->availableVPNTypes();
1050 bool TDEGlobalNetworkManager::networkingEnabled() {
1051 if (!m_internalConnectionManager)
return false;
1052 return m_internalConnectionManager->networkingEnabled();
1055 bool TDEGlobalNetworkManager::enableNetworking(
bool enable) {
1056 if (!m_internalConnectionManager)
return false;
1057 return m_internalConnectionManager->enableNetworking(enable);
1060 bool TDEGlobalNetworkManager::wiFiHardwareEnabled() {
1061 if (!m_internalConnectionManager)
return false;
1062 return m_internalConnectionManager->wiFiHardwareEnabled();
1065 bool TDEGlobalNetworkManager::enableWiFi(
bool enable) {
1066 if (!m_internalConnectionManager)
return false;
1067 return m_internalConnectionManager->enableWiFi(enable);
1070 bool TDEGlobalNetworkManager::wiFiEnabled() {
1071 if (!m_internalConnectionManager)
return false;
1072 return m_internalConnectionManager->wiFiEnabled();
1075 TQStringList TDEGlobalNetworkManager::defaultNetworkDevices() {
1076 if (!m_internalConnectionManager)
return TQStringList();
1077 return m_internalConnectionManager->defaultNetworkDevices();
1080 TDENetworkConnectionList* TDEGlobalNetworkManager::connections() {
1081 if (!m_internalConnectionManager)
return NULL;
1082 return m_internalConnectionManager->connections();
1085 TDENetworkConnection* TDEGlobalNetworkManager::findConnectionByUUID(TQString uuid) {
1086 if (!m_internalConnectionManager)
return NULL;
1087 return m_internalConnectionManager->findConnectionByUUID(uuid);
1090 TDENetworkDevice* TDEGlobalNetworkManager::findDeviceByUUID(TQString uuid) {
1091 if (!m_internalConnectionManager)
return NULL;
1092 return m_internalConnectionManager->findDeviceByUUID(uuid);
1095 TDENetworkWiFiAPInfo* TDEGlobalNetworkManager::findAccessPointByBSSID(TDEMACAddress bssid) {
1096 TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
1101 TDENetworkWiFiAPInfo* ret = NULL;
1102 TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network);
1103 for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) {
1104 TDENetworkDevice* dev =
dynamic_cast<TDENetworkDevice*
>(*it);
1106 TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
1109 TDENetworkWiFiAPInfo* candidate = deviceConnMan->findAccessPointByBSSID(bssid);
1126 #include "tdenetworkconnections.moc"
TQString i18n(const char *text)
i18n is the function that does everything you need to translate a string.
kdbgstream kdDebug(int area=0)
Returns a debug stream.
kdbgstream & endl(kdbgstream &s)
Prints an "\n".
int event(const TQString &message, const TQString &text=TQString::null) TDE_DEPRECATED