A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-remote-station-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006,2007 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_REMOTE_STATION_MANAGER_H
21#define WIFI_REMOTE_STATION_MANAGER_H
22
23#include "qos-utils.h"
24#include "wifi-mode.h"
26#include "wifi-utils.h"
27
28#include "ns3/data-rate.h"
29#include "ns3/eht-capabilities.h"
30#include "ns3/he-capabilities.h"
31#include "ns3/ht-capabilities.h"
32#include "ns3/mac48-address.h"
33#include "ns3/multi-link-element.h"
34#include "ns3/object.h"
35#include "ns3/traced-callback.h"
36#include "ns3/vht-capabilities.h"
37
38#include <array>
39#include <memory>
40#include <optional>
41#include <unordered_map>
42
43namespace ns3
44{
45
46class WifiPhy;
47class WifiMac;
48class WifiMacHeader;
49class Packet;
50class WifiMpdu;
51class WifiTxVector;
52
53struct WifiRemoteStationState;
54struct RxSignalInfo;
55
56/**
57 * \brief hold per-remote-station state.
58 *
59 * The state in this class is used to keep track
60 * of association status if we are in an infrastructure
61 * network and to perform the selection of TX parameters
62 * on a per-packet basis.
63 *
64 * This class is typically subclassed and extended by
65 * rate control implementations
66 */
68{
69 virtual ~WifiRemoteStation(){};
70 WifiRemoteStationState* m_state; //!< Remote station state
71 std::pair<double, Time>
72 m_rssiAndUpdateTimePair; //!< RSSI (in dBm) of the most recent packet received from the
73 //!< remote station along with update time
74};
75
76/**
77 * A struct that holds information about each remote station.
78 */
80{
81 /**
82 * State of the station
83 */
84 enum
85 {
92
93 /**
94 * This member is the list of WifiMode objects that comprise the
95 * OperationalRateSet parameter for this remote station. This list
96 * is constructed through calls to
97 * WifiRemoteStationManager::AddSupportedMode(), and an API that
98 * allows external access to it is available through
99 * WifiRemoteStationManager::GetNSupported() and
100 * WifiRemoteStationManager::GetSupported().
101 */
102 WifiModeList m_operationalRateSet; //!< operational rate set
103 WifiModeList m_operationalMcsSet; //!< operational MCS set
104 Mac48Address m_address; //!< Mac48Address of the remote station
105 uint16_t m_aid; /**< AID of the remote station (unused if this object
106 is installed on a non-AP station) */
107 WifiRemoteStationInfo m_info; //!< remote station info
108 bool m_dsssSupported; //!< Flag if DSSS is supported by the remote station
109 bool m_erpOfdmSupported; //!< Flag if ERP OFDM is supported by the remote station
110 bool m_ofdmSupported; //!< Flag if OFDM is supported by the remote station
111 Ptr<const HtCapabilities> m_htCapabilities; //!< remote station HT capabilities
112 Ptr<const VhtCapabilities> m_vhtCapabilities; //!< remote station VHT capabilities
113 Ptr<const HeCapabilities> m_heCapabilities; //!< remote station HE capabilities
114 Ptr<const EhtCapabilities> m_ehtCapabilities; //!< remote station EHT capabilities
115 /// remote station Multi-Link Element Common Info
116 std::shared_ptr<CommonInfoBasicMle> m_mleCommonInfo;
117 bool m_emlsrEnabled; //!< whether EMLSR mode is enabled on this link
118
119 uint16_t m_channelWidth; //!< Channel width (in MHz) supported by the remote station
120 uint16_t m_guardInterval; //!< HE Guard interval duration (in nanoseconds) supported by the
121 //!< remote station
122 uint8_t m_ness; //!< Number of extended spatial streams of the remote station
123 bool m_aggregation; //!< Flag if MPDU aggregation is used by the remote station
124 bool m_shortPreamble; //!< Flag if short PHY preamble is supported by the remote station
125 bool m_shortSlotTime; //!< Flag if short ERP slot time is supported by the remote station
126 bool m_qosSupported; //!< Flag if QoS is supported by the station
127 bool m_isInPsMode; //!< Flag if the STA is currently in PS mode
128};
129
130/**
131 * \ingroup wifi
132 * \brief hold a list of per-remote-station state.
133 *
134 * \sa ns3::WifiRemoteStation.
135 */
137{
138 public:
139 /**
140 * \brief Get the type ID.
141 * \return the object TypeId
142 */
143 static TypeId GetTypeId();
144
146 ~WifiRemoteStationManager() override;
147
148 /// ProtectionMode enumeration
150 {
153 };
154
155 /**
156 * A map of WifiRemoteStations with Mac48Address as key
157 */
158 using Stations = std::unordered_map<Mac48Address, WifiRemoteStation*, WifiAddressHash>;
159 /**
160 * A map of WifiRemoteStationStates with Mac48Address as key
161 */
163 std::unordered_map<Mac48Address, std::shared_ptr<WifiRemoteStationState>, WifiAddressHash>;
164
165 /**
166 * Set up PHY associated with this device since it is the object that
167 * knows the full set of transmit rates that are supported.
168 *
169 * \param phy the PHY of this device
170 */
171 virtual void SetupPhy(const Ptr<WifiPhy> phy);
172 /**
173 * Set up MAC associated with this device since it is the object that
174 * knows the full set of timing parameters (e.g. IFS).
175 *
176 * \param mac the MAC of this device
177 */
178 virtual void SetupMac(const Ptr<WifiMac> mac);
179
180 /**
181 * Assign a fixed random variable stream number to the random variables
182 * used by this model. Return the number of streams (possibly zero) that
183 * have been assigned.
184 *
185 * \param stream first stream index to use
186 * \return the number of stream indices assigned by this model
187 */
188 virtual int64_t AssignStreams(int64_t stream);
189
190 /**
191 * Sets the maximum STA short retry count (SSRC).
192 *
193 * \param maxSsrc the maximum SSRC
194 */
195 void SetMaxSsrc(uint32_t maxSsrc);
196 /**
197 * Sets the maximum STA long retry count (SLRC).
198 *
199 * \param maxSlrc the maximum SLRC
200 */
201 void SetMaxSlrc(uint32_t maxSlrc);
202 /**
203 * Sets the RTS threshold.
204 *
205 * \param threshold the RTS threshold
206 */
207 void SetRtsCtsThreshold(uint32_t threshold);
208
209 /**
210 * Return the fragmentation threshold.
211 *
212 * \return the fragmentation threshold
213 */
215 /**
216 * Sets a fragmentation threshold. The method calls a private method
217 * DoSetFragmentationThreshold that checks the validity of the value given.
218 *
219 * \param threshold the fragmentation threshold
220 */
221 void SetFragmentationThreshold(uint32_t threshold);
222
223 /**
224 * Record the AID of a remote station. Should only be called by APs.
225 *
226 * \param remoteAddress the MAC address of the remote station
227 * \param aid the Association ID
228 */
229 void SetAssociationId(Mac48Address remoteAddress, uint16_t aid);
230 /**
231 * Records QoS support of the remote station.
232 *
233 * \param from the address of the station being recorded
234 * \param qosSupported whether the station supports QoS
235 */
236 void SetQosSupport(Mac48Address from, bool qosSupported);
237 /**
238 * \param from the address of the station being recorded
239 * \param emlsrEnabled whether EMLSR mode is enabled for the station on this link
240 */
241 void SetEmlsrEnabled(const Mac48Address& from, bool emlsrEnabled);
242 /**
243 * Records HT capabilities of the remote station.
244 *
245 * \param from the address of the station being recorded
246 * \param htCapabilities the HT capabilities of the station
247 */
248 void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities);
249 /**
250 * Records VHT capabilities of the remote station.
251 *
252 * \param from the address of the station being recorded
253 * \param vhtCapabilities the VHT capabilities of the station
254 */
255 void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities);
256 /**
257 * Records HE capabilities of the remote station.
258 *
259 * \param from the address of the station being recorded
260 * \param heCapabilities the HE capabilities of the station
261 */
262 void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities);
263 /**
264 * Records EHT capabilities of the remote station.
265 *
266 * \param from the address of the station being recorded
267 * \param ehtCapabilities the EHT capabilities of the station
268 */
269 void AddStationEhtCapabilities(Mac48Address from, EhtCapabilities ehtCapabilities);
270 /**
271 * Records the Common Info field advertised by the given remote station in a Multi-Link
272 * Element. It includes the MLD address of the remote station.
273 *
274 * \param from the address of the station being recorded
275 * \param mleCommonInfo the MLE Common Info advertised by the station
276 */
278 const std::shared_ptr<CommonInfoBasicMle>& mleCommonInfo);
279 /**
280 * Return the HT capabilities sent by the remote station.
281 *
282 * \param from the address of the remote station
283 * \return the HT capabilities sent by the remote station
284 */
286 /**
287 * Return the VHT capabilities sent by the remote station.
288 *
289 * \param from the address of the remote station
290 * \return the VHT capabilities sent by the remote station
291 */
293 /**
294 * Return the HE capabilities sent by the remote station.
295 *
296 * \param from the address of the remote station
297 * \return the HE capabilities sent by the remote station
298 */
300 /**
301 * Return the EHT capabilities sent by the remote station.
302 *
303 * \param from the address of the remote station
304 * \return the EHT capabilities sent by the remote station
305 */
307 /**
308 * \param from the (MLD or link) address of the remote non-AP MLD
309 * \return the EML Capabilities advertised by the remote non-AP MLD
310 */
311 std::optional<std::reference_wrapper<CommonInfoBasicMle::EmlCapabilities>>
313 /**
314 * \param from the (MLD or link) address of the remote non-AP MLD
315 * \return the MLD Capabilities advertised by the remote non-AP MLD
316 */
317 std::optional<std::reference_wrapper<CommonInfoBasicMle::MldCapabilities>>
319 /**
320 * Return whether the device has HT capability support enabled.
321 *
322 * \return true if HT capability support is enabled, false otherwise
323 */
324 bool GetHtSupported() const;
325 /**
326 * Return whether the device has VHT capability support enabled.
327 *
328 * \return true if VHT capability support is enabled, false otherwise
329 */
330 bool GetVhtSupported() const;
331 /**
332 * Return whether the device has HE capability support enabled.
333 *
334 * \return true if HE capability support is enabled, false otherwise
335 */
336 bool GetHeSupported() const;
337 /**
338 * Return whether the device has EHT capability support enabled.
339 *
340 * \return true if EHT capability support is enabled, false otherwise
341 */
342 bool GetEhtSupported() const;
343 /**
344 * Return whether the device has LDPC support enabled.
345 *
346 * \return true if LDPC support is enabled, false otherwise
347 */
348 bool GetLdpcSupported() const;
349 /**
350 * Return whether the device has SGI support enabled.
351 *
352 * \return true if SGI support is enabled, false otherwise
353 */
355 /**
356 * Return the supported HE guard interval duration (in nanoseconds).
357 *
358 * \return the supported HE guard interval duration (in nanoseconds)
359 */
360 uint16_t GetGuardInterval() const;
361 /**
362 * Enable or disable protection for non-ERP stations.
363 *
364 * \param enable enable or disable protection for non-ERP stations
365 */
366 void SetUseNonErpProtection(bool enable);
367 /**
368 * Return whether the device supports protection of non-ERP stations.
369 *
370 * \return true if protection for non-ERP stations is enabled,
371 * false otherwise
372 */
373 bool GetUseNonErpProtection() const;
374 /**
375 * Enable or disable protection for non-HT stations.
376 *
377 * \param enable enable or disable protection for non-HT stations
378 */
379 void SetUseNonHtProtection(bool enable);
380 /**
381 * Return whether the device supports protection of non-HT stations.
382 *
383 * \return true if protection for non-HT stations is enabled,
384 * false otherwise
385 */
386 bool GetUseNonHtProtection() const;
387 /**
388 * Enable or disable short PHY preambles.
389 *
390 * \param enable enable or disable short PHY preambles
391 */
392 void SetShortPreambleEnabled(bool enable);
393 /**
394 * Return whether the device uses short PHY preambles.
395 *
396 * \return true if short PHY preambles are enabled,
397 * false otherwise
398 */
399 bool GetShortPreambleEnabled() const;
400 /**
401 * Enable or disable short slot time.
402 *
403 * \param enable enable or disable short slot time
404 */
405 void SetShortSlotTimeEnabled(bool enable);
406 /**
407 * Return whether the device uses short slot time.
408 *
409 * \return true if short slot time is enabled,
410 * false otherwise
411 */
412 bool GetShortSlotTimeEnabled() const;
413
414 /**
415 * Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
416 */
417 void Reset();
418
419 /**
420 * Invoked in a STA upon association to store the set of rates which belong to the
421 * BSSBasicRateSet of the associated AP and which are supported locally.
422 * Invoked in an AP to configure the BSSBasicRateSet.
423 *
424 * \param mode the WifiMode to be added to the basic mode set
425 */
426 void AddBasicMode(WifiMode mode);
427 /**
428 * Return the default transmission mode.
429 *
430 * \return WifiMode the default transmission mode
431 */
432 WifiMode GetDefaultMode() const;
433 /**
434 * Return the number of basic modes we support.
435 *
436 * \return the number of basic modes we support
437 */
438 uint8_t GetNBasicModes() const;
439 /**
440 * Return a basic mode from the set of basic modes.
441 *
442 * \param i index of the basic mode in the basic mode set
443 *
444 * \return the basic mode at the given index
445 */
446 WifiMode GetBasicMode(uint8_t i) const;
447 /**
448 * Return the number of non-ERP basic modes we support.
449 *
450 * \return the number of basic modes we support
451 */
453 /**
454 * Return a basic mode from the set of basic modes that is not an ERP mode.
455 *
456 * \param i index of the basic mode in the basic mode set
457 *
458 * \return the basic mode at the given index
459 */
460 WifiMode GetNonErpBasicMode(uint8_t i) const;
461 /**
462 * Return whether the station supports LDPC or not.
463 *
464 * \param address the address of the station
465 *
466 * \return true if LDPC is supported by the station,
467 * false otherwise
468 */
469 bool GetLdpcSupported(Mac48Address address) const;
470 /**
471 * Return whether the station supports short PHY preamble or not.
472 *
473 * \param address the address of the station
474 *
475 * \return true if short PHY preamble is supported by the station,
476 * false otherwise
477 */
478 bool GetShortPreambleSupported(Mac48Address address) const;
479 /**
480 * Return whether the station supports short ERP slot time or not.
481 *
482 * \param address the address of the station
483 *
484 * \return true if short ERP slot time is supported by the station,
485 * false otherwise
486 */
487 bool GetShortSlotTimeSupported(Mac48Address address) const;
488 /**
489 * Return whether the given station is QoS capable.
490 *
491 * \param address the address of the station
492 *
493 * \return true if the station has QoS capabilities,
494 * false otherwise
495 */
496 bool GetQosSupported(Mac48Address address) const;
497 /**
498 * Get the AID of a remote station. Should only be called by APs.
499 *
500 * \param remoteAddress the MAC address of the remote station
501 * \return the Association ID if the station is associated, SU_STA_ID otherwise
502 */
503 uint16_t GetAssociationId(Mac48Address remoteAddress) const;
504 /**
505 * Add a given Modulation and Coding Scheme (MCS) index to
506 * the set of basic MCS.
507 *
508 * \param mcs the WifiMode to be added to the basic MCS set
509 */
510 void AddBasicMcs(WifiMode mcs);
511 /**
512 * Return the default Modulation and Coding Scheme (MCS) index.
513 *
514 * \return the default WifiMode
515 */
516 WifiMode GetDefaultMcs() const;
517 /**
518 * Return the default MCS to use to transmit frames to the given station.
519 *
520 * \param st the given station
521 * \return the default MCS to use to transmit frames to the given station
522 */
524 /**
525 * Return the number of basic MCS index.
526 *
527 * \return the number of basic MCS index
528 */
529 uint8_t GetNBasicMcs() const;
530 /**
531 * Return the MCS at the given <i>list</i> index.
532 *
533 * \param i the position in the list
534 *
535 * \return the basic MCS at the given list index
536 */
537 WifiMode GetBasicMcs(uint8_t i) const;
538 /**
539 * Record the MCS index supported by the station.
540 *
541 * \param address the address of the station
542 * \param mcs the WifiMode supported by the station
543 */
544 void AddSupportedMcs(Mac48Address address, WifiMode mcs);
545 /**
546 * Return the channel width supported by the station.
547 *
548 * \param address the address of the station
549 *
550 * \return the channel width supported by the station
551 */
552 uint16_t GetChannelWidthSupported(Mac48Address address) const;
553 /**
554 * Return whether the station supports HT/VHT short guard interval.
555 *
556 * \param address the address of the station
557 *
558 * \return true if the station supports HT/VHT short guard interval,
559 * false otherwise
560 */
562 /**
563 * Return the number of spatial streams supported by the station.
564 *
565 * \param address the address of the station
566 *
567 * \return the number of spatial streams supported by the station
568 */
569 uint8_t GetNumberOfSupportedStreams(Mac48Address address) const;
570 /**
571 * Return the number of MCS supported by the station.
572 *
573 * \param address the address of the station
574 *
575 * \return the number of MCS supported by the station
576 */
577 uint8_t GetNMcsSupported(Mac48Address address) const;
578 /**
579 * Return whether the station supports DSSS or not.
580 *
581 * \param address the address of the station
582 *
583 * \return true if DSSS is supported by the station,
584 * false otherwise
585 */
586 bool GetDsssSupported(const Mac48Address& address) const;
587 /**
588 * Return whether the station supports ERP OFDM or not.
589 *
590 * \param address the address of the station
591 *
592 * \return true if ERP OFDM is supported by the station,
593 * false otherwise
594 */
595 bool GetErpOfdmSupported(const Mac48Address& address) const;
596 /**
597 * Return whether the station supports OFDM or not.
598 *
599 * \param address the address of the station
600 *
601 * \return true if OFDM is supported by the station,
602 * false otherwise
603 */
604 bool GetOfdmSupported(const Mac48Address& address) const;
605 /**
606 * Return whether the station supports HT or not.
607 *
608 * \param address the address of the station
609 *
610 * \return true if HT is supported by the station,
611 * false otherwise
612 */
613 bool GetHtSupported(Mac48Address address) const;
614 /**
615 * Return whether the station supports VHT or not.
616 *
617 * \param address the address of the station
618 *
619 * \return true if VHT is supported by the station,
620 * false otherwise
621 */
622 bool GetVhtSupported(Mac48Address address) const;
623 /**
624 * Return whether the station supports HE or not.
625 *
626 * \param address the address of the station
627 *
628 * \return true if HE is supported by the station,
629 * false otherwise
630 */
631 bool GetHeSupported(Mac48Address address) const;
632 /**
633 * Return whether the station supports EHT or not.
634 *
635 * \param address the address of the station
636 *
637 * \return true if EHT is supported by the station,
638 * false otherwise
639 */
640 bool GetEhtSupported(Mac48Address address) const;
641 /**
642 * \param address the (MLD or link) address of the non-AP MLD
643 * \return whether the non-AP MLD supports EMLSR
644 */
645 bool GetEmlsrSupported(const Mac48Address& address) const;
646 /**
647 * \param address the (MLD or link) address of the non-AP MLD
648 * \return whether EMLSR mode is enabled for the non-AP MLD on this link
649 */
650 bool GetEmlsrEnabled(const Mac48Address& address) const;
651
652 /**
653 * Return a mode for non-unicast packets.
654 *
655 * \return WifiMode for non-unicast packets
656 */
658
659 /**
660 * Invoked in a STA or AP to store the set of
661 * modes supported by a destination which is
662 * also supported locally.
663 * The set of supported modes includes
664 * the BSSBasicRateSet.
665 *
666 * \param address the address of the station being recorded
667 * \param mode the WifiMode supports by the station
668 */
669 void AddSupportedMode(Mac48Address address, WifiMode mode);
670 /**
671 * Invoked in a STA or AP to store all of the modes supported
672 * by a destination which is also supported locally.
673 * The set of supported modes includes the BSSBasicRateSet.
674 *
675 * \param address the address of the station being recorded
676 */
678 /**
679 * Invoked in a STA or AP to store all of the MCS supported
680 * by a destination which is also supported locally.
681 *
682 * \param address the address of the station being recorded
683 */
684 void AddAllSupportedMcs(Mac48Address address);
685 /**
686 * Invoked in a STA or AP to delete all of the supported MCS by a destination.
687 *
688 * \param address the address of the station being recorded
689 */
691 /**
692 * Record whether the short PHY preamble is supported by the station.
693 *
694 * \param address the address of the station
695 * \param isShortPreambleSupported whether or not short PHY preamble is supported by the station
696 */
697 void AddSupportedPhyPreamble(Mac48Address address, bool isShortPreambleSupported);
698 /**
699 * Record whether the short ERP slot time is supported by the station.
700 *
701 * \param address the address of the station
702 * \param isShortSlotTimeSupported whether or not short ERP slot time is supported by the
703 * station
704 */
705 void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported);
706 /**
707 * Return whether the station state is brand new.
708 *
709 * \param address the address of the station
710 *
711 * \return true if the state of the station is brand new,
712 * false otherwise
713 */
714 bool IsBrandNew(Mac48Address address) const;
715 /**
716 * Return whether the station associated.
717 *
718 * \param address the address of the station
719 *
720 * \return true if the station is associated,
721 * false otherwise
722 */
723 bool IsAssociated(Mac48Address address) const;
724 /**
725 * Return whether we are waiting for an ACK for
726 * the association response we sent.
727 *
728 * \param address the address of the station
729 *
730 * \return true if the station is associated,
731 * false otherwise
732 */
733 bool IsWaitAssocTxOk(Mac48Address address) const;
734 /**
735 * Records that we are waiting for an ACK for
736 * the association response we sent.
737 *
738 * \param address the address of the station
739 */
740 void RecordWaitAssocTxOk(Mac48Address address);
741 /**
742 * Records that we got an ACK for
743 * the association response we sent.
744 *
745 * \param address the address of the station
746 */
747 void RecordGotAssocTxOk(Mac48Address address);
748 /**
749 * Records that we missed an ACK for
750 * the association response we sent.
751 *
752 * \param address the address of the station
753 */
755 /**
756 * Records that the STA was disassociated.
757 *
758 * \param address the address of the station
759 */
760 void RecordDisassociated(Mac48Address address);
761 /**
762 * Return whether we refused an association request from the given station
763 *
764 * \param address the address of the station
765 * \return true if we refused an association request, false otherwise
766 */
767 bool IsAssocRefused(Mac48Address address) const;
768 /**
769 * Records that association request was refused
770 *
771 * \param address the address of the station
772 */
773 void RecordAssocRefused(Mac48Address address);
774
775 /**
776 * Return whether the STA is currently in Power Save mode.
777 *
778 * \param address the address of the station
779 *
780 * \return true if the station is in Power Save mode, false otherwise
781 */
782 bool IsInPsMode(const Mac48Address& address) const;
783 /**
784 * Register whether the STA is in Power Save mode or not.
785 *
786 * \param address the address of the station
787 * \param isInPsMode whether the STA is in PS mode or not
788 */
789 void SetPsMode(const Mac48Address& address, bool isInPsMode);
790
791 /**
792 * Get the address of the MLD the given station is affiliated with, if any.
793 * Note that an MLD address is only present if an ML discovery/setup was performed
794 * with the given station (which requires both this station and the given
795 * station to be MLDs).
796 *
797 * \param address the MAC address of the remote station
798 * \return the address of the MLD the given station is affiliated with, if any
799 */
800 std::optional<Mac48Address> GetMldAddress(const Mac48Address& address) const;
801 /**
802 * Get the address of the remote station operating on this link and affiliated
803 * with the MLD having the given MAC address, if any.
804 *
805 * \param mldAddress the MLD MAC address
806 * \return the address of the remote station operating on this link and
807 * affiliated with the MLD, if any
808 */
809 std::optional<Mac48Address> GetAffiliatedStaAddress(const Mac48Address& mldAddress) const;
810
811 /**
812 * \param header MAC header
813 * \param allowedWidth the allowed width in MHz to send this packet
814 * \return the TXVECTOR to use to send this packet
815 */
816 WifiTxVector GetDataTxVector(const WifiMacHeader& header, uint16_t allowedWidth);
817 /**
818 * \param address remote address
819 * \param allowedWidth the allowed width in MHz for the data frame being protected
820 *
821 * \return the TXVECTOR to use to send the RTS prior to the
822 * transmission of the data packet itself.
823 */
824 WifiTxVector GetRtsTxVector(Mac48Address address, uint16_t allowedWidth);
825 /**
826 * Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS
827 * used by the sender.
828 *
829 * \param to the MAC address of the CTS receiver
830 * \param rtsTxMode the mode of the RTS used by the sender
831 * \return TXVECTOR for the CTS
832 */
834 /**
835 * Since CTS-to-self parameters are not dependent on the station,
836 * it is implemented in wifi remote station manager
837 *
838 * \return the transmission mode to use to send the CTS-to-self prior to the
839 * transmission of the data packet itself.
840 */
842 /**
843 * Adjust the TXVECTOR for an initial Control frame to ensure that the modulation class
844 * is non-HT and the rate is 6 Mbps, 12 Mbps or 24 Mbps.
845 *
846 * \param txVector the TXVECTOR to adjust
847 */
848 void AdjustTxVectorForIcf(WifiTxVector& txVector) const;
849 /**
850 * Return a TXVECTOR for the Ack frame given the destination and the mode of the Data
851 * used by the sender.
852 *
853 * \param to the MAC address of the Ack receiver
854 * \param dataTxVector the TXVECTOR of the Data used by the sender
855 * \return TXVECTOR for the Ack
856 */
857 WifiTxVector GetAckTxVector(Mac48Address to, const WifiTxVector& dataTxVector) const;
858 /**
859 * Return a TXVECTOR for the BlockAck frame given the destination and the mode of the Data
860 * used by the sender.
861 *
862 * \param to the MAC address of the BlockAck receiver
863 * \param dataTxVector the TXVECTOR of the Data used by the sender
864 * \return TXVECTOR for the BlockAck
865 */
866 WifiTxVector GetBlockAckTxVector(Mac48Address to, const WifiTxVector& dataTxVector) const;
867 /**
868 * Get control answer mode function.
869 *
870 * \param reqMode request mode
871 * \return control answer mode
872 */
874
875 /**
876 * Should be invoked whenever the RtsTimeout associated to a transmission
877 * attempt expires.
878 *
879 * \param header MAC header of the DATA packet
880 */
881 void ReportRtsFailed(const WifiMacHeader& header);
882 /**
883 * Should be invoked whenever the AckTimeout associated to a transmission
884 * attempt expires.
885 *
886 * \param mpdu the MPDU whose transmission failed
887 */
889 /**
890 * Should be invoked whenever we receive the CTS associated to an RTS
891 * we just sent. Note that we also get the SNR of the RTS we sent since
892 * the receiver put a SnrTag in the CTS.
893 *
894 * \param header MAC header of the DATA packet
895 * \param ctsSnr the SNR of the CTS we received
896 * \param ctsMode the WifiMode the receiver used to send the CTS
897 * \param rtsSnr the SNR of the RTS we sent
898 */
899 void ReportRtsOk(const WifiMacHeader& header, double ctsSnr, WifiMode ctsMode, double rtsSnr);
900 /**
901 * Should be invoked whenever we receive the ACK associated to a data packet
902 * we just sent.
903 *
904 * \param mpdu the MPDU
905 * \param ackSnr the SNR of the ACK we received
906 * \param ackMode the WifiMode the receiver used to send the ACK
907 * \param dataSnr the SNR of the DATA we sent
908 * \param dataTxVector the TXVECTOR of the DATA we sent
909 */
911 double ackSnr,
912 WifiMode ackMode,
913 double dataSnr,
914 WifiTxVector dataTxVector);
915 /**
916 * Should be invoked after calling ReportRtsFailed if
917 * NeedRetransmission returns false
918 *
919 * \param header MAC header of the DATA packet
920 */
921 void ReportFinalRtsFailed(const WifiMacHeader& header);
922 /**
923 * Should be invoked after calling ReportDataFailed if
924 * NeedRetransmission returns false
925 *
926 * \param mpdu the MPDU which was discarded
927 */
929 /**
930 * Typically called per A-MPDU, either when a Block ACK was successfully
931 * received or when a BlockAckTimeout has elapsed.
932 *
933 * \param address the address of the receiver
934 * \param nSuccessfulMpdus number of successfully transmitted MPDUs
935 * A value of 0 means that the Block ACK was missed.
936 * \param nFailedMpdus number of unsuccessfuly transmitted MPDUs
937 * \param rxSnr received SNR of the block ack frame itself
938 * \param dataSnr data SNR reported by remote station
939 * \param dataTxVector the TXVECTOR of the MPDUs we sent
940 */
942 uint16_t nSuccessfulMpdus,
943 uint16_t nFailedMpdus,
944 double rxSnr,
945 double dataSnr,
946 WifiTxVector dataTxVector);
947
948 /**
949 * \param address remote address
950 * \param rxSignalInfo the info on the received signal (\see RxSignalInfo)
951 * \param txVector the TXVECTOR used for the packet received
952 *
953 * Should be invoked whenever a packet is successfully received.
954 */
955 void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector);
956
957 /**
958 * \param header MAC header
959 * \param size the size of the frame to send in bytes
960 *
961 * \return true if we want to use an RTS/CTS handshake for this
962 * frame before sending it, false otherwise.
963 */
964 bool NeedRts(const WifiMacHeader& header, uint32_t size);
965 /**
966 * Return if we need to do CTS-to-self before sending a DATA.
967 *
968 * \param txVector the TXVECTOR of the packet to be sent
969 *
970 * \return true if CTS-to-self is needed,
971 * false otherwise
972 */
973 bool NeedCtsToSelf(WifiTxVector txVector);
974
975 /**
976 * \param mpdu the MPDU to send
977 *
978 * \return true if we want to resend a packet after a failed transmission attempt,
979 * false otherwise.
980 */
982 /**
983 * \param mpdu the MPDU to send
984 *
985 * \return true if this packet should be fragmented,
986 * false otherwise.
987 */
989 /**
990 * \param mpdu the MPDU to send
991 * \param fragmentNumber the fragment index of the next fragment to send (starts at zero).
992 *
993 * \return the size of the corresponding fragment.
994 */
996 /**
997 * \param mpdu the packet to send
998 * \param fragmentNumber the fragment index of the next fragment to send (starts at zero).
999 *
1000 * \return the offset within the original packet where this fragment starts.
1001 */
1003 /**
1004 * \param mpdu the packet to send
1005 * \param fragmentNumber the fragment index of the next fragment to send (starts at zero).
1006 *
1007 * \return true if this is the last fragment, false otherwise.
1008 */
1009 bool IsLastFragment(Ptr<const WifiMpdu> mpdu, uint32_t fragmentNumber);
1010
1011 /**
1012 * \return the default transmission power
1013 */
1014 uint8_t GetDefaultTxPowerLevel() const;
1015 /**
1016 * \param address of the remote station
1017 *
1018 * \return information regarding the remote station associated with the given address
1019 */
1021 /**
1022 * \param address of the remote station
1023 *
1024 * \return the RSSI (in dBm) of the most recent packet received from the remote station
1025 * (irrespective of TID)
1026 *
1027 * This method is typically used when the device needs
1028 * to estimate the target UL RSSI info to put in the
1029 * Trigger frame to send to the remote station.
1030 */
1031 std::optional<double> GetMostRecentRssi(Mac48Address address) const;
1032 /**
1033 * Set the default transmission power level
1034 *
1035 * \param txPower the default transmission power level
1036 */
1037 void SetDefaultTxPowerLevel(uint8_t txPower);
1038 /**
1039 * \return the number of antennas supported by the PHY layer
1040 */
1041 uint8_t GetNumberOfAntennas() const;
1042 /**
1043 * \return the maximum number of spatial streams supported by the PHY layer
1044 */
1045 uint8_t GetMaxNumberOfTransmitStreams() const;
1046 /**
1047 * \returns whether LDPC should be used for a given destination address.
1048 *
1049 * \param dest the destination address
1050 *
1051 * \return whether LDPC should be used for a given destination address
1052 */
1053 bool UseLdpcForDestination(Mac48Address dest) const;
1054
1055 /**
1056 * TracedCallback signature for power change events.
1057 *
1058 * \param [in] oldPower The previous power (in dBm).
1059 * \param [in] newPower The new power (in dBm).
1060 * \param [in] address The remote station MAC address.
1061 */
1062 typedef void (*PowerChangeTracedCallback)(double oldPower,
1063 double newPower,
1064 Mac48Address remoteAddress);
1065
1066 /**
1067 * TracedCallback signature for rate change events.
1068 *
1069 * \param [in] oldRate The previous data rate.
1070 * \param [in] newRate The new data rate.
1071 * \param [in] address The remote station MAC address.
1072 */
1073 typedef void (*RateChangeTracedCallback)(DataRate oldRate,
1074 DataRate newRate,
1075 Mac48Address remoteAddress);
1076
1077 /**
1078 * Return the WifiPhy.
1079 *
1080 * \return a pointer to the WifiPhy
1081 */
1082 Ptr<WifiPhy> GetPhy() const;
1083 /**
1084 * Return the WifiMac.
1085 *
1086 * \return a pointer to the WifiMac
1087 */
1088 Ptr<WifiMac> GetMac() const;
1089
1090 protected:
1091 void DoDispose() override;
1092 /**
1093 * Return whether mode associated with the specified station at the specified index.
1094 *
1095 * \param station the station being queried
1096 * \param i the index
1097 *
1098 * \return WifiMode at the given index of the specified station
1099 */
1100 WifiMode GetSupported(const WifiRemoteStation* station, uint8_t i) const;
1101 /**
1102 * Return the number of modes supported by the given station.
1103 *
1104 * \param station the station being queried
1105 *
1106 * \return the number of modes supported by the given station
1107 */
1108 uint8_t GetNSupported(const WifiRemoteStation* station) const;
1109 /**
1110 * Return whether the given station is QoS capable.
1111 *
1112 * \param station the station being queried
1113 *
1114 * \return true if the station has QoS capabilities,
1115 * false otherwise
1116 */
1117 bool GetQosSupported(const WifiRemoteStation* station) const;
1118 /**
1119 * Return whether the given station is HT capable.
1120 *
1121 * \param station the station being queried
1122 *
1123 * \return true if the station has HT capabilities,
1124 * false otherwise
1125 */
1126 bool GetHtSupported(const WifiRemoteStation* station) const;
1127 /**
1128 * Return whether the given station is VHT capable.
1129 *
1130 * \param station the station being queried
1131 *
1132 * \return true if the station has VHT capabilities,
1133 * false otherwise
1134 */
1135 bool GetVhtSupported(const WifiRemoteStation* station) const;
1136 /**
1137 * Return whether the given station is HE capable.
1138 *
1139 * \param station the station being queried
1140 *
1141 * \return true if the station has HE capabilities,
1142 * false otherwise
1143 */
1144 bool GetHeSupported(const WifiRemoteStation* station) const;
1145 /**
1146 * Return whether the given station is EHT capable.
1147 *
1148 * \param station the station being queried
1149 *
1150 * \return true if the station has EHT capabilities,
1151 * false otherwise
1152 */
1153 bool GetEhtSupported(const WifiRemoteStation* station) const;
1154 /**
1155 * \param station the station of a non-AP MLD
1156 * \return whether the non-AP MLD supports EMLSR
1157 */
1158 bool GetEmlsrSupported(const WifiRemoteStation* station) const;
1159 /**
1160 * \param station the station of a non-AP MLD
1161 * \return whether EMLSR mode is enabled for the non-AP MLD on this link
1162 */
1163 bool GetEmlsrEnabled(const WifiRemoteStation* station) const;
1164 /**
1165 * Return the WifiMode supported by the specified station at the specified index.
1166 *
1167 * \param station the station being queried
1168 * \param i the index
1169 *
1170 * \return the WifiMode at the given index of the specified station
1171 */
1172
1173 WifiMode GetMcsSupported(const WifiRemoteStation* station, uint8_t i) const;
1174 /**
1175 * Return the number of MCS supported by the given station.
1176 *
1177 * \param station the station being queried
1178 *
1179 * \return the number of MCS supported by the given station
1180 */
1181 uint8_t GetNMcsSupported(const WifiRemoteStation* station) const;
1182 /**
1183 * Return whether non-ERP mode associated with the specified station at the specified index.
1184 *
1185 * \param station the station being queried
1186 * \param i the index
1187 *
1188 * \return WifiMode at the given index of the specified station
1189 */
1190 WifiMode GetNonErpSupported(const WifiRemoteStation* station, uint8_t i) const;
1191 /**
1192 * Return the number of non-ERP modes supported by the given station.
1193 *
1194 * \param station the station being queried
1195 *
1196 * \return the number of non-ERP modes supported by the given station
1197 */
1198 uint32_t GetNNonErpSupported(const WifiRemoteStation* station) const;
1199 /**
1200 * Return the address of the station.
1201 *
1202 * \param station the station being queried
1203 *
1204 * \return the address of the station
1205 */
1206 Mac48Address GetAddress(const WifiRemoteStation* station) const;
1207 /**
1208 * Return the channel width supported by the station.
1209 *
1210 * \param station the station being queried
1211 *
1212 * \return the channel width (in MHz) supported by the station
1213 */
1214 uint16_t GetChannelWidth(const WifiRemoteStation* station) const;
1215 /**
1216 * Return whether the given station supports HT/VHT short guard interval.
1217 *
1218 * \param station the station being queried
1219 *
1220 * \return true if the station supports HT/VHT short guard interval,
1221 * false otherwise
1222 */
1223 bool GetShortGuardIntervalSupported(const WifiRemoteStation* station) const;
1224 /**
1225 * Return the HE guard interval duration supported by the station.
1226 *
1227 * \param station the station being queried
1228 *
1229 * \return the HE guard interval duration (in nanoseconds) supported by the station
1230 */
1231 uint16_t GetGuardInterval(const WifiRemoteStation* station) const;
1232 /**
1233 * Return whether the given station supports A-MPDU.
1234 *
1235 * \param station the station being queried
1236 *
1237 * \return true if the station supports MPDU aggregation,
1238 * false otherwise
1239 */
1240 bool GetAggregation(const WifiRemoteStation* station) const;
1241
1242 /**
1243 * Return the number of supported streams the station has.
1244 *
1245 * \param station the station being queried
1246 *
1247 * \return the number of supported streams the station has
1248 */
1249 uint8_t GetNumberOfSupportedStreams(const WifiRemoteStation* station) const;
1250 /**
1251 * \returns the number of Ness the station has.
1252 *
1253 * \param station the station being queried
1254 *
1255 * \return the number of Ness the station has
1256 */
1257 uint8_t GetNess(const WifiRemoteStation* station) const;
1258
1259 private:
1260 /**
1261 * If the given TXVECTOR is used for a MU transmission, return the STAID of
1262 * the station with the given address if we are an AP or our own STAID if we
1263 * are a STA associated with some AP. Otherwise, return SU_STA_ID.
1264 *
1265 * \param address the address of the station
1266 * \param txVector the TXVECTOR used for a MU transmission
1267 * \return the STA-ID of the station
1268 */
1269 uint16_t GetStaId(Mac48Address address, const WifiTxVector& txVector) const;
1270
1271 /**
1272 * \param station the station that we need to communicate
1273 * \param size the size of the frame to send in bytes
1274 * \param normally indicates whether the normal 802.11 RTS enable mechanism would
1275 * request that the RTS is sent or not.
1276 *
1277 * \return true if we want to use an RTS/CTS handshake for this frame before sending it,
1278 * false otherwise.
1279 *
1280 * Note: This method is called before a unicast packet is sent on the medium.
1281 */
1282 virtual bool DoNeedRts(WifiRemoteStation* station, uint32_t size, bool normally);
1283 /**
1284 * \param station the station that we need to communicate
1285 * \param packet the packet to send
1286 * \param normally indicates whether the normal 802.11 data retransmission mechanism
1287 * would request that the data is retransmitted or not.
1288 * \return true if we want to resend a packet after a failed transmission attempt,
1289 * false otherwise.
1290 *
1291 * Note: This method is called after any unicast packet transmission (control, management,
1292 * or data) has been attempted and has failed.
1293 */
1294 virtual bool DoNeedRetransmission(WifiRemoteStation* station,
1295 Ptr<const Packet> packet,
1296 bool normally);
1297 /**
1298 * \param station the station that we need to communicate
1299 * \param packet the packet to send
1300 * \param normally indicates whether the normal 802.11 data fragmentation mechanism
1301 * would request that the data packet is fragmented or not.
1302 *
1303 * \return true if this packet should be fragmented,
1304 * false otherwise.
1305 *
1306 * Note: This method is called before sending a unicast packet.
1307 */
1308 virtual bool DoNeedFragmentation(WifiRemoteStation* station,
1309 Ptr<const Packet> packet,
1310 bool normally);
1311 /**
1312 * \return a new station data structure
1313 */
1315 /**
1316 * \param station the station that we need to communicate
1317 * \param allowedWidth the allowed width in MHz to send a packet to the station
1318 * \return the TXVECTOR to use to send a packet to the station
1319 *
1320 * Note: This method is called before sending a unicast packet or a fragment
1321 * of a unicast packet to decide which transmission mode to use.
1322 */
1323 virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation* station, uint16_t allowedWidth) = 0;
1324 /**
1325 * \param station the station that we need to communicate
1326 *
1327 * \return the transmission mode to use to send an RTS to the station
1328 *
1329 * Note: This method is called before sending an RTS to a station
1330 * to decide which transmission mode to use for the RTS.
1331 */
1333
1334 /**
1335 * This method is a pure virtual method that must be implemented by the sub-class.
1336 * This allows different types of WifiRemoteStationManager to respond differently,
1337 *
1338 * \param station the station that we failed to send RTS
1339 */
1340 virtual void DoReportRtsFailed(WifiRemoteStation* station) = 0;
1341 /**
1342 * This method is a pure virtual method that must be implemented by the sub-class.
1343 * This allows different types of WifiRemoteStationManager to respond differently,
1344 *
1345 * \param station the station that we failed to send DATA
1346 */
1347 virtual void DoReportDataFailed(WifiRemoteStation* station) = 0;
1348 /**
1349 * This method is a pure virtual method that must be implemented by the sub-class.
1350 * This allows different types of WifiRemoteStationManager to respond differently,
1351 *
1352 * \param station the station that we successfully sent RTS
1353 * \param ctsSnr the SNR of the CTS we received
1354 * \param ctsMode the WifiMode the receiver used to send the CTS
1355 * \param rtsSnr the SNR of the RTS we sent
1356 */
1357 virtual void DoReportRtsOk(WifiRemoteStation* station,
1358 double ctsSnr,
1359 WifiMode ctsMode,
1360 double rtsSnr) = 0;
1361 /**
1362 * This method is a pure virtual method that must be implemented by the sub-class.
1363 * This allows different types of WifiRemoteStationManager to respond differently,
1364 *
1365 * \param station the station that we successfully sent RTS
1366 * \param ackSnr the SNR of the ACK we received
1367 * \param ackMode the WifiMode the receiver used to send the ACK
1368 * \param dataSnr the SNR of the DATA we sent
1369 * \param dataChannelWidth the channel width (in MHz) of the DATA we sent
1370 * \param dataNss the number of spatial streams used to send the DATA
1371 */
1372 virtual void DoReportDataOk(WifiRemoteStation* station,
1373 double ackSnr,
1374 WifiMode ackMode,
1375 double dataSnr,
1376 uint16_t dataChannelWidth,
1377 uint8_t dataNss) = 0;
1378 /**
1379 * This method is a pure virtual method that must be implemented by the sub-class.
1380 * This allows different types of WifiRemoteStationManager to respond differently,
1381 *
1382 * \param station the station that we failed to send RTS
1383 */
1384 virtual void DoReportFinalRtsFailed(WifiRemoteStation* station) = 0;
1385 /**
1386 * This method is a pure virtual method that must be implemented by the sub-class.
1387 * This allows different types of WifiRemoteStationManager to respond differently,
1388 *
1389 * \param station the station that we failed to send DATA
1390 */
1391 virtual void DoReportFinalDataFailed(WifiRemoteStation* station) = 0;
1392 /**
1393 * This method is a pure virtual method that must be implemented by the sub-class.
1394 * This allows different types of WifiRemoteStationManager to respond differently,
1395 *
1396 * \param station the station that sent the DATA to us
1397 * \param rxSnr the SNR of the DATA we received
1398 * \param txMode the WifiMode the sender used to send the DATA
1399 */
1400 virtual void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) = 0;
1401 /**
1402 * Typically called per A-MPDU, either when a Block ACK was successfully received
1403 * or when a BlockAckTimeout has elapsed. This method is a virtual method that must
1404 * be implemented by the sub-class intended to handle A-MPDUs. This allows different
1405 * types of WifiRemoteStationManager to respond differently.
1406 *
1407 * \param station the station that sent the DATA to us
1408 * \param nSuccessfulMpdus number of successfully transmitted MPDUs.
1409 * A value of 0 means that the Block ACK was missed.
1410 * \param nFailedMpdus number of unsuccessfuly transmitted MPDUs.
1411 * \param rxSnr received SNR of the block ack frame itself
1412 * \param dataSnr data SNR reported by remote station
1413 * \param dataChannelWidth the channel width (in MHz) of the A-MPDU we sent
1414 * \param dataNss the number of spatial streams used to send the A-MPDU
1415 */
1416 virtual void DoReportAmpduTxStatus(WifiRemoteStation* station,
1417 uint16_t nSuccessfulMpdus,
1418 uint16_t nFailedMpdus,
1419 double rxSnr,
1420 double dataSnr,
1421 uint16_t dataChannelWidth,
1422 uint8_t dataNss);
1423
1424 /**
1425 * Return the state of the station associated with the given address.
1426 *
1427 * \param address the address of the station
1428 * \return WifiRemoteStationState corresponding to the address
1429 */
1430 std::shared_ptr<WifiRemoteStationState> LookupState(Mac48Address address) const;
1431 /**
1432 * Return the station associated with the given address.
1433 *
1434 * \param address the address of the station
1435 *
1436 * \return WifiRemoteStation corresponding to the address
1437 */
1438 WifiRemoteStation* Lookup(Mac48Address address) const;
1439
1440 /**
1441 * Actually sets the fragmentation threshold, it also checks the validity of
1442 * the given threshold.
1443 *
1444 * \param threshold the fragmentation threshold
1445 */
1446 void DoSetFragmentationThreshold(uint32_t threshold);
1447 /**
1448 * Return the current fragmentation threshold
1449 *
1450 * \return the fragmentation threshold
1451 */
1453 /**
1454 * Return the number of fragments needed for the given packet.
1455 *
1456 * \param mpdu the packet to be fragmented
1457 *
1458 * \return the number of fragments needed
1459 */
1461
1462 /**
1463 * This is a pointer to the WifiPhy associated with this
1464 * WifiRemoteStationManager that is set on call to
1465 * WifiRemoteStationManager::SetupPhy(). Through this pointer the
1466 * station manager can determine PHY characteristics, such as the
1467 * set of all transmission rates that may be supported (the
1468 * "DeviceRateSet").
1469 */
1471 /**
1472 * This is a pointer to the WifiMac associated with this
1473 * WifiRemoteStationManager that is set on call to
1474 * WifiRemoteStationManager::SetupMac(). Through this pointer the
1475 * station manager can determine MAC characteristics, such as the
1476 * interframe spaces.
1477 */
1479
1480 /**
1481 * This member is the list of WifiMode objects that comprise the
1482 * BSSBasicRateSet parameter. This list is constructed through calls
1483 * to WifiRemoteStationManager::AddBasicMode(), and an API that
1484 * allows external access to it is available through
1485 * WifiRemoteStationManager::GetNBasicModes() and
1486 * WifiRemoteStationManager::GetBasicMode().
1487 */
1488 WifiModeList m_bssBasicRateSet; //!< basic rate set
1489 WifiModeList m_bssBasicMcsSet; //!< basic MCS set
1490
1491 StationStates m_states; //!< States of known stations
1492 Stations m_stations; //!< Information for each known stations
1493
1494 uint32_t m_maxSsrc; //!< Maximum STA short retry count (SSRC)
1495 uint32_t m_maxSlrc; //!< Maximum STA long retry count (SLRC)
1496 uint32_t m_rtsCtsThreshold; //!< Threshold for RTS/CTS
1497 uint32_t m_fragmentationThreshold; //!< Current threshold for fragmentation
1498 uint8_t m_defaultTxPowerLevel; //!< Default transmission power level
1499 WifiMode m_nonUnicastMode; //!< Transmission mode for non-unicast Data frames
1500 bool m_useNonErpProtection; //!< flag if protection for non-ERP stations against ERP
1501 //!< transmissions is enabled
1502 bool m_useNonHtProtection; //!< flag if protection for non-HT stations against HT transmissions
1503 //!< is enabled
1504 bool m_shortPreambleEnabled; //!< flag if short PHY preamble is enabled
1505 bool m_shortSlotTimeEnabled; //!< flag if short slot time is enabled
1506 ProtectionMode m_erpProtectionMode; //!< Protection mode for ERP stations when non-ERP stations
1507 //!< are detected
1509 m_htProtectionMode; //!< Protection mode for HT stations when non-HT stations are detected
1510
1511 std::array<uint32_t, AC_BE_NQOS> m_ssrc; //!< short retry count per AC
1512 std::array<uint32_t, AC_BE_NQOS> m_slrc; //!< long retry count per AC
1513
1514 /**
1515 * The trace source fired when the transmission of a single RTS has failed
1516 */
1518 /**
1519 * The trace source fired when the transmission of a single data packet has failed
1520 */
1522 /**
1523 * The trace source fired when the transmission of a RTS has
1524 * exceeded the maximum number of attempts
1525 */
1527 /**
1528 * The trace source fired when the transmission of a data packet has
1529 * exceeded the maximum number of attempts
1530 */
1532};
1533
1534} // namespace ns3
1535
1536#endif /* WIFI_REMOTE_STATION_MANAGER_H */
Class for representing data rates.
Definition: data-rate.h:89
The IEEE 802.11be EHT Capabilities.
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
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
The IEEE 802.11ac VHT Capabilities.
Implements the IEEE 802.11 MAC header.
represent a single transmission mode
Definition: wifi-mode.h:51
TID independent remote station statistics.
hold a list of per-remote-station state.
void ReportDataFailed(Ptr< const WifiMpdu > mpdu)
Should be invoked whenever the AckTimeout associated to a transmission attempt expires.
bool GetQosSupported(Mac48Address address) const
Return whether the given station is QoS capable.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
WifiTxVector GetAckTxVector(Mac48Address to, const WifiTxVector &dataTxVector) const
Return a TXVECTOR for the Ack frame given the destination and the mode of the Data used by the sender...
virtual bool DoNeedFragmentation(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
uint32_t m_fragmentationThreshold
Current threshold for fragmentation.
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void SetPsMode(const Mac48Address &address, bool isInPsMode)
Register whether the STA is in Power Save mode or not.
uint8_t GetNess(const WifiRemoteStation *station) const
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
bool GetEmlsrEnabled(const Mac48Address &address) const
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
uint32_t GetNFragments(Ptr< const WifiMpdu > mpdu)
Return the number of fragments needed for the given packet.
uint16_t GetAssociationId(Mac48Address remoteAddress) const
Get the AID of a remote station.
ProtectionMode m_htProtectionMode
Protection mode for HT stations when non-HT stations are detected.
WifiMode GetDefaultModeForSta(const WifiRemoteStation *st) const
Return the default MCS to use to transmit frames to the given station.
void AdjustTxVectorForIcf(WifiTxVector &txVector) const
Adjust the TXVECTOR for an initial Control frame to ensure that the modulation class is non-HT and th...
std::array< uint32_t, AC_BE_NQOS > m_slrc
long retry count per AC
WifiRemoteStation * Lookup(Mac48Address address) const
Return the station associated with the given address.
uint32_t GetFragmentationThreshold() const
Return the fragmentation threshold.
bool NeedRetransmission(Ptr< const WifiMpdu > mpdu)
uint8_t GetNBasicModes() const
Return the number of basic modes we support.
bool UseLdpcForDestination(Mac48Address dest) const
uint32_t m_maxSsrc
Maximum STA short retry count (SSRC)
void SetRtsCtsThreshold(uint32_t threshold)
Sets the RTS threshold.
void AddAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to store all of the MCS supported by a destination which is also supported loc...
TracedCallback< Mac48Address > m_macTxRtsFailed
The trace source fired when the transmission of a single RTS has failed.
virtual bool DoNeedRts(WifiRemoteStation *station, uint32_t size, bool normally)
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
void DoSetFragmentationThreshold(uint32_t threshold)
Actually sets the fragmentation threshold, it also checks the validity of the given threshold.
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
virtual void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr)=0
This method is a pure virtual method that must be implemented by the sub-class.
bool GetShortSlotTimeEnabled() const
Return whether the device uses short slot time.
void DoDispose() override
Destructor implementation.
void AddStationMleCommonInfo(Mac48Address from, const std::shared_ptr< CommonInfoBasicMle > &mleCommonInfo)
Records the Common Info field advertised by the given remote station in a Multi-Link Element.
virtual void DoReportDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
bool NeedRts(const WifiMacHeader &header, uint32_t size)
bool IsLastFragment(Ptr< const WifiMpdu > mpdu, uint32_t fragmentNumber)
void ReportFinalDataFailed(Ptr< const WifiMpdu > mpdu)
Should be invoked after calling ReportDataFailed if NeedRetransmission returns false.
uint32_t GetNNonErpBasicModes() const
Return the number of non-ERP basic modes we support.
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
bool m_useNonHtProtection
flag if protection for non-HT stations against HT transmissions is enabled
bool GetShortPreambleSupported(Mac48Address address) const
Return whether the station supports short PHY preamble or not.
void(* PowerChangeTracedCallback)(double oldPower, double newPower, Mac48Address remoteAddress)
TracedCallback signature for power change events.
void AddAllSupportedModes(Mac48Address address)
Invoked in a STA or AP to store all of the modes supported by a destination which is also supported l...
std::optional< Mac48Address > GetAffiliatedStaAddress(const Mac48Address &mldAddress) const
Get the address of the remote station operating on this link and affiliated with the MLD having the g...
WifiMode GetNonErpBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes that is not an ERP mode.
void ReportRtsOk(const WifiMacHeader &header, double ctsSnr, WifiMode ctsMode, double rtsSnr)
Should be invoked whenever we receive the CTS associated to an RTS we just sent.
Ptr< WifiPhy > GetPhy() const
Return the WifiPhy.
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
std::optional< std::reference_wrapper< CommonInfoBasicMle::EmlCapabilities > > GetStationEmlCapabilities(const Mac48Address &from)
WifiTxVector GetBlockAckTxVector(Mac48Address to, const WifiTxVector &dataTxVector) const
Return a TXVECTOR for the BlockAck frame given the destination and the mode of the Data used by the s...
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the supported MCS by a destination.
uint32_t DoGetFragmentationThreshold() const
Return the current fragmentation threshold.
WifiModeList m_bssBasicMcsSet
basic MCS set
TracedCallback< Mac48Address > m_macTxFinalRtsFailed
The trace source fired when the transmission of a RTS has exceeded the maximum number of attempts.
WifiMode GetNonUnicastMode() const
Return a mode for non-unicast packets.
bool m_shortPreambleEnabled
flag if short PHY preamble is enabled
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities)
Records VHT capabilities of the remote station.
bool GetShortSlotTimeSupported(Mac48Address address) const
Return whether the station supports short ERP slot time or not.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PHY preambles.
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth)=0
WifiMode GetDefaultMcs() const
Return the default Modulation and Coding Scheme (MCS) index.
Ptr< WifiPhy > m_wifiPhy
This is a pointer to the WifiPhy associated with this WifiRemoteStationManager that is set on call to...
void AddBasicMcs(WifiMode mcs)
Add a given Modulation and Coding Scheme (MCS) index to the set of basic MCS.
void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
uint8_t m_defaultTxPowerLevel
Default transmission power level.
bool GetErpOfdmSupported(const Mac48Address &address) const
Return whether the station supports ERP OFDM or not.
static TypeId GetTypeId()
Get the type ID.
WifiMode m_nonUnicastMode
Transmission mode for non-unicast Data frames.
void SetUseNonHtProtection(bool enable)
Enable or disable protection for non-HT stations.
uint16_t GetGuardInterval() const
Return the supported HE guard interval duration (in nanoseconds).
bool IsAssociated(Mac48Address address) const
Return whether the station associated.
Ptr< const HtCapabilities > GetStationHtCapabilities(Mac48Address from)
Return the HT capabilities sent by the remote station.
bool NeedFragmentation(Ptr< const WifiMpdu > mpdu)
void ReportAmpduTxStatus(Mac48Address address, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, WifiTxVector dataTxVector)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
bool GetDsssSupported(const Mac48Address &address) const
Return whether the station supports DSSS or not.
uint32_t GetFragmentOffset(Ptr< const WifiMpdu > mpdu, uint32_t fragmentNumber)
void SetQosSupport(Mac48Address from, bool qosSupported)
Records QoS support of the remote station.
WifiRemoteStationInfo GetInfo(Mac48Address address)
bool GetOfdmSupported(const Mac48Address &address) const
Return whether the station supports OFDM or not.
void(* RateChangeTracedCallback)(DataRate oldRate, DataRate newRate, Mac48Address remoteAddress)
TracedCallback signature for rate change events.
uint32_t GetFragmentSize(Ptr< const WifiMpdu > mpdu, uint32_t fragmentNumber)
WifiTxVector GetCtsToSelfTxVector()
Since CTS-to-self parameters are not dependent on the station, it is implemented in wifi remote stati...
uint8_t GetNBasicMcs() const
Return the number of basic MCS index.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetHtSupported() const
Return whether the device has HT capability support enabled.
void RecordWaitAssocTxOk(Mac48Address address)
Records that we are waiting for an ACK for the association response we sent.
void SetFragmentationThreshold(uint32_t threshold)
Sets a fragmentation threshold.
Ptr< WifiMac > m_wifiMac
This is a pointer to the WifiMac associated with this WifiRemoteStationManager that is set on call to...
void RecordGotAssocTxOk(Mac48Address address)
Records that we got an ACK for the association response we sent.
bool GetLdpcSupported() const
Return whether the device has LDPC support enabled.
std::unordered_map< Mac48Address, std::shared_ptr< WifiRemoteStationState >, WifiAddressHash > StationStates
A map of WifiRemoteStationStates with Mac48Address as key.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
WifiTxVector GetRtsTxVector(Mac48Address address, uint16_t allowedWidth)
bool GetEhtSupported() const
Return whether the device has EHT capability support enabled.
void AddSupportedMode(Mac48Address address, WifiMode mode)
Invoked in a STA or AP to store the set of modes supported by a destination which is also supported l...
std::optional< double > GetMostRecentRssi(Mac48Address address) const
std::shared_ptr< WifiRemoteStationState > LookupState(Mac48Address address) const
Return the state of the station associated with the given address.
Ptr< WifiMac > GetMac() const
Return the WifiMac.
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index.
std::array< uint32_t, AC_BE_NQOS > m_ssrc
short retry count per AC
Ptr< const EhtCapabilities > GetStationEhtCapabilities(Mac48Address from)
Return the EHT capabilities sent by the remote station.
void RecordAssocRefused(Mac48Address address)
Records that association request was refused.
bool IsInPsMode(const Mac48Address &address) const
Return whether the STA is currently in Power Save mode.
void ReportFinalRtsFailed(const WifiMacHeader &header)
Should be invoked after calling ReportRtsFailed if NeedRetransmission returns false.
StationStates m_states
States of known stations.
bool NeedCtsToSelf(WifiTxVector txVector)
Return if we need to do CTS-to-self before sending a DATA.
std::unordered_map< Mac48Address, WifiRemoteStation *, WifiAddressHash > Stations
A map of WifiRemoteStations with Mac48Address as key.
WifiTxVector GetCtsTxVector(Mac48Address to, WifiMode rtsTxMode) const
Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS used by the sender.
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
Ptr< const HeCapabilities > GetStationHeCapabilities(Mac48Address from)
Return the HE capabilities sent by the remote station.
WifiMode GetBasicMcs(uint8_t i) const
Return the MCS at the given list index.
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
TracedCallback< Mac48Address > m_macTxDataFailed
The trace source fired when the transmission of a single data packet has failed.
uint16_t GetStaId(Mac48Address address, const WifiTxVector &txVector) const
If the given TXVECTOR is used for a MU transmission, return the STAID of the station with the given a...
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
void AddStationEhtCapabilities(Mac48Address from, EhtCapabilities ehtCapabilities)
Records EHT capabilities of the remote station.
void AddSupportedPhyPreamble(Mac48Address address, bool isShortPreambleSupported)
Record whether the short PHY preamble is supported by the station.
bool GetEmlsrSupported(const Mac48Address &address) const
bool GetShortGuardIntervalSupported() const
Return whether the device has SGI support enabled.
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
virtual void DoReportRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
void SetDefaultTxPowerLevel(uint8_t txPower)
Set the default transmission power level.
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
Stations m_stations
Information for each known stations.
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)=0
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
std::optional< std::reference_wrapper< CommonInfoBasicMle::MldCapabilities > > GetStationMldCapabilities(const Mac48Address &from)
uint32_t GetNNonErpSupported(const WifiRemoteStation *station) const
Return the number of non-ERP modes supported by the given station.
uint16_t GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
uint32_t m_maxSlrc
Maximum STA long retry count (SLRC)
virtual WifiRemoteStation * DoCreateStation() const =0
void Reset()
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
bool GetUseNonErpProtection() const
Return whether the device supports protection of non-ERP stations.
bool IsAssocRefused(Mac48Address address) const
Return whether we refused an association request from the given station.
void SetAssociationId(Mac48Address remoteAddress, uint16_t aid)
Record the AID of a remote station.
virtual void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
bool GetVhtSupported() const
Return whether the device has VHT capability support enabled.
Ptr< const VhtCapabilities > GetStationVhtCapabilities(Mac48Address from)
Return the VHT capabilities sent by the remote station.
ProtectionMode m_erpProtectionMode
Protection mode for ERP stations when non-ERP stations are detected.
WifiModeList m_bssBasicRateSet
This member is the list of WifiMode objects that comprise the BSSBasicRateSet parameter.
virtual void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)=0
This method is a pure virtual method that must be implemented by the sub-class.
ProtectionMode
ProtectionMode enumeration.
WifiTxVector GetDataTxVector(const WifiMacHeader &header, uint16_t allowedWidth)
void ReportDataOk(Ptr< const WifiMpdu > mpdu, double ackSnr, WifiMode ackMode, double dataSnr, WifiTxVector dataTxVector)
Should be invoked whenever we receive the ACK associated to a data packet we just sent.
void ReportRtsFailed(const WifiMacHeader &header)
Should be invoked whenever the RtsTimeout associated to a transmission attempt expires.
void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported)
Record whether the short ERP slot time is supported by the station.
bool GetShortPreambleEnabled() const
Return whether the device uses short PHY preambles.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
bool GetHeSupported() const
Return whether the device has HE capability support enabled.
virtual void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)=0
This method is a pure virtual method that must be implemented by the sub-class.
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
virtual bool DoNeedRetransmission(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
WifiMode GetDefaultMode() const
Return the default transmission mode.
void SetEmlsrEnabled(const Mac48Address &from, bool emlsrEnabled)
void RecordGotAssocTxFailed(Mac48Address address)
Records that we missed an ACK for the association response we sent.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &address) const
Get the address of the MLD the given station is affiliated with, if any.
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
virtual void SetupMac(const Ptr< WifiMac > mac)
Set up MAC associated with this device since it is the object that knows the full set of timing param...
uint32_t m_rtsCtsThreshold
Threshold for RTS/CTS.
bool m_useNonErpProtection
flag if protection for non-ERP stations against ERP transmissions is enabled
WifiMode GetControlAnswerMode(WifiMode reqMode) const
Get control answer mode function.
bool m_shortSlotTimeEnabled
flag if short slot time is enabled
bool IsWaitAssocTxOk(Mac48Address address) const
Return whether we are waiting for an ACK for the association response we sent.
void SetMaxSlrc(uint32_t maxSlrc)
Sets the maximum STA long retry count (SLRC).
TracedCallback< Mac48Address > m_macTxFinalDataFailed
The trace source fired when the transmission of a data packet has exceeded the maximum number of atte...
bool GetUseNonHtProtection() const
Return whether the device supports protection of non-HT stations.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes.
Definition: wifi-mode.h:262
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:69
Function object to compute the hash of a MAC address.
Definition: qos-utils.h:56
hold per-remote-station state.
WifiRemoteStationState * m_state
Remote station state.
std::pair< double, Time > m_rssiAndUpdateTimePair
RSSI (in dBm) of the most recent packet received from the remote station along with update time.
A struct that holds information about each remote station.
std::shared_ptr< CommonInfoBasicMle > m_mleCommonInfo
remote station Multi-Link Element Common Info
Mac48Address m_address
Mac48Address of the remote station.
bool m_shortSlotTime
Flag if short ERP slot time is supported by the remote station.
bool m_dsssSupported
Flag if DSSS is supported by the remote station.
uint16_t m_channelWidth
Channel width (in MHz) supported by the remote station.
uint16_t m_aid
AID of the remote station (unused if this object is installed on a non-AP station)
bool m_ofdmSupported
Flag if OFDM is supported by the remote station.
enum ns3::WifiRemoteStationState::@75 m_state
State of the station.
uint8_t m_ness
Number of extended spatial streams of the remote station.
bool m_aggregation
Flag if MPDU aggregation is used by the remote station.
bool m_qosSupported
Flag if QoS is supported by the station.
WifiModeList m_operationalRateSet
This member is the list of WifiMode objects that comprise the OperationalRateSet parameter for this r...
WifiModeList m_operationalMcsSet
operational MCS set
uint16_t m_guardInterval
HE Guard interval duration (in nanoseconds) supported by the remote station.
bool m_isInPsMode
Flag if the STA is currently in PS mode.
Ptr< const EhtCapabilities > m_ehtCapabilities
remote station EHT capabilities
bool m_shortPreamble
Flag if short PHY preamble is supported by the remote station.
bool m_erpOfdmSupported
Flag if ERP OFDM is supported by the remote station.
Ptr< const VhtCapabilities > m_vhtCapabilities
remote station VHT capabilities
WifiRemoteStationInfo m_info
remote station info
bool m_emlsrEnabled
whether EMLSR mode is enabled on this link
Ptr< const HtCapabilities > m_htCapabilities
remote station HT capabilities
Ptr< const HeCapabilities > m_heCapabilities
remote station HE capabilities