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");
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);
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
virtual void ErrorClose(SocketWho who)
Socket closed with an error.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void ConfigureEnvironment()
Change the configuration of the environment.
uint32_t m_seqToDrop
the sequence number to drop
TcpSsThreshRtoTest(TypeId &congControl, uint32_t seqToDrop, Time minRto, const std::string &msg)
Constructor.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
Ptr< TcpSocketMsgBase > GetSenderSocket()
Get the pointer to a previously created sender socket.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet has been dropped.
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet > > cb)
Set the drop callback.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
#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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time GetEstimate(void) const
gets the RTT estimate.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet has been dropped.
static TcpSocketState::TcpCongState_t GetCongStateFrom(Ptr< const TcpSocketState > tcb)
Convenience function to retrieve the ACK state from a TCB.
uint32_t m_segmentSize
Segment size.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time GetMinRto(SocketWho who)
Get the minimum RTO attribute.
static TcpRtoTestSuite g_TcpRtoTestSuite
Static variable for test initialization.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Bytes in flight changes.
AttributeValue implementation for Time.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Hold an unsigned integer type.
#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.
bool m_segmentReceived
True if segments have been received.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssth.
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
#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...
Testing the ssthresh behavior after the RTO expires.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetClockGranularity(SocketWho who)
Get the clock granularity attribute.
virtual void BeforeRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
uint32_t m_ssThreshSocket
the ssThresh as computed by the socket
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
bool m_closed
True if the connection is closed.
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
Time GetVariation(void) const
Note that this is not a formal statistical variance; it has the the same units as the estimate...
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
void SetAppPktInterval(Time pktInterval)
Interval between app-generated packet.
TcpTimeRtoTest(TypeId &congControl, const std::string &msg)
Constructor.
Time m_minRtoTime
the minimum RTO time
Testing the moments after an RTO expiration.
uint32_t m_bytesInFlight
Store the number of bytes in flight.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
Time m_previousRTO
Previous RTO.
uint32_t m_senderSentSegments
Number of segments sent.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
General infrastructure for TCP testing.
bool m_afterRTOExpired
True if RTO is expired.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual void SsThreshTrace(uint32_t oldValue, uint32_t newValue)
Slow start threshold changes.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time GetConnTimeout(SocketWho who)
Get the retransmission time for the SYN segments.
This test suite implements a Unit Test.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Testing the timing of RTO.
uint32_t m_bytesInFlightBeforeRto
Store the number of bytes in flight before the RTO expiration.
TcpRtoTest(TypeId &congControl, const std::string &msg)
Constructor.
Ptr< RttEstimator > GetRttEstimator(SocketWho who)
Get the Rtt estimator of the socket.
a unique identifier for an interface.
virtual void ProcessedAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
Processed ack.
virtual void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
Received ack.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
TypeId m_congControlTypeId
Congestion control.
Time GetRto(SocketWho who)
Get the retransmission time.