23 #include "ns3/simulator.h"
24 #include "ns3/packet.h"
25 #include "ns3/uinteger.h"
48 .AddConstructor<WifiMacQueue> ()
49 .AddAttribute (
"MaxPacketNumber",
"If a packet arrives when there are already this number of packets, it is dropped.",
52 MakeUintegerChecker<uint32_t> ())
53 .AddAttribute (
"MaxDelay",
"If a packet stays longer than this delay in the queue, it is dropped.",
172 if (it->hdr.IsQosData ())
175 && it->hdr.GetQosTid () == tid)
199 if (it->hdr.IsQosData ())
202 && it->hdr.GetQosTid () == tid)
205 *timestamp=it->tstamp;
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.
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 Packet > packet
Actual packet.
void Flush(void)
Flush the queue.
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.
AddressType
Address types.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
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.
Time Seconds(double value)
Construct a Time in the indicated unit.
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)
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.