TCP Test - send string data from client to server and back. More...
Inheritance diagram for TcpTestCase:
Collaboration diagram for TcpTestCase: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 | 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. | |
| void | AddTestCase (TestCase *testCase, TestDuration 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 58 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 189 of file tcp-test.cc.
|
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 380 of file tcp-test.cc.
References ns3::Mac48Address::Allocate(), and ns3::Mac48Address::ConvertFrom().
Referenced by SetupDefaultSim().
Here is the call graph for this function:
Here is the caller graph for this function:
|
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 524 of file tcp-test.cc.
References ns3::Mac48Address::Allocate(), and ns3::Mac48Address::ConvertFrom().
Referenced by SetupDefaultSim6().
Here is the call graph for this function:
Here is the caller graph for this function:Create a node with the Internet stack (IPv4 version).
Definition at line 349 of file tcp-test.cc.
Referenced by SetupDefaultSim().
Here is the caller graph for this function:Create a node with the Internet stack (IPv6 version).
Definition at line 494 of file tcp-test.cc.
Referenced by SetupDefaultSim6().
Here is the caller graph for this function:
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 212 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().
Here is the call graph for this function:
|
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 252 of file tcp-test.cc.
References ns3::Simulator::Destroy(), m_serverRxPayload, m_sourceRxPayload, and m_sourceTxPayload.
Here is the call graph for this function:Server: Handle connection created.
| s | The socket. |
| addr | The other party address. |
Definition at line 261 of file tcp-test.cc.
References ns3::MakeCallback(), ServerHandleRecv(), and ServerHandleSend().
Referenced by SetupDefaultSim(), and SetupDefaultSim6().
Here is the call graph for this function:
Here is the caller graph for this function:Server: Receive data.
| sock | The socket. |
Definition at line 268 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().
Here is the call graph for this function:
Here is the caller graph for this function:Server: Send data.
| sock | The socket. |
| available | Unused in the test. |
Definition at line 289 of file tcp-test.cc.
References 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().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Setup the test (IPv4 version).
Definition at line 394 of file tcp-test.cc.
References AddSimpleNetDevice(), CreateInternetNode(), ns3::Socket::ERROR_NOTCONN, ns3::Ipv4Address::GetAny(), ns3::MakeCallback(), ns3::MakeNullCallback(), NS_TEST_EXPECT_MSG_EQ, port, ServerHandleConnectionCreated(), SourceHandleRecv(), and SourceHandleSend().
Referenced by DoRun().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Setup the test (IPv6 version).
Definition at line 444 of file tcp-test.cc.
References AddSimpleNetDevice6(), CreateInternetNode6(), ns3::Socket::ERROR_NOTCONN, ns3::Ipv6Address::GetAny(), ns3::MakeCallback(), ns3::MakeNullCallback(), NS_TEST_EXPECT_MSG_EQ, port, ServerHandleConnectionCreated(), SourceHandleRecv(), and SourceHandleSend().
Referenced by DoRun().
Here is the call graph for this function:
Here is the caller graph for this function:Client: Receive data.
| sock | The socket. |
Definition at line 325 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().
Here is the call graph for this function:
Here is the caller graph for this function:Client: Send data.
| sock | The socket. |
| available | Unused in the test. |
Definition at line 309 of file tcp-test.cc.
References GetString(), m_currentSourceTxBytes, m_sourceTxPayload, m_sourceWriteSize, m_totalBytes, NS_LOG_DEBUG, and NS_TEST_EXPECT_MSG_EQ.
Referenced by SetupDefaultSim(), and SetupDefaultSim6().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Server Tx bytes.
Definition at line 156 of file tcp-test.cc.
Referenced by DoRun(), ServerHandleRecv(), and ServerHandleSend().
|
private |
Server Rx bytes.
Definition at line 157 of file tcp-test.cc.
Referenced by DoRun(), and ServerHandleSend().
|
private |
Client Rx bytes.
Definition at line 155 of file tcp-test.cc.
Referenced by DoRun(), and SourceHandleRecv().
|
private |
Client Tx bytes.
Definition at line 154 of file tcp-test.cc.
Referenced by DoRun(), and SourceHandleSend().
|
private |
Server data size when receiving.
Definition at line 153 of file tcp-test.cc.
Referenced by ServerHandleRecv().
|
private |
Server Rx payload.
Definition at line 160 of file tcp-test.cc.
Referenced by DoRun(), DoTeardown(), ServerHandleRecv(), and ServerHandleSend().
|
private |
Server data size when sending.
Definition at line 152 of file tcp-test.cc.
Referenced by ServerHandleSend().
|
private |
Client data size when receiving.
Definition at line 151 of file tcp-test.cc.
Referenced by SourceHandleRecv().
|
private |
Client Rx payload.
Definition at line 159 of file tcp-test.cc.
Referenced by DoRun(), DoTeardown(), and SourceHandleRecv().
|
private |
Client Tx payload.
Definition at line 158 of file tcp-test.cc.
Referenced by DoRun(), DoTeardown(), and SourceHandleSend().
|
private |
Client data size when sending.
Definition at line 150 of file tcp-test.cc.
Referenced by SourceHandleSend().
|
private |
Total stream size (in bytes).
Definition at line 149 of file tcp-test.cc.
Referenced by DoRun(), ServerHandleRecv(), ServerHandleSend(), SourceHandleRecv(), and SourceHandleSend().
|
private |