A Discrete-Event Network Simulator
API
tcp-rate-ops-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2018 NITK Surathkal
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Vivek Jain <jain.vivek.anand@gmail.com>
19  * Viyom Mittal <viyommittal@gmail.com>
20  * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
21  */
22 
23 #include "ns3/test.h"
24 #include "ns3/tcp-tx-item.h"
25 #include "ns3/log.h"
26 #include "ns3/tcp-rate-ops.h"
27 #include "tcp-general-test.h"
28 #include "ns3/config.h"
29 #include "tcp-error-model.h"
30 #include "ns3/tcp-tx-buffer.h"
31 
32 using namespace ns3;
33 
34 NS_LOG_COMPONENT_DEFINE ("TcpRateOpsTestSuite");
35 
36 class MimicCongControl;
37 
45 {
46 public:
47  TcpRateLinuxBasicTest (uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx,
48  uint32_t lostOut, uint32_t retransOut, uint32_t testCase,
49  std::string testName);
50 
51 private:
52  virtual void DoRun (void);
53 
54  void SendSkb (TcpTxItem * skb);
55  void SkbDelivered (TcpTxItem * skb);
56 
58  uint32_t m_cWnd;
59  uint32_t m_inFlight;
60  uint32_t m_segmentSize;
61  uint32_t m_delivered;
65  uint32_t m_testCase;
66  std::vector <TcpTxItem *> m_skbs;
67 };
68 
70  SequenceNumber32 nextTx, uint32_t lostOut,
71  uint32_t retransOut, uint32_t testCase, std::string testName)
72  : TestCase (testName),
73  m_cWnd (cWnd),
74  m_inFlight (0),
75  m_segmentSize (1),
76  m_delivered (0),
77  m_deliveredTime (Seconds (0)),
78  m_tailSeq (tailSeq),
79  m_nextTx (nextTx),
80  m_testCase (testCase)
81 {
82 }
83 
84 void
86 {
87  for (uint8_t i = 0; i < 100; ++i)
88  {
89  m_skbs.push_back (new TcpTxItem ());
90  Simulator::Schedule (Time (Seconds (i * 0.01)), &TcpRateLinuxBasicTest::SendSkb, this, m_skbs [i]);
91  }
92 
93  for (uint8_t i = 0; i < 100; ++i)
94  {
95  Simulator::Schedule (Time (Seconds ((i + 1) * 0.1)), &TcpRateLinuxBasicTest::SkbDelivered, this, m_skbs [i]);
96  }
97 
98  Simulator::Run ();
99  Simulator::Destroy ();
100 
101  for (uint8_t i = 0; i < 100; ++i)
102  {
103  delete m_skbs[i];
104  }
105 }
106 
107 void
109 {
110  bool isStartOfTransmission = m_inFlight == 0;
112  m_rateOps.SkbSent (skb, isStartOfTransmission);
113  m_inFlight += skb->GetSeqSize ();
114 
115  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_delivered, m_delivered, "SKB should have delivered equal to current value of total delivered");
116 
117  if (isStartOfTransmission)
118  {
119  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_deliveredTime, Simulator::Now (), "SKB should have updated the delivered time to current value");
120  }
121  else
122  {
123  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_deliveredTime, m_deliveredTime, "SKB should have updated the delivered time to current value");
124  }
125 }
126 
127 void
129 {
130  m_rateOps.SkbDelivered (skb);
131  m_inFlight -= skb->GetSeqSize ();
132  m_delivered += skb->GetSeqSize ();
134 
135  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_deliveredTime, Time::Max (), "SKB should have delivered time as Time::Max ()");
136 
137  if (m_testCase == 1)
138  {
139  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_isAppLimited, false, "Socket should not be applimited");
140  }
141  else if (m_testCase == 2)
142  {
143  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_isAppLimited, true, "Socket should be applimited");
144  }
145 }
146 
154 {
155 public:
160  static TypeId GetTypeId (void);
161 
163  {
164  }
165 
166  virtual bool HasCongControl () const
167  {
168  return true;
169  }
170 
171 };
172 
173 TypeId
175 {
176  static TypeId tid = TypeId ("ns3::MimicCongControl")
177  .SetParent<TcpNewReno> ()
178  .AddConstructor<MimicCongControl> ()
179  .SetGroupName ("Internet")
180  ;
181  return tid;
182 }
183 
196 {
197 public:
204  TcpRateLinuxWithSocketsTest (const std::string &desc, bool sackEnabled,
205  std::vector<uint32_t> &toDrop);
206 
207 protected:
214 
220 
227  virtual void Rx (const Ptr<const Packet> p, const TcpHeader&h, SocketWho who);
228 
234  virtual void BytesInFlightTrace (uint32_t oldValue, uint32_t newValue);
235 
242  void PktDropped (const Ipv4Header &ipH, const TcpHeader& tcpH, Ptr<const Packet> p);
243 
247  void ConfigureEnvironment ();
248 
252  void FinalChecks ();
253 
258  virtual void RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate);
259 
264  virtual void RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample);
265 
266 private:
269  std::vector<uint32_t> m_toDrop;
270  uint32_t m_bytesInFlight {0};
272  bool m_isDupAck;
273  TcpRateLinux::TcpRateConnection m_prevRate;
274  TcpRateLinux::TcpRateSample m_prevRateSample;
275 };
276 
277 TcpRateLinuxWithSocketsTest::TcpRateLinuxWithSocketsTest (const std::string &desc, bool sackEnabled,
278  std::vector<uint32_t> &toDrop)
279  : TcpGeneralTest (desc),
280  m_sackEnabled (sackEnabled),
281  m_toDrop (toDrop)
282 {
283 }
284 
287 {
288  Ptr<TcpSocketMsgBase> s = TcpGeneralTest::CreateSenderSocket (node);
289  m_congCtl = CreateObject<MimicCongControl> ();
291  return s;
292 }
293 
294 void
296 {
297  TcpGeneralTest::ConfigureEnvironment ();
298  SetAppPktCount (300);
300  SetTransmitStart (Seconds (2.0));
301 
302  Config::SetDefault ("ns3::TcpSocketBase::Sack", BooleanValue (m_sackEnabled));
303 }
304 
307 {
308  Ptr<TcpSeqErrorModel> m_errorModel = CreateObject<TcpSeqErrorModel> ();
309  for (std::vector<uint32_t>::iterator it = m_toDrop.begin (); it != m_toDrop.end (); ++it)
310  {
311  m_errorModel->AddSeqToKill (SequenceNumber32 (*it));
312  }
313 
315 
316  return m_errorModel;
317 }
318 
319 void
322 {
323  NS_LOG_DEBUG ("Drop seq= " << tcpH.GetSequenceNumber () << " size " << p->GetSize ());
324 }
325 
326 void
328 {
329  if (who == SENDER)
330  {
331  if (h.GetAckNumber () == m_lastAckRecv
333  && (h.GetFlags () & TcpHeader::FIN) == 0)
334  {
335  m_isDupAck = true;
336  }
337  else
338  {
339  m_isDupAck = false;
341  }
342  }
343 }
344 
345 void
346 TcpRateLinuxWithSocketsTest::BytesInFlightTrace (uint32_t oldValue, uint32_t newValue)
347 {
348  NS_UNUSED (oldValue);
349  m_bytesInFlight = newValue;
350 }
351 
352 void
353 TcpRateLinuxWithSocketsTest::RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate)
354 {
355  NS_LOG_DEBUG ("Rate updated " << rate);
356  if (m_bytesInFlight == 0)
357  {
358  NS_TEST_ASSERT_MSG_EQ (rate.m_firstSentTime, Simulator::Now (), "FirstSentTime should be current time when bytes inflight is zero");
359  NS_TEST_ASSERT_MSG_EQ (rate.m_deliveredTime, Simulator::Now (), "Delivered time should be current time when bytes inflight is zero");
360  }
361  NS_TEST_ASSERT_MSG_GT_OR_EQ (rate.m_delivered, m_prevRate.m_delivered, "Total delivered should not be lesser than previous values");
362  m_prevRate = rate;
363 }
364 
365 void
366 TcpRateLinuxWithSocketsTest::RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample)
367 {
368  NS_LOG_DEBUG ("Rate sample updated " << sample);
369  if (m_isDupAck)
370  {
371  if (!m_sackEnabled)
372  {
373  NS_TEST_ASSERT_MSG_EQ (m_prevRateSample, sample, "RateSample should not update due to DupAcks");
374  }
375  else
376  {
377  if (sample.m_ackedSacked == 0)
378  {
379  NS_TEST_ASSERT_MSG_EQ (m_prevRateSample, sample, "RateSample should not update as nothing is acked or sacked");
380  }
381  }
382  }
383  m_prevRateSample = sample;
384 }
385 
386 void
388 {
389 }
390 
399 {
400 public:
406  TcpRateLinuxWithBufferTest (uint32_t segmentSize, std::string desc);
407 
408 private:
409  virtual void DoRun (void);
410  virtual void DoTeardown (void);
411 
416  virtual void RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate);
417 
422  virtual void RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample);
423 
425  void TestWithStraightAcks ();
426 
428  void TestWithSackBlocks ();
429 
430  uint32_t m_expectedDelivered {0};
431  uint32_t m_expectedAckedSacked {0};
432  uint32_t m_segmentSize;
435 };
436 
438  std::string testString)
439  : TestCase (testString),
440  m_segmentSize (segmentSize)
441 {
442  m_rateOps = CreateObject <TcpRateLinux> ();
443  m_rateOps->TraceConnectWithoutContext ("TcpRateUpdated",
445  m_rateOps->TraceConnectWithoutContext ("TcpRateSampleUpdated",
447 }
448 
449 void
451 {
452  Simulator::Schedule (Seconds (0.0), &TcpRateLinuxWithBufferTest::TestWithSackBlocks, this);
453  Simulator::Run ();
454  Simulator::Destroy ();
455 }
456 
457 void
458 TcpRateLinuxWithBufferTest::RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate)
459 {
460  NS_LOG_DEBUG ("Rate updated " << rate);
461  NS_TEST_ASSERT_MSG_EQ (rate.m_delivered, m_expectedDelivered, "Delivered data is not equal to expected delivered");
462 }
463 
464 void
465 TcpRateLinuxWithBufferTest::RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample)
466 {
467  NS_LOG_DEBUG ("Rate sample updated " << sample);
468  NS_TEST_ASSERT_MSG_EQ (sample.m_ackedSacked, m_expectedAckedSacked, "AckedSacked bytes is not equal to expected AckedSacked bytes");
469 }
470 
471 void
473 {
474  SequenceNumber32 head (1);
475  m_txBuf.SetHeadSequence (head);
476  SequenceNumber32 ret;
477  Ptr<TcpOptionSack> sack = CreateObject<TcpOptionSack> ();
480 
481  m_txBuf.Add (Create<Packet> (10 * m_segmentSize));
482 
483  // Send 10 Segments
484  for (uint8_t i = 0; i < 10; ++i)
485  {
486  bool isStartOfTransmission = m_txBuf.BytesInFlight () == 0;
488  m_rateOps->SkbSent (outItem, isStartOfTransmission);
489  }
490 
491  uint32_t priorInFlight = m_txBuf.BytesInFlight ();
492  // ACK 2 Segments
493  for (uint8_t i = 1; i <= 2; ++i)
494  {
495  priorInFlight = m_txBuf.BytesInFlight ();
497  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * i + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
499  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
500  }
501 
502  priorInFlight = m_txBuf.BytesInFlight ();
505  m_txBuf.Update (sack->GetSackList (), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
507  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
508 
509  priorInFlight = m_txBuf.BytesInFlight ();
512  m_txBuf.Update (sack->GetSackList (), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
513  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
514 
515  priorInFlight = m_txBuf.BytesInFlight ();
516  // Actual delivered should be increased by one segment even multiple blocks are acked.
518  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * 5 + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
519  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
520 
521 
522  priorInFlight = m_txBuf.BytesInFlight ();
523  // ACK rest of the segments
524  for (uint8_t i = 6; i <= 10; ++i)
525  {
527  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * i + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
528  }
530  TcpRateOps::TcpRateSample rateSample = m_rateOps->GenerateSample (5 * m_segmentSize, 0, false, priorInFlight, Seconds (0));
531 }
532 
533 void
535 {
536 }
537 
538 
546 {
547 public:
549  : TestSuite ("tcp-rate-ops", UNIT)
550  {
551  AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (20), SequenceNumber32 (11), 1, 0, 0, "Testing SkbDelivered and SkbSent"), TestCase::QUICK);
552  AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (11), SequenceNumber32 (11), 2, 0, 0, "Testing SkbDelivered and SkbSent with app limited data"), TestCase::QUICK);
553 
554  std::vector<uint32_t> toDrop;
555  toDrop.push_back (4001);
556  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value without SACK, one drop", false, toDrop),
557  TestCase::QUICK);
558 
559  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value with SACK, one drop", true, toDrop),
560  TestCase::QUICK);
561  toDrop.push_back (4001);
562  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value without SACK, two drop", false, toDrop),
563  TestCase::QUICK);
564 
565  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value with SACK, two drop", true, toDrop),
566  TestCase::QUICK);
567 
568  AddTestCase (new TcpRateLinuxWithBufferTest (1000, "Checking rate sample values with arbitary SACK Block"), TestCase::QUICK);
569 
570  AddTestCase (new TcpRateLinuxWithBufferTest (500, "Checking rate sample values with arbitary SACK Block"), TestCase::QUICK);
571 
572  }
573 };
574 
void SetCongestionControlAlgorithm(Ptr< TcpCongestionOps > algo)
Install a congestion control algorithm on this socket.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Receive a packet.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
std::vector< TcpTxItem * > m_skbs
Ptr< TcpRateOps > m_rateOps
Rate operations.
SequenceNumber32 m_nextTx
TcpRateLinuxWithBufferTest(uint32_t segmentSize, std::string desc)
Constructor.
AttributeValue implementation for Boolean.
Definition: boolean.h:36
uint32_t m_segmentSize
Segment size.
uint32_t m_bytesInFlight
Bytes inflight.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet is dropped.
uint32_t m_expectedAckedSacked
Amount of expected acked sacked data.
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet > > cb)
Set the drop callback.
A suite of tests to run.
Definition: test.h:1341
uint32_t m_expectedDelivered
Amount of expected delivered data.
void TestWithStraightAcks()
Test with acks without drop.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1072
Linux management and generation of Rate information for TCP.
Definition: tcp-rate-ops.h:179
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
uint32_t GetSeqSize(void) const
Get the size in the sequence number space.
Definition: tcp-tx-item.cc:62
encapsulates test code
Definition: test.h:1153
The NewReno implementation.
void AddSackBlock(SackBlock s)
Add a SACK block.
SequenceNumber32 GetAckNumber() const
Get the ACK number.
Definition: tcp-header.cc:149
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Packet header for IPv4.
Definition: ipv4-header.h:33
Item that encloses the application packet and some flags for it.
Definition: tcp-tx-item.h:32
Rate Sample structure.
Definition: tcp-rate-ops.h:132
SequenceNumber32 m_tailSeq
static TypeId GetTypeId(void)
Get the type ID.
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Track the bytes in flight.
uint64_t m_delivered
Connection&#39;s delivered data at the time the packet was sent.
Definition: tcp-tx-item.h:88
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
void FinalChecks()
Do the final checks.
bool m_isAppLimited
Connection&#39;s app limited at the time the packet was sent.
Definition: tcp-tx-item.h:91
virtual bool HasCongControl() const
Returns true when Congestion Control Algorithm implements CongControl.
#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.
Definition: test.h:166
void DiscardUpTo(const SequenceNumber32 &seq, const Callback< void, TcpTxItem *> &beforeDelCb=m_nullCb)
Discard data up to but not including this sequence number.
RateInformation & GetRateInformation(void)
Get (to modify) the Rate Information of this item.
Definition: tcp-tx-item.cc:98
void ConfigureEnvironment()
Configure the test.
#define Max(a, b)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1610
static TcpRateOpsTestSuite g_TcpRateOpsTestSuite
Static variable for test initialization.
TcpTxItem * CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data from the range [seq, seq+numBytes) into a packet.
Tcp sender buffer.
Ptr< MimicCongControl > m_congCtl
Dummy congestion control.
void TestWithSackBlocks()
Test with arbitary SACK scenario.
bool m_sackEnabled
Sack Variable.
Behaves as NewReno except HasCongControl returns true.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:295
void SendSkb(TcpTxItem *skb)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:44
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 Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
TcpRateLinuxBasicTest(uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx, uint32_t lostOut, uint32_t retransOut, uint32_t testCase, std::string testName)
TcpTxBuffer m_txBuf
Tcp Tx buffer.
void SetDupAckThresh(uint32_t dupAckThresh)
Set the DupAckThresh.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
the TestSuite for the TcpRateLinux test case
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
TcpRateLinux::TcpRateSample m_prevRateSample
Previous rate sample.
SequenceNumber32 m_lastAckRecv
Last ACK received.
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
void SetSegmentSize(uint32_t segmentSize)
Set the segment size.
General infrastructure for TCP testing.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
uint8_t GetFlags() const
Get the flags.
Definition: tcp-header.cc:173
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) override
Put the rate information inside the sent skb.
uint32_t Update(const TcpOptionSack::SackList &list, const Callback< void, TcpTxItem *> &sackedCb=m_nullCb)
Update the scoreboard.
The TcpRateLinux Test uses sender-receiver model to test its functionality.
Time m_deliveredTime
Connection&#39;s delivered time at the time the packet was sent.
Definition: tcp-tx-item.h:89
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1064
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:812
The TcpRateLinux Basic Test.
virtual void DoRun(void)
Implementation to actually run this TestCase.
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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void SkbDelivered(TcpTxItem *skb) override
Update the Rate information after an item is received.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:309
SequenceNumber32 GetSequenceNumber() const
Get the sequence number.
Definition: tcp-header.cc:143
TcpRateLinux::TcpRateConnection m_prevRate
Previous rate.
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create a receiver error model.
This test suite implements a Unit Test.
Definition: test.h:1351
#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...
Definition: test.h:1016
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
bool m_isDupAck
Whether ACK is DupAck.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
The TcpRateLinuxWithBufferTest tests rate sample functionality with arbitary SACK scenario...
TcpRateLinuxWithSocketsTest(const std::string &desc, bool sackEnabled, std::vector< uint32_t > &toDrop)
Constructor.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
uint32_t BytesInFlight() const
Return total bytes in flight.
virtual void SkbSent(TcpTxItem *skb, bool isStartOfTransmission)=0
Put the rate information inside the sent skb.
void SkbDelivered(TcpTxItem *skb)
SackList GetSackList(void) const
Get the SACK list.
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.
std::vector< uint32_t > m_toDrop
List of SequenceNumber to drop.