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)
uint32_t GetReTxThreshold(SocketWho who)
Get the retransmission threshold.
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 "...
uint32_t m_bytesRcvButNotAcked
Number of bytes received but not acked.
Test the fast retransmission.
SequenceNumber32 m_previousAck
Previous ACK 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).
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet > > cb)
Set the drop callback.
bool m_pktWasDropped
The packet was dropped (according to the receiver).
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Check if the packet being dropped is the right one.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_countRetr
Retry counter.
static TcpSocketState::TcpCongState_t GetCongStateFrom(Ptr< const TcpSocketState > tcb)
Convenience function to retrieve the ACK state from a TCB.
TcpFastRetrTest(TypeId congControl, uint32_t seqToKill, const std::string &msg)
Constructor.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
uint32_t m_seqToKill
Sequence number to drop.
uint32_t GetDelAckCount(SocketWho who)
Get the number of delayed ack (if present)
Ptr< TcpSeqErrorModel > m_errorModel
Error model.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
virtual void CongStateTrace(const TcpSocketState::TcpCongState_t oldValue, const TcpSocketState::TcpCongState_t newValue)
State on Ack state machine changes.
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)
Processed ack.
AttributeValue implementation for Time.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
SequenceNumber32 m_sndNextExpSeq
Sender next expected sequence number.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
#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.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssth.
TcpCongState_t
Definition of the Congestion state machine.
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Generic "sequence number" class.
uint32_t GetSegSize(SocketWho who)
Get the segment size of the node specified.
uint32_t GetDupAckCount(SocketWho who)
Get the number of dupack received.
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
bool m_pktDropped
The packet has been dropped.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
virtual Ptr< ErrorModel > CreateSenderErrorModel()
Create and return the error model to install in the sender node.
General infrastructure for TCP testing.
uint32_t m_dupAckReceived
DipACk received.
SequenceNumber32 m_rcvNextExpAck
Receiver next expected sequence number.
Time Seconds(double value)
Construct a Time in the indicated unit.
This test suite implements a Unit Test.
virtual void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
Received ack.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
#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...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
a unique identifier for an interface.
static TcpFastRetrTestSuite g_TcpFastRetrTestSuite
Static variable for test initialization.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
TypeId m_congControlTypeId
Congestion control.