20 #include "ns3/header-serialization-test.h"
22 #include "ns3/supported-rates.h"
23 #include "ns3/wifi-information-element.h"
24 #include "ns3/wifi-mgt-header.h"
61 uint16_t GetInformationFieldSize()
const override;
71 m_content.resize(count);
72 std::iota(m_content.begin(), m_content.end(),
start);
84 return m_content.size();
91 for (
const auto&
byte : m_content)
102 for (uint16_t i = 0; i < length; i++)
104 m_content.push_back(
start.ReadU8());
135 uint16_t GetInformationFieldSize()
const override;
166 m_content.push_back(std::move(subelement));
175 size += subelement.GetSerializedSize();
198 while (count < length)
202 m_content.push_back(std::move(subelement));
215 :
public WifiMgtHeader<TestHeader, std::tuple<std::vector<TestWifiInformationElement>>>
248 .SetGroupName(
"Wifi")
296 void CheckSerializedByte(
const Buffer& buffer, uint32_t position, uint8_t
value);
299 void DoRun()
override;
324 uint8_t
byte = it.
ReadU8();
341 uint16_t sub01Size = 50;
342 uint16_t sub02Size = limit - sub01Size;
349 testIe.AddSubelement(std::move(sub01));
350 testIe.AddSubelement(std::move(sub02));
370 uint32_t expectedHdrSize = 2 + 255;
379 sub02Size = limit + 1 - sub01Size;
386 testIe.AddSubelement(std::move(sub01));
387 testIe.AddSubelement(std::move(sub02));
411 expectedHdrSize += 2 + 255
422 uint16_t sub03Size = limit + 255 - sub01Size - sub02Size;
430 testIe.AddSubelement(std::move(sub01));
431 testIe.AddSubelement(std::move(sub02));
432 testIe.AddSubelement(std::move(sub03));
454 expectedHdrSize += 2 + 255
465 sub03Size = limit + 255 + 1 - sub01Size - sub02Size;
473 testIe.AddSubelement(std::move(sub01));
474 testIe.AddSubelement(std::move(sub02));
475 testIe.AddSubelement(std::move(sub03));
495 (
m_extended ? 3 : 2) + sub01Size + 2 + sub02Size,
498 (
m_extended ? 3 : 2) + sub01Size + 2 + sub02Size + 1,
505 expectedHdrSize += 2 + 255
521 testIe.AddSubelement(std::move(sub01));
539 expectedHdrSize += 2 + 255
554 testIe.AddSubelement(std::move(sub01));
584 expectedHdrSize += 2 + 255
Subelement to test fragmentation.
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
TestWifiSubElement()=default
std::list< uint8_t > m_content
content of the IE
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 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)
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
Test fragmentation of Information Elements.
Buffer SerializeIntoBuffer(const WifiInformationElement &element)
Serialize the given element in a buffer.
WifiIeFragmentationTest(bool extended)
Constructor.
bool m_extended
whether the IE includes an Element ID Extension field
void CheckSerializedByte(const Buffer &buffer, uint32_t position, uint8_t value)
Check that the given buffer contains the given value at the given position.
void DoRun() override
Implementation to actually run this TestCase.
~WifiIeFragmentationTest() override=default
wifi Information Element fragmentation Test Suite
WifiIeFragmentationTestSuite()
iterator in a Buffer instance
uint32_t GetDistanceFrom(const Iterator &o) const
void Next()
go forward by one byte
automatically resized byte buffer
void AddAtStart(uint32_t start)
Buffer::Iterator Begin() const
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
static bool g_extendedIe
whether the test Information Element includes an Element ID Extension field
static WifiIeFragmentationTestSuite g_wifiIeFragmentationTestSuite
the test suite