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 
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 
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;
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
363 {
364  m_bytesInFlight = newValue;
365 }
366 
367 void
368 TcpRateLinuxWithSocketsTest::RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate)
369 {
370  NS_LOG_DEBUG ("Rate updated " << rate);
371  if (m_bytesInFlight == 0)
372  {
373  NS_TEST_ASSERT_MSG_EQ (rate.m_firstSentTime, Simulator::Now (), "FirstSentTime should be current time when bytes inflight is zero");
374  NS_TEST_ASSERT_MSG_EQ (rate.m_deliveredTime, Simulator::Now (), "Delivered time should be current time when bytes inflight is zero");
375  }
376  NS_TEST_ASSERT_MSG_GT_OR_EQ (rate.m_delivered, m_prevRate.m_delivered, "Total delivered should not be lesser than previous values");
377  m_prevRate = rate;
378 }
379 
380 void
381 TcpRateLinuxWithSocketsTest::RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample)
382 {
383  NS_LOG_DEBUG ("Rate sample updated " << sample);
384  if (m_isDupAck)
385  {
386  if (!m_sackEnabled)
387  {
388  NS_TEST_ASSERT_MSG_EQ (m_prevRateSample, sample, "RateSample should not update due to DupAcks");
389  }
390  else
391  {
392  if (sample.m_ackedSacked == 0)
393  {
394  NS_TEST_ASSERT_MSG_EQ (m_prevRateSample, sample, "RateSample should not update as nothing is acked or sacked");
395  }
396  }
397  }
398  m_prevRateSample = sample;
399 }
400 
401 void
403 {
404 }
405 
414 {
415 public:
421  TcpRateLinuxWithBufferTest (uint32_t segmentSize, std::string desc);
422 
423 private:
424  virtual void DoRun (void);
425  virtual void DoTeardown (void);
426 
431  virtual void RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate);
432 
437  virtual void RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample);
438 
441 
443  void TestWithSackBlocks ();
444 
450 };
451 
453  std::string testString)
454  : TestCase (testString),
455  m_segmentSize (segmentSize)
456 {
457  m_rateOps = CreateObject <TcpRateLinux> ();
458  m_rateOps->TraceConnectWithoutContext ("TcpRateUpdated",
460  m_rateOps->TraceConnectWithoutContext ("TcpRateSampleUpdated",
462 }
463 
464 void
466 {
467  Simulator::Schedule (Seconds (0.0), &TcpRateLinuxWithBufferTest::TestWithSackBlocks, this);
468  Simulator::Run ();
469  Simulator::Destroy ();
470 }
471 
472 void
473 TcpRateLinuxWithBufferTest::RateUpdatedTrace (const TcpRateLinux::TcpRateConnection &rate)
474 {
475  NS_LOG_DEBUG ("Rate updated " << rate);
476  NS_TEST_ASSERT_MSG_EQ (rate.m_delivered, m_expectedDelivered, "Delivered data is not equal to expected delivered");
477 }
478 
479 void
480 TcpRateLinuxWithBufferTest::RateSampleUpdatedTrace (const TcpRateLinux::TcpRateSample &sample)
481 {
482  NS_LOG_DEBUG ("Rate sample updated " << sample);
483  NS_TEST_ASSERT_MSG_EQ (sample.m_ackedSacked, m_expectedAckedSacked, "AckedSacked bytes is not equal to expected AckedSacked bytes");
484 }
485 
486 void
488 {
489  SequenceNumber32 head (1);
490  m_txBuf.SetHeadSequence (head);
491  SequenceNumber32 ret;
492  Ptr<TcpOptionSack> sack = CreateObject<TcpOptionSack> ();
495 
496  m_txBuf.Add (Create<Packet> (10 * m_segmentSize));
497 
498  // Send 10 Segments
499  for (uint8_t i = 0; i < 10; ++i)
500  {
501  bool isStartOfTransmission = m_txBuf.BytesInFlight () == 0;
503  m_rateOps->SkbSent (outItem, isStartOfTransmission);
504  }
505 
506  uint32_t priorInFlight = m_txBuf.BytesInFlight ();
507  // ACK 2 Segments
508  for (uint8_t i = 1; i <= 2; ++i)
509  {
510  priorInFlight = m_txBuf.BytesInFlight ();
512  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * i + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
514  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
515  }
516 
517  priorInFlight = m_txBuf.BytesInFlight ();
520  m_txBuf.Update (sack->GetSackList (), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
522  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
523 
524  priorInFlight = m_txBuf.BytesInFlight ();
527  m_txBuf.Update (sack->GetSackList (), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
528  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
529 
530  priorInFlight = m_txBuf.BytesInFlight ();
531  // Actual delivered should be increased by one segment even multiple blocks are acked.
533  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * 5 + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
534  m_rateOps->GenerateSample (m_segmentSize, 0, false, priorInFlight, Seconds (0));
535 
536 
537  priorInFlight = m_txBuf.BytesInFlight ();
538  // ACK rest of the segments
539  for (uint8_t i = 6; i <= 10; ++i)
540  {
542  m_txBuf.DiscardUpTo (SequenceNumber32 (m_segmentSize * i + 1), MakeCallback (&TcpRateOps::SkbDelivered, m_rateOps));
543  }
545  TcpRateOps::TcpRateSample rateSample = m_rateOps->GenerateSample (5 * m_segmentSize, 0, false, priorInFlight, Seconds (0));
546 }
547 
548 void
550 {
551 }
552 
553 
561 {
562 public:
564  : TestSuite ("tcp-rate-ops", UNIT)
565  {
566  AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (20), SequenceNumber32 (11), 1, "Testing SkbDelivered and SkbSent"), TestCase::QUICK);
567  AddTestCase (new TcpRateLinuxBasicTest (1000, SequenceNumber32 (11), SequenceNumber32 (11), 2, "Testing SkbDelivered and SkbSent with app limited data"), TestCase::QUICK);
568 
569  std::vector<uint32_t> toDrop;
570  toDrop.push_back (4001);
571  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value without SACK, one drop", false, toDrop),
572  TestCase::QUICK);
573 
574  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value with SACK, one drop", true, toDrop),
575  TestCase::QUICK);
576  toDrop.push_back (4001);
577  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value without SACK, two drop", false, toDrop),
578  TestCase::QUICK);
579 
580  AddTestCase (new TcpRateLinuxWithSocketsTest ("Checking Rate sample value with SACK, two drop", true, toDrop),
581  TestCase::QUICK);
582 
583  AddTestCase (new TcpRateLinuxWithBufferTest (1000, "Checking rate sample values with arbitary SACK Block"), TestCase::QUICK);
584 
585  AddTestCase (new TcpRateLinuxWithBufferTest (500, "Checking rate sample values with arbitary SACK Block"), TestCase::QUICK);
586 
587  }
588 };
589 
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:563
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:862
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:368
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:480
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:402
TcpRateLinuxWithBufferTest::m_expectedAckedSacked
uint32_t m_expectedAckedSacked
Amount of expected acked sacked data.
Definition: tcp-rate-ops-test.cc:446
TcpRateLinuxWithBufferTest::m_rateOps
Ptr< TcpRateOps > m_rateOps
Rate operations.
Definition: tcp-rate-ops-test.cc:449
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:922
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:994
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:487
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:414
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:445
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
g_TcpRateOpsTestSuite
static TcpRateOpsTestSuite g_TcpRateOpsTestSuite
Static variable for test initialization.
Definition: tcp-rate-ops-test.cc:590
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:549
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:465
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:103
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:1648
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:1188
TcpRateLinuxWithBufferTest::RateUpdatedTrace
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
Definition: tcp-rate-ops-test.cc:473
uint32_t
TcpRateLinuxWithSocketsTest::RateSampleUpdatedTrace
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Definition: tcp-rate-ops-test.cc:381
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:141
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:783
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:1197
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:1244
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:561
ns3::TcpNewReno
The NewReno implementation.
Definition: tcp-congestion-ops.h:215
ns3::TcpSocketBase::SetCongestionControlAlgorithm
void SetCongestionControlAlgorithm(Ptr< TcpCongestionOps > algo)
Install a congestion control algorithm on this socket.
Definition: tcp-socket-base.cc:4415
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:452
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:364
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:448
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:1073
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
Generic "sequence number" class.
Definition: sequence-number.h:60
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:447
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