22 #include "ns3/simple-channel.h"
23 #include "ns3/rtt-estimator.h"
62 virtual void FinalChecks ();
63 virtual void ConfigureProperties ();
64 virtual void ConfigureEnvironment ();
73 m_afterRTOExpired (false),
74 m_segmentReceived (false)
82 TcpGeneralTest::ConfigureEnvironment ();
89 TcpGeneralTest::ConfigureProperties ();
111 "Second RTO expired");
113 "Ack state machine not in LOSS state after a loss");
131 "Ack state machine not in LOSS state after a loss");
136 "Ack state machine not in OPEN state after recovering "
149 "Ack state machine not in OPEN state after recovering "
166 "Retransmission has not been done");
197 virtual void SsThreshTrace (uint32_t oldValue, uint32_t newValue);
221 m_seqToDrop (seqToDrop),
222 m_minRtoTime (minRto)
230 TcpGeneralTest::ConfigureEnvironment ();
241 NS_LOG_DEBUG(
"TcpSsThreshRtoTest create sender socket");
253 for (uint32_t i = 0; i < 3; ++i)
310 "Slow Start Threshold is incorrect");
359 m_senderSentSegments (0),
368 TcpGeneralTest::ConfigureEnvironment ();
388 for (uint32_t i = 0; i < 7; ++i)
414 "SYN packet sent without respecting "
415 "ConnTimeout attribute");
422 "First packet was not correctly sent");
436 if (clockGranularity > rttEstimator->GetVariation () * 4)
448 "RTO value differs from calculation");
454 "RTO value has changed unexpectedly");
480 "RTO has not doubled after an expiration");
486 "RTO goes beyond 60 second limit");
501 "Socket has not been closed after retrying data retransmissions");
516 std::list<TypeId> types = {
517 TcpNewReno::GetTypeId (),
520 for (
const auto &t : types)
524 constexpr uint32_t seqToDrop = 25001;
529 t.GetName () +
" RTO ssthresh testing, set to 2*MSL"),
535 t.GetName () +
" RTO ssthresh testing, set to half of BytesInFlight"),
Testing the moments after an RTO expiration.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
TcpRtoTest(const TypeId &congControl, const std::string &msg)
Constructor.
bool m_segmentReceived
True if segments have been received.
bool m_afterRTOExpired
True if RTO is expired.
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
virtual void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
virtual void ProcessedAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
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.
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Time m_minRtoTime
the minimum RTO time
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
virtual void SsThreshTrace(uint32_t oldValue, uint32_t newValue)
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
virtual void ConfigureEnvironment()
Change the configuration of the environment.
virtual void BeforeRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
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.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
Testing the timing of RTO.
uint32_t m_senderSentSegments
Number of segments sent.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet has been dropped.
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Time m_previousRTO
Previous RTO.
bool m_closed
True if the connection is closed.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
TcpTimeRtoTest(const TypeId &congControl, const std::string &msg)
Constructor.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
virtual void ErrorClose(SocketWho who)
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.
AttributeValue implementation for Time.
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.
#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...
static TcpSocketState::TcpCongState_t GetCongStateFrom(Ptr< const TcpSocketState > tcb)
Convenience function to retrieve the ACK state from a TCB.
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, Ts... > MakeCallback(R(T::*memPtr)(Ts...), 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.