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

IPv4 Fragmentation Test. More...

+ Inheritance diagram for Ipv4FragmentationTest:
+ Collaboration diagram for Ipv4FragmentationTest:

Public Member Functions

 Ipv4FragmentationTest (bool broadcast)
 Constructor.
 
 ~Ipv4FragmentationTest () override
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void HandleReadClient (Ptr< Socket > socket)
 Handle incoming packets.
 
void HandleReadIcmpClient (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
 Handle incoming ICMP packets.
 
void HandleReadServer (Ptr< Socket > socket)
 Handle incoming packets.
 
Ptr< PacketSendClient ()
 Send a packet.
 
void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
 Set the packet fill.
 
void StartClient (Ptr< Node > ClientNode)
 Start the client.
 
void StartServer (Ptr< Node > ServerNode)
 Start the server.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Attributes

bool m_broadcast
 broadcast packets
 
uint8_t * m_data
 Data.
 
uint32_t m_dataSize
 Data size.
 
uint8_t m_icmpType
 ICMP type.
 
Ptr< Packetm_receivedPacketClient
 Packet received by client.
 
Ptr< Packetm_receivedPacketServer
 Packet received by server.
 
Ptr< Packetm_sentPacketClient
 Packet sent by client.
 
uint32_t m_size
 packet size.
 
Ptr< Socketm_socketClient
 Client socket.
 
Ptr< Socketm_socketServer
 Server socket.
 

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

IPv4 Fragmentation Test.

Definition at line 119 of file ipv4-fragmentation-test.cc.

Constructor & Destructor Documentation

◆ Ipv4FragmentationTest()

Ipv4FragmentationTest::Ipv4FragmentationTest ( bool broadcast)

Constructor.

Parameters
broadcastsend broadcast packets (true) or unicast packets (false)

Definition at line 196 of file ipv4-fragmentation-test.cc.

References m_broadcast, m_data, m_dataSize, m_icmpType, m_size, and m_socketServer.

◆ ~Ipv4FragmentationTest()

Ipv4FragmentationTest::~Ipv4FragmentationTest ( )
override

Definition at line 208 of file ipv4-fragmentation-test.cc.

References m_data, and m_dataSize.

Member Function Documentation

◆ DoRun()

◆ HandleReadClient()

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

Handle incoming packets.

Parameters
socketThe receiving socket.

Definition at line 270 of file ipv4-fragmentation-test.cc.

References ns3::InetSocketAddress::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 Ipv4FragmentationTest::HandleReadIcmpClient ( Ipv4Address icmpSource,
uint8_t icmpTtl,
uint8_t icmpType,
uint8_t icmpCode,
uint32_t icmpInfo )

Handle incoming ICMP packets.

Parameters
icmpSourceThe ICMP sender.
icmpTtlThe ICMP TTL.
icmpTypeThe ICMP Type.
icmpCodeThe ICMP Code.
icmpInfoThe ICMP Info.

Definition at line 284 of file ipv4-fragmentation-test.cc.

References m_icmpType.

Referenced by StartClient().

+ Here is the caller graph for this function:

◆ HandleReadServer()

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

Handle incoming packets.

Parameters
socketThe receiving socket.

Definition at line 239 of file ipv4-fragmentation-test.cc.

References ns3::InetSocketAddress::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 > Ipv4FragmentationTest::SendClient ( )

Send a packet.

Returns
The sent packet.

Definition at line 322 of file ipv4-fragmentation-test.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::Create(), ns3::Ipv4Address::GetBroadcast(), ns3::Socket::GetPeerName(), m_broadcast, m_data, m_dataSize, m_size, m_socketClient, ns3::Socket::Send(), ns3::Socket::SendTo(), ns3::InetSocketAddress::SetIpv4(), and IPv4TestTag::SetToken().

Referenced by DoRun().

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

◆ SetFill()

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

Set the packet fill.

Parameters
fillThe fill.
fillSizeThe fill size.
dataSizeThe packet size.

Definition at line 294 of file ipv4-fragmentation-test.cc.

References m_data, m_dataSize, and m_size.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ StartClient()

void Ipv4FragmentationTest::StartClient ( Ptr< Node > ClientNode)

Start the client.

Parameters
ClientNodeThe client.

Definition at line 253 of file ipv4-fragmentation-test.cc.

References ns3::Socket::Bind(), ns3::Socket::Connect(), ns3::Socket::CreateSocket(), HandleReadClient(), HandleReadIcmpClient(), ns3::TypeId::LookupByName(), m_broadcast, m_socketClient, ns3::MakeCallback(), ns3::Socket::SetAllowBroadcast(), 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 Ipv4FragmentationTest::StartServer ( Ptr< Node > ServerNode)

Start the server.

Parameters
ServerNodeThe server.

Definition at line 219 of file ipv4-fragmentation-test.cc.

References ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::DynamicCast(), ns3::Ipv4Address::GetAny(), 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_broadcast

bool Ipv4FragmentationTest::m_broadcast
private

broadcast packets

Definition at line 131 of file ipv4-fragmentation-test.cc.

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

◆ m_data

uint8_t* Ipv4FragmentationTest::m_data
private

◆ m_dataSize

uint32_t Ipv4FragmentationTest::m_dataSize
private

Data size.

Definition at line 127 of file ipv4-fragmentation-test.cc.

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

◆ m_icmpType

uint8_t Ipv4FragmentationTest::m_icmpType
private

ICMP type.

Definition at line 130 of file ipv4-fragmentation-test.cc.

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

◆ m_receivedPacketClient

Ptr<Packet> Ipv4FragmentationTest::m_receivedPacketClient
private

Packet received by client.

Definition at line 122 of file ipv4-fragmentation-test.cc.

Referenced by HandleReadClient().

◆ m_receivedPacketServer

Ptr<Packet> Ipv4FragmentationTest::m_receivedPacketServer
private

Packet received by server.

Definition at line 123 of file ipv4-fragmentation-test.cc.

Referenced by DoRun(), and HandleReadServer().

◆ m_sentPacketClient

Ptr<Packet> Ipv4FragmentationTest::m_sentPacketClient
private

Packet sent by client.

Definition at line 121 of file ipv4-fragmentation-test.cc.

◆ m_size

uint32_t Ipv4FragmentationTest::m_size
private

packet size.

Definition at line 129 of file ipv4-fragmentation-test.cc.

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

◆ m_socketClient

Ptr<Socket> Ipv4FragmentationTest::m_socketClient
private

Client socket.

Definition at line 126 of file ipv4-fragmentation-test.cc.

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

◆ m_socketServer

Ptr<Socket> Ipv4FragmentationTest::m_socketServer
private

Server socket.

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

Referenced by Ipv4FragmentationTest(), and StartServer().


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