wifi: Add a WifiPsdu method to check if a PSDU is setting the NAV

This commit is contained in:
Stefano Avallone
2023-01-18 10:12:29 +01:00
parent 1553cdcee4
commit e574f80fca
3 changed files with 16 additions and 6 deletions

View File

@@ -1110,13 +1110,8 @@ FrameExchangeManager::UpdateNav(Ptr<const WifiPsdu> psdu, const WifiTxVector& tx
{
NS_LOG_FUNCTION(this << psdu << txVector);
if (psdu->GetHeader(0).GetRawDuration() > 32767)
if (!psdu->HasNav())
{
// When the contents of a received Duration/ID field, treated as an unsigned
// integer, are greater than 32 768, the contents are interpreted as appropriate
// for the frame type and subtype or ignored if the receiving MAC entity does
// not have a defined interpretation for that type and subtype (IEEE 802.11-2016
// sec. 10.27.3)
return;
}

View File

@@ -139,6 +139,16 @@ WifiPsdu::GetAddr2() const
return ta;
}
bool
WifiPsdu::HasNav() const
{
// When the contents of a received Duration/ID field, treated as an unsigned integer,
// are greater than 32 768, the contents are interpreted as appropriate for the frame
// type and subtype or ignored if the receiving MAC entity does not have a defined
// interpretation for that type and subtype (IEEE 802.11-2016 sec. 10.27.3)
return (m_mpduList.at(0)->GetHeader().GetRawDuration() & 0x8000) == 0;
}
Time
WifiPsdu::GetDuration() const
{

View File

@@ -144,6 +144,11 @@ class WifiPsdu : public SimpleRefCount<WifiPsdu>
*/
Mac48Address GetAddr2() const;
/**
* \return true if the Duration/ID field contains a value for setting the NAV
*/
bool HasNav() const;
/**
* Get the duration from the Duration/ID field, which is common to all the MPDUs
* \return the duration from the Duration/ID field.