A Discrete-Event Network Simulator
API
codel-vs-droptail-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  *
20  */
21 
22 /*
23  * This is an example that compares CoDel and DropTail 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) DropTail queue , 256K bytes
38  * (2) DropTail, CoDel, FqCoDel, SfqCoDel, etc.
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 <iostream>
50 #include <fstream>
51 #include <string>
52 
53 #include "ns3/core-module.h"
54 #include "ns3/network-module.h"
55 #include "ns3/internet-module.h"
56 #include "ns3/point-to-point-module.h"
57 #include "ns3/applications-module.h"
58 #include "ns3/config-store-module.h"
59 #include "ns3/error-model.h"
60 #include "ns3/tcp-header.h"
61 #include "ns3/udp-header.h"
62 #include "ns3/enum.h"
63 #include "ns3/event-id.h"
64 #include "ns3/ipv4-global-routing-helper.h"
65 
66 using namespace ns3;
67 
68 NS_LOG_COMPONENT_DEFINE ("CoDelDropTailAsymmetricTest");
69 
70 static void
71 CwndTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
72 {
73  *stream->GetStream () << oldval << " " << newval << std::endl;
74 }
75 
76 static void
77 TraceCwnd (std::string cwndTrFileName)
78 {
79  AsciiTraceHelper ascii;
80  if (cwndTrFileName.compare ("") == 0)
81  {
82  NS_LOG_DEBUG ("No trace file for cwnd provided");
83  return;
84  }
85  else
86  {
87  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (cwndTrFileName.c_str ());
88  Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",MakeBoundCallback (&CwndTracer, stream));
89  }
90 }
91 
92 static void
94 {
95  *stream->GetStream () << oldval << " " << newval << std::endl;
96 }
97 
98 static void
99 TraceSojourn (std::string sojournTrFileName)
100 {
101  AsciiTraceHelper ascii;
102  if (sojournTrFileName.compare ("") == 0)
103  {
104  NS_LOG_DEBUG ("No trace file for sojourn provided");
105  return;
106  }
107  else
108  {
109  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (sojournTrFileName.c_str ());
110  Config::ConnectWithoutContext ("/NodeList/2/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/$ns3::CoDelQueue/Sojourn", MakeBoundCallback (&SojournTracer, stream));
111  }
112 }
113 
114 static void
115 QueueLengthTracer (Ptr<OutputStreamWrapper>stream, uint32_t oldval, uint32_t newval)
116 {
117  *stream->GetStream () << oldval << " " << newval << std::endl;
118 }
119 
120 static void
121 TraceQueueLength (std::string queueLengthTrFileName)
122 {
123  AsciiTraceHelper ascii;
124  if (queueLengthTrFileName.compare ("") == 0)
125  {
126  NS_LOG_DEBUG ("No trace file for queue length provided");
127  return;
128  }
129  else
130  {
131  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (queueLengthTrFileName.c_str ());
132  Config::ConnectWithoutContext ("/NodeList/2/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/$ns3::CoDelQueue/BytesInQueue", MakeBoundCallback (&QueueLengthTracer, stream));
133  }
134 }
135 
136 static void
138 {
139  *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << p << std::endl;
140 }
141 
142 static void
143 TraceEveryDrop (std::string everyDropTrFileName)
144 {
145  AsciiTraceHelper ascii;
146  if (everyDropTrFileName.compare ("") == 0)
147  {
148  NS_LOG_DEBUG ("No trace file for every drop event provided");
149  return;
150  }
151  else
152  {
153  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (everyDropTrFileName.c_str ());
154  Config::ConnectWithoutContext ("/NodeList/2/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/Drop", MakeBoundCallback (&EveryDropTracer, stream));
155  }
156 }
157 
158 static void
159 DroppingStateTracer (Ptr<OutputStreamWrapper>stream, bool oldVal, bool newVal)
160 {
161  if (oldVal == false && newVal == true)
162  {
163  NS_LOG_INFO ("Entering the dropping state");
164  *stream->GetStream () << Simulator::Now ().GetSeconds () << " ";
165  }
166  else if (oldVal == true && newVal == false)
167  {
168  NS_LOG_INFO ("Leaving the dropping state");
169  *stream->GetStream () << Simulator::Now ().GetSeconds () << std::endl;
170  }
171 }
172 
173 static void
174 TraceDroppingState (std::string dropStateTrFileName)
175 {
176  AsciiTraceHelper ascii;
177  if (dropStateTrFileName.compare ("") == 0)
178  {
179  NS_LOG_DEBUG ("No trace file for dropping state provided");
180  return;
181  }
182  else
183  {
184  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream (dropStateTrFileName.c_str ());
185  Config::ConnectWithoutContext ("/NodeList/2/DeviceList/1/$ns3::PointToPointNetDevice/TxQueue/$ns3::CoDelQueue/DropState", MakeBoundCallback (&DroppingStateTracer, stream));
186  }
187 }
188 
189 void
190 CreateBulkFlow (AddressValue remoteAddress, Ptr<Node> sender, uint32_t pktSize, float stopTime)
191 {
192  BulkSendHelper sourceHelper ("ns3::TcpSocketFactory", Address ());
193  sourceHelper.SetAttribute ("Remote", remoteAddress);
194  sourceHelper.SetAttribute ("SendSize", UintegerValue (pktSize));
195  sourceHelper.SetAttribute ("MaxBytes", UintegerValue (0));
196  ApplicationContainer sourceApp = sourceHelper.Install (sender);
197  sourceApp.Start (Seconds (0));
198  sourceApp.Stop (Seconds (stopTime - 3));
199 }
200 
201 void
202 CreateOnOffFlow (AddressValue remoteAddress, Ptr<Node> sender, float stopTime)
203 {
204  OnOffHelper sourceHelper ("ns3::UdpSocketFactory", Address ());
205  sourceHelper.SetAttribute ("PacketSize", UintegerValue (280));
206  sourceHelper.SetAttribute ("Remote", remoteAddress);
207  ApplicationContainer sourceApp = sourceHelper.Install (sender);
208  sourceApp.Start (Seconds (0));
209  sourceApp.Stop (Seconds (stopTime - 3));
210 }
211 
212 int main (int argc, char *argv[])
213 {
214  std::string serverCmtsDelay = "15ms";
215  std::string cmtsRouterDelay = "6ms";
216  std::string routerHostDelay = "0.1ms";
217  std::string serverLanDataRate = "10Gbps";
218  std::string cmtsLanDataRate = "10Gbps";
219  std::string cmtsWanDataRate = "22Mbps";
220  std::string routerWanDataRate = "5Mbps";
221  std::string routerLanDataRate = "10Gbps";
222  std::string hostLanDataRate = "10Gbps";
223 
224  std::string routerWanQueueType = "CoDel"; // outbound cable router queue
225  uint32_t pktSize = 1458; // in bytes. 1458 to prevent fragments
226  uint32_t queueSize = 1000; // in packets
227  uint32_t numOfUpLoadBulkFlows = 1; // # of upload bulk transfer flows
228  uint32_t numOfDownLoadBulkFlows = 1; // # of download bulk transfer flows
229  uint32_t numOfUpLoadOnOffFlows = 1; // # of upload onoff flows
230  uint32_t numOfDownLoadOnOffFlows = 1; // # of download onoff flows
231  bool isPcapEnabled = true;
232 
233  float startTime = 0.1;
234  float simDuration = 60; //in seconds
235 
236  std::string fileNamePrefix = "codel-vs-droptail-asymmetric";
237  bool logging = true;
238 
240  cmd.AddValue ("serverCmtsDelay", "Link delay between server and CMTS", serverCmtsDelay);
241  cmd.AddValue ("cmtsRouterDelay", "Link delay between CMTS and rounter", cmtsRouterDelay);
242  cmd.AddValue ("routerHostDelay", "Link delay between router and host", routerHostDelay);
243  cmd.AddValue ("serverLanDataRate", "Server LAN net device data rate", serverLanDataRate);
244  cmd.AddValue ("cmtsLanDataRate", "CMTS LAN net device data rate", cmtsLanDataRate);
245  cmd.AddValue ("cmtsWanDataRate", "CMTS WAN net device data rate", cmtsWanDataRate);
246  cmd.AddValue ("routerWanDataRate", "Router WAN net device data rate", routerWanDataRate);
247  cmd.AddValue ("routerLanDataRate", "Router LAN net device data rate", routerLanDataRate);
248  cmd.AddValue ("hostLanDataRate", "Host LAN net device data rate", hostLanDataRate);
249  cmd.AddValue ("routerWanQueueType", "Router WAN net device queue type", routerWanQueueType);
250  cmd.AddValue ("queueSize", "Queue size in packets", queueSize);
251  cmd.AddValue ("pktSize", "Packet size in bytes", pktSize);
252  cmd.AddValue ("numOfUpLoadBulkFlows", "Number of upload bulk transfer flows", numOfUpLoadBulkFlows);
253  cmd.AddValue ("numOfDownLoadBulkFlows", "Number of download bulk transfer flows", numOfDownLoadBulkFlows);
254  cmd.AddValue ("numOfUpLoadOnOffFlows", "Number of upload OnOff flows", numOfUpLoadOnOffFlows);
255  cmd.AddValue ("numOfDownLoadOnOffFlows", "Number of download OnOff flows", numOfDownLoadOnOffFlows);
256  cmd.AddValue ("startTime", "Simulation start time", startTime);
257  cmd.AddValue ("simDuration", "Simulation duration in seconds", simDuration);
258  cmd.AddValue ("isPcapEnabled", "Flag to enable/disable pcap", isPcapEnabled);
259  cmd.AddValue ("logging", "Flag to enable/disable logging", logging);
260  cmd.Parse (argc, argv);
261 
262  float stopTime = startTime + simDuration;
263 
264  std::string pcapFileName = fileNamePrefix + "-" + routerWanQueueType;
265  std::string cwndTrFileName = fileNamePrefix + "-" + routerWanQueueType + "-cwnd" + ".tr";
266  std::string attributeFileName = fileNamePrefix + "-" + routerWanQueueType + ".attr";
267  std::string sojournTrFileName = fileNamePrefix + "-" + routerWanQueueType + "-sojourn" + ".tr";
268  std::string queueLengthTrFileName = fileNamePrefix + "-" + routerWanQueueType + "-length" + ".tr";
269  std::string everyDropTrFileName = fileNamePrefix + "-" + routerWanQueueType + "-drop" + ".tr";
270  std::string dropStateTrFileName = fileNamePrefix + "-" + routerWanQueueType + "-drop-state" + ".tr";
271  if (logging)
272  {
273  //LogComponentEnable ("CoDelDropTailAsymmetricTest", LOG_LEVEL_ALL);
274  //LogComponentEnable ("BulkSendApplication", LOG_LEVEL_INFO);
275  //LogComponentEnable ("DropTailQueue", LOG_LEVEL_ALL);
276  LogComponentEnable ("CoDelQueue", LOG_LEVEL_FUNCTION);
277  }
278 
279  // Queue defaults
280  Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (queueSize));
281  Config::SetDefault ("ns3::CoDelQueue::MaxPackets", UintegerValue (queueSize));
282  Config::SetDefault ("ns3::DropTailQueue::Mode", StringValue ("QUEUE_MODE_PACKETS"));
283  Config::SetDefault ("ns3::CoDelQueue::Mode", StringValue ("QUEUE_MODE_PACKETS"));
284 
285  // Create the nodes
286  NS_LOG_INFO ("Create nodes");
288  nodes.Create (4);
289  // Descriptive names
290  Names::Add ("server", nodes.Get (0));
291  Names::Add ("cmts", nodes.Get (1));
292  Names::Add ("router", nodes.Get (2));
293  Names::Add ("host", nodes.Get (3));
294  NodeContainer serverCmts;
295  serverCmts = NodeContainer (nodes.Get (0), nodes.Get (1));
296  NodeContainer cmtsRouter;
297  cmtsRouter = NodeContainer (nodes.Get (1), nodes.Get (2));
298  NodeContainer routerHost;
299  routerHost = NodeContainer (nodes.Get (2), nodes.Get (3));
300 
301  // Enable checksum
302  if (isPcapEnabled)
303  {
304  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
305  }
306 
307  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (pktSize));
308 
309  NS_LOG_INFO ("Install Internet stack on all nodes");
311  stack.InstallAll ();
312 
313  NS_LOG_INFO ("Create channels and install net devices on nodes");
314  PointToPointHelper p2p;
315 
316  p2p.SetChannelAttribute ("Delay", StringValue (serverCmtsDelay));
317  NetDeviceContainer serverCmtsDev = p2p.Install (serverCmts);
318  Names::Add ("server/lan", serverCmtsDev.Get (0));
319  Names::Add ("cmts/lan", serverCmtsDev.Get (1));
320  Ptr<PointToPointNetDevice> serverLanDev = DynamicCast<PointToPointNetDevice> (serverCmtsDev.Get (0));
321  serverLanDev->SetAttribute ("DataRate", StringValue (serverLanDataRate));
322  Ptr<PointToPointNetDevice> cmtsLanDev = DynamicCast<PointToPointNetDevice> (serverCmtsDev.Get (1));
323  cmtsLanDev->SetAttribute ("DataRate", StringValue (cmtsLanDataRate));
324 
325  p2p.SetChannelAttribute ("Delay", StringValue (cmtsRouterDelay));
326  NetDeviceContainer cmtsRouterDev = p2p.Install (cmtsRouter);
327  Names::Add ("cmts/wan", cmtsRouterDev.Get (0));
328  Names::Add ("router/wan", cmtsRouterDev.Get (1));
329  Ptr<PointToPointNetDevice> cmtsWanDev = DynamicCast<PointToPointNetDevice> (cmtsRouterDev.Get (0));
330  cmtsWanDev->SetAttribute ("DataRate", StringValue (cmtsWanDataRate));
331  Ptr<Queue> queue = cmtsWanDev->GetQueue ();
332  DynamicCast<DropTailQueue> (queue)->SetMode (DropTailQueue::QUEUE_MODE_BYTES);
333  DynamicCast<DropTailQueue> (queue)->SetAttribute ("MaxBytes", UintegerValue (256000));
334 
335  Ptr<PointToPointNetDevice> routerWanDev = DynamicCast<PointToPointNetDevice> (cmtsRouterDev.Get (1));
336  routerWanDev->SetAttribute ("DataRate", StringValue (routerWanDataRate));
337  if (routerWanQueueType.compare ("DropTail") == 0)
338  {
339  Ptr<Queue> dropTail = CreateObject<DropTailQueue> ();
340  routerWanDev->SetQueue (dropTail);
341  }
342  else if (routerWanQueueType.compare ("CoDel") == 0)
343  {
344  Ptr<Queue> codel = CreateObject<CoDelQueue> ();
345  routerWanDev->SetQueue (codel);
346  }
347 
348  p2p.SetChannelAttribute ("Delay", StringValue (routerHostDelay));
349  NetDeviceContainer routerHostDev = p2p.Install (routerHost);
350  Names::Add ("router/lan", routerHostDev.Get (0));
351  Names::Add ("host/lan", routerHostDev.Get (1));
352  Ptr<PointToPointNetDevice> routerLanDev = DynamicCast<PointToPointNetDevice> (routerHostDev.Get (0));
353  routerLanDev->SetAttribute ("DataRate", StringValue (routerLanDataRate));
354  Ptr<PointToPointNetDevice> hostLanDev = DynamicCast<PointToPointNetDevice> (routerHostDev.Get (1));
355  hostLanDev->SetAttribute ("DataRate", StringValue (hostLanDataRate));
356 
357  NS_LOG_INFO ("Assign IP Addresses");
358  Ipv4AddressHelper ipv4;
359  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
360  Ipv4InterfaceContainer serverCmtsInterface = ipv4.Assign (serverCmtsDev);
361  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
362  Ipv4InterfaceContainer cmtsRouterInterface = ipv4.Assign (cmtsRouterDev);
363  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
364  Ipv4InterfaceContainer routerHostInterface = ipv4.Assign (routerHostDev);
365 
366  NS_LOG_INFO ("Initialize Global Routing");
368 
369  NS_LOG_INFO ("Configure downstream");
370  uint16_t port1 = 50000;
371  Address sinkLocalAddress1 (InetSocketAddress (Ipv4Address::GetAny (), port1));
372  PacketSinkHelper sinkHelper1 ("ns3::TcpSocketFactory", sinkLocalAddress1);
373  ApplicationContainer sinkApp1 = sinkHelper1.Install (routerHost.Get (1));
374  sinkApp1.Start (Seconds (0));
375  sinkApp1.Stop (Seconds (stopTime));
376  AddressValue remoteAddress1 (InetSocketAddress (routerHostInterface.GetAddress (1), port1));
377  while (numOfDownLoadBulkFlows)
378  {
379  CreateBulkFlow (remoteAddress1, serverCmts.Get (0), pktSize, stopTime);
380  numOfDownLoadBulkFlows--;
381  }
382 
383  while (numOfDownLoadOnOffFlows)
384  {
385  CreateOnOffFlow (remoteAddress1, serverCmts.Get (0), stopTime);
386  numOfDownLoadOnOffFlows--;
387  }
388 
389  NS_LOG_INFO ("Configure upstream");
390  uint16_t port2 = 50001;
391  Address sinkLocalAddress2 (InetSocketAddress (Ipv4Address::GetAny (), port2));
392  PacketSinkHelper sinkHelper2 ("ns3::TcpSocketFactory", sinkLocalAddress2);
393  ApplicationContainer sinkApp2 = sinkHelper2.Install (serverCmts.Get (0));
394  sinkApp2.Start (Seconds (0));
395  sinkApp2.Stop (Seconds (stopTime));
396  AddressValue remoteAddress2 (InetSocketAddress (serverCmtsInterface.GetAddress (0), port2));
397  while (numOfUpLoadBulkFlows)
398  {
399  CreateBulkFlow (remoteAddress2, routerHost.Get (1), pktSize, stopTime);
400  numOfUpLoadBulkFlows--;
401  }
402 
403  while (numOfUpLoadOnOffFlows)
404  {
405  CreateOnOffFlow (remoteAddress2, routerHost.Get (1), stopTime);
406  numOfUpLoadOnOffFlows--;
407  }
408 
409  Simulator::Schedule (Seconds (0.00001), &TraceCwnd, cwndTrFileName);
410  TraceEveryDrop (everyDropTrFileName);
411  if (routerWanQueueType.compare ("CoDel") == 0)
412  {
413  TraceSojourn (sojournTrFileName);
414  TraceQueueLength (queueLengthTrFileName);
415  TraceDroppingState (dropStateTrFileName);
416  }
417  if (isPcapEnabled)
418  {
419  p2p.EnablePcapAll (pcapFileName);
420  }
421 
422  // Output config store to txt format
423  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue (attributeFileName));
424  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
425  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
426  ConfigStore outputConfig;
427  outputConfig.ConfigureDefaults ();
428  outputConfig.ConfigureAttributes ();
429 
430  Simulator::Stop (Seconds (stopTime));
431  Simulator::Run ();
432 
434  return 0;
435 }
holds a vector of ns3::Application pointers.
Introspection did not find any typical Config paths.
Definition: config-store.h:54
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Manage ASCII trace files for device models.
Definition: trace-helper.h:155
an Inet address class
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
Definition: boolean.h:34
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
void CreateBulkFlow(AddressValue remoteAddress, Ptr< Node > sender, uint32_t pktSize, float stopTime)
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)
static void TraceQueueLength(std::string queueLengthTrFileName)
Use number of bytes for maximum queue size.
Definition: queue.h:129
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1677
static void DroppingStateTracer(Ptr< OutputStreamWrapper >stream, bool oldVal, bool newVal)
static void Run(void)
Run the simulation.
Definition: simulator.cc:200
#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.
static void TraceCwnd(std::string cwndTrFileName)
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:244
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
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.
static void SojournTracer(Ptr< OutputStreamWrapper >stream, Time oldval, Time newval)
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:694
void CreateOnOffFlow(AddressValue remoteAddress, Ptr< Node > sender, float stopTime)
tuple nodes
Definition: first.py:25
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:351
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:1216
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:824
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...
Parse command-line arguments.
Definition: command-line.h:201
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:164
static void TraceEveryDrop(std::string everyDropTrFileName)
void ConfigureDefaults(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static void QueueLengthTracer(Ptr< OutputStreamWrapper >stream, uint32_t oldval, uint32_t newval)
keep track of a set of node pointers.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
tuple stack
Definition: first.py:34
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
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)
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
static void TraceSojourn(std::string sojournTrFileName)
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:491
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:208
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:236
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
static void TraceDroppingState(std::string dropStateTrFileName)
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...
static void CwndTracer(Ptr< OutputStreamWrapper >stream, uint32_t oldval, uint32_t newval)
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:191
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
static void EveryDropTracer(Ptr< OutputStreamWrapper >stream, Ptr< const Packet > p)
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