A Discrete-Event Network Simulator
API
codel-vs-pfifo-asymmetric.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 ResiliNets, ITTC, University of Kansas
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Truc Anh N Nguyen <trucanh524@gmail.com>
18  * Modified by: Pasquale Imputato <p.imputato@gmail.com>
19  *
20  */
21 
22 /*
23  * This is an example that compares CoDel and PfifoFast queues using a
24  * typical cable modem topology and delay
25  * (total RTT 37 ms as measured by Measuring Broadband America)
26  *
27  * 10gigE 22 Mb/s gigE
28  * 15 ms 1 ms 0.1 ms
29  * -------- ------- (1) -------- -------
30  * | |------>| |------>| |------->| |
31  * |server| |CMTS | |Router| |Host |
32  * | |<------| |<------| |<-------| |
33  * -------- -------- (2)-------- -------
34  * 10gigE 5 Mb/s gigE
35  * 15 ms 6 ms 0.1 ms
36  *
37  * (1) PfifoFast queue , 256K bytes
38  * (2) PfifoFast, CoDel
39  *
40  * The server initiates a bulk send TCP transfer to the host.
41  * The host initiates a bulk send TCP transfer to the server.
42  * Also, isochronous traffic (VoIP-like) between server and host
43  * The default TCP version in ns-3, TcpNewReno, is used as the transport-layer
44  * protocol.
45  * Packets transmitted during a simulation run are captured into a .pcap file,
46  * and congestion window values are also traced.
47  */
48 
49 #include "ns3/applications-module.h"
50 #include "ns3/config-store.h"
51 #include "ns3/core-module.h"
52 #include "ns3/enum.h"
53 #include "ns3/error-model.h"
54 #include "ns3/event-id.h"
55 #include "ns3/internet-module.h"
56 #include "ns3/ipv4-global-routing-helper.h"
57 #include "ns3/network-module.h"
58 #include "ns3/point-to-point-module.h"
59 #include "ns3/tcp-header.h"
60 #include "ns3/traffic-control-module.h"
61 #include "ns3/udp-header.h"
62 
63 #include <fstream>
64 #include <iostream>
65 #include <string>
66 
67 using namespace ns3;
68 
69 NS_LOG_COMPONENT_DEFINE("CoDelPfifoFastAsymmetricTest");
70 
78 static void
79 CwndTracer(Ptr<OutputStreamWrapper> stream, uint32_t oldval, uint32_t newval)
80 {
81  *stream->GetStream() << oldval << " " << newval << std::endl;
82 }
83 
89 static void
90 TraceCwnd(std::string cwndTrFileName)
91 {
92  AsciiTraceHelper ascii;
93  if (cwndTrFileName.empty())
94  {
95  NS_LOG_DEBUG("No trace file for cwnd provided");
96  return;
97  }
98  else
99  {
100  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(cwndTrFileName);
102  "/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
103  MakeBoundCallback(&CwndTracer, stream));
104  }
105 }
106 
113 static void
115 {
116  *stream->GetStream() << newval << std::endl;
117 }
118 
124 static void
125 TraceSojourn(std::string sojournTrFileName)
126 {
127  AsciiTraceHelper ascii;
128  if (sojournTrFileName.empty())
129  {
130  NS_LOG_DEBUG("No trace file for sojourn provided");
131  return;
132  }
133  else
134  {
135  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(sojournTrFileName);
136  Config::ConnectWithoutContext("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/"
137  "$ns3::CoDelQueueDisc/SojournTime",
138  MakeBoundCallback(&SojournTracer, stream));
139  }
140 }
141 
149 static void
150 QueueLengthTracer(Ptr<OutputStreamWrapper> stream, uint32_t oldval, uint32_t newval)
151 {
152  *stream->GetStream() << oldval << " " << newval << std::endl;
153 }
154 
160 static void
161 TraceQueueLength(std::string queueLengthTrFileName)
162 {
163  AsciiTraceHelper ascii;
164  if (queueLengthTrFileName.empty())
165  {
166  NS_LOG_DEBUG("No trace file for queue length provided");
167  return;
168  }
169  else
170  {
171  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(queueLengthTrFileName);
173  "/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/BytesInQueue",
175  }
176 }
177 
184 static void
186 {
187  *stream->GetStream() << Simulator::Now().GetSeconds() << " " << item << std::endl;
188 }
189 
195 static void
196 TraceEveryDrop(std::string everyDropTrFileName)
197 {
198  AsciiTraceHelper ascii;
199  if (everyDropTrFileName.empty())
200  {
201  NS_LOG_DEBUG("No trace file for every drop event provided");
202  return;
203  }
204  else
205  {
206  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(everyDropTrFileName);
208  "/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/Drop",
210  }
211 }
212 
220 static void
221 DroppingStateTracer(Ptr<OutputStreamWrapper> stream, bool oldVal, bool newVal)
222 {
223  if (!oldVal && newVal)
224  {
225  NS_LOG_INFO("Entering the dropping state");
226  *stream->GetStream() << Simulator::Now().GetSeconds() << " ";
227  }
228  else if (oldVal && !newVal)
229  {
230  NS_LOG_INFO("Leaving the dropping state");
231  *stream->GetStream() << Simulator::Now().GetSeconds() << std::endl;
232  }
233 }
234 
240 static void
241 TraceDroppingState(std::string dropStateTrFileName)
242 {
243  AsciiTraceHelper ascii;
244  if (dropStateTrFileName.empty())
245  {
246  NS_LOG_DEBUG("No trace file for dropping state provided");
247  return;
248  }
249  else
250  {
251  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(dropStateTrFileName);
252  Config::ConnectWithoutContext("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/"
253  "$ns3::CoDelQueueDisc/DropState",
255  }
256 }
257 
266 void
267 CreateBulkFlow(AddressValue remoteAddress, Ptr<Node> sender, uint32_t pktSize, float stopTime)
268 {
269  BulkSendHelper sourceHelper("ns3::TcpSocketFactory", Address());
270  sourceHelper.SetAttribute("Remote", remoteAddress);
271  sourceHelper.SetAttribute("SendSize", UintegerValue(pktSize));
272  sourceHelper.SetAttribute("MaxBytes", UintegerValue(0));
273  ApplicationContainer sourceApp = sourceHelper.Install(sender);
274  sourceApp.Start(Seconds(0));
275  sourceApp.Stop(Seconds(stopTime - 3));
276 }
277 
285 void
286 CreateOnOffFlow(AddressValue remoteAddress, Ptr<Node> sender, float stopTime)
287 {
288  OnOffHelper sourceHelper("ns3::UdpSocketFactory", Address());
289  sourceHelper.SetAttribute("PacketSize", UintegerValue(280));
290  sourceHelper.SetAttribute("Remote", remoteAddress);
291  ApplicationContainer sourceApp = sourceHelper.Install(sender);
292  sourceApp.Start(Seconds(0));
293  sourceApp.Stop(Seconds(stopTime - 3));
294 }
295 
296 int
297 main(int argc, char* argv[])
298 {
299  std::string serverCmtsDelay = "15ms";
300  std::string cmtsRouterDelay = "6ms";
301  std::string routerHostDelay = "0.1ms";
302  std::string serverLanDataRate = "10Gbps";
303  std::string cmtsLanDataRate = "10Gbps";
304  std::string cmtsWanDataRate = "22Mbps";
305  std::string routerWanDataRate = "5Mbps";
306  std::string routerLanDataRate = "10Gbps";
307  std::string hostLanDataRate = "10Gbps";
308 
309  std::string routerWanQueueDiscType = "CoDel"; // outbound cable router queue
310  uint32_t pktSize = 1458; // in bytes. 1458 to prevent fragments
311  uint32_t queueSize = 1000; // in packets
312  uint32_t numOfUpLoadBulkFlows = 1; // # of upload bulk transfer flows
313  uint32_t numOfDownLoadBulkFlows = 1; // # of download bulk transfer flows
314  uint32_t numOfUpLoadOnOffFlows = 1; // # of upload onoff flows
315  uint32_t numOfDownLoadOnOffFlows = 1; // # of download onoff flows
316  bool isPcapEnabled = true;
317 
318  float startTime = 0.1F;
319  float simDuration = 60; // in seconds
320 
321  std::string fileNamePrefix = "codel-vs-pfifo-fast-asymmetric";
322  bool logging = true;
323 
324  CommandLine cmd(__FILE__);
325  cmd.AddValue("serverCmtsDelay", "Link delay between server and CMTS", serverCmtsDelay);
326  cmd.AddValue("cmtsRouterDelay", "Link delay between CMTS and rounter", cmtsRouterDelay);
327  cmd.AddValue("routerHostDelay", "Link delay between router and host", routerHostDelay);
328  cmd.AddValue("serverLanDataRate", "Server LAN net device data rate", serverLanDataRate);
329  cmd.AddValue("cmtsLanDataRate", "CMTS LAN net device data rate", cmtsLanDataRate);
330  cmd.AddValue("cmtsWanDataRate", "CMTS WAN net device data rate", cmtsWanDataRate);
331  cmd.AddValue("routerWanDataRate", "Router WAN net device data rate", routerWanDataRate);
332  cmd.AddValue("routerLanDataRate", "Router LAN net device data rate", routerLanDataRate);
333  cmd.AddValue("hostLanDataRate", "Host LAN net device data rate", hostLanDataRate);
334  cmd.AddValue("routerWanQueueDiscType",
335  "Router WAN queue disc type: "
336  "PfifoFast, CoDel",
337  routerWanQueueDiscType);
338  cmd.AddValue("queueSize", "Queue size in packets", queueSize);
339  cmd.AddValue("pktSize", "Packet size in bytes", pktSize);
340  cmd.AddValue("numOfUpLoadBulkFlows",
341  "Number of upload bulk transfer flows",
342  numOfUpLoadBulkFlows);
343  cmd.AddValue("numOfDownLoadBulkFlows",
344  "Number of download bulk transfer flows",
345  numOfDownLoadBulkFlows);
346  cmd.AddValue("numOfUpLoadOnOffFlows", "Number of upload OnOff flows", numOfUpLoadOnOffFlows);
347  cmd.AddValue("numOfDownLoadOnOffFlows",
348  "Number of download OnOff flows",
349  numOfDownLoadOnOffFlows);
350  cmd.AddValue("startTime", "Simulation start time", startTime);
351  cmd.AddValue("simDuration", "Simulation duration in seconds", simDuration);
352  cmd.AddValue("isPcapEnabled", "Flag to enable/disable pcap", isPcapEnabled);
353  cmd.AddValue("logging", "Flag to enable/disable logging", logging);
354  cmd.Parse(argc, argv);
355 
356  float stopTime = startTime + simDuration;
357 
358  std::string pcapFileName = fileNamePrefix + "-" + routerWanQueueDiscType;
359  std::string cwndTrFileName = fileNamePrefix + "-" + routerWanQueueDiscType + "-cwnd" + ".tr";
360  std::string attributeFileName = fileNamePrefix + "-" + routerWanQueueDiscType + ".attr";
361  std::string sojournTrFileName =
362  fileNamePrefix + "-" + routerWanQueueDiscType + "-sojourn" + ".tr";
363  std::string queueLengthTrFileName =
364  fileNamePrefix + "-" + routerWanQueueDiscType + "-length" + ".tr";
365  std::string everyDropTrFileName =
366  fileNamePrefix + "-" + routerWanQueueDiscType + "-drop" + ".tr";
367  std::string dropStateTrFileName =
368  fileNamePrefix + "-" + routerWanQueueDiscType + "-drop-state" + ".tr";
369  if (logging)
370  {
371  // LogComponentEnable ("CoDelPfifoFastAsymmetricTest", LOG_LEVEL_ALL);
372  // LogComponentEnable ("BulkSendApplication", LOG_LEVEL_INFO);
373  // LogComponentEnable ("PfifoFastQueue", LOG_LEVEL_ALL);
374  LogComponentEnable("CoDelQueueDisc", LOG_LEVEL_FUNCTION);
375  }
376 
377  // Queue defaults
378  Config::SetDefault("ns3::PfifoFastQueueDisc::MaxSize",
379  QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueSize)));
380  Config::SetDefault("ns3::CoDelQueueDisc::MaxSize",
381  QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueSize)));
382 
383  // Create the nodes
384  NS_LOG_INFO("Create nodes");
386  nodes.Create(4);
387  // Descriptive names
388  Names::Add("server", nodes.Get(0));
389  Names::Add("cmts", nodes.Get(1));
390  Names::Add("router", nodes.Get(2));
391  Names::Add("host", nodes.Get(3));
392  NodeContainer serverCmts;
393  serverCmts = NodeContainer(nodes.Get(0), nodes.Get(1));
394  NodeContainer cmtsRouter;
395  cmtsRouter = NodeContainer(nodes.Get(1), nodes.Get(2));
396  NodeContainer routerHost;
397  routerHost = NodeContainer(nodes.Get(2), nodes.Get(3));
398 
399  // Enable checksum
400  if (isPcapEnabled)
401  {
402  GlobalValue::Bind("ChecksumEnabled", BooleanValue(true));
403  }
404 
405  Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(pktSize));
406 
407  NS_LOG_INFO("Create channels and install net devices on nodes");
409 
410  p2p.SetChannelAttribute("Delay", StringValue(serverCmtsDelay));
411  NetDeviceContainer serverCmtsDev = p2p.Install(serverCmts);
412  Names::Add("server/lan", serverCmtsDev.Get(0));
413  Names::Add("cmts/lan", serverCmtsDev.Get(1));
414  Ptr<PointToPointNetDevice> serverLanDev =
415  DynamicCast<PointToPointNetDevice>(serverCmtsDev.Get(0));
416  serverLanDev->SetAttribute("DataRate", StringValue(serverLanDataRate));
417  Ptr<PointToPointNetDevice> cmtsLanDev =
418  DynamicCast<PointToPointNetDevice>(serverCmtsDev.Get(1));
419  cmtsLanDev->SetAttribute("DataRate", StringValue(cmtsLanDataRate));
420 
421  p2p.SetChannelAttribute("Delay", StringValue(cmtsRouterDelay));
422  NetDeviceContainer cmtsRouterDev = p2p.Install(cmtsRouter);
423  Names::Add("cmts/wan", cmtsRouterDev.Get(0));
424  Names::Add("router/wan", cmtsRouterDev.Get(1));
425  Ptr<PointToPointNetDevice> cmtsWanDev =
426  DynamicCast<PointToPointNetDevice>(cmtsRouterDev.Get(0));
427  cmtsWanDev->SetAttribute("DataRate", StringValue(cmtsWanDataRate));
428  Ptr<PointToPointNetDevice> routerWanDev =
429  DynamicCast<PointToPointNetDevice>(cmtsRouterDev.Get(1));
430  routerWanDev->SetAttribute("DataRate", StringValue(routerWanDataRate));
431 
432  p2p.SetChannelAttribute("Delay", StringValue(routerHostDelay));
433  NetDeviceContainer routerHostDev = p2p.Install(routerHost);
434  Names::Add("router/lan", routerHostDev.Get(0));
435  Names::Add("host/lan", routerHostDev.Get(1));
436  Ptr<PointToPointNetDevice> routerLanDev =
437  DynamicCast<PointToPointNetDevice>(routerHostDev.Get(0));
438  routerLanDev->SetAttribute("DataRate", StringValue(routerLanDataRate));
439  Ptr<PointToPointNetDevice> hostLanDev =
440  DynamicCast<PointToPointNetDevice>(routerHostDev.Get(1));
441  hostLanDev->SetAttribute("DataRate", StringValue(hostLanDataRate));
442 
443  NS_LOG_INFO("Install Internet stack on all nodes");
445  stack.InstallAll();
446 
447  TrafficControlHelper tchPfifo;
448  tchPfifo.SetRootQueueDisc("ns3::PfifoFastQueueDisc");
449 
450  TrafficControlHelper tchCoDel;
451  tchCoDel.SetRootQueueDisc("ns3::CoDelQueueDisc");
452 
453  tchPfifo.Install(serverCmtsDev);
454  tchPfifo.Install(cmtsWanDev);
455  if (routerWanQueueDiscType == "PfifoFast")
456  {
457  tchPfifo.Install(routerWanDev);
458  }
459  else if (routerWanQueueDiscType == "CoDel")
460  {
461  tchCoDel.Install(routerWanDev);
462  }
463  else
464  {
465  NS_LOG_DEBUG("Invalid router WAN queue disc type");
466  exit(1);
467  }
468  tchPfifo.Install(routerHostDev);
469 
470  NS_LOG_INFO("Assign IP Addresses");
472  ipv4.SetBase("10.1.1.0", "255.255.255.0");
473  Ipv4InterfaceContainer serverCmtsInterface = ipv4.Assign(serverCmtsDev);
474  ipv4.SetBase("10.1.2.0", "255.255.255.0");
475  Ipv4InterfaceContainer cmtsRouterInterface = ipv4.Assign(cmtsRouterDev);
476  ipv4.SetBase("10.1.3.0", "255.255.255.0");
477  Ipv4InterfaceContainer routerHostInterface = ipv4.Assign(routerHostDev);
478 
479  NS_LOG_INFO("Initialize Global Routing");
481 
482  NS_LOG_INFO("Configure downstream");
483  uint16_t port1 = 50000;
484  Address sinkLocalAddress1(InetSocketAddress(Ipv4Address::GetAny(), port1));
485  PacketSinkHelper sinkHelper1("ns3::TcpSocketFactory", sinkLocalAddress1);
486  ApplicationContainer sinkApp1 = sinkHelper1.Install(routerHost.Get(1));
487  sinkApp1.Start(Seconds(0));
488  sinkApp1.Stop(Seconds(stopTime));
489  AddressValue remoteAddress1(InetSocketAddress(routerHostInterface.GetAddress(1), port1));
490  while (numOfDownLoadBulkFlows)
491  {
492  CreateBulkFlow(remoteAddress1, serverCmts.Get(0), pktSize, stopTime);
493  numOfDownLoadBulkFlows--;
494  }
495 
496  while (numOfDownLoadOnOffFlows)
497  {
498  CreateOnOffFlow(remoteAddress1, serverCmts.Get(0), stopTime);
499  numOfDownLoadOnOffFlows--;
500  }
501 
502  NS_LOG_INFO("Configure upstream");
503  uint16_t port2 = 50001;
504  Address sinkLocalAddress2(InetSocketAddress(Ipv4Address::GetAny(), port2));
505  PacketSinkHelper sinkHelper2("ns3::TcpSocketFactory", sinkLocalAddress2);
506  ApplicationContainer sinkApp2 = sinkHelper2.Install(serverCmts.Get(0));
507  sinkApp2.Start(Seconds(0));
508  sinkApp2.Stop(Seconds(stopTime));
509  AddressValue remoteAddress2(InetSocketAddress(serverCmtsInterface.GetAddress(0), port2));
510  while (numOfUpLoadBulkFlows)
511  {
512  CreateBulkFlow(remoteAddress2, routerHost.Get(1), pktSize, stopTime);
513  numOfUpLoadBulkFlows--;
514  }
515 
516  while (numOfUpLoadOnOffFlows)
517  {
518  CreateOnOffFlow(remoteAddress2, routerHost.Get(1), stopTime);
519  numOfUpLoadOnOffFlows--;
520  }
521 
522  Simulator::Schedule(Seconds(0.00001), &TraceCwnd, cwndTrFileName);
523  TraceEveryDrop(everyDropTrFileName);
524  if (routerWanQueueDiscType == "CoDel")
525  {
526  TraceSojourn(sojournTrFileName);
527  TraceQueueLength(queueLengthTrFileName);
528  TraceDroppingState(dropStateTrFileName);
529  }
530  if (isPcapEnabled)
531  {
532  p2p.EnablePcapAll(pcapFileName);
533  }
534 
535  // Output config store to txt format
536  Config::SetDefault("ns3::ConfigStore::Filename", StringValue(attributeFileName));
537  Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("RawText"));
538  Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
539  ConfigStore outputConfig;
540  outputConfig.ConfigureDefaults();
541  outputConfig.ConfigureAttributes();
542 
544  Simulator::Run();
545 
547  return 0;
548 }
a polymophic address class
Definition: address.h:101
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Manage ASCII trace files for device models.
Definition: trace-helper.h:174
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.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
Parse command-line arguments.
Definition: command-line.h:232
void ConfigureDefaults()
Configure the default values.
void ConfigureAttributes()
Configure the attribute values.
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...
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static Ipv4Address GetAny()
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
Definition: names.cc:775
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:44
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
std::ostream * GetStream()
Return a pointer to an ostream previously set in the wrapper.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Build a set of PointToPointNetDevice objects.
Class for representing queue sizes.
Definition: queue-size.h:96
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static void Run()
Run the simulation.
Definition: simulator.cc:178
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
Hold variables of type string.
Definition: string.h:56
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:403
Build a set of QueueDisc objects.
QueueDiscContainer Install(NetDeviceContainer c)
uint16_t SetRootQueueDisc(const std::string &type, Args &&... args)
Helper function used to set a root queue disc of the given type and with the given attributes.
Hold an unsigned integer type.
Definition: uinteger.h:45
static void TraceCwnd(std::string cwndTrFileName)
Setup for TCP congestion window tracking.
static void SojournTracer(Ptr< OutputStreamWrapper > stream, Time newval)
Traffic Control Sojourn tracker.
static void TraceDroppingState(std::string dropStateTrFileName)
Setup for Traffic Control dropping tracking.
void CreateBulkFlow(AddressValue remoteAddress, Ptr< Node > sender, uint32_t pktSize, float stopTime)
Create a Bulk Flow application.
static void CwndTracer(Ptr< OutputStreamWrapper > stream, uint32_t oldval, uint32_t newval)
TCP Congestion window tracker.
static void DroppingStateTracer(Ptr< OutputStreamWrapper > stream, bool oldVal, bool newVal)
Traffic Control Dropping state trace.
static void EveryDropTracer(Ptr< OutputStreamWrapper > stream, Ptr< const QueueDiscItem > item)
Traffic control drop trace.
void CreateOnOffFlow(AddressValue remoteAddress, Ptr< Node > sender, float stopTime)
Create a On Off Flow application.
static void TraceSojourn(std::string sojournTrFileName)
Setup for Traffic Control Sojourn time tracking.
static void TraceEveryDrop(std::string everyDropTrFileName)
Setup for Traffic Control drop tracking.
static void TraceQueueLength(std::string queueLengthTrFileName)
Setup for Traffic Control Queue length tracking.
static void QueueLengthTracer(Ptr< OutputStreamWrapper > stream, uint32_t oldval, uint32_t newval)
Traffic Control Queue length tracker.
Time stopTime
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:890
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:950
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:765
@ PACKETS
Use number of packets for queue size.
Definition: queue-size.h:45
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
NodeContainer nodes
stack
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:302
@ LOG_LEVEL_FUNCTION
LOG_FUNCTION and above.
Definition: log.h:107
cmd
Definition: second.py:40
std::ofstream queueSize
uint32_t pktSize
packet size used for the simulation (in bytes)