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

SixLowPanNetDevice compression threshold test. More...

Inheritance diagram for SixLowPanCompressionThresholdTest:
Collaboration diagram for SixLowPanCompressionThresholdTest:

Public Member Functions

 SixLowPanCompressionThresholdTest ()
void DoRun () override
 Implementation to actually run this TestCase.
Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 Caller graph was not generated because of its size.
virtual ~TestCase ()
 Destructor.
std::string GetName () const
TestCase & operator= (const TestCase &)=delete

Private Member Functions

bool ReceiveFromMockDevice (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &source, const Address &destination, NetDevice::PacketType packetType)
 Callback for frames handed to the underlying mock device.
uint8_t SendOnePacket (uint16_t paddingThreshold, uint32_t compressionThreshold, uint32_t payloadSize)
 Send one packet over a SixLowPanNetDevice.

Private Attributes

uint8_t m_dispatch {0}
 First byte of the last transmitted frame.

Additional Inherited Members

Public Types inherited from ns3::TestCase
enum class  Duration { 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, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
TestCase * GetParent () 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

SixLowPanNetDevice compression threshold test.

Packets whose compressed form is smaller than the underlying device padding threshold must be sent with the uncompressed IPv6 dispatch: link-layer padding is indistinguishable from data on such links, and it would corrupt the reconstruction of the elided IPv6 Payload Length (issue #1361).

Definition at line 35 of file sixlowpan-compression-threshold-test.cc.

Constructor & Destructor Documentation

◆ SixLowPanCompressionThresholdTest()

SixLowPanCompressionThresholdTest::SixLowPanCompressionThresholdTest ( )

Definition at line 74 of file sixlowpan-compression-threshold-test.cc.

References ns3::TestCase::TestCase().

Here is the call graph for this function:

Member Function Documentation

◆ DoRun()

void SixLowPanCompressionThresholdTest::DoRun ( )
overridevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 134 of file sixlowpan-compression-threshold-test.cc.

References ns3::SixLowPanDispatch::GetDispatchType(), ns3::SixLowPanDispatch::LOWPAN_IPHC, ns3::SixLowPanDispatch::LOWPAN_IPv6, NS_TEST_EXPECT_MSG_EQ, and SendOnePacket().

Here is the call graph for this function:

◆ ReceiveFromMockDevice()

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

Callback for frames handed to the underlying mock device.

Parameters
deviceThe mock device.
PacketThe transmitted packet.
protocolThe protocol number.
sourceThe source address.
destinationThe destination address.
packetTypeThe packet type.
Returns
true

Definition at line 80 of file sixlowpan-compression-threshold-test.cc.

References m_dispatch.

Referenced by SendOnePacket().

Here is the caller graph for this function:

◆ SendOnePacket()

uint8_t SixLowPanCompressionThresholdTest::SendOnePacket ( uint16_t paddingThreshold,
uint32_t compressionThreshold,
uint32_t payloadSize )
private

Send one packet over a SixLowPanNetDevice.

Parameters
paddingThresholdPadding threshold reported by the mock device.
compressionThresholdValue for the CompressionThreshold attribute.
payloadSizeIPv6 payload size in bytes.
Returns
The first dispatch byte of the transmitted frame.

Definition at line 92 of file sixlowpan-compression-threshold-test.cc.

References ns3::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), m_dispatch, ns3::MakeCallback(), ReceiveFromMockDevice(), 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_dispatch

uint8_t SixLowPanCompressionThresholdTest::m_dispatch {0}
private

First byte of the last transmitted frame.

Definition at line 37 of file sixlowpan-compression-threshold-test.cc.

Referenced by ReceiveFromMockDevice(), and SendOnePacket().


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