A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::WifiAssocManager Class Referenceabstract

Abstract base class for the Association Manager, which manages scanning and association for single link devices and ML discovery and setup for multi-link devices. More...

#include "wifi-assoc-manager.h"

+ Inheritance diagram for ns3::WifiAssocManager:
+ Collaboration diagram for ns3::WifiAssocManager:

Classes

struct  ApInfoCompare
 Struct providing a function call operator to compare two ApInfo objects. More...
 
struct  RnrLinkInfo
 Struct to identify a specific TBTT Information field of a Neighbor AP Information field in a Reduced Neighbor Report element. More...
 

Public Member Functions

 ~WifiAssocManager () override
 
virtual bool Compare (const StaWifiMac::ApInfo &lhs, const StaWifiMac::ApInfo &rhs) const =0
 Compare two ApInfo objects for the purpose of keeping a sorted list of ApInfo objects.
 
virtual void NotifyApInfo (const StaWifiMac::ApInfo &&apInfo)
 STA wifi MAC received a Beacon frame or Probe Response frame while scanning and notifies us the AP information contained in the received frame.
 
virtual void NotifyChannelSwitched (uint8_t linkId)=0
 Notify that the given link has completed channel switching.
 
void SetStaWifiMac (Ptr< StaWifiMac > mac)
 Set the pointer to the STA wifi MAC.
 
void StartScanning (WifiScanParams &&scanParams)
 Request the Association Manager to start a scanning procedure according to the given scanning parameters.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static std::list< WifiAssocManager::RnrLinkInfoGetAllAffiliatedAps (const ReducedNeighborReport &rnr)
 Find all the APs affiliated to the same AP MLD as the reporting AP that sent the given RNR element.
 
static std::optional< WifiAssocManager::RnrLinkInfoGetNextAffiliatedAp (const ReducedNeighborReport &rnr, std::size_t nbrApInfoId)
 Search the given RNR element for APs affiliated to the same AP MLD as the reporting AP.
 
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Protected Types

using OptMleConstRef = std::optional<std::reference_wrapper<const MultiLinkElement>>
 typedef for an optional const reference to a MultiLinkElement object
 
using OptRnrConstRef = std::optional<std::reference_wrapper<const ReducedNeighborReport>>
 typedef for an optional const reference to a ReducedNeighborReport object
 
using SortedList = std::set<StaWifiMac::ApInfo, ApInfoCompare>
 typedef for the sorted list of ApInfo objects
 

Protected Member Functions

 WifiAssocManager ()
 Constructor (protected as this is an abstract base class)
 
virtual bool CanBeInserted (const StaWifiMac::ApInfo &apInfo) const =0
 Allow subclasses to choose whether the given ApInfo shall be considered and hence inserted in the sorted list of ApInfo objects.
 
virtual bool CanBeReturned (const StaWifiMac::ApInfo &apInfo) const =0
 Allow subclasses to choose whether the given ApInfo shall be returned or discarded when the STA wifi MAC requests information on the best AP.
 
bool CanSetupMultiLink (OptMleConstRef &mle, OptRnrConstRef &rnr)
 Check whether 11be Multi-Link setup can be established with the current best AP.
 
void DoDispose () override
 Destructor implementation.
 
const WifiScanParamsGetScanParams () const
 
std::list< StaWifiMac::ApInfo::SetupLinksInfo > & GetSetupLinks (const StaWifiMac::ApInfo &apInfo)
 Get a reference to the list of the links to setup with the given AP.
 
const SortedListGetSortedList () const
 
bool MatchScanParams (const StaWifiMac::ApInfo &apInfo) const
 Check whether the given AP information match the current scanning parameters.
 
void ScanningTimeout ()
 Extract the best AP to associate with from the sorted list and return it, if any, to the STA wifi MAC along with the notification that scanning is completed.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Protected Attributes

std::set< uint8_t > m_allowedLinks
 "Only Beacon and Probe Response frames received on a link belonging to the this set are processed
 
Ptr< StaWifiMacm_mac
 pointer to the STA wifi MAC
 

Private Member Functions

virtual void DoStartScanning ()=0
 Start a scanning procedure.
 

Private Attributes

SortedList m_apList
 sorted list of candidate APs
 
std::unordered_map< Mac48Address, SortedList::const_iterator, WifiAddressHashm_apListIt
 hash table to help locate ApInfo objects in the sorted list based on the BSSID
 
WifiScanParams m_scanParams
 scanning parameters
 

Additional Inherited Members

Detailed Description

Abstract base class for the Association Manager, which manages scanning and association for single link devices and ML discovery and setup for multi-link devices.

Definition at line 29 of file wifi-assoc-manager.h.

Member Typedef Documentation

◆ OptMleConstRef

using ns3::WifiAssocManager::OptMleConstRef = std::optional<std::reference_wrapper<const MultiLinkElement>>
protected

typedef for an optional const reference to a MultiLinkElement object

Definition at line 212 of file wifi-assoc-manager.h.

◆ OptRnrConstRef

using ns3::WifiAssocManager::OptRnrConstRef = std::optional<std::reference_wrapper<const ReducedNeighborReport>>
protected

typedef for an optional const reference to a ReducedNeighborReport object

Definition at line 210 of file wifi-assoc-manager.h.

◆ SortedList

typedef for the sorted list of ApInfo objects

Definition at line 156 of file wifi-assoc-manager.h.

Constructor & Destructor Documentation

◆ ~WifiAssocManager()

ns3::WifiAssocManager::~WifiAssocManager ( )
override

Definition at line 80 of file wifi-assoc-manager.cc.

References NS_LOG_FUNCTION.

◆ WifiAssocManager()

ns3::WifiAssocManager::WifiAssocManager ( )
protected

Constructor (protected as this is an abstract base class)

Definition at line 74 of file wifi-assoc-manager.cc.

Member Function Documentation

◆ CanBeInserted()

virtual bool ns3::WifiAssocManager::CanBeInserted ( const StaWifiMac::ApInfo & apInfo) const
protectedpure virtual

Allow subclasses to choose whether the given ApInfo shall be considered and hence inserted in the sorted list of ApInfo objects.

Parameters
apInfothe apInfo object to insert
Returns
true if the apInfo object can be inserted, false otherwise

Implemented in ns3::WifiDefaultAssocManager.

Referenced by NotifyApInfo().

+ Here is the caller graph for this function:

◆ CanBeReturned()

virtual bool ns3::WifiAssocManager::CanBeReturned ( const StaWifiMac::ApInfo & apInfo) const
protectedpure virtual

Allow subclasses to choose whether the given ApInfo shall be returned or discarded when the STA wifi MAC requests information on the best AP.

Parameters
apInfothe apInfo object to return
Returns
true if the apInfo object can be returned, false otherwise

Implemented in ns3::WifiDefaultAssocManager.

Referenced by ScanningTimeout().

+ Here is the caller graph for this function:

◆ CanSetupMultiLink()

bool ns3::WifiAssocManager::CanSetupMultiLink ( OptMleConstRef & mle,
OptRnrConstRef & rnr )
protected

Check whether 11be Multi-Link setup can be established with the current best AP.

Parameters
[out]mleconst reference to the Multi-Link Element present in the Beacon/Probe Response received from the best AP, if any
[out]rnrconst reference to the Reduced Neighbor Report Element present in the Beacon/Probe Response received from the best AP, if any.
Returns
whether 11be Multi-Link setup can be established with the current best AP

Definition at line 249 of file wifi-assoc-manager.cc.

References ns3::EnumValue< T >::Get(), GetSortedList(), m_apList, m_mac, ns3::NOT_SUPPORTED, NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

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

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

◆ Compare()

virtual bool ns3::WifiAssocManager::Compare ( const StaWifiMac::ApInfo & lhs,
const StaWifiMac::ApInfo & rhs ) const
pure virtual

Compare two ApInfo objects for the purpose of keeping a sorted list of ApInfo objects.

Parameters
lhsleft hand side ApInfo object
rhsright hand side ApInfo object
Returns
true if the left hand side ApInfo object should be placed before the right hand side ApInfo object in the sorted list of ApInfo objects, false otherwise

Implemented in ns3::WifiDefaultAssocManager.

◆ DoDispose()

void ns3::WifiAssocManager::DoDispose ( )
overrideprotectedvirtual

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.

Reimplemented in ns3::WifiDefaultAssocManager.

Definition at line 86 of file wifi-assoc-manager.cc.

References m_mac, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

◆ DoStartScanning()

virtual void ns3::WifiAssocManager::DoStartScanning ( )
privatepure virtual

Start a scanning procedure.

This method needs to schedule a call to ScanningTimeout when the scanning procedure is completed.

Implemented in ns3::WifiDefaultAssocManager.

Referenced by StartScanning().

+ Here is the caller graph for this function:

◆ GetAllAffiliatedAps()

std::list< WifiAssocManager::RnrLinkInfo > ns3::WifiAssocManager::GetAllAffiliatedAps ( const ReducedNeighborReport & rnr)
static

Find all the APs affiliated to the same AP MLD as the reporting AP that sent the given RNR element.

Parameters
rnrthe given RNR element
Returns
a list containing the index of the Neighbor AP Information field and the index of the TBTT Information field containing all the affiliated APs

Definition at line 351 of file wifi-assoc-manager.cc.

References GetNextAffiliatedAp().

Referenced by GetRnrLinkInfoTest::DoRun(), and ns3::WifiDefaultAssocManager::EndScanning().

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

◆ GetNextAffiliatedAp()

std::optional< WifiAssocManager::RnrLinkInfo > ns3::WifiAssocManager::GetNextAffiliatedAp ( const ReducedNeighborReport & rnr,
std::size_t nbrApInfoId )
static

Search the given RNR element for APs affiliated to the same AP MLD as the reporting AP.

The search starts at the given Neighbor AP Information field.

Parameters
rnrthe given RNR element
nbrApInfoIdthe index of the given Neighbor AP Information field
Returns
the index of the Neighbor AP Information field and the index of the TBTT Information field containing the next affiliated AP, if any.

Definition at line 318 of file wifi-assoc-manager.cc.

References ns3::ReducedNeighborReport::GetMldId(), ns3::ReducedNeighborReport::GetNNbrApInfoFields(), ns3::ReducedNeighborReport::GetNTbttInformationFields(), ns3::ReducedNeighborReport::HasMldParameters(), and NS_LOG_FUNCTION.

Referenced by GetRnrLinkInfoTest::DoRun(), and GetAllAffiliatedAps().

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

◆ GetScanParams()

const WifiScanParams & ns3::WifiAssocManager::GetScanParams ( ) const
protected
Returns
the scanning parameters.

Definition at line 106 of file wifi-assoc-manager.cc.

References m_scanParams.

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

+ Here is the caller graph for this function:

◆ GetSetupLinks()

std::list< StaWifiMac::ApInfo::SetupLinksInfo > & ns3::WifiAssocManager::GetSetupLinks ( const StaWifiMac::ApInfo & apInfo)
protected

Get a reference to the list of the links to setup with the given AP.

This method allows subclasses to modify such a list.

Parameters
apInfothe info about the given AP
Returns
a reference to the list of the links to setup with the given AP

Definition at line 243 of file wifi-assoc-manager.cc.

References ns3::StaWifiMac::ApInfo::m_setupLinks.

Referenced by ns3::WifiDefaultAssocManager::ChannelSwitchTimeout(), and ns3::WifiDefaultAssocManager::EndScanning().

+ Here is the caller graph for this function:

◆ GetSortedList()

const WifiAssocManager::SortedList & ns3::WifiAssocManager::GetSortedList ( ) const
protected
Returns
a const reference to the sorted list of ApInfo objects.

Definition at line 100 of file wifi-assoc-manager.cc.

References m_apList.

Referenced by CanSetupMultiLink(), ns3::WifiDefaultAssocManager::ChannelSwitchTimeout(), ns3::WifiDefaultAssocManager::DoStartScanning(), and ns3::WifiDefaultAssocManager::EndScanning().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::WifiAssocManager::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

Definition at line 58 of file wifi-assoc-manager.cc.

References m_allowedLinks, ns3::MakeAttributeContainerAccessor(), ns3::MakeAttributeContainerChecker(), ns3::MakeUintegerChecker(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ MatchScanParams()

bool ns3::WifiAssocManager::MatchScanParams ( const StaWifiMac::ApInfo & apInfo) const
protected

Check whether the given AP information match the current scanning parameters.

Parameters
apInfothe given AP information
Returns
whether the given AP information match the current scanning parameters

Definition at line 112 of file wifi-assoc-manager.cc.

References ns3::WifiScanParams::Channel::band, ns3::WifiScanParams::channelList, ns3::Ssid::IsBroadcast(), ns3::Ssid::IsEqual(), ns3::StaWifiMac::ApInfo::m_bssid, ns3::StaWifiMac::ApInfo::m_channel, ns3::StaWifiMac::ApInfo::m_frame, ns3::StaWifiMac::ApInfo::m_linkId, m_scanParams, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WifiScanParams::Channel::number, ns3::WifiScanParams::ssid, and ns3::WIFI_PHY_BAND_UNSPECIFIED.

Referenced by NotifyApInfo(), and StartScanning().

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

◆ NotifyApInfo()

void ns3::WifiAssocManager::NotifyApInfo ( const StaWifiMac::ApInfo && apInfo)
virtual

STA wifi MAC received a Beacon frame or Probe Response frame while scanning and notifies us the AP information contained in the received frame.

Note that the given ApInfo object is moved to the sorted list of ApInfo objects.

Parameters
apInfothe AP information contained in the received frame

Definition at line 190 of file wifi-assoc-manager.cc.

References CanBeInserted(), m_allowedLinks, m_apList, m_apListIt, MatchScanParams(), NS_ASSERT_MSG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ NotifyChannelSwitched()

virtual void ns3::WifiAssocManager::NotifyChannelSwitched ( uint8_t linkId)
pure virtual

Notify that the given link has completed channel switching.

Parameters
linkIdthe ID of the given link

Implemented in ns3::WifiDefaultAssocManager.

◆ ScanningTimeout()

void ns3::WifiAssocManager::ScanningTimeout ( )
protected

Extract the best AP to associate with from the sorted list and return it, if any, to the STA wifi MAC along with the notification that scanning is completed.

Definition at line 221 of file wifi-assoc-manager.cc.

References CanBeReturned(), m_apList, m_apListIt, ns3::StaWifiMac::ApInfo::m_bssid, m_mac, and NS_LOG_FUNCTION.

Referenced by ns3::WifiDefaultAssocManager::ChannelSwitchTimeout(), ns3::WifiDefaultAssocManager::EndScanning(), and ns3::WifiDefaultAssocManager::NotifyChannelSwitched().

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

◆ SetStaWifiMac()

void ns3::WifiAssocManager::SetStaWifiMac ( Ptr< StaWifiMac > mac)

Set the pointer to the STA wifi MAC.

Parameters
macthe pointer to the STA wifi MAC

Definition at line 93 of file wifi-assoc-manager.cc.

References m_mac, and NS_LOG_FUNCTION.

◆ StartScanning()

void ns3::WifiAssocManager::StartScanning ( WifiScanParams && scanParams)

Request the Association Manager to start a scanning procedure according to the given scanning parameters.

At subclass' discretion, stored information about APs matching the given scanning parameters may be used and scanning not performed.

Parameters
scanParamsthe scanning parameters

Definition at line 164 of file wifi-assoc-manager.cc.

References DoStartScanning(), m_allowedLinks, m_apList, m_apListIt, m_scanParams, MatchScanParams(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_allowedLinks

std::set<uint8_t> ns3::WifiAssocManager::m_allowedLinks
protected

"Only Beacon and Probe Response frames received on a link belonging to the this set are processed

Definition at line 226 of file wifi-assoc-manager.h.

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

◆ m_apList

SortedList ns3::WifiAssocManager::m_apList
private

sorted list of candidate APs

Definition at line 237 of file wifi-assoc-manager.h.

Referenced by CanSetupMultiLink(), GetSortedList(), NotifyApInfo(), ScanningTimeout(), and StartScanning().

◆ m_apListIt

std::unordered_map<Mac48Address, SortedList::const_iterator, WifiAddressHash> ns3::WifiAssocManager::m_apListIt
private

hash table to help locate ApInfo objects in the sorted list based on the BSSID

Definition at line 239 of file wifi-assoc-manager.h.

Referenced by NotifyApInfo(), ScanningTimeout(), and StartScanning().

◆ m_mac

Ptr<StaWifiMac> ns3::WifiAssocManager::m_mac
protected

◆ m_scanParams

WifiScanParams ns3::WifiAssocManager::m_scanParams
private

scanning parameters

Definition at line 236 of file wifi-assoc-manager.h.

Referenced by GetScanParams(), MatchScanParams(), and StartScanning().


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