A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::olsr::Bug780Test Class Reference

See Bug 780 More...

#include "bug780-test.h"

+ Inheritance diagram for ns3::olsr::Bug780Test:
+ Collaboration diagram for ns3::olsr::Bug780Test:

Public Member Functions

 Bug780Test ()
 
 ~Bug780Test () override
 
- 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

void CreateNodes ()
 Create & configure test network.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void Receive (Ptr< Socket > socket)
 Receive echo reply.
 
void SendPing ()
 Send one ping.
 

Private Attributes

uint16_t m_recvCount
 Received ECHO Reply counter.
 
uint16_t m_seq
 Sequence number.
 
Ptr< Socketm_socket
 Socket.
 
const Time m_time
 Total simulation time.
 

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

See Bug 780

Definition at line 29 of file bug780-test.h.

Constructor & Destructor Documentation

◆ Bug780Test()

ns3::olsr::Bug780Test::Bug780Test ( )

Definition at line 35 of file bug780-test.cc.

◆ ~Bug780Test()

ns3::olsr::Bug780Test::~Bug780Test ( )
override

Definition at line 43 of file bug780-test.cc.

Member Function Documentation

◆ CreateNodes()

void ns3::olsr::Bug780Test::CreateNodes ( )
private

◆ DoRun()

void ns3::olsr::Bug780Test::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 48 of file bug780-test.cc.

References CreateNodes(), ns3::Simulator::Destroy(), m_recvCount, m_time, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), and ns3::Simulator::Stop().

+ Here is the call graph for this function:

◆ Receive()

void ns3::olsr::Bug780Test::Receive ( Ptr< Socket > socket)
private

Receive echo reply.

Parameters
socketthe socket

Definition at line 137 of file bug780-test.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetPort(), ns3::Socket::GetRxAvailable(), ns3::Icmpv4Header::GetType(), ns3::Icmpv4Header::ICMPV4_ECHO_REPLY, ns3::InetSocketAddress::IsMatchingType(), m_recvCount, m_socket, NS_ASSERT, and ns3::Socket::RecvFrom().

Referenced by CreateNodes().

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

◆ SendPing()

void ns3::olsr::Bug780Test::SendPing ( )
private

Send one ping.

Definition at line 108 of file bug780-test.cc.

References ns3::Node::ChecksumEnabled(), ns3::Create(), ns3::Icmpv4Header::EnableChecksum(), ns3::Icmpv4Header::ICMPV4_ECHO, m_seq, m_socket, m_time, ns3::Simulator::Now(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::Socket::Send(), SendPing(), ns3::Icmpv4Header::SetCode(), ns3::Icmpv4Echo::SetData(), ns3::Icmpv4Echo::SetIdentifier(), ns3::Icmpv4Echo::SetSequenceNumber(), and ns3::Icmpv4Header::SetType().

Referenced by CreateNodes(), and SendPing().

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

Member Data Documentation

◆ m_recvCount

uint16_t ns3::olsr::Bug780Test::m_recvCount
private

Received ECHO Reply counter.

Definition at line 53 of file bug780-test.h.

Referenced by DoRun(), and Receive().

◆ m_seq

uint16_t ns3::olsr::Bug780Test::m_seq
private

Sequence number.

Definition at line 51 of file bug780-test.h.

Referenced by SendPing().

◆ m_socket

Ptr<Socket> ns3::olsr::Bug780Test::m_socket
private

Socket.

Definition at line 49 of file bug780-test.h.

Referenced by CreateNodes(), Receive(), and SendPing().

◆ m_time

const Time ns3::olsr::Bug780Test::m_time
private

Total simulation time.

Definition at line 37 of file bug780-test.h.

Referenced by DoRun(), and SendPing().


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