20 #include "ns3/tcp-westwood.h"
22 #include "ns3/simple-channel.h"
78 virtual void FinalChecks ();
80 virtual void ConfigureProperties ();
81 virtual void ConfigureEnvironment ();
100 const std::string &msg)
102 m_pktDropped (false),
103 m_pktWasDropped (false),
104 m_seqToKill (seqToKill),
105 m_dupAckReceived (0),
109 m_bytesRcvButNotAcked (0)
117 TcpGeneralTest::ConfigureProperties ();
124 TcpGeneralTest::ConfigureEnvironment ();
197 "Segment retransmitted too many times");
210 "Sequence number expected differs");
234 if (h.
GetFlags () == (TcpHeader::SYN | TcpHeader::ACK))
237 "SYN pkt has not 0 as initial sequence number."
238 "Probably, random sqn number has been implemented."
244 "ACK pkt has not 1 as sequence number."
245 "Probably, random sqn number has been implemented."
261 "ACKing something not considered");
297 "Not in OPEN state to respond to a loss");
299 "Dupack different than 0 but no loss detected");
304 "Dupack count differs");
310 "Not in OPEN state for processing dupack");
316 "Not in DISORDER state after receiving dupacks");
321 "Not in RECOVERY state after reaching retxthresh");
328 "Receiver not in OPEN state");
345 "Count of dupAck differs");
350 "DupAck less than ReTxThreshold but not "
351 "in DISORDER state");
356 "DupAck greater than ReTxThreshold but not "
357 "in RECOVERY or LOSS state");
371 "Different state than OPEN in the receiver");
387 if (oldValue == TcpSocketState::CA_OPEN && newValue == TcpSocketState::CA_DISORDER)
390 else if (oldValue == TcpSocketState::CA_OPEN
391 && newValue == TcpSocketState::CA_RECOVERY
395 "Invalid OPEN to RECOVERY state change");
397 else if (oldValue == TcpSocketState::CA_DISORDER
398 && newValue == TcpSocketState::CA_RECOVERY)
401 "DISORDER to RECOVERY state change but not reached "
402 "the ReTxThreshold");
416 "Packet dropped but sequence number differs");
423 "Packet was not dropped at all");
425 "Segment was not retransmitted at all");
427 "Not all data have been transmitted");
442 std::list<TypeId> types;
443 types.insert (types.begin (), TcpWestwood::GetTypeId ());
444 types.insert (types.begin (), TcpNewReno::GetTypeId ());
446 for (std::list<TypeId>::iterator it = types.begin (); it != types.end (); ++it)
Test the fast retransmission.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
virtual void ProcessedAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
uint32_t m_seqToKill
Sequence number to drop.
SequenceNumber32 m_sndNextExpSeq
Sender next expected sequence number.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
virtual void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
bool m_pktDropped
The packet has been dropped.
virtual void CongStateTrace(const TcpSocketState::TcpCongState_t oldValue, const TcpSocketState::TcpCongState_t newValue)
SequenceNumber32 m_previousAck
Previous ACK received.
Ptr< TcpSeqErrorModel > m_errorModel
Error model.
uint32_t m_countRetr
Retry counter.
TcpFastRetrTest(TypeId congControl, uint32_t seqToKill, const std::string &msg)
Constructor.
SequenceNumber32 m_rcvNextExpAck
Receiver next expected sequence number.
bool m_pktWasDropped
The packet was dropped (according to the receiver).
virtual Ptr< ErrorModel > CreateSenderErrorModel()
Create and return the error model to install in the sender node.
uint32_t m_bytesRcvButNotAcked
Number of bytes received but not acked.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Check if the packet being dropped is the right one.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
uint32_t m_dupAckReceived
DipACk received.
Testsuite for the fast retransmission.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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.
uint32_t GetDelAckCount(SocketWho who)
Get the number of delayed ack (if present)
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.
uint32_t GetReTxThreshold(SocketWho who)
Get the retransmission threshold.
uint32_t GetDupAckCount(SocketWho who)
Get the number of dupack received.
uint32_t GetSegSize(SocketWho who)
Get the segment size of the node specified.
TypeId m_congControlTypeId
Congestion control.
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssthresh.
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
TcpCongState_t
Definition of the Congestion state machine.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
AttributeValue implementation for Time.
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
static TcpSocketState::TcpCongState_t GetCongStateFrom(Ptr< const TcpSocketState > tcb)
Convenience function to retrieve the ACK state from a TCB.
Time Seconds(double 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 TcpFastRetrTestSuite g_TcpFastRetrTestSuite
Static variable for test initialization.