A Discrete-Event Network Simulator
API
ns3::WifiPsdu Class Reference

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"

+ Inheritance diagram for ns3::WifiPsdu:
+ Collaboration diagram for ns3::WifiPsdu:

Public Member Functions

 WifiPsdu (Ptr< const Packet > p, const WifiMacHeader &header)
 Create a PSDU storing an MPDU. More...
 
 WifiPsdu (Ptr< const WifiMpdu > mpdu, bool isSingle)
 Create a PSDU storing an MPDU or S-MPDU. More...
 
 WifiPsdu (Ptr< WifiMpdu > mpdu, bool isSingle)
 Create a PSDU storing an MPDU or S-MPDU. More...
 
 WifiPsdu (std::vector< Ptr< WifiMpdu >> mpduList)
 Create a PSDU storing an S-MPDU or A-MPDU. More...
 
virtual ~WifiPsdu ()
 
std::vector< Ptr< WifiMpdu > >::iterator begin ()
 Return an iterator to the first MPDU. More...
 
std::vector< Ptr< WifiMpdu > >::const_iterator begin () const
 Return a const iterator to the first MPDU. More...
 
std::vector< Ptr< WifiMpdu > >::iterator end ()
 Return an iterator to past-the-last MPDU. More...
 
std::vector< Ptr< WifiMpdu > >::const_iterator end () 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 () const
 Get the Receiver Address (RA), which is common to all the MPDUs. More...
 
Mac48Address GetAddr2 () const
 Get the Transmitter Address (TA), which is common to all the MPDUs. More...
 
Ptr< PacketGetAmpduSubframe (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 () const
 Get the duration from the Duration/ID field, which is common to all the MPDUs. More...
 
WifiMacHeaderGetHeader (std::size_t i)
 Get the header of the i-th MPDU. More...
 
const WifiMacHeaderGetHeader (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 () const
 Return the number of MPDUs constituting the PSDU. More...
 
Ptr< const PacketGetPacket () const
 Get the PSDU as a single packet. More...
 
Ptr< const PacketGetPayload (std::size_t i) const
 Get the payload of the i-th MPDU. More...
 
uint32_t GetSize () const
 Return the size of the PSDU in bytes. More...
 
std::set< uint8_t > GetTids () const
 Get the set of TIDs of the QoS Data frames included in the PSDU. More...
 
bool HasNav () const
 
bool IsAggregate () const
 Return true if the PSDU is an S-MPDU or A-MPDU. More...
 
bool IsSingle () 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 () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 

Private Attributes

bool m_isSingle
 true for an S-MPDU More...
 
std::vector< Ptr< WifiMpdu > > m_mpduList
 list of constituent MPDUs More...
 
uint32_t m_size
 the size of the PSDU in bytes More...
 

Detailed Description

WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each constituent MPDU.

Definition at line 42 of file wifi-psdu.h.

Constructor & Destructor Documentation

◆ WifiPsdu() [1/4]

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.

Parameters
pthe payload of the MPDU.
headerthe Wifi MAC header of the MPDU.

Definition at line 35 of file wifi-psdu.cc.

References ns3::WifiMacHeader::GetSerializedSize(), ns3::Packet::GetSize(), m_mpduList, m_size, and ns3::WIFI_MAC_FCS_LENGTH.

+ Here is the call graph for this function:

◆ WifiPsdu() [2/4]

ns3::WifiPsdu::WifiPsdu ( Ptr< WifiMpdu 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.

Parameters
mpduthe MPDU.
isSingletrue for an S-MPDU

Definition at line 42 of file wifi-psdu.cc.

References m_mpduList, and m_size.

◆ WifiPsdu() [3/4]

ns3::WifiPsdu::WifiPsdu ( Ptr< const WifiMpdu 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.

Parameters
mpduthe MPDU.
isSingletrue for an S-MPDU

◆ WifiPsdu() [4/4]

ns3::WifiPsdu::WifiPsdu ( std::vector< Ptr< WifiMpdu >>  mpduList)

Create a PSDU storing an S-MPDU or A-MPDU.

Parameters
mpduListthe list of constituent MPDUs.

Definition at line 59 of file wifi-psdu.cc.

References ns3::MpduAggregator::GetSizeIfAggregated(), m_mpduList, m_size, and NS_ABORT_MSG_IF.

+ Here is the call graph for this function:

◆ ~WifiPsdu()

ns3::WifiPsdu::~WifiPsdu ( )
virtual

Definition at line 72 of file wifi-psdu.cc.

Member Function Documentation

◆ begin() [1/2]

std::vector< Ptr< WifiMpdu > >::iterator ns3::WifiPsdu::begin ( )

Return an iterator to the first MPDU.

Returns
an iterator to the first MPDU.

Definition at line 339 of file wifi-psdu.cc.

References m_mpduList.

◆ begin() [2/2]

◆ end() [1/2]

std::vector< Ptr< WifiMpdu > >::iterator ns3::WifiPsdu::end ( )

Return an iterator to past-the-last MPDU.

Returns
an iterator to past-the-last MPDU.

Definition at line 351 of file wifi-psdu.cc.

References m_mpduList.

Referenced by grid.TimelinesRenderer::draw_events(), and grid.TimelinesRenderer::draw_ranges().

+ Here is the caller graph for this function:

◆ end() [2/2]

std::vector< Ptr< WifiMpdu > >::const_iterator ns3::WifiPsdu::end ( ) const

Return a const iterator to past-the-last MPDU.

Returns
a const iterator to past-the-last MPDU.

Definition at line 345 of file wifi-psdu.cc.

References m_mpduList.

Referenced by grid.TimelinesRenderer::draw_events(), grid.TimelinesRenderer::draw_ranges(), ns3::HeFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::ReleaseSequenceNumbers(), TestAmpduReception::RxFailure(), TestAmpduReception::RxSuccess(), and ns3::PhyEntity::ScheduleEndOfMpdus().

+ Here is the caller graph for this function:

◆ GetAckPolicyForTid()

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.

Parameters
tidthe given TID
Returns
the QoS Ack Policy common to all QoS Data frames having the given TID.

Definition at line 192 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().

+ Here is the caller graph for this function:

◆ GetAddr1()

◆ GetAddr2()

◆ GetAmpduSubframe()

Ptr< Packet > ns3::WifiPsdu::GetAmpduSubframe ( std::size_t  i) const

Get a copy of the i-th A-MPDU subframe (includes subframe header, MPDU, and possibly padding)

Parameters
ithe index in the list of A-MPDU subframes
Returns
the i-th A-MPDU subframe.

Definition at line 297 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAmpduSubframeSize()

std::size_t ns3::WifiPsdu::GetAmpduSubframeSize ( std::size_t  i) const

Return the size of the i-th A-MPDU subframe.

Parameters
ithe index in the list of A-MPDU subframes
Returns
the size of the i-th A-MPDU subframe.

Definition at line 314 of file wifi-psdu.cc.

References ns3::MpduAggregator::CalculatePadding(), m_mpduList, and NS_ASSERT.

Referenced by GetAmpduSubframe(), and ns3::PhyEntity::ScheduleEndOfMpdus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDuration()

Time ns3::WifiPsdu::GetDuration ( ) const

Get the duration from the Duration/ID field, which is common to all the MPDUs.

Returns
the duration from the Duration/ID field.

Definition at line 153 of file wifi-psdu.cc.

References m_mpduList, and NS_ABORT_MSG.

Referenced by ns3::HeFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::EndReceiveAmpdu(), ns3::EhtFrameExchangeManager::ForwardPsduDown(), ns3::EhtFrameExchangeManager::PostProcessFrame(), ns3::FrameExchangeManager::UpdateNav(), and ns3::HeFrameExchangeManager::UpdateNav().

+ Here is the caller graph for this function:

◆ GetHeader() [1/2]

WifiMacHeader & ns3::WifiPsdu::GetHeader ( std::size_t  i)

Get the header of the i-th MPDU.

Parameters
iindex in the list of MPDUs
Returns
the header of the i-th MPDU.

Definition at line 285 of file wifi-psdu.cc.

References m_mpduList.

◆ GetHeader() [2/2]

◆ GetMaxDistFromStartingSeq()

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.

Parameters
startingSeqthe given starting sequence number.
Returns
the maximum distance between the sequence numbers included in the PSDU and the given starting sequence number

Definition at line 239 of file wifi-psdu.cc.

References m_mpduList, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::QosUtilsIsOldPacket(), and ns3::SEQNO_SPACE_SIZE.

+ Here is the call graph for this function:

◆ GetNMpdus()

◆ GetPacket()

Ptr< const Packet > ns3::WifiPsdu::GetPacket ( ) const

Get the PSDU as a single packet.

Returns
the PSDU.

Definition at line 89 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::NotifyRxPsduFailed(), and ns3::WifiPhyStateHelper::NotifyRxPsduSucceeded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPayload()

Ptr< const Packet > ns3::WifiPsdu::GetPayload ( std::size_t  i) const

Get the payload of the i-th MPDU.

Parameters
iindex in the list of MPDUs
Returns
the payload of the i-th MPDU.

Definition at line 291 of file wifi-psdu.cc.

References m_mpduList.

Referenced by ns3::EhtFrameExchangeManager::GetEmlsrSwitchToListening(), ns3::HtFrameExchangeManager::MissedBlockAck(), ns3::HeFrameExchangeManager::PostProcessFrame(), ns3::HtFrameExchangeManager::SendBlockAck(), and ns3::HeFrameExchangeManager::SendMultiStaBlockAck().

+ Here is the caller graph for this function:

◆ GetSize()

◆ GetTids()

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.

Returns
the set of TIDs of the QoS Data frames included in the PSDU.

Definition at line 178 of file wifi-psdu.cc.

References m_mpduList.

Referenced by ns3::HeFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::EndReceiveAmpdu(), ns3::HtFrameExchangeManager::MissedBlockAck(), ns3::HtFrameExchangeManager::ReleaseSequenceNumbers(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::HeFrameExchangeManager::SendPsduMap(), and ns3::WifiAckManager::SetQosAckPolicy().

+ Here is the caller graph for this function:

◆ HasNav()

bool ns3::WifiPsdu::HasNav ( ) const
Returns
true if the Duration/ID field contains a value for setting the NAV

Definition at line 143 of file wifi-psdu.cc.

References m_mpduList.

Referenced by ns3::FrameExchangeManager::UpdateNav(), and ns3::HeFrameExchangeManager::UpdateNav().

+ Here is the caller graph for this function:

◆ IsAggregate()

bool ns3::WifiPsdu::IsAggregate ( ) const

Return true if the PSDU is an S-MPDU or A-MPDU.

Returns
true if the PSDU is an S-MPDU or A-MPDU.

Definition at line 83 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().

+ Here is the caller graph for this function:

◆ IsSingle()

bool ns3::WifiPsdu::IsSingle ( ) const

Return true if the PSDU is an S-MPDU.

Returns
true if the PSDU is an S-MPDU.

Definition at line 77 of file wifi-psdu.cc.

References m_isSingle.

Referenced by ns3::WifiPhy::NotifyMonitorSniffRx(), ns3::WifiPhy::NotifyMonitorSniffTx(), TestSimpleFrameCaptureModel::RxSuccess(), and ns3::PhyEntity::ScheduleEndOfMpdus().

+ Here is the caller graph for this function:

◆ Print()

void ns3::WifiPsdu::Print ( std::ostream &  os) const

Print the PSDU contents.

Parameters
osoutput stream in which the data should be printed.

Definition at line 357 of file wifi-psdu.cc.

References GetNMpdus(), IsAggregate(), m_isSingle, m_mpduList, and m_size.

Referenced by ns3::operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAckPolicyForTid()

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.

Parameters
tidthe given TID
policythe given QoS Ack policy

Definition at line 226 of file wifi-psdu.cc.

References m_mpduList, and NS_LOG_FUNCTION.

Referenced by ns3::WifiAckManager::SetQosAckPolicy().

+ Here is the caller graph for this function:

◆ SetDuration()

void ns3::WifiPsdu::SetDuration ( Time  duration)

Set the Duration/ID field on all the MPDUs.

Parameters
durationthe value for the Duration/ID field.

Definition at line 168 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().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_isSingle

bool ns3::WifiPsdu::m_isSingle
private

true for an S-MPDU

Definition at line 254 of file wifi-psdu.h.

Referenced by GetAmpduSubframe(), GetPacket(), IsAggregate(), IsSingle(), and Print().

◆ m_mpduList

◆ m_size

uint32_t ns3::WifiPsdu::m_size
private

the size of the PSDU in bytes

Definition at line 256 of file wifi-psdu.h.

Referenced by WifiPsdu(), GetSize(), and Print().


The documentation for this class was generated from the following files: