20#include <ns3/assert.h>
21#include <ns3/tid-to-link-mapping-element.h>
31 "Presence bitmap not expected if default mapping is set");
43 uint8_t val =
static_cast<uint8_t
>(direction);
44 val |= ((defaultMapping ? 1 : 0) << 2);
47 "Presence bitmap not expected if default mapping is set");
48 if (presenceBitmap.has_value())
50 start.WriteU8(presenceBitmap.value());
59 auto val = i.ReadU8();
63 defaultMapping = (((val >> 2) & 0x01) == 1);
68 presenceBitmap = i.ReadU8();
89 "Per-TID link mapping not expected if default mapping is set");
92 uint16_t linkMapping = 0;
94 for (
const auto& linkId : linkIds)
96 linkMapping |= (1 << linkId);
118 std::list<uint8_t> linkIds;
119 for (uint8_t linkId = 0; linkId < 15; linkId++)
121 if (((it->second >> linkId) & 0x0001) == 1)
123 linkIds.push_back(linkId);
137 "Per-TID link mapping not expected if default mapping is set");
148 "Per-TID link mapping not expected if default mapping is set");
152 start.WriteHtolsbU16(linkMapping);
162 NS_ASSERT_MSG(nCtrlOctets <= length,
"Tid-to-Link Mapping deserialize error");
164 count += nCtrlOctets;
169 "Default mapping should not be set when presence bitmap is present");
171 for (uint8_t tid = 0; tid < 8; tid++)
173 if (((presenceBitmap >> tid) & 0x01) == 1)
182 "TID-to-Link Mapping Length (" << +length
184 "from actual number of bytes read ("
iterator in a Buffer instance
void SetLinkMappingOfTid(uint8_t tid, std::list< uint8_t > linkIds)
Set the Link Mapping field of the given TID such that the given TID is mapped to the links associated...
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)
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
std::list< uint8_t > GetLinkMappingOfTid(uint8_t tid) const
Get the Link Mapping field of the given TID.
WifiInformationElementId ElementIdExt() const override
Get the wifi information element ID extension.
std::map< uint8_t, uint16_t > m_linkMapping
TID-indexed Link Mapping.
TidToLinkMapping::Control m_control
TID-to-link Mapping Control.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr uint16_t WIFI_TID_TO_LINK_MAPPING_CONTROL_BASIC_SIZE_B
size in bytes of the TID-To-Link Control field with default link mapping
TidLinkMapDir
TID-to-Link Mapping Control Direction IEEE 802.11be D2.0 Figure 9-1002an.
constexpr uint16_t WIFI_LINK_MAPPING_PER_TID_SIZE_B
size in bytes of the Link Mapping Of TID n field (IEEE 802.11be D2.0 9.4.2.314)
constexpr uint8_t WIFI_IE_ELEMENT_ID_EXT_SIZE
Size in bytes of the Element ID Extension field (IEEE 802.11-2020 9.4.2.1 General)
constexpr uint16_t WIFI_LINK_MAPPING_PRESENCE_IND_SIZE_B
size in bytes of the Link Mapping Presence Indicator field (IEEE 802.11be D2.0 9.4....
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
bool defaultMapping
Default link mapping.
void Serialize(Buffer::Iterator &start) const
Serialize the TID-to-Link Mapping Control subfield.
uint16_t GetSubfieldSize() const
uint16_t Deserialize(Buffer::Iterator start)
Deserialize the TID-to-Link Mapping Control subfield.
std::optional< uint8_t > presenceBitmap
Link Mapping Presence Indicator.