9#include "ns3/header-serialization-test.h"
11#include "ns3/supported-rates.h"
12#include "ns3/wifi-information-element.h"
13#include "ns3/wifi-mgt-header.h"
91 for (uint16_t i = 0; i < length; i++)
155 m_content.push_back(std::move(subelement));
164 size += subelement.GetSerializedSize();
175 start = subelement.Serialize(start);
187 while (count < length)
191 m_content.push_back(std::move(subelement));
204 :
public WifiMgtHeader<TestHeader, std::tuple<std::vector<TestWifiInformationElement>>>
237 .SetGroupName(
"Wifi")
285 void CheckSerializedByte(
const Buffer& buffer,
uint32_t position, uint8_t value);
288 void DoRun()
override;
293WifiIeFragmentationTest ::WifiIeFragmentationTest(
bool extended)
313 uint8_t
byte = it.
ReadU8();
330 uint16_t sub01Size = 50;
331 uint16_t sub02Size = limit - sub01Size;
338 testIe.AddSubelement(std::move(sub01));
339 testIe.AddSubelement(std::move(sub02));
368 sub02Size = limit + 1 - sub01Size;
375 testIe.AddSubelement(std::move(sub01));
376 testIe.AddSubelement(std::move(sub02));
400 expectedHdrSize += 2 + 255
411 uint16_t sub03Size = limit + 255 - sub01Size - sub02Size;
419 testIe.AddSubelement(std::move(sub01));
420 testIe.AddSubelement(std::move(sub02));
421 testIe.AddSubelement(std::move(sub03));
443 expectedHdrSize += 2 + 255
454 sub03Size = limit + 255 + 1 - sub01Size - sub02Size;
462 testIe.AddSubelement(std::move(sub01));
463 testIe.AddSubelement(std::move(sub02));
464 testIe.AddSubelement(std::move(sub03));
484 (
m_extended ? 3 : 2) + sub01Size + 2 + sub02Size,
487 (
m_extended ? 3 : 2) + sub01Size + 2 + sub02Size + 1,
494 expectedHdrSize += 2 + 255
510 testIe.AddSubelement(std::move(sub01));
528 expectedHdrSize += 2 + 255
543 testIe.AddSubelement(std::move(sub01));
573 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.
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, Duration duration=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