This queue implements the timeout procedure described in IEEE Std. More...
#include <wifi-mac-queue.h>
Classes | |
struct | Item |
A struct that holds information about a packet for putting in a packet queue. More... | |
Public Member Functions | |
WifiMacQueue () | |
~WifiMacQueue () | |
Ptr< const Packet > | Dequeue (WifiMacHeader *hdr) |
Dequeue the packet in the front of the queue. More... | |
Ptr< const Packet > | 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. More... | |
Ptr< const Packet > | DequeueFirstAvailable (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 Packet > | Peek (WifiMacHeader *hdr) |
Peek the packet in the front of the queue. More... | |
Ptr< const Packet > | PeekByTidAndAddress (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 Packet > | PeekFirstAvailable (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 () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. 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... | |
SimpleRefCount & | operator= (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 |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
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 Item > | PacketQueue |
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) | |
virtual void | DoDispose (void) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
Protected Attributes | |
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... | |
This queue implements the timeout procedure described in IEEE Std.
802.11-2007, section 9.9.1.6, paragraph 6.
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.
ns3::WifiMacQueue is accessible through the following paths with Config::Set and Config::Connect:
No TraceSources are defined for this type.
Definition at line 50 of file wifi-mac-queue.h.
|
protected |
typedef for packet (struct Item) queue.
Definition at line 214 of file wifi-mac-queue.h.
|
protected |
typedef for packet (struct Item) queue iterator.
Definition at line 227 of file wifi-mac-queue.h.
|
protected |
typedef for packet (struct Item) queue reverse iterator.
Definition at line 223 of file wifi-mac-queue.h.
ns3::WifiMacQueue::WifiMacQueue | ( | ) |
Definition at line 62 of file wifi-mac-queue.cc.
ns3::WifiMacQueue::~WifiMacQueue | ( | ) |
Definition at line 67 of file wifi-mac-queue.cc.
References Flush().
|
protectedvirtual |
Clean up the queue by removing packets that exceeded the maximum delay.
Definition at line 110 of file wifi-mac-queue.cc.
References m_maxDelay, m_queue, m_size, and ns3::Simulator::Now().
Referenced by Dequeue(), DequeueByTidAndAddress(), DequeueFirstAvailable(), Enqueue(), GetNPacketsByTidAndAddress(), IsEmpty(), Peek(), PeekByTidAndAddress(), PeekFirstAvailable(), and PushFront().
Ptr< const Packet > ns3::WifiMacQueue::Dequeue | ( | WifiMacHeader * | hdr | ) |
Dequeue the packet in the front of the queue.
hdr | the WifiMacHeader of the packet |
Definition at line 135 of file wifi-mac-queue.cc.
References Cleanup(), ns3::WifiMacQueue::Item::hdr, m_queue, m_size, and ns3::WifiMacQueue::Item::packet.
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).
hdr | the header of the dequeued packet |
tid | the given TID |
type | the given address type |
addr | the given destination |
Definition at line 163 of file wifi-mac-queue.cc.
References Cleanup(), GetAddressForPacket(), m_queue, and m_size.
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.
hdr | the header of the dequeued packet |
tStamp | |
blockedPackets |
Definition at line 305 of file wifi-mac-queue.cc.
References Cleanup(), ns3::QosBlockedDestinations::IsBlocked(), m_queue, and m_size.
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.
packet | the packet to be euqueued at the end |
hdr | the header of the given packet |
Definition at line 97 of file wifi-mac-queue.cc.
References Cleanup(), m_maxSize, m_queue, m_size, and ns3::Simulator::Now().
void ns3::WifiMacQueue::Flush | ( | void | ) |
Flush the queue.
Definition at line 228 of file wifi-mac-queue.cc.
References m_queue, and m_size.
Referenced by ~WifiMacQueue().
|
protected |
Return the appropriate address for the given packet (given by PacketQueue iterator).
type | |
it |
Definition at line 235 of file wifi-mac-queue.cc.
References ns3::WifiMacHeader::ADDR1, ns3::WifiMacHeader::ADDR2, and ns3::WifiMacHeader::ADDR3.
Referenced by DequeueByTidAndAddress(), GetNPacketsByTidAndAddress(), and PeekByTidAndAddress().
Time ns3::WifiMacQueue::GetMaxDelay | ( | void | ) | const |
Return the maximum delay before the packet is discarded.
Definition at line 91 of file wifi-mac-queue.cc.
References m_maxDelay.
uint32_t ns3::WifiMacQueue::GetMaxSize | ( | void | ) | const |
Return the maximum queue size.
Definition at line 85 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.
tid | the given TID |
type | the given address type |
addr | the given destination |
Definition at line 282 of file wifi-mac-queue.cc.
References Cleanup(), GetAddressForPacket(), and m_queue.
uint32_t ns3::WifiMacQueue::GetSize | ( | void | ) |
Return the current queue size.
Definition at line 222 of file wifi-mac-queue.cc.
References m_size.
|
static |
Definition at line 45 of file wifi-mac-queue.cc.
References m_maxDelay, m_maxSize, ns3::MakeTimeChecker(), and ns3::TypeId::SetParent().
bool ns3::WifiMacQueue::IsEmpty | ( | void | ) |
Return if the queue is empty.
Definition at line 215 of file wifi-mac-queue.cc.
References Cleanup(), and m_queue.
Ptr< const Packet > ns3::WifiMacQueue::Peek | ( | WifiMacHeader * | hdr | ) |
Peek the packet in the front of the queue.
The packet is not removed.
hdr | the WifiMacHeader of the packet |
Definition at line 150 of file wifi-mac-queue.cc.
References Cleanup(), ns3::WifiMacQueue::Item::hdr, m_queue, and ns3::WifiMacQueue::Item::packet.
Ptr< const Packet > ns3::WifiMacQueue::PeekByTidAndAddress | ( | 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 doesn't remove the packet from this queue. Is typically used by ns3::EdcaTxopN in order to perform correct MSDU aggregation (A-MSDU).
hdr | the header of the dequeued packet |
tid | the given TID |
type | the given address type |
addr | the given destination |
Definition at line 191 of file wifi-mac-queue.cc.
References Cleanup(), GetAddressForPacket(), and m_queue.
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.
hdr | the header of the dequeued packet |
tStamp | |
blockedPackets |
Definition at line 327 of file wifi-mac-queue.cc.
References Cleanup(), ns3::QosBlockedDestinations::IsBlocked(), and m_queue.
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.
packet | the packet to be euqueued at the end |
hdr | the header of the given packet |
Definition at line 269 of file wifi-mac-queue.cc.
References Cleanup(), m_maxSize, m_queue, m_size, and ns3::Simulator::Now().
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)).
packet | the packet to be removed |
Definition at line 253 of file wifi-mac-queue.cc.
void ns3::WifiMacQueue::SetMaxDelay | ( | Time | delay | ) |
Set the maximum delay before the packet is discarded.
delay | the maximum delay |
Definition at line 79 of file wifi-mac-queue.cc.
References m_maxDelay.
void ns3::WifiMacQueue::SetMaxSize | ( | uint32_t | maxSize | ) |
Set the maximum queue size.
maxSize | the maximum queue size |
Definition at line 73 of file wifi-mac-queue.cc.
References m_maxSize.
|
protected |
Time to live for packets in the queue.
Definition at line 261 of file wifi-mac-queue.h.
Referenced by Cleanup(), GetMaxDelay(), GetTypeId(), and SetMaxDelay().
|
protected |
Queue capacity.
Definition at line 260 of file wifi-mac-queue.h.
Referenced by Enqueue(), GetMaxSize(), GetTypeId(), PushFront(), and SetMaxSize().
|
protected |
Definition at line 258 of file wifi-mac-queue.h.
Referenced by Cleanup(), Dequeue(), DequeueByTidAndAddress(), DequeueFirstAvailable(), Enqueue(), Flush(), GetNPacketsByTidAndAddress(), IsEmpty(), Peek(), PeekByTidAndAddress(), PeekFirstAvailable(), PushFront(), and Remove().
|
protected |
Current queue size.
Definition at line 259 of file wifi-mac-queue.h.
Referenced by Cleanup(), Dequeue(), DequeueByTidAndAddress(), DequeueFirstAvailable(), Enqueue(), Flush(), GetSize(), PushFront(), and Remove().