A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::WifiMgtHeader< Derived, std::tuple< Elems... > > Class Template Reference

Base class for implementing management frame headers. More...

#include "wifi-mgt-header.h"

+ Inheritance diagram for ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >:
+ Collaboration diagram for ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >:

Public Member Functions

uint32_t Deserialize (Buffer::Iterator start) final
 
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==0, int > = 0>
std::optional< T > & Get ()
 Access a (mandatory or optional) Information Element.
 
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==1, int > = 0>
std::vector< T > & Get ()
 Access an Information Element that can be present zero or more times.
 
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==0, int > = 0>
const std::optional< T > & Get () const
 Access a (mandatory or optional) Information Element.
 
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==1, int > = 0>
const std::vector< T > & Get () const
 Access an Information Element that can be present zero or more times.
 
uint32_t GetSerializedSize () const final
 
void Print (std::ostream &os) const final
 
void Serialize (Buffer::Iterator start) const final
 
- Public Member Functions inherited from ns3::Header
 ~Header () override
 
uint32_t Deserialize (Buffer::Iterator start) override=0
 
virtual uint32_t Deserialize (Buffer::Iterator start)=0
 Deserialize the object from a buffer iterator.
 
virtual uint32_t Deserialize (Buffer::Iterator start, Buffer::Iterator end)
 Deserialize the object from a buffer iterator.
 
virtual uint32_t GetSerializedSize () const =0
 
void Print (std::ostream &os) const override=0
 
virtual void Serialize (Buffer::Iterator start) const =0
 
virtual uint32_t Deserialize (Buffer::Iterator start)=0
 Deserialize the object from a buffer iterator.
 
virtual uint32_t Deserialize (Buffer::Iterator start, Buffer::Iterator end)
 Deserialize the object from a buffer iterator.
 
virtual void Print (std::ostream &os) const =0
 Print the object contents.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) 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.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
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.
 

Protected Types

using Elements = std::tuple< internal::GetStoredIeT< Elems >... >
 type of the Information Elements contained by this frame
 

Protected Member Functions

uint32_t DeserializeImpl (Buffer::Iterator start)
 
template<typename T >
Buffer::Iterator DoDeserialize (std::optional< T > &elem, Buffer::Iterator start)
 
template<typename T >
Buffer::Iterator DoDeserialize (std::vector< T > &elems, Buffer::Iterator start)
 
uint32_t GetSerializedSizeImpl () const
 
void InitForDeserialization (std::optional< EhtCapabilities > &optElem)
 
template<typename IE >
void InitForDeserialization (std::optional< IE > &optElem)
 
void PrintImpl (std::ostream &os) const
 
void SerializeImpl (Buffer::Iterator start) const
 
- 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

Elements m_elements
 Information Elements contained by this frame.
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::Header
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Chunk
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Detailed Description

template<typename Derived, typename... Elems>
class ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >

Base class for implementing management frame headers.

This class adopts the CRTP idiom, mainly to allow subclasses to specialize the method used to initialize Information Elements before deserialization (InitForDeserialization).

The sorted list of Information Elements that can be included in the management frame implemented as a subclass of this class is provided as the template parameter pack. Specifically:

  • the type of a mandatory Information Element IE is IE
  • the type of an optional Information Element IE is std::optional<IE>
  • the type of an Information Element IE that can appear zero or more times is std::vector<IE>
Template Parameters
Derived[explicit] the type of derived management frame
Elems[explicit] sorted list of Information Elements that can be included in mgt frame

Definition at line 106 of file wifi-mgt-header.h.

Member Typedef Documentation

◆ Elements

template<typename Derived , typename... Elems>
using ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Elements = std::tuple<internal::GetStoredIeT<Elems>...>
protected

type of the Information Elements contained by this frame

Definition at line 198 of file wifi-mgt-header.h.

Member Function Documentation

◆ Deserialize()

template<typename Derived , typename... Elems>
uint32_t ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Deserialize ( Buffer::Iterator  start)
finalvirtual
Parameters
startan iterator which points to where the header should read from.
Returns
the number of bytes read.

This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.

Note that data is not actually removed from the buffer to which the iterator points. Both Packet::RemoveHeader() and Packet::PeekHeader() call Deserialize(), but only the RemoveHeader() has additional statements to remove the header bytes from the underlying buffer and associated metadata.

Implements ns3::Header.

Definition at line 536 of file wifi-mgt-header.h.

◆ DeserializeImpl()

template<typename Derived , typename... Elems>
uint32_t ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::DeserializeImpl ( Buffer::Iterator  start)
protected

Parameters
startan iterator which points to where the header should read from.
Returns
the number of bytes read.

This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.

Note that data is not actually removed from the buffer to which the iterator points. Both Packet::RemoveHeader() and Packet::PeekHeader() call Deserialize(), but only the RemoveHeader() has additional statements to remove the header bytes from the underlying buffer and associated metadata.

Definition at line 543 of file wifi-mgt-header.h.

◆ DoDeserialize() [1/2]

template<typename Derived , typename... Elems>
template<typename T >
Buffer::Iterator ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::DoDeserialize ( std::optional< T > &  elem,
Buffer::Iterator  start 
)
protected
Template Parameters
T[deduced] the type of the Information Element
Parameters
elemthe optional Information Element
startthe buffer iterator pointing to where deserialization starts
Returns
an iterator pointing to where deserialization terminated

Definition at line 499 of file wifi-mgt-header.h.

◆ DoDeserialize() [2/2]

template<typename Derived , typename... Elems>
template<typename T >
Buffer::Iterator ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::DoDeserialize ( std::vector< T > &  elems,
Buffer::Iterator  start 
)
protected
Template Parameters
T[deduced] the type of the Information Elements
Parameters
elemsa vector of Information Elements
startthe buffer iterator pointing to where deserialization starts
Returns
an iterator pointing to where deserialization terminated

Definition at line 515 of file wifi-mgt-header.h.

◆ Get() [1/4]

template<typename Derived , typename... Elems>
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==0, int > >
std::optional< T > & ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Get

Access a (mandatory or optional) Information Element.

Template Parameters
T[explicit] the type of the Information Element to return
Returns
a reference to the Information Element of the given type

Definition at line 335 of file wifi-mgt-header.h.

◆ Get() [2/4]

template<typename Derived , typename... Elems>
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==1, int > >
std::vector< T > & ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Get

Access an Information Element that can be present zero or more times.

Template Parameters
T[explicit] the type of the Information Element to return
Returns
a reference to the Information Element of the given type

Definition at line 351 of file wifi-mgt-header.h.

◆ Get() [3/4]

template<typename Derived , typename... Elems>
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==0, int > >
const std::optional< T > & ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Get

Access a (mandatory or optional) Information Element.

Template Parameters
T[explicit] the type of the Information Element to return
Returns
a const reference to the Information Element of the given type

Definition at line 343 of file wifi-mgt-header.h.

◆ Get() [4/4]

template<typename Derived , typename... Elems>
template<typename T , std::enable_if_t<(std::is_same_v< std::vector< T >, Elems >+...)==1, int > >
const std::vector< T > & ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Get

Access an Information Element that can be present zero or more times.

Template Parameters
T[explicit] the type of the Information Element to return
Returns
a reference to the Information Element of the given type

Definition at line 359 of file wifi-mgt-header.h.

◆ GetSerializedSize()

template<typename Derived , typename... Elems>
uint32_t ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::GetSerializedSize ( ) const
finalvirtual
Returns
the expected size of the header.

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.

Implements ns3::Header.

Definition at line 434 of file wifi-mgt-header.h.

◆ GetSerializedSizeImpl()

template<typename Derived , typename... Elems>
uint32_t ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::GetSerializedSizeImpl
protected

Returns
the expected size of the header.

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.

Definition at line 441 of file wifi-mgt-header.h.

References ns3::internal::DoGetSerializedSize().

+ Here is the call graph for this function:

◆ InitForDeserialization() [1/2]

template<typename Derived , typename... Elems>
void ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::InitForDeserialization ( std::optional< EhtCapabilities > &  optElem)
protected
Parameters
optElemthe EhtCapabilities object to initialize for deserializing the information element into

Definition at line 374 of file wifi-mgt-header.h.

References ns3::AllSupportedRates::IsSupportedRate(), and NS_ASSERT.

+ Here is the call graph for this function:

◆ InitForDeserialization() [2/2]

template<typename Derived , typename... Elems>
template<typename IE >
void ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::InitForDeserialization ( std::optional< IE > &  optElem)
protected
Template Parameters
IE[deduced] the type of the Information Element to initialize for deserialization
Parameters
optElemthe object to initialize for deserializing the information element into

The Information Element object is constructed by calling the object's default constructor.

Definition at line 367 of file wifi-mgt-header.h.

◆ Print()

template<typename Derived , typename... Elems>
void ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Print ( std::ostream &  os) const
finalvirtual
Parameters
osoutput stream This method is used by Packet::Print to print the content of a header as ascii data to a c++ output stream. Although the header is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5

Implements ns3::Header.

Definition at line 606 of file wifi-mgt-header.h.

◆ PrintImpl()

template<typename Derived , typename... Elems>
void ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::PrintImpl ( std::ostream &  os) const
protected

Parameters
osoutput stream This method is used by Packet::Print to print the content of a header as ascii data to a c++ output stream. Although the header is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5

Definition at line 613 of file wifi-mgt-header.h.

References ns3::internal::DoPrint().

+ Here is the call graph for this function:

◆ Serialize()

template<typename Derived , typename... Elems>
void ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::Serialize ( Buffer::Iterator  start) const
finalvirtual
Parameters
startan iterator which points to where the header should be written.

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.

Implements ns3::Header.

Definition at line 483 of file wifi-mgt-header.h.

◆ SerializeImpl()

template<typename Derived , typename... Elems>
void ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::SerializeImpl ( Buffer::Iterator  start) const
protected

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

This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.

Definition at line 490 of file wifi-mgt-header.h.

References ns3::internal::DoSerialize().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_elements

template<typename Derived , typename... Elems>
Elements ns3::WifiMgtHeader< Derived, std::tuple< Elems... > >::m_elements
protected

Information Elements contained by this frame.

Definition at line 200 of file wifi-mgt-header.h.


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