20 #include <ns3/lr-wpan-mac-header.h>
21 #include <ns3/lr-wpan-mac-trailer.h>
22 #include <ns3/mac16-address.h>
23 #include <ns3/mac64-address.h>
24 #include <ns3/packet.h>
46 void DoRun()
override;
50 :
TestCase(
"Test the 802.15.4 MAC header and trailer classes")
68 uint16_t srcPanId = 100;
77 std::cout <<
" <--Mac Header added " << std::endl;
85 std::vector<uint8_t> buffer(size);
87 Ptr<Packet> p2 = Create<Packet>(buffer.data(), size,
true);
90 std::cout <<
" <--Packet P2 " << std::endl;
97 receivedMacHdr.
Print(std::cout);
98 std::cout <<
" <--P2 Mac Header " << std::endl;
106 "Packet wrong size after removing headers and trailers");
LrWpan header and trailer Test.
void DoRun() override
Implementation to actually run this TestCase.
~LrWpanPacketTestCase() override
LrWpan header and trailer TestSuite.
Represent the Mac Trailer with the Frame Check Sequence field.
This class can contain 16 bit addresses.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
uint32_t RemoveTrailer(Trailer &trailer)
Remove a deserialized trailer from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t GetSerializedSize() const
Returns number of bytes required for packet serialization.
uint32_t Serialize(uint8_t *buffer, uint32_t maxSize) const
Serialize a packet, tags, and metadata into a byte buffer.
void Print(std::ostream &os) const
Print the packet contents.
void AddTrailer(const Trailer &trailer)
Add trailer to this packet.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
static LrWpanPacketTestSuite g_lrWpanPacketTestSuite
Static variable for test initialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.