From 890bd62643a9293aed74fe0118e7c246c6ca8800 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Thu, 16 Jul 2009 11:19:43 +0200 Subject: [PATCH 1/7] fixed g++-3.4 build --- src/devices/wifi/interference-helper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/wifi/interference-helper.cc b/src/devices/wifi/interference-helper.cc index 930aadb3d..f1d1ae1b4 100644 --- a/src/devices/wifi/interference-helper.cc +++ b/src/devices/wifi/interference-helper.cc @@ -381,7 +381,7 @@ InterferenceHelper::GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payl double numDataBitsPerSymbol = payloadMode.GetDataRate () * symbolDurationUs / 1e6; // IEEE Std 802.11-2007, section 17.3.5.3, equation (17-11) - uint32_t numSymbols = ceil ((16 + size * 8.0 + 6.0)/numDataBitsPerSymbol); + uint32_t numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0)/numDataBitsPerSymbol)); return numSymbols*symbolDurationUs; } @@ -390,7 +390,7 @@ InterferenceHelper::GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payl NS_LOG_LOGIC(" size=" << size << " mode=" << payloadMode << " rate=" << payloadMode.GetDataRate () ); - return ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6)); + return lrint(ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6))); default: NS_FATAL_ERROR("unknown standard"); From a3cac79763f81d4cb286f282f02e40d062c334fc Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Thu, 16 Jul 2009 13:51:12 +0400 Subject: [PATCH 2/7] Bug 625: Wrong calculation of GetAccessGrantStart in DcfManager. --- src/devices/wifi/dcf-manager-test.cc | 15 +++++++++++++++ src/devices/wifi/dcf-manager.cc | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/devices/wifi/dcf-manager-test.cc b/src/devices/wifi/dcf-manager-test.cc index 968bbea5f..b94f0ed3f 100644 --- a/src/devices/wifi/dcf-manager-test.cc +++ b/src/devices/wifi/dcf-manager-test.cc @@ -379,6 +379,21 @@ DcfManagerTest::RunTests (void) AddAccessRequest (30, 2, 70, 0); ExpectCollision (30, 0, 0); // backoff: 0 slots EndTest (); + // Test shows when two frames are received without interval between + // them: + // 20 60 100 106 110 112 + // | rx | rx |sifs | aifsn | tx | + // | + // 30 request access. backoff slots: 0 + + StartTest (4, 6 , 10); + AddDcfState (1); + AddRxOkEvt (20, 40); + AddRxOkEvt (60, 40); + AddAccessRequest (30, 2, 110, 0); + ExpectCollision (30, 0, 0); // backoff: 0 slots + EndTest (); + // The test below is subject to some discussion because I am // not sure I understand the intent of the spec here. diff --git a/src/devices/wifi/dcf-manager.cc b/src/devices/wifi/dcf-manager.cc index ec2b0e1fc..320bf0621 100644 --- a/src/devices/wifi/dcf-manager.cc +++ b/src/devices/wifi/dcf-manager.cc @@ -433,7 +433,7 @@ Time DcfManager::GetAccessGrantStart (void) const { Time rxAccessStart; - if (m_lastRxEnd >= m_lastRxStart) + if (!m_rxing) { rxAccessStart = m_lastRxEnd; if (!m_lastRxReceivedOk) From cf7de38ffd6357eb933fdd8fc5775b9ac20519b4 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 16 Jul 2009 12:31:26 +0200 Subject: [PATCH 3/7] bug 381: Wifi crashes on shutdown --- src/devices/wifi/nqap-wifi-mac.cc | 1 + src/devices/wifi/nqsta-wifi-mac.cc | 1 + src/devices/wifi/qap-wifi-mac.cc | 5 +++-- src/devices/wifi/qsta-wifi-mac.cc | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/devices/wifi/nqap-wifi-mac.cc b/src/devices/wifi/nqap-wifi-mac.cc index f72b865b5..4b9c8ce0b 100644 --- a/src/devices/wifi/nqap-wifi-mac.cc +++ b/src/devices/wifi/nqap-wifi-mac.cc @@ -97,6 +97,7 @@ NqapWifiMac::DoDispose (void) NS_LOG_FUNCTION (this); delete m_rxMiddle; delete m_dcfManager; + m_low->Dispose (); m_rxMiddle = 0; m_low = 0; m_dcfManager = 0; diff --git a/src/devices/wifi/nqsta-wifi-mac.cc b/src/devices/wifi/nqsta-wifi-mac.cc index 4a979500b..e7bceba8f 100644 --- a/src/devices/wifi/nqsta-wifi-mac.cc +++ b/src/devices/wifi/nqsta-wifi-mac.cc @@ -128,6 +128,7 @@ NqstaWifiMac::DoDispose (void) NS_LOG_FUNCTION (this); delete m_rxMiddle; delete m_dcfManager; + m_low->Dispose (); m_rxMiddle = 0; m_low = 0; m_dcfManager = 0; diff --git a/src/devices/wifi/qap-wifi-mac.cc b/src/devices/wifi/qap-wifi-mac.cc index 066bf0187..af9bb6938 100644 --- a/src/devices/wifi/qap-wifi-mac.cc +++ b/src/devices/wifi/qap-wifi-mac.cc @@ -119,10 +119,11 @@ void QapWifiMac::DoDispose () { delete m_rxMiddle; - m_rxMiddle = 0; delete m_txMiddle; - m_txMiddle = 0; delete m_dcfManager; + m_low->Dispose (); + m_rxMiddle = 0; + m_txMiddle = 0; m_dcfManager = 0; m_low = 0; m_phy = 0; diff --git a/src/devices/wifi/qsta-wifi-mac.cc b/src/devices/wifi/qsta-wifi-mac.cc index cdb12ba27..e3c3fed5a 100644 --- a/src/devices/wifi/qsta-wifi-mac.cc +++ b/src/devices/wifi/qsta-wifi-mac.cc @@ -125,6 +125,7 @@ QstaWifiMac::DoDispose () delete m_rxMiddle; delete m_txMiddle; delete m_dcfManager; + m_low->Dispose (); m_rxMiddle = 0; m_txMiddle = 0; m_low = 0; From 4b26cca7e69f2b58497292d453259881e7e8fe26 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 16 Jul 2009 13:12:34 +0200 Subject: [PATCH 4/7] rescan python --- bindings/python/ns3_module_core.py | 10 ++ bindings/python/ns3_module_csma.py | 6 +- bindings/python/ns3_module_global_routing.py | 28 +++- bindings/python/ns3_module_wifi.py | 149 ++++++++++++++++--- 4 files changed, 168 insertions(+), 25 deletions(-) diff --git a/bindings/python/ns3_module_core.py b/bindings/python/ns3_module_core.py index deaa6436e..1d5cd0e9a 100644 --- a/bindings/python/ns3_module_core.py +++ b/bindings/python/ns3_module_core.py @@ -442,6 +442,16 @@ def register_Ns3GlobalValue_methods(root_module, cls): '__gnu_cxx::__normal_iterator< ns3::GlobalValue * const *, std::vector< ns3::GlobalValue * > >', [], is_static=True) + ## global-value.h: static bool ns3::GlobalValue::GetValueByNameFailSafe(std::string name, ns3::AttributeValue & value) [member function] + cls.add_method('GetValueByNameFailSafe', + 'bool', + [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], + is_static=True) + ## global-value.h: static void ns3::GlobalValue::GetValueByName(std::string name, ns3::AttributeValue & value) [member function] + cls.add_method('GetValueByName', + 'void', + [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], + is_static=True) return def register_Ns3IntToType__0_methods(root_module, cls): diff --git a/bindings/python/ns3_module_csma.py b/bindings/python/ns3_module_csma.py index 4dcae39f4..9f464f0d7 100644 --- a/bindings/python/ns3_module_csma.py +++ b/bindings/python/ns3_module_csma.py @@ -205,13 +205,11 @@ def register_Ns3CsmaChannel_methods(root_module, cls): ## csma-channel.h: ns3::DataRate ns3::CsmaChannel::GetDataRate() [member function] cls.add_method('GetDataRate', 'ns3::DataRate', - [], - is_virtual=True) + []) ## csma-channel.h: ns3::Time ns3::CsmaChannel::GetDelay() [member function] cls.add_method('GetDelay', 'ns3::Time', - [], - is_virtual=True) + []) return def register_Ns3CsmaNetDevice_methods(root_module, cls): diff --git a/bindings/python/ns3_module_global_routing.py b/bindings/python/ns3_module_global_routing.py index a76df6b3d..9f3bda083 100644 --- a/bindings/python/ns3_module_global_routing.py +++ b/bindings/python/ns3_module_global_routing.py @@ -83,17 +83,32 @@ def register_Ns3GlobalRouteManager_methods(root_module, cls): cls.add_method('PopulateRoutingTables', 'void', [], - is_static=True) + is_static=True, deprecated=True) ## global-route-manager.h: static void ns3::GlobalRouteManager::RecomputeRoutingTables() [member function] cls.add_method('RecomputeRoutingTables', 'void', [], - is_static=True) + is_static=True, deprecated=True) ## global-route-manager.h: static uint32_t ns3::GlobalRouteManager::AllocateRouterId() [member function] cls.add_method('AllocateRouterId', 'uint32_t', [], is_static=True) + ## global-route-manager.h: static void ns3::GlobalRouteManager::DeleteGlobalRoutes() [member function] + cls.add_method('DeleteGlobalRoutes', + 'void', + [], + is_static=True) + ## global-route-manager.h: static void ns3::GlobalRouteManager::BuildGlobalRoutingDatabase() [member function] + cls.add_method('BuildGlobalRoutingDatabase', + 'void', + [], + is_static=True) + ## global-route-manager.h: static void ns3::GlobalRouteManager::InitializeRoutes() [member function] + cls.add_method('InitializeRoutes', + 'void', + [], + is_static=True) return def register_Ns3GlobalRoutingLSA_methods(root_module, cls): @@ -160,6 +175,11 @@ def register_Ns3GlobalRoutingLSA_methods(root_module, cls): 'ns3::Ipv4Mask', [], is_const=True) + ## global-router-interface.h: ns3::Ptr ns3::GlobalRoutingLSA::GetNode() const [member function] + cls.add_method('GetNode', + 'ns3::Ptr< ns3::Node >', + [], + is_const=True) ## global-router-interface.h: ns3::GlobalRoutingLSA::SPFStatus ns3::GlobalRoutingLSA::GetStatus() const [member function] cls.add_method('GetStatus', 'ns3::GlobalRoutingLSA::SPFStatus', @@ -191,6 +211,10 @@ def register_Ns3GlobalRoutingLSA_methods(root_module, cls): cls.add_method('SetNetworkLSANetworkMask', 'void', [param('ns3::Ipv4Mask', 'mask')]) + ## global-router-interface.h: void ns3::GlobalRoutingLSA::SetNode(ns3::Ptr node) [member function] + cls.add_method('SetNode', + 'void', + [param('ns3::Ptr< ns3::Node >', 'node')]) ## global-router-interface.h: void ns3::GlobalRoutingLSA::SetStatus(ns3::GlobalRoutingLSA::SPFStatus status) [member function] cls.add_method('SetStatus', 'void', diff --git a/bindings/python/ns3_module_wifi.py b/bindings/python/ns3_module_wifi.py index 1555f2e7d..06db78743 100644 --- a/bindings/python/ns3_module_wifi.py +++ b/bindings/python/ns3_module_wifi.py @@ -8,7 +8,7 @@ def register_types(module): ## wifi-preamble.h: ns3::WifiPreamble [enumeration] module.add_enum('WifiPreamble', ['WIFI_PREAMBLE_LONG', 'WIFI_PREAMBLE_SHORT']) ## wifi-phy-standard.h: ns3::WifiPhyStandard [enumeration] - module.add_enum('WifiPhyStandard', ['WIFI_PHY_STANDARD_80211a', 'WIFI_PHY_STANDARD_80211b', 'WIFI_PHY_STANDARD_holland']) + module.add_enum('WifiPhyStandard', ['WIFI_PHY_STANDARD_80211a', 'WIFI_PHY_STANDARD_80211b', 'WIFI_PHY_STANDARD_80211_10Mhz', 'WIFI_PHY_STANDARD_80211_5Mhz', 'WIFI_PHY_STANDARD_holland']) ## qos-utils.h: ns3::AccessClass [enumeration] module.add_enum('AccessClass', ['AC_VO', 'AC_VI', 'AC_BE', 'AC_BK', 'AC_UNDEF']) ## edca-txop-n.h: ns3::TypeOfStation [enumeration] @@ -264,19 +264,11 @@ def register_Ns3InterferenceHelper_methods(root_module, cls): cls.add_method('CalculateSnrPer', 'ns3::InterferenceHelper::SnrPer', [param('ns3::Ptr< ns3::InterferenceHelper::Event >', 'event')]) - ## interference-helper.h: ns3::Time ns3::InterferenceHelper::CalculateTxDuration(uint32_t size, ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) const [member function] + ## interference-helper.h: static ns3::Time ns3::InterferenceHelper::CalculateTxDuration(uint32_t size, ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) [member function] cls.add_method('CalculateTxDuration', 'ns3::Time', [param('uint32_t', 'size'), param('ns3::WifiMode', 'payloadMode'), param('ns3::WifiPreamble', 'preamble')], - is_const=True) - ## interference-helper.h: void ns3::InterferenceHelper::Configure80211aParameters() [member function] - cls.add_method('Configure80211aParameters', - 'void', - []) - ## interference-helper.h: void ns3::InterferenceHelper::Configure80211bParameters() [member function] - cls.add_method('Configure80211bParameters', - 'void', - []) + is_static=True) ## interference-helper.h: ns3::Time ns3::InterferenceHelper::GetEnergyDuration(double energyW) [member function] cls.add_method('GetEnergyDuration', 'ns3::Time', @@ -291,6 +283,26 @@ def register_Ns3InterferenceHelper_methods(root_module, cls): 'double', [], is_const=True) + ## interference-helper.h: static uint32_t ns3::InterferenceHelper::GetPayloadDurationMicroSeconds(uint32_t size, ns3::WifiMode payloadMode) [member function] + cls.add_method('GetPayloadDurationMicroSeconds', + 'uint32_t', + [param('uint32_t', 'size'), param('ns3::WifiMode', 'payloadMode')], + is_static=True) + ## interference-helper.h: static uint32_t ns3::InterferenceHelper::GetPlcpHeaderDurationMicroSeconds(ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) [member function] + cls.add_method('GetPlcpHeaderDurationMicroSeconds', + 'uint32_t', + [param('ns3::WifiMode', 'payloadMode'), param('ns3::WifiPreamble', 'preamble')], + is_static=True) + ## interference-helper.h: static ns3::WifiMode ns3::InterferenceHelper::GetPlcpHeaderMode(ns3::WifiMode payloadMode, ns3::WifiPreamble preamble) [member function] + cls.add_method('GetPlcpHeaderMode', + 'ns3::WifiMode', + [param('ns3::WifiMode', 'payloadMode'), param('ns3::WifiPreamble', 'preamble')], + is_static=True) + ## interference-helper.h: static uint32_t ns3::InterferenceHelper::GetPlcpPreambleDurationMicroSeconds(ns3::WifiMode mode, ns3::WifiPreamble preamble) [member function] + cls.add_method('GetPlcpPreambleDurationMicroSeconds', + 'uint32_t', + [param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble')], + is_static=True) ## interference-helper.h: void ns3::InterferenceHelper::SetErrorRateModel(ns3::Ptr rate) [member function] cls.add_method('SetErrorRateModel', 'void', @@ -457,6 +469,11 @@ def register_Ns3WifiMode_methods(root_module, cls): 'uint32_t', [], is_const=True) + ## wifi-mode.h: ns3::WifiPhyStandard ns3::WifiMode::GetStandard() const [member function] + cls.add_method('GetStandard', + 'ns3::WifiPhyStandard', + [], + is_const=True) ## wifi-mode.h: uint32_t ns3::WifiMode::GetUid() const [member function] cls.add_method('GetUid', 'uint32_t', @@ -487,25 +504,25 @@ def register_Ns3WifiMode_methods(root_module, cls): def register_Ns3WifiModeFactory_methods(root_module, cls): ## wifi-mode.h: ns3::WifiModeFactory::WifiModeFactory(ns3::WifiModeFactory const & arg0) [copy constructor] cls.add_constructor([param('ns3::WifiModeFactory const &', 'arg0')]) - ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateBpsk(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate) [member function] + ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateBpsk(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate, ns3::WifiPhyStandard standard) [member function] cls.add_method('CreateBpsk', 'ns3::WifiMode', - [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate')], + [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate'), param('ns3::WifiPhyStandard', 'standard')], is_static=True) - ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateQam(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate, uint8_t constellationSize) [member function] + ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateQam(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate, uint8_t constellationSize, ns3::WifiPhyStandard standard) [member function] cls.add_method('CreateQam', 'ns3::WifiMode', - [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate'), param('uint8_t', 'constellationSize')], + [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate'), param('uint8_t', 'constellationSize'), param('ns3::WifiPhyStandard', 'standard')], is_static=True) - ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateDbpsk(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate) [member function] + ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateDbpsk(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate, ns3::WifiPhyStandard standard) [member function] cls.add_method('CreateDbpsk', 'ns3::WifiMode', - [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate')], + [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate'), param('ns3::WifiPhyStandard', 'standard')], is_static=True) - ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateDqpsk(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate) [member function] + ## wifi-mode.h: static ns3::WifiMode ns3::WifiModeFactory::CreateDqpsk(std::string uniqueName, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, uint32_t phyRate, ns3::WifiPhyStandard standard) [member function] cls.add_method('CreateDqpsk', 'ns3::WifiMode', - [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate')], + [param('std::string', 'uniqueName'), param('bool', 'isMandatory'), param('uint32_t', 'bandwidth'), param('uint32_t', 'dataRate'), param('uint32_t', 'phyRate'), param('ns3::WifiPhyStandard', 'standard')], is_static=True) return @@ -1470,6 +1487,10 @@ def register_Ns3WifiMac_methods(root_module, cls): cls.add_method('NotifyRxDrop', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) + ## wifi-mac.h: void ns3::WifiMac::SetStandard(ns3::WifiPhyStandard standard) [member function] + cls.add_method('SetStandard', + 'void', + [param('ns3::WifiPhyStandard', 'standard')]) return def register_Ns3WifiMacHeader_methods(root_module, cls): @@ -2053,6 +2074,86 @@ def register_Ns3WifiPhy_methods(root_module, cls): 'ns3::WifiMode', [], is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get3mb10Mhz() [member function] + cls.add_method('Get3mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get4_5mb10Mhz() [member function] + cls.add_method('Get4_5mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get6mb10Mhz() [member function] + cls.add_method('Get6mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get9mb10Mhz() [member function] + cls.add_method('Get9mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get12mb10Mhz() [member function] + cls.add_method('Get12mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get18mb10Mhz() [member function] + cls.add_method('Get18mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get24mb10Mhz() [member function] + cls.add_method('Get24mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get27mb10Mhz() [member function] + cls.add_method('Get27mb10Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get1_5mb5Mhz() [member function] + cls.add_method('Get1_5mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get2_25mb5Mhz() [member function] + cls.add_method('Get2_25mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get3mb5Mhz() [member function] + cls.add_method('Get3mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get4_5mb5Mhz() [member function] + cls.add_method('Get4_5mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get6mb5Mhz() [member function] + cls.add_method('Get6mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get9mb5Mhz() [member function] + cls.add_method('Get9mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get12mb5Mhz() [member function] + cls.add_method('Get12mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) + ## wifi-phy.h: static ns3::WifiMode ns3::WifiPhy::Get13_5mb5Mhz() [member function] + cls.add_method('Get13_5mb5Mhz', + 'ns3::WifiMode', + [], + is_static=True) ## wifi-phy.h: void ns3::WifiPhy::NotifyTxBegin(ns3::Ptr packet) [member function] cls.add_method('NotifyTxBegin', 'void', @@ -3128,6 +3229,16 @@ def register_Ns3JakesPropagationLossModel_methods(root_module, cls): cls.add_method('SetNOscillators', 'void', [param('uint8_t', 'nOscillators')]) + ## jakes-propagation-loss-model.h: uint8_t ns3::JakesPropagationLossModel::GetNRays() const [member function] + cls.add_method('GetNRays', + 'uint8_t', + [], + is_const=True) + ## jakes-propagation-loss-model.h: uint8_t ns3::JakesPropagationLossModel::GetNOscillators() const [member function] + cls.add_method('GetNOscillators', + 'uint8_t', + [], + is_const=True) ## jakes-propagation-loss-model.h: double ns3::JakesPropagationLossModel::DoCalcRxPower(double txPowerDbm, ns3::Ptr a, ns3::Ptr b) const [member function] cls.add_method('DoCalcRxPower', 'double', From 82f915fd5abb8e2ed03357a3ba7ba0c48b3a9be0 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 16 Jul 2009 13:40:56 +0200 Subject: [PATCH 5/7] fix optimized build for true --- src/devices/wifi/interference-helper.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/devices/wifi/interference-helper.cc b/src/devices/wifi/interference-helper.cc index f1d1ae1b4..c375d095e 100644 --- a/src/devices/wifi/interference-helper.cc +++ b/src/devices/wifi/interference-helper.cc @@ -372,8 +372,11 @@ InterferenceHelper::GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payl case WIFI_PHY_STANDARD_80211b: NS_FATAL_ERROR("can't happen here"); symbolDurationUs = 0; // quiet compiler + break; default: NS_FATAL_ERROR("unknown standard"); + symbolDurationUs = 0; // quiet compiler + break; } // IEEE Std 802.11-2007, section 17.3.2.2, table 17-3 From dae8a0debb1b54d23af4340888b11bf27ab0d123 Mon Sep 17 00:00:00 2001 From: Pavel Boyko Date: Thu, 16 Jul 2009 15:56:42 +0400 Subject: [PATCH 6/7] Initial multichannel support in Yans Wifi PHY. --- src/devices/wifi/wifi-phy.h | 14 +++++++- src/devices/wifi/yans-wifi-channel.cc | 9 +++-- src/devices/wifi/yans-wifi-phy.cc | 52 ++++++++++++++++++++++----- src/devices/wifi/yans-wifi-phy.h | 23 +++++++++++- 4 files changed, 85 insertions(+), 13 deletions(-) diff --git a/src/devices/wifi/wifi-phy.h b/src/devices/wifi/wifi-phy.h index 2da58de60..f17adac2c 100644 --- a/src/devices/wifi/wifi-phy.h +++ b/src/devices/wifi/wifi-phy.h @@ -241,7 +241,19 @@ public: * the requested ber for the specified transmission mode. (W/W) */ virtual double CalculateSnr (WifiMode txMode, double ber) const = 0; - + + /** + * \brief Set channel number. + * + * Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1) + * + * where Starting channel frequency is standard-dependent, see SetStandard() + * as defined in IEEE 802.11-2007 17.3.8.3.2. + */ + virtual void SetChannelNumber (uint16_t id) = 0; + /// Return current channel number, see SetChannelNumber() + virtual uint16_t GetChannelNumber () const = 0; + virtual Ptr GetChannel (void) const = 0; static WifiMode Get6mba (void); diff --git a/src/devices/wifi/yans-wifi-channel.cc b/src/devices/wifi/yans-wifi-channel.cc index 2bbc4559b..52ce25527 100644 --- a/src/devices/wifi/yans-wifi-channel.cc +++ b/src/devices/wifi/yans-wifi-channel.cc @@ -77,10 +77,14 @@ YansWifiChannel::Send (Ptr sender, Ptr packet, double Ptr senderMobility = sender->GetMobility ()->GetObject (); NS_ASSERT (senderMobility != 0); uint32_t j = 0; - for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++) - { + for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++, j++) + { if (sender != (*i)) { + // For now don't account for inter channel interference + if ((*i)->GetChannelNumber() != sender->GetChannelNumber()) + continue; + Ptr receiverMobility = (*i)->GetMobility ()->GetObject (); Time delay = m_delay->GetDelay (senderMobility, receiverMobility); double rxPowerDbm = m_loss->CalcRxPower (txPowerDbm, senderMobility, receiverMobility); @@ -90,7 +94,6 @@ YansWifiChannel::Send (Ptr sender, Ptr packet, double Simulator::Schedule (delay, &YansWifiChannel::Receive, this, j, copy, rxPowerDbm, wifiMode, preamble); } - j++; } } diff --git a/src/devices/wifi/yans-wifi-phy.cc b/src/devices/wifi/yans-wifi-phy.cc index 40b1599e3..75024b1c2 100644 --- a/src/devices/wifi/yans-wifi-phy.cc +++ b/src/devices/wifi/yans-wifi-phy.cc @@ -112,21 +112,25 @@ YansWifiPhy::GetTypeId (void) MakeEnumChecker (WIFI_PHY_STANDARD_80211a, "802.11a", WIFI_PHY_STANDARD_80211b, "802.11b", WIFI_PHY_STANDARD_80211_10Mhz,"802.11_10Mhz", - WIFI_PHY_STANDARD_80211_5Mhz,"802-11_5Mhz", + WIFI_PHY_STANDARD_80211_5Mhz,"802.11_5Mhz", WIFI_PHY_STANDARD_holland, "holland")) .AddAttribute ("State", "The state of the PHY layer", PointerValue (), MakePointerAccessor (&YansWifiPhy::m_state), MakePointerChecker ()) + .AddAttribute ("ChannelSwitchDelay", + "Delay between two short frames transmitted on different frequencies. NOTE: Unused now.", + TimeValue (MicroSeconds (250)), + MakeTimeAccessor (&YansWifiPhy::m_channelSwitchDelay), + MakeTimeChecker ()) ; return tid; } YansWifiPhy::YansWifiPhy () - : m_channelFreqMhz(2437), - m_endSyncEvent (), - m_random (0.0, 1.0) - + : m_endSyncEvent (), + m_random (0.0, 1.0), + m_channelStartingFrequency (0) { NS_LOG_FUNCTION (this); m_state = CreateObject (); @@ -163,7 +167,7 @@ YansWifiPhy::SetStandard (enum WifiPhyStandard standard) break; case WIFI_PHY_STANDARD_80211_5Mhz: Configure80211_5Mhz (); - break; + break; case WIFI_PHY_STANDARD_holland: ConfigureHolland (); break; @@ -308,6 +312,33 @@ YansWifiPhy::SetChannel (Ptr channel) { m_channel = channel; m_channel->Add (this); + m_channelId = 1; // always start on channel starting frequency (channel 1) +} + +void +YansWifiPhy::SetChannelNumber (uint16_t nch) +{ + // TODO implement channel switching state machine here + DoSetChannelNumber (nch); +} + +void +YansWifiPhy::DoSetChannelNumber (uint16_t nch) +{ + NS_LOG_DEBUG("switching channel " << m_channelId << " -> " << nch); + m_channelId = nch; +} + +uint16_t +YansWifiPhy::GetChannelNumber() const +{ + return m_channelId; +} + +double +YansWifiPhy::GetChannelFrequencyMhz() const +{ + return m_channelStartingFrequency + 5 * (GetChannelNumber() - 1); } void @@ -420,7 +451,7 @@ YansWifiPhy::SendPacket (Ptr packet, WifiMode txMode, WifiPreamble NotifyTxBegin (packet); uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000; bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble); - NotifyPromiscSniffTx (packet, m_channelFreqMhz, dataRate500KbpsUnits, isShortPreamble); + NotifyPromiscSniffTx (packet, (uint16_t)GetChannelFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble); m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower); m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble); } @@ -445,6 +476,7 @@ void YansWifiPhy::Configure80211a (void) { NS_LOG_FUNCTION (this); + m_channelStartingFrequency = 5e3; // 5.000 GHz m_modes.push_back (WifiPhy::Get6mba ()); m_modes.push_back (WifiPhy::Get9mba ()); m_modes.push_back (WifiPhy::Get12mba ()); @@ -460,6 +492,7 @@ void YansWifiPhy::Configure80211b (void) { NS_LOG_FUNCTION (this); + m_channelStartingFrequency = 2412; // 2.412 GHz m_modes.push_back (WifiPhy::Get1mbb ()); m_modes.push_back (WifiPhy::Get2mbb ()); m_modes.push_back (WifiPhy::Get5_5mbb ()); @@ -470,6 +503,7 @@ void YansWifiPhy::Configure80211_10Mhz (void) { NS_LOG_FUNCTION (this); + m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a m_modes.push_back (WifiPhy::Get3mb10Mhz ()); m_modes.push_back (WifiPhy::Get4_5mb10Mhz ()); m_modes.push_back (WifiPhy::Get6mb10Mhz ()); @@ -484,6 +518,7 @@ void YansWifiPhy::Configure80211_5Mhz (void) { NS_LOG_FUNCTION (this); + m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a m_modes.push_back (WifiPhy::Get1_5mb5Mhz ()); m_modes.push_back (WifiPhy::Get2_25mb5Mhz ()); m_modes.push_back (WifiPhy::Get3mb5Mhz ()); @@ -498,6 +533,7 @@ void YansWifiPhy::ConfigureHolland (void) { NS_LOG_FUNCTION (this); + m_channelStartingFrequency = 5e3; // 5.000 GHz m_modes.push_back (WifiPhy::Get6mba ()); m_modes.push_back (WifiPhy::Get12mba ()); m_modes.push_back (WifiPhy::Get18mba ()); @@ -621,7 +657,7 @@ YansWifiPhy::EndSync (Ptr packet, Ptr event) bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ()); double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30; double noiseDbm = RatioToDb(event->GetRxPowerW() / snrPer.snr) - GetRxNoiseFigure() + 30 ; - NotifyPromiscSniffRx (packet, m_channelFreqMhz, dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm); + NotifyPromiscSniffRx (packet, (uint16_t)GetChannelFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm); m_state->SwitchFromSyncEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ()); } else diff --git a/src/devices/wifi/yans-wifi-phy.h b/src/devices/wifi/yans-wifi-phy.h index 56357177a..a2efeba4e 100644 --- a/src/devices/wifi/yans-wifi-phy.h +++ b/src/devices/wifi/yans-wifi-phy.h @@ -69,6 +69,21 @@ public: virtual ~YansWifiPhy (); void SetChannel (Ptr channel); + + /** + * \brief Set channel number. + * + * Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1) + * + * where Starting channel frequency is standard-dependent, see SetStandard() + * as defined in IEEE 802.11-2007 17.3.8.3.2. + */ + void SetChannelNumber (uint16_t id); + /// Return current channel number, see SetChannelNumber() + uint16_t GetChannelNumber () const; + /// Return current center channel frequency in MHz, see SetСhannelNumber() + double GetChannelFrequencyMhz() const; + void StartReceivePacket (Ptr packet, double rxPowerDbm, WifiMode mode, @@ -94,6 +109,8 @@ public: Ptr GetErrorRateModel (void) const; Ptr GetDevice (void) const; Ptr GetMobility (void); + + virtual double GetTxPowerStart (void) const; @@ -135,6 +152,7 @@ private: double RatioToDb (double ratio) const; double GetPowerDbm (uint8_t power) const; void EndSync (Ptr packet, Ptr event); + void DoSetChannelNumber(uint16_t id); private: double m_edThresholdW; @@ -144,17 +162,20 @@ private: double m_txPowerBaseDbm; double m_txPowerEndDbm; uint32_t m_nTxPower; - uint16_t m_channelFreqMhz; Ptr m_channel; + uint16_t m_channelId; Ptr m_device; Ptr m_mobility; Modes m_modes; EventId m_endSyncEvent; UniformVariable m_random; WifiPhyStandard m_standard; + /// Standard-dependent center frequency of 0-th channel, MHz + double m_channelStartingFrequency; Ptr m_state; InterferenceHelper m_interference; + Time m_channelSwitchDelay; }; From 0888097992b5766c349fadb0fd6ae877d4aadab8 Mon Sep 17 00:00:00 2001 From: Pavel Boyko Date: Thu, 16 Jul 2009 16:55:20 +0400 Subject: [PATCH 7/7] Review issue 88093: Minor changes in wifi module needed by 802.11s --- src/devices/wifi/mgt-headers.cc | 8 ++- src/devices/wifi/mgt-headers.h | 3 +- src/devices/wifi/qos-tag.cc | 6 +- src/devices/wifi/qos-tag.h | 1 + src/devices/wifi/wifi-mac-header.cc | 55 ++++++++++++++++++- src/devices/wifi/wifi-mac-header.h | 7 +++ .../wifi/wifi-remote-station-manager.cc | 11 +++- .../wifi/wifi-remote-station-manager.h | 7 ++- src/devices/wifi/wscript | 7 +++ 9 files changed, 97 insertions(+), 8 deletions(-) diff --git a/src/devices/wifi/mgt-headers.cc b/src/devices/wifi/mgt-headers.cc index eccb71aa6..83668c120 100644 --- a/src/devices/wifi/mgt-headers.cc +++ b/src/devices/wifi/mgt-headers.cc @@ -108,7 +108,11 @@ MgtProbeResponseHeader::MgtProbeResponseHeader () {} MgtProbeResponseHeader::~MgtProbeResponseHeader () {} - +uint64_t +MgtProbeResponseHeader::GetTimestamp() +{ + return m_timestamp; +} Ssid MgtProbeResponseHeader::GetSsid (void) const { @@ -198,7 +202,7 @@ uint32_t MgtProbeResponseHeader::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; - i.Next (8); // timestamp + m_timestamp = i.ReadNtohU64(); m_beaconInterval = i.ReadNtohU16 (); m_beaconInterval *= 1024; i = m_capability.Deserialize (i); diff --git a/src/devices/wifi/mgt-headers.h b/src/devices/wifi/mgt-headers.h index 45996600e..44cf60aed 100644 --- a/src/devices/wifi/mgt-headers.h +++ b/src/devices/wifi/mgt-headers.h @@ -116,7 +116,7 @@ public: void SetSsid (Ssid ssid); void SetBeaconIntervalUs (uint64_t us); void SetSupportedRates (SupportedRates rates); - + uint64_t GetTimestamp(); static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; virtual void Print (std::ostream &os) const; @@ -125,6 +125,7 @@ public: virtual uint32_t Deserialize (Buffer::Iterator start); private: + uint64_t m_timestamp; Ssid m_ssid; uint64_t m_beaconInterval; SupportedRates m_rates; diff --git a/src/devices/wifi/qos-tag.cc b/src/devices/wifi/qos-tag.cc index 98bed65b6..2010be3c1 100644 --- a/src/devices/wifi/qos-tag.cc +++ b/src/devices/wifi/qos-tag.cc @@ -43,7 +43,11 @@ QosTag::GetInstanceTypeId (void) const return GetTypeId (); } -QosTag::QosTag() +QosTag::QosTag (): + m_tid (0) +{} +QosTag::QosTag (uint8_t tid): + m_tid (tid) {} uint32_t diff --git a/src/devices/wifi/qos-tag.h b/src/devices/wifi/qos-tag.h index 51f13a908..1e8ab9dac 100644 --- a/src/devices/wifi/qos-tag.h +++ b/src/devices/wifi/qos-tag.h @@ -33,6 +33,7 @@ public: virtual TypeId GetInstanceTypeId (void) const; QosTag (); + QosTag (uint8_t tid); virtual void Serialize (TagBuffer i) const; virtual void Deserialize (TagBuffer i); virtual uint32_t GetSerializedSize () const; diff --git a/src/devices/wifi/wifi-mac-header.cc b/src/devices/wifi/wifi-mac-header.cc index 3d49525e8..d61a64d1f 100644 --- a/src/devices/wifi/wifi-mac-header.cc +++ b/src/devices/wifi/wifi-mac-header.cc @@ -128,6 +128,18 @@ WifiMacHeader::SetTypeData (void) m_ctrlType = TYPE_DATA; m_ctrlSubtype = 0; } +void +WifiMacHeader::SetAction (void) +{ + m_ctrlType = TYPE_MGT; + m_ctrlSubtype = 0x0D; +} +void +WifiMacHeader::SetMultihopAction (void) +{ + m_ctrlType = TYPE_MGT; + m_ctrlSubtype = 0x0F; +} void WifiMacHeader::SetType (enum WifiMacType type) { @@ -191,6 +203,15 @@ WifiMacHeader::SetType (enum WifiMacType type) case WIFI_MAC_MGT_DEAUTHENTICATION: m_ctrlType = TYPE_MGT; m_ctrlSubtype = 12; + case WIFI_MAC_MGT_ACTION: + m_ctrlType = TYPE_MGT; + m_ctrlSubtype = 13; + case WIFI_MAC_MGT_ACTION_NO_ACK: + m_ctrlType = TYPE_MGT; + m_ctrlSubtype = 14; + case WIFI_MAC_MGT_MULTIHOP_ACTION: + m_ctrlType = TYPE_MGT; + m_ctrlSubtype = 15; break; case WIFI_MAC_DATA: @@ -397,6 +418,15 @@ WifiMacHeader::GetType (void) const case 12: return WIFI_MAC_MGT_DEAUTHENTICATION; break; + case 13: + return WIFI_MAC_MGT_ACTION; + break; + case 14: + return WIFI_MAC_MGT_ACTION_NO_ACK; + break; + case 15: + return WIFI_MAC_MGT_MULTIHOP_ACTION; + break; } break; @@ -590,6 +620,16 @@ WifiMacHeader::IsDeauthentication (void) const { return (GetType () == WIFI_MAC_MGT_DEAUTHENTICATION)?true:false; } +bool +WifiMacHeader::IsAction (void) const +{ + return (GetType () == WIFI_MAC_MGT_ACTION)?true:false; +} +bool +WifiMacHeader::IsMultihopAction (void) const +{ + return (GetType () == WIFI_MAC_MGT_MULTIHOP_ACTION)?true:false; +} uint16_t @@ -810,6 +850,9 @@ case WIFI_MAC_ ## x: \ FOO (MGT_PROBE_RESPONSE); FOO (MGT_AUTHENTICATION); FOO (MGT_DEAUTHENTICATION); + FOO (MGT_ACTION); + FOO (MGT_ACTION_NO_ACK); + FOO (MGT_MULTIHOP_ACTION); FOO (DATA); FOO (DATA_CFACK); @@ -895,6 +938,16 @@ WifiMacHeader::Print (std::ostream &os) const << ", BSSID=" << m_addr3 << ", FragNumber=" << m_seqFrag << ", SeqNumber=" << m_seqSeq; break; + case WIFI_MAC_MGT_ACTION: + case WIFI_MAC_MGT_ACTION_NO_ACK: + PrintFrameControl (os); + os << " Duration/ID=" << m_duration << "us" + << "DA=" << m_addr1 << ", SA=" << m_addr2 << ", BSSID=" << m_addr3 + << ", FragNumber=" << m_seqFrag << ", SeqNumber=" << m_seqSeq; + case WIFI_MAC_MGT_MULTIHOP_ACTION: + os << " Duration/ID=" << m_duration << "us" + << "RA=" << m_addr1 << ", TA=" << m_addr2 << ", DA=" << m_addr3 + << ", FragNumber=" << m_seqFrag << ", SeqNumber=" << m_seqSeq; case WIFI_MAC_DATA: PrintFrameControl (os); os << " Duration/ID=" << m_duration << "us"; @@ -916,7 +969,7 @@ WifiMacHeader::Print (std::ostream &os) const } else { - NS_ASSERT (false); + NS_FATAL_ERROR ("Impossible ToDs and FromDs flags combination"); } os << ", FragNumber=" << m_seqFrag << ", SeqNumber=" << m_seqSeq; diff --git a/src/devices/wifi/wifi-mac-header.h b/src/devices/wifi/wifi-mac-header.h index 1cb29f819..0cb6d2f95 100644 --- a/src/devices/wifi/wifi-mac-header.h +++ b/src/devices/wifi/wifi-mac-header.h @@ -46,6 +46,9 @@ enum WifiMacType { WIFI_MAC_MGT_PROBE_RESPONSE, WIFI_MAC_MGT_AUTHENTICATION, WIFI_MAC_MGT_DEAUTHENTICATION, + WIFI_MAC_MGT_ACTION, + WIFI_MAC_MGT_ACTION_NO_ACK, + WIFI_MAC_MGT_MULTIHOP_ACTION, WIFI_MAC_DATA, WIFI_MAC_DATA_CFACK, @@ -98,6 +101,8 @@ public: void SetProbeResp (void); void SetBeacon (void); void SetTypeData (void); + void SetAction (); + void SetMultihopAction(); void SetDsFrom (void); void SetDsNotFrom (void); void SetDsTo (void); @@ -150,6 +155,8 @@ public: bool IsDisassociation (void) const; bool IsAuthentication (void) const; bool IsDeauthentication (void) const; + bool IsAction () const; + bool IsMultihopAction () const; uint16_t GetRawDuration (void) const; Time GetDuration (void) const; uint16_t GetSequenceControl (void) const; diff --git a/src/devices/wifi/wifi-remote-station-manager.cc b/src/devices/wifi/wifi-remote-station-manager.cc index 6cf9e2129..01c204b09 100644 --- a/src/devices/wifi/wifi-remote-station-manager.cc +++ b/src/devices/wifi/wifi-remote-station-manager.cc @@ -433,7 +433,9 @@ WifiRemoteStation::GetTypeId (void) WifiRemoteStation::WifiRemoteStation () : m_state (BRAND_NEW), m_ssrc (0), - m_slrc (0) + m_slrc (0), + m_avgSlrcCoefficient(0.9), + m_avgSlrc (0) {} WifiRemoteStation::~WifiRemoteStation () {} @@ -557,7 +559,11 @@ WifiRemoteStation::GetAckMode (WifiMode dataMode) { return GetControlAnswerMode (dataMode); } - +double +WifiRemoteStation::GetAvgSlrc () const +{ + return m_avgSlrc; +} uint32_t WifiRemoteStation::GetNSupportedModes (void) const { @@ -712,6 +718,7 @@ WifiRemoteStation::ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr) void WifiRemoteStation::ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr) { + m_avgSlrc = m_avgSlrc * m_avgSlrcCoefficient + (double) m_slrc * (1 - m_avgSlrcCoefficient); m_slrc = 0; DoReportDataOk (ackSnr, ackMode, dataSnr); } diff --git a/src/devices/wifi/wifi-remote-station-manager.h b/src/devices/wifi/wifi-remote-station-manager.h index aead1a308..a7d698a3c 100644 --- a/src/devices/wifi/wifi-remote-station-manager.h +++ b/src/devices/wifi/wifi-remote-station-manager.h @@ -260,7 +260,10 @@ public: * handshake. */ WifiMode GetAckMode (WifiMode dataMode); - + /** + * \return exponentially weighted average SLRC, this is used by Airtime link metric of 802.11s + */ + double GetAvgSlrc () const; private: virtual Ptr GetManager (void) const = 0; virtual WifiMode DoGetDataMode (uint32_t size) = 0; @@ -289,6 +292,8 @@ private: SupportedModes m_modes; TracedValue m_ssrc; TracedValue m_slrc; + double m_avgSlrcCoefficient; + double m_avgSlrc; }; } // namespace ns3 diff --git a/src/devices/wifi/wscript b/src/devices/wifi/wscript index cf4a2dcbd..82e0195d4 100644 --- a/src/devices/wifi/wscript +++ b/src/devices/wifi/wscript @@ -106,6 +106,13 @@ def build(bld): 'msdu-aggregator.h', 'amsdu-subframe-header.h', 'qos-tag.h', +# Need this for module devices/mesh + 'mgt-headers.h', + 'status-code.h', + 'capability-information.h', + 'dcf-manager.h', + 'mac-rx-middle.h', + 'mac-low.h', ] if bld.env['ENABLE_GSL']: