A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3tcp-cwnd-test-suite.cc
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 
91  Ptr<Socket> m_socket;
92  Address m_peer;
93  uint32_t m_packetSize;
94  uint32_t m_nPackets;
95  DataRate m_dataRate;
96  EventId m_sendEvent;
97  bool m_running;
98  uint32_t m_packetsSent;
99 };
100 
101 SimpleSource::SimpleSource ()
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 
113 SimpleSource::~SimpleSource()
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 ();
134  m_socket->Connect (m_peer);
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
155 SimpleSource::SendPacket (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
167 SimpleSource::ScheduleTx (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);
184  bool m_writeResults;
185 
186  class CwndEvent {
187 public:
188  uint32_t m_oldCwnd;
189  uint32_t m_newCwnd;
190  };
191 
192  TestVectors<CwndEvent> m_responses;
193 
194  void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
195 };
196 
197 Ns3TcpCwndTestCase1::Ns3TcpCwndTestCase1 ()
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 
203 Ns3TcpCwndTestCase1::~Ns3TcpCwndTestCase1 ()
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  //
227  NodeContainer nodes;
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  //
235  PointToPointHelper pointToPoint;
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  //
242  NetDeviceContainer devices;
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  //
249  InternetStackHelper stack;
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  //
264  Ipv4AddressHelper address;
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);
388  bool m_writeResults;
389 
390  class CwndEvent {
391 public:
392  uint32_t m_oldCwnd;
393  uint32_t m_newCwnd;
394  };
395 
396  TestVectors<CwndEvent> m_responses;
397 
398  void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
399 };
400 
401 Ns3TcpCwndTestCase2::Ns3TcpCwndTestCase2 ()
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 
407 Ns3TcpCwndTestCase2::~Ns3TcpCwndTestCase2 ()
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 
431  NodeContainer n1n2;
432  n1n2.Add (n0n1.Get (1));
433  n1n2.Create (1);
434 
435  NodeContainer n2n3;
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.4));
489 
490  if (m_writeResults)
491  {
492  // Write a pcap for tcp cwnd testcase with out-of-order delivery
493  PointToPointHelper pointToPoint;
494  pointToPoint.EnablePcapAll ("tcp-cwnd-ood");
495  }
496 
497  // Finally, set up the simulator to run.
498  Simulator::Stop (Seconds (4.4));
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 = 45;
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  //Partial ACK in fast recovery: cwnd set to 4824
536  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (15).m_newCwnd, 9 * MSS, "Wrong new cwnd value in cwnd change event " << 15);
537 
538  //DUP ACKS in fast recovery
539  VerifyCwndRun (16, 17, 10 * MSS, MSS);
540 
541  //Partial ack will end up modifying cwnd 2X due to how code is written, therefore eat 18 and 19
542  //Partial ACK in fast recovery: cwnd set to 4824
543  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (19).m_newCwnd, 9 * MSS, "Wrong new cwnd value in cwnd change event " << 19);
544 
545  //DUP ACKS in fast recovery
546  VerifyCwndRun (20, 22, 10 * MSS, MSS);
547 
548  //Partial ack will end up modifying cwnd 2X due to how code is written, therefore eat 23, 24
549  //Partial ACK in fast recovery: cwnd set to 4824
550  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (24).m_newCwnd, 10 * MSS, "Wrong new cwnd value in cwnd change event " << 24);
551 
552  //DUP ACKS in fast recovery
553  VerifyCwndRun (25, 29, 11 * MSS, MSS);
554 
555  //Leaving fast recovery
556  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (29).m_newCwnd, 5 * MSS, "Wrong new cwnd value in cwnd change event " << 29);
557 
558  uint32_t cwnd = 5 * MSS;
559  //In CongAvoid each event will increase cwnd by (MSS * MSS / cwnd)
560  for (uint32_t i = 30; i < N_EVENTS; ++i)
561  {
562  double adder = static_cast<double> (MSS * MSS) / cwnd;
563  adder = std::max (1.0, adder);
564  cwnd += static_cast<uint32_t> (adder);
565  NS_TEST_ASSERT_MSG_EQ (m_responses.Get (i).m_newCwnd, cwnd, "Wrong new cwnd value in cwnd change event " << i);
566  }
567 }
568 
569 void
570 Ns3TcpCwndTestCase2::VerifyCwndRun (uint32_t beginIdx, uint32_t endIdx, uint32_t initialCwnd, uint32_t mss)
571 {
572 
573  CwndEvent event;
574 
575  for(uint32_t i = beginIdx, to = initialCwnd; i < endIdx; ++i, to += mss)
576  {
577  event = m_responses.Get (i);
578  NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
579  }
580 }
581 
583 {
584 public:
586 };
587 
588 Ns3TcpCwndTestSuite::Ns3TcpCwndTestSuite ()
589  : TestSuite ("ns3-tcp-cwnd", SYSTEM)
590 {
591  AddTestCase (new Ns3TcpCwndTestCase1, TestCase::QUICK);
592  AddTestCase (new Ns3TcpCwndTestCase2, TestCase::QUICK);
593 }
594 
595 Ns3TcpCwndTestSuite ns3TcpCwndTestSuite;
holds a vector of ns3::Application pointers.
uint32_t AddApplication(Ptr< Application > application)
Definition: node.cc:148
void SetStopTime(Time stop)
Specify application stop time.
Definition: application.cc:74
keep track of time unit.
Definition: nstime.h:149
an Inet address class
holds a vector of std::pair of Ptr<Ipv4> and interface index.
hold variables of type string
Definition: string.h:19
NetDeviceContainer Install(NodeContainer c)
A suite of tests to run.
Definition: test.h:962
#define NS_LOG_COMPONENT_DEFINE(name)
Definition: log.h:122
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
Definition: event-id.cc:59
Build a set of PointToPointNetDevice objects.
encapsulates test code
Definition: test.h:834
void SetDeviceAttribute(std::string name, const AttributeValue &value)
a polymophic address class
Definition: address.h:86
A simple way to store test vectors (for stimulus or from responses)
Definition: test.h:1013
virtual void StopApplication(void)
Application specific shutdown code.
Class for representing data rates.
Definition: data-rate.h:71
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 ...
The base class for all ns3 applications.
Definition: application.h:61
hold objects of type ns3::Time
Definition: nstime.h:700
virtual void StartApplication(void)
Application specific startup code.
Hold an unsigned integer type.
Definition: uinteger.h:46
holds a vector of ns3::NetDevice pointers
virtual void DoRun(void)
Implementation to actually run this test case.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:502
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.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: object-base.cc:268
virtual void DoRun(void)
Implementation to actually run this test case.
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
Definition: data-rate.cc:235
void Install(std::string nodeName) const
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
Definition: test.cc:172
void SetChannelAttribute(std::string name, const AttributeValue &value)
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...
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
Definition: nstime.h:586
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<Node> stored in this container at a given index.
ApplicationContainer Install(NodeContainer c) const
Time MilliSeconds(uint64_t ms)
create ns3::Time instances in units of milliseconds.
Definition: nstime.h:601
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.
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