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. More... | |
WifiPsdu (Ptr< const WifiMacQueueItem > mpdu, bool isSingle) | |
Create a PSDU storing an MPDU or S-MPDU. More... | |
WifiPsdu (Ptr< WifiMacQueueItem > mpdu, bool isSingle) | |
Create a PSDU storing an MPDU or S-MPDU. More... | |
WifiPsdu (std::vector< Ptr< WifiMacQueueItem >> mpduList) | |
Create a PSDU storing an S-MPDU or A-MPDU. More... | |
virtual | ~WifiPsdu () |
std::vector< Ptr< WifiMacQueueItem > >::iterator | begin (void) |
Return an iterator to the first MPDU. More... | |
std::vector< Ptr< WifiMacQueueItem > >::const_iterator | begin (void) const |
Return a const iterator to the first MPDU. More... | |
std::vector< Ptr< WifiMacQueueItem > >::iterator | end (void) |
Return an iterator to past-the-last MPDU. More... | |
std::vector< Ptr< WifiMacQueueItem > >::const_iterator | end (void) const |
Return a const iterator to past-the-last MPDU. More... | |
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. More... | |
Mac48Address | GetAddr1 (void) const |
Get the Receiver Address (RA), which is common to all the MPDUs. More... | |
Mac48Address | GetAddr2 (void) const |
Get the Transmitter Address (TA), which is common to all the MPDUs. More... | |
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) More... | |
std::size_t | GetAmpduSubframeSize (std::size_t i) const |
Return the size of the i-th A-MPDU subframe. More... | |
Time | GetDuration (void) const |
Get the duration from the Duration/ID field, which is common to all the MPDUs. More... | |
WifiMacHeader & | GetHeader (std::size_t i) |
Get the header of the i-th MPDU. More... | |
const WifiMacHeader & | GetHeader (std::size_t i) const |
Get the header of the i-th MPDU. More... | |
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. More... | |
std::size_t | GetNMpdus (void) const |
Return the number of MPDUs constituting the PSDU. More... | |
Ptr< const Packet > | GetPacket (void) const |
Get the PSDU as a single packet. More... | |
Ptr< const Packet > | GetPayload (std::size_t i) const |
Get the payload of the i-th MPDU. More... | |
uint32_t | GetSize (void) const |
Return the size of the PSDU in bytes. More... | |
std::set< uint8_t > | GetTids (void) const |
Get the set of TIDs of the QoS Data frames included in the PSDU. More... | |
Time | GetTimeStamp (std::size_t i) const |
Get the timestamp of the i-th MPDU. More... | |
bool | IsAggregate (void) const |
Return true if the PSDU is an S-MPDU or A-MPDU. More... | |
bool | IsSingle (void) const |
Return true if the PSDU is an S-MPDU. More... | |
void | Print (std::ostream &os) const |
Print the PSDU contents. More... | |
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. More... | |
void | SetDuration (Time duration) |
Set the Duration/ID field on all the MPDUs. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< WifiPsdu > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= ([[maybe_unused]] const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Private Attributes | |
bool | m_isSingle |
true for an S-MPDU More... | |
std::vector< Ptr< WifiMacQueueItem > > | m_mpduList |
list of constituent MPDUs More... | |
uint32_t | m_size |
the size of the PSDU in bytes More... | |
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each constituent MPDU.
Definition at line 40 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 33 of file wifi-psdu.cc.
References ns3::WifiMacHeader::GetSerializedSize(), ns3::Packet::GetSize(), m_mpduList, m_size, and ns3::WIFI_MAC_FCS_LENGTH.
ns3::WifiPsdu::WifiPsdu | ( | Ptr< WifiMacQueueItem > | mpdu, |
bool | isSingle | ||
) |
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 40 of file wifi-psdu.cc.
References m_mpduList, and m_size.
ns3::WifiPsdu::WifiPsdu | ( | Ptr< const WifiMacQueueItem > | mpdu, |
bool | isSingle | ||
) |
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 |
ns3::WifiPsdu::WifiPsdu | ( | std::vector< Ptr< WifiMacQueueItem >> | mpduList | ) |
Create a PSDU storing an S-MPDU or A-MPDU.
mpduList | the list of constituent MPDUs. |
Definition at line 57 of file wifi-psdu.cc.
References ns3::MpduAggregator::GetSizeIfAggregated(), m_mpduList, m_size, and NS_ABORT_MSG_IF.
|
virtual |
Definition at line 70 of file wifi-psdu.cc.
std::vector< Ptr< WifiMacQueueItem > >::iterator ns3::WifiPsdu::begin | ( | void | ) |
Return an iterator to the first MPDU.
Definition at line 331 of file wifi-psdu.cc.
References m_mpduList.
std::vector< Ptr< WifiMacQueueItem > >::const_iterator ns3::WifiPsdu::begin | ( | void | ) | const |
Return a const iterator to the first MPDU.
Definition at line 325 of file wifi-psdu.cc.
References m_mpduList.
Referenced by ns3::HeFrameExchangeManager::BlockAckAfterTbPpduTimeout(), ns3::HtFrameExchangeManager::BlockAckTimeout(), ns3::FrameExchangeManager::DoCtsTimeout(), ns3::HeFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::MissedBlockAck(), ns3::FrameExchangeManager::Receive(), CollisionExperiment::Receive(), TestAmpduReception::RxFailure(), TestAmpduReception::RxSuccess(), ns3::PhyEntity::ScheduleEndOfMpdus(), CollisionExperiment::SendA(), CollisionExperiment::SendB(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::HeFrameExchangeManager::SendPsduMap(), and ns3::WifiAckManager::SetQosAckPolicy().
std::vector< Ptr< WifiMacQueueItem > >::iterator ns3::WifiPsdu::end | ( | void | ) |
Return an iterator to past-the-last MPDU.
Definition at line 343 of file wifi-psdu.cc.
References m_mpduList.
Referenced by grid.TimelinesRenderer::draw_events(), and grid.TimelinesRenderer::draw_ranges().
std::vector< Ptr< WifiMacQueueItem > >::const_iterator ns3::WifiPsdu::end | ( | void | ) | const |
Return a const iterator to past-the-last MPDU.
Definition at line 337 of file wifi-psdu.cc.
References m_mpduList.
Referenced by grid.TimelinesRenderer::draw_events(), grid.TimelinesRenderer::draw_ranges(), ns3::HeFrameExchangeManager::EndReceiveAmpdu(), TestAmpduReception::RxFailure(), TestAmpduReception::RxSuccess(), and ns3::PhyEntity::ScheduleEndOfMpdus().
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 180 of file wifi-psdu.cc.
References m_mpduList, NS_ABORT_MSG, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
Referenced by ns3::HtFrameExchangeManager::EndReceiveAmpdu(), and ns3::HtFrameExchangeManager::SendPsdu().
Mac48Address ns3::WifiPsdu::GetAddr1 | ( | void | ) | const |
Get the Receiver Address (RA), which is common to all the MPDUs.
Definition at line 111 of file wifi-psdu.cc.
References m_mpduList, and NS_ABORT_MSG.
Referenced by ns3::HtFrameExchangeManager::MissedBlockAck(), ns3::QosFrameExchangeManager::PreProcessFrame(), ns3::FrameExchangeManager::Receive(), ns3::HtFrameExchangeManager::ReceiveMpdu(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::HeFrameExchangeManager::SendPsduMap(), ns3::WifiAckManager::SetQosAckPolicy(), ns3::QosFrameExchangeManager::SetTxopHolder(), and ns3::FrameExchangeManager::UpdateNav().
Mac48Address ns3::WifiPsdu::GetAddr2 | ( | void | ) | const |
Get the Transmitter Address (TA), which is common to all the MPDUs.
Definition at line 126 of file wifi-psdu.cc.
References m_mpduList, and NS_ABORT_MSG.
Referenced by ns3::HeFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::EndReceiveAmpdu(), TestUlOfdmaPowerControl::ReceiveOkCallbackAtAp(), TestUlOfdmaPhyTransmission::RxFailure(), TestPhyPaddingExclusion::RxFailure(), TestUlOfdmaPhyTransmission::RxSuccess(), TestPhyPaddingExclusion::RxSuccess(), ns3::QosFrameExchangeManager::SetTxopHolder(), and ns3::HeFrameExchangeManager::SetTxopHolder().
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 290 of file wifi-psdu.cc.
References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::MpduAggregator::GetAmpduSubframeHeader(), GetAmpduSubframeSize(), ns3::Packet::GetSize(), m_isSingle, m_mpduList, and NS_ASSERT.
Referenced by ns3::WifiPhy::NotifyMonitorSniffRx(), and ns3::WifiPhy::NotifyMonitorSniffTx().
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 306 of file wifi-psdu.cc.
References ns3::MpduAggregator::CalculatePadding(), m_mpduList, and NS_ASSERT.
Referenced by GetAmpduSubframe(), and ns3::PhyEntity::ScheduleEndOfMpdus().
Time ns3::WifiPsdu::GetDuration | ( | void | ) | const |
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Definition at line 141 of file wifi-psdu.cc.
References m_mpduList, and NS_ABORT_MSG.
Referenced by ns3::HtFrameExchangeManager::EndReceiveAmpdu(), and ns3::FrameExchangeManager::UpdateNav().
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 272 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 266 of file wifi-psdu.cc.
References m_mpduList.
Referenced by ns3::FrameExchangeManager::DoCtsTimeout(), AmpduAggregationTest::DoRun(), ns3::HtFrameExchangeManager::MissedBlockAck(), ns3::FrameExchangeManager::Receive(), WifiPrimaryChannelsTest::ReceiveDl(), ns3::HtFrameExchangeManager::ReceiveMpdu(), TestUlOfdmaPowerControl::ReceiveOkCallbackAtAp(), WifiPrimaryChannelsTest::ReceiveUl(), ns3::HtFrameExchangeManager::SendBlockAck(), WifiPrimaryChannelsTest::SendHeTbPpdu(), ns3::QosFrameExchangeManager::SetTxopHolder(), ns3::HeFrameExchangeManager::SetTxopHolder(), and ns3::FrameExchangeManager::UpdateNav().
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 227 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 | ( | void | ) | const |
Return the number of MPDUs constituting the PSDU.
Definition at line 319 of file wifi-psdu.cc.
References m_mpduList.
Referenced by AmpduAggregationTest::DoRun(), ns3::HtFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::MissedBlockAck(), ns3::WifiPhy::NotifyMonitorSniffRx(), ns3::WifiPhy::NotifyMonitorSniffTx(), Print(), ns3::FrameExchangeManager::Receive(), WifiPrimaryChannelsTest::ReceiveDl(), TestUlOfdmaPowerControl::ReceiveOkCallbackAtAp(), WifiPrimaryChannelsTest::ReceiveUl(), TestAmpduReception::RxSuccess(), ns3::PhyEntity::ScheduleEndOfMpdus(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::HeFrameExchangeManager::SendPsduMap(), and ns3::WifiAckManager::SetQosAckPolicy().
Get the PSDU as a single packet.
Definition at line 87 of file wifi-psdu.cc.
References ns3::Packet::AddHeader(), ns3::AddWifiMacTrailer(), ns3::MpduAggregator::Aggregate(), m_isSingle, and m_mpduList.
Referenced by ns3::PhyEntity::GetReceptionStatus(), ns3::WifiPhy::NotifyMonitorSniffRx(), ns3::WifiPhy::NotifyMonitorSniffTx(), ns3::WifiPhyStateHelper::SwitchFromRxEndError(), and ns3::WifiPhyStateHelper::SwitchFromRxEndOk().
Get the payload 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::MissedBlockAck(), ns3::HtFrameExchangeManager::SendBlockAck(), and ns3::HeFrameExchangeManager::SendMultiStaBlockAck().
uint32_t ns3::WifiPsdu::GetSize | ( | void | ) | const |
Return the size of the PSDU in bytes.
Definition at line 260 of file wifi-psdu.cc.
References m_size.
Referenced by ns3::HtPpdu::HtPpdu(), ns3::OfdmPpdu::OfdmPpdu(), AmpduAggregationTest::DoRun(), TwoLevelAggregationTest::DoRun(), WifiPrimaryChannelsTest::DoSendHeTbPpdu(), WifiPrimaryChannelsTest::DoSetup(), ns3::PhyEntity::GetReceptionStatus(), SpectrumWifiPhyBasicTest::MakeSignal(), WifiPhyThresholdsTest::MakeWifiSignal(), TestMultipleHeTbPreambles::RxHeTbPpdu(), TestUlOfdmaPhyTransmission::RxSuccess(), TestPhyPaddingExclusion::RxSuccess(), TestSimpleFrameCaptureModel::RxSuccess(), TestDlOfdmaPhyTransmission::RxSuccessSta1(), TestDlOfdmaPhyTransmission::RxSuccessSta2(), TestDlOfdmaPhyTransmission::RxSuccessSta3(), ns3::PhyEntity::ScheduleEndOfMpdus(), TestAmpduReception::SendAmpduWithThreeMpdus(), TestUlOfdmaPhyTransmission::SendHeTbPpdu(), TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket(), TestThresholdPreambleDetectionWithFrameCapture::SendPacket(), TestPhyHeadersReception::SendPacket(), TestSimpleFrameCaptureModel::SendPacket(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::HeFrameExchangeManager::SendPsduMap(), and TestUlOfdmaPpduUid::SendTbPpdu().
std::set< uint8_t > ns3::WifiPsdu::GetTids | ( | void | ) | 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 166 of file wifi-psdu.cc.
References m_mpduList.
Referenced by ns3::HeFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::MissedBlockAck(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::HeFrameExchangeManager::SendPsduMap(), and ns3::WifiAckManager::SetQosAckPolicy().
Time ns3::WifiPsdu::GetTimeStamp | ( | std::size_t | i | ) | const |
Get the timestamp of the i-th MPDU.
i | index in the list of MPDUs |
Definition at line 284 of file wifi-psdu.cc.
References m_mpduList.
bool ns3::WifiPsdu::IsAggregate | ( | void | ) | const |
Return true if the PSDU is an S-MPDU or A-MPDU.
Definition at line 81 of file wifi-psdu.cc.
References m_isSingle, and m_mpduList.
Referenced by ns3::HtFrameExchangeManager::ForwardPsduDown(), ns3::WifiPhy::NotifyMonitorSniffRx(), ns3::WifiPhy::NotifyMonitorSniffTx(), Print(), and TestSimpleFrameCaptureModel::RxSuccess().
bool ns3::WifiPsdu::IsSingle | ( | void | ) | const |
Return true if the PSDU is an S-MPDU.
Definition at line 75 of file wifi-psdu.cc.
References m_isSingle.
Referenced by ns3::WifiPhy::NotifyMonitorSniffRx(), ns3::WifiPhy::NotifyMonitorSniffTx(), TestSimpleFrameCaptureModel::RxSuccess(), and ns3::PhyEntity::ScheduleEndOfMpdus().
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 349 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 214 of file wifi-psdu.cc.
References m_mpduList, and NS_LOG_FUNCTION.
Referenced by ns3::WifiAckManager::SetQosAckPolicy().
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 156 of file wifi-psdu.cc.
References m_mpduList, and NS_LOG_FUNCTION.
Referenced by ns3::HeFrameExchangeManager::ReceiveBasicTrigger(), TestUlOfdmaPowerControl::SendMuBar(), ns3::HeFrameExchangeManager::SendMultiStaBlockAck(), and ns3::HtFrameExchangeManager::SendPsdu().
|
private |
true for an S-MPDU
Definition at line 254 of file wifi-psdu.h.
Referenced by GetAmpduSubframe(), GetPacket(), IsAggregate(), IsSingle(), and Print().
|
private |
list of constituent MPDUs
Definition at line 255 of file wifi-psdu.h.
Referenced by WifiPsdu(), begin(), end(), GetAckPolicyForTid(), GetAddr1(), GetAddr2(), GetAmpduSubframe(), GetAmpduSubframeSize(), GetDuration(), GetHeader(), GetMaxDistFromStartingSeq(), GetNMpdus(), GetPacket(), GetPayload(), GetTids(), GetTimeStamp(), IsAggregate(), Print(), SetAckPolicyForTid(), and SetDuration().
|
private |
the size of the PSDU in bytes
Definition at line 256 of file wifi-psdu.h.
Referenced by WifiPsdu(), GetSize(), and Print().