14#include "ns3/mac48-address.h" 
   15#include "ns3/simulator.h" 
   36                        "pos iterator does not point to the correct container queue");
 
   37    NS_ABORT_MSG_IF(!item->IsOriginal(), 
"Only the original copy of an MPDU can be inserted");
 
   40    it->second += item->GetSize();
 
   42    return m_queues[queueId].emplace(pos, item);
 
 
   56    NS_ASSERT(it->second >= pos->mpdu->GetSize());
 
   57    it->second -= pos->mpdu->GetSize();
 
 
   83        address = hdr.
IsQosAmsdu() ? mpdu->begin()->second.GetDestinationAddr() : hdr.
GetAddr1();
 
 
  115    if (
auto it = 
m_queues.find(queueId); it == 
m_queues.end() || it->second.empty())
 
 
  122std::pair<WifiMacQueueContainer::iterator, WifiMacQueueContainer::iterator>
 
  128std::pair<WifiMacQueueContainer::iterator, WifiMacQueueContainer::iterator>
 
  131    std::optional<std::pair<WifiMacQueueContainer::iterator, WifiMacQueueContainer::iterator>> ret;
 
  132    auto firstExpiredIt = queue.begin();
 
  133    auto lastExpiredIt = firstExpiredIt;
 
  139        for (firstExpiredIt = lastExpiredIt;
 
  140             firstExpiredIt != queue.end() && !firstExpiredIt->inflights.empty();
 
  141             ++firstExpiredIt, ++lastExpiredIt)
 
  148            ret = std::make_pair(firstExpiredIt, lastExpiredIt);
 
  152        while (lastExpiredIt != queue.end() && lastExpiredIt->expiryTime <= now &&
 
  153               lastExpiredIt->inflights.empty())
 
  155            lastExpiredIt->expired = 
true;
 
  158            lastExpiredIt->deleter(lastExpiredIt->mpdu);
 
  163            NS_ASSERT(it->second >= lastExpiredIt->mpdu->GetSize());
 
  164            it->second -= lastExpiredIt->mpdu->GetSize();
 
  169        if (lastExpiredIt == firstExpiredIt)
 
 
  183std::pair<WifiMacQueueContainer::iterator, WifiMacQueueContainer::iterator>
 
  186    std::optional<WifiMacQueueContainer::iterator> firstExpiredIt;
 
  192        if (firstIt != lastIt && !firstExpiredIt)
 
  195            firstExpiredIt = firstIt;
 
  198    return std::make_pair(firstExpiredIt ? *firstExpiredIt : 
m_expiredQueue.end(),
 
 
  202std::pair<WifiMacQueueContainer::iterator, WifiMacQueueContainer::iterator>
 
  217    auto [type, addrType, address, tid] = queueId;
 
  218    const std::size_t size = tid.has_value() ? 8 : 7;
 
  220    std::vector<uint8_t> buffer(size);
 
  222    address.CopyTo(&buffer[1]);
 
  228    std::string s(buffer.begin(), buffer.end());
 
  229    return std::hash<std::string>{}(s);
 
 
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
const ContainerQueue & GetQueue(const WifiContainerQueueId &queueId) const
Get a const reference to the container queue identified by the given QueueId.
void clear()
Erase all elements from the container.
static WifiContainerQueueId GetQueueId(Ptr< const WifiMpdu > mpdu)
Return the QueueId identifying the container queue in which the given MPDU is (or is to be) enqueued.
ContainerQueue::iterator iterator
iterator over elements in a container queue
std::unordered_map< WifiContainerQueueId, uint32_t > m_nBytesPerQueue
size in bytes of the container queues
uint32_t GetNBytes(const WifiContainerQueueId &queueId) const
Get the total size of the MPDUs stored in the queue identified by the given QueueId.
Ptr< WifiMpdu > GetItem(const const_iterator it) const
Return the WifiMpdu included in the element pointed to by the given iterator.
std::pair< iterator, iterator > ExtractAllExpiredMpdus() const
Transfer non-inflight MPDUs with expired lifetime in all the container queues to the container queue ...
iterator insert(const_iterator pos, Ptr< WifiMpdu > item)
Insert the given item at the specified location in the container.
std::unordered_map< WifiContainerQueueId, ContainerQueue > m_queues
the container queues
std::list< WifiMacQueueElem > ContainerQueue
Type of a queue held by the container.
iterator erase(const_iterator pos)
Erase the specified elements from the container.
std::pair< iterator, iterator > GetAllExpiredMpdus() const
Get the range [first, last) of iterators pointing to all the MPDUs queued in the container queue stor...
ContainerQueue::const_iterator const_iterator
const iterator over elements in a container queue
ContainerQueue m_expiredQueue
queue storing MPDUs with expired lifetime
std::pair< iterator, iterator > ExtractExpiredMpdus(const WifiContainerQueueId &queueId) const
Transfer non-inflight MPDUs with expired lifetime in the container queue identified by the given Queu...
std::pair< iterator, iterator > DoExtractExpiredMpdus(ContainerQueue &queue) const
Transfer non-inflight MPDUs with expired lifetime in the given container queue to the container queue...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
@ AC_UNDEF
Total number of ACs.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std:: tuple< WifiContainerQueueType, WifiReceiverAddressType, Mac48Address, std::optional< uint8_t > > WifiContainerQueueId
Tuple (queue type, receiver address type, Address, TID) identifying a container queue.
WifiReceiverAddressType
enumeration of frame directions
std::size_t operator()(ns3::WifiContainerQueueId queueId) const
The functor.