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

WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were enqueued. More...

#include "wifi-mac-queue-item.h"

+ Inheritance diagram for ns3::WifiMacQueueItem:
+ Collaboration diagram for ns3::WifiMacQueueItem:

Public Types

typedef std::list< Ptr< WifiMacQueueItem > >::const_iterator ConstIterator
 Const iterator typedef. More...
 
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...
 

Public Member Functions

 WifiMacQueueItem (Ptr< const Packet > p, const WifiMacHeader &header)
 Create a Wifi MAC queue item containing a packet and a Wifi MAC header. More...
 
 WifiMacQueueItem (Ptr< const Packet > p, const WifiMacHeader &header, Time tstamp)
 Create a Wifi MAC queue item containing a packet and a Wifi MAC header. More...
 
virtual ~WifiMacQueueItem ()
 
void Aggregate (Ptr< const WifiMacQueueItem > msdu)
 Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). More...
 
DeaggregatedMsdusCI begin (void)
 Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs. More...
 
DeaggregatedMsdusCI end (void)
 Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs. More...
 
Mac48Address GetDestinationAddress (void) const
 Return the destination address present in the header. More...
 
WifiMacHeaderGetHeader (void)
 Get the header stored in this item. More...
 
const WifiMacHeaderGetHeader (void) const
 Get the header stored in this item. More...
 
Ptr< WifiMacQueueItemGetItem (void) const
 Get a pointer to this WifiMacQueueItem object. More...
 
Ptr< const PacketGetPacket (void) const
 Get the packet stored in this item. More...
 
uint32_t GetPacketSize (void) const
 Return the size in bytes of the packet or control header or management header stored by this item. More...
 
Ptr< PacketGetProtocolDataUnit (void) const
 Get the MAC protocol data unit (MPDU) corresponding to this item (i.e. More...
 
AcIndex GetQueueAc (void) const
 Get the AC of the queue this item is stored into. More...
 
uint32_t GetSize (void) const
 Return the size of the packet stored by this item, including header size and trailer size. More...
 
Time GetTimeStamp (void) const
 Get the timestamp included in this item. More...
 
bool IsFragment (void) const
 Return true if this item contains an MSDU fragment, false otherwise. More...
 
bool IsInFlight (void) const
 Return true if this MPDU is in flight, false otherwise. More...
 
bool IsQueued (void) 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 (void)
 Mark this MPDU as not being in flight (only used if Block Ack agreement established). More...
 
void SetInFlight (void)
 Mark this MPDU as being in flight (only used if Block Ack agreement established). More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< WifiMacQueueItem >
 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...
 
SimpleRefCountoperator= ([[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 Member Functions

void DoAggregate (Ptr< const WifiMacQueueItem > msdu)
 Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). More...
 

Private Attributes

WifiMacHeader m_header
 Wifi MAC header associated with the packet. More...
 
bool m_inFlight
 whether the MPDU is in flight More...
 
DeaggregatedMsdus m_msduList
 The list of aggregated MSDUs included in this MPDU. More...
 
Ptr< const Packetm_packet
 The packet (MSDU or A-MSDU) contained in this queue item. More...
 
AcIndex m_queueAc
 AC associated with the queue this MPDU is stored into. More...
 
ConstIterator m_queueIt
 Queue iterator pointing to this MPDU, if queued. More...
 
Time m_tstamp
 timestamp when the packet arrived at the queue More...
 

Friends

class WifiMacQueue
 

Detailed Description

WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were enqueued.

Definition at line 44 of file wifi-mac-queue-item.h.

Member Typedef Documentation

◆ ConstIterator

Const iterator typedef.

Definition at line 153 of file wifi-mac-queue-item.h.

◆ DeaggregatedMsdus

DeaggregatedMsdus typedef.

Definition at line 135 of file wifi-mac-queue-item.h.

◆ DeaggregatedMsdusCI

DeaggregatedMsdusCI typedef.

Definition at line 137 of file wifi-mac-queue-item.h.

Constructor & Destructor Documentation

◆ WifiMacQueueItem() [1/2]

ns3::WifiMacQueueItem::WifiMacQueueItem ( Ptr< const Packet p,
const WifiMacHeader header 
)

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.

Definition at line 36 of file wifi-mac-queue-item.cc.

◆ WifiMacQueueItem() [2/2]

ns3::WifiMacQueueItem::WifiMacQueueItem ( Ptr< const Packet p,
const WifiMacHeader header,
Time  tstamp 
)

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.
tstampthe timestamp associated with the created item.

Definition at line 41 of file wifi-mac-queue-item.cc.

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

+ Here is the call graph for this function:

◆ ~WifiMacQueueItem()

ns3::WifiMacQueueItem::~WifiMacQueueItem ( )
virtual

Definition at line 54 of file wifi-mac-queue-item.cc.

Member Function Documentation

◆ Aggregate()

void ns3::WifiMacQueueItem::Aggregate ( Ptr< const WifiMacQueueItem 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.

Parameters
msduthe MPDU containing the MSDU to aggregate

Definition at line 123 of file wifi-mac-queue-item.cc.

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

+ Here is the call graph for this function:

◆ begin()

WifiMacQueueItem::DeaggregatedMsdusCI ns3::WifiMacQueueItem::begin ( void  )

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 243 of file wifi-mac-queue-item.cc.

References m_msduList.

◆ DoAggregate()

void ns3::WifiMacQueueItem::DoAggregate ( Ptr< const WifiMacQueueItem 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 157 of file wifi-mac-queue-item.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::MsduAggregator::CalculatePadding(), ns3::Packet::Copy(), ns3::Packet::GetSize(), m_msduList, m_packet, m_tstamp, ns3::Max(), 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()

WifiMacQueueItem::DeaggregatedMsdusCI ns3::WifiMacQueueItem::end ( void  )

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 249 of file wifi-mac-queue-item.cc.

References m_msduList.

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

+ Here is the caller graph for this function:

◆ GetDestinationAddress()

Mac48Address ns3::WifiMacQueueItem::GetDestinationAddress ( void  ) const

Return the destination address present in the header.

Returns
the destination address

Definition at line 84 of file wifi-mac-queue-item.cc.

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

+ Here is the call graph for this function:

◆ GetHeader() [1/2]

WifiMacHeader & ns3::WifiMacQueueItem::GetHeader ( void  )

Get the header stored in this item.

Returns
the header stored in this item.

Definition at line 78 of file wifi-mac-queue-item.cc.

References m_header.

◆ GetHeader() [2/2]

const WifiMacHeader & ns3::WifiMacQueueItem::GetHeader ( void  ) const

Get the header stored in this item.

Returns
the header stored in this item.

Definition at line 72 of file wifi-mac-queue-item.cc.

References m_header.

◆ GetItem()

Ptr< WifiMacQueueItem > ns3::WifiMacQueueItem::GetItem ( void  ) const

Get a pointer to this WifiMacQueueItem object.

This method is useful to convert a pointer to const WifiMacQueueItem into a pointer to non-const WifiMacQueueItem. This method can only be called if this item is stored in a wifi MAC queue.

Returns
a pointer to this WifiMacQueueItem object

Definition at line 59 of file wifi-mac-queue-item.cc.

References IsQueued(), m_queueIt, and NS_ASSERT.

+ Here is the call graph for this function:

◆ GetPacket()

Ptr< const Packet > ns3::WifiMacQueueItem::GetPacket ( void  ) const

Get the packet stored in this item.

Returns
the packet stored in this item.

Definition at line 66 of file wifi-mac-queue-item.cc.

References m_packet.

◆ GetPacketSize()

uint32_t ns3::WifiMacQueueItem::GetPacketSize ( void  ) 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 96 of file wifi-mac-queue-item.cc.

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

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::WifiMacQueueItem::GetProtocolDataUnit ( void  ) 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 114 of file wifi-mac-queue-item.cc.

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

+ Here is the call graph for this function:

◆ GetQueueAc()

AcIndex ns3::WifiMacQueueItem::GetQueueAc ( void  ) 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 218 of file wifi-mac-queue-item.cc.

References IsQueued(), m_queueAc, and NS_ASSERT.

+ Here is the call graph for this function:

◆ GetSize()

uint32_t ns3::WifiMacQueueItem::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 102 of file wifi-mac-queue-item.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::WifiMacQueueItem::GetTimeStamp ( void  ) const

Get the timestamp included in this item.

Returns
the timestamp included in this item.

Definition at line 90 of file wifi-mac-queue-item.cc.

References m_tstamp.

◆ IsFragment()

bool ns3::WifiMacQueueItem::IsFragment ( void  ) 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 108 of file wifi-mac-queue-item.cc.

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

+ Here is the call graph for this function:

◆ IsInFlight()

bool ns3::WifiMacQueueItem::IsInFlight ( void  ) const

Return true if this MPDU is in flight, false otherwise.

Returns
true if this MPDU is in flight, false otherwise

Definition at line 237 of file wifi-mac-queue-item.cc.

References m_inFlight.

Referenced by Print().

+ Here is the caller graph for this function:

◆ IsQueued()

bool ns3::WifiMacQueueItem::IsQueued ( void  ) 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 212 of file wifi-mac-queue-item.cc.

References ns3::AC_UNDEF, and m_queueAc.

Referenced by GetItem(), GetQueueAc(), and Print().

+ Here is the caller graph for this function:

◆ Print()

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

◆ ResetInFlight()

void ns3::WifiMacQueueItem::ResetInFlight ( void  )

Mark this MPDU as not being in flight (only used if Block Ack agreement established).

Definition at line 231 of file wifi-mac-queue-item.cc.

References m_inFlight.

◆ SetInFlight()

void ns3::WifiMacQueueItem::SetInFlight ( void  )

Mark this MPDU as being in flight (only used if Block Ack agreement established).

Definition at line 225 of file wifi-mac-queue-item.cc.

References m_inFlight.

Friends And Related Function Documentation

◆ WifiMacQueue

friend class WifiMacQueue
friend

Definition at line 207 of file wifi-mac-queue-item.h.

Member Data Documentation

◆ m_header

WifiMacHeader ns3::WifiMacQueueItem::m_header
private

Wifi MAC header associated with the packet.

Definition at line 210 of file wifi-mac-queue-item.h.

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

◆ m_inFlight

bool ns3::WifiMacQueueItem::m_inFlight
private

whether the MPDU is in flight

Definition at line 215 of file wifi-mac-queue-item.h.

Referenced by WifiMacQueueItem(), IsInFlight(), ResetInFlight(), and SetInFlight().

◆ m_msduList

DeaggregatedMsdus ns3::WifiMacQueueItem::m_msduList
private

The list of aggregated MSDUs included in this MPDU.

Definition at line 212 of file wifi-mac-queue-item.h.

Referenced by WifiMacQueueItem(), Aggregate(), begin(), DoAggregate(), and end().

◆ m_packet

Ptr<const Packet> ns3::WifiMacQueueItem::m_packet
private

The packet (MSDU or A-MSDU) contained in this queue item.

Definition at line 209 of file wifi-mac-queue-item.h.

Referenced by Aggregate(), DoAggregate(), GetPacket(), GetPacketSize(), GetProtocolDataUnit(), and Print().

◆ m_queueAc

AcIndex ns3::WifiMacQueueItem::m_queueAc
private

AC associated with the queue this MPDU is stored into.

Definition at line 214 of file wifi-mac-queue-item.h.

Referenced by GetQueueAc(), and IsQueued().

◆ m_queueIt

ConstIterator ns3::WifiMacQueueItem::m_queueIt
private

Queue iterator pointing to this MPDU, if queued.

Definition at line 213 of file wifi-mac-queue-item.h.

Referenced by GetItem().

◆ m_tstamp

Time ns3::WifiMacQueueItem::m_tstamp
private

timestamp when the packet arrived at the queue

Definition at line 211 of file wifi-mac-queue-item.h.

Referenced by DoAggregate(), GetTimeStamp(), and Print().


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