24 #include "ns3/rtt-estimator.h"
25 #include "ns3/simple-channel.h"
60 void FinalChecks()
override;
61 void ConfigureProperties()
override;
62 void ConfigureEnvironment()
override;
71 m_afterRTOExpired(false),
72 m_segmentReceived(false)
80 TcpGeneralTest::ConfigureEnvironment();
87 TcpGeneralTest::ConfigureProperties();
110 TcpSocketState::CA_LOSS,
111 "Ack state machine not in LOSS state after a loss");
128 TcpSocketState::CA_LOSS,
129 "Ack state machine not in LOSS state after a loss");
134 TcpSocketState::CA_OPEN,
135 "Ack state machine not in OPEN state after recovering "
147 TcpSocketState::CA_OPEN,
148 "Ack state machine not in OPEN state after recovering "
189 const std::string& msg);
195 void SsThreshTrace(uint32_t oldValue, uint32_t newValue)
override;
221 const std::string& desc)
223 m_seqToDrop(seqToDrop),
232 TcpGeneralTest::ConfigureEnvironment();
243 NS_LOG_DEBUG(
"TcpSsThreshRtoTest create sender socket");
255 for (uint32_t i = 0; i < 3; ++i)
356 m_senderSentSegments(0),
365 TcpGeneralTest::ConfigureEnvironment();
384 for (uint32_t i = 0; i < 7; ++i)
408 "Number of segments sent is different than 1");
413 "SYN packet sent without respecting "
414 "ConnTimeout attribute");
422 "First packet was not correctly sent");
436 if (clockGranularity > rttEstimator->GetVariation() * 4)
450 "RTO value differs from calculation");
458 "RTO value has changed unexpectedly");
485 "RTO has not doubled after an expiration");
505 "Socket has not been closed after retrying data retransmissions");
519 std::list<TypeId> types = {
520 TcpNewReno::GetTypeId(),
523 for (
const auto& t : types)
528 constexpr uint32_t seqToDrop = 25001;
534 t.GetName() +
" RTO ssthresh testing, set to 2*MSL"),
542 t.GetName() +
" RTO ssthresh testing, set to half of BytesInFlight"),
Testing the moments after an RTO expiration.
void ProcessedAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who) override
TcpRtoTest(const TypeId &congControl, const std::string &msg)
Constructor.
bool m_segmentReceived
True if segments have been received.
Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node) override
Create and install the socket to install on the sender.
void ConfigureProperties() override
Change the configuration of the socket properties.
bool m_afterRTOExpired
True if RTO is expired.
void FinalChecks() override
Performs the (eventual) final checks through test asserts.
void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who) override
void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who) override
void ConfigureEnvironment() override
Change the configuration of the environment.
Testing the ssthresh behavior after the RTO expires.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet has been dropped.
void ConfigureEnvironment() override
Change the configuration of the environment.
Time m_minRtoTime
the minimum RTO time
TcpSsThreshRtoTest(const TypeId &congControl, uint32_t seqToDrop, Time minRto, const std::string &msg)
Constructor.
uint32_t m_seqToDrop
the sequence number to drop
uint32_t m_ssThreshSocket
the ssThresh as computed by the socket
uint32_t m_bytesInFlight
Store the number of bytes in flight.
uint32_t m_bytesInFlightBeforeRto
Store the number of bytes in flight before the RTO expiration.
Ptr< ErrorModel > CreateReceiverErrorModel() override
Create and return the error model to install in the receiver node.
void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue) override
Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node) override
Create and install the socket to install on the sender.
void BeforeRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who) override
void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who) override
void SsThreshTrace(uint32_t oldValue, uint32_t newValue) override
Testing the timing of RTO.
uint32_t m_senderSentSegments
Number of segments sent.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet has been dropped.
Ptr< ErrorModel > CreateReceiverErrorModel() override
Create and return the error model to install in the receiver node.
Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node) override
Create and install the socket to install on the sender.
void FinalChecks() override
Performs the (eventual) final checks through test asserts.
Time m_previousRTO
Previous RTO.
void ErrorClose(SocketWho who) override
bool m_closed
True if the connection is closed.
void ConfigureEnvironment() override
Change the configuration of the environment.
TcpTimeRtoTest(const TypeId &congControl, const std::string &msg)
Constructor.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who) override
Smart pointer class similar to boost::intrusive_ptr.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet >> cb)
Set the drop callback.
General infrastructure for TCP testing.
Ptr< RttEstimator > GetRttEstimator(SocketWho who)
Get the Rtt estimator of the socket.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
Time GetMinRto(SocketWho who)
Get the minimum RTO attribute.
Time GetClockGranularity(SocketWho who)
Get the clock granularity attribute.
Time GetRto(SocketWho who)
Get the retransmission time.
Time GetConnTimeout(SocketWho who)
Get the retransmission time for the SYN segments.
void SetAppPktInterval(Time pktInterval)
Interval between app-generated packet.
TypeId m_congControlTypeId
Congestion control.
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssthresh.
Ptr< TcpSocketMsgBase > GetSenderSocket()
Get the pointer to a previously created sender socket.
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
Hold an unsigned integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static TcpRtoTestSuite g_TcpRtoTestSuite
Static variable for test initialization.