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

6LoWPAN Fragmentation Test More...

+ Inheritance diagram for SixlowpanFragmentationTest:
+ Collaboration diagram for SixlowpanFragmentationTest:

Public Member Functions

 SixlowpanFragmentationTest ()
 
 ~SixlowpanFragmentationTest () override
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void HandleReadClient (Ptr< Socket > socket)
 Handles incoming packets in the client.
 
void HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
 Handles incoming ICMP packets in the client.
 
void HandleReadServer (Ptr< Socket > socket)
 Handles incoming packets in the server.
 
Ptr< PacketSendClient ()
 Send a packet to the server.
 
void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
 Set the packet optional content.
 
void StartClient (Ptr< Node > clientNode)
 Start the client node.
 
void StartServer (Ptr< Node > serverNode)
 Start the server node.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Attributes

uint8_t * m_data
 Data to be carried in the packet.
 
uint32_t m_dataSize
 Size of the data (if any).
 
uint8_t m_icmpCode
 ICMP code.
 
uint8_t m_icmpType
 ICMP type.
 
Ptr< Packetm_receivedPacketClient
 Packet received by the client.
 
Ptr< Packetm_receivedPacketServer
 packet received by the server.
 
Ptr< Packetm_sentPacketClient
 Packet sent by client.
 
uint32_t m_size
 Size of the packet if no data has been provided.
 
Ptr< Socketm_socketClient
 Socket on the client.
 
Ptr< Socketm_socketServer
 Socket on the server.
 

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...
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto QUICK = Duration::QUICK
 Deprecated test duration simple enums.
 
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto TAKES_FOREVER = Duration::TAKES_FOREVER
 
- 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.
 
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 Fragmentation Test

Definition at line 43 of file sixlowpan-fragmentation-test.cc.

Constructor & Destructor Documentation

◆ SixlowpanFragmentationTest()

SixlowpanFragmentationTest::SixlowpanFragmentationTest ( )

◆ ~SixlowpanFragmentationTest()

SixlowpanFragmentationTest::~SixlowpanFragmentationTest ( )
override

Definition at line 125 of file sixlowpan-fragmentation-test.cc.

References m_data, and m_dataSize.

Member Function Documentation

◆ DoRun()

void SixlowpanFragmentationTest::DoRun ( )
overridevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 257 of file sixlowpan-fragmentation-test.cc.

References ns3::Mac48Address::Allocate(), ns3::Mac48Address::ConvertFrom(), ns3::Packet::CopyData(), ns3::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), ns3::Packet::EnablePrinting(), ns3::Node::GetId(), ns3::Socket::GetNode(), ns3::Packet::GetSize(), m_data, m_icmpCode, m_icmpType, m_receivedPacketServer, m_socketClient, NS_TEST_EXPECT_MSG_EQ, packetSize, ns3::Simulator::Run(), ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), SendClient(), SetFill(), StartClient(), and StartServer().

+ Here is the call graph for this function:

◆ HandleReadClient()

void SixlowpanFragmentationTest::HandleReadClient ( Ptr< Socket > socket)

Handles incoming packets in the client.

Parameters
socketThe receiving socket.

Definition at line 187 of file sixlowpan-fragmentation-test.cc.

References ns3::Inet6SocketAddress::IsMatchingType(), and m_receivedPacketClient.

Referenced by StartClient().

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

◆ HandleReadIcmpClient()

void SixlowpanFragmentationTest::HandleReadIcmpClient ( Ipv6Address icmpSource,
uint8_t icmpTtl,
uint8_t icmpType,
uint8_t icmpCode,
uint32_t icmpInfo )

Handles incoming ICMP packets in the client.

Parameters
icmpSourceICMP sender address.
icmpTtlICMP TTL.
icmpTypeICMP type.
icmpCodeICMP code.
icmpInfoICMP info.

Definition at line 201 of file sixlowpan-fragmentation-test.cc.

References m_icmpCode, and m_icmpType.

Referenced by StartClient().

+ Here is the caller graph for this function:

◆ HandleReadServer()

void SixlowpanFragmentationTest::HandleReadServer ( Ptr< Socket > socket)

Handles incoming packets in the server.

Parameters
socketThe receiving socket.

Definition at line 152 of file sixlowpan-fragmentation-test.cc.

References ns3::Inet6SocketAddress::IsMatchingType(), and m_receivedPacketServer.

Referenced by StartServer().

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

◆ SendClient()

Ptr< Packet > SixlowpanFragmentationTest::SendClient ( )

Send a packet to the server.

Returns
The packet sent.

Definition at line 240 of file sixlowpan-fragmentation-test.cc.

References ns3::Create(), m_data, m_dataSize, m_size, m_socketClient, and ns3::Socket::Send().

Referenced by DoRun().

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

◆ SetFill()

void SixlowpanFragmentationTest::SetFill ( uint8_t * fill,
uint32_t fillSize,
uint32_t dataSize )

Set the packet optional content.

Parameters
fillPointer to an array of data.
fillSizeSize of the array of data.
dataSizeSize of the packet - if fillSize is less than dataSize, the data is repeated.

Definition at line 212 of file sixlowpan-fragmentation-test.cc.

References m_data, m_dataSize, and m_size.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ StartClient()

void SixlowpanFragmentationTest::StartClient ( Ptr< Node > clientNode)

Start the client node.

Parameters
clientNodeThe client node.

Definition at line 169 of file sixlowpan-fragmentation-test.cc.

References ns3::Socket::Bind(), ns3::Socket::Connect(), ns3::Socket::CreateSocket(), ns3::Ipv6Address::GetAny(), HandleReadClient(), HandleReadIcmpClient(), ns3::TypeId::LookupByName(), m_socketClient, ns3::MakeCallback(), ns3::ObjectBase::SetAttribute(), and ns3::Socket::SetRecvCallback().

Referenced by DoRun().

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

◆ StartServer()

void SixlowpanFragmentationTest::StartServer ( Ptr< Node > serverNode)

Start the server node.

Parameters
serverNodeThe server node.

Definition at line 136 of file sixlowpan-fragmentation-test.cc.

References ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::DynamicCast(), HandleReadServer(), ns3::TypeId::LookupByName(), m_socketServer, ns3::MakeCallback(), and ns3::Socket::SetRecvCallback().

Referenced by DoRun().

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

Member Data Documentation

◆ m_data

uint8_t* SixlowpanFragmentationTest::m_data
private

Data to be carried in the packet.

Definition at line 52 of file sixlowpan-fragmentation-test.cc.

Referenced by SixlowpanFragmentationTest(), ~SixlowpanFragmentationTest(), DoRun(), SendClient(), and SetFill().

◆ m_dataSize

uint32_t SixlowpanFragmentationTest::m_dataSize
private

Size of the data (if any).

Definition at line 51 of file sixlowpan-fragmentation-test.cc.

Referenced by SixlowpanFragmentationTest(), ~SixlowpanFragmentationTest(), SendClient(), and SetFill().

◆ m_icmpCode

uint8_t SixlowpanFragmentationTest::m_icmpCode
private

ICMP code.

Definition at line 55 of file sixlowpan-fragmentation-test.cc.

Referenced by SixlowpanFragmentationTest(), DoRun(), and HandleReadIcmpClient().

◆ m_icmpType

uint8_t SixlowpanFragmentationTest::m_icmpType
private

ICMP type.

Definition at line 54 of file sixlowpan-fragmentation-test.cc.

Referenced by SixlowpanFragmentationTest(), DoRun(), and HandleReadIcmpClient().

◆ m_receivedPacketClient

Ptr<Packet> SixlowpanFragmentationTest::m_receivedPacketClient
private

Packet received by the client.

Definition at line 46 of file sixlowpan-fragmentation-test.cc.

Referenced by HandleReadClient().

◆ m_receivedPacketServer

Ptr<Packet> SixlowpanFragmentationTest::m_receivedPacketServer
private

packet received by the server.

Definition at line 47 of file sixlowpan-fragmentation-test.cc.

Referenced by DoRun(), and HandleReadServer().

◆ m_sentPacketClient

Ptr<Packet> SixlowpanFragmentationTest::m_sentPacketClient
private

Packet sent by client.

Definition at line 45 of file sixlowpan-fragmentation-test.cc.

◆ m_size

uint32_t SixlowpanFragmentationTest::m_size
private

Size of the packet if no data has been provided.

Definition at line 53 of file sixlowpan-fragmentation-test.cc.

Referenced by SixlowpanFragmentationTest(), SendClient(), and SetFill().

◆ m_socketClient

Ptr<Socket> SixlowpanFragmentationTest::m_socketClient
private

Socket on the client.

Definition at line 50 of file sixlowpan-fragmentation-test.cc.

Referenced by DoRun(), SendClient(), and StartClient().

◆ m_socketServer

Ptr<Socket> SixlowpanFragmentationTest::m_socketServer
private

Socket on the server.

Definition at line 49 of file sixlowpan-fragmentation-test.cc.

Referenced by SixlowpanFragmentationTest(), and StartServer().


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