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

WifiMpdu stores a (const) packet along with a MAC header. More...

#include "wifi-mpdu.h"

+ Inheritance diagram for ns3::WifiMpdu:
+ Collaboration diagram for ns3::WifiMpdu:

Classes

struct  OriginalInfo
 Information stored by the original copy only. More...
 

Public Types

typedef std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
 DeaggregatedMsdus typedef. More...
 
typedef std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
 DeaggregatedMsdusCI typedef. More...
 
typedef std::list< WifiMacQueueElem >::iterator Iterator
 Const iterator typedef. More...
 

Public Member Functions

 WifiMpdu (Ptr< const Packet > p, const WifiMacHeader &header, Time stamp=Simulator::Now())
 Create a Wifi MAC queue item containing a packet and a Wifi MAC header. More...
 
virtual ~WifiMpdu ()
 
void Aggregate (Ptr< const WifiMpdu > msdu)
 Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). More...
 
void AssignSeqNo (uint16_t seqNo)
 Set the sequence number of this MPDU (and of the original copy, if this is an alias) to the given value. More...
 
DeaggregatedMsdusCI begin () const
 Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs. More...
 
Ptr< WifiMpduCreateAlias (uint8_t linkId) const
 Create an alias for this MPDU (which must be an original copy) for transmission on the link with the given ID. More...
 
DeaggregatedMsdusCI end () const
 Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs. More...
 
Mac48Address GetDestinationAddress () const
 Return the destination address present in the header. More...
 
Time GetExpiryTime () const
 
WifiMacHeaderGetHeader ()
 Get the header stored in this item. More...
 
const WifiMacHeaderGetHeader () const
 Get the header stored in this item. More...
 
std::set< uint8_t > GetInFlightLinkIds () const
 
Ptr< const WifiMpduGetOriginal () const
 
Ptr< const PacketGetPacket () const
 Get the packet stored in this item. More...
 
uint32_t GetPacketSize () const
 Return the size in bytes of the packet or control header or management header stored by this item. More...
 
Ptr< PacketGetProtocolDataUnit () const
 Get the MAC protocol data unit (MPDU) corresponding to this item (i.e. More...
 
AcIndex GetQueueAc () const
 Get the AC of the queue this item is stored into. More...
 
Iterator GetQueueIt (WmqIteratorTag tag) const
 
uint32_t GetSize () const
 Return the size of the packet stored by this item, including header size and trailer size. More...
 
Time GetTimestamp () const
 
bool HasSeqNoAssigned () const
 
bool IsFragment () const
 Return true if this item contains an MSDU fragment, false otherwise. More...
 
bool IsInFlight () const
 
bool IsOriginal () const
 
bool IsQueued () const
 Return true if this item is stored in some queue, false otherwise. More...
 
virtual void Print (std::ostream &os) const
 Print the item contents. More...
 
void ResetInFlight (uint8_t linkId) const
 Mark this MPDU as not being in flight on the given link. More...
 
void SetInFlight (uint8_t linkId) const
 Mark this MPDU as being in flight on the given link. More...
 
void SetQueueIt (std::optional< Iterator > queueIt, WmqIteratorTag tag)
 Set the queue iterator stored by this object. More...
 
void UnassignSeqNo ()
 Record that a sequence number is no (longer) assigned to this MPDU. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< WifiMpdu >
 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 Types

using InstanceInfo = std::variant< OriginalInfo, Ptr< WifiMpdu > >
 Information stored by the original copy and an alias, respectively. More...
 

Private Member Functions

 WifiMpdu ()=default
 Private default constructor (used to construct aliases). More...
 
void DoAggregate (Ptr< const WifiMpdu > msdu)
 Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). More...
 
OriginalInfoGetOriginalInfo ()
 
const OriginalInfoGetOriginalInfo () const
 
Iterator GetQueueIt () const
 

Private Attributes

WifiMacHeader m_header
 Information stored by both the original copy and the aliases. More...
 
InstanceInfo m_instanceInfo
 information associated with the instance type More...
 

Static Private Attributes

static constexpr std::size_t ALIAS = 1
 index of an alias in the InstanceInfo variant More...
 
static constexpr std::size_t ORIGINAL
 index of original copy in the InstanceInfo variant More...
 

Detailed Description

WifiMpdu stores a (const) packet along with a MAC header.

To support 802.11be Multi-Link Operation (MLO), a WifiMpdu variant, referred to as WifiMpdu alias, is added. A WifiMpdu alias stores its own MAC header and a pointer to the original copy of the WifiMpdu.

Definition at line 61 of file wifi-mpdu.h.

Member Typedef Documentation

◆ DeaggregatedMsdus

DeaggregatedMsdus typedef.

Definition at line 142 of file wifi-mpdu.h.

◆ DeaggregatedMsdusCI

typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> >::const_iterator ns3::WifiMpdu::DeaggregatedMsdusCI

DeaggregatedMsdusCI typedef.

Definition at line 145 of file wifi-mpdu.h.

◆ InstanceInfo

using ns3::WifiMpdu::InstanceInfo = std::variant<OriginalInfo, Ptr<WifiMpdu> >
private

Information stored by the original copy and an alias, respectively.

Definition at line 305 of file wifi-mpdu.h.

◆ Iterator

Const iterator typedef.

Definition at line 161 of file wifi-mpdu.h.

Constructor & Destructor Documentation

◆ WifiMpdu() [1/2]

ns3::WifiMpdu::WifiMpdu ( Ptr< const Packet p,
const WifiMacHeader header,
Time  stamp = Simulator::Now() 
)

Create a Wifi MAC queue item containing a packet and a Wifi MAC header.

Parameters
pthe const packet included in the created item.
headerthe Wifi MAC header included in the created item.
stampthe timestamp to associate with the MPDU

Definition at line 37 of file wifi-mpdu.cc.

References ns3::Packet::Copy(), ns3::MsduAggregator::Deaggregate(), ns3::WifiMacHeader::IsQosAmsdu(), ns3::WifiMacHeader::IsQosData(), and m_instanceInfo.

+ Here is the call graph for this function:

◆ ~WifiMpdu()

ns3::WifiMpdu::~WifiMpdu ( )
virtual

Definition at line 50 of file wifi-mpdu.cc.

References IsQueued(), m_instanceInfo, and NS_ASSERT.

+ Here is the call graph for this function:

◆ WifiMpdu() [2/2]

ns3::WifiMpdu::WifiMpdu ( )
privatedefault

Private default constructor (used to construct aliases).

Member Function Documentation

◆ Aggregate()

void ns3::WifiMpdu::Aggregate ( Ptr< const WifiMpdu msdu)

Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).

Note that the given MPDU cannot contain an A-MSDU. If the given MPDU is a null pointer, the effect of this call is to add only an A-MSDU subframe header, thus producing an A-MSDU containing a single MSDU.

Parameters
msduthe MPDU containing the MSDU to aggregate

Definition at line 175 of file wifi-mpdu.cc.

References DoAggregate(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::IsFromDs(), ns3::WifiMacHeader::IsToDs(), m_header, m_instanceInfo, NS_ABORT_MSG_IF, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr3(), and ns3::WifiMacHeader::SetQosAmsdu().

+ Here is the call graph for this function:

◆ AssignSeqNo()

void ns3::WifiMpdu::AssignSeqNo ( uint16_t  seqNo)

Set the sequence number of this MPDU (and of the original copy, if this is an alias) to the given value.

Also, record that a sequence number has been assigned to this MPDU.

Parameters
seqNothe given sequence number

Definition at line 346 of file wifi-mpdu.cc.

References GetOriginalInfo(), m_header, m_instanceInfo, ns3::WifiMpdu::OriginalInfo::m_seqNoAssigned, NS_LOG_FUNCTION, and ns3::WifiMacHeader::SetSequenceNumber().

+ Here is the call graph for this function:

◆ begin()

WifiMpdu::DeaggregatedMsdusCI ns3::WifiMpdu::begin ( ) const

Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.

Returns
a constant iterator pointing to the first MSDU in the list of aggregated MSDUs

Definition at line 372 of file wifi-mpdu.cc.

References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_msduList.

+ Here is the call graph for this function:

◆ CreateAlias()

Ptr< WifiMpdu > ns3::WifiMpdu::CreateAlias ( uint8_t  linkId) const

Create an alias for this MPDU (which must be an original copy) for transmission on the link with the given ID.

Aliases have their own copy of the MAC header and cannot be used to perform non-const operations on the frame body.

Parameters
linkIdthe ID of the given link
Returns
an alias for this MPDU

Definition at line 73 of file wifi-mpdu.cc.

References ALIAS, IsQueued(), m_header, m_instanceInfo, NS_ABORT_MSG_IF, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoAggregate()

void ns3::WifiMpdu::DoAggregate ( Ptr< const WifiMpdu msdu)
private

Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).

Note that the given MPDU cannot contain an A-MSDU.

Parameters
msduthe MPDU containing the MSDU to aggregate

Definition at line 222 of file wifi-mpdu.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::MsduAggregator::CalculatePadding(), ns3::Packet::Copy(), m_instanceInfo, NS_ASSERT, NS_LOG_FUNCTION, ns3::AmsduSubframeHeader::SetDestinationAddr(), ns3::AmsduSubframeHeader::SetLength(), and ns3::AmsduSubframeHeader::SetSourceAddr().

Referenced by Aggregate().

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

◆ end()

WifiMpdu::DeaggregatedMsdusCI ns3::WifiMpdu::end ( ) const

Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.

Returns
a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs

Definition at line 378 of file wifi-mpdu.cc.

References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_msduList.

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

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

◆ GetDestinationAddress()

Mac48Address ns3::WifiMpdu::GetDestinationAddress ( ) const

Return the destination address present in the header.

Returns
the destination address

Definition at line 142 of file wifi-mpdu.cc.

References ns3::WifiMacHeader::GetAddr1(), and m_header.

+ Here is the call graph for this function:

◆ GetExpiryTime()

Time ns3::WifiMpdu::GetExpiryTime ( ) const
Returns
the expiry time of this MPDU

Definition at line 307 of file wifi-mpdu.cc.

References GetQueueIt().

Referenced by Print().

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

◆ GetHeader() [1/2]

WifiMacHeader & ns3::WifiMpdu::GetHeader ( )

Get the header stored in this item.

Returns
the header stored in this item.

Definition at line 136 of file wifi-mpdu.cc.

References m_header.

◆ GetHeader() [2/2]

const WifiMacHeader & ns3::WifiMpdu::GetHeader ( ) const

Get the header stored in this item.

Returns
the header stored in this item.

Definition at line 130 of file wifi-mpdu.cc.

References m_header.

◆ GetInFlightLinkIds()

std::set< uint8_t > ns3::WifiMpdu::GetInFlightLinkIds ( ) const
Returns
the set of IDs of the links on which this MPDU is currently in flight

Definition at line 325 of file wifi-mpdu.cc.

References GetQueueIt(), and IsQueued().

+ Here is the call graph for this function:

◆ GetOriginal()

Ptr< const WifiMpdu > ns3::WifiMpdu::GetOriginal ( ) const
Returns
the original version of this MPDU

Definition at line 63 of file wifi-mpdu.cc.

References m_instanceInfo.

◆ GetOriginalInfo() [1/2]

WifiMpdu::OriginalInfo & ns3::WifiMpdu::GetOriginalInfo ( )
private
Returns
a reference to the information held by the original copy of the MPDU.

Definition at line 91 of file wifi-mpdu.cc.

References m_instanceInfo.

Referenced by AssignSeqNo(), begin(), end(), GetPacket(), GetQueueIt(), HasSeqNoAssigned(), IsQueued(), and UnassignSeqNo().

+ Here is the caller graph for this function:

◆ GetOriginalInfo() [2/2]

const WifiMpdu::OriginalInfo & ns3::WifiMpdu::GetOriginalInfo ( ) const
private
Returns
a const reference to the information held by the original copy of the MPDU.

Definition at line 102 of file wifi-mpdu.cc.

References m_instanceInfo.

◆ GetPacket()

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

Get the packet stored in this item.

Returns
the packet stored in this item.

Definition at line 113 of file wifi-mpdu.cc.

References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_packet.

Referenced by GetPacketSize(), GetProtocolDataUnit(), and Print().

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

◆ GetPacketSize()

uint32_t ns3::WifiMpdu::GetPacketSize ( ) const

Return the size in bytes of the packet or control header or management header stored by this item.

Returns
the size in bytes of the packet or control header or management header stored by this item

Definition at line 148 of file wifi-mpdu.cc.

References GetPacket(), and ns3::Packet::GetSize().

Referenced by GetSize(), and Print().

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

◆ GetProtocolDataUnit()

Ptr< Packet > ns3::WifiMpdu::GetProtocolDataUnit ( ) const

Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.

a copy of the packet stored in this item wrapped with MAC header and trailer)

Returns
the MAC protocol data unit corresponding to this item.

Definition at line 166 of file wifi-mpdu.cc.

References ns3::Packet::AddHeader(), ns3::AddWifiMacTrailer(), ns3::Packet::Copy(), GetPacket(), and m_header.

+ Here is the call graph for this function:

◆ GetQueueAc()

AcIndex ns3::WifiMpdu::GetQueueAc ( ) const

Get the AC of the queue this item is stored into.

Abort if this item is not stored in a queue.

Returns
the AC of the queue this item is stored into

Definition at line 301 of file wifi-mpdu.cc.

References GetQueueIt().

+ Here is the call graph for this function:

◆ GetQueueIt() [1/2]

WifiMpdu::Iterator ns3::WifiMpdu::GetQueueIt ( ) const
private
Returns
the queue iterator stored by this object

Definition at line 294 of file wifi-mpdu.cc.

References GetOriginalInfo(), IsQueued(), ns3::WifiMpdu::OriginalInfo::m_queueIt, and NS_ASSERT.

Referenced by GetExpiryTime(), GetInFlightLinkIds(), GetQueueAc(), GetQueueIt(), IsInFlight(), ResetInFlight(), and SetInFlight().

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

◆ GetQueueIt() [2/2]

WifiMpdu::Iterator ns3::WifiMpdu::GetQueueIt ( WmqIteratorTag  tag) const
Parameters
taga wifi MAC queue iterator tag (allows only WifiMacQueue to call this method)
Returns
the queue iterator stored by this object

Definition at line 288 of file wifi-mpdu.cc.

References GetQueueIt().

+ Here is the call graph for this function:

◆ GetSize()

uint32_t ns3::WifiMpdu::GetSize ( void  ) const

Return the size of the packet stored by this item, including header size and trailer size.

Returns
the size of the packet stored by this item in bytes.

Definition at line 154 of file wifi-mpdu.cc.

References GetPacketSize(), ns3::WifiMacHeader::GetSerializedSize(), m_header, and ns3::WIFI_MAC_FCS_LENGTH.

+ Here is the call graph for this function:

◆ GetTimestamp()

Time ns3::WifiMpdu::GetTimestamp ( ) const
Returns
the time this MPDU was constructed

Definition at line 119 of file wifi-mpdu.cc.

References m_instanceInfo.

◆ HasSeqNoAssigned()

bool ns3::WifiMpdu::HasSeqNoAssigned ( ) const
Returns
whether a sequence number has been assigned to this MPDU

Definition at line 360 of file wifi-mpdu.cc.

References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_seqNoAssigned.

+ Here is the call graph for this function:

◆ IsFragment()

bool ns3::WifiMpdu::IsFragment ( ) const

Return true if this item contains an MSDU fragment, false otherwise.

Returns
true if this item contains an MSDU fragment, false otherwise

Definition at line 160 of file wifi-mpdu.cc.

References ns3::WifiMacHeader::GetFragmentNumber(), ns3::WifiMacHeader::IsMoreFragments(), and m_header.

+ Here is the call graph for this function:

◆ IsInFlight()

bool ns3::WifiMpdu::IsInFlight ( ) const
Returns
true if this MPDU is in flight on any link, false otherwise

Definition at line 340 of file wifi-mpdu.cc.

References GetQueueIt(), and IsQueued().

Referenced by Print().

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

◆ IsOriginal()

bool ns3::WifiMpdu::IsOriginal ( ) const
Returns
whether this is the original version of the MPDU

Definition at line 57 of file wifi-mpdu.cc.

References m_instanceInfo.

◆ IsQueued()

bool ns3::WifiMpdu::IsQueued ( ) const

Return true if this item is stored in some queue, false otherwise.

Returns
true if this item is stored in some queue, false otherwise

Definition at line 272 of file wifi-mpdu.cc.

References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_queueIt.

Referenced by ~WifiMpdu(), CreateAlias(), GetInFlightLinkIds(), GetQueueIt(), IsInFlight(), and Print().

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

◆ Print()

void ns3::WifiMpdu::Print ( std::ostream &  os) const
virtual

◆ ResetInFlight()

void ns3::WifiMpdu::ResetInFlight ( uint8_t  linkId) const

Mark this MPDU as not being in flight on the given link.

Parameters
linkIdthe ID of the given link

Definition at line 319 of file wifi-mpdu.cc.

References GetQueueIt().

+ Here is the call graph for this function:

◆ SetInFlight()

void ns3::WifiMpdu::SetInFlight ( uint8_t  linkId) const

Mark this MPDU as being in flight on the given link.

Parameters
linkIdthe ID of the given link

Definition at line 313 of file wifi-mpdu.cc.

References GetQueueIt().

+ Here is the call graph for this function:

◆ SetQueueIt()

void ns3::WifiMpdu::SetQueueIt ( std::optional< Iterator queueIt,
WmqIteratorTag  tag 
)

Set the queue iterator stored by this object.

Parameters
queueItthe queue iterator for this object
taga wifi MAC queue iterator tag (allows only WifiMacQueue to call this method)

Definition at line 278 of file wifi-mpdu.cc.

References m_instanceInfo, and NS_ABORT_MSG_IF.

◆ UnassignSeqNo()

void ns3::WifiMpdu::UnassignSeqNo ( )

Record that a sequence number is no (longer) assigned to this MPDU.

Definition at line 366 of file wifi-mpdu.cc.

References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_seqNoAssigned.

+ Here is the call graph for this function:

Member Data Documentation

◆ ALIAS

constexpr std::size_t ns3::WifiMpdu::ALIAS = 1
staticconstexprprivate

index of an alias in the InstanceInfo variant

Definition at line 310 of file wifi-mpdu.h.

Referenced by CreateAlias().

◆ m_header

WifiMacHeader ns3::WifiMpdu::m_header
private

Information stored by both the original copy and the aliases.

Wifi MAC header associated with the packet

Definition at line 281 of file wifi-mpdu.h.

Referenced by Aggregate(), AssignSeqNo(), CreateAlias(), GetDestinationAddress(), GetHeader(), GetProtocolDataUnit(), GetSize(), IsFragment(), and Print().

◆ m_instanceInfo

InstanceInfo ns3::WifiMpdu::m_instanceInfo
private

information associated with the instance type

Definition at line 307 of file wifi-mpdu.h.

Referenced by WifiMpdu(), ~WifiMpdu(), Aggregate(), AssignSeqNo(), CreateAlias(), DoAggregate(), GetOriginal(), GetOriginalInfo(), GetTimestamp(), IsOriginal(), and SetQueueIt().

◆ ORIGINAL

constexpr std::size_t ns3::WifiMpdu::ORIGINAL
staticconstexprprivate
Initial value:
=
0

index of original copy in the InstanceInfo variant

Definition at line 308 of file wifi-mpdu.h.


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