diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2017-06-17 12:57:10 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-06-17 13:52:54 +0200 |
commit | 234f323f7b3ae009f4236a775a72dd96094ebba1 (patch) | |
tree | c15bedc17dac35438798604cb93f8f9d16a15e88 /tdecore/tdehw/tdenetworkconnections.cpp | |
parent | a8e587a9733dd076c0356dbfcef561eb7ed45e90 (diff) | |
download | tdelibs-234f323f7b3ae009f4236a775a72dd96094ebba1.tar.gz tdelibs-234f323f7b3ae009f4236a775a72dd96094ebba1.zip |
tdehwlib: Use TDENetworkDevice in TDENetworkConnectionManager instead of MAC address
Use interface name in TDENetworkConnectionManager_BackendNM instead of MAC address
This relates to bug 2748
The name of the network interface seems to be a more stable identifier than the MAC
address because the MAC address can be changed easily or even automatically - see
randomization of MAC addresses on wireless interfaces. Therefore, the use of the
MAC address as a network interface identifier was abandoned.
Beware, this change is an API / ABI change! However, most changes are internal
and the only one affected is application TDENetworkManager.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit e0fd34a1bd2c6412171bcceb19520d129bbcb66d)
Diffstat (limited to 'tdecore/tdehw/tdenetworkconnections.cpp')
-rw-r--r-- | tdecore/tdehw/tdenetworkconnections.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tdecore/tdehw/tdenetworkconnections.cpp b/tdecore/tdehw/tdenetworkconnections.cpp index dec04e86b..7cef67cf3 100644 --- a/tdecore/tdehw/tdenetworkconnections.cpp +++ b/tdecore/tdehw/tdenetworkconnections.cpp @@ -698,7 +698,7 @@ TDEWiFiConnection::~TDEWiFiConnection() { /* TDENetworkConnectionManager */ /*================================================================================================*/ -TDENetworkConnectionManager::TDENetworkConnectionManager(TQString macAddress) : TQObject(), m_connectionList(NULL), m_hwNeighborList(NULL), m_macAddress(macAddress), m_prevConnectionStatus(TDENetworkGlobalManagerFlags::Unknown) { +TDENetworkConnectionManager::TDENetworkConnectionManager(TDENetworkDevice *networkDevice) : TQObject(), m_connectionList(NULL), m_hwNeighborList(NULL), m_networkDevice(networkDevice), m_prevConnectionStatus(TDENetworkGlobalManagerFlags::Unknown) { m_emissionTimer = new TQTimer(); connect(m_emissionTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(emitQueuedSignals())); if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, TRUE); @@ -709,8 +709,12 @@ TDENetworkConnectionManager::~TDENetworkConnectionManager() { delete m_emissionTimer; } +TQString TDENetworkConnectionManager::deviceNode() { + return m_networkDevice ? m_networkDevice->deviceNode() : TQString(); +} + TQString TDENetworkConnectionManager::deviceMACAddress() { - return m_macAddress; + return m_networkDevice ? m_networkDevice->macAddress() : TQString(); } TDENetworkConnectionList* TDENetworkConnectionManager::connections() { @@ -856,20 +860,20 @@ void TDENetworkConnectionManager::internalNetworkConnectionStateChanged(TDENetwo m_prevConnectionStatus = newState; } -void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress) { - if (!m_prevDeviceStatus.contains(hwAddress)) { - m_prevDeviceStatus[hwAddress] = TDENetworkConnectionStatus::Invalid; +void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString deviceNodeName) { + if (!m_prevDeviceStatus.contains(deviceNodeName)) { + m_prevDeviceStatus[deviceNodeName] = TDENetworkConnectionStatus::Invalid; } TDENetworkEventQueueEvent_Private queuedEvent; queuedEvent.eventType = 1; queuedEvent.newConnStatus = newState; - queuedEvent.previousConnStatus = m_prevDeviceStatus[hwAddress]; - queuedEvent.hwAddress = hwAddress; + queuedEvent.previousConnStatus = m_prevDeviceStatus[deviceNodeName]; + queuedEvent.deviceNode = deviceNodeName; m_globalEventQueueEventList.append(queuedEvent); if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, TRUE); - m_prevDeviceStatus[hwAddress] = newState; + m_prevDeviceStatus[deviceNodeName] = newState; } void TDENetworkConnectionManager::internalAccessPointStatusChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) { @@ -921,7 +925,7 @@ void TDENetworkConnectionManager::emitQueuedSignals() { emit(networkConnectionStateChanged(event.newState, event.previousState)); } else if (event.eventType == 1) { - emit(networkDeviceStateChanged(event.newConnStatus, event.previousConnStatus, event.hwAddress)); + emit(networkDeviceStateChanged(event.newConnStatus, event.previousConnStatus, event.deviceNode)); } else if (event.eventType == 2) { emit(accessPointStatusChanged(event.BSSID, event.apevent)); @@ -948,7 +952,7 @@ void TDENetworkConnectionManager::emitQueuedSignals() { TDEGlobalNetworkManager::TDEGlobalNetworkManager() : m_internalConnectionManager(NULL) { #ifdef WITH_NETWORK_MANAGER_BACKEND - m_internalConnectionManager = new TDENetworkConnectionManager_BackendNM(TQString::null); + m_internalConnectionManager = new TDENetworkConnectionManager_BackendNM(NULL); #endif // WITH_NETWORK_MANAGER_BACKEND if (m_internalConnectionManager) { connect(m_internalConnectionManager, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); |