13#include "ns3/rtt-estimator.h"
14#include "ns3/simple-channel.h"
60 m_afterRTOExpired(false),
61 m_segmentReceived(false)
100 "Ack state machine not in LOSS state after a loss");
118 "Ack state machine not in LOSS state after a loss");
124 "Ack state machine not in OPEN state after recovering "
137 "Ack state machine not in OPEN state after recovering "
178 const std::string& msg);
210 const std::string& desc)
212 m_seqToDrop(seqToDrop),
232 NS_LOG_DEBUG(
"TcpSsThreshRtoTest create sender socket");
345 m_senderSentSegments(0),
397 "Number of segments sent is different than 1");
402 "SYN packet sent without respecting "
403 "ConnTimeout attribute");
411 "First packet was not correctly sent");
425 if (clockGranularity > rttEstimator->GetVariation() * 4)
439 "RTO value differs from calculation");
447 "RTO value has changed unexpectedly");
474 "RTO has not doubled after an expiration");
494 "Socket has not been closed after retrying data retransmissions");
508 std::list<TypeId> types = {
512 for (
const auto& t : types)
515 TestCase::Duration::QUICK);
517 constexpr uint32_t seqToDrop = 25001;
523 t.GetName() +
" RTO ssthresh testing, set to 2*MSL"),
524 TestCase::Duration::QUICK);
531 t.GetName() +
" RTO ssthresh testing, set to half of BytesInFlight"),
532 TestCase::Duration::QUICK);
535 TestCase::Duration::QUICK);
Testing the moments after an RTO expiration.
void ProcessedAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who) override
Processed ack.
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
Rto has expired.
void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who) override
Received ack.
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
Bytes in flight changes.
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
Rto has expired.
void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who) override
Rto has expired.
void SsThreshTrace(uint32_t oldValue, uint32_t newValue) override
Slow start threshold changes.
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
Socket closed with an error.
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
Rto has expired.
Smart pointer class similar to boost::intrusive_ptr.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
General infrastructure for TCP testing.
Ptr< RttEstimator > GetRttEstimator(SocketWho who)
Get the Rtt estimator of the socket.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
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.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
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.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
Ptr< TcpSocketMsgBase > GetSenderSocket()
Get the pointer to a previously created sender socket.
static TypeId GetTypeId()
Get the type ID.
@ CA_LOSS
CWND was reduced due to RTO timeout or SACK reneging.
@ CA_OPEN
Normal state, no dubious events.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
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.