A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-mac.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 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 WIFI_MAC_H
21#define WIFI_MAC_H
22
23#include "qos-utils.h"
24#include "ssid.h"
27#include "wifi-standards.h"
28
29#include <functional>
30#include <list>
31#include <map>
32#include <memory>
33#include <optional>
34#include <set>
35#include <unordered_map>
36#include <vector>
37
38namespace ns3
39{
40
41class Txop;
42class WifiNetDevice;
43class QosTxop;
44class WifiPsdu;
45class MacRxMiddle;
46class MacTxMiddle;
47class WifiMacQueue;
48class WifiMpdu;
49class HtConfiguration;
50class VhtConfiguration;
51class HeConfiguration;
52class EhtConfiguration;
53class FrameExchangeManager;
54class ChannelAccessManager;
55class ExtendedCapabilities;
56class OriginatorBlockAckAgreement;
57class RecipientBlockAckAgreement;
58
59/**
60 * \ingroup wifi
61 * Enumeration for type of WiFi station
62 */
64{
69 OCB
70};
71
72/**
73 * \ingroup wifi
74 * \brief The reason why an MPDU was dropped
75 */
76enum WifiMacDropReason : uint8_t
77{
82};
83
84typedef std::unordered_map<uint16_t /* staId */, Ptr<WifiPsdu> /* PSDU */> WifiPsduMap;
85
86/**
87 * \brief base class for all MAC-level wifi objects.
88 * \ingroup wifi
89 *
90 * This class encapsulates all the low-level MAC functionality
91 * DCA, EDCA, etc) and all the high-level MAC functionality
92 * (association/disassociation state machines).
93 *
94 */
95class WifiMac : public Object
96{
97 public:
98 /**
99 * \brief Get the type ID.
100 * \return the object TypeId
101 */
102 static TypeId GetTypeId();
103
104 WifiMac();
105 ~WifiMac() override;
106
107 // Delete copy constructor and assignment operator to avoid misuse
108 WifiMac(const WifiMac&) = delete;
109 WifiMac& operator=(const WifiMac&) = delete;
110
111 /**
112 * Sets the device this PHY is associated with.
113 *
114 * \param device the device this PHY is associated with
115 */
116 void SetDevice(const Ptr<WifiNetDevice> device);
117 /**
118 * Return the device this PHY is associated with
119 *
120 * \return the device this PHY is associated with
121 */
123
124 /**
125 * Get the Frame Exchange Manager associated with the given link
126 *
127 * \param linkId the ID of the given link
128 * \return the Frame Exchange Manager
129 */
131
132 /**
133 * Get the Channel Access Manager associated with the given link
134 *
135 * \param linkId the ID of the given link
136 * \return the Channel Access Manager
137 */
139
140 /**
141 * Get the number of links (can be greater than 1 for 11be devices only).
142 *
143 * \return the number of links used by this MAC
144 */
145 uint8_t GetNLinks() const;
146
147 /**
148 * \return the set of link IDs in use by this device
149 */
150 const std::set<uint8_t>& GetLinkIds() const;
151
152 /**
153 * Get the ID of the link having the given MAC address, if any.
154 *
155 * \param address the given MAC address
156 * \return the ID of the link having the given MAC address, if any
157 */
158 virtual std::optional<uint8_t> GetLinkIdByAddress(const Mac48Address& address) const;
159
160 /**
161 * Get the ID of the link (if any) on which the given PHY is operating.
162 *
163 * \param phy the given PHY
164 * \return the ID of the link (if any) on which the given PHY is operating
165 */
166 std::optional<uint8_t> GetLinkForPhy(Ptr<const WifiPhy> phy) const;
167
168 /**
169 * Get the ID of the link (if any) on which the given PHY is operating.
170 *
171 * \param phyId the index of the given PHY in the vector of PHYs held by WifiNetDevice
172 * \return the ID of the link (if any) on which the given PHY is operating
173 */
174 std::optional<uint8_t> GetLinkForPhy(std::size_t phyId) const;
175
176 /**
177 * \param remoteAddr the (MLD or link) address of a remote device
178 * \return the MLD address of the remote device having the given (MLD or link) address, if
179 * the remote device is an MLD.
180 */
181 std::optional<Mac48Address> GetMldAddress(const Mac48Address& remoteAddr) const;
182
183 /**
184 * Get the local MAC address used to communicate with a remote STA. Specifically:
185 * - If the given remote address is the address of a STA affiliated with a remote MLD
186 * and operating on a setup link, the address of the local STA operating on such a link
187 * is returned.
188 * - If the given remote address is the MLD address of a remote MLD (with which some link
189 * has been setup), the MLD address of this device is returned.
190 * - If this is a single link device, the unique MAC address of this device is returned.
191 * - Otherwise, return the MAC address of the affiliated STA (which must exists) that
192 * can be used to communicate with the remote device.
193 *
194 * \param remoteAddr the MAC address of the remote device
195 * \return the local MAC address used to communicate with the remote device
196 */
197 Mac48Address GetLocalAddress(const Mac48Address& remoteAddr) const;
198
199 /**
200 * Accessor for the Txop object
201 *
202 * \return a smart pointer to Txop
203 */
204 Ptr<Txop> GetTxop() const;
205 /**
206 * Accessor for a specified EDCA object
207 *
208 * \param ac the Access Category
209 * \return a smart pointer to a QosTxop
210 */
212 /**
213 * Accessor for a specified EDCA object
214 *
215 * \param tid the Traffic ID
216 * \return a smart pointer to a QosTxop
217 */
218 Ptr<QosTxop> GetQosTxop(uint8_t tid) const;
219 /**
220 * Get the wifi MAC queue of the (Qos)Txop associated with the given AC,
221 * if such (Qos)Txop is installed, or a null pointer, otherwise.
222 *
223 * \param ac the given Access Category
224 * \return the wifi MAC queue of the (Qos)Txop associated with the given AC,
225 * if such (Qos)Txop is installed, or a null pointer, otherwise
226 */
227 virtual Ptr<WifiMacQueue> GetTxopQueue(AcIndex ac) const;
228
229 /**
230 * Check if the MAC has frames to transmit over the given link
231 * \param linkId the ID of the given link.
232 * \return whether the MAC has frames to transmit.
233 */
234 virtual bool HasFramesToTransmit(uint8_t linkId);
235
236 /**
237 * Set the wifi MAC queue scheduler
238 *
239 * \param scheduler the wifi MAC queue scheduler
240 */
241 virtual void SetMacQueueScheduler(Ptr<WifiMacQueueScheduler> scheduler);
242 /**
243 * Get the wifi MAC queue scheduler
244 *
245 * \return the wifi MAC queue scheduler
246 */
248
249 /**
250 * This method is invoked by a subclass to specify what type of
251 * station it is implementing. This is something that the channel
252 * access functions need to know.
253 *
254 * \param type the type of station.
255 */
257 /**
258 * Return the type of station.
259 *
260 * \return the type of station.
261 */
263
264 /**
265 * \param ssid the current SSID of this MAC layer.
266 */
267 void SetSsid(Ssid ssid);
268 /**
269 * \brief Sets the interface in promiscuous mode.
270 *
271 * Enables promiscuous mode on the interface. Note that any further
272 * filtering on the incoming frame path may affect the overall
273 * behavior.
274 */
275 void SetPromisc();
276 /**
277 * Enable or disable CTS-to-self feature.
278 *
279 * \param enable true if CTS-to-self is to be supported,
280 * false otherwise
281 */
282 void SetCtsToSelfSupported(bool enable);
283
284 /**
285 * \return the MAC address associated to this MAC layer.
286 */
287 Mac48Address GetAddress() const;
288 /**
289 * \return the SSID which this MAC layer is going to try to stay in.
290 */
291 Ssid GetSsid() const;
292 /**
293 * \param address the current address of this MAC layer.
294 */
295 virtual void SetAddress(Mac48Address address);
296 /**
297 * \return the BSSID of the network the given link belongs to.
298 * \param linkId the ID of the given link
299 */
300 Mac48Address GetBssid(uint8_t linkId) const;
301 /**
302 * \param bssid the BSSID of the network that the given link belongs to.
303 * \param linkId the ID of the given link
304 */
305 void SetBssid(Mac48Address bssid, uint8_t linkId);
306
307 /**
308 * Block the transmission on the given links of all unicast frames addressed to
309 * the station with the given address for the given reason. The given MAC address
310 * must be the MLD address in case the addressed device is multi-link.
311 *
312 * \param reason the reason for blocking transmissions
313 * \param address the MAC address of the given device
314 * \param linkIds the IDs of the links to block
315 */
317 const Mac48Address& address,
318 const std::set<uint8_t>& linkIds);
319
320 /**
321 * Unblock the transmission on the given links of all unicast frames addressed to
322 * the station with the given address for the given reason. The given MAC address
323 * must be the MLD address in case the addressed device is multi-link.
324 *
325 * \param reason the reason for unblocking transmissions
326 * \param address the MAC address of the given device
327 * \param linkIds the IDs of the links to unblock
328 */
330 const Mac48Address& address,
331 const std::set<uint8_t>& linkIds);
332
333 /**
334 * Return true if packets can be forwarded to the given destination,
335 * false otherwise.
336 *
337 * \param to the address to which the packet should be sent
338 * \return whether packets can be forwarded to the given destination
339 */
340 virtual bool CanForwardPacketsTo(Mac48Address to) const = 0;
341 /**
342 * \param packet the packet to send.
343 * \param to the address to which the packet should be sent.
344 * \param from the address from which the packet should be sent.
345 *
346 * The packet should be enqueued in a TX queue, and should be
347 * dequeued as soon as the DCF function determines that
348 * access it granted to this MAC. The extra parameter "from" allows
349 * this device to operate in a bridged mode, forwarding received
350 * frames without altering the source address.
351 */
352 virtual void Enqueue(Ptr<Packet> packet, Mac48Address to, Mac48Address from);
353 /**
354 * \param packet the packet to send.
355 * \param to the address to which the packet should be sent.
356 *
357 * The packet should be enqueued in a TX queue, and should be
358 * dequeued as soon as the DCF function determines that
359 * access it granted to this MAC.
360 */
361 virtual void Enqueue(Ptr<Packet> packet, Mac48Address to) = 0;
362 /**
363 * \return if this MAC supports sending from arbitrary address.
364 *
365 * The interface may or may not support sending from arbitrary address.
366 * This function returns true if sending from arbitrary address is supported,
367 * false otherwise.
368 */
369 virtual bool SupportsSendFrom() const;
370
371 /**
372 * \param phys the physical layers attached to this MAC.
373 */
374 virtual void SetWifiPhys(const std::vector<Ptr<WifiPhy>>& phys);
375 /**
376 * \param linkId the index (starting at 0) of the PHY object to retrieve
377 * \return the physical layer attached to this MAC
378 */
379 Ptr<WifiPhy> GetWifiPhy(uint8_t linkId = SINGLE_LINK_OP_ID) const;
380 /**
381 * Remove currently attached WifiPhy objects from this MAC.
382 */
383 void ResetWifiPhys();
384
385 /**
386 * \param stationManager the station manager attached to this MAC.
387 */
389 /**
390 * \param stationManagers the station managers attached to this MAC.
391 */
393 const std::vector<Ptr<WifiRemoteStationManager>>& stationManagers);
394 /**
395 * \param linkId the ID (starting at 0) of the link of the RemoteStationManager object
396 * to retrieve
397 * \return the remote station manager operating on the given link
398 */
400
401 /**
402 * This type defines the callback of a higher layer that a
403 * WifiMac(-derived) object invokes to pass a packet up the stack.
404 *
405 * \param packet the packet that has been received.
406 * \param from the MAC address of the device that sent the packet.
407 * \param to the MAC address of the device that the packet is destined for.
408 */
410
411 /**
412 * \param upCallback the callback to invoke when a packet must be
413 * forwarded up the stack.
414 */
416 /**
417 * \param linkUp the callback to invoke when the link becomes up.
418 */
419 virtual void SetLinkUpCallback(Callback<void> linkUp);
420 /**
421 * \param linkDown the callback to invoke when the link becomes down.
422 */
423 void SetLinkDownCallback(Callback<void> linkDown);
424 /* Next functions are not pure virtual so non QoS WifiMacs are not
425 * forced to implement them.
426 */
427
428 /**
429 * Notify that channel on the given link has been switched.
430 *
431 * \param linkId the ID of the given link
432 */
433 virtual void NotifyChannelSwitching(uint8_t linkId);
434
435 /**
436 * \param packet the packet being enqueued
437 *
438 * Public method used to fire a MacTx trace. Implemented for encapsulation purposes.
439 * Note this trace indicates that the packet was accepted by the device only.
440 * The packet may be dropped later (e.g. if the queue is full).
441 */
442 void NotifyTx(Ptr<const Packet> packet);
443 /**
444 * \param packet the packet being dropped
445 *
446 * Public method used to fire a MacTxDrop trace.
447 * This trace indicates that the packet was dropped before it was queued for
448 * transmission (e.g. when a STA is not associated with an AP).
449 */
450 void NotifyTxDrop(Ptr<const Packet> packet);
451 /**
452 * \param packet the packet we received
453 *
454 * Public method used to fire a MacRx trace. Implemented for encapsulation purposes.
455 */
456 void NotifyRx(Ptr<const Packet> packet);
457 /**
458 * \param packet the packet we received promiscuously
459 *
460 * Public method used to fire a MacPromiscRx trace. Implemented for encapsulation purposes.
461 */
463 /**
464 * \param packet the packet we received but is not destined for us
465 *
466 * Public method used to fire a MacRxDrop trace. Implemented for encapsulation purposes.
467 */
468 void NotifyRxDrop(Ptr<const Packet> packet);
469
470 /**
471 * \param standard the wifi standard to be configured
472 *
473 * This method completes the configuration process for a requested PHY standard
474 * by creating the Frame Exchange Manager and the Channel Access Manager and
475 * configuring the PHY dependent parameters.
476 * This method can only be called after a configured PHY has been set.
477 */
478 virtual void ConfigureStandard(WifiStandard standard);
479
480 /**
481 * \return pointer to HtConfiguration if it exists
482 */
484 /**
485 * \return pointer to VhtConfiguration if it exists
486 */
488 /**
489 * \return pointer to HeConfiguration if it exists
490 */
492 /**
493 * \return pointer to EhtConfiguration if it exists
494 */
496
497 /**
498 * Return the extended capabilities of the device.
499 *
500 * \return the extended capabilities that we support
501 */
503 /**
504 * Return the HT capabilities of the device for the given link.
505 *
506 * \param linkId the ID of the given link
507 * \return the HT capabilities that we support
508 */
509 HtCapabilities GetHtCapabilities(uint8_t linkId) const;
510 /**
511 * Return the VHT capabilities of the device for the given link.
512 *
513 * \param linkId the ID of the given link
514 * \return the VHT capabilities that we support
515 */
516 VhtCapabilities GetVhtCapabilities(uint8_t linkId) const;
517 /**
518 * Return the HE capabilities of the device for the given link.
519 *
520 * \param linkId the ID of the given link
521 * \return the HE capabilities that we support
522 */
523 HeCapabilities GetHeCapabilities(uint8_t linkId) const;
524 /**
525 * Return the EHT capabilities of the device for the given link.
526 *
527 * \param linkId the ID of the given link
528 * \return the EHT capabilities that we support
529 */
530 EhtCapabilities GetEhtCapabilities(uint8_t linkId) const;
531
532 /**
533 * Return whether the device supports QoS.
534 *
535 * \return true if QoS is supported, false otherwise
536 */
537 bool GetQosSupported() const;
538 /**
539 * Return whether the device supports ERP on the given link.
540 *
541 * \param linkId the ID of the given link
542 * \return true if ERP is supported, false otherwise
543 */
544 bool GetErpSupported(uint8_t linkId) const;
545 /**
546 * Return whether the device supports DSSS on the given link.
547 *
548 * \param linkId the ID of the given link
549 * \return true if DSSS is supported, false otherwise
550 */
551 bool GetDsssSupported(uint8_t linkId) const;
552 /**
553 * Return whether the device supports HT.
554 *
555 * \return true if HT is supported, false otherwise
556 */
557 bool GetHtSupported() const;
558 /**
559 * Return whether the device supports VHT on the given link.
560 *
561 * \param linkId the ID of the given link.
562 * \return true if VHT is supported, false otherwise
563 */
564 bool GetVhtSupported(uint8_t linkId) const;
565 /**
566 * Return whether the device supports HE.
567 *
568 * \return true if HE is supported, false otherwise
569 */
570 bool GetHeSupported() const;
571 /**
572 * Return whether the device supports EHT.
573 *
574 * \return true if EHT is supported, false otherwise
575 */
576 bool GetEhtSupported() const;
577
578 /**
579 * \param address the (link or MLD) address of a remote station
580 * \return true if the remote station with the given address supports HT
581 */
582 bool GetHtSupported(const Mac48Address& address) const;
583 /**
584 * \param address the (link or MLD) address of a remote station
585 * \return true if the remote station with the given address supports VHT
586 */
587 bool GetVhtSupported(const Mac48Address& address) const;
588 /**
589 * \param address the (link or MLD) address of a remote station
590 * \return true if the remote station with the given address supports HE
591 */
592 bool GetHeSupported(const Mac48Address& address) const;
593 /**
594 * \param address the (link or MLD) address of a remote station
595 * \return true if the remote station with the given address supports EHT
596 */
597 bool GetEhtSupported(const Mac48Address& address) const;
598
599 /**
600 * Return the maximum A-MPDU size of the given Access Category.
601 *
602 * \param ac Access Category index
603 * \return the maximum A-MPDU size
604 */
606 /**
607 * Return the maximum A-MSDU size of the given Access Category.
608 *
609 * \param ac Access Category index
610 * \return the maximum A-MSDU size
611 */
612 uint16_t GetMaxAmsduSize(AcIndex ac) const;
613
614 /// optional const reference to OriginatorBlockAckAgreement
616 std::optional<std::reference_wrapper<const OriginatorBlockAckAgreement>>;
617 /// optional const reference to RecipientBlockAckAgreement
619 std::optional<std::reference_wrapper<const RecipientBlockAckAgreement>>;
620
621 /**
622 * \param recipient (link or device) MAC address of the recipient
623 * \param tid traffic ID.
624 *
625 * \return the originator block ack agreement, if one has been established
626 *
627 * Checks if an originator block ack agreement is established with station addressed by
628 * <i>recipient</i> for TID <i>tid</i>.
629 */
631 uint8_t tid) const;
632 /**
633 * \param originator (link or device) MAC address of the originator
634 * \param tid traffic ID.
635 *
636 * \return the recipient block ack agreement, if one has been established
637 *
638 * Checks if a recipient block ack agreement is established with station addressed by
639 * <i>originator</i> for TID <i>tid</i>.
640 */
642 uint8_t tid) const;
643
644 /**
645 * \param recipient MAC address
646 * \param tid traffic ID
647 *
648 * \return the type of Block Acks sent by the recipient
649 *
650 * This function returns the type of Block Acks sent by the recipient.
651 */
652 BlockAckType GetBaTypeAsOriginator(const Mac48Address& recipient, uint8_t tid) const;
653 /**
654 * \param recipient MAC address of recipient
655 * \param tid traffic ID
656 *
657 * \return the type of Block Ack Requests sent to the recipient
658 *
659 * This function returns the type of Block Ack Requests sent to the recipient.
660 */
661 BlockAckReqType GetBarTypeAsOriginator(const Mac48Address& recipient, uint8_t tid) const;
662 /**
663 * \param originator MAC address of originator
664 * \param tid traffic ID
665 *
666 * \return the type of Block Acks sent to the originator
667 *
668 * This function returns the type of Block Acks sent to the originator.
669 */
670 BlockAckType GetBaTypeAsRecipient(Mac48Address originator, uint8_t tid) const;
671 /**
672 * \param originator MAC address of originator
673 * \param tid traffic ID
674 *
675 * \return the type of Block Ack Requests sent by the originator
676 *
677 * This function returns the type of Block Ack Requests sent by the originator.
678 */
679 BlockAckReqType GetBarTypeAsRecipient(Mac48Address originator, uint8_t tid) const;
680
681 /**
682 * Get the maximum Block Ack buffer size (in number of MPDUs) supported by the given device,
683 * if any, or by this device, otherwise, based on the supported standard.
684 *
685 * \param address the (MLD or link) address of the given device
686 * \return the maximum supported Block Ack buffer size (in number of MPDUs)
687 */
688 uint16_t GetMaxBaBufferSize(std::optional<Mac48Address> address = std::nullopt) const;
689
690 /**
691 * \param size the size (in number of MPDUs) of the buffer used for each BlockAck
692 * agreement in which this node is a recipient
693 */
694 void SetMpduBufferSize(uint16_t size);
695
696 /**
697 * \return the size (in number of MPDUs) of the buffer used for each BlockAck
698 * agreement in which this node is a recipient
699 */
700 uint16_t GetMpduBufferSize() const;
701
702 /**
703 * Get the TID-to-Link Mapping negotiated with the given MLD (if any) for the given direction.
704 * An empty mapping indicates the default mapping.
705 *
706 * \param mldAddr the MLD address of the given MLD
707 * \param dir the given direction (DL or UL)
708 * \return the negotiated TID-to-Link Mapping
709 */
710 std::optional<std::reference_wrapper<const WifiTidLinkMapping>> GetTidToLinkMapping(
711 Mac48Address mldAddr,
712 WifiDirection dir) const;
713
714 /**
715 * Check whether the given TID is mapped on the given link in the given direction for the
716 * given MLD.
717 *
718 * \param mldAddr the MLD address of the given MLD
719 * \param dir the given direction (DL or UL)
720 * \param tid the given TID
721 * \param linkId the ID of the given link
722 * \return whether the given TID is mapped on the given link in the given direction for the
723 * given MLD
724 */
725 bool TidMappedOnLink(Mac48Address mldAddr,
727 uint8_t tid,
728 uint8_t linkId) const;
729
730 protected:
731 void DoInitialize() override;
732 void DoDispose() override;
733
734 /**
735 * \param cwMin the minimum contention window size
736 * \param cwMax the maximum contention window size
737 *
738 * This method is called to set the minimum and the maximum
739 * contention window size.
740 */
741 virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax);
742
743 /**
744 * Enable or disable QoS support for the device. Construct a Txop object
745 * or QosTxop objects accordingly. This method can only be called before
746 * initialization.
747 *
748 * \param enable whether QoS is supported
749 */
750 void SetQosSupported(bool enable);
751
752 /**
753 * Enable or disable short slot time feature.
754 *
755 * \param enable true if short slot time is to be supported,
756 * false otherwise
757 */
758 void SetShortSlotTimeSupported(bool enable);
759 /**
760 * \return whether the device supports short slot time capability.
761 */
762 bool GetShortSlotTimeSupported() const;
763
764 /**
765 * Accessor for the AC_VO channel access function
766 *
767 * \return a smart pointer to QosTxop
768 */
769 Ptr<QosTxop> GetVOQueue() const;
770 /**
771 * Accessor for the AC_VI channel access function
772 *
773 * \return a smart pointer to QosTxop
774 */
775 Ptr<QosTxop> GetVIQueue() const;
776 /**
777 * Accessor for the AC_BE channel access function
778 *
779 * \return a smart pointer to QosTxop
780 */
781 Ptr<QosTxop> GetBEQueue() const;
782 /**
783 * Accessor for the AC_BK channel access function
784 *
785 * \return a smart pointer to QosTxop
786 */
787 Ptr<QosTxop> GetBKQueue() const;
788
789 /**
790 * This method acts as the MacRxMiddle receive callback and is
791 * invoked to notify us that a frame has been received on the given link.
792 * The implementation is intended to capture logic that is going to be
793 * common to all (or most) derived classes. Specifically, handling
794 * of Block Ack management frames is dealt with here.
795 *
796 * This method will need, however, to be overridden by derived
797 * classes so that they can perform their data handling before
798 * invoking the base version.
799 *
800 * The given link may be undefined in some cases (e.g., in case of
801 * QoS Data frames received in the context of a Block Ack agreement --
802 * because the BlockAckManager does not have to record the link each
803 * buffered MPDU has been received on); in such a cases, the value
804 * of <i>linkId</i> should be WIFI_LINKID_UNDEFINED.
805 *
806 * \param mpdu the MPDU that has been received.
807 * \param linkId the ID of the given link
808 */
809 virtual void Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
810 /**
811 * Forward the packet up to the device.
812 *
813 * \param packet the packet that we are forwarding up to the device
814 * \param from the address of the source
815 * \param to the address of the destination
816 */
818
819 /**
820 * This method can be called to de-aggregate an A-MSDU and forward
821 * the constituent packets up the stack.
822 *
823 * \param mpdu the MPDU containing the A-MSDU.
824 */
826
827 /**
828 * Apply the TID-to-Link Mapping negotiated with the given MLD for the given direction
829 * by properly configuring the queue scheduler.
830 *
831 * \param mldAddr the MLD MAC address of the given MLD
832 * \param dir the given direction (DL or UL)
833 */
835
836 /**
837 * Swap the links based on the information included in the given map. This method
838 * is normally called by a non-AP MLD upon completing ML setup to have its link IDs
839 * match AP MLD's link IDs.
840 *
841 * \param links a set of pairs (from, to) each mapping a current link ID to the
842 * link ID it has to become (i.e., link 'from' becomes link 'to')
843 */
844 void SwapLinks(std::map<uint8_t, uint8_t> links);
845
846 /**
847 * Structure holding information specific to a single link. Here, the meaning of
848 * "link" is that of the 11be amendment which introduced multi-link devices. For
849 * previous amendments, only one link can be created. Therefore, "link" has not
850 * to be confused with the general concept of link for a NetDevice (used by the
851 * m_linkUp and m_linkDown callbacks).
852 */
854 {
855 /// Destructor (a virtual method is needed to make this struct polymorphic)
856 virtual ~LinkEntity();
857
858 Ptr<WifiPhy> phy; //!< Wifi PHY object
859 Ptr<ChannelAccessManager> channelAccessManager; //!< channel access manager object
860 Ptr<FrameExchangeManager> feManager; //!< Frame Exchange Manager object
861 Ptr<WifiRemoteStationManager> stationManager; //!< Remote station manager (rate control,
862 //!< RTS/CTS/fragmentation thresholds etc.)
863 bool erpSupported{false}; //!< set to \c true iff this WifiMac is to model 802.11g
864 bool dsssSupported{false}; //!< set to \c true iff this WifiMac is to model 802.11b
865 };
866
867 /**
868 * \return a const reference to the map of link entities
869 */
870 const std::map<uint8_t, std::unique_ptr<LinkEntity>>& GetLinks() const;
871
872 /**
873 * Get a reference to the link associated with the given ID.
874 *
875 * \param linkId the given link ID
876 * \return a reference to the link associated with the given ID
877 */
878 LinkEntity& GetLink(uint8_t linkId) const;
879
880 /**
881 * Update the TID-to-Link Mappings for the given MLD in the given direction based on the
882 * given negotiated mappings. An empty mapping indicates the default mapping.
883 *
884 * \param mldAddr the MLD address of the given MLD
885 * \param dir the given direction (DL or UL)
886 * \param mapping the negotiated TID-to-Link Mapping
887 */
888 void UpdateTidToLinkMapping(const Mac48Address& mldAddr,
890 const WifiTidLinkMapping& mapping);
891
892 Ptr<MacRxMiddle> m_rxMiddle; //!< RX middle (defragmentation etc.)
893 Ptr<MacTxMiddle> m_txMiddle; //!< TX middle (aggregation etc.)
894 Ptr<Txop> m_txop; //!< TXOP used for transmission of frames to non-QoS peers.
895 Ptr<WifiMacQueueScheduler> m_scheduler; //!< wifi MAC queue scheduler
896
897 Callback<void> m_linkUp; //!< Callback when a link is up
898 Callback<void> m_linkDown; //!< Callback when a link is down
899
900 private:
901 /**
902 * \param dcf the DCF to be configured
903 * \param cwmin the minimum contention window for the DCF
904 * \param cwmax the maximum contention window for the DCF
905 * \param isDsss vector of flags to indicate whether PHY is DSSS or HR/DSSS for every link
906 * \param ac the access category for the DCF
907 *
908 * Configure the DCF with appropriate values depending on the given access category.
909 */
910 void ConfigureDcf(Ptr<Txop> dcf,
911 uint32_t cwmin,
912 uint32_t cwmax,
913 std::list<bool> isDsss,
914 AcIndex ac);
915
916 /**
917 * Configure PHY dependent parameters such as CWmin and CWmax on the given link.
918 *
919 * \param linkId the ID of the given link
920 */
921 void ConfigurePhyDependentParameters(uint8_t linkId);
922
923 /**
924 * This method is a private utility invoked to configure the channel
925 * access function for the specified Access Category.
926 *
927 * \param ac the Access Category of the queue to initialise.
928 */
929 void SetupEdcaQueue(AcIndex ac);
930
931 /**
932 * Create a Frame Exchange Manager depending on the supported version
933 * of the standard.
934 *
935 * \param standard the supported version of the standard
936 * \return the created Frame Exchange Manager
937 */
939
940 /**
941 * Create a LinkEntity object.
942 *
943 * \return a unique pointer to the created LinkEntity object
944 */
945 virtual std::unique_ptr<LinkEntity> CreateLinkEntity() const;
946
947 /**
948 * This method is intended to be called when a link changes ID in order to update the
949 * link ID stored by the Frame Exchange Manager and the Channel Access Manager operating
950 * on that link.
951 *
952 * \param id the (new) ID of the link that has changed ID
953 */
954 void UpdateLinkId(uint8_t id);
955
956 /**
957 * This method is called if this device is an MLD to determine the MAC address of
958 * the affiliated STA used to communicate with the single link device having the
959 * given MAC address. This method is overridden because its implementation depends
960 * on the type of station.
961 *
962 * \param remoteAddr the MAC address of the remote single link device
963 * \return the MAC address of the affiliated STA used to communicate with the remote device
964 */
965 virtual Mac48Address DoGetLocalAddress(const Mac48Address& remoteAddr) const;
966
967 /**
968 * Enable or disable ERP support for the given link.
969 *
970 * \param enable whether ERP is supported
971 * \param linkId the ID of the given link
972 */
973 void SetErpSupported(bool enable, uint8_t linkId);
974 /**
975 * Enable or disable DSSS support for the given link.
976 *
977 * \param enable whether DSSS is supported
978 * \param linkId the ID of the given link
979 */
980 void SetDsssSupported(bool enable, uint8_t linkId);
981
982 /**
983 * Set the block ack threshold for AC_VO.
984 *
985 * \param threshold the block ack threshold for AC_VO.
986 */
987 void SetVoBlockAckThreshold(uint8_t threshold);
988 /**
989 * Set the block ack threshold for AC_VI.
990 *
991 * \param threshold the block ack threshold for AC_VI.
992 */
993 void SetViBlockAckThreshold(uint8_t threshold);
994 /**
995 * Set the block ack threshold for AC_BE.
996 *
997 * \param threshold the block ack threshold for AC_BE.
998 */
999 void SetBeBlockAckThreshold(uint8_t threshold);
1000 /**
1001 * Set the block ack threshold for AC_BK.
1002 *
1003 * \param threshold the block ack threshold for AC_BK.
1004 */
1005 void SetBkBlockAckThreshold(uint8_t threshold);
1006
1007 /**
1008 * Set VO block ack inactivity timeout.
1009 *
1010 * \param timeout the VO block ack inactivity timeout.
1011 */
1013 /**
1014 * Set VI block ack inactivity timeout.
1015 *
1016 * \param timeout the VI block ack inactivity timeout.
1017 */
1019 /**
1020 * Set BE block ack inactivity timeout.
1021 *
1022 * \param timeout the BE block ack inactivity timeout.
1023 */
1025 /**
1026 * Set BK block ack inactivity timeout.
1027 *
1028 * \param timeout the BK block ack inactivity timeout.
1029 */
1031
1032 /**
1033 * This Boolean is set \c true iff this WifiMac is to model
1034 * 802.11e/WMM style Quality of Service. It is exposed through the
1035 * attribute system.
1036 *
1037 * At the moment, this flag is the sole selection between QoS and
1038 * non-QoS operation for the STA (whether IBSS, AP, or
1039 * non-AP). Ultimately, we will want a QoS-enabled STA to be able to
1040 * fall back to non-QoS operation with a non-QoS peer. This'll
1041 * require further intelligence - i.e., per-association QoS
1042 * state. Having a big switch seems like a good intermediate stage,
1043 * however.
1044 */
1046
1047 bool m_shortSlotTimeSupported; ///< flag whether short slot time is supported
1048 bool m_ctsToSelfSupported; ///< flag indicating whether CTS-To-Self is supported
1049
1050 TypeOfStation m_typeOfStation; //!< the type of station
1051
1052 Ptr<WifiNetDevice> m_device; //!< Pointer to the device
1053 std::map<uint8_t, std::unique_ptr<LinkEntity>> m_links; //!< ID-indexed map of Link objects
1054 std::set<uint8_t> m_linkIds; //!< IDs of the links in use
1055
1056 Mac48Address m_address; //!< MAC address of this station
1057 Ssid m_ssid; //!< Service Set ID (SSID)
1058
1059 /** This type defines a mapping between an Access Category index,
1060 and a pointer to the corresponding channel access function.
1061 Access Categories are sorted in decreasing order of priority. */
1062 typedef std::map<AcIndex, Ptr<QosTxop>, std::greater<>> EdcaQueues;
1063
1064 /** This is a map from Access Category index to the corresponding
1065 channel access function */
1067
1068 uint16_t m_voMaxAmsduSize; ///< maximum A-MSDU size for AC_VO (in bytes)
1069 uint16_t m_viMaxAmsduSize; ///< maximum A-MSDU size for AC_VI (in bytes)
1070 uint16_t m_beMaxAmsduSize; ///< maximum A-MSDU size for AC_BE (in bytes)
1071 uint16_t m_bkMaxAmsduSize; ///< maximum A-MSDU size for AC_BK (in bytes)
1072
1073 uint32_t m_voMaxAmpduSize; ///< maximum A-MPDU size for AC_VO (in bytes)
1074 uint32_t m_viMaxAmpduSize; ///< maximum A-MPDU size for AC_VI (in bytes)
1075 uint32_t m_beMaxAmpduSize; ///< maximum A-MPDU size for AC_BE (in bytes)
1076 uint32_t m_bkMaxAmpduSize; ///< maximum A-MPDU size for AC_BK (in bytes)
1077
1078 uint16_t m_mpduBufferSize; //!< BlockAck buffer size (in number of MPDUs)
1079
1080 /// @brief DL TID-to-Link Mapping negotiated with an MLD (identified by its MLD address)
1081 std::unordered_map<Mac48Address, WifiTidLinkMapping, WifiAddressHash> m_dlTidLinkMappings;
1082 /// @brief UL TID-to-Link Mapping negotiated with an MLD (identified by its MLD address)
1083 std::unordered_map<Mac48Address, WifiTidLinkMapping, WifiAddressHash> m_ulTidLinkMappings;
1084
1085 ForwardUpCallback m_forwardUp; //!< Callback to forward packet up the stack
1086
1087 /**
1088 * The trace source fired when packets come into the "top" of the device
1089 * at the L3/L2 transition, before being queued for transmission.
1090 *
1091 * \see class CallBackTraceSource
1092 */
1094 /**
1095 * The trace source fired when packets coming into the "top" of the device
1096 * are dropped at the MAC layer before being queued for transmission.
1097 *
1098 * \see class CallBackTraceSource
1099 */
1101 /**
1102 * The trace source fired for packets successfully received by the device
1103 * immediately before being forwarded up to higher layers (at the L2/L3
1104 * transition). This is a promiscuous trace.
1105 *
1106 * \see class CallBackTraceSource
1107 */
1109 /**
1110 * The trace source fired for packets successfully received by the device
1111 * immediately before being forwarded up to higher layers (at the L2/L3
1112 * transition). This is a non- promiscuous trace.
1113 *
1114 * \see class CallBackTraceSource
1115 */
1117 /**
1118 * The trace source fired when packets coming into the "top" of the device
1119 * are dropped at the MAC layer during reception.
1120 *
1121 * \see class CallBackTraceSource
1122 */
1124
1125 /**
1126 * TracedCallback signature for MPDU drop events.
1127 *
1128 * \param reason the reason why the MPDU was dropped (\see WifiMacDropReason)
1129 * \param mpdu the dropped MPDU
1130 */
1132
1133 /// TracedCallback for MPDU drop events typedef
1135
1136 /**
1137 * This trace indicates that an MPDU was dropped for the given reason.
1138 */
1140
1141 /// TracedCallback for acked/nacked MPDUs typedef
1143
1144 MpduTracedCallback m_ackedMpduCallback; ///< ack'ed MPDU callback
1145 MpduTracedCallback m_nackedMpduCallback; ///< nack'ed MPDU callback
1146
1147 /**
1148 * TracedCallback signature for MPDU response timeout events.
1149 *
1150 * \param reason the reason why the timer was started
1151 * \param mpdu the MPDU whose response was not received before the timeout
1152 * \param txVector the TXVECTOR used to transmit the MPDU
1153 */
1154 typedef void (*MpduResponseTimeoutCallback)(uint8_t reason,
1156 const WifiTxVector& txVector);
1157
1158 /// TracedCallback for MPDU response timeout events typedef
1161
1162 /**
1163 * MPDU response timeout traced callback.
1164 * This trace source is fed by a WifiTxTimer object.
1165 */
1167
1168 /**
1169 * TracedCallback signature for PSDU response timeout events.
1170 *
1171 * \param reason the reason why the timer was started
1172 * \param psdu the PSDU whose response was not received before the timeout
1173 * \param txVector the TXVECTOR used to transmit the PSDU
1174 */
1175 typedef void (*PsduResponseTimeoutCallback)(uint8_t reason,
1177 const WifiTxVector& txVector);
1178
1179 /// TracedCallback for PSDU response timeout events typedef
1182
1183 /**
1184 * PSDU response timeout traced callback.
1185 * This trace source is fed by a WifiTxTimer object.
1186 */
1188
1189 /**
1190 * TracedCallback signature for PSDU map response timeout events.
1191 *
1192 * \param reason the reason why the timer was started
1193 * \param psduMap the PSDU map for which not all responses were received before the timeout
1194 * \param missingStations the MAC addresses of the stations that did not respond
1195 * \param nTotalStations the total number of stations that had to respond
1196 */
1197 typedef void (*PsduMapResponseTimeoutCallback)(uint8_t reason,
1198 WifiPsduMap* psduMap,
1199 const std::set<Mac48Address>* missingStations,
1200 std::size_t nTotalStations);
1201
1202 /// TracedCallback for PSDU map response timeout events typedef
1205
1206 /**
1207 * PSDU map response timeout traced callback.
1208 * This trace source is fed by a WifiTxTimer object.
1209 */
1211};
1212
1213} // namespace ns3
1214
1215#endif /* WIFI_MAC_H */
Callback template class.
Definition: callback.h:438
The IEEE 802.11be EHT Capabilities.
The Extended Capabilities Information Element.
The IEEE 802.11ax HE Capabilities.
The HT Capabilities Information Element.
an EUI-48 address
Definition: mac48-address.h:46
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
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
The IEEE 802.11ac VHT Capabilities.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:96
uint16_t GetMaxAmsduSize(AcIndex ac) const
Return the maximum A-MSDU size of the given Access Category.
Definition: wifi-mac.cc:2276
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Definition: wifi-mac.cc:864
Ptr< QosTxop > GetBEQueue() const
Accessor for the AC_BE channel access function.
Definition: wifi-mac.cc:533
virtual void NotifyChannelSwitching(uint8_t linkId)
Notify that channel on the given link has been switched.
Definition: wifi-mac.cc:582
std::optional< Mac48Address > GetMldAddress(const Mac48Address &remoteAddr) const
Definition: wifi-mac.cc:1632
virtual void SetMacQueueScheduler(Ptr< WifiMacQueueScheduler > scheduler)
Set the wifi MAC queue scheduler.
Definition: wifi-mac.cc:569
Mac48Address GetBssid(uint8_t linkId) const
Definition: wifi-mac.cc:478
void(* PsduResponseTimeoutCallback)(uint8_t reason, Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
TracedCallback signature for PSDU response timeout events.
Definition: wifi-mac.h:1175
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI (in bytes)
Definition: wifi-mac.h:1069
bool m_shortSlotTimeSupported
flag whether short slot time is supported
Definition: wifi-mac.h:1047
void ConfigurePhyDependentParameters(uint8_t linkId)
Configure PHY dependent parameters such as CWmin and CWmax on the given link.
Definition: wifi-mac.cc:795
Ptr< HeConfiguration > GetHeConfiguration() const
Definition: wifi-mac.cc:1749
DroppedMpduTracedCallback m_droppedMpduCallback
This trace indicates that an MPDU was dropped for the given reason.
Definition: wifi-mac.h:1139
TracedCallback< WifiMacDropReason, Ptr< const WifiMpdu > > DroppedMpduTracedCallback
TracedCallback for MPDU drop events typedef.
Definition: wifi-mac.h:1134
TypeOfStation GetTypeOfStation() const
Return the type of station.
Definition: wifi-mac.cc:422
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service.
Definition: wifi-mac.h:1045
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
Definition: wifi-mac.cc:918
Ptr< Txop > GetTxop() const
Accessor for the Txop object.
Definition: wifi-mac.cc:493
VhtCapabilities GetVhtCapabilities(uint8_t linkId) const
Return the VHT capabilities of the device for the given link.
Definition: wifi-mac.cc:2018
Callback< void > m_linkDown
Callback when a link is down.
Definition: wifi-mac.h:898
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: wifi-mac.cc:1222
std::optional< std::reference_wrapper< const RecipientBlockAckAgreement > > RecipientAgreementOptConstRef
optional const reference to RecipientBlockAckAgreement
Definition: wifi-mac.h:619
virtual void SetAddress(Mac48Address address)
Definition: wifi-mac.cc:445
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
Definition: wifi-mac.h:894
void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
Definition: wifi-mac.cc:1195
Mac48Address m_address
MAC address of this station.
Definition: wifi-mac.h:1056
std::set< uint8_t > m_linkIds
IDs of the links in use.
Definition: wifi-mac.h:1054
Ptr< WifiMacQueueScheduler > GetMacQueueScheduler() const
Get the wifi MAC queue scheduler.
Definition: wifi-mac.cc:576
uint16_t GetMpduBufferSize() const
Definition: wifi-mac.cc:1862
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
Definition: wifi-mac.cc:933
BlockAckType GetBaTypeAsRecipient(Mac48Address originator, uint8_t tid) const
Definition: wifi-mac.cc:1719
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
Definition: wifi-mac.cc:995
uint16_t m_voMaxAmsduSize
maximum A-MSDU size for AC_VO (in bytes)
Definition: wifi-mac.h:1068
Ptr< MacRxMiddle > m_rxMiddle
RX middle (defragmentation etc.)
Definition: wifi-mac.h:892
Ptr< WifiMacQueueScheduler > m_scheduler
wifi MAC queue scheduler
Definition: wifi-mac.h:895
void DoInitialize() override
Initialize() implementation.
Definition: wifi-mac.cc:349
TypeOfStation m_typeOfStation
the type of station
Definition: wifi-mac.h:1050
uint16_t m_mpduBufferSize
BlockAck buffer size (in number of MPDUs)
Definition: wifi-mac.h:1078
uint32_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE (in bytes)
Definition: wifi-mac.h:1075
virtual void ConfigureStandard(WifiStandard standard)
Definition: wifi-mac.cc:748
bool TidMappedOnLink(Mac48Address mldAddr, WifiDirection dir, uint8_t tid, uint8_t linkId) const
Check whether the given TID is mapped on the given link in the given direction for the given MLD.
Definition: wifi-mac.cc:1116
void UnblockUnicastTxOnLinks(WifiQueueBlockedReason reason, const Mac48Address &address, const std::set< uint8_t > &linkIds)
Unblock the transmission on the given links of all unicast frames addressed to the station with the g...
Definition: wifi-mac.cc:1428
Ssid GetSsid() const
Definition: wifi-mac.cc:465
void SetWifiRemoteStationManagers(const std::vector< Ptr< WifiRemoteStationManager > > &stationManagers)
Definition: wifi-mac.cc:883
void SetBeBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BE.
Definition: wifi-mac.cc:1888
bool GetErpSupported(uint8_t linkId) const
Return whether the device supports ERP on the given link.
Definition: wifi-mac.cc:1228
bool GetHtSupported() const
Return whether the device supports HT.
Definition: wifi-mac.cc:1761
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to)=0
void ResetWifiPhys()
Remove currently attached WifiPhy objects from this MAC.
Definition: wifi-mac.cc:1177
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
Definition: wifi-mac.h:1093
void SetErpSupported(bool enable, uint8_t linkId)
Enable or disable ERP support for the given link.
Definition: wifi-mac.cc:1234
uint32_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO (in bytes)
Definition: wifi-mac.h:1073
void(* MpduResponseTimeoutCallback)(uint8_t reason, Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector)
TracedCallback signature for MPDU response timeout events.
Definition: wifi-mac.h:1154
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, std::list< bool > isDsss, AcIndex ac)
Definition: wifi-mac.cc:669
WifiMac(const WifiMac &)=delete
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-mac.h:1052
void SetSsid(Ssid ssid)
Definition: wifi-mac.cc:458
void UpdateLinkId(uint8_t id)
This method is intended to be called when a link changes ID in order to update the link ID stored by ...
Definition: wifi-mac.cc:945
Ptr< QosTxop > GetVOQueue() const
Accessor for the AC_VO channel access function.
Definition: wifi-mac.cc:521
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: wifi-mac.cc:415
MpduTracedCallback m_ackedMpduCallback
ack'ed MPDU callback
Definition: wifi-mac.h:1144
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
Definition: wifi-mac.cc:1171
void SetMpduBufferSize(uint16_t size)
Definition: wifi-mac.cc:1853
void BlockUnicastTxOnLinks(WifiQueueBlockedReason reason, const Mac48Address &address, const std::set< uint8_t > &linkIds)
Block the transmission on the given links of all unicast frames addressed to the station with the giv...
Definition: wifi-mac.cc:1387
MpduTracedCallback m_nackedMpduCallback
nack'ed MPDU callback
Definition: wifi-mac.h:1145
bool GetEhtSupported() const
Return whether the device supports EHT.
Definition: wifi-mac.cc:1780
bool GetHeSupported() const
Return whether the device supports HE.
Definition: wifi-mac.cc:1774
HtCapabilities GetHtCapabilities(uint8_t linkId) const
Return the HT capabilities of the device for the given link.
Definition: wifi-mac.cc:1959
void SetBkBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BK.
Definition: wifi-mac.cc:1898
void SetVoBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VO.
Definition: wifi-mac.cc:1868
virtual std::optional< uint8_t > GetLinkIdByAddress(const Mac48Address &address) const
Get the ID of the link having the given MAC address, if any.
Definition: wifi-mac.cc:961
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:613
std::unordered_map< Mac48Address, WifiTidLinkMapping, WifiAddressHash > m_dlTidLinkMappings
DL TID-to-Link Mapping negotiated with an MLD (identified by its MLD address)
Definition: wifi-mac.h:1081
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the MAC has frames to transmit over the given link.
Definition: wifi-mac.cc:552
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
Definition: wifi-mac.cc:876
void ApplyTidLinkMapping(const Mac48Address &mldAddr, WifiDirection dir)
Apply the TID-to-Link Mapping negotiated with the given MLD for the given direction by properly confi...
Definition: wifi-mac.cc:1305
RecipientAgreementOptConstRef GetBaAgreementEstablishedAsRecipient(Mac48Address originator, uint8_t tid) const
Definition: wifi-mac.cc:1693
void SetBeBlockAckInactivityTimeout(uint16_t timeout)
Set BE block ack inactivity timeout.
Definition: wifi-mac.cc:1928
Ptr< EhtConfiguration > GetEhtConfiguration() const
Definition: wifi-mac.cc:1755
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: wifi-mac.h:1116
bool GetVhtSupported(uint8_t linkId) const
Return whether the device supports VHT on the given link.
Definition: wifi-mac.cc:1767
void SetDsssSupported(bool enable, uint8_t linkId)
Enable or disable DSSS support for the given link.
Definition: wifi-mac.cc:1245
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Definition: wifi-mac.h:1100
TracedCallback< Ptr< const WifiMpdu > > MpduTracedCallback
TracedCallback for acked/nacked MPDUs typedef.
Definition: wifi-mac.h:1142
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: wifi-mac.h:893
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:595
static TypeId GetTypeId()
Get the type ID.
Definition: wifi-mac.cc:67
Ptr< HtConfiguration > GetHtConfiguration() const
Definition: wifi-mac.cc:1737
std::optional< std::reference_wrapper< const WifiTidLinkMapping > > GetTidToLinkMapping(Mac48Address mldAddr, WifiDirection dir) const
Get the TID-to-Link Mapping negotiated with the given MLD (if any) for the given direction.
Definition: wifi-mac.cc:1100
uint32_t GetMaxAmpduSize(AcIndex ac) const
Return the maximum A-MPDU size of the given Access Category.
Definition: wifi-mac.cc:2251
BlockAckReqType GetBarTypeAsRecipient(Mac48Address originator, uint8_t tid) const
Definition: wifi-mac.cc:1728
Ssid m_ssid
Service Set ID (SSID)
Definition: wifi-mac.h:1057
std::map< uint8_t, std::unique_ptr< LinkEntity > > m_links
ID-indexed map of Link objects.
Definition: wifi-mac.h:1053
virtual void DeaggregateAmsduAndForward(Ptr< const WifiMpdu > mpdu)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
Definition: wifi-mac.cc:1620
Ptr< QosTxop > GetVIQueue() const
Accessor for the AC_VI channel access function.
Definition: wifi-mac.cc:527
void SetBssid(Mac48Address bssid, uint8_t linkId)
Definition: wifi-mac.cc:471
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:439
Ptr< FrameExchangeManager > SetupFrameExchangeManager(WifiStandard standard)
Create a Frame Exchange Manager depending on the supported version of the standard.
Definition: wifi-mac.cc:813
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
Definition: wifi-mac.cc:1479
void NotifyRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:607
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Definition: wifi-mac.h:1123
void UpdateTidToLinkMapping(const Mac48Address &mldAddr, WifiDirection dir, const WifiTidLinkMapping &mapping)
Update the TID-to-Link Mappings for the given MLD in the given direction based on the given negotiate...
Definition: wifi-mac.cc:1066
BlockAckType GetBaTypeAsOriginator(const Mac48Address &recipient, uint8_t tid) const
Definition: wifi-mac.cc:1701
MpduResponseTimeoutTracedCallback m_mpduResponseTimeoutCallback
MPDU response timeout traced callback.
Definition: wifi-mac.h:1166
void SetForwardUpCallback(ForwardUpCallback upCallback)
Definition: wifi-mac.cc:1284
PsduMapResponseTimeoutTracedCallback m_psduMapResponseTimeoutCallback
PSDU map response timeout traced callback.
Definition: wifi-mac.h:1210
ExtendedCapabilities GetExtendedCapabilities() const
Return the extended capabilities of the device.
Definition: wifi-mac.cc:1948
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: wifi-mac.h:1108
std::map< AcIndex, Ptr< QosTxop >, std::greater<> > EdcaQueues
This type defines a mapping between an Access Category index, and a pointer to the corresponding chan...
Definition: wifi-mac.h:1062
uint16_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK (in bytes)
Definition: wifi-mac.h:1071
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
Definition: wifi-mac.cc:1938
std::optional< std::reference_wrapper< const OriginatorBlockAckAgreement > > OriginatorAgreementOptConstRef
optional const reference to OriginatorBlockAckAgreement
Definition: wifi-mac.h:616
std::unordered_map< Mac48Address, WifiTidLinkMapping, WifiAddressHash > m_ulTidLinkMappings
UL TID-to-Link Mapping negotiated with an MLD (identified by its MLD address)
Definition: wifi-mac.h:1083
virtual bool SupportsSendFrom() const
Definition: wifi-mac.cc:1278
uint16_t GetMaxBaBufferSize(std::optional< Mac48Address > address=std::nullopt) const
Get the maximum Block Ack buffer size (in number of MPDUs) supported by the given device,...
Definition: wifi-mac.cc:1838
virtual Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const
Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed,...
Definition: wifi-mac.cc:545
std::optional< uint8_t > GetLinkForPhy(Ptr< const WifiPhy > phy) const
Get the ID of the link (if any) on which the given PHY is operating.
Definition: wifi-mac.cc:974
void SetViBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VI.
Definition: wifi-mac.cc:1878
void SetViBlockAckInactivityTimeout(uint16_t timeout)
Set VI block ack inactivity timeout.
Definition: wifi-mac.cc:1918
bool GetShortSlotTimeSupported() const
Definition: wifi-mac.cc:1272
BlockAckReqType GetBarTypeAsOriginator(const Mac48Address &recipient, uint8_t tid) const
Definition: wifi-mac.cc:1710
void SetupEdcaQueue(AcIndex ac)
This method is a private utility invoked to configure the channel access function for the specified A...
Definition: wifi-mac.cc:625
void SetLinkDownCallback(Callback< void > linkDown)
Definition: wifi-mac.cc:1298
Ptr< QosTxop > GetBKQueue() const
Accessor for the AC_BK channel access function.
Definition: wifi-mac.cc:539
~WifiMac() override
Definition: wifi-mac.cc:61
void SetPromisc()
Sets the interface in promiscuous mode.
Definition: wifi-mac.cc:484
Ptr< VhtConfiguration > GetVhtConfiguration() const
Definition: wifi-mac.cc:1743
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:619
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: wifi-mac.cc:1291
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Definition: wifi-mac.cc:906
const std::set< uint8_t > & GetLinkIds() const
Definition: wifi-mac.cc:939
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:428
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
Definition: wifi-mac.cc:1258
Mac48Address GetLocalAddress(const Mac48Address &remoteAddr) const
Get the local MAC address used to communicate with a remote STA.
Definition: wifi-mac.cc:1645
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Definition: wifi-mac.h:1066
uint32_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK (in bytes)
Definition: wifi-mac.h:1076
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: wifi-mac.cc:1490
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
Definition: wifi-mac.cc:646
TracedCallback< uint8_t, Ptr< const WifiPsdu >, const WifiTxVector & > PsduResponseTimeoutTracedCallback
TracedCallback for PSDU response timeout events typedef.
Definition: wifi-mac.h:1181
TracedCallback< uint8_t, Ptr< const WifiMpdu >, const WifiTxVector & > MpduResponseTimeoutTracedCallback
TracedCallback for MPDU response timeout events typedef.
Definition: wifi-mac.h:1160
OriginatorAgreementOptConstRef GetBaAgreementEstablishedAsOriginator(Mac48Address recipient, uint8_t tid) const
Definition: wifi-mac.cc:1679
virtual void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Definition: wifi-mac.cc:1497
Mac48Address GetAddress() const
Definition: wifi-mac.cc:452
void(* DroppedMpduCallback)(WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
TracedCallback signature for MPDU drop events.
Definition: wifi-mac.h:1131
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
Definition: wifi-mac.h:1085
EhtCapabilities GetEhtCapabilities(uint8_t linkId) const
Return the EHT capabilities of the device for the given link.
Definition: wifi-mac.cc:2158
TracedCallback< uint8_t, WifiPsduMap *, const std::set< Mac48Address > *, std::size_t > PsduMapResponseTimeoutTracedCallback
TracedCallback for PSDU map response timeout events typedef.
Definition: wifi-mac.h:1204
Callback< void > m_linkUp
Callback when a link is up.
Definition: wifi-mac.h:897
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: wifi-mac.cc:924
HeCapabilities GetHeCapabilities(uint8_t linkId) const
Return the HE capabilities of the device for the given link.
Definition: wifi-mac.cc:2100
WifiMac & operator=(const WifiMac &)=delete
virtual bool CanForwardPacketsTo(Mac48Address to) const =0
Return true if packets can be forwarded to the given destination, false otherwise.
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys)
Definition: wifi-mac.cc:1146
Callback< void, Ptr< const Packet >, Mac48Address, Mac48Address > ForwardUpCallback
This type defines the callback of a higher layer that a WifiMac(-derived) object invokes to pass a pa...
Definition: wifi-mac.h:409
PsduResponseTimeoutTracedCallback m_psduResponseTimeoutCallback
PSDU response timeout traced callback.
Definition: wifi-mac.h:1187
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Definition: wifi-mac.cc:499
void(* PsduMapResponseTimeoutCallback)(uint8_t reason, WifiPsduMap *psduMap, const std::set< Mac48Address > *missingStations, std::size_t nTotalStations)
TracedCallback signature for PSDU map response timeout events.
Definition: wifi-mac.h:1197
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:601
void DoDispose() override
Destructor implementation.
Definition: wifi-mac.cc:373
bool GetDsssSupported(uint8_t linkId) const
Return whether the device supports DSSS on the given link.
Definition: wifi-mac.cc:1252
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
void SetVoBlockAckInactivityTimeout(uint16_t timeout)
Set VO block ack inactivity timeout.
Definition: wifi-mac.cc:1908
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
Definition: wifi-mac.cc:912
void SetShortSlotTimeSupported(bool enable)
Enable or disable short slot time feature.
Definition: wifi-mac.cc:1265
bool m_ctsToSelfSupported
flag indicating whether CTS-To-Self is supported
Definition: wifi-mac.h:1048
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE (in bytes)
Definition: wifi-mac.h:1070
virtual Mac48Address DoGetLocalAddress(const Mac48Address &remoteAddr) const
This method is called if this device is an MLD to determine the MAC address of the affiliated STA use...
Definition: wifi-mac.cc:1673
uint32_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI (in bytes)
Definition: wifi-mac.h:1074
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
TypeOfStation
Enumeration for type of WiFi station.
Definition: wifi-mac.h:64
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:77
WifiQueueBlockedReason
Enumeration of the reasons to block container queues.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:73
@ ADHOC_STA
Definition: wifi-mac.h:67
@ MESH
Definition: wifi-mac.h:68
@ STA
Definition: wifi-mac.h:65
@ AP
Definition: wifi-mac.h:66
@ OCB
Definition: wifi-mac.h:69
@ WIFI_MAC_DROP_QOS_OLD_PACKET
Definition: wifi-mac.h:81
@ WIFI_MAC_DROP_FAILED_ENQUEUE
Definition: wifi-mac.h:78
@ WIFI_MAC_DROP_EXPIRED_LIFETIME
Definition: wifi-mac.h:79
@ WIFI_MAC_DROP_REACHED_RETRY_LIMIT
Definition: wifi-mac.h:80
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
Definition: wifi-utils.h:192
WifiDirection
Wifi direction.
Definition: wifi-utils.h:43
std::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
Definition: wifi-utils.h:74
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
ns3::Time timeout
The different BlockAckRequest variants.
The different BlockAck variants.
std::string dir