A Discrete-Event Network Simulator
API
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 
43 namespace ns3
44 {
45 
46 class WifiPhy;
47 class WifiMac;
48 class WifiMacHeader;
49 class Packet;
50 class WifiMpdu;
51 class WifiTxVector;
52 
53 struct WifiRemoteStationState;
54 struct RxSignalInfo;
55 
68 {
69  virtual ~WifiRemoteStation(){};
71  std::pair<double, Time>
74 };
75 
80 {
84  enum
85  {
92 
105  uint16_t m_aid;
116  std::shared_ptr<CommonInfoBasicMle> m_mleCommonInfo;
118 
119  uint16_t m_channelWidth;
120  uint16_t m_guardInterval;
122  uint8_t m_ness;
128 };
129 
137 {
138  public:
143  static TypeId GetTypeId();
144 
146  ~WifiRemoteStationManager() override;
147 
150  {
153  };
154 
158  using Stations = std::unordered_map<Mac48Address, WifiRemoteStation*, WifiAddressHash>;
163  std::unordered_map<Mac48Address, std::shared_ptr<WifiRemoteStationState>, WifiAddressHash>;
164 
171  virtual void SetupPhy(const Ptr<WifiPhy> phy);
178  virtual void SetupMac(const Ptr<WifiMac> mac);
179 
188  virtual int64_t AssignStreams(int64_t stream);
189 
195  void SetMaxSsrc(uint32_t maxSsrc);
201  void SetMaxSlrc(uint32_t maxSlrc);
207  void SetRtsCtsThreshold(uint32_t threshold);
208 
214  uint32_t GetFragmentationThreshold() const;
221  void SetFragmentationThreshold(uint32_t threshold);
222 
229  void SetAssociationId(Mac48Address remoteAddress, uint16_t aid);
236  void SetQosSupport(Mac48Address from, bool qosSupported);
241  void SetEmlsrEnabled(const Mac48Address& from, bool emlsrEnabled);
248  void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities);
255  void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities);
262  void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities);
269  void AddStationEhtCapabilities(Mac48Address from, EhtCapabilities ehtCapabilities);
278  const std::shared_ptr<CommonInfoBasicMle>& mleCommonInfo);
311  std::optional<std::reference_wrapper<CommonInfoBasicMle::EmlCapabilities>>
317  std::optional<std::reference_wrapper<CommonInfoBasicMle::MldCapabilities>>
324  bool GetHtSupported() const;
330  bool GetVhtSupported() const;
336  bool GetHeSupported() const;
342  bool GetEhtSupported() const;
348  bool GetLdpcSupported() const;
354  bool GetShortGuardIntervalSupported() const;
360  uint16_t GetGuardInterval() const;
366  void SetUseNonErpProtection(bool enable);
373  bool GetUseNonErpProtection() const;
379  void SetUseNonHtProtection(bool enable);
386  bool GetUseNonHtProtection() const;
392  void SetShortPreambleEnabled(bool enable);
399  bool GetShortPreambleEnabled() const;
405  void SetShortSlotTimeEnabled(bool enable);
412  bool GetShortSlotTimeEnabled() const;
413 
417  void Reset();
418 
426  void AddBasicMode(WifiMode mode);
432  WifiMode GetDefaultMode() const;
438  uint8_t GetNBasicModes() const;
446  WifiMode GetBasicMode(uint8_t i) const;
452  uint32_t GetNNonErpBasicModes() const;
460  WifiMode GetNonErpBasicMode(uint8_t i) const;
510  void AddBasicMcs(WifiMode mcs);
516  WifiMode GetDefaultMcs() const;
529  uint8_t GetNBasicMcs() const;
537  WifiMode GetBasicMcs(uint8_t i) const;
577  uint8_t GetNMcsSupported(Mac48Address address) const;
586  bool GetDsssSupported(const Mac48Address& address) const;
595  bool GetErpOfdmSupported(const Mac48Address& address) const;
604  bool GetOfdmSupported(const Mac48Address& address) const;
613  bool GetHtSupported(Mac48Address address) const;
631  bool GetHeSupported(Mac48Address address) const;
645  bool GetEmlsrSupported(const Mac48Address& address) const;
650  bool GetEmlsrEnabled(const Mac48Address& address) const;
651 
657  WifiMode GetNonUnicastMode() const;
658 
697  void AddSupportedPhyPreamble(Mac48Address address, bool isShortPreambleSupported);
705  void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported);
714  bool IsBrandNew(Mac48Address address) const;
723  bool IsAssociated(Mac48Address address) const;
767  bool IsAssocRefused(Mac48Address address) const;
774 
782  bool IsInPsMode(const Mac48Address& address) const;
789  void SetPsMode(const Mac48Address& address, bool isInPsMode);
790 
800  std::optional<Mac48Address> GetMldAddress(const Mac48Address& address) const;
809  std::optional<Mac48Address> GetAffiliatedStaAddress(const Mac48Address& mldAddress) const;
810 
816  WifiTxVector GetDataTxVector(const WifiMacHeader& header, uint16_t allowedWidth);
824  WifiTxVector GetRtsTxVector(Mac48Address address, uint16_t allowedWidth);
833  WifiTxVector GetCtsTxVector(Mac48Address to, WifiMode rtsTxMode) const;
848  void AdjustTxVectorForIcf(WifiTxVector& txVector) const;
857  WifiTxVector GetAckTxVector(Mac48Address to, const WifiTxVector& dataTxVector) const;
866  WifiTxVector GetBlockAckTxVector(Mac48Address to, const WifiTxVector& dataTxVector) const;
873  WifiMode GetControlAnswerMode(WifiMode reqMode) const;
874 
881  void ReportRtsFailed(const WifiMacHeader& header);
899  void ReportRtsOk(const WifiMacHeader& header, double ctsSnr, WifiMode ctsMode, double rtsSnr);
911  double ackSnr,
912  WifiMode ackMode,
913  double dataSnr,
914  WifiTxVector dataTxVector);
921  void ReportFinalRtsFailed(const WifiMacHeader& header);
942  uint16_t nSuccessfulMpdus,
943  uint16_t nFailedMpdus,
944  double rxSnr,
945  double dataSnr,
946  WifiTxVector dataTxVector);
947 
955  void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector);
956 
964  bool NeedRts(const WifiMacHeader& header, uint32_t size);
973  bool NeedCtsToSelf(WifiTxVector txVector);
974 
995  uint32_t GetFragmentSize(Ptr<const WifiMpdu> mpdu, uint32_t fragmentNumber);
1002  uint32_t GetFragmentOffset(Ptr<const WifiMpdu> mpdu, uint32_t fragmentNumber);
1009  bool IsLastFragment(Ptr<const WifiMpdu> mpdu, uint32_t fragmentNumber);
1010 
1014  uint8_t GetDefaultTxPowerLevel() const;
1031  std::optional<double> GetMostRecentRssi(Mac48Address address) const;
1037  void SetDefaultTxPowerLevel(uint8_t txPower);
1041  uint8_t GetNumberOfAntennas() const;
1045  uint8_t GetMaxNumberOfTransmitStreams() const;
1053  bool UseLdpcForDestination(Mac48Address dest) const;
1054 
1062  typedef void (*PowerChangeTracedCallback)(double oldPower,
1063  double newPower,
1065 
1073  typedef void (*RateChangeTracedCallback)(DataRate oldRate,
1074  DataRate newRate,
1076 
1082  Ptr<WifiPhy> GetPhy() const;
1088  Ptr<WifiMac> GetMac() const;
1089 
1090  protected:
1091  void DoDispose() override;
1100  WifiMode GetSupported(const WifiRemoteStation* station, uint8_t i) const;
1108  uint8_t GetNSupported(const WifiRemoteStation* station) const;
1117  bool GetQosSupported(const WifiRemoteStation* station) const;
1126  bool GetHtSupported(const WifiRemoteStation* station) const;
1135  bool GetVhtSupported(const WifiRemoteStation* station) const;
1144  bool GetHeSupported(const WifiRemoteStation* station) const;
1153  bool GetEhtSupported(const WifiRemoteStation* station) const;
1158  bool GetEmlsrSupported(const WifiRemoteStation* station) const;
1163  bool GetEmlsrEnabled(const WifiRemoteStation* station) const;
1173  WifiMode GetMcsSupported(const WifiRemoteStation* station, uint8_t i) const;
1181  uint8_t GetNMcsSupported(const WifiRemoteStation* station) const;
1190  WifiMode GetNonErpSupported(const WifiRemoteStation* station, uint8_t i) const;
1198  uint32_t GetNNonErpSupported(const WifiRemoteStation* station) const;
1206  Mac48Address GetAddress(const WifiRemoteStation* station) const;
1214  uint16_t GetChannelWidth(const WifiRemoteStation* station) const;
1223  bool GetShortGuardIntervalSupported(const WifiRemoteStation* station) const;
1231  uint16_t GetGuardInterval(const WifiRemoteStation* station) const;
1240  bool GetAggregation(const WifiRemoteStation* station) const;
1241 
1249  uint8_t GetNumberOfSupportedStreams(const WifiRemoteStation* station) const;
1257  uint8_t GetNess(const WifiRemoteStation* station) const;
1258 
1259  private:
1269  uint16_t GetStaId(Mac48Address address, const WifiTxVector& txVector) const;
1270 
1282  virtual bool DoNeedRts(WifiRemoteStation* station, uint32_t size, bool normally);
1294  virtual bool DoNeedRetransmission(WifiRemoteStation* station,
1295  Ptr<const Packet> packet,
1296  bool normally);
1308  virtual bool DoNeedFragmentation(WifiRemoteStation* station,
1309  Ptr<const Packet> packet,
1310  bool normally);
1314  virtual WifiRemoteStation* DoCreateStation() const = 0;
1323  virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation* station, uint16_t allowedWidth) = 0;
1333 
1340  virtual void DoReportRtsFailed(WifiRemoteStation* station) = 0;
1347  virtual void DoReportDataFailed(WifiRemoteStation* station) = 0;
1357  virtual void DoReportRtsOk(WifiRemoteStation* station,
1358  double ctsSnr,
1359  WifiMode ctsMode,
1360  double rtsSnr) = 0;
1372  virtual void DoReportDataOk(WifiRemoteStation* station,
1373  double ackSnr,
1374  WifiMode ackMode,
1375  double dataSnr,
1376  uint16_t dataChannelWidth,
1377  uint8_t dataNss) = 0;
1384  virtual void DoReportFinalRtsFailed(WifiRemoteStation* station) = 0;
1391  virtual void DoReportFinalDataFailed(WifiRemoteStation* station) = 0;
1400  virtual void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) = 0;
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 
1430  std::shared_ptr<WifiRemoteStationState> LookupState(Mac48Address address) const;
1439 
1446  void DoSetFragmentationThreshold(uint32_t threshold);
1452  uint32_t DoGetFragmentationThreshold() const;
1460  uint32_t GetNFragments(Ptr<const WifiMpdu> mpdu);
1461 
1479 
1490 
1493 
1494  uint32_t m_maxSsrc;
1495  uint32_t m_maxSlrc;
1510 
1511  std::array<uint32_t, AC_BE_NQOS> m_ssrc;
1512  std::array<uint32_t, AC_BE_NQOS> m_slrc;
1513 
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)
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...
virtual WifiRemoteStation * DoCreateStation() const =0
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...
address
Definition: first.py:47
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
mac
Definition: third.py:92
phy
Definition: third.py:89
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.
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
enum ns3::WifiRemoteStationState::@77 m_state
State of the station.
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