24 #include "ns3/simulator.h" 39 .SetGroupName (
"Wifi")
41 .AddAttribute (
"MaxDelay",
"If a packet stays longer than this delay in the queue, it is dropped.",
45 .AddAttribute (
"DropPolicy",
"Upon enqueue with full queue, drop oldest (DropOldest) or newest (DropNewest) packet",
84 NS_LOG_DEBUG (
"Removing packet that stayed in the queue for too long (" <<
98 "WifiMacQueues must be in packet mode");
117 return DoEnqueue (Tail (), item);
125 "WifiMacQueues must be in packet mode");
144 return DoEnqueue (Head (), item);
151 for (
auto it = Head (); it != Tail (); )
155 return DoDequeue (it);
167 for (
auto it = Head (); it != Tail (); )
171 if ((*it)->GetHeader ().IsData () && (*it)->GetDestinationAddress () == dest)
173 return DoDequeue (it);
187 for (
auto it = Head (); it != Tail (); )
191 if ((*it)->GetHeader ().IsQosData () && (*it)->GetDestinationAddress () == dest
192 && (*it)->GetHeader ().GetQosTid () == tid)
194 return DoDequeue (it);
208 for (
auto it = Head (); it != Tail (); )
212 if (!(*it)->GetHeader ().IsQosData ()
213 || !blockedPackets->IsBlocked ((*it)->GetHeader ().GetAddr1 (), (*it)->GetHeader ().GetQosTid ()))
215 return DoDequeue (it);
229 for (
auto it = Head (); it != Tail (); it++)
246 for (
auto it = Head (); it != Tail (); )
250 if ((*it)->GetHeader ().IsQosData () && (*it)->GetDestinationAddress () == dest
251 && (*it)->GetHeader ().GetQosTid () == tid)
267 for (
auto it = Head (); it != Tail (); )
271 if (!(*it)->GetHeader ().IsQosData ()
272 || !blockedPackets->IsBlocked ((*it)->GetHeader ().GetAddr1 (), (*it)->GetHeader ().GetQosTid ()))
289 for (
auto it = Head (); it != Tail (); )
293 return DoRemove (it);
304 for (
auto it = Head (); it != Tail (); )
308 if ((*it)->GetPacket () == packet)
317 NS_LOG_DEBUG (
"Packet " << packet <<
" not found in the queue");
326 uint32_t nPackets = 0;
328 for (
auto it = Head (); it != Tail (); )
332 if ((*it)->GetHeader ().IsData () && (*it)->GetDestinationAddress () == dest)
348 uint32_t nPackets = 0;
349 for (
auto it = Head (); it != Tail (); )
353 if ((*it)->GetHeader ().IsQosData () && (*it)->GetDestinationAddress () == dest
354 && (*it)->GetHeader ().GetQosTid () == tid)
370 for (
auto it = Head (); it != Tail (); )
387 for (
auto it = Head (); it != Tail (); )
402 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.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
Ptr< const WifiMacQueueItem > PeekByTidAndAddress(uint8_t tid, Mac48Address dest)
Search and return, if present in the queue, the first packet having the address indicated by type equ...
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.
Introspection did not find any typical Config paths.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
uint32_t GetNPacketsByTidAndAddress(uint8_t tid, Mac48Address dest)
Return the number of QoS packets having tid equal to tid and destination address equal to dest...
Ptr< WifiMacQueueItem > Dequeue(void)
Dequeue the packet in the front of the queue.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
uint32_t GetNBytes(void) const
Hold variables of type enum.
AttributeValue implementation for Time.
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
Ptr< WifiMacQueueItem > DequeueByAddress(Mac48Address dest)
Search and return, if present in the queue, the first packet having the address indicated by type equ...
Use number of packets for queue size.
Ptr< const WifiMacQueueItem > Peek(void) const
Peek the packet in the front of the queue.
static TypeId GetTypeId(void)
Get the type ID.
Time GetMaxDelay(void) const
Return the maximum delay before the packet is discarded.
Ptr< WifiMacQueueItem > DequeueFirstAvailable(const Ptr< QosBlockedDestinations > blockedPackets)
Return first available packet for transmission.
DropPolicy m_dropPolicy
Drop behavior of queue.
uint32_t GetNPacketsByAddress(Mac48Address dest)
Return the number of packets having destination address specified by dest.
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.
#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...
Ptr< WifiMacQueueItem > DequeueByTidAndAddress(uint8_t tid, Mac48Address dest)
Search and return, if present in the queue, the first packet having the address indicated by type equ...
uint32_t GetNPackets(void)
uint32_t GetNPackets(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.