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

The Supported Rates Information Element. More...

#include "supported-rates.h"

+ Inheritance diagram for ns3::SupportedRates:
+ Collaboration diagram for ns3::SupportedRates:

Public Member Functions

 SupportedRates ()
 
 SupportedRates (const SupportedRates &rates)
 Type conversion operator. More...
 
void AddBssMembershipSelectorRate (uint64_t bs)
 Add a special value to the supported rate set, corresponding to a BSS membership selector. More...
 
void AddSupportedRate (uint64_t bs)
 Add the given rate to the supported rates. More...
 
WifiInformationElementId ElementId () const override
 Get the wifi information element ID. More...
 
uint8_t GetNRates () const
 Return the number of supported rates. More...
 
uint32_t GetRate (uint8_t i) const
 Return the rate at the given index. More...
 
bool IsBasicRate (uint64_t bs) const
 Check if the given rate is a basic rate. More...
 
bool IsBssMembershipSelectorRate (uint64_t bs) const
 Check if the given rate is a BSS membership selector value. More...
 
bool IsSupportedRate (uint64_t bs) const
 Check if the given rate is supported. More...
 
SupportedRatesoperator= (const SupportedRates &rates)
 Assignment operator. More...
 
void SetBasicRate (uint64_t bs)
 Set the given rate to basic rates. More...
 
- Public Member Functions inherited from ns3::WifiInformationElement
virtual ~WifiInformationElement ()
 
Buffer::Iterator Deserialize (Buffer::Iterator i)
 Deserialize entire IE (which may possibly be fragmented into multiple elements), which must be present. More...
 
virtual WifiInformationElementId ElementIdExt () const
 Get the wifi information element ID extension. More...
 
uint16_t GetSerializedSize () const
 Get the size of the serialized IE including Element ID and length fields (for every element this IE is possibly fragmented into). More...
 
virtual bool operator== (const WifiInformationElement &a) const
 Compare two IEs for equality by ID & Length, and then through memcmp of serialised version. More...
 
virtual void Print (std::ostream &os) const
 Generate human-readable form of IE. More...
 
Buffer::Iterator Serialize (Buffer::Iterator i) const
 Serialize entire IE including Element ID and length fields. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< WifiInformationElement >
 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 Attributes

std::optional< ExtendedSupportedRatesIEextended
 extended supported rates info element More...
 

Static Public Attributes

static const uint8_t MAX_SUPPORTED_RATES = 32
 This defines the maximum number of supported rates that a STA is allowed to have. More...
 

Private Member Functions

uint16_t DeserializeInformationField (Buffer::Iterator start, uint16_t length) override
 Deserialize information (i.e., the body of the IE, not including the Element ID and length octets) More...
 
uint16_t GetInformationFieldSize () const override
 Length of serialized information (i.e., the length of the body of the IE, not including the Element ID and length octets. More...
 
void SerializeInformationField (Buffer::Iterator start) const override
 Serialize information (i.e., the body of the IE, not including the Element ID and length octets) More...
 

Private Attributes

uint8_t m_nRates
 Number of supported rates. More...
 
uint8_t m_rates [MAX_SUPPORTED_RATES]
 List of supported bit rates (divided by 500000) More...
 

Friends

class ExtendedSupportedRatesIE
 We support the Extended Supported Rates Information Element through the ExtendedSupportedRatesIE object which is declared above. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::WifiInformationElement
template<typename IE , typename... Args>
static Buffer::Iterator DeserializeIfPresent (std::optional< IE > &optElem, Buffer::Iterator i, Args &&... args)
 Deserialize an entire IE (which may possibly be fragmented into multiple elements) that is optionally present. More...
 

Detailed Description

The Supported Rates Information Element.

This class knows how to serialise and deserialise the Supported Rates Element that holds the first 8 (non-HT) supported rates.

The ExtendedSupportedRatesIE class (of which an instance exists in objects of this class) deals with rates beyond the first 8.

Definition at line 87 of file supported-rates.h.

Constructor & Destructor Documentation

◆ SupportedRates() [1/2]

ns3::SupportedRates::SupportedRates ( )

Definition at line 34 of file supported-rates.cc.

References NS_LOG_FUNCTION.

◆ SupportedRates() [2/2]

ns3::SupportedRates::SupportedRates ( const SupportedRates rates)

Type conversion operator.

Parameters
ratesthe reference const SupportedRates

Definition at line 41 of file supported-rates.cc.

References extended, ExtendedSupportedRatesIE, m_nRates, m_rates, MAX_SUPPORTED_RATES, and NS_LOG_FUNCTION.

Member Function Documentation

◆ AddBssMembershipSelectorRate()

void ns3::SupportedRates::AddBssMembershipSelectorRate ( uint64_t  bs)

Add a special value to the supported rate set, corresponding to a BSS membership selector.

Parameters
bsthe special membership selector value (not a valid rate)

Definition at line 99 of file supported-rates.cc.

References BSS_MEMBERSHIP_SELECTOR_EHT_PHY, BSS_MEMBERSHIP_SELECTOR_HE_PHY, BSS_MEMBERSHIP_SELECTOR_HT_PHY, BSS_MEMBERSHIP_SELECTOR_VHT_PHY, m_nRates, m_rates, NS_ASSERT_MSG, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::ApWifiMac::GetSupportedRates(), and ns3::StaWifiMac::GetSupportedRates().

+ Here is the caller graph for this function:

◆ AddSupportedRate()

void ns3::SupportedRates::AddSupportedRate ( uint64_t  bs)

Add the given rate to the supported rates.

Parameters
bsthe rate to be added in bps

Definition at line 61 of file supported-rates.cc.

References IsBssMembershipSelectorRate(), IsSupportedRate(), m_nRates, m_rates, MAX_SUPPORTED_RATES, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by BasicMultiLinkElementTest::DoRun(), ns3::MeshWifiInterfaceMac::GetSupportedRates(), ns3::ApWifiMac::GetSupportedRates(), ns3::StaWifiMac::GetSupportedRates(), and SetBasicRate().

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

◆ DeserializeInformationField()

uint16_t ns3::SupportedRates::DeserializeInformationField ( Buffer::Iterator  start,
uint16_t  length 
)
overrideprivatevirtual

Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)

Parameters
startan iterator which points to where the information should be written.
lengththe expected number of bytes to read
Returns
the number of bytes read

Implements ns3::WifiInformationElement.

Definition at line 199 of file supported-rates.cc.

References m_nRates, m_rates, NS_ASSERT, and two-ray-to-three-gpp-ch-calibration::start.

◆ ElementId()

WifiInformationElementId ns3::SupportedRates::ElementId ( ) const
overridevirtual

Get the wifi information element ID.

Returns
the wifi information element ID

Implements ns3::WifiInformationElement.

Definition at line 175 of file supported-rates.cc.

References IE_SUPPORTED_RATES.

◆ GetInformationFieldSize()

uint16_t ns3::SupportedRates::GetInformationFieldSize ( ) const
overrideprivatevirtual

Length of serialized information (i.e., the length of the body of the IE, not including the Element ID and length octets.

This is the value that will appear in the second octet of the entire IE - the length field - if the IE is not fragmented)

Returns
the length of serialized information

Implements ns3::WifiInformationElement.

Definition at line 181 of file supported-rates.cc.

References m_nRates.

◆ GetNRates()

◆ GetRate()

uint32_t ns3::SupportedRates::GetRate ( uint8_t  i) const

Return the rate at the given index.

Return the rate (converted back to raw value) at the given index.

Parameters
ithe given index
Returns
the rate in bps

Definition at line 169 of file supported-rates.cc.

References m_rates.

Referenced by ns3::operator<<().

+ Here is the caller graph for this function:

◆ IsBasicRate()

bool ns3::SupportedRates::IsBasicRate ( uint64_t  bs) const

Check if the given rate is a basic rate.

The rate is encoded as it is serialized to the Supported Rates Information Element (i.e. as a multiple of 500 Kbits/sec, with MSB set to 1).

Parameters
bsthe rate to be checked in bps
Returns
true if the rate is a basic rate, false otherwise

Definition at line 119 of file supported-rates.cc.

References m_nRates, m_rates, and NS_LOG_FUNCTION.

Referenced by ns3::operator<<(), ns3::MeshWifiInterfaceMac::Receive(), and ns3::StaWifiMac::UpdateApInfo().

+ Here is the caller graph for this function:

◆ IsBssMembershipSelectorRate()

bool ns3::SupportedRates::IsBssMembershipSelectorRate ( uint64_t  bs) const

Check if the given rate is a BSS membership selector value.

The rate is encoded as it is serialized to the Supporting Rates Information Element (i.e. with the MSB set to 1).

Parameters
bsthe rate to be checked in bps
Returns
true if the rate is a BSS membership selector, false otherwise

Definition at line 149 of file supported-rates.cc.

References BSS_MEMBERSHIP_SELECTOR_EHT_PHY, BSS_MEMBERSHIP_SELECTOR_HE_PHY, BSS_MEMBERSHIP_SELECTOR_HT_PHY, BSS_MEMBERSHIP_SELECTOR_VHT_PHY, and NS_LOG_FUNCTION.

Referenced by AddSupportedRate(), ns3::StaWifiMac::CheckSupportedRates(), and SetBasicRate().

+ Here is the caller graph for this function:

◆ IsSupportedRate()

bool ns3::SupportedRates::IsSupportedRate ( uint64_t  bs) const

Check if the given rate is supported.

The rate is encoded as it is serialized to the Supported Rates Information Element (i.e. as a multiple of 500 Kbits/sec, possibly with MSB set to 1).

Parameters
bsthe rate to be checked in bps
Returns
true if the rate is supported, false otherwise

Definition at line 134 of file supported-rates.cc.

References m_nRates, m_rates, and NS_LOG_FUNCTION.

Referenced by AddSupportedRate(), ns3::MeshWifiInterfaceMac::CheckSupportedRates(), ns3::MgtAssocRequestHeader::Deserialize(), ns3::MgtReassocRequestHeader::Deserialize(), ns3::MgtAssocResponseHeader::Deserialize(), ns3::MgtProbeRequestHeader::Deserialize(), ns3::MgtProbeResponseHeader::Deserialize(), ns3::MeshWifiInterfaceMac::Receive(), ns3::ApWifiMac::ReceiveAssocRequest(), and ns3::StaWifiMac::UpdateApInfo().

+ Here is the caller graph for this function:

◆ operator=()

SupportedRates & ns3::SupportedRates::operator= ( const SupportedRates rates)

Assignment operator.

Parameters
ratesthe rates to assign
Returns
the assigned value

Definition at line 51 of file supported-rates.cc.

References extended, ExtendedSupportedRatesIE, m_nRates, m_rates, and MAX_SUPPORTED_RATES.

◆ SerializeInformationField()

void ns3::SupportedRates::SerializeInformationField ( Buffer::Iterator  start) const
overrideprivatevirtual

Serialize information (i.e., the body of the IE, not including the Element ID and length octets)

Parameters
startan iterator which points to where the information should be written.

Implements ns3::WifiInformationElement.

Definition at line 190 of file supported-rates.cc.

References m_nRates, m_rates, and two-ray-to-three-gpp-ch-calibration::start.

◆ SetBasicRate()

void ns3::SupportedRates::SetBasicRate ( uint64_t  bs)

Set the given rate to basic rates.

Parameters
bsthe rate to be set in bps

Definition at line 76 of file supported-rates.cc.

References AddSupportedRate(), IsBssMembershipSelectorRate(), m_nRates, m_rates, NS_ASSERT_MSG, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::MeshWifiInterfaceMac::GetSupportedRates(), and ns3::ApWifiMac::GetSupportedRates().

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

Friends And Related Function Documentation

◆ ExtendedSupportedRatesIE

friend class ExtendedSupportedRatesIE
friend

We support the Extended Supported Rates Information Element through the ExtendedSupportedRatesIE object which is declared above.

We allow this class to be a friend so that it can access our private data detailing the rates, and create an instance as extended.

Definition at line 189 of file supported-rates.h.

Referenced by SupportedRates(), and operator=().

Member Data Documentation

◆ extended

◆ m_nRates

◆ m_rates

◆ MAX_SUPPORTED_RATES

const uint8_t ns3::SupportedRates::MAX_SUPPORTED_RATES = 32
static

This defines the maximum number of supported rates that a STA is allowed to have.

Currently this number is set for IEEE 802.11b/g and SISO IEEE 802.11n stations which need 2 rates each from Clauses 15 and 18, and then 8 from Clause 19.

Definition at line 116 of file supported-rates.h.

Referenced by SupportedRates(), AddSupportedRate(), ns3::ExtendedSupportedRatesIE::DeserializeInformationField(), and operator=().


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