A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
SixlowpanIphcStatefulImplTest Class Reference

6LoWPAN IPHC stateful compression Test More...

+ Inheritance diagram for SixlowpanIphcStatefulImplTest:
+ Collaboration diagram for SixlowpanIphcStatefulImplTest:

Classes

struct  Data
 Structure to hold the Rx/Tx packets. More...
 

Public Member Functions

 SixlowpanIphcStatefulImplTest ()
 
void DoRun () override
 Implementation to actually run this TestCase.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

bool PromiscReceiveFromSixLowPanDevice (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &source, const Address &destination, NetDevice::PacketType packetType)
 Promiscuous receive from a SixLowPanNetDevice.
 
bool ReceiveFromMockDevice (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &source, const Address &destination, NetDevice::PacketType packetType)
 Receive from a MockDevice.
 
void SendOnePacket (Ptr< NetDevice > device, Ipv6Address from, Ipv6Address to)
 Send one packet.
 

Private Attributes

NetDeviceContainer m_mockDevices
 MockNetDevice container.
 
std::vector< Datam_rxPackets
 Received packets.
 
NetDeviceContainer m_sixDevices
 SixLowPanNetDevice container.
 
std::vector< Datam_txPackets
 Transmitted packets.
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

6LoWPAN IPHC stateful compression Test

Definition at line 48 of file sixlowpan-iphc-stateful-test.cc.

Constructor & Destructor Documentation

◆ SixlowpanIphcStatefulImplTest()

SixlowpanIphcStatefulImplTest::SixlowpanIphcStatefulImplTest ( )

Definition at line 113 of file sixlowpan-iphc-stateful-test.cc.

Member Function Documentation

◆ DoRun()

void SixlowpanIphcStatefulImplTest::DoRun ( )
overridevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 184 of file sixlowpan-iphc-stateful-test.cc.

References ns3::NetDeviceContainer::Add(), ns3::SixLowPanHelper::AddContext(), ns3::Node::AddDevice(), ns3::Ipv6AddressHelper::Assign(), ns3::NodeContainer::Begin(), ns3::NodeContainer::Create(), ns3::Simulator::Destroy(), ns3::NodeContainer::End(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::Ipv6InterfaceContainer::GetAddress(), ns3::Ipv6Address::GetAny(), ns3::SixLowPanIphc::GetCid(), ns3::SixLowPanIphc::GetDac(), ns3::SixLowPanIphc::GetDam(), ns3::Ipv6Header::GetDestination(), ns3::SixLowPanIphc::GetDstContextId(), ns3::SixLowPanIphc::GetM(), ns3::SixLowPanIphc::GetSac(), ns3::SixLowPanIphc::GetSam(), ns3::Ipv6Header::GetSource(), ns3::SixLowPanIphc::GetSrcContextId(), ns3::SixLowPanIphc::HC_COMPR_0, ns3::SixLowPanIphc::HC_COMPR_16, ns3::SixLowPanIphc::HC_COMPR_64, ns3::SixLowPanIphc::HC_INLINE, ns3::SixLowPanHelper::Install(), ns3::InternetStackHelper::Install(), m_mockDevices, m_rxPackets, m_sixDevices, m_txPackets, ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::MakeCallback(), ns3::Minutes(), nodes, NS_TEST_EXPECT_MSG_EQ, PromiscReceiveFromSixLowPanDevice(), ReceiveFromMockDevice(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), SendOnePacket(), ns3::Ipv6AddressHelper::SetBase(), and ns3::Simulator::Stop().

+ Here is the call graph for this function:

◆ PromiscReceiveFromSixLowPanDevice()

bool SixlowpanIphcStatefulImplTest::PromiscReceiveFromSixLowPanDevice ( Ptr< NetDevice device,
Ptr< const Packet packet,
uint16_t  protocol,
const Address source,
const Address destination,
NetDevice::PacketType  packetType 
)
private

Promiscuous receive from a SixLowPanNetDevice.

Parameters
devicea pointer to the net device which is calling this function
packetthe packet received
protocolthe 16 bit protocol number associated with this packet.
sourcethe address of the sender
destinationthe address of the receiver
packetTypetype of packet received (broadcast/multicast/unicast/otherhost)
Returns
true.

Definition at line 150 of file sixlowpan-iphc-stateful-test.cc.

References SixlowpanIphcStatefulImplTest::Data::dst, m_rxPackets, SixlowpanIphcStatefulImplTest::Data::packet, and SixlowpanIphcStatefulImplTest::Data::src.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ ReceiveFromMockDevice()

bool SixlowpanIphcStatefulImplTest::ReceiveFromMockDevice ( Ptr< NetDevice device,
Ptr< const Packet packet,
uint16_t  protocol,
const Address source,
const Address destination,
NetDevice::PacketType  packetType 
)
private

Receive from a MockDevice.

Parameters
devicea pointer to the net device which is calling this function
packetthe packet received
protocolthe 16 bit protocol number associated with this packet.
sourcethe address of the sender
destinationthe address of the receiver
packetTypetype of packet received (broadcast/multicast/unicast/otherhost)
Returns
true.

Definition at line 119 of file sixlowpan-iphc-stateful-test.cc.

References SixlowpanIphcStatefulImplTest::Data::dst, ns3::NetDeviceContainer::Get(), m_mockDevices, m_txPackets, SixlowpanIphcStatefulImplTest::Data::packet, ns3::MockNetDevice::Receive(), ns3::Simulator::ScheduleWithContext(), and SixlowpanIphcStatefulImplTest::Data::src.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendOnePacket()

void SixlowpanIphcStatefulImplTest::SendOnePacket ( Ptr< NetDevice device,
Ipv6Address  from,
Ipv6Address  to 
)
private

Send one packet.

Parameters
devicethe device to send from
fromsender address
todestination address

Definition at line 167 of file sixlowpan-iphc-stateful-test.cc.

References ns3::Ipv6Header::SetDestination(), ns3::Ipv6Header::SetHopLimit(), ns3::Ipv6Header::SetNextHeader(), ns3::Ipv6Header::SetPayloadLength(), and ns3::Ipv6Header::SetSource().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_mockDevices

NetDeviceContainer SixlowpanIphcStatefulImplTest::m_mockDevices
private

MockNetDevice container.

Definition at line 105 of file sixlowpan-iphc-stateful-test.cc.

Referenced by DoRun(), and ReceiveFromMockDevice().

◆ m_rxPackets

std::vector<Data> SixlowpanIphcStatefulImplTest::m_rxPackets
private

Received packets.

Definition at line 61 of file sixlowpan-iphc-stateful-test.cc.

Referenced by DoRun(), and PromiscReceiveFromSixLowPanDevice().

◆ m_sixDevices

NetDeviceContainer SixlowpanIphcStatefulImplTest::m_sixDevices
private

SixLowPanNetDevice container.

Definition at line 106 of file sixlowpan-iphc-stateful-test.cc.

Referenced by DoRun().

◆ m_txPackets

std::vector<Data> SixlowpanIphcStatefulImplTest::m_txPackets
private

Transmitted packets.

Definition at line 60 of file sixlowpan-iphc-stateful-test.cc.

Referenced by DoRun(), and ReceiveFromMockDevice().


The documentation for this class was generated from the following file: