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 () << 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/SojournTime", 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.1f;
236  float simDuration = 60; //in seconds
237 
238  std::string fileNamePrefix = "codel-vs-pfifo-fast-asymmetric";
239  bool logging = true;
240 
241  CommandLine cmd (__FILE__);
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::MaxSize",
285  Config::SetDefault ("ns3::CoDelQueueDisc::MaxSize",
287 
288  // Create the nodes
289  NS_LOG_INFO ("Create nodes");
291  nodes.Create (4);
292  // Descriptive names
293  Names::Add ("server", nodes.Get (0));
294  Names::Add ("cmts", nodes.Get (1));
295  Names::Add ("router", nodes.Get (2));
296  Names::Add ("host", nodes.Get (3));
297  NodeContainer serverCmts;
298  serverCmts = NodeContainer (nodes.Get (0), nodes.Get (1));
299  NodeContainer cmtsRouter;
300  cmtsRouter = NodeContainer (nodes.Get (1), nodes.Get (2));
301  NodeContainer routerHost;
302  routerHost = NodeContainer (nodes.Get (2), nodes.Get (3));
303 
304  // Enable checksum
305  if (isPcapEnabled)
306  {
307  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
308  }
309 
310  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (pktSize));
311 
312  NS_LOG_INFO ("Create channels and install net devices on nodes");
313  PointToPointHelper p2p;
314 
315  p2p.SetChannelAttribute ("Delay", StringValue (serverCmtsDelay));
316  NetDeviceContainer serverCmtsDev = p2p.Install (serverCmts);
317  Names::Add ("server/lan", serverCmtsDev.Get (0));
318  Names::Add ("cmts/lan", serverCmtsDev.Get (1));
319  Ptr<PointToPointNetDevice> serverLanDev = DynamicCast<PointToPointNetDevice> (serverCmtsDev.Get (0));
320  serverLanDev->SetAttribute ("DataRate", StringValue (serverLanDataRate));
321  Ptr<PointToPointNetDevice> cmtsLanDev = DynamicCast<PointToPointNetDevice> (serverCmtsDev.Get (1));
322  cmtsLanDev->SetAttribute ("DataRate", StringValue (cmtsLanDataRate));
323 
324  p2p.SetChannelAttribute ("Delay", StringValue (cmtsRouterDelay));
325  NetDeviceContainer cmtsRouterDev = p2p.Install (cmtsRouter);
326  Names::Add ("cmts/wan", cmtsRouterDev.Get (0));
327  Names::Add ("router/wan", cmtsRouterDev.Get (1));
328  Ptr<PointToPointNetDevice> cmtsWanDev = DynamicCast<PointToPointNetDevice> (cmtsRouterDev.Get (0));
329  cmtsWanDev->SetAttribute ("DataRate", StringValue (cmtsWanDataRate));
330  Ptr<PointToPointNetDevice> routerWanDev = DynamicCast<PointToPointNetDevice> (cmtsRouterDev.Get (1));
331  routerWanDev->SetAttribute ("DataRate", StringValue (routerWanDataRate));
332 
333  p2p.SetChannelAttribute ("Delay", StringValue (routerHostDelay));
334  NetDeviceContainer routerHostDev = p2p.Install (routerHost);
335  Names::Add ("router/lan", routerHostDev.Get (0));
336  Names::Add ("host/lan", routerHostDev.Get (1));
337  Ptr<PointToPointNetDevice> routerLanDev = DynamicCast<PointToPointNetDevice> (routerHostDev.Get (0));
338  routerLanDev->SetAttribute ("DataRate", StringValue (routerLanDataRate));
339  Ptr<PointToPointNetDevice> hostLanDev = DynamicCast<PointToPointNetDevice> (routerHostDev.Get (1));
340  hostLanDev->SetAttribute ("DataRate", StringValue (hostLanDataRate));
341 
342  NS_LOG_INFO ("Install Internet stack on all nodes");
344  stack.InstallAll ();
345 
346  TrafficControlHelper tchPfifo;
347  tchPfifo.SetRootQueueDisc ("ns3::PfifoFastQueueDisc");
348 
349  TrafficControlHelper tchCoDel;
350  tchCoDel.SetRootQueueDisc ("ns3::CoDelQueueDisc");
351 
352  tchPfifo.Install (serverCmtsDev);
353  tchPfifo.Install (cmtsWanDev);
354  if (routerWanQueueDiscType.compare ("PfifoFast") == 0)
355  {
356  tchPfifo.Install (routerWanDev);
357  }
358  else if (routerWanQueueDiscType.compare ("CoDel") == 0)
359  {
360  tchCoDel.Install (routerWanDev);
361  }
362  else
363  {
364  NS_LOG_DEBUG ("Invalid router WAN queue disc type");
365  exit (1);
366  }
367  tchPfifo.Install (routerHostDev);
368 
369  NS_LOG_INFO ("Assign IP Addresses");
370  Ipv4AddressHelper ipv4;
371  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
372  Ipv4InterfaceContainer serverCmtsInterface = ipv4.Assign (serverCmtsDev);
373  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
374  Ipv4InterfaceContainer cmtsRouterInterface = ipv4.Assign (cmtsRouterDev);
375  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
376  Ipv4InterfaceContainer routerHostInterface = ipv4.Assign (routerHostDev);
377 
378  NS_LOG_INFO ("Initialize Global Routing");
380 
381  NS_LOG_INFO ("Configure downstream");
382  uint16_t port1 = 50000;
383  Address sinkLocalAddress1 (InetSocketAddress (Ipv4Address::GetAny (), port1));
384  PacketSinkHelper sinkHelper1 ("ns3::TcpSocketFactory", sinkLocalAddress1);
385  ApplicationContainer sinkApp1 = sinkHelper1.Install (routerHost.Get (1));
386  sinkApp1.Start (Seconds (0));
387  sinkApp1.Stop (Seconds (stopTime));
388  AddressValue remoteAddress1 (InetSocketAddress (routerHostInterface.GetAddress (1), port1));
389  while (numOfDownLoadBulkFlows)
390  {
391  CreateBulkFlow (remoteAddress1, serverCmts.Get (0), pktSize, stopTime);
392  numOfDownLoadBulkFlows--;
393  }
394 
395  while (numOfDownLoadOnOffFlows)
396  {
397  CreateOnOffFlow (remoteAddress1, serverCmts.Get (0), stopTime);
398  numOfDownLoadOnOffFlows--;
399  }
400 
401  NS_LOG_INFO ("Configure upstream");
402  uint16_t port2 = 50001;
403  Address sinkLocalAddress2 (InetSocketAddress (Ipv4Address::GetAny (), port2));
404  PacketSinkHelper sinkHelper2 ("ns3::TcpSocketFactory", sinkLocalAddress2);
405  ApplicationContainer sinkApp2 = sinkHelper2.Install (serverCmts.Get (0));
406  sinkApp2.Start (Seconds (0));
407  sinkApp2.Stop (Seconds (stopTime));
408  AddressValue remoteAddress2 (InetSocketAddress (serverCmtsInterface.GetAddress (0), port2));
409  while (numOfUpLoadBulkFlows)
410  {
411  CreateBulkFlow (remoteAddress2, routerHost.Get (1), pktSize, stopTime);
412  numOfUpLoadBulkFlows--;
413  }
414 
415  while (numOfUpLoadOnOffFlows)
416  {
417  CreateOnOffFlow (remoteAddress2, routerHost.Get (1), stopTime);
418  numOfUpLoadOnOffFlows--;
419  }
420 
421  Simulator::Schedule (Seconds (0.00001), &TraceCwnd, cwndTrFileName);
422  TraceEveryDrop (everyDropTrFileName);
423  if (routerWanQueueDiscType.compare ("CoDel") == 0)
424  {
425  TraceSojourn (sojournTrFileName);
426  TraceQueueLength (queueLengthTrFileName);
427  TraceDroppingState (dropStateTrFileName);
428  }
429  if (isPcapEnabled)
430  {
431  p2p.EnablePcapAll (pcapFileName);
432  }
433 
434  // Output config store to txt format
435  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (attributeFileName));
436  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
437  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
438  ConfigStore outputConfig;
439  outputConfig.ConfigureDefaults ();
440  outputConfig.ConfigureAttributes ();
441 
443  Simulator::Run ();
444 
446  return 0;
447 }
holds a vector of ns3::Application pointers.
Introspection did not find any typical Config paths.
Definition: config-store.h:59
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Manage ASCII trace files for device models.
Definition: trace-helper.h:162
an Inet address class
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
QueueDiscContainer Install(NetDeviceContainer c)
Class for representing queue sizes.
Definition: queue-size.h:94
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
holds a vector of std::pair of Ptr<Ipv4> 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
NetDeviceContainer Install(NodeContainer c)
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
void CreateBulkFlow(AddressValue remoteAddress, Ptr< Node > sender, uint32_t pktSize, float stopTime)
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
aggregate IP/TCP/UDP functionality to existing Nodes.
void CreateOnOffFlow(AddressValue remoteAddress, Ptr< Node > sender, float stopTime)
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
cmd
Definition: second.py:35
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&#39;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
stack
Definition: first.py:41
static void SojournTracer(Ptr< OutputStreamWrapper >stream, Time newval)
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<Object> obj.
Definition: names.cc:768
static void DroppingStateTracer(Ptr< OutputStreamWrapper >stream, bool oldVal, bool newVal)
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
nodes
Definition: first.py:32
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 ...
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
Definition: uinteger.h:44
double startTime
Use number of packets for queue size.
Definition: queue-size.h:44
holds a vector of ns3::NetDevice pointers
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:901
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...
Time stopTime
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:227
static void CwndTracer(Ptr< OutputStreamWrapper >stream, uint32_t oldval, uint32_t newval)
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...
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
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.
static void TraceSojourn(std::string sojournTrFileName)
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
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...
LOG_FUNCTION and above.
Definition: log.h:110
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes...
uint32_t pktSize
packet size used for the simulation (in bytes)
Definition: wifi-bianchi.cc:86
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
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.