24 #include "ns3/simulator.h"
25 #include "ns3/uinteger.h"
27 #include "ns3/assert.h"
97 .SetGroupName (
"Wifi")
99 .AddAttribute (
"MaxDelay",
"If a packet stays longer than this delay in the queue, it is dropped.",
103 .AddAttribute (
"DropPolicy",
"Upon enqueue with full queue, drop oldest (DropOldest) or newest (DropNewest) packet",
145 NS_LOG_DEBUG (
"Removing packet that stayed in the queue for too long (" <<
178 return DoEnqueue (Tail (), item);
205 return DoEnqueue (Head (), item);
213 for (
auto it = Head (); it != Tail (); )
217 return DoDequeue (it);
230 for (
auto it = Head (); it != Tail (); )
234 if ((*it)->GetHeader ().IsQosData () && (*it)->GetAddress (type) == dest &&
235 (*it)->GetHeader ().GetQosTid () == tid)
237 return DoDequeue (it);
252 for (
auto it = Head (); it != Tail (); )
256 if (!(*it)->GetHeader ().IsQosData ()
257 || !blockedPackets->IsBlocked ((*it)->GetHeader ().GetAddr1 (), (*it)->GetHeader ().GetQosTid ()))
259 return DoDequeue (it);
274 for (
auto it = Head (); it != Tail (); it++)
293 for (
auto it = Head (); it != Tail (); )
297 if ((*it)->GetHeader ().IsQosData () && (*it)->GetAddress (type) == dest &&
298 (*it)->GetHeader ().GetQosTid () == tid)
315 for (
auto it = Head (); it != Tail (); )
319 if (!(*it)->GetHeader ().IsQosData ()
320 || !blockedPackets->IsBlocked ((*it)->GetHeader ().GetAddr1 (), (*it)->GetHeader ().GetQosTid ()))
337 for (
auto it = Head (); it != Tail (); )
341 return DoRemove (it);
353 for (
auto it = Head (); it != Tail (); )
357 if ((*it)->GetPacket () == packet)
366 NS_LOG_DEBUG (
"Packet " << packet <<
" not found in the queue");
376 uint32_t nPackets = 0;
378 for (
auto it = Head (); it != Tail (); )
382 if ((*it)->GetHeader ().IsQosData () && (*it)->GetAddress (type) == addr &&
383 (*it)->GetHeader ().GetQosTid () == tid)
400 for (
auto it = Head (); it != Tail (); )
418 for (
auto it = Head (); it != Tail (); )
434 for (
auto it = Head (); it != Tail (); )
Time m_maxDelay
Time to live for packets in the queue.
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Simulation virtual time values and global simulation resolution.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Control the scheduling of simulation events.
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.
Mac48Address GetAddress(enum WifiMacHeader::AddressType type) const
Return the requested address present in the header.
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 GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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.
Time GetTimeStamp(void) const
Get the timestamp included in this item.
Ptr< WifiMacQueueItem > Dequeue(void)
Dequeue the packet in the front of the queue.
Use number of packets for maximum queue size.
Template class for packet Queues.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Ptr< const Packet > m_packet
The packet contained in this queue item.
uint32_t GetNBytes(void) const
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
Hold variables of type enum.
Time m_tstamp
timestamp when the packet arrived at the queue
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.
WifiMacQueueItem()
Default constructor.
static TypeId GetTypeId(void)
Get the type ID.
WifiMacHeader m_header
Wifi MAC header associated with the packet.
Ptr< WifiMacQueueItem > DequeueFirstAvailable(const Ptr< QosBlockedDestinations > blockedPackets)
Return first available packet for transmission.
DropPolicy m_dropPolicy
Drop behavior of queue.
virtual ~WifiMacQueueItem()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
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...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
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
#define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type, param)
Explicitly instantiate a template class and register the resulting instance with the TypeId system...
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Time GetMaxDelay(void) const
Return the maximum delay before the packet is discarded.
uint32_t GetSize(void) const
Return the size of the packet included in this item.
uint32_t GetNPackets(void)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.