TCP Test - send string data from client to server and back. More...
| Public Member Functions | |
| TcpTestCase (uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t sourceReadSize, uint32_t serverWriteSize, uint32_t serverReadSize, bool useIpv6) | |
| Constructor. | |
| Public Member Functions inherited from ns3::TestCase | |
| TestCase (const TestCase &)=delete | |
| virtual | ~TestCase () | 
| Destructor. | |
| std::string | GetName () const | 
| TestCase & | operator= (const TestCase &)=delete | 
| Private Member Functions | |
| Ptr< SimpleNetDevice > | AddSimpleNetDevice (Ptr< Node > node, const char *ipaddr, const char *netmask) | 
| Add a SimpleNetDevice to a node (IPv4 version). | |
| Ptr< SimpleNetDevice > | AddSimpleNetDevice6 (Ptr< Node > node, Ipv6Address ipaddr, Ipv6Prefix prefix) | 
| Add a SimpleNetDevice to a node (IPv6 version). | |
| Ptr< Node > | CreateInternetNode () | 
| Create a node with the Internet stack (IPv4 version). | |
| Ptr< Node > | CreateInternetNode6 () | 
| Create a node with the Internet stack (IPv6 version). | |
| void | DoRun () override | 
| Implementation to actually run this TestCase. | |
| void | DoTeardown () override | 
| Implementation to do any local setup required for this TestCase. | |
| void | ServerHandleConnectionCreated (Ptr< Socket > s, const Address &addr) | 
| Server: Handle connection created. | |
| void | ServerHandleRecv (Ptr< Socket > sock) | 
| Server: Receive data. | |
| void | ServerHandleSend (Ptr< Socket > sock, uint32_t available) | 
| Server: Send data. | |
| void | SetupDefaultSim () | 
| Setup the test (IPv4 version). | |
| void | SetupDefaultSim6 () | 
| Setup the test (IPv6 version). | |
| void | SourceHandleRecv (Ptr< Socket > sock) | 
| Client: Receive data. | |
| void | SourceHandleSend (Ptr< Socket > sock, uint32_t available) | 
| Client: Send data. | |
| Private Attributes | |
| uint32_t | m_currentServerRxBytes | 
| Server Tx bytes. | |
| uint32_t | m_currentServerTxBytes | 
| Server Rx bytes. | |
| uint32_t | m_currentSourceRxBytes | 
| Client Rx bytes. | |
| uint32_t | m_currentSourceTxBytes | 
| Client Tx bytes. | |
| uint32_t | m_serverReadSize | 
| Server data size when receiving. | |
| uint8_t * | m_serverRxPayload | 
| Server Rx payload. | |
| uint32_t | m_serverWriteSize | 
| Server data size when sending. | |
| uint32_t | m_sourceReadSize | 
| Client data size when receiving. | |
| uint8_t * | m_sourceRxPayload | 
| Client Rx payload. | |
| uint8_t * | m_sourceTxPayload | 
| Client Tx payload. | |
| uint32_t | m_sourceWriteSize | 
| Client data size when sending. | |
| uint32_t | m_totalBytes | 
| Total stream size (in bytes). | |
| bool | m_useIpv6 | 
| Use IPv6 instead of IPv4. | |
| 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. | |
TCP Test - send string data from client to server and back.
Definition at line 47 of file tcp-test.cc.
| TcpTestCase::TcpTestCase | ( | uint32_t | totalStreamSize, | 
| uint32_t | sourceWriteSize, | ||
| uint32_t | sourceReadSize, | ||
| uint32_t | serverWriteSize, | ||
| uint32_t | serverReadSize, | ||
| bool | useIpv6 ) | 
Constructor.
| totalStreamSize | Total stream size (in bytes). | 
| sourceWriteSize | Client data size when sending. | 
| sourceReadSize | Client data size when receiving. | 
| serverWriteSize | Server data size when sending. | 
| serverReadSize | Server data size when receiving. | 
| useIpv6 | Use IPv6 instead of IPv4. | 
Definition at line 178 of file tcp-test.cc.
References ns3::TestCase::TestCase(), m_serverReadSize, m_serverWriteSize, m_sourceReadSize, m_sourceWriteSize, m_totalBytes, m_useIpv6, and Name().
| 
 | private | 
Add a SimpleNetDevice to a node (IPv4 version).
| node | The target node. | 
| ipaddr | the SimpleNetDevice IPv4 address. | 
| netmask | the SimpleNetDevice IPv4 address netmask. | 
Definition at line 369 of file tcp-test.cc.
References ns3::Mac48Address::Allocate(), ns3::Mac48Address::ConvertFrom(), and ns3::CreateObject().
Referenced by SetupDefaultSim().
| 
 | private | 
Add a SimpleNetDevice to a node (IPv6 version).
| node | The target node. | 
| ipaddr | the SimpleNetDevice IPv6 address. | 
| prefix | the SimpleNetDevice IP6 address prefix. | 
Definition at line 513 of file tcp-test.cc.
References ns3::Mac48Address::Allocate(), ns3::Mac48Address::ConvertFrom(), and ns3::CreateObject().
Referenced by SetupDefaultSim6().
Create a node with the Internet stack (IPv4 version).
Definition at line 338 of file tcp-test.cc.
References ns3::CreateObject().
Referenced by SetupDefaultSim().
Create a node with the Internet stack (IPv6 version).
Definition at line 483 of file tcp-test.cc.
References ns3::CreateObject().
Referenced by SetupDefaultSim6().
| 
 | overrideprivatevirtual | 
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 201 of file tcp-test.cc.
References m_currentServerRxBytes, m_currentServerTxBytes, m_currentSourceRxBytes, m_currentSourceTxBytes, m_serverRxPayload, m_sourceRxPayload, m_sourceTxPayload, m_totalBytes, m_useIpv6, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), SetupDefaultSim(), and SetupDefaultSim6().
| 
 | overrideprivatevirtual | 
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test teardown
Reimplemented from ns3::TestCase.
Definition at line 241 of file tcp-test.cc.
References ns3::Simulator::Destroy(), m_serverRxPayload, m_sourceRxPayload, and m_sourceTxPayload.
Server: Handle connection created.
| s | The socket. | 
| addr | The other party address. | 
Definition at line 250 of file tcp-test.cc.
References ns3::MakeCallback(), ServerHandleRecv(), and ServerHandleSend().
Referenced by SetupDefaultSim(), and SetupDefaultSim6().
Server: Receive data.
| sock | The socket. | 
Definition at line 257 of file tcp-test.cc.
References ns3::Socket::ERROR_NOTERROR, GetString(), m_currentServerRxBytes, m_serverReadSize, m_serverRxPayload, m_totalBytes, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_TEST_EXPECT_MSG_EQ, and ServerHandleSend().
Referenced by ServerHandleConnectionCreated().
Server: Send data.
| sock | The socket. | 
| available | Unused in the test. | 
Definition at line 278 of file tcp-test.cc.
References ns3::Create(), GetString(), m_currentServerRxBytes, m_currentServerTxBytes, m_serverRxPayload, m_serverWriteSize, m_totalBytes, NS_LOG_DEBUG, and NS_TEST_EXPECT_MSG_EQ.
Referenced by ServerHandleConnectionCreated(), and ServerHandleRecv().
| 
 | private | 
Setup the test (IPv4 version).
Definition at line 383 of file tcp-test.cc.
References AddSimpleNetDevice(), CreateInternetNode(), ns3::CreateObject(), ns3::Socket::ERROR_NOTCONN, ns3::Ipv4Address::GetAny(), ns3::MakeCallback(), ns3::MakeNullCallback(), NS_TEST_EXPECT_MSG_EQ, port, ServerHandleConnectionCreated(), SourceHandleRecv(), and SourceHandleSend().
Referenced by DoRun().
| 
 | private | 
Setup the test (IPv6 version).
Definition at line 433 of file tcp-test.cc.
References AddSimpleNetDevice6(), CreateInternetNode6(), ns3::CreateObject(), ns3::Socket::ERROR_NOTCONN, ns3::Ipv6Address::GetAny(), ns3::MakeCallback(), ns3::MakeNullCallback(), NS_TEST_EXPECT_MSG_EQ, port, ServerHandleConnectionCreated(), SourceHandleRecv(), and SourceHandleSend().
Referenced by DoRun().
Client: Receive data.
| sock | The socket. | 
Definition at line 314 of file tcp-test.cc.
References ns3::Socket::ERROR_NOTERROR, GetString(), m_currentSourceRxBytes, m_sourceReadSize, m_sourceRxPayload, m_totalBytes, NS_FATAL_ERROR, NS_LOG_DEBUG, and NS_TEST_EXPECT_MSG_EQ.
Referenced by SetupDefaultSim(), and SetupDefaultSim6().
Client: Send data.
| sock | The socket. | 
| available | Unused in the test. | 
Definition at line 298 of file tcp-test.cc.
References ns3::Create(), GetString(), m_currentSourceTxBytes, m_sourceTxPayload, m_sourceWriteSize, m_totalBytes, NS_LOG_DEBUG, and NS_TEST_EXPECT_MSG_EQ.
Referenced by SetupDefaultSim(), and SetupDefaultSim6().
| 
 | private | 
Server Tx bytes.
Definition at line 145 of file tcp-test.cc.
Referenced by DoRun(), ServerHandleRecv(), and ServerHandleSend().
| 
 | private | 
Server Rx bytes.
Definition at line 146 of file tcp-test.cc.
Referenced by DoRun(), and ServerHandleSend().
| 
 | private | 
Client Rx bytes.
Definition at line 144 of file tcp-test.cc.
Referenced by DoRun(), and SourceHandleRecv().
| 
 | private | 
Client Tx bytes.
Definition at line 143 of file tcp-test.cc.
Referenced by DoRun(), and SourceHandleSend().
| 
 | private | 
Server data size when receiving.
Definition at line 142 of file tcp-test.cc.
Referenced by TcpTestCase(), and ServerHandleRecv().
| 
 | private | 
Server Rx payload.
Definition at line 149 of file tcp-test.cc.
Referenced by DoRun(), DoTeardown(), ServerHandleRecv(), and ServerHandleSend().
| 
 | private | 
Server data size when sending.
Definition at line 141 of file tcp-test.cc.
Referenced by TcpTestCase(), and ServerHandleSend().
| 
 | private | 
Client data size when receiving.
Definition at line 140 of file tcp-test.cc.
Referenced by TcpTestCase(), and SourceHandleRecv().
| 
 | private | 
Client Rx payload.
Definition at line 148 of file tcp-test.cc.
Referenced by DoRun(), DoTeardown(), and SourceHandleRecv().
| 
 | private | 
Client Tx payload.
Definition at line 147 of file tcp-test.cc.
Referenced by DoRun(), DoTeardown(), and SourceHandleSend().
| 
 | private | 
Client data size when sending.
Definition at line 139 of file tcp-test.cc.
Referenced by TcpTestCase(), and SourceHandleSend().
| 
 | private | 
Total stream size (in bytes).
Definition at line 138 of file tcp-test.cc.
Referenced by TcpTestCase(), DoRun(), ServerHandleRecv(), ServerHandleSend(), SourceHandleRecv(), and SourceHandleSend().
| 
 | private | 
Use IPv6 instead of IPv4.
Definition at line 151 of file tcp-test.cc.
Referenced by TcpTestCase(), and DoRun().