20 #include "ns3/ipv6-extension-header.h"
21 #include "ns3/ipv6-option-header.h"
44 NS_TEST_EXPECT_MSG_EQ (header.
GetSerializedSize () % 8, 0,
"length of extension header is not a multiple of 8");
50 const uint8_t* data = buf.PeekData ();
51 NS_TEST_EXPECT_MSG_EQ (*(data+2), 1,
"padding is missing");
68 static const uint8_t TYPE = 42;
77 start.
WriteU8 (GetSerializedSize ()-2);
95 NS_TEST_EXPECT_MSG_EQ (header.
GetSerializedSize () % 8, 0,
"length of extension header is not a multiple of 8");
101 const uint8_t* data = buf.PeekData ();
102 NS_TEST_EXPECT_MSG_EQ (*(data+2), OptionWithoutAlignmentHeader::TYPE,
"option without alignment is not first in header field");
124 static const uint8_t TYPE = 73;
133 start.
WriteU8 (GetSerializedSize ()-2);
157 NS_TEST_EXPECT_MSG_EQ (header.
GetSerializedSize () % 8, 0,
"length of extension header is not a multiple of 8");
163 const uint8_t* data = buf.PeekData ();
164 NS_TEST_EXPECT_MSG_EQ (*(data+2), 1,
"padding is missing");
165 NS_TEST_EXPECT_MSG_EQ (*(data+4), OptionWithAlignmentHeader::TYPE,
"option with alignment is not padded correctly");
166 NS_TEST_EXPECT_MSG_EQ (*(data+8), 1,
"padding is missing");
167 NS_TEST_EXPECT_MSG_EQ (*(data+10), jumboHeader.
GetType (),
"option with alignment is not padded correctly");
200 NS_TEST_EXPECT_MSG_EQ (header.
GetSerializedSize () % 8, 0,
"length of extension header is not a multiple of 8");
206 const uint8_t* data = buf.PeekData ();
207 NS_TEST_EXPECT_MSG_EQ (*(data+2), jumboHeader.
GetType (),
"option with fulfilled alignment is padded anyway");
208 NS_TEST_EXPECT_MSG_EQ (*(data+8), OptionWithAlignmentHeader::TYPE,
"option with fulfilled alignment is padded anyway");
216 :
TestSuite (
"ipv6-extension-header", UNIT)
automatically resized byte buffer
iterator in a Buffer instance
void WriteU16(uint16_t data)
virtual void DoRun()
Implementation to actually run this test case.
virtual void DoRun()
Implementation to actually run this test case.
virtual void DoRun()
Implementation to actually run this test case.
void WriteU8(uint8_t data)
void AddOption(Ipv6OptionHeader const &option)
Serialize the option, prepending pad1 or padn option as necessary.
bool AddAtStart(uint32_t start)
virtual void DoRun()
Implementation to actually run this test case.