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