A Discrete-Event Network Simulator
API
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 Types

enum  DropPolicy { DROP_NEWEST, DROP_OLDEST }
 drop policy More...
 

Public Member Functions

 WifiMacQueue ()
 
 ~WifiMacQueue ()
 
Ptr< WifiMacQueueItemDequeue (void)
 Dequeue the packet in the front of the queue. More...
 
Ptr< WifiMacQueueItemDequeueByTidAndAddress (uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
 Search and return, if present in the queue, the first packet having the address indicated by type equal to addr, and tid equal to tid. More...
 
Ptr< WifiMacQueueItemDequeueFirstAvailable (const Ptr< QosBlockedDestinations > blockedPackets)
 Return first available packet for transmission. More...
 
bool Enqueue (Ptr< WifiMacQueueItem > item)
 Enqueue the given Wifi MAC queue item at the end of the queue. More...
 
Time GetMaxDelay (void) const
 Return the maximum delay before the packet is discarded. More...
 
uint32_t GetNBytes (void)
 
uint32_t GetNPackets (void)
 
uint32_t GetNPacketsByTidAndAddress (uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
 Return the number of QoS packets having tid equal to tid and address specified by type equal to addr. More...
 
bool IsEmpty (void)
 
Ptr< const WifiMacQueueItemPeek (void) const
 Peek the packet in the front of the queue. More...
 
Ptr< const WifiMacQueueItemPeekByTidAndAddress (uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
 Search and return, if present in the queue, the first packet having the address indicated by type equal to addr, and tid equal to tid. More...
 
Ptr< const WifiMacQueueItemPeekFirstAvailable (const Ptr< QosBlockedDestinations > blockedPackets)
 Return first available packet for transmission. More...
 
bool PushFront (Ptr< WifiMacQueueItem > item)
 Enqueue the given Wifi MAC queue item at the front of the queue. More...
 
Ptr< WifiMacQueueItemRemove (void)
 Remove the packet in the front of the queue. More...
 
bool Remove (Ptr< const Packet > packet)
 If exists, removes packet from queue and returns true. More...
 
void SetMaxDelay (Time delay)
 Set the maximum delay before the packet is discarded. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Member Functions

bool TtlExceeded (ConstIterator &it)
 Remove the item pointed to by the iterator it if it has been in the queue for too long. More...
 

Private Attributes

DropPolicy m_dropPolicy
 Drop behavior of queue. More...
 
Time m_maxDelay
 Time to live for packets in the queue. More...
 
 NS_LOG_TEMPLATE_DECLARE
 redefinition of the log component More...
 

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.

Config Paths

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

  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/DcaTxop/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 –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +500000000.0ns
    • Flags: construct write read
  • DropPolicy: Upon enqueue with full queue, drop oldest (DropOldest) or newest (DropNewest) packet
    • Set with class: ns3::EnumValue
    • Underlying type:
    • Initial value: DropNewest
    • Flags: construct write read

Attributes defined in parent class ns3::QueueBase

  • Mode: Whether to use bytes (see MaxBytes) or packets (see MaxPackets) as the maximum queue size metric.
    • Set with class: ns3::EnumValue
    • Underlying type:
    • Initial value: QUEUE_MODE_PACKETS
    • Flags: construct write read
  • MaxPackets: The maximum number of packets accepted by this queue.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 100
    • Flags: construct write read
  • MaxBytes: The maximum number of bytes accepted by this queue.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 6553500
    • Flags: construct write read
  • MaxSize: The max queue size

No TraceSources are defined for this type.

TraceSources defined in parent class ns3::Queue<WifiMacQueueItem>

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

TraceSources defined in parent class ns3::QueueBase

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

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

Constructor & Destructor Documentation

ns3::WifiMacQueue::WifiMacQueue ( )

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

ns3::WifiMacQueue::~WifiMacQueue ( )

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

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

Ptr< WifiMacQueueItem > ns3::WifiMacQueue::Dequeue ( void  )

Dequeue the packet in the front of the queue.

Returns
the packet

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

Ptr< WifiMacQueueItem > ns3::WifiMacQueue::DequeueByTidAndAddress ( uint8_t  tid,
WifiMacHeader::AddressType  type,
Mac48Address  addr 
)

Search and return, if present in the queue, the first packet having the address indicated by type equal to addr, and tid equal to tid.

This method removes the packet from the queue. It is typically used by ns3::EdcaTxopN in order to perform correct MSDU aggregation (A-MSDU).

Parameters
tidthe given TID
typethe given address type
addrthe given destination
Returns
the packet

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

Ptr< WifiMacQueueItem > ns3::WifiMacQueue::DequeueFirstAvailable ( const Ptr< QosBlockedDestinations blockedPackets)

Return first available packet for transmission.

A packet could be no available if it is a QoS packet with a tid and an address1 fields equal to tid and addr respectively that index a pending agreement in the BlockAckManager object. So that packet must not be transmitted until reception of an ADDBA response frame from station addressed by addr. This method removes the packet from queue.

Parameters
blockedPackets
Returns
packet

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

bool ns3::WifiMacQueue::Enqueue ( Ptr< WifiMacQueueItem item)

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

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

References DROP_OLDEST, ns3::QueueBase::GetNPackets(), m_dropPolicy, NS_ASSERT_MSG(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::QueueBase::QUEUE_MODE_PACKETS, and TtlExceeded().

+ Here is the call graph for this function:

Time ns3::WifiMacQueue::GetMaxDelay ( void  ) const

Return the maximum delay before the packet is discarded.

Returns
the maximum delay

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

References m_maxDelay, and NS_LOG_FUNCTION.

uint32_t ns3::WifiMacQueue::GetNBytes ( void  )
Returns
The number of bytes currently occupied by the packets in the Queue

Overrides the GetNBytes method provided by QueueBase

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

References ns3::QueueBase::GetNBytes(), NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

uint32_t ns3::WifiMacQueue::GetNPackets ( void  )
Returns
The number of packets currently stored in the Queue

Overrides the GetNPackets method provided by QueueBase

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

References ns3::QueueBase::GetNPackets(), NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

uint32_t ns3::WifiMacQueue::GetNPacketsByTidAndAddress ( uint8_t  tid,
WifiMacHeader::AddressType  type,
Mac48Address  addr 
)

Return the number of QoS packets having tid equal to tid and address specified by type equal to addr.

Parameters
tidthe given TID
typethe given address type
addrthe given destination
Returns
the number of QoS packets

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

TypeId ns3::WifiMacQueue::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

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

References DROP_NEWEST, DROP_OLDEST, m_dropPolicy, m_maxDelay, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MilliSeconds(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

bool ns3::WifiMacQueue::IsEmpty ( void  )
Returns
true if the queue is empty; false otherwise

Overrides the IsEmpty method provided by QueueBase

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

Ptr< const WifiMacQueueItem > ns3::WifiMacQueue::Peek ( void  ) const

Peek the packet in the front of the queue.

The packet is not removed.

Returns
the packet

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

References m_maxDelay, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Ptr< const WifiMacQueueItem > ns3::WifiMacQueue::PeekByTidAndAddress ( uint8_t  tid,
WifiMacHeader::AddressType  type,
Mac48Address  addr 
)

Search and return, if present in the queue, the first packet having the address indicated by type equal to addr, and tid equal to tid.

This method does not remove the packet from the queue. It is typically used by ns3::EdcaTxopN in order to perform correct MSDU aggregation (A-MSDU).

Parameters
tidthe given TID
typethe given address type
addrthe given destination
Returns
packet

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

Ptr< const WifiMacQueueItem > ns3::WifiMacQueue::PeekFirstAvailable ( const Ptr< QosBlockedDestinations blockedPackets)

Return first available packet for transmission.

The packet is not removed from queue.

Parameters
blockedPackets
Returns
packet

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

bool ns3::WifiMacQueue::PushFront ( Ptr< WifiMacQueueItem item)

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

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

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

References DROP_OLDEST, ns3::QueueBase::GetNPackets(), m_dropPolicy, NS_ASSERT_MSG(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::QueueBase::QUEUE_MODE_PACKETS, and TtlExceeded().

+ Here is the call graph for this function:

Ptr< WifiMacQueueItem > ns3::WifiMacQueue::Remove ( void  )

Remove the packet in the front of the queue.

Returns
the packet

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

bool ns3::WifiMacQueue::Remove ( Ptr< const Packet packet)

If exists, removes packet from queue and returns true.

Otherwise it takes no effects and return false. Deletion of the packet is performed in linear time (O(n)).

Parameters
packetthe packet to be removed
Returns
true if the packet was removed, false otherwise

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and TtlExceeded().

+ Here is the call graph for this function:

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

Set the maximum delay before the packet is discarded.

Parameters
delaythe maximum delay

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

References m_maxDelay, and NS_LOG_FUNCTION.

bool ns3::WifiMacQueue::TtlExceeded ( ConstIterator &  it)
private

Remove the item pointed to by the iterator it if it has been in the queue for too long.

If the item is removed, the iterator is updated to point to the item that followed the erased one.

Parameters
itan iterator pointing to the item
Returns
true if the item is removed, false otherwise

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

References m_maxDelay, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by Dequeue(), DequeueByTidAndAddress(), DequeueFirstAvailable(), Enqueue(), GetNBytes(), GetNPackets(), GetNPacketsByTidAndAddress(), IsEmpty(), PeekByTidAndAddress(), PeekFirstAvailable(), PushFront(), and Remove().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

DropPolicy ns3::WifiMacQueue::m_dropPolicy
private

Drop behavior of queue.

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

Referenced by Enqueue(), GetTypeId(), and PushFront().

Time ns3::WifiMacQueue::m_maxDelay
private

Time to live for packets in the queue.

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

Referenced by GetMaxDelay(), GetTypeId(), Peek(), SetMaxDelay(), and TtlExceeded().

ns3::WifiMacQueue::NS_LOG_TEMPLATE_DECLARE
private

redefinition of the log component

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


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