|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #ifndef WIFI_REMOTE_STATION_MANAGER_H
22 #define WIFI_REMOTE_STATION_MANAGER_H
25 #include <unordered_map>
26 #include "ns3/traced-callback.h"
27 #include "ns3/object.h"
28 #include "ns3/data-rate.h"
29 #include "ns3/mac48-address.h"
34 #include "ns3/ht-capabilities.h"
35 #include "ns3/vht-capabilities.h"
36 #include "ns3/he-capabilities.h"
44 class WifiMacQueueItem;
47 struct WifiRemoteStationState;
142 using Stations = std::unordered_map <Mac48Address, WifiRemoteStation *, WifiAddressHash>;
146 using StationStates = std::unordered_map <Mac48Address, WifiRemoteStationState *, WifiAddressHash>;
753 double ctsSnr,
WifiMode ctsMode,
double rtsSnr);
793 double rxSnr,
double dataSnr,
WifiTxVector dataTxVector);
1108 uint32_t size,
bool normally);
1182 double ctsSnr,
WifiMode ctsMode,
double rtsSnr) = 0;
1195 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) = 0;
1219 double rxSnr,
WifiMode txMode) = 0;
1236 double rxSnr,
double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss);
bool IsAssociated(Mac48Address address) const
Return whether the station associated.
a unique identifier for an interface.
uint8_t GetDefaultTxPowerLevel(void) const
The IEEE 802.11ac VHT Capabilities.
uint8_t GetNBasicMcs(void) const
Return the number of basic MCS index.
WifiModeList m_bssBasicRateSet
This member is the list of WifiMode objects that comprise the BSSBasicRateSet parameter.
bool m_shortPreambleEnabled
flag if short PHY preamble is enabled
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
WifiMode GetDefaultMcs(void) const
Return the default Modulation and Coding Scheme (MCS) index.
Ptr< WifiMac > GetMac(void) const
Return the WifiMac.
bool GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
uint16_t m_aid
AID of the remote station (unused if this object is installed on a non-AP station)
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...
Ptr< const VhtCapabilities > m_vhtCapabilities
remote station VHT capabilities
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
WifiRemoteStation * Lookup(Mac48Address address) const
Return the station associated with the given address.
void SetRtsCtsThreshold(uint32_t threshold)
Sets the RTS threshold.
bool UseLdpcForDestination(Mac48Address dest) const
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 AddBasicMcs(WifiMode mcs)
Add a given Modulation and Coding Scheme (MCS) index to the set of basic MCS.
void ReportRtsFailed(const WifiMacHeader &header)
Should be invoked whenever the RtsTimeout associated to a transmission attempt expires.
uint32_t GetNNonErpSupported(const WifiRemoteStation *station) const
Return the number of non-ERP modes supported by the given station.
WifiMode GetNonErpBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes that is not an ERP mode.
bool NeedFragmentation(Ptr< const WifiMacQueueItem > mpdu)
std::array< uint32_t, AC_BE_NQOS > m_ssrc
short retry count per AC
The IEEE 802.11ax HE Capabilities.
WifiMode GetControlAnswerMode(WifiMode reqMode) const
Get control answer mode function.
void RecordGotAssocTxFailed(Mac48Address address)
Records that we missed an ACK for the association response we sent.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
void SetAssociationId(Mac48Address remoteAddress, uint16_t aid)
Record the AID of a remote station.
hold a list of per-remote-station state.
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Ptr< WifiMac > m_wifiMac
This is a pointer to the WifiMac associated with this WifiRemoteStationManager that is set on call to...
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
uint16_t GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
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 ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
enum ns3::WifiRemoteStationState::@0 m_state
State of the station.
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...
bool GetShortPreambleSupported(Mac48Address address) const
Return whether the station supports short PHY preamble or not.
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...
bool m_useNonErpProtection
flag if protection for non-ERP stations against ERP transmissions is enabled
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
ProtectionMode
ProtectionMode enumeration.
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
uint32_t GetNFragments(Ptr< const WifiMacQueueItem > mpdu)
Return the number of fragments needed for the given packet.
TracedCallback< Mac48Address > m_macTxFinalRtsFailed
The trace source fired when the transmission of a RTS has exceeded the maximum number of attempts.
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
uint32_t m_maxSlrc
Maximum STA long retry count (SLRC)
TracedCallback< Mac48Address > m_macTxDataFailed
The trace source fired when the transmission of a single data packet has failed.
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...
WifiModeList m_operationalMcsSet
operational MCS set
uint32_t DoGetFragmentationThreshold(void) const
Return the current fragmentation threshold.
Smart pointer class similar to boost::intrusive_ptr.
ProtectionMode m_erpProtectionMode
Protection mode for ERP stations when non-ERP stations are detected.
Class for representing data rates.
Ptr< const HeCapabilities > GetStationHeCapabilities(Mac48Address from)
Return the HE capabilities sent by the remote station.
WifiMode GetNonUnicastMode(void) const
Return a mode for non-unicast packets.
uint16_t m_channelWidth
Channel width (in MHz) supported by the remote station.
void DoSetFragmentationThreshold(uint32_t threshold)
Actually sets the fragmentation threshold, it also checks the validity of the given threshold.
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 GetQosSupported(Mac48Address address) const
Return whether the given station is QoS capable.
std::array< uint32_t, AC_BE_NQOS > m_slrc
long retry count per AC
Ptr< const HtCapabilities > GetStationHtCapabilities(Mac48Address from)
Return the HT capabilities sent by the remote station.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the supported MCS by a destination.
represent a single transmission mode
bool NeedRts(const WifiMacHeader &header, uint32_t size)
virtual void DoReportDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
Stations m_stations
Information for each known stations.
void(* RateChangeTracedCallback)(DataRate oldRate, DataRate newRate, Mac48Address remoteAddress)
TracedCallback signature for rate change events.
void SetQosSupport(Mac48Address from, bool qosSupported)
Records QoS support of the remote station.
WifiMode m_defaultTxMode
The default transmission mode.
bool GetOfdmSupported(const Mac48Address &address) const
Return whether the station supports OFDM or not.
void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported)
Record whether the short ERP slot time is supported by the station.
A base class which provides memory management and object aggregation.
void Reset(void)
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
bool GetShortSlotTimeSupported(Mac48Address address) const
Return whether the station supports short ERP slot time or not.
The HT Capabilities Information Element.
WifiMode m_defaultTxMcs
The default transmission modulation-coding scheme (MCS)
uint8_t m_ness
Number of extended spatial streams of the remote station.
uint8_t m_defaultTxPowerLevel
Default transmission power level.
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.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
bool NeedCtsToSelf(WifiTxVector txVector)
Return if we need to do CTS-to-self before sending a DATA.
bool m_useNonHtProtection
flag if protection for non-HT stations against HT transmissions is enabled
bool m_ofdmSupported
Flag if OFDM is supported by the remote station.
uint8_t GetNess(const WifiRemoteStation *station) const
TracedCallback< Mac48Address > m_macTxFinalDataFailed
The trace source fired when the transmission of a data packet has exceeded the maximum number of atte...
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...
virtual ~WifiRemoteStation()
bool GetUseNonHtProtection(void) const
Return whether the device supports protection of non-HT stations.
bool m_shortSlotTime
Flag if short ERP slot time is supported by the remote station.
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...
WifiRemoteStationManager()
uint32_t GetFragmentOffset(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
WifiMode GetDefaultMode(void) const
Return the default transmission mode.
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
static TypeId GetTypeId(void)
Get the type ID.
ProtectionMode m_htProtectionMode
Protection mode for HT stations when non-HT stations are detected.
uint32_t m_rtsCtsThreshold
Threshold for RTS/CTS.
bool m_shortSlotTimeEnabled
flag if short slot time is enabled
bool GetErpOfdmSupported(const Mac48Address &address) const
Return whether the station supports ERP OFDM or not.
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...
void AddSupportedPhyPreamble(Mac48Address address, bool isShortPreambleSupported)
Record whether the short PHY preamble is supported by the station.
bool GetShortSlotTimeEnabled(void) const
Return whether the device uses short slot time.
bool GetLdpcSupported(void) const
Return whether the device has LDPC support enabled.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PHY preambles.
WifiMode GetBasicMcs(uint8_t i) const
Return the MCS at the given list index.
Ptr< const VhtCapabilities > GetStationVhtCapabilities(Mac48Address from)
Return the VHT capabilities sent by the remote station.
TracedCallback< Mac48Address > m_macTxRtsFailed
The trace source fired when the transmission of a single RTS has failed.
void(* PowerChangeTracedCallback)(double oldPower, double newPower, Mac48Address remoteAddress)
TracedCallback signature for power change events.
void RecordWaitAssocTxOk(Mac48Address address)
Records that we are waiting for an ACK for the association response we sent.
bool IsLastFragment(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities)
Records VHT capabilities of the remote station.
WifiTxVector GetDataTxVector(const WifiMacHeader &header)
bool m_qosSupported
Flag if QoS is supported by the station.
bool m_shortPreamble
Flag if short PHY preamble is supported by the remote 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...
hold per-remote-station state.
void ReportDataFailed(Ptr< const WifiMacQueueItem > mpdu)
Should be invoked whenever the AckTimeout associated to a transmission attempt expires.
virtual ~WifiRemoteStationManager()
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
virtual bool DoNeedRetransmission(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
WifiRemoteStationInfo m_info
remote station info
bool m_dsssSupported
Flag if DSSS is supported by the remote station.
uint8_t GetNumberOfAntennas(void) const
uint32_t GetFragmentationThreshold(void) const
Return the fragmentation threshold.
uint32_t GetFragmentSize(Ptr< const WifiMacQueueItem > mpdu, uint32_t fragmentNumber)
RxSignalInfo structure containing info on the received signal.
WifiRemoteStationState * m_state
Remote station state.
Ptr< const HtCapabilities > m_htCapabilities
remote station HT capabilities
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index.
virtual void DoReportRtsFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
uint16_t m_guardInterval
HE Guard interval duration (in nanoseconds) supported by the remote station.
void RecordGotAssocTxOk(Mac48Address address)
Records that we got an ACK for the association response we sent.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
virtual bool DoNeedRts(WifiRemoteStation *station, uint32_t size, bool normally)
void SetFragmentationThreshold(uint32_t threshold)
Sets a fragmentation threshold.
uint32_t m_fragmentationThreshold
Current threshold for fragmentation.
A struct that holds information about each remote station.
void SetMaxSlrc(uint32_t maxSlrc)
Sets the maximum STA long retry count (SLRC).
bool NeedRetransmission(Ptr< const WifiMacQueueItem > mpdu)
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
bool m_erpOfdmSupported
Flag if ERP OFDM is supported by the remote station.
Ptr< const HeCapabilities > m_heCapabilities
remote station HE capabilities
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
StationStates m_states
States of known stations.
double GetMostRecentRssi(Mac48Address address) const
uint8_t GetMaxNumberOfTransmitStreams(void) const
void SetUseNonHtProtection(bool enable)
Enable or disable protection for non-HT stations.
WifiMode m_nonUnicastMode
Transmission mode for non-unicast Data frames.
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.
WifiRemoteStationInfo GetInfo(Mac48Address address)
bool GetDsssSupported(const Mac48Address &address) const
Return whether the station supports DSSS or not.
std::unordered_map< Mac48Address, WifiRemoteStation *, WifiAddressHash > Stations
A map of WifiRemoteStations with Mac48Address as key.
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
WifiModeList m_operationalRateSet
This member is the list of WifiMode objects that comprise the OperationalRateSet parameter for this r...
Forward calls to a chain of Callback.
void SetDefaultTxPowerLevel(uint8_t txPower)
Set the default transmission power level.
void ReportDataOk(Ptr< const WifiMacQueueItem > 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.
WifiModeList m_bssBasicMcsSet
basic MCS set
Ptr< WifiPhy > m_wifiPhy
This is a pointer to the WifiPhy associated with this WifiRemoteStationManager that is set on call to...
Mac48Address m_address
Mac48Address of the remote station.
std::pair< double, Time > m_rssiAndUpdateTimePair
RSSI (in dBm) of the most recent packet received from the remote station along with update time.
void ReportFinalRtsFailed(const WifiMacHeader &header)
Should be invoked after calling ReportRtsFailed if NeedRetransmission returns false.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
uint32_t m_maxSsrc
Maximum STA short retry count (SSRC)
std::unordered_map< Mac48Address, WifiRemoteStationState *, WifiAddressHash > StationStates
A map of WifiRemoteStationStates with Mac48Address as key.
virtual WifiRemoteStation * DoCreateStation(void) const =0
WifiRemoteStationState * LookupState(Mac48Address address) const
Return the state of the station associated with the given address.
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)=0
uint16_t GetAssociationId(Mac48Address remoteAddress) const
Get the AID of a remote station.
virtual bool DoNeedFragmentation(WifiRemoteStation *station, Ptr< const Packet > packet, bool normally)
bool IsWaitAssocTxOk(Mac48Address address) const
Return whether we are waiting for an ACK for the association response we sent.
WifiTxVector GetRtsTxVector(Mac48Address address)
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...
TID independent remote station statistics.
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)=0
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t GetNNonErpBasicModes(void) const
Return the number of non-ERP basic modes we support.
void ReportFinalDataFailed(Ptr< const WifiMacQueueItem > mpdu)
Should be invoked after calling ReportDataFailed if NeedRetransmission returns false.
bool m_aggregation
Flag if MPDU aggregation is used by the remote station.
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.
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)=0
virtual void DoDispose(void)
Destructor implementation.
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
WifiTxVector GetCtsToSelfTxVector(void)
Since CTS-to-self parameters are not dependent on the station, it is implemented in wifi remote stati...