A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
wifi-mac-queue.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005, 2009 INRIA
3
* Copyright (c) 2009 MIRKO BANCHI
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
* Mirko Banchi <mk.banchi@gmail.com>
20
* Stefano Avallone <stavallo@unina.it>
21
*/
22
23
#ifndef WIFI_MAC_QUEUE_H
24
#define WIFI_MAC_QUEUE_H
25
26
#include "
qos-utils.h
"
27
#include "
wifi-mac-queue-container.h
"
28
#include "
wifi-mpdu.h
"
29
30
#include "ns3/queue.h"
31
32
#include <functional>
33
#include <unordered_map>
34
35
namespace
ns3
36
{
37
38
class
WifiMacQueueScheduler;
39
40
// The following explicit template instantiation declaration prevents modules
41
// including this header file from implicitly instantiating Queue<WifiMpdu>.
42
// This would cause python examples using wifi to crash at runtime with the
43
// following error message: "Trying to allocate twice the same UID:
44
// ns3::Queue<WifiMpdu>"
45
extern
template
class
Queue<WifiMpdu, ns3::WifiMacQueueContainer>;
46
65
class
WifiMacQueue
:
public
Queue<WifiMpdu, ns3::WifiMacQueueContainer>
66
{
67
public
:
72
static
TypeId
GetTypeId();
73
79
WifiMacQueue
(
AcIndex
ac =
AC_UNDEF
);
80
81
~WifiMacQueue
()
override
;
82
84
using
Queue
<
WifiMpdu
,
WifiMacQueueContainer
>::ConstIterator;
85
using
Queue
<
WifiMpdu
,
WifiMacQueueContainer
>::Iterator;
86
using
Queue
<
WifiMpdu
,
WifiMacQueueContainer
>::IsEmpty;
87
using
Queue
<
WifiMpdu
,
WifiMacQueueContainer
>::GetNPackets;
88
using
Queue
<
WifiMpdu
,
WifiMacQueueContainer
>::GetNBytes;
89
95
AcIndex
GetAc()
const
;
96
102
void
SetScheduler(
Ptr<WifiMacQueueScheduler>
scheduler);
103
109
void
SetMaxDelay(
Time
delay);
115
Time
GetMaxDelay()
const
;
116
123
bool
Enqueue(
Ptr<WifiMpdu>
item)
override
;
129
Ptr<WifiMpdu>
Dequeue()
override
;
135
void
DequeueIfQueued(
const
std::list<
Ptr<const WifiMpdu>
>& mpdus);
141
Ptr<const WifiMpdu>
Peek()
const override
;
149
Ptr<WifiMpdu>
Peek(uint8_t linkId)
const
;
165
Ptr<WifiMpdu>
PeekByTidAndAddress(uint8_t tid,
166
Mac48Address
dest,
167
Ptr<const WifiMpdu>
item =
nullptr
)
const
;
182
Ptr<WifiMpdu>
PeekByQueueId(
const
WifiContainerQueueId
& queueId,
183
Ptr<const WifiMpdu>
item =
nullptr
)
const
;
184
196
Ptr<WifiMpdu>
PeekFirstAvailable(uint8_t linkId,
Ptr<const WifiMpdu>
item =
nullptr
)
const
;
202
Ptr<WifiMpdu>
Remove()
override
;
212
Ptr<WifiMpdu>
Remove(
Ptr<const WifiMpdu>
item);
213
222
void
Replace(
Ptr<const WifiMpdu>
currentItem,
Ptr<WifiMpdu>
newItem);
223
231
uint32_t
GetNPackets(
const
WifiContainerQueueId
& queueId)
const
;
232
240
uint32_t
GetNBytes(
const
WifiContainerQueueId
& queueId)
const
;
241
250
bool
TtlExceeded(
Ptr<const WifiMpdu>
item,
const
Time
& now);
251
263
void
ExtractExpiredMpdus(
const
WifiContainerQueueId
& queueId)
const
;
273
void
ExtractAllExpiredMpdus()
const
;
277
void
WipeAllExpiredMpdus();
278
286
Ptr<WifiMpdu>
GetOriginal(
Ptr<WifiMpdu>
mpdu);
287
294
Ptr<WifiMpdu>
GetAlias(
Ptr<const WifiMpdu>
mpdu, uint8_t linkId);
295
296
protected
:
297
using
Queue
<
WifiMpdu
,
WifiMacQueueContainer
>::GetContainer;
298
299
void
DoDispose()
override
;
300
301
private
:
306
Iterator
GetIt(
Ptr<const WifiMpdu>
mpdu)
const
;
307
315
bool
Insert(ConstIterator pos,
Ptr<WifiMpdu>
item);
325
bool
DoEnqueue(ConstIterator pos,
Ptr<WifiMpdu>
item);
333
void
DoDequeue(
const
std::list<ConstIterator>& iterators);
342
Ptr<WifiMpdu>
DoRemove(ConstIterator pos);
343
344
Time
m_maxDelay
;
345
AcIndex
m_ac
;
346
Ptr<WifiMacQueueScheduler>
m_scheduler
;
347
349
TracedCallback<Ptr<const WifiMpdu>
>
m_traceExpired
;
350
351
NS_LOG_TEMPLATE_DECLARE
;
352
};
353
354
}
// namespace ns3
355
356
#endif
/* WIFI_MAC_QUEUE_H */
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
ns3::Queue
Template class for packet Queues.
Definition:
queue.h:267
ns3::Queue< WifiMpdu, ns3::WifiMacQueueContainer >::Iterator
Container::iterator Iterator
Iterator.
Definition:
queue.h:320
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition:
traced-callback.h:54
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::WifiMacQueueContainer
Class for the container used by WifiMacQueue.
Definition:
wifi-mac-queue-container.h:114
ns3::WifiMacQueue
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
Definition:
wifi-mac-queue.h:66
ns3::WifiMacQueue::m_maxDelay
Time m_maxDelay
Time to live for packets in the queue.
Definition:
wifi-mac-queue.h:344
ns3::WifiMacQueue::m_scheduler
Ptr< WifiMacQueueScheduler > m_scheduler
the MAC queue scheduler
Definition:
wifi-mac-queue.h:346
ns3::WifiMacQueue::NS_LOG_TEMPLATE_DECLARE
NS_LOG_TEMPLATE_DECLARE
redefinition of the log component
Definition:
wifi-mac-queue.h:351
ns3::WifiMacQueue::m_traceExpired
TracedCallback< Ptr< const WifiMpdu > > m_traceExpired
Traced callback: fired when a packet is dropped due to lifetime expiration.
Definition:
wifi-mac-queue.h:349
ns3::WifiMacQueue::m_ac
AcIndex m_ac
the access category
Definition:
wifi-mac-queue.h:345
ns3::WifiMpdu
WifiMpdu stores a (const) packet along with a MAC header.
Definition:
wifi-mpdu.h:62
uint32_t
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition:
qos-utils.h:72
ns3::AC_UNDEF
@ AC_UNDEF
Total number of ACs.
Definition:
qos-utils.h:86
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiContainerQueueId
std::tuple< WifiContainerQueueType, WifiReceiverAddressType, Mac48Address, std::optional< uint8_t > > WifiContainerQueueId
Tuple (queue type, receiver address type, Address, TID) identifying a container queue.
Definition:
wifi-mac-queue-container.h:79
qos-utils.h
wifi-mac-queue-container.h
wifi-mpdu.h
src
wifi
model
wifi-mac-queue.h
Generated on Sun Jul 2 2023 18:22:13 for ns-3 by
1.9.6