21 #include <ns3/packet.h>
22 #include <ns3/lr-wpan-mac-header.h>
23 #include <ns3/lr-wpan-mac-trailer.h>
24 #include <ns3/mac16-address.h>
25 #include <ns3/mac64-address.h>
41 virtual void DoRun (
void);
45 :
TestCase (
"Test the 802.15.4 MAC header and trailer classes")
64 uint16_t srcPanId = 100;
74 std::cout <<
" <--Mac Header added " << std::endl;
84 Ptr<Packet> p2 = Create<Packet> (buffer, size,
true);
87 p2->
Print (std::cout);
88 std::cout <<
" <--Packet P2 " << std::endl;
95 receivedMacHdr.Print (std::cout);
96 std::cout <<
" <--P2 Mac Header " << std::endl;
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
uint32_t Serialize(uint8_t *buffer, uint32_t maxSize) const
Serialize a packet, tags, and metadata into a byte buffer.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void Print(std::ostream &os) const
Print the packet contents.
static LrWpanPacketTestSuite lrWpanPacketTestSuite
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
#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.
void AddTrailer(const Trailer &trailer)
Add trailer to this packet.
uint32_t RemoveTrailer(Trailer &trailer)
Remove a deserialized trailer from the internal buffer.
This class can contain 16 bit addresses.
Represent the Mac Trailer with the Frame Check Sequence field.
virtual ~LrWpanPacketTestCase()
uint32_t GetSerializedSize(void) const
Returns number of bytes required for packet serialization.
void AddHeader(const Header &header)
Add header to this packet.