A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Tim Class Reference

The Traffic Indication Map Information Element. More...

#include "tim.h"

+ Inheritance diagram for ns3::Tim:
+ Collaboration diagram for ns3::Tim:

Public Member Functions

template<typename Iterator >
void AddAid (Iterator begin, Iterator end)
 Add the AID values in the provided iterator range to the list contained in the Virtual Bitmap.
 
void AddAid (uint16_t aid)
 Add the provided AID value to the list contained in the Virtual Bitmap.
 
WifiInformationElementId ElementId () const override
 Get the wifi information element ID.
 
std::set< uint16_t > GetAidSet (uint16_t aid=0) const
 Return the AID values, greater than the given AID value, whose corresponding bits are set in the virtual bitmap.
 
uint8_t GetLastNonZeroOctetIndex () const
 
uint8_t GetPartialVirtualBitmapOffset () const
 Get the Partial Virtual Bitmap offset, i.e., the number (denoted as N1 by the specs) of the first octet included in the Partial Virtual Bitmap.
 
bool HasAid (uint16_t aid) const
 Check whether the bit corresponding to the provided AID is set in the Virtual Bitmap included in this TIM.
 
void Print (std::ostream &os) const override
 Generate human-readable form of IE.
 
- 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.
 
Buffer::Iterator DeserializeIfPresent (Buffer::Iterator i)
 Deserialize entire IE (which may possibly be fragmented into multiple elements) if it is present.
 
virtual WifiInformationElementId ElementIdExt () const
 Get the wifi information element ID extension.
 
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).
 
virtual bool operator== (const WifiInformationElement &a) const
 Compare two IEs for equality by ID & Length, and then through memcmp of serialised version.
 
Buffer::Iterator Serialize (Buffer::Iterator i) const
 Serialize entire IE including Element ID and length fields.
 
- Public Member Functions inherited from ns3::SimpleRefCount< WifiInformationElement >
 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 Attributes

uint8_t m_dtimCount {0}
 The DTIM Count field.
 
uint8_t m_dtimPeriod {0}
 The DTIM Period field.
 
bool m_hasMulticastPending {false}
 Whether there is Multicast / Broadcast data.
 

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)
 
uint8_t GetAidBit (uint16_t aid) const
 Obtain an octet with a set bit, corresponding to the provided AID value.
 
uint16_t GetAidFromOctetIndexAndBitPosition (uint16_t octet, uint8_t position) const
 Obtain the AID value represented by a certain octet index and bit position inside the Virtual Bitmap.
 
uint8_t GetAidOctetIndex (uint16_t aid) const
 Obtain the index of the octet where the provided AID value should be set in the Virtual Bitmap.
 
uint8_t GetBitmapControl () const
 The Bitmap Control field is optional if the TIM is carried in an S1G PPDU, while it is always present when the TIM is carried in a non-S1G PPDU.
 
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.
 
std::vector< uint8_t > GetPartialVirtualBitmap () const
 
void SerializeInformationField (Buffer::Iterator start) const override
 Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
 

Private Attributes

std::set< uint16_t > m_aidValues
 List of AID values included in this TIM.
 

Detailed Description

The Traffic Indication Map Information Element.

The 802.11 Traffic Indication Map (see section 9.4.2.5 of 802.11-2020)

Note: The current implementation does not support S1G operation, or multiple BSSID.

Definition at line 28 of file tim.h.

Member Function Documentation

◆ AddAid() [1/2]

template<typename Iterator >
void ns3::Tim::AddAid ( Iterator begin,
Iterator end )

Add the AID values in the provided iterator range to the list contained in the Virtual Bitmap.

Template Parameters
IteratorType of iterator
Parameters
beginStarting position of the iterator range
endEnding position of the iterator range

Definition at line 140 of file tim.h.

References AddAid().

+ Here is the call graph for this function:

◆ AddAid() [2/2]

void ns3::Tim::AddAid ( uint16_t aid)

Add the provided AID value to the list contained in the Virtual Bitmap.

Parameters
aidthe AID value to add to this TIM's Virtual Bitmap

Definition at line 38 of file tim.cc.

References m_aidValues, and NS_ABORT_IF.

Referenced by AddAid(), and TimInformationElementTest::SetTim().

+ Here is the caller graph for this function:

◆ DeserializeInformationField()

uint16_t ns3::Tim::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 75 of file tim.cc.

References GetAidFromOctetIndexAndBitPosition(), m_aidValues, m_dtimCount, m_dtimPeriod, m_hasMulticastPending, and NS_ABORT_MSG_IF.

+ Here is the call graph for this function:

◆ ElementId()

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

Get the wifi information element ID.

Returns
the wifi information element ID

Implements ns3::WifiInformationElement.

Definition at line 18 of file tim.cc.

References IE_TIM.

◆ GetAidBit()

uint8_t ns3::Tim::GetAidBit ( uint16_t aid) const
private

Obtain an octet with a set bit, corresponding to the provided AID value.

Parameters
aidthe provided AID value
Returns
an octet with a set bit, corresponding to the provided AID value

Definition at line 127 of file tim.cc.

Referenced by GetPartialVirtualBitmap().

+ Here is the caller graph for this function:

◆ GetAidFromOctetIndexAndBitPosition()

uint16_t ns3::Tim::GetAidFromOctetIndexAndBitPosition ( uint16_t octet,
uint8_t position ) const
private

Obtain the AID value represented by a certain octet index and bit position inside the Virtual Bitmap.

Parameters
octetthe octet index in the Virtual Bitmap
positionthe bit position in the octet of the Virtual Bitmap
Returns
the corresponding AID value

Definition at line 136 of file tim.cc.

Referenced by DeserializeInformationField().

+ Here is the caller graph for this function:

◆ GetAidOctetIndex()

uint8_t ns3::Tim::GetAidOctetIndex ( uint16_t aid) const
private

Obtain the index of the octet where the provided AID value should be set in the Virtual Bitmap.

Parameters
aidthe provided AID value
Returns
the index of the octet where the provided AID value should be set in the Virtual Bitmap

Definition at line 118 of file tim.cc.

Referenced by GetLastNonZeroOctetIndex(), GetPartialVirtualBitmap(), and GetPartialVirtualBitmapOffset().

+ Here is the caller graph for this function:

◆ GetAidSet()

std::set< uint16_t > ns3::Tim::GetAidSet ( uint16_t aid = 0) const

Return the AID values, greater than the given AID value, whose corresponding bits are set in the virtual bitmap.

Parameters
aidthe given AID value
Returns
the AID values, greater than the given AID value, whose corresponding bits are set in the virtual bitmap

Definition at line 52 of file tim.cc.

References m_aidValues.

Referenced by TimInformationElementTest::CheckAidSet().

+ Here is the caller graph for this function:

◆ GetBitmapControl()

uint8_t ns3::Tim::GetBitmapControl ( ) const
private

The Bitmap Control field is optional if the TIM is carried in an S1G PPDU, while it is always present when the TIM is carried in a non-S1G PPDU.

Returns
the value of the Bitmap Control field

Definition at line 172 of file tim.cc.

References GetPartialVirtualBitmapOffset(), m_dtimCount, and m_hasMulticastPending.

Referenced by SerializeInformationField().

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

◆ GetInformationFieldSize()

uint16_t ns3::Tim::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 24 of file tim.cc.

References GetLastNonZeroOctetIndex(), and GetPartialVirtualBitmapOffset().

+ Here is the call graph for this function:

◆ GetLastNonZeroOctetIndex()

uint8_t ns3::Tim::GetLastNonZeroOctetIndex ( ) const
Returns
the last non-zero octet in the virtual bitmap (denoted as N2 by the specs)

Definition at line 157 of file tim.cc.

References GetAidOctetIndex(), and m_aidValues.

Referenced by GetInformationFieldSize(), and GetPartialVirtualBitmap().

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

◆ GetPartialVirtualBitmap()

std::vector< uint8_t > ns3::Tim::GetPartialVirtualBitmap ( ) const
private
Returns
a vector containing the Partial Virtual Bitmap octets

Definition at line 189 of file tim.cc.

References GetAidBit(), GetAidOctetIndex(), GetLastNonZeroOctetIndex(), GetPartialVirtualBitmapOffset(), and m_aidValues.

Referenced by SerializeInformationField().

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

◆ GetPartialVirtualBitmapOffset()

uint8_t ns3::Tim::GetPartialVirtualBitmapOffset ( ) const

Get the Partial Virtual Bitmap offset, i.e., the number (denoted as N1 by the specs) of the first octet included in the Partial Virtual Bitmap.

Note that the Bitmap Offset subfield contains the number N1/2.

Returns
the Partial Virtual Bitmap offset

Definition at line 142 of file tim.cc.

References GetAidOctetIndex(), and m_aidValues.

Referenced by GetBitmapControl(), GetInformationFieldSize(), and GetPartialVirtualBitmap().

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

◆ HasAid()

bool ns3::Tim::HasAid ( uint16_t aid) const

Check whether the bit corresponding to the provided AID is set in the Virtual Bitmap included in this TIM.

Parameters
aidThe AID value to look for
Returns
True if the AID value is found in the Virtual Bitmap, false otherwise

Definition at line 46 of file tim.cc.

References m_aidValues.

Referenced by Print().

+ Here is the caller graph for this function:

◆ Print()

void ns3::Tim::Print ( std::ostream & os) const
overridevirtual

Generate human-readable form of IE.

Parameters
osoutput stream

Reimplemented from ns3::WifiInformationElement.

Definition at line 206 of file tim.cc.

References HasAid(), m_dtimCount, m_dtimPeriod, and m_hasMulticastPending.

+ Here is the call graph for this function:

◆ SerializeInformationField()

void ns3::Tim::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 59 of file tim.cc.

References GetBitmapControl(), GetPartialVirtualBitmap(), m_dtimCount, and m_dtimPeriod.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_aidValues

std::set<uint16_t> ns3::Tim::m_aidValues
private

List of AID values included in this TIM.

Definition at line 135 of file tim.h.

Referenced by AddAid(), DeserializeInformationField(), GetAidSet(), GetLastNonZeroOctetIndex(), GetPartialVirtualBitmap(), GetPartialVirtualBitmapOffset(), and HasAid().

◆ m_dtimCount

uint8_t ns3::Tim::m_dtimCount {0}

◆ m_dtimPeriod

uint8_t ns3::Tim::m_dtimPeriod {0}

The DTIM Period field.

Definition at line 86 of file tim.h.

Referenced by DeserializeInformationField(), Print(), SerializeInformationField(), and TimInformationElementTest::SetTim().

◆ m_hasMulticastPending

bool ns3::Tim::m_hasMulticastPending {false}

Whether there is Multicast / Broadcast data.

Definition at line 87 of file tim.h.

Referenced by DeserializeInformationField(), GetBitmapControl(), Print(), and TimInformationElementTest::SetTim().


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