A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-mac-queue-container.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Universita' degli Studi di Napoli Federico II
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef WIFI_MAC_QUEUE_CONTAINER_H
21#define WIFI_MAC_QUEUE_CONTAINER_H
22
23#include "wifi-mac-queue-elem.h"
24
25#include "ns3/mac48-address.h"
26
27#include <list>
28#include <optional>
29#include <tuple>
30#include <unordered_map>
31
32namespace ns3
33{
34
37{
42};
43
46{
49};
50
79 tuple<WifiContainerQueueType, WifiReceiverAddressType, Mac48Address, std::optional<uint8_t>>;
80
81} // namespace ns3
82
83/****************************************************
84 * Global Functions (outside namespace ns3)
85 ***************************************************/
86
92template <>
93struct std::hash<ns3::WifiContainerQueueId>
94{
100 std::size_t operator()(ns3::WifiContainerQueueId queueId) const;
101};
102
103namespace ns3
104{
105
114{
115 public:
117 using ContainerQueue = std::list<WifiMacQueueElem>;
119 using iterator = ContainerQueue::iterator;
121 using const_iterator = ContainerQueue::const_iterator;
122
126 void clear();
127
136
144
151 Ptr<WifiMpdu> GetItem(const const_iterator it) const;
152
162
170 const ContainerQueue& GetQueue(const WifiContainerQueueId& queueId) const;
171
179 uint32_t GetNBytes(const WifiContainerQueueId& queueId) const;
180
189 std::pair<iterator, iterator> ExtractExpiredMpdus(const WifiContainerQueueId& queueId) const;
197 std::pair<iterator, iterator> ExtractAllExpiredMpdus() const;
205 std::pair<iterator, iterator> GetAllExpiredMpdus() const;
206
207 private:
216 std::pair<iterator, iterator> DoExtractExpiredMpdus(ContainerQueue& queue) const;
217
218 mutable std::unordered_map<WifiContainerQueueId, ContainerQueue>
221 mutable std::unordered_map<WifiContainerQueueId, uint32_t>
223};
224
225} // namespace ns3
226
227#endif /* WIFI_MAC_QUEUE_CONTAINER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Class for the container used by WifiMacQueue.
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...
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.
WifiContainerQueueType
enumeration of container queue types
WifiReceiverAddressType
enumeration of frame directions