22 #include "ns3/tcp-westwood.h"
23 #include "ns3/simple-channel.h"
24 #include "ns3/rtt-estimator.h"
63 virtual void FinalChecks ();
64 virtual void ConfigureProperties ();
65 virtual void ConfigureEnvironment ();
74 m_afterRTOExpired (false),
75 m_segmentReceived (false)
83 TcpGeneralTest::ConfigureEnvironment ();
90 TcpGeneralTest::ConfigureProperties ();
112 "Second RTO expired");
114 "Ack state machine not in LOSS state after a loss");
132 "Ack state machine not in LOSS state after a loss");
137 "Ack state machine not in OPEN state after recovering "
150 "Ack state machine not in OPEN state after recovering "
167 "Retransmission has not been done");
198 virtual void SsThreshTrace (uint32_t oldValue, uint32_t newValue);
222 m_seqToDrop (seqToDrop),
223 m_minRtoTime (minRto)
231 TcpGeneralTest::ConfigureEnvironment ();
242 NS_LOG_DEBUG(
"TcpSsThreshRtoTest create sender socket");
254 for (uint32_t i = 0; i<3; ++i)
311 "Slow Start Threshold is incorrect");
360 m_senderSentSegments (0),
369 TcpGeneralTest::ConfigureEnvironment ();
389 for (uint32_t i = 0; i<7; ++i)
415 "SYN packet sent without respecting "
416 "ConnTimeout attribute");
423 "First packet has been correctly sent");
437 if (clockGranularity > rttEstimator->GetVariation ()*4)
449 "RTO value differs from calculation");
455 "RTO value has changed unexpectedly");
482 "RTO has not doubled after an expiration");
488 "RTO goes beyond 60 second limit");
503 "Socket has not been closed after retrying data retransmissions");
518 std::list<TypeId> types;
519 types.insert (types.begin (), TcpNewReno::GetTypeId ());
520 types.insert (types.begin (), TcpWestwood::GetTypeId ());
522 for (std::list<TypeId>::iterator it = types.begin (); it != types.end (); ++it)
525 uint32_t seqToDrop = 25001;
531 AddTestCase (
new TcpSsThreshRtoTest ((*it), seqToDrop, minRto, (*it).GetName () +
" RTO ssthresh testing, set to half of BytesInFlight"), TestCase::QUICK);
Testing the moments after an RTO expiration.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
bool m_segmentReceived
True if segments have been received.
bool m_afterRTOExpired
True if RTO is expired.
TcpRtoTest(TypeId &congControl, const std::string &msg)
Constructor.
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
virtual void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
Received ack.
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)
Processed ack.
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)
Bytes in flight changes.
Time m_minRtoTime
the minimum RTO time
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
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)
Slow start threshold changes.
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)
Rto has expired.
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.
TcpSsThreshRtoTest(TypeId &congControl, uint32_t seqToDrop, Time minRto, const std::string &msg)
Constructor.
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)
Rto has expired.
Time m_previousRTO
Previous RTO.
bool m_closed
True if the connection is closed.
TcpTimeRtoTest(TypeId &congControl, const std::string &msg)
Constructor.
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.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
virtual void ErrorClose(SocketWho who)
Socket closed with an error.
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_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#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.