A Discrete-Event Network Simulator
API
codel-vs-pfifo-asymmetric.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 ResiliNets, ITTC, University of Kansas
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  * Author: Truc Anh N Nguyen <trucanh524@gmail.com>
19  * Modified by: Pasquale Imputato <p.imputato@gmail.com>
20  *
21  */
22 
23 /*
24  * This is an example that compares CoDel and PfifoFast queues using a
25  * typical cable modem topology and delay
26  * (total RTT 37 ms as measured by Measuring Broadband America)
27  *
28  * 10gigE 22 Mb/s gigE
29  * 15 ms 1 ms 0.1 ms
30  * -------- ------- (1) -------- -------
31  * | |------>| |------>| |------->| |
32  * |server| |CMTS | |Router| |Host |
33  * | |<------| |<------| |<-------| |
34  * -------- -------- (2)-------- -------
35  * 10gigE 5 Mb/s gigE
36  * 15 ms 6 ms 0.1 ms
37  *
38  * (1) PfifoFast queue , 256K bytes
39  * (2) PfifoFast, CoDel
40  *
41  * The server initiates a bulk send TCP transfer to the host.
42  * The host initiates a bulk send TCP transfer to the server.
43  * Also, isochronous traffic (VoIP-like) between server and host
44  * The default TCP version in ns-3, TcpNewReno, is used as the transport-layer
45  * protocol.
46  * Packets transmitted during a simulation run are captured into a .pcap file,
47  * and congestion window values are also traced.
48  */
49 
50 #include <iostream>
51 #include <fstream>
52 #include <string>
53 
54 #include "ns3/core-module.h"
55 #include "ns3/network-module.h"
56 #include "ns3/internet-module.h"
57 #include "ns3/point-to-point-module.h"
58 #include "ns3/applications-module.h"
59 #include "ns3/config-store-module.h"
60 #include "ns3/error-model.h"
61 #include "ns3/tcp-header.h"
62 #include "ns3/udp-header.h"
63 #include "ns3/enum.h"
64 #include "ns3/event-id.h"
65 #include "ns3/ipv4-global-routing-helper.h"
66 #include "ns3/traffic-control-module.h"
67 
68 using namespace ns3;
69 
70 NS_LOG_COMPONENT_DEFINE ("CoDelPfifoFastAsymmetricTest");
71 
72 static void
73 CwndTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
74 {
75  *stream->GetStream () << oldval << " " << newval << std::endl;
76 }
77 
78 static void
79 TraceCwnd (std::string cwndTrFileName)
80 {
81  AsciiTraceHelper ascii;
82  if (cwndTrFileName.compare ("") == 0)
83  {
84  NS_LOG_DEBUG ("No trace file for cwnd provided");
85  return;
86  }
87  else
88  {
89  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (cwndTrFileName.c_str ());
90  Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",MakeBoundCallback (&CwndTracer, stream));
91  }
92 }
93 
94 static void
96 {
97  *stream->GetStream () << oldval << " " << newval << std::endl;
98 }
99 
100 static void
101 TraceSojourn (std::string sojournTrFileName)
102 {
103  AsciiTraceHelper ascii;
104  if (sojournTrFileName.compare ("") == 0)
105  {
106  NS_LOG_DEBUG ("No trace file for sojourn provided");
107  return;
108  }
109  else
110  {
111  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (sojournTrFileName.c_str ());
112  Config::ConnectWithoutContext ("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/$ns3::CoDelQueueDisc/Sojourn", MakeBoundCallback (&SojournTracer, stream));
113  }
114 }
115 
116 static void
117 QueueLengthTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
118 {
119  *stream->GetStream () << oldval << " " << newval << std::endl;
120 }
121 
122 static void
123 TraceQueueLength (std::string queueLengthTrFileName)
124 {
125  AsciiTraceHelper ascii;
126  if (queueLengthTrFileName.compare ("") == 0)
127  {
128  NS_LOG_DEBUG ("No trace file for queue length provided");
129  return;
130  }
131  else
132  {
133  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (queueLengthTrFileName.c_str ());
134  Config::ConnectWithoutContext ("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/BytesInQueue", MakeBoundCallback (&QueueLengthTracer, stream));
135  }
136 }
137 
138 static void
140 {
141  *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << item << std::endl;
142 }
143 
144 static void
145 TraceEveryDrop (std::string everyDropTrFileName)
146 {
147  AsciiTraceHelper ascii;
148  if (everyDropTrFileName.compare ("") == 0)
149  {
150  NS_LOG_DEBUG ("No trace file for every drop event provided");
151  return;
152  }
153  else
154  {
155  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (everyDropTrFileName.c_str ());
156  Config::ConnectWithoutContext ("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/Drop", MakeBoundCallback (&EveryDropTracer, stream));
157  }
158 }
159 
160 static void
161 DroppingStateTracer (Ptr<OutputStreamWrapper>stream, bool oldVal, bool newVal)
162 {
163  if (oldVal == false && newVal == true)
164  {
165  NS_LOG_INFO ("Entering the dropping state");
166  *stream->GetStream () << Simulator::Now ().GetSeconds () << " ";
167  }
168  else if (oldVal == true && newVal == false)
169  {
170  NS_LOG_INFO ("Leaving the dropping state");
171  *stream->GetStream () << Simulator::Now ().GetSeconds () << std::endl;
172  }
173 }
174 
175 static void
176 TraceDroppingState (std::string dropStateTrFileName)
177 {
178  AsciiTraceHelper ascii;
179  if (dropStateTrFileName.compare ("") == 0)
180  {
181  NS_LOG_DEBUG ("No trace file for dropping state provided");
182  return;
183  }
184  else
185  {
186  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (dropStateTrFileName.c_str ());
187  Config::ConnectWithoutContext ("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/$ns3::CoDelQueueDisc/DropState", MakeBoundCallback (&DroppingStateTracer, stream));
188  }
189 }
190 
191 void
192 CreateBulkFlow (AddressValue remoteAddress, Ptr<Node> sender, uint32_t pktSize, float stopTime)
193 {
194  BulkSendHelper sourceHelper ("ns3::TcpSocketFactory", Address ());
195  sourceHelper.SetAttribute ("Remote", remoteAddress);
196  sourceHelper.SetAttribute ("SendSize", UintegerValue (pktSize));
197  sourceHelper.SetAttribute ("MaxBytes", UintegerValue (0));
198  ApplicationContainer sourceApp = sourceHelper.Install (sender);
199  sourceApp.Start (Seconds (0));
200  sourceApp.Stop (Seconds (stopTime - 3));
201 }
202 
203 void
204 CreateOnOffFlow (AddressValue remoteAddress, Ptr<Node> sender, float stopTime)
205 {
206  OnOffHelper sourceHelper ("ns3::UdpSocketFactory", Address ());
207  sourceHelper.SetAttribute ("PacketSize", UintegerValue (280));
208  sourceHelper.SetAttribute ("Remote", remoteAddress);
209  ApplicationContainer sourceApp = sourceHelper.Install (sender);
210  sourceApp.Start (Seconds (0));
211  sourceApp.Stop (Seconds (stopTime - 3));
212 }
213 
214 int main (int argc, char *argv[])
215 {
216  std::string serverCmtsDelay = "15ms";
217  std::string cmtsRouterDelay = "6ms";
218  std::string routerHostDelay = "0.1ms";
219  std::string serverLanDataRate = "10Gbps";
220  std::string cmtsLanDataRate = "10Gbps";
221  std::string cmtsWanDataRate = "22Mbps";
222  std::string routerWanDataRate = "5Mbps";
223  std::string routerLanDataRate = "10Gbps";
224  std::string hostLanDataRate = "10Gbps";
225 
226  std::string routerWanQueueDiscType = "CoDel"; // outbound cable router queue
227  uint32_t pktSize = 1458; // in bytes. 1458 to prevent fragments
228  uint32_t queueSize = 1000; // in packets
229  uint32_t numOfUpLoadBulkFlows = 1; // # of upload bulk transfer flows
230  uint32_t numOfDownLoadBulkFlows = 1; // # of download bulk transfer flows
231  uint32_t numOfUpLoadOnOffFlows = 1; // # of upload onoff flows
232  uint32_t numOfDownLoadOnOffFlows = 1; // # of download onoff flows
233  bool isPcapEnabled = true;
234 
235  float startTime = 0.1;
236  float simDuration = 60; //in seconds
237 
238  std::string fileNamePrefix = "codel-vs-pfifo-fast-asymmetric";
239  bool logging = true;
240 
242  cmd.AddValue ("serverCmtsDelay", "Link delay between server and CMTS", serverCmtsDelay);
243  cmd.AddValue ("cmtsRouterDelay", "Link delay between CMTS and rounter", cmtsRouterDelay);
244  cmd.AddValue ("routerHostDelay", "Link delay between router and host", routerHostDelay);
245  cmd.AddValue ("serverLanDataRate", "Server LAN net device data rate", serverLanDataRate);
246  cmd.AddValue ("cmtsLanDataRate", "CMTS LAN net device data rate", cmtsLanDataRate);
247  cmd.AddValue ("cmtsWanDataRate", "CMTS WAN net device data rate", cmtsWanDataRate);
248  cmd.AddValue ("routerWanDataRate", "Router WAN net device data rate", routerWanDataRate);
249  cmd.AddValue ("routerLanDataRate", "Router LAN net device data rate", routerLanDataRate);
250  cmd.AddValue ("hostLanDataRate", "Host LAN net device data rate", hostLanDataRate);
251  cmd.AddValue ("routerWanQueueDiscType", "Router WAN queue disc type: "
252  "PfifoFast, CoDel", routerWanQueueDiscType);
253  cmd.AddValue ("queueSize", "Queue size in packets", queueSize);
254  cmd.AddValue ("pktSize", "Packet size in bytes", pktSize);
255  cmd.AddValue ("numOfUpLoadBulkFlows", "Number of upload bulk transfer flows", numOfUpLoadBulkFlows);
256  cmd.AddValue ("numOfDownLoadBulkFlows", "Number of download bulk transfer flows", numOfDownLoadBulkFlows);
257  cmd.AddValue ("numOfUpLoadOnOffFlows", "Number of upload OnOff flows", numOfUpLoadOnOffFlows);
258  cmd.AddValue ("numOfDownLoadOnOffFlows", "Number of download OnOff flows", numOfDownLoadOnOffFlows);
259  cmd.AddValue ("startTime", "Simulation start time", startTime);
260  cmd.AddValue ("simDuration", "Simulation duration in seconds", simDuration);
261  cmd.AddValue ("isPcapEnabled", "Flag to enable/disable pcap", isPcapEnabled);
262  cmd.AddValue ("logging", "Flag to enable/disable logging", logging);
263  cmd.Parse (argc, argv);
264 
265  float stopTime = startTime + simDuration;
266 
267  std::string pcapFileName = fileNamePrefix + "-" + routerWanQueueDiscType;
268  std::string cwndTrFileName = fileNamePrefix + "-" + routerWanQueueDiscType + "-cwnd" + ".tr";
269  std::string attributeFileName = fileNamePrefix + "-" + routerWanQueueDiscType + ".attr";
270  std::string sojournTrFileName = fileNamePrefix + "-" + routerWanQueueDiscType + "-sojourn" + ".tr";
271  std::string queueLengthTrFileName = fileNamePrefix + "-" + routerWanQueueDiscType + "-length" + ".tr";
272  std::string everyDropTrFileName = fileNamePrefix + "-" + routerWanQueueDiscType + "-drop" + ".tr";
273  std::string dropStateTrFileName = fileNamePrefix + "-" + routerWanQueueDiscType + "-drop-state" + ".tr";
274  if (logging)
275  {
276  //LogComponentEnable ("CoDelPfifoFastAsymmetricTest", LOG_LEVEL_ALL);
277  //LogComponentEnable ("BulkSendApplication", LOG_LEVEL_INFO);
278  //LogComponentEnable ("PfifoFastQueue", LOG_LEVEL_ALL);
279  LogComponentEnable ("CoDelQueueDisc", LOG_LEVEL_FUNCTION);
280  }
281 
282  // Queue defaults
283  Config::SetDefault ("ns3::PfifoFastQueueDisc::Limit", UintegerValue (queueSize));
284  Config::SetDefault ("ns3::CoDelQueueDisc::MaxPackets", UintegerValue (queueSize));
285  Config::SetDefault ("ns3::CoDelQueueDisc::Mode", StringValue ("QUEUE_DISC_MODE_PACKETS"));
286 
287  // Create the nodes
288  NS_LOG_INFO ("Create nodes");
290  nodes.Create (4);
291  // Descriptive names
292  Names::Add ("server", nodes.Get (0));
293  Names::Add ("cmts", nodes.Get (1));
294  Names::Add ("router", nodes.Get (2));
295  Names::Add ("host", nodes.Get (3));
296  NodeContainer serverCmts;
297  serverCmts = NodeContainer (nodes.Get (0), nodes.Get (1));
298  NodeContainer cmtsRouter;
299  cmtsRouter = NodeContainer (nodes.Get (1), nodes.Get (2));
300  NodeContainer routerHost;
301  routerHost = NodeContainer (nodes.Get (2), nodes.Get (3));
302 
303  // Enable checksum
304  if (isPcapEnabled)
305  {
306  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
307  }
308 
309  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (pktSize));
310 
311  NS_LOG_INFO ("Create channels and install net devices on nodes");
312  PointToPointHelper p2p;
313 
314  p2p.SetChannelAttribute ("Delay", StringValue (serverCmtsDelay));
315  NetDeviceContainer serverCmtsDev = p2p.Install (serverCmts);
316  Names::Add ("server/lan", serverCmtsDev.Get (0));
317  Names::Add ("cmts/lan", serverCmtsDev.Get (1));
318  Ptr<PointToPointNetDevice> serverLanDev = DynamicCast<PointToPointNetDevice> (serverCmtsDev.Get (0));
319  serverLanDev->SetAttribute ("DataRate", StringValue (serverLanDataRate));
320  Ptr<PointToPointNetDevice> cmtsLanDev = DynamicCast<PointToPointNetDevice> (serverCmtsDev.Get (1));
321  cmtsLanDev->SetAttribute ("DataRate", StringValue (cmtsLanDataRate));
322 
323  p2p.SetChannelAttribute ("Delay", StringValue (cmtsRouterDelay));
324  NetDeviceContainer cmtsRouterDev = p2p.Install (cmtsRouter);
325  Names::Add ("cmts/wan", cmtsRouterDev.Get (0));
326  Names::Add ("router/wan", cmtsRouterDev.Get (1));
327  Ptr<PointToPointNetDevice> cmtsWanDev = DynamicCast<PointToPointNetDevice> (cmtsRouterDev.Get (0));
328  cmtsWanDev->SetAttribute ("DataRate", StringValue (cmtsWanDataRate));
329  Ptr<PointToPointNetDevice> routerWanDev = DynamicCast<PointToPointNetDevice> (cmtsRouterDev.Get (1));
330  routerWanDev->SetAttribute ("DataRate", StringValue (routerWanDataRate));
331 
332  p2p.SetChannelAttribute ("Delay", StringValue (routerHostDelay));
333  NetDeviceContainer routerHostDev = p2p.Install (routerHost);
334  Names::Add ("router/lan", routerHostDev.Get (0));
335  Names::Add ("host/lan", routerHostDev.Get (1));
336  Ptr<PointToPointNetDevice> routerLanDev = DynamicCast<PointToPointNetDevice> (routerHostDev.Get (0));
337  routerLanDev->SetAttribute ("DataRate", StringValue (routerLanDataRate));
338  Ptr<PointToPointNetDevice> hostLanDev = DynamicCast<PointToPointNetDevice> (routerHostDev.Get (1));
339  hostLanDev->SetAttribute ("DataRate", StringValue (hostLanDataRate));
340 
341  NS_LOG_INFO ("Install Internet stack on all nodes");
343  stack.InstallAll ();
344 
345  TrafficControlHelper tchPfifo;
346  tchPfifo.SetRootQueueDisc ("ns3::PfifoFastQueueDisc");
347 
348  TrafficControlHelper tchCoDel;
349  tchCoDel.SetRootQueueDisc ("ns3::CoDelQueueDisc");
350 
351  tchPfifo.Install (serverCmtsDev);
352  tchPfifo.Install (cmtsWanDev);
353  if (routerWanQueueDiscType.compare ("PfifoFast") == 0)
354  {
355  tchPfifo.Install (routerWanDev);
356  }
357  else if (routerWanQueueDiscType.compare ("CoDel") == 0)
358  {
359  tchCoDel.Install (routerWanDev);
360  }
361  else
362  {
363  NS_LOG_DEBUG ("Invalid router WAN queue disc type");
364  exit (1);
365  }
366  tchPfifo.Install (routerHostDev);
367 
368  NS_LOG_INFO ("Assign IP Addresses");
369  Ipv4AddressHelper ipv4;
370  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
371  Ipv4InterfaceContainer serverCmtsInterface = ipv4.Assign (serverCmtsDev);
372  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
373  Ipv4InterfaceContainer cmtsRouterInterface = ipv4.Assign (cmtsRouterDev);
374  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
375  Ipv4InterfaceContainer routerHostInterface = ipv4.Assign (routerHostDev);
376 
377  NS_LOG_INFO ("Initialize Global Routing");
379 
380  NS_LOG_INFO ("Configure downstream");
381  uint16_t port1 = 50000;
382  Address sinkLocalAddress1 (InetSocketAddress (Ipv4Address::GetAny (), port1));
383  PacketSinkHelper sinkHelper1 ("ns3::TcpSocketFactory", sinkLocalAddress1);
384  ApplicationContainer sinkApp1 = sinkHelper1.Install (routerHost.Get (1));
385  sinkApp1.Start (Seconds (0));
386  sinkApp1.Stop (Seconds (stopTime));
387  AddressValue remoteAddress1 (InetSocketAddress (routerHostInterface.GetAddress (1), port1));
388  while (numOfDownLoadBulkFlows)
389  {
390  CreateBulkFlow (remoteAddress1, serverCmts.Get (0), pktSize, stopTime);
391  numOfDownLoadBulkFlows--;
392  }
393 
394  while (numOfDownLoadOnOffFlows)
395  {
396  CreateOnOffFlow (remoteAddress1, serverCmts.Get (0), stopTime);
397  numOfDownLoadOnOffFlows--;
398  }
399 
400  NS_LOG_INFO ("Configure upstream");
401  uint16_t port2 = 50001;
402  Address sinkLocalAddress2 (InetSocketAddress (Ipv4Address::GetAny (), port2));
403  PacketSinkHelper sinkHelper2 ("ns3::TcpSocketFactory", sinkLocalAddress2);
404  ApplicationContainer sinkApp2 = sinkHelper2.Install (serverCmts.Get (0));
405  sinkApp2.Start (Seconds (0));
406  sinkApp2.Stop (Seconds (stopTime));
407  AddressValue remoteAddress2 (InetSocketAddress (serverCmtsInterface.GetAddress (0), port2));
408  while (numOfUpLoadBulkFlows)
409  {
410  CreateBulkFlow (remoteAddress2, routerHost.Get (1), pktSize, stopTime);
411  numOfUpLoadBulkFlows--;
412  }
413 
414  while (numOfUpLoadOnOffFlows)
415  {
416  CreateOnOffFlow (remoteAddress2, routerHost.Get (1), stopTime);
417  numOfUpLoadOnOffFlows--;
418  }
419 
420  Simulator::Schedule (Seconds (0.00001), &TraceCwnd, cwndTrFileName);
421  TraceEveryDrop (everyDropTrFileName);
422  if (routerWanQueueDiscType.compare ("CoDel") == 0)
423  {
424  TraceSojourn (sojournTrFileName);
425  TraceQueueLength (queueLengthTrFileName);
426  TraceDroppingState (dropStateTrFileName);
427  }
428  if (isPcapEnabled)
429  {
430  p2p.EnablePcapAll (pcapFileName);
431  }
432 
433  // Output config store to txt format
434  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (attributeFileName));
435  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
436  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
437  ConfigStore outputConfig;
438  outputConfig.ConfigureDefaults ();
439  outputConfig.ConfigureAttributes ();
440 
441  Simulator::Stop (Seconds (stopTime));
442  Simulator::Run ();
443 
445  return 0;
446 }
holds a vector of ns3::Application pointers.
Introspection did not find any typical Config paths.
Definition: config-store.h:59
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Manage ASCII trace files for device models.
Definition: trace-helper.h:161
an Inet address class
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
QueueDiscContainer Install(NetDeviceContainer c)
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
holds a vector of std::pair of Ptr and interface index.
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation.
Hold variables of type string.
Definition: string.h:41
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
void CreateBulkFlow(AddressValue remoteAddress, Ptr< Node > sender, uint32_t pktSize, float stopTime)
static void SojournTracer(Ptr< OutputStreamWrapper >stream, Time oldval, Time newval)
static void Run(void)
Run the simulation.
Definition: simulator.cc:226
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
aggregate IP/TCP/UDP functionality to existing Nodes.
void CreateOnOffFlow(AddressValue remoteAddress, Ptr< Node > sender, float stopTime)
LOG_FUNCTION and above.
Definition: log.h:106
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:277
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
static void QueueLengthTracer(Ptr< OutputStreamWrapper >stream, uint32_t oldval, uint32_t newval)
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
Build a set of PointToPointNetDevice objects.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
tuple cmd
Definition: second.py:35
double stopTime
a polymophic address class
Definition: address.h:90
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr obj.
Definition: names.cc:770
tuple nodes
Definition: first.py:25
static void DroppingStateTracer(Ptr< OutputStreamWrapper >stream, bool oldVal, bool newVal)
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:341
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:369
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 ...
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1375
void InstallAll(void) const
Aggregate IPv4, IPv6, UDP, and TCP stacks to all nodes in the simulation.
Hold an unsigned integer type.
Definition: uinteger.h:44
double startTime
holds a vector of ns3::NetDevice pointers
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:832
static void TraceQueueLength(std::string queueLengthTrFileName)
Build a set of QueueDisc objects.
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
static void EveryDropTracer(Ptr< OutputStreamWrapper >stream, Ptr< const QueueDiscItem > item)
Parse command-line arguments.
Definition: command-line.h:205
static void CwndTracer(Ptr< OutputStreamWrapper >stream, uint32_t oldval, uint32_t newval)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:190
void ConfigureDefaults(void)
Configure the default values.
static void TraceCwnd(std::string cwndTrFileName)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
uint16_t SetRootQueueDisc(std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to set a root queue disc of the given type and with the given attributes...
static void TraceSojourn(std::string sojournTrFileName)
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
tuple stack
Definition: first.py:34
static void TraceEveryDrop(std::string everyDropTrFileName)
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
static void TraceDroppingState(std::string dropStateTrFileName)
AttributeValue implementation for Address.
Definition: address.h:278
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
void ConfigureAttributes(void)
Configure the attribute values.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:498
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:234
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:993
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:782
void Parse(int argc, char *argv[])
Parse the program arguments.
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.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
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