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 WIFI_TXOP_NS_LOG_APPEND_CONTEXT
38
39namespace ns3
40{
41
43
45
46TypeId
48{
49 static TypeId tid =
50 TypeId("ns3::Txop")
52 .SetGroupName("Wifi")
53 .AddConstructor<Txop>()
54 .AddAttribute("MinCw",
55 "The minimum value of the contention window (just for the first link, "
56 "in case of 11be multi-link devices).",
57 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
58 UintegerValue(15),
60 (uint32_t(Txop::*)() const) & Txop::GetMinCw),
61 MakeUintegerChecker<uint32_t>())
62 .AddAttribute(
63 "MinCws",
64 "The minimum values of the contention window for all the links",
65 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
67 MakeAttributeContainerAccessor<UintegerValue>(&Txop::SetMinCws, &Txop::GetMinCws),
68 MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint32_t>()))
69 .AddAttribute("MaxCw",
70 "The maximum value of the contention window (just for the first link, "
71 "in case of 11be multi-link devices).",
72 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
73 UintegerValue(1023),
75 (uint32_t(Txop::*)() const) & Txop::GetMaxCw),
76 MakeUintegerChecker<uint32_t>())
77 .AddAttribute(
78 "MaxCws",
79 "The maximum values of the contention window for all the links",
80 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
82 MakeAttributeContainerAccessor<UintegerValue>(&Txop::SetMaxCws, &Txop::GetMaxCws),
83 MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint32_t>()))
84 .AddAttribute(
85 "Aifsn",
86 "The AIFSN: the default value conforms to non-QOS (just for the first link, "
87 "in case of 11be multi-link devices).",
88 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
90 MakeUintegerAccessor((void(Txop::*)(uint8_t)) & Txop::SetAifsn,
91 (uint8_t(Txop::*)() const) & Txop::GetAifsn),
92 MakeUintegerChecker<uint8_t>())
93 .AddAttribute(
94 "Aifsns",
95 "The values of AIFSN for all the links",
96 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
98 MakeAttributeContainerAccessor<UintegerValue>(&Txop::SetAifsns, &Txop::GetAifsns),
99 MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()))
100 .AddAttribute("TxopLimit",
101 "The TXOP limit: the default value conforms to non-QoS "
102 "(just for the first link, in case of 11be multi-link devices).",
103 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
106 (Time(Txop::*)() const) & Txop::GetTxopLimit),
108 .AddAttribute("TxopLimits",
109 "The values of TXOP limit for all the links",
110 TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
112 MakeAttributeContainerAccessor<TimeValue>(&Txop::SetTxopLimits,
114 MakeAttributeContainerChecker<TimeValue>(MakeTimeChecker()))
115 .AddAttribute("Queue",
116 "The WifiMacQueue object",
117 PointerValue(),
119 MakePointerChecker<WifiMacQueue>())
120 .AddTraceSource("BackoffTrace",
121 "Trace source for backoff values",
123 "ns3::Txop::BackoffValueTracedCallback")
124 .AddTraceSource("CwTrace",
125 "Trace source for contention window values",
127 "ns3::Txop::CwValueTracedCallback");
128 return tid;
129}
130
133{
134}
135
137 : m_queue(queue)
138{
139 NS_LOG_FUNCTION(this);
140 m_rng = CreateObject<UniformRandomVariable>();
141}
142
144{
145 NS_LOG_FUNCTION(this);
146}
147
148void
150{
151 NS_LOG_FUNCTION(this);
152 m_queue = nullptr;
153 m_mac = nullptr;
154 m_rng = nullptr;
155 m_txMiddle = nullptr;
156 m_links.clear();
157}
158
159std::unique_ptr<Txop::LinkEntity>
161{
162 return std::make_unique<LinkEntity>();
163}
164
166Txop::GetLink(uint8_t linkId) const
167{
168 auto it = m_links.find(linkId);
169 NS_ASSERT(it != m_links.cend());
170 NS_ASSERT(it->second); // check that the pointer owns an object
171 return *it->second;
172}
173
174const std::map<uint8_t, std::unique_ptr<Txop::LinkEntity>>&
176{
177 return m_links;
178}
179
180void
181Txop::SwapLinks(std::map<uint8_t, uint8_t> links)
182{
183 NS_LOG_FUNCTION(this);
184
185 decltype(m_links) tmp;
186 tmp.swap(m_links); // move all links to temporary map
187 for (const auto& [from, to] : links)
188 {
189 auto nh = tmp.extract(from);
190 nh.key() = to;
191 m_links.insert(std::move(nh));
192 }
193 // move links remaining in tmp to m_links
194 m_links.merge(tmp);
195}
196
197void
199{
200 NS_LOG_FUNCTION(this);
201 m_txMiddle = txMiddle;
202}
203
204void
206{
207 NS_LOG_FUNCTION(this << mac);
208 m_mac = mac;
209 for (const auto linkId : m_mac->GetLinkIds())
210 {
211 m_links.emplace(linkId, CreateLinkEntity());
212 }
213}
214
215void
217{
218 NS_LOG_FUNCTION(this << &callback);
219 m_droppedMpduCallback = callback;
220 m_queue->TraceConnectWithoutContext("DropBeforeEnqueue",
222 m_queue->TraceConnectWithoutContext("Expired",
224}
225
228{
229 return m_queue;
230}
231
232void
234{
235 SetMinCw(minCw, 0);
236}
237
238void
239Txop::SetMinCws(std::vector<uint32_t> minCws)
240{
241 NS_ABORT_IF(minCws.size() != m_links.size());
242 std::size_t i = 0;
243 for (const auto& [id, link] : m_links)
244 {
245 SetMinCw(minCws[i++], id);
246 }
247}
248
249void
250Txop::SetMinCw(uint32_t minCw, uint8_t linkId)
251{
252 NS_LOG_FUNCTION(this << minCw << +linkId);
253 auto& link = GetLink(linkId);
254 bool changed = (link.cwMin != minCw);
255 link.cwMin = minCw;
256 if (changed)
257 {
258 ResetCw(linkId);
259 }
260}
261
262void
264{
265 SetMaxCw(maxCw, 0);
266}
267
268void
269Txop::SetMaxCws(std::vector<uint32_t> maxCws)
270{
271 NS_ABORT_IF(maxCws.size() != m_links.size());
272 std::size_t i = 0;
273 for (const auto& [id, link] : m_links)
274 {
275 SetMaxCw(maxCws[i++], id);
276 }
277}
278
279void
280Txop::SetMaxCw(uint32_t maxCw, uint8_t linkId)
281{
282 NS_LOG_FUNCTION(this << maxCw << +linkId);
283 auto& link = GetLink(linkId);
284 bool changed = (link.cwMax != maxCw);
285 link.cwMax = maxCw;
286 if (changed)
287 {
288 ResetCw(linkId);
289 }
290}
291
293Txop::GetCw(uint8_t linkId) const
294{
295 return GetLink(linkId).cw;
296}
297
298void
299Txop::ResetCw(uint8_t linkId)
300{
301 NS_LOG_FUNCTION(this);
302 auto& link = GetLink(linkId);
303 link.cw = GetMinCw(linkId);
304 m_cwTrace(link.cw, linkId);
305}
306
307void
308Txop::UpdateFailedCw(uint8_t linkId)
309{
310 NS_LOG_FUNCTION(this);
311 auto& link = GetLink(linkId);
312 // see 802.11-2012, section 9.19.2.5
313 link.cw = std::min(2 * (link.cw + 1) - 1, GetMaxCw(linkId));
314 // if the MU EDCA timer is running, CW cannot be less than MU CW min
315 link.cw = std::max(link.cw, GetMinCw(linkId));
316 m_cwTrace(link.cw, linkId);
317}
318
320Txop::GetBackoffSlots(uint8_t linkId) const
321{
322 return GetLink(linkId).backoffSlots;
323}
324
325Time
326Txop::GetBackoffStart(uint8_t linkId) const
327{
328 return GetLink(linkId).backoffStart;
329}
330
331void
332Txop::UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
333{
334 NS_LOG_FUNCTION(this << nSlots << backoffUpdateBound << +linkId);
335 auto& link = GetLink(linkId);
336
337 link.backoffSlots -= nSlots;
338 link.backoffStart = backoffUpdateBound;
339 NS_LOG_DEBUG("update slots=" << nSlots << " slots, backoff=" << link.backoffSlots);
340}
341
342void
343Txop::StartBackoffNow(uint32_t nSlots, uint8_t linkId)
344{
345 NS_LOG_FUNCTION(this << nSlots << +linkId);
346 auto& link = GetLink(linkId);
347
348 if (link.backoffSlots != 0)
349 {
350 NS_LOG_DEBUG("reset backoff from " << link.backoffSlots << " to " << nSlots << " slots");
351 }
352 else
353 {
354 NS_LOG_DEBUG("start backoff=" << nSlots << " slots");
355 }
356 link.backoffSlots = nSlots;
357 link.backoffStart = Simulator::Now();
358}
359
360void
361Txop::SetAifsn(uint8_t aifsn)
362{
363 SetAifsn(aifsn, 0);
364}
365
366void
367Txop::SetAifsns(std::vector<uint8_t> aifsns)
368{
369 NS_ABORT_IF(aifsns.size() != m_links.size());
370 std::size_t i = 0;
371 for (const auto& [id, link] : m_links)
372 {
373 SetAifsn(aifsns[i++], id);
374 }
375}
376
377void
378Txop::SetAifsn(uint8_t aifsn, uint8_t linkId)
379{
380 NS_LOG_FUNCTION(this << +aifsn << +linkId);
381 GetLink(linkId).aifsn = aifsn;
382}
383
384void
386{
387 SetTxopLimit(txopLimit, 0);
388}
389
390void
391Txop::SetTxopLimits(const std::vector<Time>& txopLimits)
392{
393 NS_ABORT_MSG_IF(txopLimits.size() != m_links.size(),
394 "The size of the given vector (" << txopLimits.size()
395 << ") does not match the number of links ("
396 << m_links.size() << ")");
397 std::size_t i = 0;
398 for (const auto& [id, link] : m_links)
399 {
400 SetTxopLimit(txopLimits[i++], id);
401 }
402}
403
404void
405Txop::SetTxopLimit(Time txopLimit, uint8_t linkId)
406{
407 NS_LOG_FUNCTION(this << txopLimit << +linkId);
408 NS_ASSERT_MSG((txopLimit.GetMicroSeconds() % 32 == 0),
409 "The TXOP limit must be expressed in multiple of 32 microseconds!");
410 GetLink(linkId).txopLimit = txopLimit;
411}
412
415{
416 return GetMinCw(0);
417}
418
419std::vector<uint32_t>
421{
422 std::vector<uint32_t> ret;
423 ret.reserve(m_links.size());
424 for (const auto& [id, link] : m_links)
425 {
426 ret.push_back(link->cwMin);
427 }
428 return ret;
429}
430
432Txop::GetMinCw(uint8_t linkId) const
433{
434 return GetLink(linkId).cwMin;
435}
436
439{
440 return GetMaxCw(0);
441}
442
443std::vector<uint32_t>
445{
446 std::vector<uint32_t> ret;
447 ret.reserve(m_links.size());
448 for (const auto& [id, link] : m_links)
449 {
450 ret.push_back(link->cwMax);
451 }
452 return ret;
453}
454
456Txop::GetMaxCw(uint8_t linkId) const
457{
458 return GetLink(linkId).cwMax;
459}
460
461uint8_t
463{
464 return GetAifsn(0);
465}
466
467std::vector<uint8_t>
469{
470 std::vector<uint8_t> ret;
471 ret.reserve(m_links.size());
472 for (const auto& [id, link] : m_links)
473 {
474 ret.push_back(link->aifsn);
475 }
476 return ret;
477}
478
479uint8_t
480Txop::GetAifsn(uint8_t linkId) const
481{
482 return GetLink(linkId).aifsn;
483}
484
485Time
487{
488 return GetTxopLimit(0);
489}
490
491std::vector<Time>
493{
494 std::vector<Time> ret;
495 ret.reserve(m_links.size());
496 for (const auto& [id, link] : m_links)
497 {
498 ret.push_back(link->txopLimit);
499 }
500 return ret;
501}
502
503Time
504Txop::GetTxopLimit(uint8_t linkId) const
505{
506 return GetLink(linkId).txopLimit;
507}
508
509bool
511{
512 m_queue->WipeAllExpiredMpdus();
513 bool ret = static_cast<bool>(m_queue->Peek(linkId));
514 NS_LOG_FUNCTION(this << +linkId << ret);
515 return ret;
516}
517
518void
520{
521 NS_LOG_FUNCTION(this << packet << &hdr);
522 // remove the priority tag attached, if any
523 SocketPriorityTag priorityTag;
524 packet->RemovePacketTag(priorityTag);
525 Queue(Create<WifiMpdu>(packet, hdr));
526}
527
528void
530{
531 NS_LOG_FUNCTION(this << *mpdu);
532 const auto linkIds = m_mac->GetMacQueueScheduler()->GetLinkIds(m_queue->GetAc(), mpdu);
533 std::map<uint8_t, bool> hasFramesToTransmit;
534
535 // save the status of the AC queues before enqueuing the MPDU (required to determine if
536 // backoff is needed)
537 for (const auto linkId : linkIds)
538 {
539 hasFramesToTransmit[linkId] = HasFramesToTransmit(linkId);
540 }
541 m_queue->Enqueue(mpdu);
542 for (const auto linkId : linkIds)
543 {
544 // schedule a call to StartAccessIfNeeded() to request channel access after that all the
545 // packets of a burst have been enqueued, instead of requesting channel access right after
546 // the first packet. The call to StartAccessIfNeeded() is scheduled only after the first
547 // packet
548 if (auto& event = GetLink(linkId).accessRequest.event; !event.IsRunning())
549 {
551 this,
552 linkId,
553 hasFramesToTransmit.at(linkId),
555 }
556 }
557}
558
559int64_t
560Txop::AssignStreams(int64_t stream)
561{
562 NS_LOG_FUNCTION(this << stream);
563 m_rng->SetStream(stream);
564 return 1;
565}
566
567void
568Txop::StartAccessAfterEvent(uint8_t linkId, bool hadFramesToTransmit, bool checkMediumBusy)
569{
570 NS_LOG_FUNCTION(this << +linkId << hadFramesToTransmit << checkMediumBusy);
571
572 if (GetLink(linkId).access != NOT_REQUESTED || !HasFramesToTransmit(linkId))
573 {
574 NS_LOG_DEBUG("No need to request channel access on link " << +linkId);
575 return;
576 }
577
579 hadFramesToTransmit,
580 checkMediumBusy))
581 {
582 GenerateBackoff(linkId);
583 }
584
586}
587
588void
590{
591 NS_LOG_FUNCTION(this);
592 for (const auto& [id, link] : m_links)
593 {
594 ResetCw(id);
595 GenerateBackoff(id);
596 }
597}
598
600Txop::GetAccessStatus(uint8_t linkId) const
601{
602 return GetLink(linkId).access;
603}
604
605void
607{
608 NS_LOG_FUNCTION(this << +linkId);
609 GetLink(linkId).access = REQUESTED;
610}
611
612void
613Txop::NotifyChannelAccessed(uint8_t linkId, Time txopDuration)
614{
615 NS_LOG_FUNCTION(this << +linkId << txopDuration);
616 GetLink(linkId).access = GRANTED;
617}
618
619void
621{
622 NS_LOG_FUNCTION(this << +linkId);
623 GetLink(linkId).access = NOT_REQUESTED;
624 GenerateBackoff(linkId);
625 if (HasFramesToTransmit(linkId))
626 {
628 }
629}
630
631void
632Txop::RequestAccess(uint8_t linkId)
633{
634 NS_LOG_FUNCTION(this << +linkId);
635 if (GetLink(linkId).access == NOT_REQUESTED)
636 {
638 }
639}
640
641void
643{
644 NS_LOG_FUNCTION(this << +linkId);
645 uint32_t backoff = m_rng->GetInteger(0, GetCw(linkId));
646 m_backoffTrace(backoff, linkId);
647 StartBackoffNow(backoff, linkId);
648}
649
650void
651Txop::NotifySleep(uint8_t linkId)
652{
653 NS_LOG_FUNCTION(this << +linkId);
654}
655
656void
658{
659 NS_LOG_FUNCTION(this);
660 m_queue->Flush();
661}
662
663void
664Txop::NotifyWakeUp(uint8_t linkId)
665{
666 NS_LOG_FUNCTION(this << +linkId);
667 // before wake up, no packet can be transmitted
669}
670
671void
673{
674 NS_LOG_FUNCTION(this);
675 for (const auto& [id, link] : m_links)
676 {
677 // before being turned on, no packet can be transmitted
679 }
680}
681
682bool
684{
685 return false;
686}
687
688} // 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
AttributeValue implementation for Pointer.
Definition: pointer.h:48
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:1318
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:80
Ptr< WifiMac > m_mac
the wifi MAC
Definition: txop.h:561
Time GetTxopLimit() const
Return the TXOP limit.
Definition: txop.cc:486
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
Definition: txop.cc:160
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: txop.cc:560
virtual ChannelAccessStatus GetAccessStatus(uint8_t linkId) const
Definition: txop.cc:600
Ptr< WifiMacQueue > m_queue
the wifi MAC queue
Definition: txop.h:559
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:568
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the Txop has frames to transmit over the given link.
Definition: txop.cc:510
virtual void NotifyOff()
When off operation occurs, the queue gets cleaned up.
Definition: txop.cc:657
Ptr< UniformRandomVariable > m_rng
the random stream
Definition: txop.h:562
CwValueTracedCallback m_cwTrace
CW trace value.
Definition: txop.h:570
void DoDispose() override
Destructor implementation.
Definition: txop.cc:149
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:263
uint32_t GetMinCw() const
Return the minimum contention window size.
Definition: txop.cc:414
ChannelAccessStatus
Enumeration for channel access status.
Definition: txop.h:108
@ GRANTED
Definition: txop.h:111
@ NOT_REQUESTED
Definition: txop.h:109
@ REQUESTED
Definition: txop.h:110
virtual void NotifyOn()
When on operation occurs, channel access will be started.
Definition: txop.cc:672
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:308
static constexpr bool DIDNT_HAVE_FRAMES_TO_TRANSMIT
no packet available for transmission was in the queue
Definition: txop.h:423
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:227
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:205
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:664
virtual void NotifyChannelReleased(uint8_t linkId)
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: txop.cc:620
std::vector< uint32_t > GetMaxCws() const
Return the maximum contention window size for each link.
Definition: txop.cc:444
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: txop.cc:385
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:299
Txop()
Definition: txop.cc:131
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: txop.cc:166
virtual bool IsQosTxop() const
Check for QoS TXOP.
Definition: txop.cc:683
std::vector< uint32_t > GetMinCws() const
Return the minimum contention window size for each link.
Definition: txop.cc:420
std::vector< uint8_t > GetAifsns() const
Return the number of slots that make up an AIFS for each link.
Definition: txop.cc:468
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
Update backoff slots for the given link that nSlots has passed.
Definition: txop.cc:332
Time GetBackoffStart(uint8_t linkId) const
Return the time when the backoff procedure started on the given link.
Definition: txop.cc:326
void SetMaxCws(std::vector< uint32_t > maxCws)
Set the maximum contention window size for each link.
Definition: txop.cc:269
void SetTxopLimits(const std::vector< Time > &txopLimits)
Set the TXOP limit for each link.
Definition: txop.cc:391
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
Definition: txop.h:558
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
Definition: txop.cc:181
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:198
std::vector< Time > GetTxopLimits() const
Return the TXOP limit for each link.
Definition: txop.cc:492
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
Definition: txop.cc:175
static TypeId GetTypeId()
Get the type ID.
Definition: txop.cc:47
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:361
uint32_t GetCw(uint8_t linkId) const
Get the current value of the CW variable for the given link.
Definition: txop.cc:293
void SetMinCws(std::vector< uint32_t > minCws)
Set the minimum contention window size for each link.
Definition: txop.cc:239
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Definition: txop.cc:216
virtual void GenerateBackoff(uint8_t linkId)
Generate a new backoff for the given link now.
Definition: txop.cc:642
BackoffValueTracedCallback m_backoffTrace
backoff trace value
Definition: txop.h:569
virtual void NotifyAccessRequested(uint8_t linkId)
Notify that access request has been received for the given link.
Definition: txop.cc:606
void SetAifsns(std::vector< uint8_t > aifsns)
Set the number of slots that make up an AIFS for each link.
Definition: txop.cc:367
Ptr< MacTxMiddle > m_txMiddle
the MacTxMiddle
Definition: txop.h:560
static constexpr bool CHECK_MEDIUM_BUSY
generation of backoff (also) depends on the busy/idle state of the medium
Definition: txop.h:425
~Txop() override
Definition: txop.cc:143
void StartBackoffNow(uint32_t nSlots, uint8_t linkId)
Definition: txop.cc:343
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:613
std::map< uint8_t, std::unique_ptr< LinkEntity > > m_links
ID-indexed map of LinkEntity objects.
Definition: txop.h:581
void RequestAccess(uint8_t linkId)
Request access to the ChannelAccessManager associated with the given link.
Definition: txop.cc:632
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:233
uint8_t GetAifsn() const
Return the number of slots that make up an AIFS.
Definition: txop.cc:462
uint32_t GetBackoffSlots(uint8_t linkId) const
Return the current number of backoff slots on the given link.
Definition: txop.cc:320
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:519
virtual void NotifySleep(uint8_t linkId)
Notify that the given link switched to sleep mode.
Definition: txop.cc:651
static constexpr bool DONT_CHECK_MEDIUM_BUSY
generation of backoff is independent of the busy/idle state of the medium
Definition: txop.h:427
uint32_t GetMaxCw() const
Return the maximum contention window size.
Definition: txop.cc:438
void DoInitialize() override
Initialize() implementation.
Definition: txop.cc:589
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:932
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:259
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:630
#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.