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:

Classes

struct  Item
 A struct that holds information about a packet for putting in a packet queue. More...
 

Public Types

enum  DropPolicy { DROP_NEWEST, DROP_OLDEST }
 

Public Member Functions

 WifiMacQueue ()
 
 ~WifiMacQueue ()
 
Ptr< const PacketDequeue (WifiMacHeader *hdr)
 Dequeue the packet in the front of the queue. More...
 
Ptr< const PacketDequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
 Searchs and returns, if is present in this queue, first packet having address indicated by type equals to addr, and tid equals to tid. More...
 
Ptr< const PacketDequeueFirstAvailable (WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets)
 Returns first available packet for transmission. More...
 
void Enqueue (Ptr< const Packet > packet, const WifiMacHeader &hdr)
 Enqueue the given packet and its corresponding WifiMacHeader at the end of the queue. More...
 
void Flush (void)
 Flush the queue. More...
 
Time GetMaxDelay (void) const
 Return the maximum delay before the packet is discarded. More...
 
uint32_t GetMaxSize (void) const
 Return the maximum queue size. More...
 
uint32_t GetNPacketsByTidAndAddress (uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
 Returns number of QoS packets having tid equals to tid and address specified by type equals to addr. More...
 
uint32_t GetSize (void)
 Return the current queue size. More...
 
bool IsEmpty (void)
 Return if the queue is empty. More...
 
Ptr< const PacketPeek (WifiMacHeader *hdr)
 Peek the packet in the front of the queue. More...
 
Ptr< const PacketPeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr, Time *timestamp)
 Searchs and returns, if is present in this queue, first packet having address indicated by type equals to addr, and tid equals to tid. More...
 
Ptr< const PacketPeekFirstAvailable (WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets)
 Returns first available packet for transmission. More...
 
void PushFront (Ptr< const Packet > packet, const WifiMacHeader &hdr)
 Enqueue the given packet and its corresponding WifiMacHeader at 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...
 
void SetMaxSize (uint32_t maxSize)
 Set the maximum queue size. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Implement the GetInstanceTypeId method defined in ObjectBase. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Types

typedef std::list< struct ItemPacketQueue
 typedef for packet (struct Item) queue. More...
 
typedef std::list< struct Item >::iterator PacketQueueI
 typedef for packet (struct Item) queue iterator. More...
 
typedef std::list< struct Item >::reverse_iterator PacketQueueRI
 typedef for packet (struct Item) queue reverse iterator. More...
 

Protected Member Functions

virtual void Cleanup (void)
 Clean up the queue by removing packets that exceeded the maximum delay. More...
 
Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it)
 Return the appropriate address for the given packet (given by PacketQueue iterator). More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Protected Attributes

enum DropPolicy m_dropPolicy
 Drop behavior of queue. More...
 
Time m_maxDelay
 Time to live for packets in the queue. More...
 
uint32_t m_maxSize
 Queue capacity. More...
 
PacketQueue m_queue
 Packet (struct Item) queue. More...
 
uint32_t m_size
 Current queue size. More...
 

Additional Inherited Members

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"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/VO_EdcaTxopN/Queue"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/VI_EdcaTxopN/Queue"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/BE_EdcaTxopN/Queue"
  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/BK_EdcaTxopN/Queue"

Attributes

  • MaxPacketNumber: If a packet arrives when there are already this number of packets, it is dropped.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 400
    • Flags: construct write read
  • 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

No TraceSources are defined for this type.
Size of this type is 72 bytes (on a 64-bit architecture).

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

Member Typedef Documentation

typedef std::list<struct Item> ns3::WifiMacQueue::PacketQueue
protected

typedef for packet (struct Item) queue.

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

typedef std::list<struct Item>::iterator ns3::WifiMacQueue::PacketQueueI
protected

typedef for packet (struct Item) queue iterator.

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

typedef std::list<struct Item>::reverse_iterator ns3::WifiMacQueue::PacketQueueRI
protected

typedef for packet (struct Item) queue reverse iterator.

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

Constructor & Destructor Documentation

ns3::WifiMacQueue::WifiMacQueue ( )

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

ns3::WifiMacQueue::~WifiMacQueue ( )

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

References Flush().

+ Here is the call graph for this function:

Member Function Documentation

void ns3::WifiMacQueue::Cleanup ( void  )
protectedvirtual

Clean up the queue by removing packets that exceeded the maximum delay.

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

References m_maxDelay, m_queue, m_size, and ns3::Simulator::Now().

Referenced by Dequeue(), DequeueByTidAndAddress(), DequeueFirstAvailable(), Enqueue(), GetNPacketsByTidAndAddress(), GetSize(), IsEmpty(), Peek(), PeekByTidAndAddress(), PeekFirstAvailable(), and PushFront().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< const Packet > ns3::WifiMacQueue::Dequeue ( WifiMacHeader hdr)

Dequeue the packet in the front of the queue.

Parameters
hdrthe WifiMacHeader of the packet
Returns
the packet

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

References Cleanup(), ns3::WifiMacQueue::Item::hdr, m_queue, m_size, and ns3::WifiMacQueue::Item::packet.

+ Here is the call graph for this function:

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

Searchs and returns, if is present in this queue, first packet having address indicated by type equals to addr, and tid equals to tid.

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

Parameters
hdrthe header of the dequeued packet
tidthe given TID
typethe given address type
addrthe given destination
Returns
packet

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

References Cleanup(), GetAddressForPacket(), m_queue, and m_size.

+ Here is the call graph for this function:

Ptr< const Packet > ns3::WifiMacQueue::DequeueFirstAvailable ( WifiMacHeader hdr,
Time tStamp,
const QosBlockedDestinations blockedPackets 
)

Returns first available packet for transmission.

A packet could be no available if it's 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
hdrthe header of the dequeued packet
tStamp
blockedPackets
Returns
packet

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

References Cleanup(), ns3::QosBlockedDestinations::IsBlocked(), m_queue, and m_size.

+ Here is the call graph for this function:

void ns3::WifiMacQueue::Enqueue ( Ptr< const Packet packet,
const WifiMacHeader hdr 
)

Enqueue the given packet and its corresponding WifiMacHeader at the end of the queue.

Parameters
packetthe packet to be euqueued at the end
hdrthe header of the given packet

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

References Cleanup(), DROP_NEWEST, DROP_OLDEST, m_dropPolicy, m_maxSize, m_queue, m_size, and ns3::Simulator::Now().

+ Here is the call graph for this function:

void ns3::WifiMacQueue::Flush ( void  )

Flush the queue.

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

References m_queue, and m_size.

Referenced by ~WifiMacQueue().

+ Here is the caller graph for this function:

Mac48Address ns3::WifiMacQueue::GetAddressForPacket ( enum WifiMacHeader::AddressType  type,
PacketQueueI  it 
)
protected

Return the appropriate address for the given packet (given by PacketQueue iterator).

Parameters
type
it
Returns
the address

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

References ns3::WifiMacHeader::ADDR1, ns3::WifiMacHeader::ADDR2, and ns3::WifiMacHeader::ADDR3.

Referenced by DequeueByTidAndAddress(), GetNPacketsByTidAndAddress(), and PeekByTidAndAddress().

+ Here is the caller 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 96 of file wifi-mac-queue.cc.

References m_maxDelay.

uint32_t ns3::WifiMacQueue::GetMaxSize ( void  ) const

Return the maximum queue size.

Returns
the maximum queue size

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

References m_maxSize.

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

Returns number of QoS packets having tid equals to tid and address specified by type equals to addr.

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

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

References Cleanup(), GetAddressForPacket(), and m_queue.

+ Here is the call graph for this function:

uint32_t ns3::WifiMacQueue::GetSize ( void  )

Return the current queue size.

Returns
the current queue size

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

References Cleanup(), and m_size.

+ Here is the call graph for this function:

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

Return if the queue is empty.

Returns
true if the queue is empty, false otherwise

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

References Cleanup(), and m_queue.

+ Here is the call graph for this function:

Ptr< const Packet > ns3::WifiMacQueue::Peek ( WifiMacHeader hdr)

Peek the packet in the front of the queue.

The packet is not removed.

Parameters
hdrthe WifiMacHeader of the packet
Returns
the packet

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

References Cleanup(), ns3::WifiMacQueue::Item::hdr, m_queue, and ns3::WifiMacQueue::Item::packet.

+ Here is the call graph for this function:

Ptr< const Packet > ns3::WifiMacQueue::PeekByTidAndAddress ( WifiMacHeader hdr,
uint8_t  tid,
WifiMacHeader::AddressType  type,
Mac48Address  addr,
Time timestamp 
)

Searchs and returns, if is present in this queue, first packet having address indicated by type equals to addr, and tid equals to tid.

This method doesn't remove the packet from this queue. Is typically used by ns3::EdcaTxopN in order to perform correct MSDU aggregation (A-MSDU).

Parameters
hdrthe header of the dequeued packet
tidthe given TID
typethe given address type
addrthe given destination
timestamp
Returns
packet

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

References Cleanup(), GetAddressForPacket(), and m_queue.

+ Here is the call graph for this function:

Ptr< const Packet > ns3::WifiMacQueue::PeekFirstAvailable ( WifiMacHeader hdr,
Time tStamp,
const QosBlockedDestinations blockedPackets 
)

Returns first available packet for transmission.

The packet isn't removed from queue.

Parameters
hdrthe header of the dequeued packet
tStamp
blockedPackets
Returns
packet

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

References Cleanup(), ns3::QosBlockedDestinations::IsBlocked(), and m_queue.

+ Here is the call graph for this function:

void ns3::WifiMacQueue::PushFront ( Ptr< const Packet packet,
const WifiMacHeader hdr 
)

Enqueue the given packet and its corresponding WifiMacHeader at the front of the queue.

Parameters
packetthe packet to be euqueued at the end
hdrthe header of the given packet

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

References Cleanup(), m_maxSize, m_queue, m_size, and ns3::Simulator::Now().

+ 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 268 of file wifi-mac-queue.cc.

References m_queue, and m_size.

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

Set the maximum delay before the packet is discarded.

Parameters
delaythe maximum delay

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

References m_maxDelay.

void ns3::WifiMacQueue::SetMaxSize ( uint32_t  maxSize)

Set the maximum queue size.

Parameters
maxSizethe maximum queue size

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

References m_maxSize.

Member Data Documentation

enum DropPolicy ns3::WifiMacQueue::m_dropPolicy
protected

Drop behavior of queue.

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

Referenced by Enqueue(), and GetTypeId().

Time ns3::WifiMacQueue::m_maxDelay
protected

Time to live for packets in the queue.

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

Referenced by Cleanup(), GetMaxDelay(), GetTypeId(), and SetMaxDelay().

uint32_t ns3::WifiMacQueue::m_maxSize
protected

Queue capacity.

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

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

uint32_t ns3::WifiMacQueue::m_size
protected

Current queue size.

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

Referenced by Cleanup(), Dequeue(), DequeueByTidAndAddress(), DequeueFirstAvailable(), Enqueue(), Flush(), GetSize(), PushFront(), and Remove().


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