23 #include "ns3/simple-channel.h"
24 #include "ns3/tcp-westwood-plus.h"
77 void FinalChecks()
override;
79 void ConfigureProperties()
override;
80 void ConfigureEnvironment()
override;
101 m_pktWasDropped(false),
102 m_seqToKill(seqToKill),
107 m_bytesRcvButNotAcked(0)
115 TcpGeneralTest::ConfigureProperties();
122 TcpGeneralTest::ConfigureEnvironment();
207 "Sequence number expected differs");
231 if (h.
GetFlags() == (TcpHeader::SYN | TcpHeader::ACK))
235 "SYN pkt has not 0 as initial sequence number."
236 "Probably, random sqn number has been implemented."
243 "ACK pkt has not 1 as sequence number."
244 "Probably, random sqn number has been implemented."
294 TcpSocketState::CA_OPEN,
295 "Not in OPEN state to respond to a loss");
298 "Dupack different than 0 but no loss detected");
307 TcpSocketState::CA_OPEN,
308 "Not in OPEN state for processing dupack");
314 TcpSocketState::CA_DISORDER,
315 "Not in DISORDER state after receiving dupacks");
320 TcpSocketState::CA_RECOVERY,
321 "Not in RECOVERY state after reaching retxthresh");
328 TcpSocketState::CA_OPEN,
329 "Receiver not in OPEN state");
348 "Count of dupAck differs");
353 TcpSocketState::CA_DISORDER,
354 "DupAck less than ReTxThreshold but not "
355 "in DISORDER state");
360 TcpSocketState::CA_RECOVERY,
361 "DupAck greater than ReTxThreshold but not "
362 "in RECOVERY or LOSS state");
376 TcpSocketState::CA_OPEN,
377 "Different state than OPEN in the receiver");
393 if (oldValue == TcpSocketState::CA_OPEN && newValue == TcpSocketState::CA_DISORDER)
396 else if (oldValue == TcpSocketState::CA_OPEN && newValue == TcpSocketState::CA_RECOVERY &&
401 else if (oldValue == TcpSocketState::CA_DISORDER && newValue == TcpSocketState::CA_RECOVERY)
405 "DISORDER to RECOVERY state change but not reached "
406 "the ReTxThreshold");
420 "Packet dropped but sequence number differs");
442 std::list<TypeId> types;
443 types.insert(types.begin(), TcpWestwoodPlus::GetTypeId());
444 types.insert(types.begin(), TcpNewReno::GetTypeId());
446 for (
auto it = types.begin(); it != types.end(); ++it)
Test the fast retransmission.
void ProcessedAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who) override
void ConfigureEnvironment() override
Change the configuration of the environment.
void CongStateTrace(const TcpSocketState::TcpCongState_t oldValue, const TcpSocketState::TcpCongState_t newValue) override
uint32_t m_seqToKill
Sequence number to drop.
Ptr< ErrorModel > CreateReceiverErrorModel() override
Create and return the error model to install in the receiver node.
SequenceNumber32 m_sndNextExpSeq
Sender next expected sequence number.
void ConfigureProperties() override
Change the configuration of the socket properties.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
bool m_pktDropped
The packet has been dropped.
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.
void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who) override
SequenceNumber32 m_rcvNextExpAck
Receiver next expected sequence number.
bool m_pktWasDropped
The packet was dropped (according to the receiver).
uint32_t m_bytesRcvButNotAcked
Number of bytes received but not acked.
Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node) override
Create and install the socket to install on the sender.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Check if the packet being dropped is the right one.
void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet received from IP layer.
void FinalChecks() override
Performs the (eventual) final checks through test asserts.
uint32_t m_dupAckReceived
DipACk received.
Ptr< ErrorModel > CreateSenderErrorModel() override
Create and return the error model to install in the sender node.
void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who) override
Testsuite for the fast retransmission.
uint32_t GetSize() 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.
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.
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, Args... > MakeCallback(R(T::*memPtr)(Args...), 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.