A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3tcp-cwnd-test-suite.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
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 
19 #include "ns3/log.h"
20 #include "ns3/abort.h"
21 #include "ns3/test.h"
22 #include "ns3/pcap-file.h"
23 #include "ns3/config.h"
24 #include "ns3/string.h"
25 #include "ns3/uinteger.h"
26 #include "ns3/data-rate.h"
27 #include "ns3/inet-socket-address.h"
28 #include "ns3/point-to-point-helper.h"
29 #include "ns3/internet-stack-helper.h"
30 #include "ns3/ipv4-global-routing-helper.h"
31 #include "ns3/ipv4-address-helper.h"
32 #include "ns3/packet-sink-helper.h"
33 #include "ns3/tcp-socket-factory.h"
34 #include "ns3/simulator.h"
35 
36 using namespace ns3;
37 
38 NS_LOG_COMPONENT_DEFINE ("Ns3CwndTest");
39 
40 // ===========================================================================
41 // This is a simple test to demonstrate how a known good model (a reference
42 // implementation) may be used to test another model without resorting to
43 // storing stimulus or response vectors.
44 //
45 // Node zero contains the model under test, in this case the ns-3 TCP
46 // implementation. Node one contains the reference implementation that we
47 // assume will generate good test vectors for us. In this case, a Linux
48 // TCP implementation is used to stimulate the ns-3 TCP model with what we
49 // assume are perfectly good packets. We watch the ns-3 implementation to
50 // see what it does in the presence of these assumed good stimuli.
51 //
52 // The test is arranged as a typical ns-3 script, but we use the trace system
53 // to peek into the running system and monitor the ns-3 TCP.
54 //
55 // The topology is just two nodes communicating over a point-to-point network.
56 // The point-to-point network is chosen because it is simple and allows us to
57 // easily generate pcap traces we can use to separately verify that the ns-3
58 // implementation is responding correctly. Once the oopration is verified, we
59 // enter a list of responses that capture the response succinctly.
60 //
61 // node 0 node 1
62 // +----------------+ +----------------+
63 // | ns-3 TCP | | Linux TCP |
64 // +----------------+ +----------------+
65 // | 10.1.1.1 | | 10.1.1.2 |
66 // +----------------+ +----------------+
67 // | point-to-point | | point-to-point |
68 // +----------------+ +----------------+
69 // | |
70 // +---------------------+
71 // 5 Mbps, 2 ms
72 //
73 // ===========================================================================
74 //
75 class SimpleSource : public Application
76 {
77 public:
78 
79  SimpleSource ();
80  virtual ~SimpleSource();
81 
82  void Setup (Ptr<Socket> socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate);
83 
84 private:
85  virtual void StartApplication (void);
86  virtual void StopApplication (void);
87 
88  void ScheduleTx (void);
89  void SendPacket (void);
90 
93  uint32_t m_packetSize;
94  uint32_t m_nPackets;
97  bool m_running;
98  uint32_t m_packetsSent;
99 };
100 
102  : m_socket (0),
103  m_peer (),
104  m_packetSize (0),
105  m_nPackets (0),
106  m_dataRate (0),
107  m_sendEvent (),
108  m_running (false),
109  m_packetsSent (0)
110 {
111 }
112 
114 {
115  m_socket = 0;
116 }
117 
118 void
119 SimpleSource::Setup (Ptr<Socket> socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate)
120 {
121  m_socket = socket;
122  m_peer = address;
123  m_packetSize = packetSize;
124  m_nPackets = nPackets;
125  m_dataRate = dataRate;
126 }
127 
128 void
130 {
131  m_running = true;
132  m_packetsSent = 0;
133  m_socket->Bind ();
135  SendPacket ();
136 }
137 
138 void
140 {
141  m_running = false;
142 
143  if (m_sendEvent.IsRunning ())
144  {
145  Simulator::Cancel (m_sendEvent);
146  }
147 
148  if (m_socket)
149  {
150  m_socket->Close ();
151  }
152 }
153 
154 void
156 {
157  Ptr<Packet> packet = Create<Packet> (m_packetSize);
158  m_socket->Send (packet);
159 
160  if (++m_packetsSent < m_nPackets)
161  {
162  ScheduleTx ();
163  }
164 }
165 
166 void
168 {
169  if (m_running)
170  {
171  Time tNext (Seconds (m_packetSize * 8 / static_cast<double> (m_dataRate.GetBitRate ())));
172  m_sendEvent = Simulator::Schedule (tNext, &SimpleSource::SendPacket, this);
173  }
174 }
175 
177 {
178 public:
180  virtual ~Ns3TcpCwndTestCase1 ();
181 
182 private:
183  virtual void DoRun (void);
185 
186  class CwndEvent {
187 public:
188  uint32_t m_oldCwnd;
189  uint32_t m_newCwnd;
190  };
191 
193 
194  void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
195 };
196 
198  : TestCase ("Check to see that the ns-3 TCP congestion window works as expected against liblinux2.6.26.so"),
199  m_writeResults (false)
200 {
201 }
202 
204 {
205 }
206 
207 void
208 Ns3TcpCwndTestCase1::CwndChange (uint32_t oldCwnd, uint32_t newCwnd)
209 {
210  CwndEvent event;
211 
212  event.m_oldCwnd = oldCwnd;
213  event.m_newCwnd = newCwnd;
214 
215  m_responses.Add (event);
216 }
217 
218 void
220 {
221  //
222  // Just create two nodes. One (node zero) will be the node with the TCP
223  // under test which is the ns-3 TCP implementation. The other node (node
224  // one) will be the node with the reference implementation we use to drive
225  // the tests.
226  //
228  nodes.Create (2);
229 
230  //
231  // For this test we'll use a point-to-point net device. It's not as simple
232  // as a simple-net-device, but it provides nice places to hook trace events
233  // so we can see what's moving between our nodes.
234  //
236  pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
237  pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
238 
239  //
240  // Install the point-to-point devices on both nodes and connec them up.
241  //
243  devices = pointToPoint.Install (nodes);
244 
245  //
246  // Install two variants of the internet stack. The first, on node zero
247  // uses the TCP under test, which is the default ns-3 TCP implementation.
248  //
250  stack.Install (nodes.Get (0));
251 
252  //
253  // The other node, node one, is going to be set up to use a Linux TCP
254  // implementation that we consider a known good TCP.
255  //
256  std::string nscStack = "liblinux2.6.26.so";
257  stack.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so"));
258  stack.Install (nodes.Get (1));
259 
260  //
261  // Assign the address 10.1.1.1 to the TCP implementation under test (index
262  // zero) and 10.1.1.2 to the reference implementation (index one).
263  //
265  address.SetBase ("10.1.1.0", "255.255.255.252");
266  Ipv4InterfaceContainer interfaces = address.Assign (devices);
267 
268  //
269  // We need a place to send our TCP data on the node with the reference TCP
270  // implementation. We aren't really concerned about what happens there, so
271  // just create a sink.
272  //
273  uint16_t sinkPort = 8080;
274  Address sinkAddress (InetSocketAddress (interfaces.GetAddress (1), sinkPort));
275  PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
276  ApplicationContainer sinkApps = packetSinkHelper.Install (nodes.Get (1));
277  sinkApps.Start (Seconds (0.));
278  sinkApps.Stop (Seconds (1.1));
279 
280  //
281  // We want to look at changes in the ns-3 TCP congestion window. The
282  // congestion window is flow clontrol imposed by the sender, so we need
283  // to crank up a flow from the ns-3 TCP node to the NSC TCP node and hook the
284  // CongestionWindow attribute on the socket. Normally one would use an on-off
285  // application to generate a flow, but this has a couple of problems. First,
286  // the socket of the on-off application is not created until Application Start
287  // time, so we wouldn't be able to hook the socket now at configuration time.
288  // Second, even if we could arrange a call after start time, the socket is not
289  // public.
290  //
291  // So, we can cook up a simple version of the on-off application that does what
292  // we want. On the plus side we don't need all of the complexity of the on-off
293  // application. On the minus side, we don't have a helper, so we have to get
294  // a little more involved in the details, but this is trivial.
295  //
296  // So first, we create a socket and do the trace connect on it; then we pass this
297  // socket into the constructor of our simple application which we then install
298  // in the node with the ns-3 TCP.
299  //
300  Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (nodes.Get (0), TcpSocketFactory::GetTypeId ());
301  ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeCallback (&Ns3TcpCwndTestCase1::CwndChange, this));
302 
303  Ptr<SimpleSource> app = CreateObject<SimpleSource> ();
304  app->Setup (ns3TcpSocket, sinkAddress, 1040, 10, DataRate ("5Mbps"));
305  nodes.Get (0)->AddApplication (app);
306  app->SetStartTime (Seconds (1.));
307  app->SetStopTime (Seconds (1.1));
308 
309  //
310  // The idea here is that someone will look very closely at the all of the
311  // communications between the reference TCP and the TCP under test in this
312  // simulation and determine that all of the responses are correct. We expect
313  // that this means generating a pcap trace file from the point-to-point link
314  // and examining the packets closely using tcpdump, wireshark or some such
315  // program. So we provide the ability to generate a pcap trace of the
316  // test execution for your perusal.
317  //
318  // Once the validation test is determined to be running exactly as exptected,
319  // the set of congestion window changes is collected and hard coded into the
320  // test results which will then be checked during the actual execution of the
321  // test.
322  //
323 
324  if (m_writeResults)
325  {
326  pointToPoint.EnablePcapAll ("tcp-cwnd");
327  }
328 
329  Simulator::Stop (Seconds (2));
330  Simulator::Run ();
331  Simulator::Destroy ();
332 
333  //
334  // As new acks are received by the TCP under test, the congestion window
335  // should be opened up by one segment (MSS bytes) each time. This should
336  // trigger a congestion window change event which we hooked and saved above.
337  // We should now be able to look through the saved response vectors and follow
338  // the congestion window as it opens up when the ns-3 TCP under test
339  // transmits its bits
340  //
341  // From inspecting the results, we know that we should see N_EVENTS congestion
342  // window change events. The window should expand N_EVENTS - 1 times (each
343  // time by MSS bytes) until it gets to its largest value. Then the application
344  // sending stops and the window should be slammed shut, with the last event
345  // reflecting the change from LARGEST_CWND back to MSS
346  //
347  const uint32_t MSS = 536;
348  const uint32_t N_EVENTS = 21;
349 
350  CwndEvent event;
351 
352  NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), N_EVENTS, "Unexpectedly low number of cwnd change events");
353 
354 
355  // Ignore the first event logged (i=0) when m_cWnd goes from 0 to MSS bytes
356  for (uint32_t i = 1, from = MSS, to = MSS * 2; i < N_EVENTS; ++i, from += MSS, to += MSS)
357  {
358  event = m_responses.Get (i);
359  NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
360  NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
361  }
362 }
363 
364 
365 // ===========================================================================
366 // Test case for cwnd changes due to out-of-order packets. A bottleneck
367 // link is created, and a limited droptail queue is used in order to
368 // force dropped packets, resulting in out-of-order packet delivery.
369 // This out-of-order delivery will result in a different congestion
370 // window behavior than testcase 1. Specifically, duplicate ACKs
371 // are encountered.
372 //
373 // Network topology
374 //
375 // 1Mb/s, 10ms 100kb/s, 10ms 1Mb/s, 10ms
376 // n0--------------n1-----------------n2---------------n3
377 //
378 // ===========================================================================
380 {
381 public:
383  virtual ~Ns3TcpCwndTestCase2 ();
384 
385 private:
386  virtual void DoRun (void);
387  void VerifyCwndRun (uint32_t beginIdx, uint32_t endIdx, uint32_t initialCwnd, uint32_t mss);
389 
390  class CwndEvent {
391 public:
392  uint32_t m_oldCwnd;
393  uint32_t m_newCwnd;
394  };
395 
397 
398  void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
399 };
400 
402  : TestCase ("Check to see that the ns-3 TCP congestion window works as expected for out-of-order packet delivery"),
403  m_writeResults (false)
404 {
405 }
406 
408 {
409 }
410 
411 void
412 Ns3TcpCwndTestCase2::CwndChange (uint32_t oldCwnd, uint32_t newCwnd)
413 {
414  CwndEvent event;
415 
416  event.m_oldCwnd = oldCwnd;
417  event.m_newCwnd = newCwnd;
418 
419  m_responses.Add (event);
420 }
421 
422 void
424 {
425  // Set up some default values for the simulation.
426  Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (4));
427 
428  NodeContainer n0n1;
429  n0n1.Create (2);
430 
432  n1n2.Add (n0n1.Get (1));
433  n1n2.Create (1);
434 
436  n2n3.Add (n1n2.Get (1));
437  n2n3.Create (1);
438 
439  PointToPointHelper p2p1;
440  p2p1.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1000000)));
441  p2p1.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10)));
442  PointToPointHelper p2p2;
443  p2p2.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (100000)));
444  p2p2.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10)));
445 
446  // And then install devices and channels connecting our topology.
447  NetDeviceContainer dev0 = p2p1.Install (n0n1);
448  NetDeviceContainer dev1 = p2p2.Install (n1n2);
449  NetDeviceContainer dev2 = p2p1.Install (n2n3);
450 
451  // Now add ip/tcp stack to all nodes.
452  InternetStackHelper internet;
453  internet.InstallAll ();
454 
455  // Later, we add IP addresses.
456  Ipv4AddressHelper ipv4;
457  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
458  ipv4.Assign (dev0);
459  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
460  ipv4.Assign (dev1);
461  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
462  Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev2);
463 
464  // and setup ip routing tables to get total ip-level connectivity.
465  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
466 
467  // Set up the apps
468  uint16_t servPort = 50000;
469 
470  // Create a packet sink to receive these packets on n3
471  PacketSinkHelper sink ("ns3::TcpSocketFactory",
472  InetSocketAddress (Ipv4Address::GetAny (), servPort));
473 
474  ApplicationContainer apps = sink.Install (n2n3.Get (1));
475  apps.Start (Seconds (0.0));
476  apps.Stop (Seconds (5.4));
477 
478  // Create the socket for n0
479  Address sinkAddress (InetSocketAddress (ipInterfs.GetAddress (1), servPort));
480  Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
481  ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeCallback (&Ns3TcpCwndTestCase2::CwndChange, this));
482 
483  // Create and start the app for n0
484  Ptr<SimpleSource> app = CreateObject<SimpleSource> ();
485  app->Setup (ns3TcpSocket, sinkAddress, 1040, 1000, DataRate ("1Mbps"));
486  n0n1.Get (0)->AddApplication (app);
487  app->SetStartTime (Seconds (1.0));
488  app->SetStopTime (Seconds (4.1));
489 
490  if (m_writeResults)
491  {
492  // Write a pcap for tcp cwnd testcase with out-of-order delivery
494  pointToPoint.EnablePcapAll ("tcp-cwnd-ood");
495  }
496 
497  // Finally, set up the simulator to run.
498  Simulator::Stop (Seconds (4.1));
499  Simulator::Run ();
500  Simulator::Destroy ();
501 
502  //
503  // As new acks are received by the TCP under test, the congestion window
504  // should be opened up by one segment (MSS bytes) each time. This should
505  // trigger a congestion window change event which we hooked and saved above.
506  // We should now be able to look through the saved response vectors and follow
507  // the congestion window as it opens up when the ns-3 TCP under test
508  // transmits its bits
509  //
510  // From inspecting the results, we know that we should see N_EVENTS congestion
511  // window change events. On the tenth change event, the window should
512  // be cut from 5360 to 4288 due to 3 dup acks (NewReno behavior is to
513  // cut in half, and then add 3 segments (5360/2 + 3*536 = 4288)
514  //
515 
516 
517 
518  const uint32_t MSS = 536;
519  const uint32_t N_EVENTS = 41;
520 
521  CwndEvent event;
522 
523  NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), N_EVENTS, "Unexpected number of cwnd change events");
524 
525  // Ignore the first event logged (i=0) when m_cWnd goes from 0 to MSS bytes
526  VerifyCwndRun (1, 10, 2 * MSS, MSS);
527 
528  // Cwnd should be back to (10/2 + 3) = 8*MSS
529  event = m_responses.Get (10);
530  NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, 8*MSS, "Wrong new cwnd value in cwnd change event " << 10);
531 
532  VerifyCwndRun (11, 13, 9 * MSS, MSS);
533 
534  //Partial ack will end up modifying cwnd 2X due to how code is written
535  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (15).m_newCwnd, 9 * MSS, "Wrong new cwnd value in cwnd change event " << 15);
536 
537  //DUP ACKS in fast recovery
538  VerifyCwndRun (16, 17, 10 * MSS, MSS);
539 
540  //Partial ack will end up modifying cwnd 2X due to how code is written, therefore eat 18 and 19
541  VerifyCwndRun (19, 20, 9 * MSS, MSS);
542 
543 
544  VerifyCwndRun(22, 25, 8 * MSS, MSS);
545 
546  //Leaving fast recovery
547  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (26).m_newCwnd, 5 * MSS, "Wrong new cwnd value in cwnd change event " << 26);
548 
549  uint32_t cwnd = 5 * MSS;
550  //In CongAvoid each event will increase cwnd by (MSS * MSS / cwnd)
551  for (uint32_t i = 27; i < N_EVENTS; ++i)
552  {
553  double adder = static_cast<double> (MSS * MSS) / cwnd;
554  adder = std::max (1.0, adder);
555  cwnd += static_cast<uint32_t> (adder);
556  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (i).m_newCwnd, cwnd, "Wrong new cwnd value in cwnd change event " << i);
557  }
558 
559  for (uint32_t i = 0; i < N_EVENTS; ++i)
560  {
561  std::cout << "i: " << m_responses.Get(i).m_newCwnd << " " << m_responses.Get(i).m_oldCwnd << std::endl;
562  }
563 }
564 
565 void
566 Ns3TcpCwndTestCase2::VerifyCwndRun (uint32_t beginIdx, uint32_t endIdx, uint32_t initialCwnd, uint32_t mss)
567 {
568 
569  CwndEvent event;
570 
571  for(uint32_t i = beginIdx, to = initialCwnd; i < endIdx; ++i, to += mss)
572  {
573  event = m_responses.Get (i);
574  NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
575  }
576 }
577 
579 {
580 public:
582 };
583 
585  : TestSuite ("ns3-tcp-cwnd", SYSTEM)
586 {
587  AddTestCase (new Ns3TcpCwndTestCase1, TestCase::QUICK);
588  AddTestCase (new Ns3TcpCwndTestCase2, TestCase::QUICK);
589 }
590 
holds a vector of ns3::Application pointers.
uint32_t AddApplication(Ptr< Application > application)
Definition: node.cc:149
Ptr< Socket > m_socket
static void SendPacket(Ptr< Socket > socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
tuple pointToPoint
Definition: first.py:28
void SetStopTime(Time stop)
Specify application stop time.
Definition: application.cc:74
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
an Inet address class
tuple devices
Definition: first.py:32
NodeContainer n1n2
Definition: red-tests.cc:63
holds a vector of std::pair of Ptr and interface index.
hold variables of type string
Definition: string.h:18
NetDeviceContainer Install(NodeContainer c)
A suite of tests to run.
Definition: test.h:1105
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
bool IsRunning(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
Definition: event-id.cc:59
Build a set of PointToPointNetDevice objects.
void CwndChange(uint32_t oldCwnd, uint32_t newCwnd)
encapsulates test code
Definition: test.h:929
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
a polymophic address class
Definition: address.h:86
A simple way to store test vectors (for stimulus or from responses)
Definition: test.h:1167
virtual void StopApplication(void)
Application specific shutdown code.
tuple nodes
Definition: first.py:25
Class for representing data rates.
Definition: data-rate.h:71
TestVectors< CwndEvent > m_responses
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
void InstallAll(void) const
Aggregate IPv4, IPv6, UDP, and TCP stacks to all nodes in the simulation.
The base class for all ns3 applications.
Definition: application.h:60
hold objects of type ns3::Time
Definition: nstime.h:1008
virtual void StartApplication(void)
Application specific startup code.
Hold an unsigned integer type.
Definition: uinteger.h:46
#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:148
tuple interfaces
Definition: first.py:40
holds a vector of ns3::NetDevice pointers
virtual void DoRun(void)
Implementation to actually run this TestCase.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1242
Ns3TcpCwndTestSuite ns3TcpCwndTestSuite
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
void VerifyCwndRun(uint32_t beginIdx, uint32_t endIdx, uint32_t initialCwnd, uint32_t mss)
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: object-base.cc:284
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:667
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
keep track of a set of node pointers.
void SetTcp(std::string tid)
set the Tcp stack which will not need any other parameter.
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:235
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
TestVectors< CwndEvent > m_responses
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Definition: test.cc:184
tuple stack
Definition: first.py:34
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
an identifier for simulation events.
Definition: event-id.h:46
hold objects of type ns3::DataRate
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
void Setup(Ptr< Socket > socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate)
NodeContainer n2n3
Definition: red-tests.cc:64
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
tuple address
Definition: first.py:37
void CwndChange(uint32_t oldCwnd, uint32_t newCwnd)
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual int Close(void)=0
Close a socket.
void SetStartTime(Time start)
Specify application start time.
Definition: application.cc:68
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const