23 #include "ns3/simulator.h"
24 #include "ns3/packet.h"
25 #include "ns3/uinteger.h"
49 .AddConstructor<WifiMacQueue> ()
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.",
173 if (it->hdr.IsQosData ())
176 && it->hdr.GetQosTid () == tid)
200 if (it->hdr.IsQosData ())
203 && it->hdr.GetQosTid () == tid)
239 return it->hdr.GetAddr1 ();
243 return it->hdr.GetAddr2 ();
247 return it->hdr.GetAddr3 ();
256 for (; it !=
m_queue.end (); it++)
258 if (it->packet == packet)
286 uint32_t nPackets = 0;
294 if (it->hdr.IsQosData () && it->hdr.GetQosTid () == tid)
312 if (!it->hdr.IsQosData ()
313 || !blockedPackets->
IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
316 timestamp = it->tstamp;
333 if (!it->hdr.IsQosData ()
334 || !blockedPackets->
IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
337 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.
keep track of time values and allow control of global simulation resolution
void SetMaxDelay(Time delay)
Set the maximum delay before the packet is discarded.
Ptr< const Packet > packet
Actual packet.
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
void Flush(void)
Flush the queue.
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 equal...
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...
hold objects of type ns3::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.
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Enqueue the given packet and its corresponding WifiMacHeader at the front of the queue.
static Time Now(void)
Return the "current simulation time".
Mac48Address GetAddressForPacket(enum WifiMacHeader::AddressType type, PacketQueueI it)
Return the appropriate address for the given packet (given by PacketQueue iterator).
Ptr< const Packet > PeekFirstAvailable(WifiMacHeader *hdr, Time &tStamp, const QosBlockedDestinations *blockedPackets)
Returns first available packet for transmission.
void Enqueue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Enqueue the given packet and its corresponding WifiMacHeader at the end of the queue.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
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.