Information element, as defined in 802.11-2007 standard. More...
#include "wifi-information-element.h"
Public Member Functions | |
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 | ElementId () const =0 |
Get the wifi information element ID. | |
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. | |
virtual void | Print (std::ostream &os) const |
Generate human-readable form of IE. | |
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. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Member Functions | |
virtual uint16_t | DeserializeInformationField (Buffer::Iterator start, uint16_t length)=0 |
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets) | |
Buffer::Iterator | DoDeserialize (Buffer::Iterator i, uint16_t length) |
Deserialize the Information field of an IE. | |
virtual uint16_t | GetInformationFieldSize () const =0 |
Length of serialized information (i.e., the length of the body of the IE, not including the Element ID and length octets. | |
Buffer::Iterator | SerializeFragments (Buffer::Iterator i, uint16_t size) const |
Serialize an IE that needs to be fragmented. | |
virtual void | SerializeInformationField (Buffer::Iterator start) const =0 |
Serialize information (i.e., the body of the IE, not including the Element ID and length octets) | |
Information element, as defined in 802.11-2007 standard.
The IEEE 802.11 standard includes the notion of Information Elements, which are encodings of management information to be communicated between STAs in the payload of various frames of type Management. Information Elements (IEs) have a common format, each starting with a single octet - the Element ID, which indicates the specific type of IE (a type to represent the options here is defined as WifiInformationElementId). The next octet is a length field and encodes the number of octets in the third and final field, which is the IE Information field.
The class ns3::WifiInformationElement provides a base for classes which represent specific Information Elements. This class defines pure virtual methods for serialisation (ns3::WifiInformationElement::SerializeInformationField) and deserialisation (ns3::WifiInformationElement::DeserializeInformationField) of IEs, from or to data members or other objects that simulation objects use to maintain the relevant state.
This class also provides an implementation of the equality operator, which operates by comparing the serialised versions of the two WifiInformationElement objects concerned.
Elements are defined to have a common general format consisting of a 1 octet Element ID field, a 1 octet length field, and a variable-length element-specific information field. Each element is assigned a unique Element ID as defined in this standard. The Length field specifies the number of octets in the Information field.
Fragmentation of an Information Element is handled transparently by the base class. Subclasses can simply serialize/deserialize their data into/from a single large buffer. It is the base class that takes care of splitting serialized data into multiple fragments (when serializing) or reconstructing data from multiple fragments when deserializing.
This class is pure virtual and acts as base for classes which know how to serialize specific IEs.
Definition at line 277 of file wifi-information-element.h.
|
virtual |
Definition at line 14 of file wifi-information-element.cc.
Buffer::Iterator ns3::WifiInformationElement::Deserialize | ( | Buffer::Iterator | i | ) |
Deserialize entire IE (which may possibly be fragmented into multiple elements), which must be present.
The iterator passed in must be pointing at the Element ID (i.e., the very first octet) of the correct type of information element, otherwise this method will generate a fatal error.
i | an iterator which points to where the IE should be read. |
Definition at line 121 of file wifi-information-element.cc.
References DeserializeIfPresent(), ns3::Buffer::Iterator::GetDistanceFrom(), and NS_ASSERT.
Referenced by ns3::dot11s::PeerLinkConfirmStart::Deserialize(), ns3::dot11s::PeerLinkOpenStart::Deserialize(), and TestWifiInformationElement::DeserializeInformationField().
Buffer::Iterator ns3::WifiInformationElement::DeserializeIfPresent | ( | Buffer::Iterator | i | ) |
Deserialize entire IE (which may possibly be fragmented into multiple elements) if it is present.
The iterator passed in must be pointing at the Element ID of an information element. If the Element ID is not the one that the given class is interested in then it will return the same iterator.
i | an iterator which points to where the IE should be read. |
Definition at line 132 of file wifi-information-element.cc.
References DoDeserialize(), ElementId(), ElementIdExt(), IE_EXTENSION, ns3::Buffer::Iterator::IsEnd(), and ns3::Buffer::Iterator::ReadU8().
Referenced by ns3::MgtAddBaRequestHeader::Deserialize(), ns3::MgtAddBaResponseHeader::Deserialize(), Deserialize(), and BasicMultiLinkElementTest::DoRun().
|
privatepure virtual |
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
start | an iterator which points to where the information should be written. |
length | the expected number of bytes to read |
Implemented in ns3::AddbaExtension, ns3::dot11s::IeBeaconTiming, ns3::dot11s::IeConfiguration, ns3::dot11s::IeLinkMetricReport, ns3::dot11s::IeMeshId, ns3::dot11s::IePeeringProtocol, ns3::dot11s::IePeerManagement, ns3::dot11s::IePerr, ns3::dot11s::IePrep, ns3::dot11s::IePreq, ns3::dot11s::IeRann, ns3::DsssParameterSet, ns3::EdcaParameterSet, ns3::EhtCapabilities, ns3::EhtOperation, ns3::ErpInformation, ns3::ExtendedCapabilities, ns3::He6GhzBandCapabilities, ns3::HeCapabilities, ns3::HeOperation, ns3::HtCapabilities, ns3::HtOperation, ns3::MuEdcaParameterSet, ns3::MultiLinkElement, ns3::MultiLinkElement::PerStaProfileSubelement, ns3::NonInheritance, ns3::ReducedNeighborReport, ns3::Ssid, ns3::SupportedRates, ns3::TidToLinkMapping, ns3::Tim, ns3::VhtCapabilities, ns3::VhtOperation, TestWifiInformationElement, and TestWifiSubElement.
Referenced by DoDeserialize().
|
private |
Deserialize the Information field of an IE.
Also handle the case in which the IE is fragmented.
i | an iterator which points to where the Information field should be read. |
length | the expected number of bytes to read |
Definition at line 167 of file wifi-information-element.cc.
References ns3::Buffer::AddAtEnd(), ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), DeserializeInformationField(), ElementId(), IE_EXTENSION, IE_FRAGMENT, ns3::Buffer::Iterator::IsEnd(), ns3::Buffer::Iterator::Next(), NS_ASSERT, ns3::Buffer::Iterator::PeekU8(), ns3::Buffer::Iterator::ReadU8(), and ns3::Buffer::Iterator::WriteU8().
Referenced by DeserializeIfPresent().
|
pure virtual |
Get the wifi information element ID.
Implemented in ns3::AddbaExtension, ns3::dot11s::IeBeaconTiming, ns3::dot11s::IeConfiguration, ns3::dot11s::IeLinkMetricReport, ns3::dot11s::IeMeshId, ns3::dot11s::IePeeringProtocol, ns3::dot11s::IePeerManagement, ns3::dot11s::IePerr, ns3::dot11s::IePrep, ns3::dot11s::IePreq, ns3::dot11s::IeRann, ns3::DsssParameterSet, ns3::EdcaParameterSet, ns3::EhtCapabilities, ns3::EhtOperation, ns3::ErpInformation, ns3::ExtendedCapabilities, ns3::ExtendedSupportedRatesIE, ns3::He6GhzBandCapabilities, ns3::HeCapabilities, ns3::HeOperation, ns3::HtCapabilities, ns3::HtOperation, ns3::MuEdcaParameterSet, ns3::MultiLinkElement, ns3::MultiLinkElement::PerStaProfileSubelement, ns3::NonInheritance, ns3::ReducedNeighborReport, ns3::Ssid, ns3::SupportedRates, ns3::TidToLinkMapping, ns3::Tim, ns3::VhtCapabilities, ns3::VhtOperation, TestWifiInformationElement, and TestWifiSubElement.
Referenced by DeserializeIfPresent(), DoDeserialize(), operator==(), Serialize(), and SerializeFragments().
|
virtual |
Get the wifi information element ID extension.
Reimplemented in ns3::EhtCapabilities, ns3::EhtOperation, ns3::He6GhzBandCapabilities, ns3::HeCapabilities, ns3::HeOperation, ns3::MuEdcaParameterSet, ns3::MultiLinkElement, ns3::NonInheritance, ns3::TidToLinkMapping, and TestWifiInformationElement.
Definition at line 44 of file wifi-information-element.cc.
Referenced by DeserializeIfPresent(), operator==(), Serialize(), and SerializeFragments().
|
privatepure virtual |
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)
Implemented in ns3::AddbaExtension, ns3::dot11s::IeBeaconTiming, ns3::dot11s::IeConfiguration, ns3::dot11s::IeLinkMetricReport, ns3::dot11s::IeMeshId, ns3::dot11s::IePeeringProtocol, ns3::dot11s::IePeerManagement, ns3::dot11s::IePerr, ns3::dot11s::IePrep, ns3::dot11s::IePreq, ns3::dot11s::IeRann, ns3::DsssParameterSet, ns3::EdcaParameterSet, ns3::EhtCapabilities, ns3::EhtOperation, ns3::ErpInformation, ns3::ExtendedCapabilities, ns3::He6GhzBandCapabilities, ns3::HeCapabilities, ns3::HeOperation, ns3::HtCapabilities, ns3::HtOperation, ns3::MuEdcaParameterSet, ns3::MultiLinkElement, ns3::MultiLinkElement::PerStaProfileSubelement, ns3::NonInheritance, ns3::ReducedNeighborReport, ns3::Ssid, ns3::SupportedRates, ns3::TidToLinkMapping, ns3::Tim, ns3::VhtCapabilities, ns3::VhtOperation, TestWifiInformationElement, and TestWifiSubElement.
Referenced by GetSerializedSize(), and Serialize().
uint16_t ns3::WifiInformationElement::GetSerializedSize | ( | ) | const |
Get the size of the serialized IE including Element ID and length fields (for every element this IE is possibly fragmented into).
Definition at line 24 of file wifi-information-element.cc.
References GetInformationFieldSize().
Referenced by TimInformationElementTest::CheckSerializationAgainstBuffer(), TimInformationElementTest::DoRun(), WifiEhtCapabilitiesIeTest::DoRun(), ns3::dot11s::PeerLinkConfirmStart::GetSerializedSize(), ns3::dot11s::PeerLinkOpenStart::GetSerializedSize(), ns3::MgtAddBaRequestHeader::GetSerializedSize(), ns3::MgtAddBaResponseHeader::GetSerializedSize(), operator==(), WifiEhtCapabilitiesIeTest::SerializeIntoBuffer(), and WifiIeFragmentationTest::SerializeIntoBuffer().
|
virtual |
Compare two IEs for equality by ID & Length, and then through memcmp of serialised version.
a | another information element to compare with |
Reimplemented in ns3::dot11s::IeBeaconTiming.
Definition at line 223 of file wifi-information-element.cc.
References ns3::Buffer::AddAtEnd(), ns3::Buffer::Begin(), ElementId(), ElementIdExt(), GetSerializedSize(), ns3::Buffer::PeekData(), and Serialize().
|
virtual |
Generate human-readable form of IE.
os | output stream |
Reimplemented in ns3::AddbaExtension, ns3::dot11s::IeBeaconTiming, ns3::dot11s::IeConfiguration, ns3::dot11s::IeLinkMetricReport, ns3::dot11s::IeMeshId, ns3::dot11s::IePeeringProtocol, ns3::dot11s::IePeerManagement, ns3::dot11s::IePerr, ns3::dot11s::IePrep, ns3::dot11s::IePreq, ns3::dot11s::IeRann, ns3::EhtCapabilities, ns3::EhtOperation, ns3::ExtendedCapabilities, ns3::He6GhzBandCapabilities, ns3::HeCapabilities, ns3::HeOperation, ns3::HtCapabilities, ns3::HtOperation, ns3::NonInheritance, ns3::Ssid, ns3::SupportedRates, ns3::Tim, ns3::VhtCapabilities, and ns3::VhtOperation.
Definition at line 19 of file wifi-information-element.cc.
Referenced by ns3::operator<<().
Buffer::Iterator ns3::WifiInformationElement::Serialize | ( | Buffer::Iterator | i | ) | const |
Serialize entire IE including Element ID and length fields.
Handle fragmentation of the IE if needed.
i | an iterator which points to where the IE should be written. |
Definition at line 50 of file wifi-information-element.cc.
References ElementId(), ElementIdExt(), GetInformationFieldSize(), IE_EXTENSION, ns3::Buffer::Iterator::Next(), SerializeFragments(), SerializeInformationField(), and ns3::Buffer::Iterator::WriteU8().
Referenced by TimInformationElementTest::CheckSerializationAgainstBuffer(), operator==(), ns3::dot11s::PeerLinkCloseStart::Serialize(), ns3::dot11s::PeerLinkConfirmStart::Serialize(), ns3::dot11s::PeerLinkOpenStart::Serialize(), ns3::MgtAddBaRequestHeader::Serialize(), ns3::MgtAddBaResponseHeader::Serialize(), WifiEhtCapabilitiesIeTest::SerializeIntoBuffer(), and WifiIeFragmentationTest::SerializeIntoBuffer().
|
private |
Serialize an IE that needs to be fragmented.
i | an iterator which points to where the IE should be written. |
size | the size of the body of the IE |
Definition at line 76 of file wifi-information-element.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), ElementId(), ElementIdExt(), IE_EXTENSION, IE_FRAGMENT, NS_ASSERT, ns3::Buffer::Iterator::ReadU8(), SerializeInformationField(), and ns3::Buffer::Iterator::WriteU8().
Referenced by Serialize().
|
privatepure virtual |
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
start | an iterator which points to where the information should be written. |
Implemented in ns3::AddbaExtension, ns3::dot11s::IeBeaconTiming, ns3::dot11s::IeConfiguration, ns3::dot11s::IeLinkMetricReport, ns3::dot11s::IeMeshId, ns3::dot11s::IePeeringProtocol, ns3::dot11s::IePeerManagement, ns3::dot11s::IePerr, ns3::dot11s::IePrep, ns3::dot11s::IePreq, ns3::dot11s::IeRann, ns3::DsssParameterSet, ns3::EdcaParameterSet, ns3::EhtCapabilities, ns3::EhtOperation, ns3::ErpInformation, ns3::ExtendedCapabilities, ns3::He6GhzBandCapabilities, ns3::HeCapabilities, ns3::HeOperation, ns3::HtCapabilities, ns3::HtOperation, ns3::MuEdcaParameterSet, ns3::MultiLinkElement::PerStaProfileSubelement, ns3::MultiLinkElement, ns3::NonInheritance, ns3::ReducedNeighborReport, ns3::Ssid, ns3::SupportedRates, ns3::TidToLinkMapping, ns3::Tim, ns3::VhtCapabilities, ns3::VhtOperation, TestWifiInformationElement, and TestWifiSubElement.
Referenced by Serialize(), and SerializeFragments().