A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
txop.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef TXOP_H
10#define TXOP_H
11
12#include "wifi-mac-header.h"
13
14#include "ns3/nstime.h"
15#include "ns3/object.h"
16#include "ns3/traced-value.h"
17#include "ns3/uniform-random-bit-generator.h"
18
19#include <map>
20#include <memory>
21#include <vector>
22
23#define WIFI_TXOP_NS_LOG_APPEND_CONTEXT \
24 if (m_mac) \
25 { \
26 std::clog << "[mac=" << m_mac->GetAddress() << "] "; \
27 }
28
29class EmlsrUlTxopTest;
30
31namespace ns3
32{
33
34class Packet;
35class ChannelAccessManager;
36class MacTxMiddle;
37class WifiMode;
38class WifiMacQueue;
39class WifiMpdu;
40class UniformRandomVariable;
41class CtrlBAckResponseHeader;
42class WifiMac;
43enum AcIndex : uint8_t; // opaque enum declaration
44enum WifiMacDropReason : uint8_t; // opaque enum declaration
45
46/**
47 * \brief Handles the packet queue and stores DCF/EDCA access parameters
48 * (one Txop per AC).
49 * \ingroup wifi
50 *
51 * This class handles the packet queue and stores DCF/EDCA access
52 * parameters (one Txop per AC). It generates backoff values and stores the channel access status
53 * (not requested, requested, granted) for the corresponding DCF/EDCA and for each link.
54 */
55class Txop : public Object
56{
57 public:
58 Txop();
59 ~Txop() override;
60
61 /**
62 * \brief Get the type ID.
63 * \return the object TypeId
64 */
65 static TypeId GetTypeId();
66
67 /**
68 * typedef for a callback to invoke when an MPDU is dropped.
69 */
71
72 /**
73 * Enumeration for channel access status
74 */
81
82 /**
83 * Check for QoS TXOP.
84 *
85 * \returns true if QoS TXOP.
86 */
87 virtual bool IsQosTxop() const;
88
89 /**
90 * Set the wifi MAC this Txop is associated to.
91 *
92 * \param mac associated wifi MAC
93 */
94 virtual void SetWifiMac(const Ptr<WifiMac> mac);
95 /**
96 * Set MacTxMiddle this Txop is associated to.
97 *
98 * \param txMiddle MacTxMiddle to associate.
99 */
100 void SetTxMiddle(const Ptr<MacTxMiddle> txMiddle);
101
102 /**
103 * \param callback the callback to invoke when an MPDU is dropped
104 */
105 virtual void SetDroppedMpduCallback(DroppedMpdu callback);
106
107 /**
108 * Return the packet queue associated with this Txop.
109 *
110 * \return the associated WifiMacQueue
111 */
113
114 /**
115 * Set the minimum contention window size. For 11be multi-link devices,
116 * set the minimum contention window size on the first link.
117 *
118 * \param minCw the minimum contention window size.
119 */
120 void SetMinCw(uint32_t minCw);
121 /**
122 * Set the minimum contention window size for each link.
123 * Note that an empty <i>minCws</i> is ignored, otherwise its size must match the number
124 * of links.
125 *
126 * \param minCws the minimum contention window size for each link (links are sorted in
127 * increasing order of link ID).
128 */
129 void SetMinCws(const std::vector<uint32_t>& minCws);
130 /**
131 * Set the minimum contention window size for the given link. Note that this function can
132 * only be called after that links have been created.
133 *
134 * \param minCw the minimum contention window size.
135 * \param linkId the ID of the given link
136 */
137 void SetMinCw(uint32_t minCw, uint8_t linkId);
138 /**
139 * Set the maximum contention window size. For 11be multi-link devices,
140 * set the maximum contention window size on the first link.
141 *
142 * \param maxCw the maximum contention window size.
143 */
144 void SetMaxCw(uint32_t maxCw);
145 /**
146 * Set the maximum contention window size for each link.
147 * Note that an empty <i>maxCws</i> is ignored, otherwise its size must match the number
148 * of links.
149 *
150 * \param maxCws the maximum contention window size for each link (links are sorted in
151 * increasing order of link ID).
152 */
153 void SetMaxCws(const std::vector<uint32_t>& maxCws);
154 /**
155 * Set the maximum contention window size for the given link. Note that this function can
156 * only be called after that links have been created.
157 *
158 * \param maxCw the maximum contention window size.
159 * \param linkId the ID of the given link
160 */
161 void SetMaxCw(uint32_t maxCw, uint8_t linkId);
162 /**
163 * Set the number of slots that make up an AIFS. For 11be multi-link devices,
164 * set the number of slots that make up an AIFS on the first link.
165 *
166 * \param aifsn the number of slots that make up an AIFS.
167 */
168 void SetAifsn(uint8_t aifsn);
169 /**
170 * Set the number of slots that make up an AIFS for each link.
171 * Note that an empty <i>aifsns</i> is ignored, otherwise its size must match the number
172 * of links.
173 *
174 * \param aifsns the number of slots that make up an AIFS for each link (links are sorted in
175 * increasing order of link ID).
176 */
177 void SetAifsns(const std::vector<uint8_t>& aifsns);
178 /**
179 * Set the number of slots that make up an AIFS for the given link. Note that this function
180 * can only be called after that links have been created.
181 *
182 * \param aifsn the number of slots that make up an AIFS.
183 * \param linkId the ID of the given link
184 */
185 void SetAifsn(uint8_t aifsn, uint8_t linkId);
186 /**
187 * Set the TXOP limit.
188 *
189 * \param txopLimit the TXOP limit.
190 * Value zero corresponds to default Txop.
191 */
192 void SetTxopLimit(Time txopLimit);
193 /**
194 * Set the TXOP limit for each link.
195 * Note that an empty <i>txopLimits</i> is ignored, otherwise its size must match the number
196 * of links.
197 *
198 * \param txopLimits the TXOP limit for each link (links are sorted in increasing order of
199 * link ID).
200 */
201 void SetTxopLimits(const std::vector<Time>& txopLimits);
202 /**
203 * Set the TXOP limit for the given link. Note that this function can only be called after
204 * that links have been created.
205 *
206 * \param txopLimit the TXOP limit (must not be negative)
207 * \param linkId the ID of the given link
208 */
209 void SetTxopLimit(Time txopLimit, uint8_t linkId);
210 /**
211 * Return the minimum contention window size. For 11be multi-link devices,
212 * return the minimum contention window size on the first link.
213 *
214 * \return the minimum contention window size.
215 */
216 uint32_t GetMinCw() const;
217 /**
218 * Return the minimum contention window size for each link.
219 *
220 * \return the minimum contention window size values.
221 */
222 std::vector<uint32_t> GetMinCws() const;
223 /**
224 * Return the minimum contention window size for the given link.
225 *
226 * \param linkId the ID of the given link
227 * \return the minimum contention window size.
228 */
229 virtual uint32_t GetMinCw(uint8_t linkId) const;
230 /**
231 * Return the maximum contention window size. For 11be multi-link devices,
232 * return the maximum contention window size on the first link.
233 *
234 * \return the maximum contention window size.
235 */
236 uint32_t GetMaxCw() const;
237 /**
238 * Return the maximum contention window size for each link.
239 *
240 * \return the maximum contention window size values.
241 */
242 std::vector<uint32_t> GetMaxCws() const;
243 /**
244 * Return the maximum contention window size for the given link.
245 *
246 * \param linkId the ID of the given link
247 * \return the maximum contention window size.
248 */
249 virtual uint32_t GetMaxCw(uint8_t linkId) const;
250 /**
251 * Return the number of slots that make up an AIFS. For 11be multi-link devices,
252 * return the number of slots that make up an AIFS on the first link.
253 *
254 * \return the number of slots that make up an AIFS.
255 */
256 uint8_t GetAifsn() const;
257 /**
258 * Return the number of slots that make up an AIFS for each link.
259 *
260 * \return the number of slots that make up an AIFS for each link.
261 */
262 std::vector<uint8_t> GetAifsns() const;
263 /**
264 * Return the number of slots that make up an AIFS for the given link.
265 *
266 * \param linkId the ID of the given link
267 * \return the number of slots that make up an AIFS.
268 */
269 virtual uint8_t GetAifsn(uint8_t linkId) const;
270 /**
271 * Return the TXOP limit.
272 *
273 * \return the TXOP limit.
274 */
275 Time GetTxopLimit() const;
276 /**
277 * Return the TXOP limit for each link.
278 *
279 * \return the TXOP limit for each link.
280 */
281 std::vector<Time> GetTxopLimits() const;
282 /**
283 * Return the TXOP limit for the given link.
284 *
285 * \param linkId the ID of the given link
286 * \return the TXOP limit.
287 */
288 Time GetTxopLimit(uint8_t linkId) const;
289 /**
290 * Update the value of the CW variable for the given link to take into account
291 * a transmission success or a transmission abort (stop transmission
292 * of a packet after the maximum number of retransmissions has been
293 * reached). By default, this resets the CW variable to minCW.
294 *
295 * \param linkId the ID of the given link
296 */
297 void ResetCw(uint8_t linkId);
298 /**
299 * Update the value of the CW variable for the given link to take into account
300 * a transmission failure. By default, this triggers a doubling
301 * of CW (capped by maxCW).
302 *
303 * \param linkId the ID of the given link
304 */
305 void UpdateFailedCw(uint8_t linkId);
306
307 /**
308 * Notify that the given link switched to sleep mode.
309 *
310 * \param linkId the ID of the given link
311 */
312 virtual void NotifySleep(uint8_t linkId);
313 /**
314 * When off operation occurs, the queue gets cleaned up.
315 */
316 virtual void NotifyOff();
317 /**
318 * When wake up operation occurs on a link, channel access on that link
319 * will be restarted.
320 *
321 * \param linkId the ID of the link
322 */
323 virtual void NotifyWakeUp(uint8_t linkId);
324 /**
325 * When on operation occurs, channel access will be started.
326 */
327 virtual void NotifyOn();
328
329 /* Event handlers */
330 /**
331 * \param mpdu the given MPDU
332 *
333 * Store the given MPDU in the internal queue until it
334 * can be sent safely.
335 */
336 virtual void Queue(Ptr<WifiMpdu> mpdu);
337
338 /**
339 * Called by the FrameExchangeManager to notify that channel access has
340 * been granted on the given link for the given amount of time.
341 *
342 * \param linkId the ID of the given link
343 * \param txopDuration the duration of the TXOP gained (zero for DCF)
344 */
345 virtual void NotifyChannelAccessed(uint8_t linkId, Time txopDuration = Seconds(0));
346 /**
347 * Called by the FrameExchangeManager to notify the completion of the transmissions.
348 * This method generates a new backoff and restarts access if needed.
349 *
350 * \param linkId the ID of the link the FrameExchangeManager is operating on
351 */
352 virtual void NotifyChannelReleased(uint8_t linkId);
353
354 /**
355 * Assign a fixed random variable stream number to the random variables
356 * used by this model. Return the number of streams (possibly zero) that
357 * have been assigned.
358 *
359 * \param stream first stream index to use.
360 *
361 * \return the number of stream indices assigned by this model.
362 */
363 int64_t AssignStreams(int64_t stream);
364
365 /**
366 * \param linkId the ID of the given link
367 * \return the current channel access status for the given link
368 */
369 virtual ChannelAccessStatus GetAccessStatus(uint8_t linkId) const;
370
371 /**
372 * Request channel access on the given link after the occurrence of an event that possibly
373 * requires to generate a new backoff value. Examples of such an event are: a packet has been
374 * enqueued by the upper layer; the given link has been unblocked after being blocked for some
375 * reason (e.g., wait for ADDBA Response, wait for TX on another EMLSR link to finish, etc.);
376 * the PHY operating on the given link just woke up from sleep mode. The <i>checkMediumBusy</i>
377 * argument is forwarded to the NeedBackoffUponAccess method of the ChannelAccessManager.
378 *
379 * \param linkId the ID of the given link
380 * \param hadFramesToTransmit whether packets available for transmission were queued just
381 * before the occurrence of the event causing this channel access
382 * request
383 * \param checkMediumBusy whether generation of backoff (also) depends on the busy/idle state
384 * of the medium
385 */
386 void StartAccessAfterEvent(uint8_t linkId, bool hadFramesToTransmit, bool checkMediumBusy);
387
388 static constexpr bool HAD_FRAMES_TO_TRANSMIT =
389 true; //!< packets available for transmission were in the queue
390 static constexpr bool DIDNT_HAVE_FRAMES_TO_TRANSMIT =
391 false; //!< no packet available for transmission was in the queue
392 static constexpr bool CHECK_MEDIUM_BUSY =
393 true; //!< generation of backoff (also) depends on the busy/idle state of the medium
394 static constexpr bool DONT_CHECK_MEDIUM_BUSY =
395 false; //!< generation of backoff is independent of the busy/idle state of the medium
396
397 /**
398 * \param nSlots the number of slots of the backoff.
399 * \param linkId the ID of the given link
400 *
401 * Start a backoff for the given link by initializing the backoff counter to
402 * the number of slots specified.
403 */
404 void StartBackoffNow(uint32_t nSlots, uint8_t linkId);
405
406 /**
407 * Check if the Txop has frames to transmit over the given link
408 * \param linkId the ID of the given link.
409 * \return true if the Txop has frames to transmit.
410 */
411 virtual bool HasFramesToTransmit(uint8_t linkId);
412
413 /**
414 * Swap the links based on the information included in the given map. This method
415 * is normally called by the WifiMac of a non-AP MLD upon completing ML setup to have
416 * its link IDs match AP MLD's link IDs.
417 *
418 * \param links a set of pairs (from, to) each mapping a current link ID to the
419 * link ID it has to become (i.e., link 'from' becomes link 'to')
420 */
421 void SwapLinks(std::map<uint8_t, uint8_t> links);
422
423 /**
424 * DCF/EDCA access parameters for all the links provided by users via this class' attributes
425 * or the corresponding setter methods. For each access parameter, values are sorted in
426 * increasing order of link ID. If user provides access parameters, they are used by WifiMac
427 * instead of the default values specified by Table 9-155 of 802.11-2020.
428 */
430 {
431 std::vector<uint32_t> cwMins; //!< the minimum contention window values for all the links
432 std::vector<uint32_t> cwMaxs; //!< the maximum contention window values for all the links
433 std::vector<uint8_t> aifsns; //!< the AIFSN values for all the links
434 std::vector<Time> txopLimits; //!< TXOP limit values for all the links
435 };
436
437 /**
438 * \return a const reference to user-provided access parameters
439 */
441
442 protected:
443 ///< ChannelAccessManager associated class
445 friend class ::EmlsrUlTxopTest;
446
447 void DoDispose() override;
448 void DoInitialize() override;
449
450 /**
451 * Create a wifi MAC queue containing packets of the given AC
452 *
453 * \param aci the index of the given AC
454 */
455 virtual void CreateQueue(AcIndex aci);
456
457 /* Txop notifications forwarded here */
458 /**
459 * Notify that access request has been received for the given link.
460 *
461 * \param linkId the ID of the given link
462 */
463 virtual void NotifyAccessRequested(uint8_t linkId);
464
465 /**
466 * Generate a new backoff for the given link now.
467 *
468 * \param linkId the ID of the given link
469 */
470 virtual void GenerateBackoff(uint8_t linkId);
471 /**
472 * Request access to the ChannelAccessManager associated with the given link
473 *
474 * \param linkId the ID of the given link
475 */
476 void RequestAccess(uint8_t linkId);
477
478 /**
479 * Get the current value of the CW variable for the given link. The initial
480 * value is minCw.
481 *
482 * \param linkId the ID of the given link
483 * \return the current value of the CW variable for the given link
484 */
485 uint32_t GetCw(uint8_t linkId) const;
486 /**
487 * Return the current number of backoff slots on the given link.
488 *
489 * \param linkId the ID of the given link
490 * \return the current number of backoff slots
491 */
492 uint32_t GetBackoffSlots(uint8_t linkId) const;
493 /**
494 * Return the time when the backoff procedure started on the given link.
495 *
496 * \param linkId the ID of the given link
497 * \return the time when the backoff procedure started
498 */
499 Time GetBackoffStart(uint8_t linkId) const;
500 /**
501 * Update backoff slots for the given link that nSlots has passed.
502 *
503 * \param nSlots the number of slots to decrement
504 * \param backoffUpdateBound the time at which backoff should start
505 * \param linkId the ID of the given link
506 */
507 void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId);
508
509 /**
510 * Structure holding information specific to a single link. Here, the meaning of
511 * "link" is that of the 11be amendment which introduced multi-link devices. For
512 * previous amendments, only one link can be created.
513 */
515 {
516 /// Destructor (a virtual method is needed to make this struct polymorphic)
517 virtual ~LinkEntity() = default;
518
519 uint32_t backoffSlots{0}; //!< the number of backoff slots
520 Time backoffStart{0}; /**< the backoffStart variable is used to keep
521 track of the time at which a backoff was
522 started or the time at which the backoff
523 counter was last updated */
524 uint32_t cw{0}; //!< the current contention window
525 uint32_t cwMin{0}; //!< the minimum contention window
526 uint32_t cwMax{0}; //!< the maximum contention window
527 uint8_t aifsn{0}; //!< the AIFSN
528 Time txopLimit{0}; //!< the TXOP limit time
529 ChannelAccessStatus access{NOT_REQUESTED}; //!< channel access status
530
531 mutable class
532 {
533 friend void Txop::Queue(Ptr<WifiMpdu>);
535 } accessRequest; //!< access request event, to be used by Txop::Queue() only
536 };
537
538 /**
539 * Get a reference to the link associated with the given ID.
540 *
541 * \param linkId the given link ID
542 * \return a reference to the link associated with the given ID
543 */
544 LinkEntity& GetLink(uint8_t linkId) const;
545
546 /**
547 * \return a const reference to the map of link entities
548 */
549 const std::map<uint8_t, std::unique_ptr<LinkEntity>>& GetLinks() const;
550
551 DroppedMpdu m_droppedMpduCallback; //!< the dropped MPDU callback
552 Ptr<WifiMacQueue> m_queue; //!< the wifi MAC queue
553 Ptr<MacTxMiddle> m_txMiddle; //!< the MacTxMiddle
554 Ptr<WifiMac> m_mac; //!< the wifi MAC
555 Ptr<UniformRandomVariable> m_rng; //!< the random stream
556 UniformRandomBitGenerator m_shuffleLinkIdsGen; //!< random number generator to shuffle link IDs
557
558 /// TracedCallback for backoff trace value typedef
559 typedef TracedCallback<uint32_t /* value */, uint8_t /* linkId */> BackoffValueTracedCallback;
560 /// TracedCallback for CW trace value typedef
561 typedef TracedCallback<uint32_t /* value */, uint8_t /* linkId */> CwValueTracedCallback;
562
564 CwValueTracedCallback m_cwTrace; //!< CW trace value
565
566 private:
567 /**
568 * Create a LinkEntity object.
569 *
570 * \return a unique pointer to the created LinkEntity object
571 */
572 virtual std::unique_ptr<LinkEntity> CreateLinkEntity() const;
573
574 std::map<uint8_t, std::unique_ptr<LinkEntity>>
575 m_links; //!< ID-indexed map of LinkEntity objects
576
577 UserDefinedAccessParams m_userAccessParams; //!< user-defined DCF/EDCA access parameters
578};
579
580} // namespace ns3
581
582#endif /* TXOP_H */
Test the transmission of UL frames from EMLSR clients.
Callback template class.
Definition callback.h:422
Manage a set of ns3::Txop.
An identifier for simulation events.
Definition event-id.h:45
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
Handles the packet queue and stores DCF/EDCA access parameters (one Txop per AC).
Definition txop.h:56
Ptr< WifiMac > m_mac
the wifi MAC
Definition txop.h:554
Time GetTxopLimit() const
Return the TXOP limit.
Definition txop.cc:579
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
Definition txop.cc:197
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition txop.cc:674
virtual ChannelAccessStatus GetAccessStatus(uint8_t linkId) const
Definition txop.cc:726
Ptr< WifiMacQueue > m_queue
the wifi MAC queue
Definition txop.h:552
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:682
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the Txop has frames to transmit over the given link.
Definition txop.cc:603
virtual void NotifyOff()
When off operation occurs, the queue gets cleaned up.
Definition txop.cc:783
UniformRandomBitGenerator m_shuffleLinkIdsGen
random number generator to shuffle link IDs
Definition txop.h:556
Ptr< UniformRandomVariable > m_rng
the random stream
Definition txop.h:555
CwValueTracedCallback m_cwTrace
CW trace value.
Definition txop.h:564
void DoDispose() override
Destructor implementation.
Definition txop.cc:178
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition txop.cc:313
void SetMaxCws(const std::vector< uint32_t > &maxCws)
Set the maximum contention window size for each link.
Definition txop.cc:319
uint32_t GetMinCw() const
Return the minimum contention window size.
Definition txop.cc:507
ChannelAccessStatus
Enumeration for channel access status.
Definition txop.h:76
@ GRANTED
Definition txop.h:79
@ NOT_REQUESTED
Definition txop.h:77
@ REQUESTED
Definition txop.h:78
virtual void NotifyOn()
When on operation occurs, channel access will be started.
Definition txop.cc:798
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:371
void SetAifsns(const std::vector< uint8_t > &aifsns)
Set the number of slots that make up an AIFS for each link.
Definition txop.cc:430
static constexpr bool DIDNT_HAVE_FRAMES_TO_TRANSMIT
no packet available for transmission was in the queue
Definition txop.h:390
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition txop.cc:264
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition txop.cc:242
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:790
virtual void NotifyChannelReleased(uint8_t linkId)
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition txop.cc:746
std::vector< uint32_t > GetMaxCws() const
Return the maximum contention window size for each link.
Definition txop.cc:537
virtual void Queue(Ptr< WifiMpdu > mpdu)
Definition txop.cc:612
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition txop.cc:461
virtual void CreateQueue(AcIndex aci)
Create a wifi MAC queue containing packets of the given AC.
Definition txop.cc:189
TracedCallback< uint32_t, uint8_t > BackoffValueTracedCallback
TracedCallback for backoff trace value typedef.
Definition txop.h:559
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:362
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition txop.cc:203
virtual bool IsQosTxop() const
Check for QoS TXOP.
Definition txop.cc:809
std::vector< uint32_t > GetMinCws() const
Return the minimum contention window size for each link.
Definition txop.cc:513
std::vector< uint8_t > GetAifsns() const
Return the number of slots that make up an AIFS for each link.
Definition txop.cc:561
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
Update backoff slots for the given link that nSlots has passed.
Definition txop.cc:395
TracedCallback< uint32_t, uint8_t > CwValueTracedCallback
TracedCallback for CW trace value typedef.
Definition txop.h:561
Time GetBackoffStart(uint8_t linkId) const
Return the time when the backoff procedure started on the given link.
Definition txop.cc:389
void SetTxopLimits(const std::vector< Time > &txopLimits)
Set the TXOP limit for each link.
Definition txop.cc:467
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
Definition txop.h:551
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
Definition txop.cc:218
const UserDefinedAccessParams & GetUserAccessParams() const
Definition txop.cc:501
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition txop.cc:235
std::vector< Time > GetTxopLimits() const
Return the TXOP limit for each link.
Definition txop.cc:585
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
Definition txop.cc:212
static TypeId GetTypeId()
Get the type ID.
Definition txop.cc:40
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition txop.cc:424
uint32_t GetCw(uint8_t linkId) const
Get the current value of the CW variable for the given link.
Definition txop.cc:356
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Definition txop.cc:253
UserDefinedAccessParams m_userAccessParams
user-defined DCF/EDCA access parameters
Definition txop.h:577
virtual void GenerateBackoff(uint8_t linkId)
Generate a new backoff for the given link now.
Definition txop.cc:768
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:732
Ptr< MacTxMiddle > m_txMiddle
the MacTxMiddle
Definition txop.h:553
static constexpr bool CHECK_MEDIUM_BUSY
generation of backoff (also) depends on the busy/idle state of the medium
Definition txop.h:392
~Txop() override
Definition txop.cc:172
void StartBackoffNow(uint32_t nSlots, uint8_t linkId)
Definition txop.cc:406
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:739
std::map< uint8_t, std::unique_ptr< LinkEntity > > m_links
ID-indexed map of LinkEntity objects.
Definition txop.h:575
void SetMinCws(const std::vector< uint32_t > &minCws)
Set the minimum contention window size for each link.
Definition txop.cc:276
void RequestAccess(uint8_t linkId)
Request access to the ChannelAccessManager associated with the given link.
Definition txop.cc:758
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition txop.cc:270
uint8_t GetAifsn() const
Return the number of slots that make up an AIFS.
Definition txop.cc:555
uint32_t GetBackoffSlots(uint8_t linkId) const
Return the current number of backoff slots on the given link.
Definition txop.cc:383
virtual void NotifySleep(uint8_t linkId)
Notify that the given link switched to sleep mode.
Definition txop.cc:777
static constexpr bool DONT_CHECK_MEDIUM_BUSY
generation of backoff is independent of the busy/idle state of the medium
Definition txop.h:394
uint32_t GetMaxCw() const
Return the maximum contention window size.
Definition txop.cc:531
static constexpr bool HAD_FRAMES_TO_TRANSMIT
packets available for transmission were in the queue
Definition txop.h:388
Callback< void, WifiMacDropReason, Ptr< const WifiMpdu > > DroppedMpdu
typedef for a callback to invoke when an MPDU is dropped.
Definition txop.h:70
void DoInitialize() override
Initialize() implementation.
Definition txop.cc:715
a unique identifier for an interface.
Definition type-id.h:48
Wraps a UniformRandomVariable into a class that meets the requirements of a UniformRandomBitGenerator...
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
WifiMacDropReason
The reason why an MPDU was dropped.
Definition wifi-mac.h:70
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:62
Every class exported by the ns3 library is enclosed in the ns3 namespace.
DCF/EDCA access parameters for all the links provided by users via this class' attributes or the corr...
Definition txop.h:430
std::vector< uint32_t > cwMins
the minimum contention window values for all the links
Definition txop.h:431
std::vector< uint8_t > aifsns
the AIFSN values for all the links
Definition txop.h:433
std::vector< uint32_t > cwMaxs
the maximum contention window values for all the links
Definition txop.h:432
std::vector< Time > txopLimits
TXOP limit values for all the links.
Definition txop.h:434