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> 46 virtual void DoRun (
void);
50 :
TestCase (
"Test the 802.15.4 MAC header and trailer classes")
69 uint16_t srcPanId = 100;
79 std::cout <<
" <--Mac Header added " << std::endl;
89 Ptr<Packet> p2 = Create<Packet> (buffer, size,
true);
92 p2->
Print (std::cout);
93 std::cout <<
" <--Packet P2 " << std::endl;
100 receivedMacHdr.Print (std::cout);
101 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.
void Print(std::ostream &os) const
Print the packet contents.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t GetSerializedSize(void) const
Returns number of bytes required for packet serialization.
LrWpan header and trailer TestSuite.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
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.
static LrWpanPacketTestSuite g_lrWpanPacketTestSuite
Static variable for test initialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
LrWpan header and trailer Test.
Represent the Mac Trailer with the Frame Check Sequence field.
virtual ~LrWpanPacketTestCase()
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.