A Discrete-Event Network Simulator
API
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. More...
 
void HandleReadClient (Ptr< Socket > socket)
 Handles incoming packets in the client. More...
 
void HandleReadIcmpClient (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
 Handles incoming ICMP packets in the client. More...
 
void HandleReadServer (Ptr< Socket > socket)
 Handles incoming packets in the server. More...
 
Ptr< PacketSendClient ()
 Send a packet to the server. More...
 
void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
 Set the packet optional content. More...
 
void StartClient (Ptr< Node > clientNode)
 Start the client node. More...
 
void StartServer (Ptr< Node > serverNode)
 Start the server node. More...
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Attributes

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

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. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCase. More...
 
bool IsStatusFailure () const
 Check if any tests failed. More...
 
bool IsStatusSuccess () const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
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. More...
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

Detailed Description

6LoWPAN Fragmentation Test

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

Constructor & Destructor Documentation

◆ SixlowpanFragmentationTest()

SixlowpanFragmentationTest::SixlowpanFragmentationTest ( )

◆ ~SixlowpanFragmentationTest()

SixlowpanFragmentationTest::~SixlowpanFragmentationTest ( )
override

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

References m_data, and m_dataSize.

Member Function Documentation

◆ DoRun()

void SixlowpanFragmentationTest::DoRun ( )
overridevirtual

◆ HandleReadClient()

void SixlowpanFragmentationTest::HandleReadClient ( Ptr< Socket socket)

Handles incoming packets in the client.

Parameters
socketThe receiving socket.

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

References ns3::Packet::Copy(), m_receivedPacketClient, and ns3::Socket::RecvFrom().

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 212 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 163 of file sixlowpan-fragmentation-test.cc.

References ns3::Packet::Copy(), m_receivedPacketServer, ns3::Socket::RecvFrom(), ns3::Packet::RemoveAllByteTags(), and ns3::Packet::RemoveAllPacketTags().

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 251 of file sixlowpan-fragmentation-test.cc.

References 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 223 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 180 of file sixlowpan-fragmentation-test.cc.

References ns3::Socket::Bind(), ns3::Socket::Connect(), HandleReadClient(), HandleReadIcmpClient(), 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 147 of file sixlowpan-fragmentation-test.cc.

References ns3::Socket::Bind(), HandleReadServer(), 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 63 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 62 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 66 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 65 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 57 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 58 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 56 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 64 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 61 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 60 of file sixlowpan-fragmentation-test.cc.

Referenced by SixlowpanFragmentationTest(), and StartServer().


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