A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::WifiMacQueue Class Reference

This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" paragraph 6; IEEE 802.11-2012). More...

#include "wifi-mac-queue.h"

+ Inheritance diagram for ns3::WifiMacQueue:
+ Collaboration diagram for ns3::WifiMacQueue:

Public Member Functions

 WifiMacQueue (AcIndex ac=AC_UNDEF)
 Constructor.
 
 ~WifiMacQueue () override
 
Ptr< WifiMpduDequeue () override
 Dequeue the packet in the front of the queue.
 
void DequeueIfQueued (const std::list< Ptr< const WifiMpdu > > &mpdus)
 Dequeue the given MPDUs if they are stored in this queue.
 
bool Enqueue (Ptr< WifiMpdu > item) override
 Enqueue the given Wifi MAC queue item at the end of the queue.
 
void ExtractAllExpiredMpdus () const
 Move MPDUs with expired lifetime from all the container queues to the container queue storing MPDUs with expired lifetime.
 
void ExtractExpiredMpdus (const WifiContainerQueueId &queueId) const
 Move MPDUs with expired lifetime from the container queue identified by the given queue ID to the container queue storing MPDUs with expired lifetime.
 
AcIndex GetAc () const
 Get the Access Category of the packets stored in this queue.
 
Ptr< WifiMpduGetAlias (Ptr< const WifiMpdu > mpdu, uint8_t linkId)
 
Time GetMaxDelay () const
 Return the maximum delay before the packet is discarded.
 
uint32_t GetNBytes (const WifiContainerQueueId &queueId) const
 Get the amount of bytes currently stored in the container queue identified by the given queue ID.
 
uint32_t GetNPackets (const WifiContainerQueueId &queueId) const
 Get the number of MPDUs currently stored in the container queue identified by the given queue ID.
 
Ptr< WifiMpduGetOriginal (Ptr< WifiMpdu > mpdu)
 Unlike the GetOriginal() method of WifiMpdu, this method returns a non-const pointer to the original copy of the given MPDU.
 
Ptr< const WifiMpduPeek () const override
 Peek the packet in the front of the queue.
 
Ptr< WifiMpduPeek (uint8_t linkId) const
 Peek the packet in the front of the queue for transmission on the given link.
 
Ptr< WifiMpduPeekByQueueId (const WifiContainerQueueId &queueId, Ptr< const WifiMpdu > item=nullptr) const
 Search and return the first packet present in the container queue identified by the given queue ID.
 
Ptr< WifiMpduPeekByTidAndAddress (uint8_t tid, Mac48Address dest, Ptr< const WifiMpdu > item=nullptr) const
 Search and return, if present in the queue, the first packet having the receiver address equal to dest, and TID equal to tid.
 
Ptr< WifiMpduPeekFirstAvailable (uint8_t linkId, Ptr< const WifiMpdu > item=nullptr) const
 Return first available packet for transmission on the given link.
 
Ptr< WifiMpduRemove () override
 Remove the packet in the front of the queue.
 
Ptr< WifiMpduRemove (Ptr< const WifiMpdu > item)
 Remove the given item from the queue and return the item following the removed one, if any, or a null pointer otherwise.
 
void Replace (Ptr< const WifiMpdu > currentItem, Ptr< WifiMpdu > newItem)
 Replace the given current item with the given new item.
 
void SetMaxDelay (Time delay)
 Set the maximum delay before the packet is discarded.
 
void SetScheduler (Ptr< WifiMacQueueScheduler > scheduler)
 Set the wifi MAC queue scheduler.
 
bool TtlExceeded (Ptr< const WifiMpdu > item, const Time &now)
 Remove the given item if it has been in the queue for too long.
 
void WipeAllExpiredMpdus ()
 Remove all MPDUs with expired lifetime from this WifiMacQueue object.
 
- Public Member Functions inherited from ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >
 Queue ()
 
 ~Queue () override
 
virtual Ptr< WifiMpduDequeue ()=0
 Remove an item from the Queue (each subclass defines the position), counting it and tracing it as dequeued.
 
virtual bool Enqueue (Ptr< WifiMpdu > item)=0
 Place an item into the Queue (each subclass defines the position)
 
void Flush ()
 Flush the queue by calling Remove() on each item enqueued.
 
virtual Ptr< const WifiMpduPeek () const=0
 Get a copy of an item in the queue (each subclass defines the position) without removing it.
 
virtual Ptr< WifiMpduRemove ()=0
 Remove an item from the Queue (each subclass defines the position), counting it and tracing it as both dequeued and dropped.
 
- Public Member Functions inherited from ns3::QueueBase
 QueueBase ()
 
 ~QueueBase () override
 
QueueSize GetCurrentSize () const
 
QueueSize GetMaxSize () const
 
uint32_t GetNBytes () const
 
uint32_t GetNPackets () const
 
uint32_t GetTotalDroppedBytes () const
 
uint32_t GetTotalDroppedBytesAfterDequeue () const
 
uint32_t GetTotalDroppedBytesBeforeEnqueue () const
 
uint32_t GetTotalDroppedPackets () const
 
uint32_t GetTotalDroppedPacketsAfterDequeue () const
 
uint32_t GetTotalDroppedPacketsBeforeEnqueue () const
 
uint32_t GetTotalReceivedBytes () const
 
uint32_t GetTotalReceivedPackets () const
 
bool IsEmpty () const
 
void ResetStatistics ()
 Resets the counts for dropped packets, dropped bytes, received packets, and received bytes.
 
void SetMaxSize (QueueSize size)
 Set the maximum size of this queue.
 
bool WouldOverflow (uint32_t nPackets, uint32_t nBytes) const
 Check if the queue would overflow with additional bytes or packets Note: the check is performed according to the queue's operating mode (bytes or packets).
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::QueueBase
static void AppendItemTypeIfNotPresent (std::string &typeId, const std::string &itemType)
 Append the item type to the provided type ID if the latter does not end with '>'.
 
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Protected Member Functions

void DoDispose () override
 Destructor implementation.
 
- Protected Member Functions inherited from ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >
Ptr< WifiMpduDoDequeue (ConstIterator pos)
 Pull the item to dequeue from the queue.
 
void DoDispose () override
 Destructor implementation.
 
bool DoEnqueue (ConstIterator pos, Ptr< WifiMpdu > item)
 Push an item in the queue.
 
bool DoEnqueue (ConstIterator pos, Ptr< WifiMpdu > item, Iterator &ret)
 Push an item in the queue.
 
Ptr< const WifiMpduDoPeek (ConstIterator pos) const
 Peek the front item in the queue.
 
Ptr< WifiMpduDoRemove (ConstIterator pos)
 Pull the item to drop from the queue.
 
void DropAfterDequeue (Ptr< WifiMpdu > item)
 Drop a packet after dequeue.
 
void DropBeforeEnqueue (Ptr< WifiMpdu > item)
 Drop a packet before enqueue.
 
const ns3::WifiMacQueueContainerGetContainer () const
 Get a const reference to the container of queue items.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Private Member Functions

void DoDequeue (const std::list< ConstIterator > &iterators)
 Wrapper for the DoDequeue method provided by the base class that additionally resets the iterator field of the dequeued items and notifies the scheduler, if any item was dequeued.
 
bool DoEnqueue (ConstIterator pos, Ptr< WifiMpdu > item)
 Wrapper for the DoEnqueue method provided by the base class that additionally sets the iterator field of the item and updates internal statistics, if insertion succeeded.
 
Ptr< WifiMpduDoRemove (ConstIterator pos)
 Wrapper for the DoRemove method provided by the base class that additionally resets the iterator field of the item and notifies the scheduleer, if an item was dropped.
 
Iterator GetIt (Ptr< const WifiMpdu > mpdu) const
 
bool Insert (ConstIterator pos, Ptr< WifiMpdu > item)
 Enqueue the given Wifi MAC queue item before the given position.
 

Private Attributes

AcIndex m_ac
 the access category
 
Time m_maxDelay
 Time to live for packets in the queue.
 
Ptr< WifiMacQueueSchedulerm_scheduler
 the MAC queue scheduler
 
TracedCallback< Ptr< const WifiMpdu > > m_traceExpired
 Traced callback: fired when a packet is dropped due to lifetime expiration.
 
 NS_LOG_TEMPLATE_DECLARE
 redefinition of the log component
 

Additional Inherited Members

- Public Types inherited from ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >
typedef WifiMpdu ItemType
 Define ItemType as the type of the stored elements.
 
- Protected Types inherited from ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >
typedef Container::const_iterator ConstIterator
 Const iterator.
 
typedef Container::iterator Iterator
 Iterator.
 
- Protected Attributes inherited from ns3::QueueBase
QueueSize m_maxSize
 max queue size
 
TracedValue< uint32_tm_nBytes
 Number of bytes in the queue.
 
TracedValue< uint32_tm_nPackets
 Number of packets in the queue.
 
uint32_t m_nTotalDroppedBytes
 Total dropped bytes.
 
uint32_t m_nTotalDroppedBytesAfterDequeue
 Total dropped bytes after dequeue.
 
uint32_t m_nTotalDroppedBytesBeforeEnqueue
 Total dropped bytes before enqueue.
 
uint32_t m_nTotalDroppedPackets
 Total dropped packets.
 
uint32_t m_nTotalDroppedPacketsAfterDequeue
 Total dropped packets after dequeue.
 
uint32_t m_nTotalDroppedPacketsBeforeEnqueue
 Total dropped packets before enqueue.
 
uint32_t m_nTotalReceivedBytes
 Total received bytes.
 
uint32_t m_nTotalReceivedPackets
 Total received packets.
 

Detailed Description

This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" paragraph 6; IEEE 802.11-2012).

When a packet is received by the MAC, to be sent to the PHY, it is queued in the internal queue after being tagged by the current time.

When a packet is dequeued, the queue checks its timestamp to verify whether or not it should be dropped. If dot11EDCATableMSDULifetime has elapsed, it is dropped. Otherwise, it is returned to the caller.

Compiling python bindings fails if the namespace (ns3) is not specified for WifiMacQueueContainerT.

Config Paths

ns3::WifiMacQueue is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/Txop/Queue"

Attributes

  • MaxDelay: If a packet stays longer than this delay in the queue, it is dropped.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+08ns
    • Flags: constructwrite
  • MaxSize: The max queue size

TraceSources

  • Expired: MPDU dropped because its lifetime expired.
    Callback signature: ns3::WifiMpdu::TracedCallback

TraceSources defined in parent class ns3::Queue<WifiMpdu,WifiMacQueueContainer>

  • Dequeue: Dequeue a packet from the queue.
    Callback signature: ns3::WifiMpdu::TracedCallback
  • Drop: Drop a packet (for whatever reason).
    Callback signature: ns3::WifiMpdu::TracedCallback
  • DropAfterDequeue: Drop a packet after dequeue.
    Callback signature: ns3::WifiMpdu::TracedCallback
  • DropBeforeEnqueue: Drop a packet before enqueue.
    Callback signature: ns3::WifiMpdu::TracedCallback
  • Enqueue: Enqueue a packet in the queue.
    Callback signature: ns3::WifiMpdu::TracedCallback

TraceSources defined in parent class ns3::QueueBase

Size of this type is 392 bytes (on a 64-bit architecture).

Definition at line 65 of file wifi-mac-queue.h.

Constructor & Destructor Documentation

◆ WifiMacQueue()

ns3::WifiMacQueue::WifiMacQueue ( AcIndex  ac = AC_UNDEF)

Constructor.

Parameters
acthe Access Category of the packets stored in this queue

Definition at line 65 of file wifi-mac-queue.cc.

◆ ~WifiMacQueue()

ns3::WifiMacQueue::~WifiMacQueue ( )
override

Definition at line 71 of file wifi-mac-queue.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

◆ Dequeue()

Ptr< WifiMpdu > ns3::WifiMacQueue::Dequeue ( )
overridevirtual

Dequeue the packet in the front of the queue.

Returns
the packet

Implements ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >.

Definition at line 263 of file wifi-mac-queue.cc.

References NS_ABORT_MSG.

◆ DequeueIfQueued()

void ns3::WifiMacQueue::DequeueIfQueued ( const std::list< Ptr< const WifiMpdu > > &  mpdus)

Dequeue the given MPDUs if they are stored in this queue.

Parameters
mpdusthe given MPDUs

Definition at line 272 of file wifi-mac-queue.cc.

References DoDequeue(), GetIt(), m_ac, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoDequeue()

void ns3::WifiMacQueue::DoDequeue ( const std::list< ConstIterator > &  iterators)
private

Wrapper for the DoDequeue method provided by the base class that additionally resets the iterator field of the dequeued items and notifies the scheduler, if any item was dequeued.

Parameters
iteratorsthe list of iterators pointing to the items to dequeue

Definition at line 485 of file wifi-mac-queue.cc.

References ns3::QueueBase::GetMaxSize(), m_ac, m_scheduler, NS_LOG_FUNCTION, and ns3::QueueBase::SetMaxSize().

Referenced by DequeueIfQueued(), and Replace().

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

◆ DoDispose()

void ns3::WifiMacQueue::DoDispose ( )
overrideprotectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 77 of file wifi-mac-queue.cc.

References ns3::Queue< Item, Container >::DoDispose(), m_scheduler, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoEnqueue()

bool ns3::WifiMacQueue::DoEnqueue ( ConstIterator  pos,
Ptr< WifiMpdu item 
)
private

Wrapper for the DoEnqueue method provided by the base class that additionally sets the iterator field of the item and updates internal statistics, if insertion succeeded.

Parameters
posthe position before where the item will be inserted
itemthe item to enqueue
Returns
true if success, false if the packet has been dropped.

Definition at line 436 of file wifi-mac-queue.cc.

References DoRemove(), ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), GetIt(), ns3::QueueBase::GetMaxSize(), ns3::WifiMacQueueContainer::GetQueueId(), m_ac, m_maxDelay, m_scheduler, ns3::Time::Max(), ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::QueueBase::SetMaxSize().

Referenced by Insert().

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

◆ DoRemove()

Ptr< WifiMpdu > ns3::WifiMacQueue::DoRemove ( ConstIterator  pos)
private

Wrapper for the DoRemove method provided by the base class that additionally resets the iterator field of the item and notifies the scheduleer, if an item was dropped.

Parameters
posthe position of the item to drop
Returns
the dropped item.

Definition at line 512 of file wifi-mac-queue.cc.

References ns3::Queue< Item, Container >::DoRemove(), ns3::QueueBase::GetMaxSize(), m_ac, m_scheduler, NS_LOG_FUNCTION, and ns3::QueueBase::SetMaxSize().

Referenced by DoEnqueue(), Remove(), and TtlExceeded().

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

◆ Enqueue()

bool ns3::WifiMacQueue::Enqueue ( Ptr< WifiMpdu item)
overridevirtual

Enqueue the given Wifi MAC queue item at the end of the queue.

Parameters
itemthe Wifi MAC queue item to be enqueued at the end
Returns
true if success, false if the packet has been dropped

Implements ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >.

Definition at line 221 of file wifi-mac-queue.cc.

References ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), ns3::WifiMacQueueContainer::GetQueueId(), Insert(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ ExtractAllExpiredMpdus()

void ns3::WifiMacQueue::ExtractAllExpiredMpdus ( ) const

Move MPDUs with expired lifetime from all the container queues to the container queue storing MPDUs with expired lifetime.

Each MPDU that is found to have an expired lifetime feeds the "Expired" trace source and is notified to the scheduler.

Note
that such MPDUs are not removed from the WifiMacQueue (and hence are still accounted for in the overall statistics kept by the Queue base class) in order to make this method const.

Definition at line 143 of file wifi-mac-queue.cc.

References ns3::WifiMacQueueContainer::ExtractAllExpiredMpdus(), ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), m_ac, m_scheduler, m_traceExpired, NS_LOG_FUNCTION, and ns3::Simulator::ScheduleNow().

Referenced by WipeAllExpiredMpdus().

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

◆ ExtractExpiredMpdus()

void ns3::WifiMacQueue::ExtractExpiredMpdus ( const WifiContainerQueueId queueId) const

Move MPDUs with expired lifetime from the container queue identified by the given queue ID to the container queue storing MPDUs with expired lifetime.

Each MPDU that is found to have an expired lifetime feeds the "Expired" trace source and is notified to the scheduler.

Note
that such MPDUs are not removed from the WifiMacQueue (and hence are still accounted for in the overall statistics kept by the Queue base class) in order to make this method const.
Parameters
queueIdthe given queue ID

Definition at line 119 of file wifi-mac-queue.cc.

References ns3::WifiMacQueueContainer::ExtractExpiredMpdus(), ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), m_ac, m_scheduler, m_traceExpired, NS_LOG_FUNCTION, and ns3::Simulator::ScheduleNow().

Referenced by PeekByQueueId().

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

◆ GetAc()

AcIndex ns3::WifiMacQueue::GetAc ( ) const

Get the Access Category of the packets stored in this queue.

Returns
the Access Category of the packets stored in this queue

Definition at line 85 of file wifi-mac-queue.cc.

References m_ac.

◆ GetAlias()

Ptr< WifiMpdu > ns3::WifiMacQueue::GetAlias ( Ptr< const WifiMpdu mpdu,
uint8_t  linkId 
)
Parameters
mpduthe given MPDU
linkIdthe ID of the given link
Returns
the alias of the given MPDU that is inflight on the given link, if any, or a null pointer, otherwise

Definition at line 104 of file wifi-mac-queue.cc.

References GetIt().

+ Here is the call graph for this function:

◆ GetIt()

WifiMacQueue::Iterator ns3::WifiMacQueue::GetIt ( Ptr< const WifiMpdu mpdu) const
private
Parameters
mpduthe given MPDU
Returns
the queue iterator stored by the given MPDU

Definition at line 91 of file wifi-mac-queue.cc.

References NS_ASSERT.

Referenced by DequeueIfQueued(), DoEnqueue(), GetAlias(), GetOriginal(), PeekByQueueId(), Remove(), Replace(), and TtlExceeded().

+ Here is the caller graph for this function:

◆ GetMaxDelay()

Time ns3::WifiMacQueue::GetMaxDelay ( ) const

Return the maximum delay before the packet is discarded.

Returns
the maximum delay

Definition at line 215 of file wifi-mac-queue.cc.

References m_maxDelay.

◆ GetNBytes()

uint32_t ns3::WifiMacQueue::GetNBytes ( const WifiContainerQueueId queueId) const

Get the amount of bytes currently stored in the container queue identified by the given queue ID.

Parameters
queueIdthe given queue ID
Returns
the amount of bytes currently stored in the container queue

Definition at line 430 of file wifi-mac-queue.cc.

References ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), and ns3::WifiMacQueueContainer::GetNBytes().

+ Here is the call graph for this function:

◆ GetNPackets()

uint32_t ns3::WifiMacQueue::GetNPackets ( const WifiContainerQueueId queueId) const

Get the number of MPDUs currently stored in the container queue identified by the given queue ID.

Parameters
queueIdthe given queue ID
Returns
the number of MPDUs currently stored in the container queue

Definition at line 424 of file wifi-mac-queue.cc.

References ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), and ns3::WifiMacQueueContainer::GetQueue().

+ Here is the call graph for this function:

◆ GetOriginal()

Ptr< WifiMpdu > ns3::WifiMacQueue::GetOriginal ( Ptr< WifiMpdu mpdu)

Unlike the GetOriginal() method of WifiMpdu, this method returns a non-const pointer to the original copy of the given MPDU.

Parameters
mpduthe given MPDU
Returns
the original copy of the given MPDU

Definition at line 98 of file wifi-mac-queue.cc.

References GetIt().

+ Here is the call graph for this function:

◆ GetTypeId()

TypeId ns3::WifiMacQueue::GetTypeId ( )
static

◆ Insert()

bool ns3::WifiMacQueue::Insert ( ConstIterator  pos,
Ptr< WifiMpdu item 
)
private

Enqueue the given Wifi MAC queue item before the given position.

Parameters
posthe position before which the item is to be inserted
itemthe Wifi MAC queue item to be enqueued
Returns
true if success, false if the packet has been dropped

Definition at line 230 of file wifi-mac-queue.cc.

References DoEnqueue(), ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), ns3::QueueBase::GetMaxSize(), ns3::QueueBase::GetNPackets(), ns3::WifiMacQueueContainer::GetQueue(), ns3::WifiMacQueueContainer::GetQueueId(), ns3::Simulator::Now(), NS_ABORT_MSG_IF, NS_ASSERT_MSG, NS_LOG_FUNCTION, ns3::PACKETS, and WipeAllExpiredMpdus().

Referenced by Enqueue(), and Replace().

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

◆ Peek() [1/2]

Ptr< const WifiMpdu > ns3::WifiMacQueue::Peek ( ) const
overridevirtual

Peek the packet in the front of the queue.

The packet is not removed.

Returns
the packet

Implements ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >.

Definition at line 293 of file wifi-mac-queue.cc.

References NS_ABORT_MSG.

Referenced by Remove().

+ Here is the caller graph for this function:

◆ Peek() [2/2]

Ptr< WifiMpdu > ns3::WifiMacQueue::Peek ( uint8_t  linkId) const

Peek the packet in the front of the queue for transmission on the given link.

The packet is not removed.

Parameters
linkIdthe ID of the link onto which we can transmit a packet
Returns
the packet

Definition at line 301 of file wifi-mac-queue.cc.

References ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), ns3::WifiMacQueueContainer::GetQueue(), m_ac, m_scheduler, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ PeekByQueueId()

Ptr< WifiMpdu > ns3::WifiMacQueue::PeekByQueueId ( const WifiContainerQueueId queueId,
Ptr< const WifiMpdu item = nullptr 
) const

Search and return the first packet present in the container queue identified by the given queue ID.

If item is a null pointer, the search starts from the head of the container queue; MPDUs with expired lifetime at the head of the container queue are ignored (and moved to the container queue storing MPDUs with expired lifetime). If item is not a null pointer, the search starts from the packet following item in the container queue (and we do not check for expired lifetime because we assume that a previous call was made with a null pointer as argument, which removed the MPDUs with expired lifetime).

Parameters
queueIdthe given queue ID
itemthe item after which the search starts from
Returns
the peeked packet or nullptr if no packet was found

Definition at line 326 of file wifi-mac-queue.cc.

References ExtractExpiredMpdus(), ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), GetIt(), ns3::WifiMacQueueContainer::GetQueue(), ns3::WifiMacQueueContainer::GetQueueId(), NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by PeekByTidAndAddress(), and PeekFirstAvailable().

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

◆ PeekByTidAndAddress()

Ptr< WifiMpdu > ns3::WifiMacQueue::PeekByTidAndAddress ( uint8_t  tid,
Mac48Address  dest,
Ptr< const WifiMpdu item = nullptr 
) const

Search and return, if present in the queue, the first packet having the receiver address equal to dest, and TID equal to tid.

If item is not a null pointer, the search starts from the packet following item in the queue; otherwise, the search starts from the head of the queue. This method does not remove the packet from the queue. It is typically used by ns3::QosTxop in order to perform correct MSDU aggregation (A-MSDU).

Parameters
tidthe given TID
destthe given destination
itemthe item after which the search starts from
Returns
the peeked packet or nullptr if no packet was found

Definition at line 317 of file wifi-mac-queue.cc.

References ns3::Mac48Address::IsGroup(), NS_ABORT_IF, NS_LOG_FUNCTION, PeekByQueueId(), ns3::WIFI_QOSDATA_QUEUE, and ns3::WIFI_UNICAST.

+ Here is the call graph for this function:

◆ PeekFirstAvailable()

Ptr< WifiMpdu > ns3::WifiMacQueue::PeekFirstAvailable ( uint8_t  linkId,
Ptr< const WifiMpdu item = nullptr 
) const

Return first available packet for transmission on the given link.

If item is not a null pointer, the search starts from the packet following item in the queue; otherwise, the search starts from the head of the queue. The packet is not removed from queue.

Parameters
linkIdthe ID of the given link
itemthe item after which the search starts from
Returns
the peeked packet or nullptr if no packet was found

Definition at line 349 of file wifi-mac-queue.cc.

References ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), ns3::WifiMacQueueContainer::GetQueue(), ns3::WifiMacQueueContainer::GetQueueId(), m_ac, m_scheduler, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and PeekByQueueId().

+ Here is the call graph for this function:

◆ Remove() [1/2]

Ptr< WifiMpdu > ns3::WifiMacQueue::Remove ( )
overridevirtual

Remove the packet in the front of the queue.

Returns
the packet

Implements ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >.

Definition at line 386 of file wifi-mac-queue.cc.

References Peek(), and Remove().

Referenced by Remove().

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

◆ Remove() [2/2]

Ptr< WifiMpdu > ns3::WifiMacQueue::Remove ( Ptr< const WifiMpdu item)

Remove the given item from the queue and return the item following the removed one, if any, or a null pointer otherwise.

If removeExpired is true, all the items in the queue from the head to the given position are removed if their lifetime expired.

Parameters
itemthe item to be removed
Returns
the removed item

Definition at line 392 of file wifi-mac-queue.cc.

References DoRemove(), GetIt(), m_ac, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ Replace()

void ns3::WifiMacQueue::Replace ( Ptr< const WifiMpdu currentItem,
Ptr< WifiMpdu newItem 
)

Replace the given current item with the given new item.

Actually, the current item is dequeued and the new item is enqueued in its place. In this way, statistics about queue size (in terms of bytes) are correctly updated.

Parameters
currentItemthe given current item
newItemthe given new item

Definition at line 404 of file wifi-mac-queue.cc.

References DoDequeue(), GetIt(), Insert(), m_ac, NS_ABORT_IF, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SetMaxDelay()

void ns3::WifiMacQueue::SetMaxDelay ( Time  delay)

Set the maximum delay before the packet is discarded.

Parameters
delaythe maximum delay

Definition at line 208 of file wifi-mac-queue.cc.

References m_maxDelay, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetScheduler()

void ns3::WifiMacQueue::SetScheduler ( Ptr< WifiMacQueueScheduler scheduler)

Set the wifi MAC queue scheduler.

Parameters
schedulerthe wifi MAC queue scheduler

Definition at line 201 of file wifi-mac-queue.cc.

References m_scheduler, and NS_LOG_FUNCTION.

◆ TtlExceeded()

bool ns3::WifiMacQueue::TtlExceeded ( Ptr< const WifiMpdu item,
const Time now 
)

Remove the given item if it has been in the queue for too long.

Return true if the item is removed, false otherwise.

Parameters
itemthe item whose lifetime is checked
nowa copy of Simulator::Now()
Returns
true if the item is removed, false otherwise

Definition at line 186 of file wifi-mac-queue.cc.

References DoRemove(), GetIt(), m_maxDelay, m_traceExpired, NS_ASSERT, and NS_LOG_DEBUG.

+ Here is the call graph for this function:

◆ WipeAllExpiredMpdus()

void ns3::WifiMacQueue::WipeAllExpiredMpdus ( )

Remove all MPDUs with expired lifetime from this WifiMacQueue object.

Definition at line 167 of file wifi-mac-queue.cc.

References ns3::Queue< Item, Container >::DoRemove(), ExtractAllExpiredMpdus(), ns3::WifiMacQueueContainer::GetAllExpiredMpdus(), ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::GetContainer(), and NS_LOG_FUNCTION.

Referenced by Insert().

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

Member Data Documentation

◆ m_ac

AcIndex ns3::WifiMacQueue::m_ac
private

◆ m_maxDelay

Time ns3::WifiMacQueue::m_maxDelay
private

Time to live for packets in the queue.

Definition at line 344 of file wifi-mac-queue.h.

Referenced by DoEnqueue(), GetMaxDelay(), SetMaxDelay(), and TtlExceeded().

◆ m_scheduler

Ptr<WifiMacQueueScheduler> ns3::WifiMacQueue::m_scheduler
private

◆ m_traceExpired

TracedCallback<Ptr<const WifiMpdu> > ns3::WifiMacQueue::m_traceExpired
private

Traced callback: fired when a packet is dropped due to lifetime expiration.

Definition at line 349 of file wifi-mac-queue.h.

Referenced by ExtractAllExpiredMpdus(), ExtractExpiredMpdus(), GetTypeId(), and TtlExceeded().

◆ NS_LOG_TEMPLATE_DECLARE

ns3::WifiMacQueue::NS_LOG_TEMPLATE_DECLARE
private

redefinition of the log component

Definition at line 351 of file wifi-mac-queue.h.


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