23 #include "ns3/simulator.h"
24 #include "ns3/packet.h"
25 #include "ns3/uinteger.h"
48 .SetGroupName (
"Wifi")
50 .AddAttribute (
"MaxPacketNumber",
"If a packet arrives when there are already this number of packets, it is dropped.",
53 MakeUintegerChecker<uint32_t> ())
54 .AddAttribute (
"MaxDelay",
"If a packet stays longer than this delay in the queue, it is dropped.",
58 .AddAttribute (
"DropPolicy",
"Upon enqueue with full queue, drop oldest (DropOldest) or newest (DropNewest) packet",
186 if (it->hdr.IsQosData ())
189 && it->hdr.GetQosTid () == tid)
213 if (it->hdr.IsQosData ())
216 && it->hdr.GetQosTid () == tid)
219 *timestamp = it->tstamp;
254 return it->hdr.GetAddr1 ();
258 return it->hdr.GetAddr2 ();
262 return it->hdr.GetAddr3 ();
271 for (; it !=
m_queue.end (); it++)
273 if (it->packet == packet)
301 uint32_t nPackets = 0;
309 if (it->hdr.IsQosData () && it->hdr.GetQosTid () == tid)
327 if (!it->hdr.IsQosData ()
328 || !blockedPackets->
IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
331 timestamp = it->tstamp;
348 if (!it->hdr.IsQosData ()
349 || !blockedPackets->
IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
352 timestamp = it->tstamp;
Time m_maxDelay
Time to live for packets in the queue.
Keep track of destination address - TID pairs that are waiting for a block ACK response.
uint32_t GetSize(void)
Return the current queue size.
WifiMacHeader hdr
Wifi MAC header associated with the packet.
Simulation virtual time values and global simulation resolution.
void SetMaxDelay(Time delay)
Set the maximum delay before the packet is discarded.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Ptr< const Packet > packet
Actual packet.
void Flush(void)
Flush the queue.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
virtual void Cleanup(void)
Clean up the queue by removing packets that exceeded the maximum delay.
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...
bool Remove(Ptr< const Packet > packet)
If exists, removes packet from queue and returns true.
void SetMaxSize(uint32_t maxSize)
Set the maximum queue size.
Ptr< const Packet > DequeueFirstAvailable(WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets)
Returns first available packet for transmission.
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 equal...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Hold variables of type enum.
AttributeValue implementation for Time.
bool IsEmpty(void)
Return if the queue is empty.
Hold an unsigned integer type.
static TypeId GetTypeId(void)
uint32_t GetMaxSize(void) const
Return the maximum queue size.
Ptr< const Packet > Dequeue(WifiMacHeader *hdr)
Dequeue the packet in the front of the queue.
uint32_t m_size
Current queue size.
Ptr< const Packet > Peek(WifiMacHeader *hdr)
Peek the packet in the front of the queue.
Ptr< const Packet > 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 equal...
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Enqueue the given packet and its corresponding WifiMacHeader at the front of the queue.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static Time Now(void)
Return the current simulation virtual time.
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
Mac48Address GetAddressForPacket(enum WifiMacHeader::AddressType type, PacketQueueI it)
Return the appropriate address for the given packet (given by PacketQueue iterator).
enum DropPolicy m_dropPolicy
Drop behavior of queue.
Ptr< const Packet > PeekFirstAvailable(WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets)
Returns first available packet for transmission.
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
Make an EnumChecker pre-configured with a set of allowed values by name.
void Enqueue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Enqueue the given packet and its corresponding WifiMacHeader at the end of the queue.
Time GetMaxDelay(void) const
Return the maximum delay before the packet is discarded.
A base class which provides memory management and object aggregation.
A struct that holds information about a packet for putting in a packet queue.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
std::list< struct Item >::iterator PacketQueueI
typedef for packet (struct Item) queue iterator.
PacketQueue m_queue
Packet (struct Item) queue.
uint32_t m_maxSize
Queue capacity.
Item(Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tstamp)
Create a struct with the given parameters.
bool IsBlocked(Mac48Address dest, uint8_t tid) const
Check if the given destination address and TID are blocked from sending (e.g.