diff --git a/src/wifi/helper/wifi-helper.cc b/src/wifi/helper/wifi-helper.cc index a4e4400cc..d7c93517d 100644 --- a/src/wifi/helper/wifi-helper.cc +++ b/src/wifi/helper/wifi-helper.cc @@ -691,6 +691,10 @@ WifiHelper::WifiHelper () m_enableFlowControl (true) { SetRemoteStationManager ("ns3::IdealWifiManager"); + m_htConfig.SetTypeId ("ns3::HtConfiguration"); + m_vhtConfig.SetTypeId ("ns3::VhtConfiguration"); + m_heConfig.SetTypeId ("ns3::HeConfiguration"); + m_ehtConfig.SetTypeId ("ns3::EhtConfiguration"); } void @@ -731,7 +735,7 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper, } if (m_standard >= WIFI_STANDARD_80211n) { - Ptr htConfiguration = CreateObject (); + auto htConfiguration = m_htConfig.Create (); device->SetHtConfiguration (htConfiguration); } if (m_standard >= WIFI_STANDARD_80211ac) @@ -741,17 +745,17 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper, // This approach allows us not to worry about deleting this object when // the PHY band is switched from 5GHz to 2.4GHz and creating this object // when the PHY band is switched from 2.4GHz to 5GHz. - Ptr vhtConfiguration = CreateObject (); + auto vhtConfiguration = m_vhtConfig.Create (); device->SetVhtConfiguration (vhtConfiguration); } if (m_standard >= WIFI_STANDARD_80211ax) { - Ptr heConfiguration = CreateObject (); + auto heConfiguration = m_heConfig.Create (); device->SetHeConfiguration (heConfiguration); } if (m_standard >= WIFI_STANDARD_80211be) { - Ptr ehtConfiguration = CreateObject (); + auto ehtConfiguration = m_ehtConfig.Create (); device->SetEhtConfiguration (ehtConfiguration); } Ptr manager = m_stationManager.Create (); diff --git a/src/wifi/helper/wifi-helper.h b/src/wifi/helper/wifi-helper.h index 953caf84f..847ff1d97 100644 --- a/src/wifi/helper/wifi-helper.h +++ b/src/wifi/helper/wifi-helper.h @@ -388,6 +388,46 @@ public: */ virtual void SetStandard (WifiStandard standard); + /** + * Helper function used to configure the HT options listed as attributes of + * the HtConfiguration class. + * + * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs. + * \param args A sequence of name-value pairs of the attributes to set. + */ + template + void ConfigHtOptions (Args&&... args); + + /** + * Helper function used to configure the VHT options listed as attributes of + * the VhtConfiguration class. + * + * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs. + * \param args A sequence of name-value pairs of the attributes to set. + */ + template + void ConfigVhtOptions (Args&&... args); + + /** + * Helper function used to configure the HE options listed as attributes of + * the HeConfiguration class. + * + * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs. + * \param args A sequence of name-value pairs of the attributes to set. + */ + template + void ConfigHeOptions (Args&&... args); + + /** + * Helper function used to configure the EHT options listed as attributes of + * the EhtConfiguration class. + * + * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs. + * \param args A sequence of name-value pairs of the attributes to set. + */ + template + void ConfigEhtOptions (Args&&... args); + /** * Helper to enable all WifiNetDevice log components with one statement */ @@ -412,8 +452,11 @@ public: protected: ObjectFactory m_stationManager; ///< station manager - ObjectFactory m_ackPolicySelector[4]; ///< ack policy selector for all ACs WifiStandard m_standard; ///< wifi standard + ObjectFactory m_htConfig; ///< HT configuration + ObjectFactory m_vhtConfig; ///< VHT configuration + ObjectFactory m_heConfig; ///< HE configuration + ObjectFactory m_ehtConfig; ///< EHT configuration SelectQueueCallback m_selectQueueCallback; ///< select queue callback ObjectFactory m_obssPdAlgorithm; ///< OBSS_PD algorithm bool m_enableFlowControl; //!< whether to enable flow control @@ -475,6 +518,34 @@ WifiHelper::SetObssPdAlgorithm (std::string type, Args&&... args) m_obssPdAlgorithm.Set (args...); } +template +void +WifiHelper::ConfigHtOptions (Args&&... args) +{ + m_htConfig.Set (args...); +} + +template +void +WifiHelper::ConfigVhtOptions (Args&&... args) +{ + m_vhtConfig.Set (args...); +} + +template +void +WifiHelper::ConfigHeOptions (Args&&... args) +{ + m_heConfig.Set (args...); +} + +template +void +WifiHelper::ConfigEhtOptions (Args&&... args) +{ + m_ehtConfig.Set (args...); +} + } // namespace ns3 #endif /* WIFI_HELPER_H */