diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index eb642126a..b61b27f01 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -64,6 +64,7 @@ HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, ui auto [it, ret] = m_muUserInfos.emplace (heMuUserInfo); NS_ABORT_MSG_IF (!ret, "STA-ID " << heMuUserInfo.first << " already present"); } + m_contentChannelAlloc = txVector.GetContentChannelAllocation (); } SetPhyHeaders (txVector, ppduDuration); SetTxPsdFlag (flag); @@ -273,6 +274,20 @@ HePpdu::SetTxPsdFlag (TxPsdFlag flag) m_txPsdFlag = flag; } +bool +HePpdu::IsAllocated (uint16_t staId) const +{ + return (m_muUserInfos.find (staId) != m_muUserInfos.cend ()); +} + +bool +HePpdu::IsStaInContentChannel (uint16_t staId, std::size_t channelId) const +{ + NS_ASSERT_MSG (channelId < m_contentChannelAlloc.size (), "Invalid content channel ID " << channelId); + const auto& channelAlloc = m_contentChannelAlloc.at (channelId); + return (std::find (channelAlloc.cbegin (), channelAlloc.cend (), staId) != channelAlloc.cend ()); +} + std::string HePpdu::PrintPayload (void) const { diff --git a/src/wifi/model/he/he-ppdu.h b/src/wifi/model/he/he-ppdu.h index 7873a4bb9..3cc90aa33 100644 --- a/src/wifi/model/he/he-ppdu.h +++ b/src/wifi/model/he/he-ppdu.h @@ -223,6 +223,21 @@ public: */ void SetTxPsdFlag (TxPsdFlag flag); + /** + * Check if STA ID is in HE SIG-B Content Channel ID + * \param staId STA ID + * \param channelId Content Channel ID + * \return true if STA ID in content channel ID, false otherwise + */ + bool IsStaInContentChannel (uint16_t staId, size_t channelId) const; + + /** + * Check if STA ID is allocated + * \param staId STA ID + * \return true if allocated, false otherwise + */ + bool IsAllocated (uint16_t staId) const; + protected: std::string PrintPayload (void) const override; WifiTxVector DoGetTxVector (void) const override; @@ -254,7 +269,8 @@ protected: HeSigHeader m_heSig; //!< the HE-SIG PHY header TxPsdFlag m_txPsdFlag; //!< the transmit power spectral density flag - WifiTxVector::HeMuUserInfoMap m_muUserInfos; //!< the HE MU specific per-user information (to be removed once HE-SIG-B headers are implemented) + WifiTxVector::HeMuUserInfoMap m_muUserInfos; //!< HE MU specific per-user information (to be removed once HE-SIG-B headers are implemented) + ContentChannelAllocation m_contentChannelAlloc; //!< HE SIG-B Content Channel allocation (to be removed once HE-SIG-B headers are implemented) }; //class HePpdu /**