24 #include "ns3/simulator.h"
25 #include "ns3/uinteger.h"
27 #include "ns3/assert.h"
42 .SetGroupName (
"Wifi")
44 .AddAttribute (
"MaxDelay",
"If a packet stays longer than this delay in the queue, it is dropped.",
48 .AddAttribute (
"DropPolicy",
"Upon enqueue with full queue, drop oldest (DropOldest) or newest (DropNewest) packet",
90 NS_LOG_DEBUG (
"Removing packet that stayed in the queue for too long (" <<
123 return DoEnqueue (Tail (), item);
150 return DoEnqueue (Head (), item);
158 for (
auto it = Head (); it != Tail (); )
162 return DoDequeue (it);
175 for (
auto it = Head (); it != Tail (); )
179 if ((*it)->GetHeader ().IsQosData () && (*it)->GetAddress (type) == dest
180 && (*it)->GetHeader ().GetQosTid () == tid)
182 return DoDequeue (it);
197 for (
auto it = Head (); it != Tail (); )
201 if (!(*it)->GetHeader ().IsQosData ()
202 || !blockedPackets->IsBlocked ((*it)->GetHeader ().GetAddr1 (), (*it)->GetHeader ().GetQosTid ()))
204 return DoDequeue (it);
219 for (
auto it = Head (); it != Tail (); it++)
238 for (
auto it = Head (); it != Tail (); )
242 if ((*it)->GetHeader ().IsQosData () && (*it)->GetAddress (type) == dest
243 && (*it)->GetHeader ().GetQosTid () == tid)
260 for (
auto it = Head (); it != Tail (); )
264 if (!(*it)->GetHeader ().IsQosData ()
265 || !blockedPackets->IsBlocked ((*it)->GetHeader ().GetAddr1 (), (*it)->GetHeader ().GetQosTid ()))
282 for (
auto it = Head (); it != Tail (); )
286 return DoRemove (it);
298 for (
auto it = Head (); it != Tail (); )
302 if ((*it)->GetPacket () == packet)
311 NS_LOG_DEBUG (
"Packet " << packet <<
" not found in the queue");
321 uint32_t nPackets = 0;
323 for (
auto it = Head (); it != Tail (); )
327 if ((*it)->GetHeader ().IsQosData () && (*it)->GetAddress (type) == addr
328 && (*it)->GetHeader ().GetQosTid () == tid)
345 for (
auto it = Head (); it != Tail (); )
363 for (
auto it = Head (); it != Tail (); )
379 for (
auto it = Head (); it != Tail (); )
Time m_maxDelay
Time to live for packets in the queue.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
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 WifiMacQueueItem > PeekFirstAvailable(const Ptr< QosBlockedDestinations > blockedPackets)
Return first available packet for transmission.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint32_t GetNPacketsByTidAndAddress(uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
Return the number of QoS packets having tid equal to tid and address specified by type equal to addr...
Introspection did not find any typical Config paths.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Ptr< WifiMacQueueItem > Dequeue(void)
Dequeue the packet in the front of the queue.
Use number of packets for maximum queue size.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
uint32_t GetNBytes(void) const
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
Hold variables of type enum.
AddressType
Address types.
AttributeValue implementation for Time.
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Ptr< WifiMacQueueItem > DequeueByTidAndAddress(uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
Search and return, if present in the queue, the first packet having the address indicated by type equ...
Ptr< const WifiMacQueueItem > Peek(void) const
Peek the packet in the front of the queue.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< WifiMacQueueItem > DequeueFirstAvailable(const Ptr< QosBlockedDestinations > blockedPackets)
Return first available packet for transmission.
DropPolicy m_dropPolicy
Drop behavior of queue.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
bool Enqueue(Ptr< WifiMacQueueItem > item)
Enqueue the given Wifi MAC queue item at the end of the queue.
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
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.
Ptr< WifiMacQueueItem > Remove(void)
Remove the packet in the front of the queue.
bool PushFront(Ptr< WifiMacQueueItem > item)
Enqueue the given Wifi MAC queue item at the front of the queue.
Ptr< const WifiMacQueueItem > PeekByTidAndAddress(uint8_t tid, WifiMacHeader::AddressType type, Mac48Address addr)
Search and return, if present in the queue, the first packet having the address indicated by type equ...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
bool TtlExceeded(ConstIterator &it)
Remove the item pointed to by the iterator it if it has been in the queue for too long...
uint32_t GetNPackets(void) const
Time GetMaxDelay(void) const
Return the maximum delay before the packet is discarded.
uint32_t GetNPackets(void)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.