A Discrete-Event Network Simulator
API
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 
22 #include "channel-access-manager.h"
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 
43 namespace ns3
44 {
45 
47 
49 
50 TypeId
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),
63  MakeUintegerAccessor((void(Txop::*)(uint32_t)) & Txop::SetMinCw,
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, std::list>(&Txop::SetMinCws,
73  MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint32_t>()))
74  .AddAttribute("MaxCw",
75  "The maximum value of the contention window (just for the first link, "
76  "in case of 11be multi-link devices).",
77  TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
78  UintegerValue(1023),
79  MakeUintegerAccessor((void(Txop::*)(uint32_t)) & Txop::SetMaxCw,
80  (uint32_t(Txop::*)() const) & Txop::GetMaxCw),
81  MakeUintegerChecker<uint32_t>())
82  .AddAttribute(
83  "MaxCws",
84  "The maximum values of the contention window for all the links",
85  TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
87  MakeAttributeContainerAccessor<UintegerValue, std::list>(&Txop::SetMaxCws,
89  MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint32_t>()))
90  .AddAttribute(
91  "Aifsn",
92  "The AIFSN: the default value conforms to non-QOS (just for the first link, "
93  "in case of 11be multi-link devices).",
94  TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
95  UintegerValue(2),
96  MakeUintegerAccessor((void(Txop::*)(uint8_t)) & Txop::SetAifsn,
97  (uint8_t(Txop::*)() const) & Txop::GetAifsn),
98  MakeUintegerChecker<uint8_t>())
99  .AddAttribute(
100  "Aifsns",
101  "The values of AIFSN for all the links",
102  TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
104  MakeAttributeContainerAccessor<UintegerValue, std::list>(&Txop::SetAifsns,
105  &Txop::GetAifsns),
106  MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()))
107  .AddAttribute("TxopLimit",
108  "The TXOP limit: the default value conforms to non-QoS "
109  "(just for the first link, in case of 11be multi-link devices).",
110  TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
113  (Time(Txop::*)() const) & Txop::GetTxopLimit),
114  MakeTimeChecker())
115  .AddAttribute(
116  "TxopLimits",
117  "The values of TXOP limit for all the links",
118  TypeId::ATTR_GET | TypeId::ATTR_SET, // do not set at construction time
120  MakeAttributeContainerAccessor<TimeValue, std::list>(&Txop::SetTxopLimits,
122  MakeAttributeContainerChecker<TimeValue>(MakeTimeChecker()))
123  .AddAttribute("Queue",
124  "The WifiMacQueue object",
125  PointerValue(),
127  MakePointerChecker<WifiMacQueue>())
128  .AddTraceSource("BackoffTrace",
129  "Trace source for backoff values",
131  "ns3::Txop::BackoffValueTracedCallback")
132  .AddTraceSource("CwTrace",
133  "Trace source for contention window values",
135  "ns3::Txop::CwValueTracedCallback");
136  return tid;
137 }
138 
141 {
142 }
143 
145  : m_queue(queue)
146 {
147  NS_LOG_FUNCTION(this);
148  m_rng = CreateObject<UniformRandomVariable>();
149 }
150 
152 {
153  NS_LOG_FUNCTION(this);
154 }
155 
156 void
158 {
159  NS_LOG_FUNCTION(this);
160  m_queue = nullptr;
161  m_mac = nullptr;
162  m_rng = nullptr;
163  m_txMiddle = nullptr;
164  m_links.clear();
165 }
166 
167 std::unique_ptr<Txop::LinkEntity>
169 {
170  return std::make_unique<LinkEntity>();
171 }
172 
174 Txop::GetLink(uint8_t linkId) const
175 {
176  NS_ASSERT(linkId < m_links.size());
177  NS_ASSERT(m_links.at(linkId)); // check that the pointer owns an object
178  return *m_links.at(linkId);
179 }
180 
181 uint8_t
183 {
184  return m_links.size();
185 }
186 
187 void
189 {
190  NS_LOG_FUNCTION(this);
191  m_txMiddle = txMiddle;
192 }
193 
194 void
196 {
197  NS_LOG_FUNCTION(this << mac);
198  m_mac = mac;
199  m_links.resize(m_mac->GetNLinks());
200  uint8_t linkId = 0;
201  for (auto& link : m_links)
202  {
203  link = CreateLinkEntity();
204  link->id = linkId++;
205  }
206 }
207 
208 void
210 {
211  NS_LOG_FUNCTION(this << &callback);
212  m_droppedMpduCallback = callback;
213  m_queue->TraceConnectWithoutContext("DropBeforeEnqueue",
215  m_queue->TraceConnectWithoutContext("Expired",
217 }
218 
221 {
222  NS_LOG_FUNCTION(this);
223  return m_queue;
224 }
225 
226 void
227 Txop::SetMinCw(uint32_t minCw)
228 {
229  SetMinCw(minCw, 0);
230 }
231 
232 void
233 Txop::SetMinCws(std::vector<uint32_t> minCws)
234 {
235  NS_ABORT_IF(minCws.size() != m_links.size());
236  for (std::size_t linkId = 0; linkId < minCws.size(); linkId++)
237  {
238  SetMinCw(minCws[linkId], linkId);
239  }
240 }
241 
242 void
243 Txop::SetMinCw(uint32_t minCw, uint8_t linkId)
244 {
245  NS_LOG_FUNCTION(this << minCw << +linkId);
246  auto& link = GetLink(linkId);
247  bool changed = (link.cwMin != minCw);
248  link.cwMin = minCw;
249  if (changed == true)
250  {
251  ResetCw(linkId);
252  }
253 }
254 
255 void
256 Txop::SetMaxCw(uint32_t maxCw)
257 {
258  SetMaxCw(maxCw, 0);
259 }
260 
261 void
262 Txop::SetMaxCws(std::vector<uint32_t> maxCws)
263 {
264  NS_ABORT_IF(maxCws.size() != m_links.size());
265  for (std::size_t linkId = 0; linkId < maxCws.size(); linkId++)
266  {
267  SetMaxCw(maxCws[linkId], linkId);
268  }
269 }
270 
271 void
272 Txop::SetMaxCw(uint32_t maxCw, uint8_t linkId)
273 {
274  NS_LOG_FUNCTION(this << maxCw << +linkId);
275  auto& link = GetLink(linkId);
276  bool changed = (link.cwMax != maxCw);
277  link.cwMax = maxCw;
278  if (changed == true)
279  {
280  ResetCw(linkId);
281  }
282 }
283 
284 uint32_t
285 Txop::GetCw(uint8_t linkId) const
286 {
287  return GetLink(linkId).cw;
288 }
289 
290 void
291 Txop::ResetCw(uint8_t linkId)
292 {
293  NS_LOG_FUNCTION(this);
294  auto& link = GetLink(linkId);
295  link.cw = GetMinCw(linkId);
296  m_cwTrace(link.cw, linkId);
297 }
298 
299 void
300 Txop::UpdateFailedCw(uint8_t linkId)
301 {
302  NS_LOG_FUNCTION(this);
303  auto& link = GetLink(linkId);
304  // see 802.11-2012, section 9.19.2.5
305  link.cw = std::min(2 * (link.cw + 1) - 1, GetMaxCw(linkId));
306  // if the MU EDCA timer is running, CW cannot be less than MU CW min
307  link.cw = std::max(link.cw, GetMinCw(linkId));
308  m_cwTrace(link.cw, linkId);
309 }
310 
311 uint32_t
312 Txop::GetBackoffSlots(uint8_t linkId) const
313 {
314  return GetLink(linkId).backoffSlots;
315 }
316 
317 Time
318 Txop::GetBackoffStart(uint8_t linkId) const
319 {
320  return GetLink(linkId).backoffStart;
321 }
322 
323 void
324 Txop::UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
325 {
326  NS_LOG_FUNCTION(this << nSlots << backoffUpdateBound << +linkId);
327  auto& link = GetLink(linkId);
328 
329  link.backoffSlots -= nSlots;
330  link.backoffStart = backoffUpdateBound;
331  NS_LOG_DEBUG("update slots=" << nSlots << " slots, backoff=" << link.backoffSlots);
332 }
333 
334 void
335 Txop::StartBackoffNow(uint32_t nSlots, uint8_t linkId)
336 {
337  NS_LOG_FUNCTION(this << nSlots << +linkId);
338  auto& link = GetLink(linkId);
339 
340  if (link.backoffSlots != 0)
341  {
342  NS_LOG_DEBUG("reset backoff from " << link.backoffSlots << " to " << nSlots << " slots");
343  }
344  else
345  {
346  NS_LOG_DEBUG("start backoff=" << nSlots << " slots");
347  }
348  link.backoffSlots = nSlots;
349  link.backoffStart = Simulator::Now();
350 }
351 
352 void
353 Txop::SetAifsn(uint8_t aifsn)
354 {
355  SetAifsn(aifsn, 0);
356 }
357 
358 void
359 Txop::SetAifsns(std::vector<uint8_t> aifsns)
360 {
361  NS_ABORT_IF(aifsns.size() != m_links.size());
362  for (std::size_t linkId = 0; linkId < aifsns.size(); linkId++)
363  {
364  SetAifsn(aifsns[linkId], linkId);
365  }
366 }
367 
368 void
369 Txop::SetAifsn(uint8_t aifsn, uint8_t linkId)
370 {
371  NS_LOG_FUNCTION(this << +aifsn << +linkId);
372  GetLink(linkId).aifsn = aifsn;
373 }
374 
375 void
377 {
378  SetTxopLimit(txopLimit, 0);
379 }
380 
381 void
382 Txop::SetTxopLimits(const std::vector<Time>& txopLimits)
383 {
384  NS_ABORT_MSG_IF(txopLimits.size() != m_links.size(),
385  "The size of the given vector (" << txopLimits.size()
386  << ") does not match the number of links ("
387  << m_links.size() << ")");
388  for (std::size_t linkId = 0; linkId < txopLimits.size(); linkId++)
389  {
390  SetTxopLimit(txopLimits[linkId], linkId);
391  }
392 }
393 
394 void
395 Txop::SetTxopLimit(Time txopLimit, uint8_t linkId)
396 {
397  NS_LOG_FUNCTION(this << txopLimit << +linkId);
398  NS_ASSERT_MSG((txopLimit.GetMicroSeconds() % 32 == 0),
399  "The TXOP limit must be expressed in multiple of 32 microseconds!");
400  GetLink(linkId).txopLimit = txopLimit;
401 }
402 
403 uint32_t
405 {
406  return GetMinCw(0);
407 }
408 
409 std::vector<uint32_t>
411 {
412  std::vector<uint32_t> ret;
413  for (std::size_t linkId = 0; linkId < m_links.size(); linkId++)
414  {
415  ret.push_back(GetMinCw(linkId));
416  }
417  return ret;
418 }
419 
420 uint32_t
421 Txop::GetMinCw(uint8_t linkId) const
422 {
423  return GetLink(linkId).cwMin;
424 }
425 
426 uint32_t
428 {
429  return GetMaxCw(0);
430 }
431 
432 std::vector<uint32_t>
434 {
435  std::vector<uint32_t> ret;
436  for (std::size_t linkId = 0; linkId < m_links.size(); linkId++)
437  {
438  ret.push_back(GetMaxCw(linkId));
439  }
440  return ret;
441 }
442 
443 uint32_t
444 Txop::GetMaxCw(uint8_t linkId) const
445 {
446  return GetLink(linkId).cwMax;
447 }
448 
449 uint8_t
451 {
452  return GetAifsn(0);
453 }
454 
455 std::vector<uint8_t>
457 {
458  std::vector<uint8_t> ret;
459  for (std::size_t linkId = 0; linkId < m_links.size(); linkId++)
460  {
461  ret.push_back(GetAifsn(linkId));
462  }
463  return ret;
464 }
465 
466 uint8_t
467 Txop::GetAifsn(uint8_t linkId) const
468 {
469  return GetLink(linkId).aifsn;
470 }
471 
472 Time
474 {
475  return GetTxopLimit(0);
476 }
477 
478 std::vector<Time>
480 {
481  std::vector<Time> ret;
482  for (std::size_t linkId = 0; linkId < m_links.size(); linkId++)
483  {
484  ret.push_back(GetTxopLimit(linkId));
485  }
486  return ret;
487 }
488 
489 Time
490 Txop::GetTxopLimit(uint8_t linkId) const
491 {
492  return GetLink(linkId).txopLimit;
493 }
494 
495 bool
497 {
498  m_queue->WipeAllExpiredMpdus();
499  bool ret = static_cast<bool>(m_queue->Peek(linkId));
500  NS_LOG_FUNCTION(this << +linkId << ret);
501  return ret;
502 }
503 
504 void
506 {
507  NS_LOG_FUNCTION(this << packet << &hdr);
508  // remove the priority tag attached, if any
509  SocketPriorityTag priorityTag;
510  packet->RemovePacketTag(priorityTag);
511  Queue(Create<WifiMpdu>(packet, hdr));
512 }
513 
514 void
516 {
517  NS_LOG_FUNCTION(this << *mpdu);
518  const auto linkIds =
519  m_mac->GetMacQueueScheduler()->GetLinkIds(m_queue->GetAc(),
521  for (const auto linkId : linkIds)
522  {
524  {
525  GenerateBackoff(linkId);
526  }
527  }
528  m_queue->Enqueue(mpdu);
529  for (const auto linkId : linkIds)
530  {
531  StartAccessIfNeeded(linkId);
532  }
533 }
534 
535 int64_t
536 Txop::AssignStreams(int64_t stream)
537 {
538  NS_LOG_FUNCTION(this << stream);
539  m_rng->SetStream(stream);
540  return 1;
541 }
542 
543 void
545 {
546  NS_LOG_FUNCTION(this << +linkId);
547  if (HasFramesToTransmit(linkId) && GetLink(linkId).access == NOT_REQUESTED)
548  {
550  }
551 }
552 
553 void
555 {
556  NS_LOG_FUNCTION(this);
557  for (std::size_t linkId = 0; linkId < m_links.size(); linkId++)
558  {
559  ResetCw(linkId);
560  GenerateBackoff(linkId);
561  }
562 }
563 
565 Txop::GetAccessStatus(uint8_t linkId) const
566 {
567  return GetLink(linkId).access;
568 }
569 
570 void
572 {
573  NS_LOG_FUNCTION(this << +linkId);
574  GetLink(linkId).access = REQUESTED;
575 }
576 
577 void
578 Txop::NotifyChannelAccessed(uint8_t linkId, Time txopDuration)
579 {
580  NS_LOG_FUNCTION(this << +linkId << txopDuration);
581  GetLink(linkId).access = GRANTED;
582 }
583 
584 void
586 {
587  NS_LOG_FUNCTION(this << +linkId);
588  GetLink(linkId).access = NOT_REQUESTED;
589  GenerateBackoff(linkId);
590  if (HasFramesToTransmit(linkId))
591  {
593  }
594 }
595 
596 void
597 Txop::RequestAccess(uint8_t linkId)
598 {
599  NS_LOG_FUNCTION(this << +linkId);
600  if (GetLink(linkId).access == NOT_REQUESTED)
601  {
603  }
604 }
605 
606 void
607 Txop::GenerateBackoff(uint8_t linkId)
608 {
609  NS_LOG_FUNCTION(this << +linkId);
610  uint32_t backoff = m_rng->GetInteger(0, GetCw(linkId));
611  m_backoffTrace(backoff, linkId);
612  StartBackoffNow(backoff, linkId);
613 }
614 
615 void
616 Txop::NotifySleep(uint8_t linkId)
617 {
618  NS_LOG_FUNCTION(this << +linkId);
619 }
620 
621 void
623 {
624  NS_LOG_FUNCTION(this);
625  m_queue->Flush();
626 }
627 
628 void
629 Txop::NotifyWakeUp(uint8_t linkId)
630 {
631  NS_LOG_FUNCTION(this << +linkId);
632  StartAccessIfNeeded(linkId);
633 }
634 
635 void
637 {
638  NS_LOG_FUNCTION(this);
639  for (std::size_t linkId = 0; linkId < m_links.size(); linkId++)
640  {
641  StartAccessIfNeeded(linkId);
642  }
643 }
644 
645 bool
647 {
648  return false;
649 }
650 
651 } // namespace ns3
#define min(a, b)
Definition: 80211b.c:42
#define max(a, b)
Definition: 80211b.c:43
A container for one type of attribute.
auto Bind(BoundArgs &&... bargs)
Bind a variable number of arguments.
Definition: callback.h:560
void RequestAccess(Ptr< Txop > txop)
bool NeedBackoffUponAccess(Ptr< Txop > txop)
Determine if a new backoff needs to be generated when a packet is queued for transmission.
A base class which provides memory management and object aggregation.
Definition: object.h:89
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:986
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:606
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:412
AttributeValue implementation for Time.
Definition: nstime.h:1423
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:71
virtual void StartAccessIfNeeded(uint8_t linkId)
Request access from Txop on the given link if needed.
Definition: txop.cc:544
Ptr< WifiMac > m_mac
the wifi MAC
Definition: txop.h:516
Time GetTxopLimit() const
Return the TXOP limit.
Definition: txop.cc:473
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
Definition: txop.cc:168
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: txop.cc:536
virtual ChannelAccessStatus GetAccessStatus(uint8_t linkId) const
Definition: txop.cc:565
Ptr< WifiMacQueue > m_queue
the wifi MAC queue
Definition: txop.h:514
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the Txop has frames to transmit over the given link.
Definition: txop.cc:496
virtual void NotifyOff()
When off operation occurs, the queue gets cleaned up.
Definition: txop.cc:622
Ptr< UniformRandomVariable > m_rng
the random stream
Definition: txop.h:517
CwValueTracedCallback m_cwTrace
CW trace value.
Definition: txop.h:525
void DoDispose() override
Destructor implementation.
Definition: txop.cc:157
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:256
uint32_t GetMinCw() const
Return the minimum contention window size.
Definition: txop.cc:404
ChannelAccessStatus
Enumeration for channel access status.
Definition: txop.h:99
@ GRANTED
Definition: txop.h:102
@ NOT_REQUESTED
Definition: txop.h:100
@ REQUESTED
Definition: txop.h:101
virtual void NotifyOn()
When on operation occurs, channel access will be started.
Definition: txop.cc:636
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:300
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:220
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:195
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:629
virtual void NotifyChannelReleased(uint8_t linkId)
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: txop.cc:585
std::vector< uint32_t > GetMaxCws() const
Return the maximum contention window size for each link.
Definition: txop.cc:433
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: txop.cc:376
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:291
Txop()
Definition: txop.cc:139
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: txop.cc:174
virtual bool IsQosTxop() const
Check for QoS TXOP.
Definition: txop.cc:646
std::vector< uint32_t > GetMinCws() const
Return the minimum contention window size for each link.
Definition: txop.cc:410
std::vector< uint8_t > GetAifsns() const
Return the number of slots that make up an AIFS for each link.
Definition: txop.cc:456
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
Update backoff slots for the given link that nSlots has passed.
Definition: txop.cc:324
Time GetBackoffStart(uint8_t linkId) const
Return the time when the backoff procedure started on the given link.
Definition: txop.cc:318
void SetMaxCws(std::vector< uint32_t > maxCws)
Set the maximum contention window size for each link.
Definition: txop.cc:262
void SetTxopLimits(const std::vector< Time > &txopLimits)
Set the TXOP limit for each link.
Definition: txop.cc:382
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
Definition: txop.h:513
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:188
std::vector< std::unique_ptr< LinkEntity > > m_links
vector of LinkEntity objects
Definition: txop.h:535
std::vector< Time > GetTxopLimits() const
Return the TXOP limit for each link.
Definition: txop.cc:479
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:353
uint32_t GetCw(uint8_t linkId) const
Get the current value of the CW variable for the given link.
Definition: txop.cc:285
void SetMinCws(std::vector< uint32_t > minCws)
Set the minimum contention window size for each link.
Definition: txop.cc:233
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Definition: txop.cc:209
virtual void GenerateBackoff(uint8_t linkId)
Generate a new backoff for the given link now.
Definition: txop.cc:607
BackoffValueTracedCallback m_backoffTrace
backoff trace value
Definition: txop.h:524
virtual void NotifyAccessRequested(uint8_t linkId)
Notify that access request has been received for the given link.
Definition: txop.cc:571
void SetAifsns(std::vector< uint8_t > aifsns)
Set the number of slots that make up an AIFS for each link.
Definition: txop.cc:359
Ptr< MacTxMiddle > m_txMiddle
the MacTxMiddle
Definition: txop.h:515
~Txop() override
Definition: txop.cc:151
void StartBackoffNow(uint32_t nSlots, uint8_t linkId)
Definition: txop.cc:335
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:578
void RequestAccess(uint8_t linkId)
Request access to the ChannelAccessManager associated with the given link.
Definition: txop.cc:597
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:227
uint8_t GetAifsn() const
Return the number of slots that make up an AIFS.
Definition: txop.cc:450
uint32_t GetBackoffSlots(uint8_t linkId) const
Return the current number of backoff slots on the given link.
Definition: txop.cc:312
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:505
virtual void NotifySleep(uint8_t linkId)
Notify that the given link switched to sleep mode.
Definition: txop.cc:616
uint32_t GetMaxCw() const
Return the maximum contention window size.
Definition: txop.cc:427
uint8_t GetNLinks() const
Get the number of links.
Definition: txop.cc:182
void DoInitialize() override
Initialize() implementation.
Definition: txop.cc:554
a unique identifier for an interface.
Definition: type-id.h:60
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:65
@ ATTR_SET
The attribute can be written.
Definition: type-id.h:66
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
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:550
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
Definition: wifi-mac.cc:906
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:846
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.
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)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:231
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1424
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
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:1348
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
@ AC_BE_NQOS
Non-QoS.
Definition: qos-utils.h:82
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:848
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:535
@ WIFI_MAC_DROP_FAILED_ENQUEUE
Definition: wifi-mac.h:76
@ WIFI_MAC_DROP_EXPIRED_LIFETIME
Definition: wifi-mac.h:77
mac
Definition: third.py:85