A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
txop.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19
20#include "txop.h"
21
23#include "mac-tx-middle.h"
25#include "wifi-mac-queue.h"
26#include "wifi-mac-trailer.h"
27#include "wifi-mac.h"
28
29#include "ns3/attribute-container.h"
30#include "ns3/log.h"
31#include "ns3/pointer.h"
32#include "ns3/random-variable-stream.h"
33#include "ns3/simulator.h"
34#include "ns3/socket.h"
35
36#undef NS_LOG_APPEND_CONTEXT
37#define NS_LOG_APPEND_CONTEXT \
38 if (m_mac) \
39 { \
40 std::clog << "[mac=" << m_mac->GetAddress() << "] "; \
41 }
42
43namespace ns3
44{
45
47
49
50TypeId
52{
53 static TypeId tid =
54 TypeId("ns3::Txop")
56 .SetGroupName("Wifi")
57 .AddConstructor<Txop>()
58 .AddAttribute("MinCw",
59 "The minimum value of the contention window (just for the first link, "
60 "in case of 11be multi-link devices).",
61 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
62 UintegerValue(15),
64 (uint32_t(Txop::*)() const) & Txop::GetMinCw),
65 MakeUintegerChecker<uint32_t>())
66 .AddAttribute(
67 "MinCws",
68 "The minimum values of the contention window for all the links",
69 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
71 MakeAttributeContainerAccessor<UintegerValue>(&Txop::SetMinCws, &Txop::GetMinCws),
72 MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint32_t>()))
73 .AddAttribute("MaxCw",
74 "The maximum value of the contention window (just for the first link, "
75 "in case of 11be multi-link devices).",
76 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
77 UintegerValue(1023),
79 (uint32_t(Txop::*)() const) & Txop::GetMaxCw),
80 MakeUintegerChecker<uint32_t>())
81 .AddAttribute(
82 "MaxCws",
83 "The maximum values of the contention window for all the links",
84 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
86 MakeAttributeContainerAccessor<UintegerValue>(&Txop::SetMaxCws, &Txop::GetMaxCws),
87 MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint32_t>()))
88 .AddAttribute(
89 "Aifsn",
90 "The AIFSN: the default value conforms to non-QOS (just for the first link, "
91 "in case of 11be multi-link devices).",
92 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
94 MakeUintegerAccessor((void(Txop::*)(uint8_t)) & Txop::SetAifsn,
95 (uint8_t(Txop::*)() const) & Txop::GetAifsn),
96 MakeUintegerChecker<uint8_t>())
97 .AddAttribute(
98 "Aifsns",
99 "The values of AIFSN for all the links",
100 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
102 MakeAttributeContainerAccessor<UintegerValue>(&Txop::SetAifsns, &Txop::GetAifsns),
103 MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()))
104 .AddAttribute("TxopLimit",
105 "The TXOP limit: the default value conforms to non-QoS "
106 "(just for the first link, in case of 11be multi-link devices).",
107 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
110 (Time(Txop::*)() const) & Txop::GetTxopLimit),
112 .AddAttribute("TxopLimits",
113 "The values of TXOP limit for all the links",
114 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
116 MakeAttributeContainerAccessor<TimeValue>(&Txop::SetTxopLimits,
118 MakeAttributeContainerChecker<TimeValue>(MakeTimeChecker()))
119 .AddAttribute("Queue",
120 "The WifiMacQueue object",
121 PointerValue(),
123 MakePointerChecker<WifiMacQueue>())
124 .AddTraceSource("BackoffTrace",
125 "Trace source for backoff values",
127 "ns3::Txop::BackoffValueTracedCallback")
128 .AddTraceSource("CwTrace",
129 "Trace source for contention window values",
131 "ns3::Txop::CwValueTracedCallback");
132 return tid;
133}
134
137{
138}
139
141 : m_queue(queue)
142{
143 NS_LOG_FUNCTION(this);
144 m_rng = CreateObject<UniformRandomVariable>();
145}
146
148{
149 NS_LOG_FUNCTION(this);
150}
151
152void
154{
155 NS_LOG_FUNCTION(this);
156 m_queue = nullptr;
157 m_mac = nullptr;
158 m_rng = nullptr;
159 m_txMiddle = nullptr;
160 m_links.clear();
161}
162
163std::unique_ptr<Txop::LinkEntity>
165{
166 return std::make_unique<LinkEntity>();
167}
168
170Txop::GetLink(uint8_t linkId) const
171{
172 auto it = m_links.find(linkId);
173 NS_ASSERT(it != m_links.cend());
174 NS_ASSERT(it->second); // check that the pointer owns an object
175 return *it->second;
176}
177
178const std::map<uint8_t, std::unique_ptr<Txop::LinkEntity>>&
180{
181 return m_links;
182}
183
184void
185Txop::SwapLinks(std::map<uint8_t, uint8_t> links)
186{
187 NS_LOG_FUNCTION(this);
188
189 decltype(m_links) tmp;
190 tmp.swap(m_links); // move all links to temporary map
191 for (const auto& [from, to] : links)
192 {
193 auto nh = tmp.extract(from);
194 nh.key() = to;
195 m_links.insert(std::move(nh));
196 }
197 // move links remaining in tmp to m_links
198 m_links.merge(tmp);
199}
200
201void
203{
204 NS_LOG_FUNCTION(this);
205 m_txMiddle = txMiddle;
206}
207
208void
210{
211 NS_LOG_FUNCTION(this << mac);
212 m_mac = mac;
213 for (const auto linkId : m_mac->GetLinkIds())
214 {
215 m_links.emplace(linkId, CreateLinkEntity());
216 }
217}
218
219void
221{
222 NS_LOG_FUNCTION(this << &callback);
223 m_droppedMpduCallback = callback;
224 m_queue->TraceConnectWithoutContext("DropBeforeEnqueue",
226 m_queue->TraceConnectWithoutContext("Expired",
228}
229
232{
233 return m_queue;
234}
235
236void
238{
239 SetMinCw(minCw, 0);
240}
241
242void
243Txop::SetMinCws(std::vector<uint32_t> minCws)
244{
245 NS_ABORT_IF(minCws.size() != m_links.size());
246 std::size_t i = 0;
247 for (const auto& [id, link] : m_links)
248 {
249 SetMinCw(minCws[i++], id);
250 }
251}
252
253void
254Txop::SetMinCw(uint32_t minCw, uint8_t linkId)
255{
256 NS_LOG_FUNCTION(this << minCw << +linkId);
257 auto& link = GetLink(linkId);
258 bool changed = (link.cwMin != minCw);
259 link.cwMin = minCw;
260 if (changed)
261 {
262 ResetCw(linkId);
263 }
264}
265
266void
268{
269 SetMaxCw(maxCw, 0);
270}
271
272void
273Txop::SetMaxCws(std::vector<uint32_t> maxCws)
274{
275 NS_ABORT_IF(maxCws.size() != m_links.size());
276 std::size_t i = 0;
277 for (const auto& [id, link] : m_links)
278 {
279 SetMaxCw(maxCws[i++], id);
280 }
281}
282
283void
284Txop::SetMaxCw(uint32_t maxCw, uint8_t linkId)
285{
286 NS_LOG_FUNCTION(this << maxCw << +linkId);
287 auto& link = GetLink(linkId);
288 bool changed = (link.cwMax != maxCw);
289 link.cwMax = maxCw;
290 if (changed)
291 {
292 ResetCw(linkId);
293 }
294}
295
297Txop::GetCw(uint8_t linkId) const
298{
299 return GetLink(linkId).cw;
300}
301
302void
303Txop::ResetCw(uint8_t linkId)
304{
305 NS_LOG_FUNCTION(this);
306 auto& link = GetLink(linkId);
307 link.cw = GetMinCw(linkId);
308 m_cwTrace(link.cw, linkId);
309}
310
311void
312Txop::UpdateFailedCw(uint8_t linkId)
313{
314 NS_LOG_FUNCTION(this);
315 auto& link = GetLink(linkId);
316 // see 802.11-2012, section 9.19.2.5
317 link.cw = std::min(2 * (link.cw + 1) - 1, GetMaxCw(linkId));
318 // if the MU EDCA timer is running, CW cannot be less than MU CW min
319 link.cw = std::max(link.cw, GetMinCw(linkId));
320 m_cwTrace(link.cw, linkId);
321}
322
324Txop::GetBackoffSlots(uint8_t linkId) const
325{
326 return GetLink(linkId).backoffSlots;
327}
328
329Time
330Txop::GetBackoffStart(uint8_t linkId) const
331{
332 return GetLink(linkId).backoffStart;
333}
334
335void
336Txop::UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
337{
338 NS_LOG_FUNCTION(this << nSlots << backoffUpdateBound << +linkId);
339 auto& link = GetLink(linkId);
340
341 link.backoffSlots -= nSlots;
342 link.backoffStart = backoffUpdateBound;
343 NS_LOG_DEBUG("update slots=" << nSlots << " slots, backoff=" << link.backoffSlots);
344}
345
346void
347Txop::StartBackoffNow(uint32_t nSlots, uint8_t linkId)
348{
349 NS_LOG_FUNCTION(this << nSlots << +linkId);
350 auto& link = GetLink(linkId);
351
352 if (link.backoffSlots != 0)
353 {
354 NS_LOG_DEBUG("reset backoff from " << link.backoffSlots << " to " << nSlots << " slots");
355 }
356 else
357 {
358 NS_LOG_DEBUG("start backoff=" << nSlots << " slots");
359 }
360 link.backoffSlots = nSlots;
361 link.backoffStart = Simulator::Now();
362}
363
364void
365Txop::SetAifsn(uint8_t aifsn)
366{
367 SetAifsn(aifsn, 0);
368}
369
370void
371Txop::SetAifsns(std::vector<uint8_t> aifsns)
372{
373 NS_ABORT_IF(aifsns.size() != m_links.size());
374 std::size_t i = 0;
375 for (const auto& [id, link] : m_links)
376 {
377 SetAifsn(aifsns[i++], id);
378 }
379}
380
381void
382Txop::SetAifsn(uint8_t aifsn, uint8_t linkId)
383{
384 NS_LOG_FUNCTION(this << +aifsn << +linkId);
385 GetLink(linkId).aifsn = aifsn;
386}
387
388void
390{
391 SetTxopLimit(txopLimit, 0);
392}
393
394void
395Txop::SetTxopLimits(const std::vector<Time>& txopLimits)
396{
397 NS_ABORT_MSG_IF(txopLimits.size() != m_links.size(),
398 "The size of the given vector (" << txopLimits.size()
399 << ") does not match the number of links ("
400 << m_links.size() << ")");
401 std::size_t i = 0;
402 for (const auto& [id, link] : m_links)
403 {
404 SetTxopLimit(txopLimits[i++], id);
405 }
406}
407
408void
409Txop::SetTxopLimit(Time txopLimit, uint8_t linkId)
410{
411 NS_LOG_FUNCTION(this << txopLimit << +linkId);
412 NS_ASSERT_MSG((txopLimit.GetMicroSeconds() % 32 == 0),
413 "The TXOP limit must be expressed in multiple of 32 microseconds!");
414 GetLink(linkId).txopLimit = txopLimit;
415}
416
419{
420 return GetMinCw(0);
421}
422
423std::vector<uint32_t>
425{
426 std::vector<uint32_t> ret;
427 ret.reserve(m_links.size());
428 for (const auto& [id, link] : m_links)
429 {
430 ret.push_back(link->cwMin);
431 }
432 return ret;
433}
434
436Txop::GetMinCw(uint8_t linkId) const
437{
438 return GetLink(linkId).cwMin;
439}
440
443{
444 return GetMaxCw(0);
445}
446
447std::vector<uint32_t>
449{
450 std::vector<uint32_t> ret;
451 ret.reserve(m_links.size());
452 for (const auto& [id, link] : m_links)
453 {
454 ret.push_back(link->cwMax);
455 }
456 return ret;
457}
458
460Txop::GetMaxCw(uint8_t linkId) const
461{
462 return GetLink(linkId).cwMax;
463}
464
465uint8_t
467{
468 return GetAifsn(0);
469}
470
471std::vector<uint8_t>
473{
474 std::vector<uint8_t> ret;
475 ret.reserve(m_links.size());
476 for (const auto& [id, link] : m_links)
477 {
478 ret.push_back(link->aifsn);
479 }
480 return ret;
481}
482
483uint8_t
484Txop::GetAifsn(uint8_t linkId) const
485{
486 return GetLink(linkId).aifsn;
487}
488
489Time
491{
492 return GetTxopLimit(0);
493}
494
495std::vector<Time>
497{
498 std::vector<Time> ret;
499 ret.reserve(m_links.size());
500 for (const auto& [id, link] : m_links)
501 {
502 ret.push_back(link->txopLimit);
503 }
504 return ret;
505}
506
507Time
508Txop::GetTxopLimit(uint8_t linkId) const
509{
510 return GetLink(linkId).txopLimit;
511}
512
513bool
515{
516 m_queue->WipeAllExpiredMpdus();
517 bool ret = static_cast<bool>(m_queue->Peek(linkId));
518 NS_LOG_FUNCTION(this << +linkId << ret);
519 return ret;
520}
521
522void
524{
525 NS_LOG_FUNCTION(this << packet << &hdr);
526 // remove the priority tag attached, if any
527 SocketPriorityTag priorityTag;
528 packet->RemovePacketTag(priorityTag);
529 Queue(Create<WifiMpdu>(packet, hdr));
530}
531
532void
534{
535 NS_LOG_FUNCTION(this << *mpdu);
536 const auto linkIds = m_mac->GetMacQueueScheduler()->GetLinkIds(m_queue->GetAc(), mpdu);
537 std::map<uint8_t, bool> hasFramesToTransmit;
538
539 // save the status of the AC queues before enqueuing the MPDU (required to determine if
540 // backoff is needed)
541 for (const auto linkId : linkIds)
542 {
543 hasFramesToTransmit[linkId] = HasFramesToTransmit(linkId);
544 }
545 m_queue->Enqueue(mpdu);
546 for (const auto linkId : linkIds)
547 {
548 // schedule a call to StartAccessIfNeeded() to request channel access after that all the
549 // packets of a burst have been enqueued, instead of requesting channel access right after
550 // the first packet. The call to StartAccessIfNeeded() is scheduled only after the first
551 // packet
552 if (auto& event = GetLink(linkId).accessRequest.event; !event.IsRunning())
553 {
555 this,
556 linkId,
557 hasFramesToTransmit.at(linkId),
559 }
560 }
561}
562
563int64_t
564Txop::AssignStreams(int64_t stream)
565{
566 NS_LOG_FUNCTION(this << stream);
567 m_rng->SetStream(stream);
568 return 1;
569}
570
571void
572Txop::StartAccessAfterEvent(uint8_t linkId, bool hadFramesToTransmit, bool checkMediumBusy)
573{
574 NS_LOG_FUNCTION(this << +linkId << hadFramesToTransmit << checkMediumBusy);
575
576 if (GetLink(linkId).access != NOT_REQUESTED || !HasFramesToTransmit(linkId))
577 {
578 NS_LOG_DEBUG("No need to request channel access on link " << +linkId);
579 return;
580 }
581
583 hadFramesToTransmit,
584 checkMediumBusy))
585 {
586 GenerateBackoff(linkId);
587 }
588
590}
591
592void
594{
595 NS_LOG_FUNCTION(this);
596 for (const auto& [id, link] : m_links)
597 {
598 ResetCw(id);
599 GenerateBackoff(id);
600 }
601}
602
604Txop::GetAccessStatus(uint8_t linkId) const
605{
606 return GetLink(linkId).access;
607}
608
609void
611{
612 NS_LOG_FUNCTION(this << +linkId);
613 GetLink(linkId).access = REQUESTED;
614}
615
616void
617Txop::NotifyChannelAccessed(uint8_t linkId, Time txopDuration)
618{
619 NS_LOG_FUNCTION(this << +linkId << txopDuration);
620 GetLink(linkId).access = GRANTED;
621}
622
623void
625{
626 NS_LOG_FUNCTION(this << +linkId);
627 GetLink(linkId).access = NOT_REQUESTED;
628 GenerateBackoff(linkId);
629 if (HasFramesToTransmit(linkId))
630 {
632 }
633}
634
635void
636Txop::RequestAccess(uint8_t linkId)
637{
638 NS_LOG_FUNCTION(this << +linkId);
639 if (GetLink(linkId).access == NOT_REQUESTED)
640 {
642 }
643}
644
645void
647{
648 NS_LOG_FUNCTION(this << +linkId);
649 uint32_t backoff = m_rng->GetInteger(0, GetCw(linkId));
650 m_backoffTrace(backoff, linkId);
651 StartBackoffNow(backoff, linkId);
652}
653
654void
655Txop::NotifySleep(uint8_t linkId)
656{
657 NS_LOG_FUNCTION(this << +linkId);
658}
659
660void
662{
663 NS_LOG_FUNCTION(this);
664 m_queue->Flush();
665}
666
667void
668Txop::NotifyWakeUp(uint8_t linkId)
669{
670 NS_LOG_FUNCTION(this << +linkId);
671 // before wake up, no packet can be transmitted
673}
674
675void
677{
678 NS_LOG_FUNCTION(this);
679 for (const auto& [id, link] : m_links)
680 {
681 // before being turned on, no packet can be transmitted
683 }
684}
685
686bool
688{
689 return false;
690}
691
692} // namespace ns3
A container for one type of attribute.
auto Bind(BoundArgs &&... bargs)
Bind a variable number of arguments.
Definition: callback.h:557
bool NeedBackoffUponAccess(Ptr< Txop > txop, bool hadFramesToTransmit, bool checkMediumBusy)
Determine if a new backoff needs to be generated as per letter a) of Section 10.23....
void RequestAccess(Ptr< Txop > txop)
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:76
A base class which provides memory management and object aggregation.
Definition: object.h:89
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Template class for packet Queues.
Definition: queue.h:268
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:605
indicates whether the socket has a priority set.
Definition: socket.h:1316
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:413
AttributeValue implementation for Time.
Definition: nstime.h:1413
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:74
Ptr< WifiMac > m_mac
the wifi MAC
Definition: txop.h:555
Time GetTxopLimit() const
Return the TXOP limit.
Definition: txop.cc:490
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
Definition: txop.cc:164
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: txop.cc:564
virtual ChannelAccessStatus GetAccessStatus(uint8_t linkId) const
Definition: txop.cc:604
Ptr< WifiMacQueue > m_queue
the wifi MAC queue
Definition: txop.h:553
void StartAccessAfterEvent(uint8_t linkId, bool hadFramesToTransmit, bool checkMediumBusy)
Request channel access on the given link after the occurrence of an event that possibly requires to g...
Definition: txop.cc:572
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the Txop has frames to transmit over the given link.
Definition: txop.cc:514
virtual void NotifyOff()
When off operation occurs, the queue gets cleaned up.
Definition: txop.cc:661
Ptr< UniformRandomVariable > m_rng
the random stream
Definition: txop.h:556
CwValueTracedCallback m_cwTrace
CW trace value.
Definition: txop.h:564
void DoDispose() override
Destructor implementation.
Definition: txop.cc:153
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:267
uint32_t GetMinCw() const
Return the minimum contention window size.
Definition: txop.cc:418
ChannelAccessStatus
Enumeration for channel access status.
Definition: txop.h:102
@ GRANTED
Definition: txop.h:105
@ NOT_REQUESTED
Definition: txop.h:103
@ REQUESTED
Definition: txop.h:104
virtual void NotifyOn()
When on operation occurs, channel access will be started.
Definition: txop.cc:676
void UpdateFailedCw(uint8_t linkId)
Update the value of the CW variable for the given link to take into account a transmission failure.
Definition: txop.cc:312
static constexpr bool DIDNT_HAVE_FRAMES_TO_TRANSMIT
no packet available for transmission was in the queue
Definition: txop.h:417
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:231
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:209
virtual void NotifyWakeUp(uint8_t linkId)
When wake up operation occurs on a link, channel access on that link will be restarted.
Definition: txop.cc:668
virtual void NotifyChannelReleased(uint8_t linkId)
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: txop.cc:624
std::vector< uint32_t > GetMaxCws() const
Return the maximum contention window size for each link.
Definition: txop.cc:448
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: txop.cc:389
void ResetCw(uint8_t linkId)
Update the value of the CW variable for the given link to take into account a transmission success or...
Definition: txop.cc:303
Txop()
Definition: txop.cc:135
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: txop.cc:170
virtual bool IsQosTxop() const
Check for QoS TXOP.
Definition: txop.cc:687
std::vector< uint32_t > GetMinCws() const
Return the minimum contention window size for each link.
Definition: txop.cc:424
std::vector< uint8_t > GetAifsns() const
Return the number of slots that make up an AIFS for each link.
Definition: txop.cc:472
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
Update backoff slots for the given link that nSlots has passed.
Definition: txop.cc:336
Time GetBackoffStart(uint8_t linkId) const
Return the time when the backoff procedure started on the given link.
Definition: txop.cc:330
void SetMaxCws(std::vector< uint32_t > maxCws)
Set the maximum contention window size for each link.
Definition: txop.cc:273
void SetTxopLimits(const std::vector< Time > &txopLimits)
Set the TXOP limit for each link.
Definition: txop.cc:395
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
Definition: txop.h:552
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
Definition: txop.cc:185
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:202
std::vector< Time > GetTxopLimits() const
Return the TXOP limit for each link.
Definition: txop.cc:496
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
Definition: txop.cc:179
static TypeId GetTypeId()
Get the type ID.
Definition: txop.cc:51
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:365
uint32_t GetCw(uint8_t linkId) const
Get the current value of the CW variable for the given link.
Definition: txop.cc:297
void SetMinCws(std::vector< uint32_t > minCws)
Set the minimum contention window size for each link.
Definition: txop.cc:243
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Definition: txop.cc:220
virtual void GenerateBackoff(uint8_t linkId)
Generate a new backoff for the given link now.
Definition: txop.cc:646
BackoffValueTracedCallback m_backoffTrace
backoff trace value
Definition: txop.h:563
virtual void NotifyAccessRequested(uint8_t linkId)
Notify that access request has been received for the given link.
Definition: txop.cc:610
void SetAifsns(std::vector< uint8_t > aifsns)
Set the number of slots that make up an AIFS for each link.
Definition: txop.cc:371
Ptr< MacTxMiddle > m_txMiddle
the MacTxMiddle
Definition: txop.h:554
static constexpr bool CHECK_MEDIUM_BUSY
generation of backoff (also) depends on the busy/idle state of the medium
Definition: txop.h:419
~Txop() override
Definition: txop.cc:147
void StartBackoffNow(uint32_t nSlots, uint8_t linkId)
Definition: txop.cc:347
virtual void NotifyChannelAccessed(uint8_t linkId, Time txopDuration=Seconds(0))
Called by the FrameExchangeManager to notify that channel access has been granted on the given link f...
Definition: txop.cc:617
std::map< uint8_t, std::unique_ptr< LinkEntity > > m_links
ID-indexed map of LinkEntity objects.
Definition: txop.h:575
void RequestAccess(uint8_t linkId)
Request access to the ChannelAccessManager associated with the given link.
Definition: txop.cc:636
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:237
uint8_t GetAifsn() const
Return the number of slots that make up an AIFS.
Definition: txop.cc:466
uint32_t GetBackoffSlots(uint8_t linkId) const
Return the current number of backoff slots on the given link.
Definition: txop.cc:324
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:523
virtual void NotifySleep(uint8_t linkId)
Notify that the given link switched to sleep mode.
Definition: txop.cc:655
static constexpr bool DONT_CHECK_MEDIUM_BUSY
generation of backoff is independent of the busy/idle state of the medium
Definition: txop.h:421
uint32_t GetMaxCw() const
Return the maximum contention window size.
Definition: txop.cc:442
void DoInitialize() override
Initialize() implementation.
Definition: txop.cc:593
a unique identifier for an interface.
Definition: type-id.h:59
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:64
@ ATTR_SET
The attribute can be written.
Definition: type-id.h:65
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
Hold an unsigned integer type.
Definition: uinteger.h:45
uint32_t GetInteger(uint32_t min, uint32_t max)
Get the next random value drawn from the distribution.
Implements the IEEE 802.11 MAC header.
Ptr< WifiMacQueueScheduler > GetMacQueueScheduler() const
Get the wifi MAC queue scheduler.
Definition: wifi-mac.cc:576
const std::set< uint8_t > & GetLinkIds() const
Definition: wifi-mac.cc:939
Ptr< ChannelAccessManager > GetChannelAccessManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Channel Access Manager associated with the given link.
Definition: wifi-mac.cc:870
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:227
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1434
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1414
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:76
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition: object.h:579
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
@ WIFI_MAC_DROP_FAILED_ENQUEUE
Definition: wifi-mac.h:78
@ WIFI_MAC_DROP_EXPIRED_LIFETIME
Definition: wifi-mac.h:79
@ AC_BE_NQOS
Non-QoS.
Definition: qos-utils.h:83
Every class exported by the ns3 library is enclosed in the ns3 namespace.