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>
47 virtual void DoRun (
void);
51 :
TestCase (
"Test the 802.15.4 MAC header and trailer classes")
70 uint16_t srcPanId = 100;
80 std::cout <<
" <--Mac Header added " << std::endl;
88 std::vector<uint8_t> buffer (size);
90 Ptr<Packet> p2 = Create<Packet> (buffer.data (), size,
true);
93 p2->
Print (std::cout);
94 std::cout <<
" <--Packet P2 " << std::endl;
101 receivedMacHdr.
Print (std::cout);
102 std::cout <<
" <--P2 Mac Header " << std::endl;
LrWpan header and trailer Test.
virtual ~LrWpanPacketTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
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 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.
uint32_t GetSerializedSize(void) const
Returns number of bytes required for packet serialization.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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.