WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each constituent MPDU. More...
#include "wifi-psdu.h"
Public Member Functions | |
WifiPsdu (Ptr< const Packet > p, const WifiMacHeader &header) | |
Create a PSDU storing an MPDU. | |
WifiPsdu (Ptr< const WifiMpdu > mpdu, bool isSingle) | |
Create a PSDU storing an MPDU or S-MPDU. | |
WifiPsdu (Ptr< WifiMpdu > mpdu, bool isSingle) | |
Create a PSDU storing an MPDU or S-MPDU. | |
WifiPsdu (std::vector< Ptr< WifiMpdu > > mpduList) | |
Create a PSDU storing an S-MPDU or A-MPDU. | |
virtual | ~WifiPsdu () |
std::vector< Ptr< WifiMpdu > >::iterator | begin () |
Return an iterator to the first MPDU. | |
std::vector< Ptr< WifiMpdu > >::const_iterator | begin () const |
Return a const iterator to the first MPDU. | |
std::vector< Ptr< WifiMpdu > >::iterator | end () |
Return an iterator to past-the-last MPDU. | |
std::vector< Ptr< WifiMpdu > >::const_iterator | end () const |
Return a const iterator to past-the-last MPDU. | |
WifiMacHeader::QosAckPolicy | GetAckPolicyForTid (uint8_t tid) const |
Get the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID. | |
Mac48Address | GetAddr1 () const |
Get the Receiver Address (RA), which is common to all the MPDUs. | |
Mac48Address | GetAddr2 () const |
Get the Transmitter Address (TA), which is common to all the MPDUs. | |
Ptr< Packet > | GetAmpduSubframe (std::size_t i) const |
Get a copy of the i-th A-MPDU subframe (includes subframe header, MPDU, and possibly padding) | |
std::size_t | GetAmpduSubframeSize (std::size_t i) const |
Return the size of the i-th A-MPDU subframe. | |
Time | GetDuration () const |
Get the duration from the Duration/ID field, which is common to all the MPDUs. | |
WifiMacHeader & | GetHeader (std::size_t i) |
Get the header of the i-th MPDU. | |
const WifiMacHeader & | GetHeader (std::size_t i) const |
Get the header of the i-th MPDU. | |
uint16_t | GetMaxDistFromStartingSeq (uint16_t startingSeq) const |
Get the maximum distance between the sequence number of any QoS Data frame included in this PSDU that is not an old frame and the given starting sequence number. | |
std::size_t | GetNMpdus () const |
Return the number of MPDUs constituting the PSDU. | |
Ptr< const Packet > | GetPacket () const |
Get the PSDU as a single packet. | |
Ptr< const Packet > | GetPayload (std::size_t i) const |
Get the payload of the i-th MPDU. | |
uint32_t | GetSize () const |
Return the size of the PSDU in bytes. | |
std::set< uint8_t > | GetTids () const |
Get the set of TIDs of the QoS Data frames included in the PSDU. | |
bool | HasNav () const |
void | IncrementRetryCount () |
Increment the frame retry count for all the MPDUs. | |
bool | IsAggregate () const |
Return true if the PSDU is an S-MPDU or A-MPDU. | |
bool | IsSingle () const |
Return true if the PSDU is an S-MPDU. | |
void | Print (std::ostream &os) const |
Print the PSDU contents. | |
void | SetAckPolicyForTid (uint8_t tid, WifiMacHeader::QosAckPolicy policy) |
Set the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID to the given policy. | |
void | SetDuration (Time duration) |
Set the Duration/ID field on all the MPDUs. | |
Public Member Functions inherited from ns3::SimpleRefCount< WifiPsdu > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Attributes | |
bool | m_isSingle |
true for an S-MPDU | |
std::vector< Ptr< WifiMpdu > > | m_mpduList |
list of constituent MPDUs | |
uint32_t | m_size |
the size of the PSDU in bytes | |
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each constituent MPDU.
Definition at line 32 of file wifi-psdu.h.
ns3::WifiPsdu::WifiPsdu | ( | Ptr< const Packet > | p, |
const WifiMacHeader & | header ) |
Create a PSDU storing an MPDU.
Typically used for control and management frames that do not have to keep an associated lifetime and are not stored in an S-MPDU.
p | the payload of the MPDU. |
header | the Wifi MAC header of the MPDU. |
Definition at line 24 of file wifi-psdu.cc.
References ns3::Create(), ns3::WifiMacHeader::GetSerializedSize(), m_mpduList, m_size, and ns3::WIFI_MAC_FCS_LENGTH.
Create a PSDU storing an MPDU or S-MPDU.
Typically used for QoS data frames that have to keep an associated lifetime.
mpdu | the MPDU. |
isSingle | true for an S-MPDU |
Definition at line 31 of file wifi-psdu.cc.
References m_mpduList, and m_size.
Create a PSDU storing an MPDU or S-MPDU.
Typically used for QoS data frames that have to keep an associated lifetime.
mpdu | the MPDU. |
isSingle | true for an S-MPDU |
Create a PSDU storing an S-MPDU or A-MPDU.
mpduList | the list of constituent MPDUs. |
Definition at line 48 of file wifi-psdu.cc.
References ns3::MpduAggregator::GetSizeIfAggregated(), m_mpduList, m_size, and NS_ABORT_MSG_IF.
|
virtual |
Definition at line 61 of file wifi-psdu.cc.
Return an iterator to the first MPDU.
Definition at line 338 of file wifi-psdu.cc.
References m_mpduList.
Return a const iterator to the first MPDU.
Definition at line 332 of file wifi-psdu.cc.
References m_mpduList.
Referenced by PreservePacketsInAmpdus::NotifyPsduForwardedDown(), and ns3::HtFrameExchangeManager::SendPsdu().
Return an iterator to past-the-last MPDU.
Definition at line 350 of file wifi-psdu.cc.
References m_mpduList.
Return a const iterator to past-the-last MPDU.
Definition at line 344 of file wifi-psdu.cc.
References m_mpduList.
Referenced by PreservePacketsInAmpdus::NotifyMacHeaderEndRx().
WifiMacHeader::QosAckPolicy ns3::WifiPsdu::GetAckPolicyForTid | ( | uint8_t | tid | ) | const |
Get the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID.
Also, check that all the QoS Data frames having the given TID have the same QoS Ack Policy. Do not call this method if there is no QoS Date frame in the PSDU.
tid | the given TID |
Definition at line 191 of file wifi-psdu.cc.
References m_mpduList, ns3::WifiMacHeader::NORMAL_ACK, NS_ABORT_MSG, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
Referenced by ns3::HtFrameExchangeManager::SendPsdu().
Mac48Address ns3::WifiPsdu::GetAddr1 | ( | ) | const |
Get the Receiver Address (RA), which is common to all the MPDUs.
Definition at line 102 of file wifi-psdu.cc.
References m_mpduList, and NS_ABORT_MSG.
Referenced by ns3::HtFrameExchangeManager::ReceiveMpdu(), and ns3::HtFrameExchangeManager::SendPsdu().
Mac48Address ns3::WifiPsdu::GetAddr2 | ( | ) | const |
Get the Transmitter Address (TA), which is common to all the MPDUs.
Definition at line 117 of file wifi-psdu.cc.
References m_mpduList, and NS_ABORT_MSG.
Get a copy of the i-th A-MPDU subframe (includes subframe header, MPDU, and possibly padding)
i | the index in the list of A-MPDU subframes |
Definition at line 296 of file wifi-psdu.cc.
References ns3::Create(), ns3::MpduAggregator::GetAmpduSubframeHeader(), GetAmpduSubframeSize(), m_isSingle, m_mpduList, and NS_ASSERT.
std::size_t ns3::WifiPsdu::GetAmpduSubframeSize | ( | std::size_t | i | ) | const |
Return the size of the i-th A-MPDU subframe.
i | the index in the list of A-MPDU subframes |
Definition at line 313 of file wifi-psdu.cc.
References ns3::MpduAggregator::CalculatePadding(), m_mpduList, and NS_ASSERT.
Referenced by GetAmpduSubframe().
Time ns3::WifiPsdu::GetDuration | ( | ) | const |
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Definition at line 142 of file wifi-psdu.cc.
References m_mpduList, and NS_ABORT_MSG.
WifiMacHeader & ns3::WifiPsdu::GetHeader | ( | std::size_t | i | ) |
Get the header of the i-th MPDU.
i | index in the list of MPDUs |
Definition at line 284 of file wifi-psdu.cc.
References m_mpduList.
const WifiMacHeader & ns3::WifiPsdu::GetHeader | ( | std::size_t | i | ) | const |
Get the header of the i-th MPDU.
i | index in the list of MPDUs |
Definition at line 278 of file wifi-psdu.cc.
References m_mpduList.
Referenced by ns3::HtFrameExchangeManager::ReceiveMpdu(), WifiPrimaryChannelsTest::SendHeTbPpdu(), ProbeExchTest::ValidateProbeReq(), and ProbeExchTest::ValidateProbeResp().
uint16_t ns3::WifiPsdu::GetMaxDistFromStartingSeq | ( | uint16_t | startingSeq | ) | const |
Get the maximum distance between the sequence number of any QoS Data frame included in this PSDU that is not an old frame and the given starting sequence number.
If this PSDU does not contain any QoS Data frame that is not an old frame, an invalid distance (4096) is returned.
startingSeq | the given starting sequence number. |
Definition at line 238 of file wifi-psdu.cc.
References m_mpduList, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::QosUtilsIsOldPacket(), and ns3::SEQNO_SPACE_SIZE.
std::size_t ns3::WifiPsdu::GetNMpdus | ( | ) | const |
Return the number of MPDUs constituting the PSDU.
Definition at line 326 of file wifi-psdu.cc.
References m_mpduList.
Referenced by Print(), ns3::HtFrameExchangeManager::ReceiveMpdu(), and ns3::HtFrameExchangeManager::SendPsdu().
Get the PSDU as a single packet.
Definition at line 78 of file wifi-psdu.cc.
References ns3::AddWifiMacTrailer(), ns3::MpduAggregator::Aggregate(), ns3::Create(), m_isSingle, and m_mpduList.
Get the payload of the i-th MPDU.
i | index in the list of MPDUs |
Definition at line 290 of file wifi-psdu.cc.
References m_mpduList.
Referenced by WifiFilsFrameTest::GetFilsDiscFrame().
uint32_t ns3::WifiPsdu::GetSize | ( | ) | const |
Return the size of the PSDU in bytes.
Definition at line 272 of file wifi-psdu.cc.
References m_size.
Referenced by WifiPrimaryChannelsTest::DoSetup(), and ns3::HtFrameExchangeManager::SendPsdu().
std::set< uint8_t > ns3::WifiPsdu::GetTids | ( | ) | const |
Get the set of TIDs of the QoS Data frames included in the PSDU.
Note that only single-TID A-MPDUs are currently supported, hence the returned set contains at most one TID value.
Definition at line 177 of file wifi-psdu.cc.
References m_mpduList.
Referenced by ns3::HtFrameExchangeManager::SendPsdu().
bool ns3::WifiPsdu::HasNav | ( | ) | const |
Definition at line 132 of file wifi-psdu.cc.
References m_mpduList.
void ns3::WifiPsdu::IncrementRetryCount | ( | ) |
Increment the frame retry count for all the MPDUs.
Definition at line 167 of file wifi-psdu.cc.
References m_mpduList, and NS_LOG_FUNCTION.
bool ns3::WifiPsdu::IsAggregate | ( | ) | const |
Return true if the PSDU is an S-MPDU or A-MPDU.
Definition at line 72 of file wifi-psdu.cc.
References m_isSingle, and m_mpduList.
Referenced by Print(), and ns3::VhtPpdu::SetTxVectorFromPhyHeaders().
bool ns3::WifiPsdu::IsSingle | ( | ) | const |
Return true if the PSDU is an S-MPDU.
Definition at line 66 of file wifi-psdu.cc.
References m_isSingle.
void ns3::WifiPsdu::Print | ( | std::ostream & | os | ) | const |
Print the PSDU contents.
os | output stream in which the data should be printed. |
Definition at line 356 of file wifi-psdu.cc.
References GetNMpdus(), IsAggregate(), m_isSingle, m_mpduList, and m_size.
Referenced by ns3::operator<<().
void ns3::WifiPsdu::SetAckPolicyForTid | ( | uint8_t | tid, |
WifiMacHeader::QosAckPolicy | policy ) |
Set the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID to the given policy.
tid | the given TID |
policy | the given QoS Ack policy |
Definition at line 225 of file wifi-psdu.cc.
References m_mpduList, and NS_LOG_FUNCTION.
void ns3::WifiPsdu::SetDuration | ( | Time | duration | ) |
Set the Duration/ID field on all the MPDUs.
duration | the value for the Duration/ID field. |
Definition at line 157 of file wifi-psdu.cc.
References m_mpduList, and NS_LOG_FUNCTION.
Referenced by ns3::HtFrameExchangeManager::SendPsdu().
|
private |
true for an S-MPDU
Definition at line 249 of file wifi-psdu.h.
Referenced by GetAmpduSubframe(), GetPacket(), IsAggregate(), IsSingle(), and Print().
list of constituent MPDUs
Definition at line 250 of file wifi-psdu.h.
Referenced by WifiPsdu(), WifiPsdu(), WifiPsdu(), begin(), begin(), end(), end(), GetAckPolicyForTid(), GetAddr1(), GetAddr2(), GetAmpduSubframe(), GetAmpduSubframeSize(), GetDuration(), GetHeader(), GetHeader(), GetMaxDistFromStartingSeq(), GetNMpdus(), GetPacket(), GetPayload(), GetTids(), HasNav(), IncrementRetryCount(), IsAggregate(), Print(), SetAckPolicyForTid(), and SetDuration().
|
private |
the size of the PSDU in bytes
Definition at line 251 of file wifi-psdu.h.
Referenced by WifiPsdu(), WifiPsdu(), WifiPsdu(), GetSize(), and Print().