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 
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 
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::Ipv4Header
Packet header for IPv4.
Definition: ipv4-header.h:34
TcpRateLinuxWithSocketsTest::m_prevRateSample
TcpRateLinux::TcpRateSample m_prevRateSample
Previous rate sample.
Definition: tcp-rate-ops-test.cc:290
ns3::TcpRateOps::TcpRateSample
Rate Sample structure.
Definition: tcp-rate-ops.h:134
ns3::TcpGeneralTest::SocketWho
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
Definition: tcp-general-test.h:275
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
ns3::TcpTxBuffer::SetSegmentSize
void SetSegmentSize(uint32_t segmentSize)
Set the segment size.
Definition: tcp-tx-buffer.cc:140
TcpRateLinuxWithSocketsTest::PktDropped
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet is dropped.
Definition: tcp-rate-ops-test.cc:336
TcpRateOpsTestSuite::TcpRateOpsTestSuite
TcpRateOpsTestSuite()
Definition: tcp-rate-ops-test.cc:564
ns3::TcpTxItem::GetSeqSize
uint32_t GetSeqSize(void) const
Get the size in the sequence number space.
Definition: tcp-tx-item.cc:62
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
NS_TEST_ASSERT_MSG_GT_OR_EQ
#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
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::TcpTxItem::GetRateInformation
RateInformation & GetRateInformation(void)
Get (to modify) the Rate Information of this item.
Definition: tcp-tx-item.cc:98
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TcpRateLinuxWithSocketsTest::m_isDupAck
bool m_isDupAck
Whether ACK is DupAck.
Definition: tcp-rate-ops-test.cc:288
TcpRateLinuxWithSocketsTest::RateUpdatedTrace
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
Definition: tcp-rate-ops-test.cc:369
ns3::TcpGeneralTest::SENDER
@ SENDER
Sender node.
Definition: tcp-general-test.h:276
ns3::TcpGeneralTest::SetTransmitStart
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
Definition: tcp-general-test.h:671
TcpRateLinuxBasicTest::m_cWnd
uint32_t m_cWnd
Congestion window size.
Definition: tcp-rate-ops-test.cc:74
TcpRateLinuxWithBufferTest::RateSampleUpdatedTrace
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Definition: tcp-rate-ops-test.cc:481
ns3::TcpOptionSack::AddSackBlock
void AddSackBlock(SackBlock s)
Add a SACK block.
Definition: tcp-option-sack.cc:132
ns3::TcpGeneralTest::SetAppPktCount
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
Definition: tcp-general-test.h:650
TcpRateLinuxBasicTest::m_deliveredTime
Time m_deliveredTime
Last time of a delivery.
Definition: tcp-rate-ops-test.cc:78
TcpRateLinuxBasicTest::m_segmentSize
uint32_t m_segmentSize
Segment size.
Definition: tcp-rate-ops-test.cc:76
TcpRateLinuxWithSocketsTest::FinalChecks
void FinalChecks()
Do the final checks.
Definition: tcp-rate-ops-test.cc:403
TcpRateLinuxWithBufferTest::m_expectedAckedSacked
uint32_t m_expectedAckedSacked
Amount of expected acked sacked data.
Definition: tcp-rate-ops-test.cc:447
TcpRateLinuxWithBufferTest::m_rateOps
Ptr< TcpRateOps > m_rateOps
Rate operations.
Definition: tcp-rate-ops-test.cc:450
TcpRateLinuxWithSocketsTest::CreateSenderSocket
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
Definition: tcp-rate-ops-test.cc:302
ns3::TcpTxBuffer
Tcp sender buffer.
Definition: tcp-tx-buffer.h:123
ns3::TcpTxBuffer::DiscardUpTo
void DiscardUpTo(const SequenceNumber32 &seq, const Callback< void, TcpTxItem * > &beforeDelCb=m_nullCb)
Discard data up to but not including this sequence number.
Definition: tcp-tx-buffer.cc:666
ns3::TcpOptionSack::GetSackList
SackList GetSackList(void) const
Get the SACK list.
Definition: tcp-option-sack.cc:153
TcpRateLinuxWithBufferTest::TestWithStraightAcks
void TestWithStraightAcks()
Test with acks without drop.
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::TcpTxItem::RateInformation::m_delivered
uint64_t m_delivered
Connection's delivered data at the time the packet was sent.
Definition: tcp-tx-item.h:89
TcpRateLinuxWithSocketsTest::m_congCtl
Ptr< MimicCongControl > m_congCtl
Dummy congestion control.
Definition: tcp-rate-ops-test.cc:283
ns3::SequenceNumber32
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
Definition: sequence-number.h:479
ns3::TestCase
encapsulates test code
Definition: test.h:1154
ns3::TcpRateOps::GenerateSample
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.
TcpRateLinuxBasicTest
The TcpRateLinux Basic Test.
Definition: tcp-rate-ops-test.cc:45
ns3::TcpGeneralErrorModel::SetDropCallback
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader &, Ptr< const Packet > > cb)
Set the drop callback.
Definition: tcp-error-model.h:52
TcpRateLinuxWithSocketsTest::m_lastAckRecv
SequenceNumber32 m_lastAckRecv
Last ACK received.
Definition: tcp-rate-ops-test.cc:287
ns3::TcpRateLinux::CalculateAppLimited
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.
Definition: tcp-rate-ops.cc:138
TcpRateLinuxBasicTest::m_tailSeq
SequenceNumber32 m_tailSeq
Tail sequence number.
Definition: tcp-rate-ops-test.cc:79
ns3::TcpRateLinux::SkbDelivered
virtual void SkbDelivered(TcpTxItem *skb) override
Update the Rate information after an item is received.
Definition: tcp-rate-ops.cc:164
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
TcpRateLinuxWithSocketsTest::ConfigureEnvironment
void ConfigureEnvironment()
Configure the test.
Definition: tcp-rate-ops-test.cc:311
TcpRateLinuxWithBufferTest::TestWithSackBlocks
void TestWithSackBlocks()
Test with arbitary SACK scenario.
Definition: tcp-rate-ops-test.cc:488
TcpRateLinuxWithSocketsTest::m_bytesInFlight
uint32_t m_bytesInFlight
Bytes inflight.
Definition: tcp-rate-ops-test.cc:286
TcpRateLinuxBasicTest::SkbDelivered
void SkbDelivered(TcpTxItem *skb)
Deliver an application packet.
Definition: tcp-rate-ops-test.cc:144
TcpRateLinuxWithBufferTest
The TcpRateLinuxWithBufferTest tests rate sample functionality with arbitary SACK scenario.
Definition: tcp-rate-ops-test.cc:415
TcpRateLinuxBasicTest::m_rateOps
TcpRateLinux m_rateOps
Rate information for TCP.
Definition: tcp-rate-ops-test.cc:73
MimicCongControl::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-rate-ops-test.cc:190
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
ns3::TcpTxItem::RateInformation::m_isAppLimited
bool m_isAppLimited
Connection's app limited at the time the packet was sent.
Definition: tcp-tx-item.h:92
TcpRateLinuxWithSocketsTest::TcpRateLinuxWithSocketsTest
TcpRateLinuxWithSocketsTest(const std::string &desc, bool sackEnabled, std::vector< uint32_t > &toDrop)
Constructor.
Definition: tcp-rate-ops-test.cc:293
TcpRateLinuxBasicTest::SendSkb
void SendSkb(TcpTxItem *skb)
Send an application packet.
Definition: tcp-rate-ops-test.cc:124
TcpRateLinuxWithBufferTest::m_expectedDelivered
uint32_t m_expectedDelivered
Amount of expected delivered data.
Definition: tcp-rate-ops-test.cc:446
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
g_TcpRateOpsTestSuite
static TcpRateOpsTestSuite g_TcpRateOpsTestSuite
Static variable for test initialization.
Definition: tcp-rate-ops-test.cc:591
NS_UNUSED
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
ns3::TcpRateLinux
Linux management and generation of Rate information for TCP.
Definition: tcp-rate-ops.h:181
tcp-error-model.h
TcpRateLinuxWithBufferTest::DoTeardown
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Definition: tcp-rate-ops-test.cc:550
TcpRateLinuxWithSocketsTest::CreateReceiverErrorModel
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create a receiver error model.
Definition: tcp-rate-ops-test.cc:322
TcpRateLinuxWithBufferTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: tcp-rate-ops-test.cc:466
ns3::TcpRateLinux::SkbSent
virtual void SkbSent(TcpTxItem *skb, bool isStartOfTransmission) override
Put the rate information inside the sent skb.
Definition: tcp-rate-ops.cc:201
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
TcpRateLinuxWithSocketsTest::Rx
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Receive a packet.
Definition: tcp-rate-ops-test.cc:343
ns3::TcpHeader
Header for the Transmission Control Protocol.
Definition: tcp-header.h:45
TcpRateLinuxBasicTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: tcp-rate-ops-test.cc:101
TcpRateLinuxBasicTest::m_delivered
uint32_t m_delivered
Number of segments delivered.
Definition: tcp-rate-ops-test.cc:77
ns3::TcpOptionSack::SackBlock
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
Definition: tcp-option-sack.h:59
tcp-general-test.h
ns3::MakeCallback
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
TcpRateLinuxWithSocketsTest
The TcpRateLinux Test uses sender-receiver model to test its functionality.
Definition: tcp-rate-ops-test.cc:212
ns3::TcpGeneralTest
General infrastructure for TCP testing.
Definition: tcp-general-test.h:257
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
TcpRateLinuxWithBufferTest::RateUpdatedTrace
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
Definition: tcp-rate-ops-test.cc:474
TcpRateLinuxWithSocketsTest::RateSampleUpdatedTrace
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Definition: tcp-rate-ops-test.cc:382
NS_TEST_ASSERT_MSG_EQ
#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
ns3::TcpTxBuffer::Update
uint32_t Update(const TcpOptionSack::SackList &list, const Callback< void, TcpTxItem * > &sackedCb=m_nullCb)
Update the scoreboard.
Definition: tcp-tx-buffer.cc:784
MimicCongControl::HasCongControl
virtual bool HasCongControl() const
Returns true when Congestion Control Algorithm implements CongControl.
Definition: tcp-rate-ops-test.cc:182
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::TcpTxItem
Item that encloses the application packet and some flags for it.
Definition: tcp-tx-item.h:33
ns3::TcpTxItem::RateInformation::m_deliveredTime
Time m_deliveredTime
Connection's delivered time at the time the packet was sent.
Definition: tcp-tx-item.h:90
ns3::TestSuite::UNIT
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1353
TcpRateLinuxBasicTest::m_testCase
uint32_t m_testCase
Test case type.
Definition: tcp-rate-ops-test.cc:81
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::TcpTxBuffer::CopyFromSequence
TcpTxItem * CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data from the range [seq, seq+numBytes) into a packet.
Definition: tcp-tx-buffer.cc:221
TcpRateLinuxWithSocketsTest::m_toDrop
std::vector< uint32_t > m_toDrop
List of SequenceNumber to drop.
Definition: tcp-rate-ops-test.cc:285
TcpRateLinuxBasicTest::m_skbs
std::vector< TcpTxItem * > m_skbs
Application packets.
Definition: tcp-rate-ops-test.cc:82
ns3::TcpTxBuffer::SetDupAckThresh
void SetDupAckThresh(uint32_t dupAckThresh)
Set the DupAckThresh.
Definition: tcp-tx-buffer.cc:134
TcpRateOpsTestSuite
the TestSuite for the TcpRateLinux test case
Definition: tcp-rate-ops-test.cc:562
ns3::TcpNewReno
The NewReno implementation.
Definition: tcp-congestion-ops.h:216
ns3::TcpSocketBase::SetCongestionControlAlgorithm
void SetCongestionControlAlgorithm(Ptr< TcpCongestionOps > algo)
Install a congestion control algorithm on this socket.
Definition: tcp-socket-base.cc:4417
segmentSize
uint32_t segmentSize
Definition: tcp-linux-reno.cc:53
ns3::TcpHeader::GetFlags
uint8_t GetFlags() const
Get the flags.
Definition: tcp-header.cc:173
ns3::TcpHeader::GetAckNumber
SequenceNumber32 GetAckNumber() const
Get the ACK number.
Definition: tcp-header.cc:149
TcpRateLinuxWithBufferTest::TcpRateLinuxWithBufferTest
TcpRateLinuxWithBufferTest(uint32_t segmentSize, std::string desc)
Constructor.
Definition: tcp-rate-ops-test.cc:453
ns3::Config::SetDefault
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
ns3::ObjectBase::TraceConnectWithoutContext
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
MimicCongControl::MimicCongControl
MimicCongControl()
Definition: tcp-rate-ops-test.cc:178
TcpRateLinuxWithSocketsTest::BytesInFlightTrace
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Track the bytes in flight.
Definition: tcp-rate-ops-test.cc:362
TcpRateLinuxWithBufferTest::m_txBuf
TcpTxBuffer m_txBuf
Tcp Tx buffer.
Definition: tcp-rate-ops-test.cc:449
ns3::TcpTxBuffer::Add
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
Definition: tcp-tx-buffer.cc:180
ns3::TcpSeqErrorModel::AddSeqToKill
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
Definition: tcp-error-model.h:100
TcpRateLinuxWithSocketsTest::m_sackEnabled
bool m_sackEnabled
Sack Variable.
Definition: tcp-rate-ops-test.cc:284
ns3::TcpTxBuffer::BytesInFlight
uint32_t BytesInFlight() const
Return total bytes in flight.
Definition: tcp-tx-buffer.cc:1074
Max
#define Max(a, b)
Definition: aarf-wifi-manager.cc:26
ns3::TcpRateOps::SkbSent
virtual void SkbSent(TcpTxItem *skb, bool isStartOfTransmission)=0
Put the rate information inside the sent skb.
TcpRateLinuxBasicTest::m_inFlight
uint32_t m_inFlight
Number of packets in-flight.
Definition: tcp-rate-ops-test.cc:75
ns3::SequenceNumber< uint32_t, int32_t >
ns3::TcpTxBuffer::SetHeadSequence
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.
Definition: tcp-tx-buffer.cc:164
TcpRateLinuxBasicTest::m_nextTx
SequenceNumber32 m_nextTx
Tx next sequence number.
Definition: tcp-rate-ops-test.cc:80
TcpRateLinuxBasicTest::TcpRateLinuxBasicTest
TcpRateLinuxBasicTest(uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx, uint32_t testCase, std::string testName)
Constructor.
Definition: tcp-rate-ops-test.cc:85
TcpRateLinuxWithBufferTest::m_segmentSize
uint32_t m_segmentSize
Segment size.
Definition: tcp-rate-ops-test.cc:448
TcpRateLinuxWithSocketsTest::m_prevRate
TcpRateLinux::TcpRateConnection m_prevRate
Previous rate.
Definition: tcp-rate-ops-test.cc:289
MimicCongControl
Behaves as NewReno except HasCongControl returns true.
Definition: tcp-rate-ops-test.cc:170
ns3::TcpGeneralTest::SetPropagationDelay
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
Definition: tcp-general-test.h:664
ns3::TcpHeader::GetSequenceNumber
SequenceNumber32 GetSequenceNumber() const
Get the sequence number.
Definition: tcp-header.cc:143