A Discrete-Event Network Simulator
API
ns3::StaWifiMac Class Reference

The Wifi MAC high model for a non-AP STA in a BSS. More...

#include "sta-wifi-mac.h"

+ Inheritance diagram for ns3::StaWifiMac:
+ Collaboration diagram for ns3::StaWifiMac:

Classes

struct  ApInfo
 Struct to hold information regarding observed AP through active/passive scanning. More...
 
struct  StaLinkEntity
 Structure holding information specific to a single link. More...
 

Public Types

using MgtFrameType = std::variant< MgtBeaconHeader, MgtProbeResponseHeader, MgtAssocResponseHeader >
 type of the management frames used to get info about APs More...
 
- Public Types inherited from ns3::WifiMac
typedef Callback< void, Ptr< const Packet >, Mac48Address, Mac48AddressForwardUpCallback
 This type defines the callback of a higher layer that a WifiMac(-derived) object invokes to pass a packet up the stack. More...
 
using OriginatorAgreementOptConstRef = std::optional< std::reference_wrapper< const OriginatorBlockAckAgreement > >
 optional const reference to OriginatorBlockAckAgreement More...
 
using RecipientAgreementOptConstRef = std::optional< std::reference_wrapper< const RecipientBlockAckAgreement > >
 optional const reference to RecipientBlockAckAgreement More...
 

Public Member Functions

 StaWifiMac ()
 
 ~StaWifiMac () override
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model. More...
 
bool CanForwardPacketsTo (Mac48Address to) const override
 Return true if packets can be forwarded to the given destination, false otherwise. More...
 
void Enqueue (Ptr< Packet > packet, Mac48Address to) override
 
uint16_t GetAssociationId () const
 Return the association ID. More...
 
std::set< uint8_t > GetSetupLinkIds () const
 Get the IDs of the setup links (if any). More...
 
bool IsAssociated () const
 Return whether we are associated with an AP. More...
 
void NotifyChannelSwitching (uint8_t linkId) override
 Notify that channel on the given link has been switched. More...
 
void ScanningTimeout (const std::optional< ApInfo > &bestAp)
 This method is called after wait beacon timeout or wait probe request timeout has occurred. More...
 
void SendProbeRequest ()
 Forward a probe request packet to the DCF. More...
 
void SetAssocManager (Ptr< WifiAssocManager > assocManager)
 Set the Association Manager. More...
 
void SetWifiPhys (const std::vector< Ptr< WifiPhy >> &phys) override
 
- Public Member Functions inherited from ns3::WifiMac
 WifiMac ()
 
 WifiMac (const WifiMac &)=delete
 
 ~WifiMac () override
 
virtual void ConfigureStandard (WifiStandard standard)
 
virtual void Enqueue (Ptr< Packet > packet, Mac48Address to, Mac48Address from)
 
Mac48Address GetAddress () const
 
OriginatorAgreementOptConstRef GetBaAgreementEstablishedAsOriginator (Mac48Address recipient, uint8_t tid) const
 
RecipientAgreementOptConstRef GetBaAgreementEstablishedAsRecipient (Mac48Address originator, uint8_t tid) const
 
BlockAckReqType GetBarTypeAsOriginator (const Mac48Address &recipient, uint8_t tid) const
 
BlockAckReqType GetBarTypeAsRecipient (Mac48Address originator, uint8_t tid) const
 
BlockAckType GetBaTypeAsOriginator (const Mac48Address &recipient, uint8_t tid) const
 
BlockAckType GetBaTypeAsRecipient (Mac48Address originator, uint8_t tid) const
 
Mac48Address GetBssid (uint8_t linkId) const
 
Ptr< ChannelAccessManagerGetChannelAccessManager (uint8_t linkId=SINGLE_LINK_OP_ID) const
 Get the Channel Access Manager associated with the given link. More...
 
Ptr< WifiNetDeviceGetDevice () const
 Return the device this PHY is associated with. More...
 
bool GetDsssSupported (uint8_t linkId) const
 Return whether the device supports DSSS on the given link. More...
 
EhtCapabilities GetEhtCapabilities (uint8_t linkId) const
 Return the EHT capabilities of the device for the given link. More...
 
Ptr< EhtConfigurationGetEhtConfiguration () const
 
bool GetEhtSupported () const
 Return whether the device supports EHT. More...
 
bool GetEhtSupported (const Mac48Address &address) const
 
bool GetErpSupported (uint8_t linkId) const
 Return whether the device supports ERP on the given link. More...
 
ExtendedCapabilities GetExtendedCapabilities () const
 Return the extended capabilities of the device. More...
 
Ptr< FrameExchangeManagerGetFrameExchangeManager (uint8_t linkId=SINGLE_LINK_OP_ID) const
 Get the Frame Exchange Manager associated with the given link. More...
 
HeCapabilities GetHeCapabilities (uint8_t linkId) const
 Return the HE capabilities of the device for the given link. More...
 
Ptr< HeConfigurationGetHeConfiguration () const
 
bool GetHeSupported () const
 Return whether the device supports HE. More...
 
bool GetHeSupported (const Mac48Address &address) const
 
HtCapabilities GetHtCapabilities (uint8_t linkId) const
 Return the HT capabilities of the device for the given link. More...
 
Ptr< HtConfigurationGetHtConfiguration () const
 
bool GetHtSupported () const
 Return whether the device supports HT. More...
 
bool GetHtSupported (const Mac48Address &address) const
 
virtual std::optional< uint8_t > GetLinkIdByAddress (const Mac48Address &address) const
 Get the ID of the link having the given MAC address, if any. More...
 
Mac48Address GetLocalAddress (const Mac48Address &remoteAddr) const
 Get the local MAC address used to communicate with a remote STA. More...
 
Ptr< WifiMacQueueSchedulerGetMacQueueScheduler () const
 Get the wifi MAC queue scheduler. More...
 
uint32_t GetMaxAmpduSize (AcIndex ac) const
 Return the maximum A-MPDU size of the given Access Category. More...
 
uint16_t GetMaxAmsduSize (AcIndex ac) const
 Return the maximum A-MSDU size of the given Access Category. More...
 
std::optional< Mac48AddressGetMldAddress (const Mac48Address &remoteAddr) const
 
uint8_t GetNLinks () const
 Get the number of links (can be greater than 1 for 11be devices only). More...
 
bool GetQosSupported () const
 Return whether the device supports QoS. More...
 
Ptr< QosTxopGetQosTxop (AcIndex ac) const
 Accessor for a specified EDCA object. More...
 
Ptr< QosTxopGetQosTxop (uint8_t tid) const
 Accessor for a specified EDCA object. More...
 
Ssid GetSsid () const
 
Ptr< TxopGetTxop () const
 Accessor for the Txop object. More...
 
virtual Ptr< WifiMacQueueGetTxopQueue (AcIndex ac) const
 Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed, or a null pointer, otherwise. More...
 
TypeOfStation GetTypeOfStation () const
 Return the type of station. More...
 
VhtCapabilities GetVhtCapabilities (uint8_t linkId) const
 Return the VHT capabilities of the device for the given link. More...
 
Ptr< VhtConfigurationGetVhtConfiguration () const
 
bool GetVhtSupported (const Mac48Address &address) const
 
bool GetVhtSupported (uint8_t linkId) const
 Return whether the device supports VHT on the given link. More...
 
Ptr< WifiPhyGetWifiPhy (uint8_t linkId=SINGLE_LINK_OP_ID) const
 
Ptr< WifiRemoteStationManagerGetWifiRemoteStationManager (uint8_t linkId=0) const
 
void NotifyPromiscRx (Ptr< const Packet > packet)
 
void NotifyRx (Ptr< const Packet > packet)
 
void NotifyRxDrop (Ptr< const Packet > packet)
 
void NotifyTx (Ptr< const Packet > packet)
 
void NotifyTxDrop (Ptr< const Packet > packet)
 
WifiMacoperator= (const WifiMac &)=delete
 
void ResetWifiPhys ()
 Remove currently attached WifiPhy objects from this MAC. More...
 
virtual void SetAddress (Mac48Address address)
 
void SetBssid (Mac48Address bssid, uint8_t linkId)
 
void SetCtsToSelfSupported (bool enable)
 Enable or disable CTS-to-self feature. More...
 
void SetDevice (const Ptr< WifiNetDevice > device)
 Sets the device this PHY is associated with. More...
 
void SetForwardUpCallback (ForwardUpCallback upCallback)
 
void SetLinkDownCallback (Callback< void > linkDown)
 
virtual void SetLinkUpCallback (Callback< void > linkUp)
 
virtual void SetMacQueueScheduler (Ptr< WifiMacQueueScheduler > scheduler)
 Set the wifi MAC queue scheduler. More...
 
void SetPromisc ()
 Sets the interface in promiscuous mode. More...
 
void SetSsid (Ssid ssid)
 
void SetTypeOfStation (TypeOfStation type)
 This method is invoked by a subclass to specify what type of station it is implementing. More...
 
void SetWifiRemoteStationManager (Ptr< WifiRemoteStationManager > stationManager)
 
void SetWifiRemoteStationManagers (const std::vector< Ptr< WifiRemoteStationManager >> &stationManagers)
 
virtual bool SupportsSendFrom () const
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
 ~Object () override
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose ()
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one. More...
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object. More...
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized () const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::WifiMac
static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID. More...
 

Protected Member Functions

StaLinkEntityGetLink (uint8_t linkId) const
 Get a reference to the link associated with the given ID. More...
 
- Protected Member Functions inherited from ns3::WifiMac
virtual void ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
 
virtual void DeaggregateAmsduAndForward (Ptr< const WifiMpdu > mpdu)
 This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack. More...
 
void DoDispose () override
 Destructor implementation. More...
 
void DoInitialize () override
 Initialize() implementation. More...
 
void ForwardUp (Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
 Forward the packet up to the device. More...
 
Ptr< QosTxopGetBEQueue () const
 Accessor for the AC_BE channel access function. More...
 
Ptr< QosTxopGetBKQueue () const
 Accessor for the AC_BK channel access function. More...
 
LinkEntityGetLink (uint8_t linkId) const
 Get a reference to the link associated with the given ID. More...
 
bool GetShortSlotTimeSupported () const
 
Ptr< QosTxopGetVIQueue () const
 Accessor for the AC_VI channel access function. More...
 
Ptr< QosTxopGetVOQueue () const
 Accessor for the AC_VO channel access function. More...
 
void SetQosSupported (bool enable)
 Enable or disable QoS support for the device. More...
 
void SetShortSlotTimeSupported (bool enable)
 Enable or disable short slot time feature. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Types

using LinkSetupCallback = void(*)(uint8_t, Mac48Address)
 TracedCallback signature for link setup completed/canceled events. More...
 
enum  MacState {
  ASSOCIATED , SCANNING , WAIT_ASSOC_RESP , UNASSOCIATED ,
  REFUSED
}
 The current MAC state of the STA. More...
 

Private Member Functions

void AssocRequestTimeout ()
 This method is called after the association timeout occurred. More...
 
bool CheckSupportedRates (std::variant< MgtBeaconHeader, MgtProbeResponseHeader > frame, uint8_t linkId)
 Determine whether the supported rates indicated in a given Beacon frame or Probe Response frame fit with the configured membership selector. More...
 
std::unique_ptr< LinkEntityCreateLinkEntity () const override
 Create a LinkEntity object. More...
 
void Disassociated (uint8_t linkId)
 Check if any enabled link remains after the given link is disabled (because, e.g., the maximum number of beacons is missed or the channel is switched). More...
 
void DoDispose () override
 Destructor implementation. More...
 
Mac48Address DoGetLocalAddress (const Mac48Address &remoteAddr) const override
 This method is called if this device is an MLD to determine the MAC address of the affiliated STA used to communicate with the single link device having the given MAC address. More...
 
void DoInitialize () override
 Initialize() implementation. More...
 
bool GetActiveProbing () const
 Return whether active probing is enabled. More...
 
std::variant< MgtAssocRequestHeader, MgtReassocRequestHeaderGetAssociationRequest (bool isReassoc, uint8_t linkId) const
 Get the (Re)Association Request frame to send on a given link. More...
 
CapabilityInformation GetCapabilities (uint8_t linkId) const
 Return the Capability information for the given link. More...
 
WifiScanParams::Channel GetCurrentChannel (uint8_t linkId) const
 Get the current primary20 channel used on the given link as a (channel number, PHY band) pair. More...
 
MultiLinkElement GetMultiLinkElement (bool isReassoc, uint8_t linkId) const
 Return the Multi-Link Element to include in the management frames transmitted on the given link. More...
 
SupportedRates GetSupportedRates (uint8_t linkId) const
 Return an instance of SupportedRates that contains all rates that we support including HT rates. More...
 
bool IsWaitAssocResp () const
 Return whether we are waiting for an association response from an AP. More...
 
void MissedBeacons (uint8_t linkId)
 This method is called after we have not received a beacon from the AP on the given link. More...
 
void PhyCapabilitiesChanged ()
 Indicate that PHY capabilities have changed. More...
 
void Receive (Ptr< const WifiMpdu > mpdu, uint8_t linkId) override
 This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has been received on the given link. More...
 
void ReceiveAssocResp (Ptr< const WifiMpdu > mpdu, uint8_t linkId)
 Process the (Re)Association Response frame received on the given link. More...
 
void ReceiveBeacon (Ptr< const WifiMpdu > mpdu, uint8_t linkId)
 Process the Beacon frame received on the given link. More...
 
void ReceiveProbeResp (Ptr< const WifiMpdu > mpdu, uint8_t linkId)
 Process the Probe Response frame received on the given link. More...
 
void RestartBeaconWatchdog (Time delay, uint8_t linkId)
 Restarts the beacon timer for the given link. More...
 
void SendAssociationRequest (bool isReassoc)
 Forward an association or reassociation request packet to the DCF. More...
 
void SetActiveProbing (bool enable)
 Enable or disable active probing. More...
 
void SetEdcaParameters (AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit)
 Set the EDCA parameters. More...
 
void SetMuEdcaParameters (AcIndex ac, uint16_t cwMin, uint16_t cwMax, uint8_t aifsn, Time muEdcaTimer)
 Set the MU EDCA parameters. More...
 
void SetState (MacState value)
 Set the current MAC state. More...
 
void StartScanning ()
 Start the scanning process which trigger active or passive scanning based on the active probing flag. More...
 
void TryToEnsureAssociated ()
 Try to ensure that we are associated with an AP by taking an appropriate action depending on the current association status. More...
 
void UpdateApInfo (const MgtFrameType &frame, const Mac48Address &apAddr, const Mac48Address &bssid, uint8_t linkId)
 Update associated AP's information from the given management frame (Beacon, Probe Response or Association Response). More...
 

Private Attributes

bool m_activeProbing
 active probing More...
 
uint16_t m_aid
 Association AID. More...
 
TracedCallback< Mac48Addressm_assocLogger
 association logger More...
 
Ptr< WifiAssocManagerm_assocManager
 Association Manager. More...
 
EventId m_assocRequestEvent
 association request event More...
 
Time m_assocRequestTimeout
 association request timeout More...
 
TracedCallback< Timem_beaconArrival
 beacon arrival logger More...
 
TracedCallback< ApInfom_beaconInfo
 beacon info logger More...
 
TracedCallback< Mac48Addressm_deAssocLogger
 disassociation logger More...
 
uint32_t m_maxMissedBeacons
 maximum missed beacons More...
 
Ptr< RandomVariableStreamm_probeDelay
 RandomVariable used to randomize the time of the first Probe Response on each channel. More...
 
Time m_probeRequestTimeout
 probe request timeout More...
 
TracedCallback< uint8_t, Mac48Addressm_setupCanceled
 link setup canceled logger More...
 
TracedCallback< uint8_t, Mac48Addressm_setupCompleted
 link setup completed logger More...
 
MacState m_state
 MAC state. More...
 
Time m_waitBeaconTimeout
 wait beacon timeout More...
 

Friends

class ::AmpduAggregationTest
 Allow test cases to access private members. More...
 
class ::HeAggregationTest
 Allow test cases to access private members. More...
 
class ::MultiLinkOperationsTestBase
 Allow test cases to access private members. More...
 
class ::TwoLevelAggregationTest
 Allow test cases to access private members. More...
 

Additional Inherited Members

- Protected Attributes inherited from ns3::WifiMac
Callback< void > m_linkDown
 Callback when a link is down. More...
 
Callback< void > m_linkUp
 Callback when a link is up. More...
 
Ptr< MacRxMiddlem_rxMiddle
 RX middle (defragmentation etc.) More...
 
Ptr< WifiMacQueueSchedulerm_scheduler
 wifi MAC queue scheduler More...
 
Ptr< MacTxMiddlem_txMiddle
 TX middle (aggregation etc.) More...
 
Ptr< Txopm_txop
 TXOP used for transmission of frames to non-QoS peers. More...
 

Detailed Description

The Wifi MAC high model for a non-AP STA in a BSS.

The state machine is as follows:

┌───────────┐            ┌────────────────┐                           ┌─────────────┐
│   Start   │      ┌─────┤   Associated   ◄───────────────────┐    ┌──►   Refused   │
└─┬─────────┘      │     └────────────────┘                   │    │  └─────────────┘
  │                │                                          │    │
  │                │ ┌─────────────────────────────────────┐  │    │
  │                │ │                                     │  │    │
  │  ┌─────────────▼─▼──┐       ┌──────────────┐       ┌───┴──▼────┴───────────────────┐
  └──►   Unassociated   ├───────►   Scanning   ├───────►   Wait AssociationiResponse   │
     └──────────────────┘       └──────┬──▲────┘       └───────────────┬──▲────────────┘
                                       │  │                            │  │
                                       │  │                            │  │
                                       └──┘                            └──┘

Notes:

  1. The state 'Start' is not included in MacState and only used for illustration purpose.
  2. The Unassociated state is a transient state before STA starts the scanning procedure which moves it into the Scanning state.
  3. In Scanning, STA is gathering beacon or probe response frames from APs, resulted in a list of candidate AP. After the timeout, it then tries to associate to the best AP, which is indicated by the Association Manager. STA will restart the scanning procedure if SetActiveProbing() called.
  4. In the case when AP responded to STA's association request with a refusal, STA will try to associate to the next best AP until the list of candidate AP is exhausted which sends STA to Refused state.
    • Note that this behavior is not currently tested since ns-3 does not implement association refusal at present.
  5. The transition from Wait Association Response to Unassociated occurs if an association request fails without explicit refusal (i.e., the AP fails to respond).
  6. The transition from Associated to Wait Association Response occurs when STA's PHY capabilities changed. In this state, STA tries to reassociate with the previously associated AP.
  7. The transition from Associated to Unassociated occurs if the number of missed beacons exceeds the threshold.

Config Paths

ns3::StaWifiMac is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac"

Attributes

  • ActiveProbing: If true, we send probe requests. If false, we don't.NOTE: if more than one STA in your simulation is using active probing, you should enable it at a different simulation time for each STA, otherwise all the STAs will start sending probes at the same time resulting in collisions. See bug 1060 for more info.
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
  • AssocRequestTimeout: The interval between two consecutive association request attempts.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+08ns
    • Flags: constructwriteread
  • MaxMissedBeacons: Number of beacons which much be consecutively missed before we attempt to restart association.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 10
    • Flags: constructwriteread
  • ProbeDelay: Delay (in microseconds) to be used prior to transmitting a Probe frame during active scanning.
  • ProbeRequestTimeout: The duration to actively probe the channel.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+07ns
    • Flags: constructwriteread
  • WaitBeaconTimeout: The duration to dwell on a channel while passively scanning for beacon
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1.2e+08ns
    • Flags: constructwriteread

Attributes defined in parent class ns3::WifiMac

  • BE_BlockAckInactivityTimeout: Represents max time (blocks of 1024 microseconds) allowed for block ackinactivity for AC_BE. If this value isn't equal to 0 a timer start after that ablock ack setup is completed and will be reset every time that a block ackframe is received. If this value is 0, block ack inactivity timeout won't be used.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 0
    • Flags: constructwrite
  • BE_BlockAckThreshold: If number of packets in BE queue reaches this value, block ack mechanism is used. If this value is 0, block ack is never used.When A-MPDU is enabled, block ack mechanism is used regardless of this value.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint8_t 0:64
    • Initial value: 0
    • Flags: constructwrite
  • BE_MaxAmpduSize: Maximum length in bytes of an A-MPDU for AC_BE access class (capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs and 15523200 for EHT PPDUs). Value 0 means A-MPDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:15523200
    • Initial value: 65535
    • Flags: constructwriteread
  • BE_MaxAmsduSize: Maximum length in bytes of an A-MSDU for AC_BE access class (capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). Value 0 means A-MSDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:11398
    • Initial value: 0
    • Flags: constructwriteread
  • BE_Txop: Queue that manages packets belonging to AC_BE access class.
  • BK_BlockAckInactivityTimeout: Represents max time (blocks of 1024 microseconds) allowed for block ackinactivity for AC_BK. If this value isn't equal to 0 a timer start after that ablock ack setup is completed and will be reset every time that a block ackframe is received. If this value is 0, block ack inactivity timeout won't be used.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 0
    • Flags: constructwrite
  • BK_BlockAckThreshold: If number of packets in BK queue reaches this value, block ack mechanism is used. If this value is 0, block ack is never used.When A-MPDU is enabled, block ack mechanism is used regardless of this value.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint8_t 0:64
    • Initial value: 0
    • Flags: constructwrite
  • BK_MaxAmpduSize: Maximum length in bytes of an A-MPDU for AC_BK access class (capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs and 15523200 for EHT PPDUs). Value 0 means A-MPDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:15523200
    • Initial value: 0
    • Flags: constructwriteread
  • BK_MaxAmsduSize: Maximum length in bytes of an A-MSDU for AC_BK access class (capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). Value 0 means A-MSDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:11398
    • Initial value: 0
    • Flags: constructwriteread
  • BK_Txop: Queue that manages packets belonging to AC_BK access class.
  • CtsToSelfSupported: Use CTS to Self when using a rate that is not in the basic rate set.
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwrite
  • QosSupported: This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA.
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructread
  • ShortSlotTimeSupported: Whether or not short slot time is supported (only used by ERP APs or STAs).
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: constructwriteread
  • Ssid: The ssid we want to belong to.
    • Set with class: ns3::SsidValue
    • Underlying type: Ssid
    • Initial value: default
    • Flags: constructwriteread
  • Txop: The Txop object.
  • VI_BlockAckInactivityTimeout: Represents max time (blocks of 1024 microseconds) allowed for block ackinactivity for AC_VI. If this value isn't equal to 0 a timer start after that ablock ack setup is completed and will be reset every time that a block ackframe is received. If this value is 0, block ack inactivity timeout won't be used.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 0
    • Flags: constructwrite
  • VI_BlockAckThreshold: If number of packets in VI queue reaches this value, block ack mechanism is used. If this value is 0, block ack is never used.When A-MPDU is enabled, block ack mechanism is used regardless of this value.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint8_t 0:64
    • Initial value: 0
    • Flags: constructwrite
  • VI_MaxAmpduSize: Maximum length in bytes of an A-MPDU for AC_VI access class (capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs and 15523200 for EHT PPDUs). Value 0 means A-MPDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:15523200
    • Initial value: 65535
    • Flags: constructwriteread
  • VI_MaxAmsduSize: Maximum length in bytes of an A-MSDU for AC_VI access class (capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). Value 0 means A-MSDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:11398
    • Initial value: 0
    • Flags: constructwriteread
  • VI_Txop: Queue that manages packets belonging to AC_VI access class.
  • VO_BlockAckInactivityTimeout: Represents max time (blocks of 1024 microseconds) allowed for block ackinactivity for AC_VO. If this value isn't equal to 0 a timer start after that ablock ack setup is completed and will be reset every time that a block ackframe is received. If this value is 0, block ack inactivity timeout won't be used.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 0
    • Flags: constructwrite
  • VO_BlockAckThreshold: If number of packets in VO queue reaches this value, block ack mechanism is used. If this value is 0, block ack is never used.When A-MPDU is enabled, block ack mechanism is used regardless of this value.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint8_t 0:64
    • Initial value: 0
    • Flags: constructwrite
  • VO_MaxAmpduSize: Maximum length in bytes of an A-MPDU for AC_VO access class (capped to 65535 for HT PPDUs, 1048575 for VHT PPDUs, 6500631 for HE PPDUs and 15523200 for EHT PPDUs). Value 0 means A-MPDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:15523200
    • Initial value: 0
    • Flags: constructwriteread
  • VO_MaxAmsduSize: Maximum length in bytes of an A-MSDU for AC_VO access class (capped to 7935 for HT PPDUs and 11398 for VHT/HE/EHT PPDUs). Value 0 means A-MSDU aggregation is disabled for that AC.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:11398
    • Initial value: 0
    • Flags: constructwriteread
  • VO_Txop: Queue that manages packets belonging to AC_VO access class.

TraceSources

  • Assoc: Associated with an access point. If this is an MLD that associated with an AP MLD, the AP MLD address is provided.
    Callback signature: ns3::Mac48Address::TracedCallback
  • BeaconArrival: Time of beacons arrival from associated AP
    Callback signature: ns3::Time::TracedCallback
  • DeAssoc: Association with an access point lost. If this is an MLD that disassociated with an AP MLD, the AP MLD address is provided.
    Callback signature: ns3::Mac48Address::TracedCallback
  • LinkSetupCanceled: A link setup in the context of ML setup with an AP MLD was torn down. Provides ID of the setup link and AP MAC address
    Callback signature: ns3::StaWifiMac::LinkSetupCallback
  • LinkSetupCompleted: A link was setup in the context of ML setup with an AP MLD. Provides ID of the setup link and AP MAC address
    Callback signature: ns3::StaWifiMac::LinkSetupCallback
  • ReceivedBeaconInfo: Information about every received Beacon frame
    Callback signature: ns3::ApInfo::TracedCallback

TraceSources defined in parent class ns3::WifiMac

  • AckedMpdu: An MPDU that was successfully acknowledged, via either a Normal Ack or a Block Ack.
    Callback signature: ns3::WifiMpdu::TracedCallback
  • DroppedMpdu: An MPDU that was dropped for the given reason (see WifiMacDropReason).
    Callback signature: ns3::WifiMac::DroppedMpduCallback
  • MacPromiscRx: A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a promiscuous trace.
    Callback signature: ns3::Packet::TracedCallback
  • MacRx: A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a non-promiscuous trace.
    Callback signature: ns3::Packet::TracedCallback
  • MacRxDrop: A packet has been dropped in the MAC layer after it has been passed up from the physical layer.
    Callback signature: ns3::Packet::TracedCallback
  • MacTx: A packet has been received from higher layers and is being processed in preparation for queueing for transmission.
    Callback signature: ns3::Packet::TracedCallback
  • MacTxDrop: A packet has been dropped in the MAC layer before being queued for transmission. This trace source is fired, e.g., when an AP's MAC receives from the upper layer a packet destined to a station that is not associated with the AP or a STA's MAC receives a packet from the upper layer while it is not associated with any AP.
    Callback signature: ns3::Packet::TracedCallback
  • MpduResponseTimeout: An MPDU whose response was not received before the timeout, along with an identifier of the type of timeout (see WifiTxTimer::Reason) and the TXVECTOR used to transmit the MPDU. This trace source is fired when a CTS is missing after an RTS, when all CTS frames are missing after an MU-RTS, or when a Normal Ack is missing after an MPDU or after a DL MU PPDU acknowledged in SU format.
    Callback signature: ns3::WifiMac::MpduResponseTimeoutCallback
  • NAckedMpdu: An MPDU that was negatively acknowledged via a Block Ack.
    Callback signature: ns3::WifiMpdu::TracedCallback
  • PsduMapResponseTimeout: A PSDU map for which not all the responses were received before the timeout, along with an identifier of the type of timeout (see WifiTxTimer::Reason), the set of MAC addresses of the stations that did not respond and the total number of stations that had to respond. This trace source is fired when not all the addressed stations responded to an MU-BAR Trigger frame (either sent as a SU frame or aggregated to PSDUs in the DL MU PPDU), a Basic Trigger Frame or a BSRP Trigger Frame.
    Callback signature: ns3::WifiMac::PsduMapResponseTimeoutCallback
  • PsduResponseTimeout: A PSDU whose response was not received before the timeout, along with an identifier of the type of timeout (see WifiTxTimer::Reason) and the TXVECTOR used to transmit the PSDU. This trace source is fired when a BlockAck is missing after an A-MPDU, a BlockAckReq (possibly in the context of the acknowledgment of a DL MU PPDU in SU format) or a TB PPDU (in the latter case the missing BlockAck is a Multi-STA BlockAck).
    Callback signature: ns3::WifiMac::PsduResponseTimeoutCallback
  • TxErrHeader: The header of unsuccessfuly transmitted packet.
    Callback signature: ns3::WifiMacHeader::TracedCallback
  • TxOkHeader: The header of successfully transmitted packet.
    Callback signature: ns3::WifiMacHeader::TracedCallback

Size of this type is 792 bytes (on a 64-bit architecture).

Definition at line 123 of file sta-wifi-mac.h.

Member Typedef Documentation

◆ LinkSetupCallback

using ns3::StaWifiMac::LinkSetupCallback = void (*)(uint8_t , Mac48Address )
private

TracedCallback signature for link setup completed/canceled events.

Definition at line 505 of file sta-wifi-mac.h.

◆ MgtFrameType

type of the management frames used to get info about APs

Definition at line 136 of file sta-wifi-mac.h.

Member Enumeration Documentation

◆ MacState

The current MAC state of the STA.

Enumerator
ASSOCIATED 
SCANNING 
WAIT_ASSOC_RESP 
UNASSOCIATED 
REFUSED 

Definition at line 268 of file sta-wifi-mac.h.

Constructor & Destructor Documentation

◆ StaWifiMac()

ns3::StaWifiMac::StaWifiMac ( )

Definition at line 128 of file sta-wifi-mac.cc.

References NS_LOG_FUNCTION, ns3::WifiMac::SetTypeOfStation(), and ns3::STA.

+ Here is the call graph for this function:

◆ ~StaWifiMac()

ns3::StaWifiMac::~StaWifiMac ( )
override

Definition at line 159 of file sta-wifi-mac.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::StaWifiMac::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 182 of file sta-wifi-mac.cc.

References m_probeDelay, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

◆ AssocRequestTimeout()

void ns3::StaWifiMac::AssocRequestTimeout ( )
private

This method is called after the association timeout occurred.

We switch the state to WAIT_ASSOC_RESP and re-send an association request.

Definition at line 609 of file sta-wifi-mac.cc.

References NS_LOG_FUNCTION, SendAssociationRequest(), SetState(), and WAIT_ASSOC_RESP.

Referenced by SendAssociationRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanForwardPacketsTo()

bool ns3::StaWifiMac::CanForwardPacketsTo ( Mac48Address  to) const
overridevirtual

Return true if packets can be forwarded to the given destination, false otherwise.

Parameters
tothe address to which the packet should be sent
Returns
whether packets can be forwarded to the given destination

Implements ns3::WifiMac.

Definition at line 746 of file sta-wifi-mac.cc.

References IsAssociated().

Referenced by Enqueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckSupportedRates()

bool ns3::StaWifiMac::CheckSupportedRates ( std::variant< MgtBeaconHeader, MgtProbeResponseHeader frame,
uint8_t  linkId 
)
private

Determine whether the supported rates indicated in a given Beacon frame or Probe Response frame fit with the configured membership selector.

Parameters
framethe given Beacon or Probe Response frame
linkIdID of the link the mgt frame was received over
Returns
whether the the supported rates indicated in the given management frame fit with the configured membership selector

Definition at line 1164 of file sta-wifi-mac.cc.

References ns3::WifiPhy::GetBssMembershipSelectorList(), ns3::WifiMac::GetWifiPhy(), ns3::SupportedRates::IsBssMembershipSelectorRate(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ReceiveBeacon(), and ReceiveProbeResp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateLinkEntity()

std::unique_ptr< WifiMac::LinkEntity > ns3::StaWifiMac::CreateLinkEntity ( ) const
overrideprivatevirtual

Create a LinkEntity object.

Returns
a unique pointer to the created LinkEntity object

Reimplemented from ns3::WifiMac.

Definition at line 170 of file sta-wifi-mac.cc.

◆ Disassociated()

void ns3::StaWifiMac::Disassociated ( uint8_t  linkId)
private

Check if any enabled link remains after the given link is disabled (because, e.g., the maximum number of beacons is missed or the channel is switched).

If no enabled link remains, proceed with disassociation.

Parameters
linkIdthe ID of the given link

Definition at line 646 of file sta-wifi-mac.cc.

References ns3::StaWifiMac::StaLinkEntity::apLinkId, ns3::WifiMac::GetBssid(), GetLink(), ns3::WifiRemoteStationManager::GetMldAddress(), ns3::WifiMac::GetNLinks(), ns3::WifiMac::GetWifiRemoteStationManager(), m_aid, m_deAssocLogger, m_setupCanceled, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WifiMac::LinkEntity::phy, ns3::WifiPhy::ResumeFromOff(), SetState(), TryToEnsureAssociated(), and UNASSOCIATED.

Referenced by MissedBeacons(), and NotifyChannelSwitching().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::StaWifiMac::DoDispose ( )
overrideprivatevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 148 of file sta-wifi-mac.cc.

References ns3::WifiMac::DoDispose(), m_assocManager, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoGetLocalAddress()

Mac48Address ns3::StaWifiMac::DoGetLocalAddress ( const Mac48Address remoteAddr) const
overrideprivatevirtual

This method is called if this device is an MLD to determine the MAC address of the affiliated STA used to communicate with the single link device having the given MAC address.

This method is overridden because its implementation depends on the type of station.

Parameters
remoteAddrthe MAC address of the remote single link device
Returns
the MAC address of the affiliated STA used to communicate with the remote device

Reimplemented from ns3::WifiMac.

Definition at line 737 of file sta-wifi-mac.cc.

References ns3::WifiMac::GetFrameExchangeManager(), GetSetupLinkIds(), and NS_ASSERT_MSG.

+ Here is the call graph for this function:

◆ DoInitialize()

void ns3::StaWifiMac::DoInitialize ( )
overrideprivatevirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 141 of file sta-wifi-mac.cc.

References NS_LOG_FUNCTION, and StartScanning().

+ Here is the call graph for this function:

◆ Enqueue()

◆ GetActiveProbing()

bool ns3::StaWifiMac::GetActiveProbing ( ) const
private

Return whether active probing is enabled.

Returns
true if active probing is enabled, false otherwise

Definition at line 217 of file sta-wifi-mac.cc.

References m_activeProbing.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetAssociationId()

uint16_t ns3::StaWifiMac::GetAssociationId ( ) const

Return the association ID.

Returns
the association ID

Definition at line 198 of file sta-wifi-mac.cc.

References IsAssociated(), m_aid, and NS_ASSERT_MSG.

Referenced by ns3::WifiRemoteStationManager::GetStaId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAssociationRequest()

std::variant< MgtAssocRequestHeader, MgtReassocRequestHeader > ns3::StaWifiMac::GetAssociationRequest ( bool  isReassoc,
uint8_t  linkId 
) const
private

Get the (Re)Association Request frame to send on a given link.

The returned frame never includes a Multi-Link Element.

Parameters
isReassocwhether a Reassociation Request has to be returned
linkIdthe ID of the given link
Returns
the (Re)Association Request frame

Definition at line 295 of file sta-wifi-mac.cc.

References ns3::WifiMac::GetBssid(), GetCapabilities(), ns3::WifiMac::GetEhtCapabilities(), ns3::WifiMac::GetEhtSupported(), ns3::WifiMac::GetExtendedCapabilities(), ns3::WifiMac::GetHeCapabilities(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetHtCapabilities(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetSsid(), GetSupportedRates(), ns3::WifiMac::GetVhtCapabilities(), ns3::WifiMac::GetVhtSupported(), NS_LOG_FUNCTION, and ns3::MgtReassocRequestHeader::SetCurrentApAddress().

Referenced by GetMultiLinkElement(), and SendAssociationRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCapabilities()

CapabilityInformation ns3::StaWifiMac::GetCapabilities ( uint8_t  linkId) const
private

Return the Capability information for the given link.

Parameters
linkIdthe ID of the given link
Returns
the Capability information that we support

Definition at line 1402 of file sta-wifi-mac.cc.

References ns3::WifiMac::GetErpSupported(), ns3::WifiMac::GetShortSlotTimeSupported(), ns3::WifiMac::GetWifiPhy(), ns3::CapabilityInformation::SetShortPreamble(), and ns3::CapabilityInformation::SetShortSlotTime().

Referenced by GetAssociationRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCurrentChannel()

WifiScanParams::Channel ns3::StaWifiMac::GetCurrentChannel ( uint8_t  linkId) const
private

Get the current primary20 channel used on the given link as a (channel number, PHY band) pair.

Parameters
linkIdthe ID of the given link
Returns
a (channel number, PHY band) pair

Definition at line 235 of file sta-wifi-mac.cc.

References ns3::WifiMac::GetWifiPhy(), and third::phy.

Referenced by ReceiveBeacon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLink()

StaWifiMac::StaLinkEntity & ns3::StaWifiMac::GetLink ( uint8_t  linkId) const
protected

Get a reference to the link associated with the given ID.

Parameters
linkIdthe given link ID
Returns
a reference to the link associated with the given ID

Definition at line 176 of file sta-wifi-mac.cc.

References ns3::WifiMac::GetLink().

Referenced by Disassociated(), GetMultiLinkElement(), GetSetupLinkIds(), MissedBeacons(), ReceiveAssocResp(), ReceiveBeacon(), RestartBeaconWatchdog(), ScanningTimeout(), and SendAssociationRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMultiLinkElement()

MultiLinkElement ns3::StaWifiMac::GetMultiLinkElement ( bool  isReassoc,
uint8_t  linkId 
) const
private

Return the Multi-Link Element to include in the management frames transmitted on the given link.

Parameters
isReassocwhether the Multi-Link Element is included in a Reassociation Request
linkIdthe ID of the given link
Returns
the Multi-Link Element

Definition at line 342 of file sta-wifi-mac.cc.

References ns3::MultiLinkElement::AddPerStaProfileSubelement(), ns3::MultiLinkElement::BASIC_VARIANT, ns3::WifiMac::GetAddress(), GetAssociationRequest(), GetLink(), ns3::WifiMac::GetNLinks(), ns3::MultiLinkElement::GetNPerStaProfileSubelements(), ns3::MultiLinkElement::GetPerStaProfile(), NS_LOG_FUNCTION, ns3::MultiLinkElement::PerStaProfileSubelement::SetLinkId(), ns3::MultiLinkElement::SetMldMacAddress(), ns3::WIFI_MAC_MGT_ASSOCIATION_REQUEST, and ns3::WIFI_MAC_MGT_REASSOCIATION_REQUEST.

Referenced by SendAssociationRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSetupLinkIds()

std::set< uint8_t > ns3::StaWifiMac::GetSetupLinkIds ( ) const

Get the IDs of the setup links (if any).

Returns
the IDs of the setup links

Definition at line 718 of file sta-wifi-mac.cc.

References ns3::StaWifiMac::StaLinkEntity::bssid, GetLink(), ns3::WifiMac::GetNLinks(), and IsAssociated().

Referenced by DoGetLocalAddress(), Enqueue(), ns3::WifiNetDevice::GetAddress(), and Receive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSupportedRates()

SupportedRates ns3::StaWifiMac::GetSupportedRates ( uint8_t  linkId) const
private

Return an instance of SupportedRates that contains all rates that we support including HT rates.

Parameters
linkIdthe ID of the link for which the request is made
Returns
SupportedRates all rates that we support

Definition at line 1382 of file sta-wifi-mac.cc.

References ns3::SupportedRates::AddBssMembershipSelectorRate(), ns3::SupportedRates::AddSupportedRate(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetWifiPhy(), and NS_LOG_DEBUG.

Referenced by GetAssociationRequest(), and SendProbeRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTypeId()

◆ IsAssociated()

bool ns3::StaWifiMac::IsAssociated ( ) const

Return whether we are associated with an AP.

Returns
true if we are associated with an AP, false otherwise

Definition at line 706 of file sta-wifi-mac.cc.

References ASSOCIATED, and m_state.

Referenced by CanForwardPacketsTo(), GetAssociationId(), GetSetupLinkIds(), ns3::WifiRemoteStationManager::GetStaId(), NotifyChannelSwitching(), PhyCapabilitiesChanged(), Receive(), and ReceiveBeacon().

+ Here is the caller graph for this function:

◆ IsWaitAssocResp()

bool ns3::StaWifiMac::IsWaitAssocResp ( ) const
private

Return whether we are waiting for an association response from an AP.

Returns
true if we are waiting for an association response from an AP, false otherwise

Definition at line 712 of file sta-wifi-mac.cc.

References m_state, and WAIT_ASSOC_RESP.

Referenced by ReceiveBeacon().

+ Here is the caller graph for this function:

◆ MissedBeacons()

void ns3::StaWifiMac::MissedBeacons ( uint8_t  linkId)
private

This method is called after we have not received a beacon from the AP on the given link.

Parameters
linkIdthe ID of the given link

Definition at line 617 of file sta-wifi-mac.cc.

References Disassociated(), ns3::WifiPhy::GetDelayUntilIdle(), GetLink(), ns3::WifiMac::GetWifiPhy(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by RestartBeaconWatchdog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyChannelSwitching()

void ns3::StaWifiMac::NotifyChannelSwitching ( uint8_t  linkId)
overridevirtual

Notify that channel on the given link has been switched.

Parameters
linkIdthe ID of the given link

Reimplemented from ns3::WifiMac.

Definition at line 1458 of file sta-wifi-mac.cc.

References Disassociated(), IsAssociated(), ns3::Object::IsInitialized(), m_assocManager, ns3::WifiMac::NotifyChannelSwitching(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ PhyCapabilitiesChanged()

void ns3::StaWifiMac::PhyCapabilitiesChanged ( )
private

Indicate that PHY capabilities have changed.

Definition at line 1446 of file sta-wifi-mac.cc.

References IsAssociated(), NS_LOG_DEBUG, NS_LOG_FUNCTION, SendAssociationRequest(), SetState(), and WAIT_ASSOC_RESP.

Referenced by SetWifiPhys().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Receive()

void ns3::StaWifiMac::Receive ( Ptr< const WifiMpdu mpdu,
uint8_t  linkId 
)
overrideprivatevirtual

This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has been received on the given link.

The implementation is intended to capture logic that is going to be common to all (or most) derived classes. Specifically, handling of Block Ack management frames is dealt with here.

This method will need, however, to be overridden by derived classes so that they can perform their data handling before invoking the base version.

The given link may be undefined in some cases (e.g., in case of QoS Data frames received in the context of a Block Ack agreement – because the BlockAckManager does not have to record the link each buffered MPDU has been received on); in such a cases, the value of linkId should be WIFI_LINKID_UNDEFINED.

Parameters
mpduthe MPDU that has been received.
linkIdthe ID of the given link

Reimplemented from ns3::WifiMac.

Definition at line 837 of file sta-wifi-mac.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::WifiMac::DeaggregateAmsduAndForward(), ns3::WifiMac::ForwardUp(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr3(), ns3::WifiMac::GetAddress(), ns3::WifiMac::GetBssid(), ns3::WifiMac::GetDevice(), ns3::WifiMac::GetFrameExchangeManager(), GetSetupLinkIds(), ns3::WifiMacHeader::GetType(), ns3::WifiMacHeader::HasData(), IsAssociated(), ns3::WifiMacHeader::IsCtl(), ns3::WifiMacHeader::IsData(), ns3::WifiMacHeader::IsFromDs(), ns3::Mac48Address::IsGroup(), ns3::WifiMacHeader::IsQosAmsdu(), ns3::WifiMacHeader::IsQosData(), ns3::WifiMacHeader::IsToDs(), ns3::WifiMac::NotifyRxDrop(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::WifiMac::Receive(), ReceiveAssocResp(), ReceiveBeacon(), ReceiveProbeResp(), ns3::WIFI_MAC_MGT_ASSOCIATION_REQUEST, ns3::WIFI_MAC_MGT_ASSOCIATION_RESPONSE, ns3::WIFI_MAC_MGT_BEACON, ns3::WIFI_MAC_MGT_PROBE_REQUEST, ns3::WIFI_MAC_MGT_PROBE_RESPONSE, ns3::WIFI_MAC_MGT_REASSOCIATION_REQUEST, and ns3::WIFI_MAC_MGT_REASSOCIATION_RESPONSE.

+ Here is the call graph for this function:

◆ ReceiveAssocResp()

◆ ReceiveBeacon()

void ns3::StaWifiMac::ReceiveBeacon ( Ptr< const WifiMpdu mpdu,
uint8_t  linkId 
)
private

◆ ReceiveProbeResp()

void ns3::StaWifiMac::ReceiveProbeResp ( Ptr< const WifiMpdu mpdu,
uint8_t  linkId 
)
private

Process the Probe Response frame received on the given link.

Parameters
mpduthe MPDU containing the Probe Response frame
linkIdthe ID of the given link

Definition at line 995 of file sta-wifi-mac.cc.

References CheckSupportedRates(), ns3::SnrTag::Get(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetAddr3(), ns3::WifiMacHeader::IsProbeResp(), m_assocManager, ns3::StaWifiMac::ApInfo::m_bssid, NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by Receive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RestartBeaconWatchdog()

void ns3::StaWifiMac::RestartBeaconWatchdog ( Time  delay,
uint8_t  linkId 
)
private

Restarts the beacon timer for the given link.

Parameters
delaythe delay before the watchdog fires
linkIdthe ID of the given link

Definition at line 693 of file sta-wifi-mac.cc.

References ns3::Simulator::GetDelayLeft(), GetLink(), max, MissedBeacons(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by ReceiveBeacon(), and ScanningTimeout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScanningTimeout()

void ns3::StaWifiMac::ScanningTimeout ( const std::optional< ApInfo > &  bestAp)

This method is called after wait beacon timeout or wait probe request timeout has occurred.

This will trigger association process from beacons or probe responses gathered while scanning.

Parameters
bestApthe info about the best AP to associate with, if one was found

Definition at line 538 of file sta-wifi-mac.cc.

References ns3::StaWifiMac::StaLinkEntity::apLinkId, ns3::StaWifiMac::StaLinkEntity::bssid, ns3::WifiRemoteStationManager::GetAffiliatedStaAddress(), GetLink(), ns3::WifiRemoteStationManager::GetMldAddress(), ns3::WifiMac::GetNLinks(), ns3::WifiMac::GetWifiRemoteStationManager(), m_maxMissedBeacons, ns3::MicroSeconds(), NS_ABORT_MSG, NS_ABORT_MSG_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, RestartBeaconWatchdog(), ns3::Seconds(), SendAssociationRequest(), ns3::StaWifiMac::StaLinkEntity::sendAssocReq, SetState(), StartScanning(), UpdateApInfo(), and WAIT_ASSOC_RESP.

Referenced by ns3::WifiAssocManager::ScanningTimeout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendAssociationRequest()

◆ SendProbeRequest()

void ns3::StaWifiMac::SendProbeRequest ( )

Forward a probe request packet to the DCF.

The standard is not clear on the correct queue for management frames if QoS is supported. We always use the DCF.

Definition at line 244 of file sta-wifi-mac.cc.

References ns3::Packet::AddHeader(), ns3::WifiMac::GetAddress(), ns3::Mac48Address::GetBroadcast(), ns3::WifiMac::GetEhtCapabilities(), ns3::WifiMac::GetEhtSupported(), ns3::WifiMac::GetExtendedCapabilities(), ns3::WifiMac::GetHeCapabilities(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetHtCapabilities(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetQosSupported(), ns3::WifiMac::GetSsid(), GetSupportedRates(), ns3::WifiMac::GetTxop(), ns3::WifiMac::GetVhtCapabilities(), ns3::WifiMac::GetVhtSupported(), ns3::WifiMac::GetVOQueue(), NS_LOG_FUNCTION, ns3::Txop::Queue(), ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::MgtProbeRequestHeader::SetEhtCapabilities(), ns3::MgtProbeRequestHeader::SetExtendedCapabilities(), ns3::MgtProbeRequestHeader::SetHeCapabilities(), ns3::MgtProbeRequestHeader::SetHtCapabilities(), ns3::MgtProbeRequestHeader::SetSsid(), ns3::MgtProbeRequestHeader::SetSupportedRates(), ns3::WifiMacHeader::SetType(), ns3::MgtProbeRequestHeader::SetVhtCapabilities(), ns3::SINGLE_LINK_OP_ID, and ns3::WIFI_MAC_MGT_PROBE_REQUEST.

Referenced by ns3::WifiDefaultAssocManager::DoStartScanning().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetActiveProbing()

void ns3::StaWifiMac::SetActiveProbing ( bool  enable)
private

Enable or disable active probing.

Parameters
enableenable or disable active probing

Definition at line 205 of file sta-wifi-mac.cc.

References m_activeProbing, m_state, NS_LOG_DEBUG, NS_LOG_FUNCTION, SCANNING, and StartScanning().

Referenced by GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAssocManager()

void ns3::StaWifiMac::SetAssocManager ( Ptr< WifiAssocManager assocManager)

Set the Association Manager.

Parameters
assocManagerthe Association Manager

Definition at line 190 of file sta-wifi-mac.cc.

References m_assocManager, and NS_LOG_FUNCTION.

◆ SetEdcaParameters()

void ns3::StaWifiMac::SetEdcaParameters ( AcIndex  ac,
uint32_t  cwMin,
uint32_t  cwMax,
uint8_t  aifsn,
Time  txopLimit 
)
private

Set the EDCA parameters.

Parameters
acthe access class
cwMinthe minimum contention window size
cwMaxthe maximum contention window size
aifsnthe number of slots that make up an AIFS
txopLimitthe TXOP limit

Definition at line 1418 of file sta-wifi-mac.cc.

References ns3::WifiMac::GetQosTxop(), ns3::Txop::SetAifsn(), ns3::Txop::SetMaxCw(), ns3::Txop::SetMinCw(), ns3::Txop::SetTxopLimit(), and ns3::SINGLE_LINK_OP_ID.

Referenced by UpdateApInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetMuEdcaParameters()

void ns3::StaWifiMac::SetMuEdcaParameters ( AcIndex  ac,
uint16_t  cwMin,
uint16_t  cwMax,
uint8_t  aifsn,
Time  muEdcaTimer 
)
private

Set the MU EDCA parameters.

Parameters
acthe Access Category
cwMinthe minimum contention window size
cwMaxthe maximum contention window size
aifsnthe number of slots that make up an AIFS
muEdcaTimerthe MU EDCA timer

Definition at line 1432 of file sta-wifi-mac.cc.

References ns3::WifiMac::GetQosTxop(), ns3::QosTxop::SetMuAifsn(), ns3::QosTxop::SetMuCwMax(), ns3::QosTxop::SetMuCwMin(), ns3::QosTxop::SetMuEdcaTimer(), and ns3::SINGLE_LINK_OP_ID.

Referenced by UpdateApInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetState()

void ns3::StaWifiMac::SetState ( MacState  value)
private

Set the current MAC state.

Parameters
valuethe new state

Definition at line 1412 of file sta-wifi-mac.cc.

References m_state, and second::value.

Referenced by AssocRequestTimeout(), Disassociated(), AmpduAggregationTest::DoRun(), TwoLevelAggregationTest::DoRun(), HeAggregationTest::DoRunSubTest(), PhyCapabilitiesChanged(), ReceiveAssocResp(), ScanningTimeout(), and StartScanning().

+ Here is the caller graph for this function:

◆ SetWifiPhys()

void ns3::StaWifiMac::SetWifiPhys ( const std::vector< Ptr< WifiPhy >> &  phys)
overridevirtual
Parameters
physthe physical layers attached to this MAC.

Reimplemented from ns3::WifiMac.

Definition at line 223 of file sta-wifi-mac.cc.

References ns3::MakeCallback(), NS_LOG_FUNCTION, third::phy, PhyCapabilitiesChanged(), and ns3::WifiMac::SetWifiPhys().

Referenced by AmpduAggregationTest::DoRun(), TwoLevelAggregationTest::DoRun(), and HeAggregationTest::DoRunSubTest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StartScanning()

◆ TryToEnsureAssociated()

void ns3::StaWifiMac::TryToEnsureAssociated ( )
private

Try to ensure that we are associated with an AP by taking an appropriate action depending on the current association status.

Definition at line 467 of file sta-wifi-mac.cc.

References ASSOCIATED, ns3::WifiMac::m_linkDown, m_state, NS_LOG_FUNCTION, REFUSED, SCANNING, StartScanning(), UNASSOCIATED, and WAIT_ASSOC_RESP.

Referenced by Disassociated(), and Enqueue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateApInfo()

void ns3::StaWifiMac::UpdateApInfo ( const MgtFrameType frame,
const Mac48Address apAddr,
const Mac48Address bssid,
uint8_t  linkId 
)
private

Update associated AP's information from the given management frame (Beacon, Probe Response or Association Response).

If STA is not associated, this information will be used for the association process.

Parameters
framethe body of the given management frame
apAddrMAC address of the AP
bssidMAC address of BSSID
linkIdID of the link the management frame was received over

Definition at line 1189 of file sta-wifi-mac.cc.

References ns3::AC_BE, ns3::AC_BK, ns3::AC_VI, ns3::AC_VO, ns3::WifiRemoteStationManager::AddBasicMode(), ns3::WifiRemoteStationManager::AddStationEhtCapabilities(), ns3::WifiRemoteStationManager::AddStationHeCapabilities(), ns3::WifiRemoteStationManager::AddStationHtCapabilities(), ns3::WifiRemoteStationManager::AddStationVhtCapabilities(), ns3::WifiRemoteStationManager::AddSupportedMcs(), ns3::WifiRemoteStationManager::AddSupportedMode(), ns3::WifiMac::GetEhtSupported(), ns3::WifiMac::GetErpSupported(), ns3::WifiMac::GetHeConfiguration(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetHtSupported(), ns3::WifiPhy::GetModeList(), ns3::WifiMac::GetQosSupported(), ns3::WifiMac::GetVhtSupported(), ns3::WifiMac::GetWifiPhy(), ns3::WifiMac::GetWifiRemoteStationManager(), ns3::SupportedRates::IsBasicRate(), ns3::CapabilityInformation::IsShortPreamble(), ns3::CapabilityInformation::IsShortSlotTime(), ns3::SupportedRates::IsSupportedRate(), ns3::MicroSeconds(), NS_LOG_FUNCTION, ns3::WifiRemoteStationManager::RemoveAllSupportedMcs(), SetEdcaParameters(), SetMuEdcaParameters(), ns3::WifiRemoteStationManager::SetQosSupport(), ns3::WifiRemoteStationManager::SetShortPreambleEnabled(), ns3::WifiRemoteStationManager::SetShortSlotTimeEnabled(), ns3::WifiPhy::SetSlot(), ns3::WifiRemoteStationManager::SetUseNonErpProtection(), ns3::WIFI_MOD_CLASS_HE, and ns3::WIFI_MOD_CLASS_VHT.

Referenced by ReceiveAssocResp(), ReceiveBeacon(), and ScanningTimeout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ::AmpduAggregationTest

friend class ::AmpduAggregationTest
friend

Allow test cases to access private members.

Definition at line 129 of file sta-wifi-mac.h.

◆ ::HeAggregationTest

friend class ::HeAggregationTest
friend

Allow test cases to access private members.

Definition at line 131 of file sta-wifi-mac.h.

◆ ::MultiLinkOperationsTestBase

friend class ::MultiLinkOperationsTestBase
friend

Allow test cases to access private members.

Definition at line 133 of file sta-wifi-mac.h.

◆ ::TwoLevelAggregationTest

friend class ::TwoLevelAggregationTest
friend

Allow test cases to access private members.

Definition at line 127 of file sta-wifi-mac.h.

Member Data Documentation

◆ m_activeProbing

bool ns3::StaWifiMac::m_activeProbing
private

active probing

Definition at line 493 of file sta-wifi-mac.h.

Referenced by GetActiveProbing(), SetActiveProbing(), and StartScanning().

◆ m_aid

uint16_t ns3::StaWifiMac::m_aid
private

Association AID.

Definition at line 486 of file sta-wifi-mac.h.

Referenced by Disassociated(), GetAssociationId(), and ReceiveAssocResp().

◆ m_assocLogger

TracedCallback<Mac48Address> ns3::StaWifiMac::m_assocLogger
private

association logger

Definition at line 497 of file sta-wifi-mac.h.

Referenced by GetTypeId(), and ReceiveAssocResp().

◆ m_assocManager

Ptr<WifiAssocManager> ns3::StaWifiMac::m_assocManager
private

Association Manager.

Definition at line 487 of file sta-wifi-mac.h.

Referenced by DoDispose(), NotifyChannelSwitching(), ReceiveBeacon(), ReceiveProbeResp(), SetAssocManager(), and StartScanning().

◆ m_assocRequestEvent

EventId ns3::StaWifiMac::m_assocRequestEvent
private

association request event

Definition at line 491 of file sta-wifi-mac.h.

Referenced by ReceiveAssocResp(), and SendAssociationRequest().

◆ m_assocRequestTimeout

Time ns3::StaWifiMac::m_assocRequestTimeout
private

association request timeout

Definition at line 490 of file sta-wifi-mac.h.

Referenced by GetTypeId(), and SendAssociationRequest().

◆ m_beaconArrival

TracedCallback<Time> ns3::StaWifiMac::m_beaconArrival
private

beacon arrival logger

Definition at line 501 of file sta-wifi-mac.h.

Referenced by GetTypeId(), and ReceiveBeacon().

◆ m_beaconInfo

TracedCallback<ApInfo> ns3::StaWifiMac::m_beaconInfo
private

beacon info logger

Definition at line 502 of file sta-wifi-mac.h.

Referenced by GetTypeId(), and ReceiveBeacon().

◆ m_deAssocLogger

TracedCallback<Mac48Address> ns3::StaWifiMac::m_deAssocLogger
private

disassociation logger

Definition at line 499 of file sta-wifi-mac.h.

Referenced by Disassociated(), and GetTypeId().

◆ m_maxMissedBeacons

uint32_t ns3::StaWifiMac::m_maxMissedBeacons
private

maximum missed beacons

Definition at line 492 of file sta-wifi-mac.h.

Referenced by GetTypeId(), ReceiveBeacon(), and ScanningTimeout().

◆ m_probeDelay

Ptr<RandomVariableStream> ns3::StaWifiMac::m_probeDelay
private

RandomVariable used to randomize the time of the first Probe Response on each channel.

Definition at line 494 of file sta-wifi-mac.h.

Referenced by AssignStreams(), GetTypeId(), and StartScanning().

◆ m_probeRequestTimeout

Time ns3::StaWifiMac::m_probeRequestTimeout
private

probe request timeout

Definition at line 489 of file sta-wifi-mac.h.

Referenced by GetTypeId(), and StartScanning().

◆ m_setupCanceled

TracedCallback<uint8_t, Mac48Address> ns3::StaWifiMac::m_setupCanceled
private

link setup canceled logger

Definition at line 500 of file sta-wifi-mac.h.

Referenced by Disassociated(), and GetTypeId().

◆ m_setupCompleted

TracedCallback<uint8_t, Mac48Address> ns3::StaWifiMac::m_setupCompleted
private

link setup completed logger

Definition at line 498 of file sta-wifi-mac.h.

Referenced by GetTypeId(), and ReceiveAssocResp().

◆ m_state

MacState ns3::StaWifiMac::m_state
private

◆ m_waitBeaconTimeout

Time ns3::StaWifiMac::m_waitBeaconTimeout
private

wait beacon timeout

Definition at line 488 of file sta-wifi-mac.h.

Referenced by GetTypeId(), and StartScanning().


The documentation for this class was generated from the following files: