24 #include "ns3/tcp-tx-item.h"
26 #include "ns3/tcp-rate-ops.h"
28 #include "ns3/config.h"
30 #include "ns3/tcp-tx-buffer.h"
57 uint32_t testCase, std::string testName);
60 virtual void DoRun (
void);
87 uint32_t testCase, std::string testName)
103 for (uint8_t i = 0; i < 100; ++i)
109 for (uint8_t i = 0; i < 100; ++i)
115 Simulator::Destroy ();
117 for (uint8_t i = 0; i < 100; ++i)
133 if (isStartOfTransmission)
194 .AddConstructor<MimicCongControl> ()
195 .SetGroupName (
"Internet")
221 std::vector<uint32_t> &toDrop);
274 virtual void RateUpdatedTrace (
const TcpRateLinux::TcpRateConnection &rate);
294 std::vector<uint32_t> &toDrop)
296 m_sackEnabled (sackEnabled),
305 m_congCtl = CreateObject<MimicCongControl> ();
306 s->SetCongestionControlAlgorithm (
m_congCtl);
313 TcpGeneralTest::ConfigureEnvironment ();
325 for (std::vector<uint32_t>::iterator it =
m_toDrop.begin (); it !=
m_toDrop.end (); ++it)
349 && (h.
GetFlags () & TcpHeader::FIN) == 0)
392 if (sample.m_ackedSacked == 0)
424 virtual void DoRun (
void);
431 virtual void RateUpdatedTrace (
const TcpRateLinux::TcpRateConnection &rate);
453 std::string testString)
457 m_rateOps = CreateObject <TcpRateLinux> ();
469 Simulator::Destroy ();
499 for (uint8_t i = 0; i < 10; ++i)
508 for (uint8_t i = 1; i <= 2; ++i)
539 for (uint8_t i = 6; i <= 10; ++i)
569 std::vector<uint32_t> toDrop;
570 toDrop.push_back (4001);
576 toDrop.push_back (4001);
Behaves as NewReno except HasCongControl returns true.
static TypeId GetTypeId(void)
Get the type ID.
virtual bool HasCongControl() const
Returns true when Congestion Control Algorithm implements CongControl.
The TcpRateLinux Basic Test.
void SkbDelivered(TcpTxItem *skb)
Deliver an application packet.
uint32_t m_delivered
Number of segments delivered.
void SendSkb(TcpTxItem *skb)
Send an application packet.
uint32_t m_segmentSize
Segment size.
TcpRateLinux m_rateOps
Rate information for TCP.
std::vector< TcpTxItem * > m_skbs
Application packets.
Time m_deliveredTime
Last time of a delivery.
uint32_t m_testCase
Test case type.
uint32_t m_inFlight
Number of packets in-flight.
uint32_t m_cWnd
Congestion window size.
virtual void DoRun(void)
Implementation to actually run this TestCase.
TcpRateLinuxBasicTest(uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx, uint32_t testCase, std::string testName)
Constructor.
SequenceNumber32 m_tailSeq
Tail sequence number.
SequenceNumber32 m_nextTx
Tx next sequence number.
The TcpRateLinuxWithBufferTest tests rate sample functionality with arbitary SACK scenario.
uint32_t m_expectedAckedSacked
Amount of expected acked sacked data.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void TestWithStraightAcks()
Test with acks without drop.
TcpTxBuffer m_txBuf
Tcp Tx buffer.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
TcpRateLinuxWithBufferTest(uint32_t segmentSize, std::string desc)
Constructor.
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
void TestWithSackBlocks()
Test with arbitary SACK scenario.
Ptr< TcpRateOps > m_rateOps
Rate operations.
uint32_t m_expectedDelivered
Amount of expected delivered data.
uint32_t m_segmentSize
Segment size.
The TcpRateLinux Test uses sender-receiver model to test its functionality.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet is dropped.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Track the bytes in flight.
TcpRateLinuxWithSocketsTest(const std::string &desc, bool sackEnabled, std::vector< uint32_t > &toDrop)
Constructor.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create a receiver error model.
bool m_isDupAck
Whether ACK is DupAck.
SequenceNumber32 m_lastAckRecv
Last ACK received.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
TcpRateLinux::TcpRateSample m_prevRateSample
Previous rate sample.
std::vector< uint32_t > m_toDrop
List of SequenceNumber to drop.
void FinalChecks()
Do the final checks.
uint32_t m_bytesInFlight
Bytes inflight.
bool m_sackEnabled
Sack Variable.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Receive a packet.
TcpRateLinux::TcpRateConnection m_prevRate
Previous rate.
Ptr< MimicCongControl > m_congCtl
Dummy congestion control.
void ConfigureEnvironment()
Configure the test.
the TestSuite for the TcpRateLinux test case
AttributeValue implementation for Boolean.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
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.
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet > > cb)
Set the drop callback.
General infrastructure for TCP testing.
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.
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
The NewReno implementation.
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
Linux management and generation of Rate information for TCP.
virtual void SkbDelivered(TcpTxItem *skb) override
Update the Rate information after an item is received.
virtual void SkbSent(TcpTxItem *skb, bool isStartOfTransmission) override
Put the rate information inside the sent skb.
virtual void CalculateAppLimited(uint32_t cWnd, uint32_t in_flight, uint32_t segmentSize, const SequenceNumber32 &tailSeq, const SequenceNumber32 &nextTx, const uint32_t lostOut, const uint32_t retransOut) override
If a gap is detected between sends, it means we are app-limited.
virtual void SkbSent(TcpTxItem *skb, bool isStartOfTransmission)=0
Put the rate information inside the sent skb.
virtual const TcpRateSample & GenerateSample(uint32_t delivered, uint32_t lost, bool is_sack_reneg, uint32_t priorInFlight, const Time &minRtt)=0
Generate a TcpRateSample to feed a congestion avoidance algorithm.
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
void SetSegmentSize(uint32_t segmentSize)
Set the segment size.
void SetDupAckThresh(uint32_t dupAckThresh)
Set the DupAckThresh.
TcpTxItem * CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data from the range [seq, seq+numBytes) into a packet.
uint32_t Update(const TcpOptionSack::SackList &list, const Callback< void, TcpTxItem * > &sackedCb=m_nullCb)
Update the scoreboard.
uint32_t BytesInFlight() const
Return total bytes in flight.
void DiscardUpTo(const SequenceNumber32 &seq, const Callback< void, TcpTxItem * > &beforeDelCb=m_nullCb)
Discard data up to but not including this sequence number.
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.
Item that encloses the application packet and some flags for it.
RateInformation & GetRateInformation(void)
Get (to modify) the Rate Information of this item.
uint32_t GetSeqSize(void) const
Get the size in the sequence number space.
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void SetDefault(std::string name, const AttributeValue &value)
#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.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
#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.
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 TcpRateOpsTestSuite g_TcpRateOpsTestSuite
Static variable for test initialization.