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 
56  TcpRateLinuxBasicTest (uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx,
57  uint32_t testCase, std::string testName);
58 
59 private:
60  virtual void DoRun (void);
61 
66  void SendSkb (TcpTxItem * skb);
71  void SkbDelivered (TcpTxItem * skb);
72 
74  uint32_t m_cWnd;
75  uint32_t m_inFlight;
76  uint32_t m_segmentSize;
77  uint32_t m_delivered;
81  uint32_t m_testCase;
82  std::vector <TcpTxItem *> m_skbs;
83 };
84 
86  SequenceNumber32 nextTx,
87  uint32_t testCase, std::string testName)
88  : TestCase (testName),
89  m_cWnd (cWnd),
90  m_inFlight (0),
91  m_segmentSize (1),
92  m_delivered (0),
93  m_deliveredTime (Seconds (0)),
94  m_tailSeq (tailSeq),
95  m_nextTx (nextTx),
96  m_testCase (testCase)
97 {
98 }
99 
100 void
102 {
103  for (uint8_t i = 0; i < 100; ++i)
104  {
105  m_skbs.push_back (new TcpTxItem ());
106  Simulator::Schedule (Time (Seconds (i * 0.01)), &TcpRateLinuxBasicTest::SendSkb, this, m_skbs [i]);
107  }
108 
109  for (uint8_t i = 0; i < 100; ++i)
110  {
111  Simulator::Schedule (Time (Seconds ((i + 1) * 0.1)), &TcpRateLinuxBasicTest::SkbDelivered, this, m_skbs [i]);
112  }
113 
114  Simulator::Run ();
115  Simulator::Destroy ();
116 
117  for (uint8_t i = 0; i < 100; ++i)
118  {
119  delete m_skbs[i];
120  }
121 }
122 
123 void
125 {
126  bool isStartOfTransmission = m_inFlight == 0;
128  m_rateOps.SkbSent (skb, isStartOfTransmission);
129  m_inFlight += skb->GetSeqSize ();
130 
131  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_delivered, m_delivered, "SKB should have delivered equal to current value of total delivered");
132 
133  if (isStartOfTransmission)
134  {
135  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_deliveredTime, Simulator::Now (), "SKB should have updated the delivered time to current value");
136  }
137  else
138  {
139  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_deliveredTime, m_deliveredTime, "SKB should have updated the delivered time to current value");
140  }
141 }
142 
143 void
145 {
146  m_rateOps.SkbDelivered (skb);
147  m_inFlight -= skb->GetSeqSize ();
148  m_delivered += skb->GetSeqSize ();
150 
151  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_deliveredTime, Time::Max (), "SKB should have delivered time as Time::Max ()");
152 
153  if (m_testCase == 1)
154  {
155  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_isAppLimited, false, "Socket should not be applimited");
156  }
157  else if (m_testCase == 2)
158  {
159  NS_TEST_ASSERT_MSG_EQ (skb->GetRateInformation ().m_isAppLimited, true, "Socket should be applimited");
160  }
161 }
162 
170 {
171 public:
176  static TypeId GetTypeId (void);
177 
179  {
180  }
181 
182  virtual bool HasCongControl () const
183  {
184  return true;
185  }
186 
187 };
188 
189 TypeId
191 {
192  static TypeId tid = TypeId ("ns3::MimicCongControl")
193  .SetParent<TcpNewReno> ()
194  .AddConstructor<MimicCongControl> ()
195  .SetGroupName ("Internet")
196  ;
197  return tid;
198 }
199 
212 {
213 public:
220  TcpRateLinuxWithSocketsTest (const std::string &desc, bool sackEnabled,
221  std::vector<uint32_t> &toDrop);
222 
223 protected:
230 
236 
243  virtual void Rx (const Ptr<const Packet> p, const TcpHeader&h, SocketWho who);
244 
250  virtual void BytesInFlightTrace (uint32_t oldValue, uint32_t newValue);
251 
258  void PktDropped (const Ipv4Header &ipH, const TcpHeader& tcpH, Ptr<const Packet> p);
259 
263  void ConfigureEnvironment ();
264 
268  void FinalChecks ();
269 
274  virtual void RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate);
275 
280  virtual void RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample);
281 
282 private:
285  std::vector<uint32_t> m_toDrop;
286  uint32_t m_bytesInFlight {0};
288  bool m_isDupAck;
289  TcpRateLinux::TcpRateConnection m_prevRate;
290  TcpRateLinux::TcpRateSample m_prevRateSample;
291 };
292 
293 TcpRateLinuxWithSocketsTest::TcpRateLinuxWithSocketsTest (const std::string &desc, bool sackEnabled,
294  std::vector<uint32_t> &toDrop)
295  : TcpGeneralTest (desc),
296  m_sackEnabled (sackEnabled),
297  m_toDrop (toDrop)
298 {
299 }
300 
303 {
304  Ptr<TcpSocketMsgBase> s = TcpGeneralTest::CreateSenderSocket (node);
305  m_congCtl = CreateObject<MimicCongControl> ();
307  return s;
308 }
309 
310 void
312 {
313  TcpGeneralTest::ConfigureEnvironment ();
314  SetAppPktCount (300);
316  SetTransmitStart (Seconds (2.0));
317 
318  Config::SetDefault ("ns3::TcpSocketBase::Sack", BooleanValue (m_sackEnabled));
319 }
320 
323 {
324  Ptr<TcpSeqErrorModel> m_errorModel = CreateObject<TcpSeqErrorModel> ();
325  for (std::vector<uint32_t>::iterator it = m_toDrop.begin (); it != m_toDrop.end (); ++it)
326  {
327  m_errorModel->AddSeqToKill (SequenceNumber32 (*it));
328  }
329 
331 
332  return m_errorModel;
333 }
334 
335 void
338 {
339  NS_LOG_DEBUG ("Drop seq= " << tcpH.GetSequenceNumber () << " size " << p->GetSize ());
340 }
341 
342 void
344 {
345  if (who == SENDER)
346  {
347  if (h.GetAckNumber () == m_lastAckRecv
349  && (h.GetFlags () & TcpHeader::FIN) == 0)
350  {
351  m_isDupAck = true;
352  }
353  else
354  {
355  m_isDupAck = false;
357  }
358  }
359 }
360 
361 void
362 TcpRateLinuxWithSocketsTest::BytesInFlightTrace (uint32_t oldValue, uint32_t newValue)
363 {
364  NS_UNUSED (oldValue);
365  m_bytesInFlight = newValue;
366 }
367 
368 void
369 TcpRateLinuxWithSocketsTest::RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate)
370 {
371  NS_LOG_DEBUG ("Rate updated " << rate);
372  if (m_bytesInFlight == 0)
373  {
374  NS_TEST_ASSERT_MSG_EQ (rate.m_firstSentTime, Simulator::Now (), "FirstSentTime should be current time when bytes inflight is zero");
375  NS_TEST_ASSERT_MSG_EQ (rate.m_deliveredTime, Simulator::Now (), "Delivered time should be current time when bytes inflight is zero");
376  }
377  NS_TEST_ASSERT_MSG_GT_OR_EQ (rate.m_delivered, m_prevRate.m_delivered, "Total delivered should not be lesser than previous values");
378  m_prevRate = rate;
379 }
380 
381 void
382 TcpRateLinuxWithSocketsTest::RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample)
383 {
384  NS_LOG_DEBUG ("Rate sample updated " << sample);
385  if (m_isDupAck)
386  {
387  if (!m_sackEnabled)
388  {
389  NS_TEST_ASSERT_MSG_EQ (m_prevRateSample, sample, "RateSample should not update due to DupAcks");
390  }
391  else
392  {
393  if (sample.m_ackedSacked == 0)
394  {
395  NS_TEST_ASSERT_MSG_EQ (m_prevRateSample, sample, "RateSample should not update as nothing is acked or sacked");
396  }
397  }
398  }
399  m_prevRateSample = sample;
400 }
401 
402 void
404 {
405 }
406 
415 {
416 public:
422  TcpRateLinuxWithBufferTest (uint32_t segmentSize, std::string desc);
423 
424 private:
425  virtual void DoRun (void);
426  virtual void DoTeardown (void);
427 
432  virtual void RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate);
433 
438  virtual void RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample);
439 
441  void TestWithStraightAcks ();
442 
444  void TestWithSackBlocks ();
445 
446  uint32_t m_expectedDelivered {0};
447  uint32_t m_expectedAckedSacked {0};
448  uint32_t m_segmentSize;
451 };
452 
454  std::string testString)
455  : TestCase (testString),
456  m_segmentSize (segmentSize)
457 {
458  m_rateOps = CreateObject <TcpRateLinux> ();
459  m_rateOps->TraceConnectWithoutContext ("TcpRateUpdated",
461  m_rateOps->TraceConnectWithoutContext ("TcpRateSampleUpdated",
463 }
464 
465 void
467 {
468  Simulator::Schedule (Seconds (0.0), &TcpRateLinuxWithBufferTest::TestWithSackBlocks, this);
469  Simulator::Run ();
470  Simulator::Destroy ();
471 }
472 
473 void
474 TcpRateLinuxWithBufferTest::RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate)
475 {
476  NS_LOG_DEBUG ("Rate updated " << rate);
477  NS_TEST_ASSERT_MSG_EQ (rate.m_delivered, m_expectedDelivered, "Delivered data is not equal to expected delivered");
478 }
479 
480 void
481 TcpRateLinuxWithBufferTest::RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample)
482 {
483  NS_LOG_DEBUG ("Rate sample updated " << sample);
484  NS_TEST_ASSERT_MSG_EQ (sample.m_ackedSacked, m_expectedAckedSacked, "AckedSacked bytes is not equal to expected AckedSacked bytes");
485 }
486 
487 void
489 {
490  SequenceNumber32 head (1);
491  m_txBuf.SetHeadSequence (head);
492  SequenceNumber32 ret;
493  Ptr<TcpOptionSack> sack = CreateObject<TcpOptionSack> ();
496 
497  m_txBuf.Add (Create<Packet> (10 * m_segmentSize));
498 
499  // Send 10 Segments
500  for (uint8_t i = 0; i < 10; ++i)
501  {
502  bool isStartOfTransmission = m_txBuf.BytesInFlight () == 0;
504  m_rateOps->SkbSent (outItem, isStartOfTransmission);
505  }
506 
507  uint32_t priorInFlight = m_txBuf.BytesInFlight ();
508  // ACK 2 Segments
509  for (uint8_t i = 1; i <= 2; ++i)
510  {
511  priorInFlight = m_txBuf.BytesInFlight ();
513  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * i + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
515  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
516  }
517 
518  priorInFlight = m_txBuf.BytesInFlight ();
521  m_txBuf.Update (sack->GetSackList (), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
523  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
524 
525  priorInFlight = m_txBuf.BytesInFlight ();
528  m_txBuf.Update (sack->GetSackList (), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
529  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
530 
531  priorInFlight = m_txBuf.BytesInFlight ();
532  // Actual delivered should be increased by one segment even multiple blocks are acked.
534  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * 5 + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
535  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
536 
537 
538  priorInFlight = m_txBuf.BytesInFlight ();
539  // ACK rest of the segments
540  for (uint8_t i = 6; i <= 10; ++i)
541  {
543  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * i + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
544  }
546  TcpRateOps::TcpRateSample rateSample = m_rateOps->GenerateSample (5 * m_segmentSize, 0, false, priorInFlight, Seconds (0));
547 }
548 
549 void
551 {
552 }
553 
554 
562 {
563 public:
565  : TestSuite ("tcp-rate-ops", UNIT)
566  {
567  AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (20), SequenceNumber32 (11), 1, "Testing SkbDelivered and SkbSent"), TestCase::QUICK);
568  AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (11), SequenceNumber32 (11), 2, "Testing SkbDelivered and SkbSent with app limited data"), TestCase::QUICK);
569 
570  std::vector<uint32_t> toDrop;
571  toDrop.push_back (4001);
572  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value without SACK, one drop", false, toDrop),
573  TestCase::QUICK);
574 
575  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value with SACK, one drop", true, toDrop),
576  TestCase::QUICK);
577  toDrop.push_back (4001);
578  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value without SACK, two drop", false, toDrop),
579  TestCase::QUICK);
580 
581  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value with SACK, two drop", true, toDrop),
582  TestCase::QUICK);
583 
584  AddTestCase (new TcpRateLinuxWithBufferTest (1000, "Checking rate sample values with arbitary SACK Block"), TestCase::QUICK);
585 
586  AddTestCase (new TcpRateLinuxWithBufferTest (500, "Checking rate sample values with arbitary SACK Block"), TestCase::QUICK);
587 
588  }
589 };
590 
void SetCongestionControlAlgorithm(Ptr< TcpCongestionOps > algo)
Install a congestion control algorithm on this socket.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
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
Application packets.
Ptr< TcpRateOps > m_rateOps
Rate operations.
SequenceNumber32 m_nextTx
Tx next sequence number.
TcpRateLinuxWithBufferTest(uint32_t segmentSize, std::string desc)
Constructor.
AttributeValue implementation for Boolean.
Definition: boolean.h:36
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
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:1343
uint32_t m_expectedDelivered
Amount of expected delivered data.
uint32_t segmentSize
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:1297
Linux management and generation of Rate information for TCP.
Definition: tcp-rate-ops.h:180
#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
Time m_deliveredTime
Last time of a delivery.
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
uint32_t m_testCase
Test case type.
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:133
SequenceNumber32 m_tailSeq
Tail sequence number.
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:89
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:92
uint32_t m_segmentSize
Segment size.
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
uint32_t m_inFlight
Number of packets in-flight.
void ConfigureEnvironment()
Configure the test.
#define Max(a, b)
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.
TcpRateLinuxBasicTest(uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx, uint32_t testCase, std::string testName)
Constructor.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
void SendSkb(TcpTxItem *skb)
Send an application packet.
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.
uint32_t m_delivered
Number of segments delivered.
uint32_t m_cWnd
Congestion window size.
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:90
#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:1289
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
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:287
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:1353
#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
TcpRateLinux m_rateOps
Rate information for TCP.
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
bool m_isDupAck
Whether ACK is DupAck.
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...
Definition: callback.h:1642
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)
Deliver an application packet.
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.