A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
codel-vs-pfifo-asymmetric.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 ResiliNets, ITTC, University of Kansas
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Truc Anh N Nguyen <trucanh524@gmail.com>
7 * Modified by: Pasquale Imputato <p.imputato@gmail.com>
8 *
9 */
10
11/*
12 * This is an example that compares CoDel and PfifoFast queues using a
13 * typical cable modem topology and delay
14 * (total RTT 37 ms as measured by Measuring Broadband America)
15 *
16 * 10gigE 22 Mb/s gigE
17 * 15 ms 1 ms 0.1 ms
18 * -------- ------- (1) -------- -------
19 * | |------>| |------>| |------->| |
20 * |server| |CMTS | |Router| |Host |
21 * | |<------| |<------| |<-------| |
22 * -------- -------- (2)-------- -------
23 * 10gigE 5 Mb/s gigE
24 * 15 ms 6 ms 0.1 ms
25 *
26 * (1) PfifoFast queue , 256K bytes
27 * (2) PfifoFast, CoDel
28 *
29 * The server initiates a bulk send TCP transfer to the host.
30 * The host initiates a bulk send TCP transfer to the server.
31 * Also, isochronous traffic (VoIP-like) between server and host
32 * The default TCP version in ns-3, TcpNewReno, is used as the transport-layer
33 * protocol.
34 * Packets transmitted during a simulation run are captured into a .pcap file,
35 * and congestion window values are also traced.
36 */
37
38#include "ns3/applications-module.h"
39#include "ns3/config-store.h"
40#include "ns3/core-module.h"
41#include "ns3/enum.h"
42#include "ns3/error-model.h"
43#include "ns3/event-id.h"
44#include "ns3/internet-module.h"
45#include "ns3/ipv4-global-routing-helper.h"
46#include "ns3/network-module.h"
47#include "ns3/point-to-point-module.h"
48#include "ns3/tcp-header.h"
49#include "ns3/traffic-control-module.h"
50#include "ns3/udp-header.h"
51
52#include <fstream>
53#include <iostream>
54#include <string>
55
56using namespace ns3;
57
58NS_LOG_COMPONENT_DEFINE("CoDelPfifoFastAsymmetricTest");
59
60/**
61 * TCP Congestion window tracker.
62 *
63 * \param stream The output stream.
64 * \param oldval Old value.
65 * \param newval New value.
66 */
67static void
69{
70 *stream->GetStream() << oldval << " " << newval << std::endl;
71}
72
73/**
74 * Setup for TCP congestion window tracking.
75 *
76 * \param cwndTrFileName Congestion window output file name.
77 */
78static void
79TraceCwnd(std::string cwndTrFileName)
80{
81 AsciiTraceHelper ascii;
82 if (cwndTrFileName.empty())
83 {
84 NS_LOG_DEBUG("No trace file for cwnd provided");
85 return;
86 }
87 else
88 {
89 Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(cwndTrFileName);
91 "/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
93 }
94}
95
96/**
97 * Traffic Control Sojourn tracker.
98 *
99 * \param stream The output stream.
100 * \param newval New value.
101 */
102static void
104{
105 *stream->GetStream() << newval << std::endl;
106}
107
108/**
109 * Setup for Traffic Control Sojourn time tracking.
110 *
111 * \param sojournTrFileName Sojourn time output file name.
112 */
113static void
114TraceSojourn(std::string sojournTrFileName)
115{
116 AsciiTraceHelper ascii;
117 if (sojournTrFileName.empty())
118 {
119 NS_LOG_DEBUG("No trace file for sojourn provided");
120 return;
121 }
122 else
123 {
124 Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(sojournTrFileName);
125 Config::ConnectWithoutContext("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/"
126 "$ns3::CoDelQueueDisc/SojournTime",
128 }
129}
130
131/**
132 * Traffic Control Queue length tracker.
133 *
134 * \param stream The output stream.
135 * \param oldval Old value.
136 * \param newval New value.
137 */
138static void
140{
141 *stream->GetStream() << oldval << " " << newval << std::endl;
142}
143
144/**
145 * Setup for Traffic Control Queue length tracking.
146 *
147 * \param queueLengthTrFileName Queue length output file name.
148 */
149static void
150TraceQueueLength(std::string queueLengthTrFileName)
151{
152 AsciiTraceHelper ascii;
153 if (queueLengthTrFileName.empty())
154 {
155 NS_LOG_DEBUG("No trace file for queue length provided");
156 return;
157 }
158 else
159 {
160 Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(queueLengthTrFileName);
162 "/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/BytesInQueue",
164 }
165}
166
167/**
168 * Traffic control drop trace.
169 *
170 * \param stream The output stream.
171 * \param item The dropped item.
172 */
173static void
175{
176 *stream->GetStream() << Simulator::Now().GetSeconds() << " " << item << std::endl;
177}
178
179/**
180 * Setup for Traffic Control drop tracking.
181 *
182 * \param everyDropTrFileName TC drop output file name.
183 */
184static void
185TraceEveryDrop(std::string everyDropTrFileName)
186{
187 AsciiTraceHelper ascii;
188 if (everyDropTrFileName.empty())
189 {
190 NS_LOG_DEBUG("No trace file for every drop event provided");
191 return;
192 }
193 else
194 {
195 Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(everyDropTrFileName);
197 "/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/Drop",
199 }
200}
201
202/**
203 * Traffic Control Dropping state trace.
204 *
205 * \param stream The output stream.
206 * \param oldVal Old value.
207 * \param newVal New value.
208 */
209static void
210DroppingStateTracer(Ptr<OutputStreamWrapper> stream, bool oldVal, bool newVal)
211{
212 if (!oldVal && newVal)
213 {
214 NS_LOG_INFO("Entering the dropping state");
215 *stream->GetStream() << Simulator::Now().GetSeconds() << " ";
216 }
217 else if (oldVal && !newVal)
218 {
219 NS_LOG_INFO("Leaving the dropping state");
220 *stream->GetStream() << Simulator::Now().GetSeconds() << std::endl;
221 }
222}
223
224/**
225 * Setup for Traffic Control dropping tracking.
226 *
227 * \param dropStateTrFileName TC drop state output file name.
228 */
229static void
230TraceDroppingState(std::string dropStateTrFileName)
231{
232 AsciiTraceHelper ascii;
233 if (dropStateTrFileName.empty())
234 {
235 NS_LOG_DEBUG("No trace file for dropping state provided");
236 return;
237 }
238 else
239 {
240 Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream(dropStateTrFileName);
241 Config::ConnectWithoutContext("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/"
242 "$ns3::CoDelQueueDisc/DropState",
244 }
245}
246
247/**
248 * Create a Bulk Flow application
249 *
250 * \param remoteAddress Remote address.
251 * \param sender Sender node.
252 * \param pktSize Packet size.
253 * \param stopTime Stop time.
254 */
255void
257{
258 BulkSendHelper sourceHelper("ns3::TcpSocketFactory", Address());
259 sourceHelper.SetAttribute("Remote", remoteAddress);
260 sourceHelper.SetAttribute("SendSize", UintegerValue(pktSize));
261 sourceHelper.SetAttribute("MaxBytes", UintegerValue(0));
262 ApplicationContainer sourceApp = sourceHelper.Install(sender);
263 sourceApp.Start(Seconds(0));
264 sourceApp.Stop(Seconds(stopTime - 3));
265}
266
267/**
268 * Create a On Off Flow application.
269 *
270 * \param remoteAddress Remote address.
271 * \param sender Sender node.
272 * \param stopTime Stop time.
273 */
274void
275CreateOnOffFlow(AddressValue remoteAddress, Ptr<Node> sender, float stopTime)
276{
277 OnOffHelper sourceHelper("ns3::UdpSocketFactory", Address());
278 sourceHelper.SetAttribute("PacketSize", UintegerValue(280));
279 sourceHelper.SetAttribute("Remote", remoteAddress);
280 ApplicationContainer sourceApp = sourceHelper.Install(sender);
281 sourceApp.Start(Seconds(0));
282 sourceApp.Stop(Seconds(stopTime - 3));
283}
284
285int
286main(int argc, char* argv[])
287{
288 std::string serverCmtsDelay = "15ms";
289 std::string cmtsRouterDelay = "6ms";
290 std::string routerHostDelay = "0.1ms";
291 std::string serverLanDataRate = "10Gbps";
292 std::string cmtsLanDataRate = "10Gbps";
293 std::string cmtsWanDataRate = "22Mbps";
294 std::string routerWanDataRate = "5Mbps";
295 std::string routerLanDataRate = "10Gbps";
296 std::string hostLanDataRate = "10Gbps";
297
298 std::string routerWanQueueDiscType = "CoDel"; // outbound cable router queue
299 uint32_t pktSize = 1458; // in bytes. 1458 to prevent fragments
300 uint32_t queueSize = 1000; // in packets
301 uint32_t numOfUpLoadBulkFlows = 1; // # of upload bulk transfer flows
302 uint32_t numOfDownLoadBulkFlows = 1; // # of download bulk transfer flows
303 uint32_t numOfUpLoadOnOffFlows = 1; // # of upload onoff flows
304 uint32_t numOfDownLoadOnOffFlows = 1; // # of download onoff flows
305 bool isPcapEnabled = true;
306
307 float startTime = 0.1F;
308 float simDuration = 60; // in seconds
309
310 std::string fileNamePrefix = "codel-vs-pfifo-fast-asymmetric";
311 bool logging = true;
312
313 CommandLine cmd(__FILE__);
314 cmd.AddValue("serverCmtsDelay", "Link delay between server and CMTS", serverCmtsDelay);
315 cmd.AddValue("cmtsRouterDelay", "Link delay between CMTS and rounter", cmtsRouterDelay);
316 cmd.AddValue("routerHostDelay", "Link delay between router and host", routerHostDelay);
317 cmd.AddValue("serverLanDataRate", "Server LAN net device data rate", serverLanDataRate);
318 cmd.AddValue("cmtsLanDataRate", "CMTS LAN net device data rate", cmtsLanDataRate);
319 cmd.AddValue("cmtsWanDataRate", "CMTS WAN net device data rate", cmtsWanDataRate);
320 cmd.AddValue("routerWanDataRate", "Router WAN net device data rate", routerWanDataRate);
321 cmd.AddValue("routerLanDataRate", "Router LAN net device data rate", routerLanDataRate);
322 cmd.AddValue("hostLanDataRate", "Host LAN net device data rate", hostLanDataRate);
323 cmd.AddValue("routerWanQueueDiscType",
324 "Router WAN queue disc type: "
325 "PfifoFast, CoDel",
326 routerWanQueueDiscType);
327 cmd.AddValue("queueSize", "Queue size in packets", queueSize);
328 cmd.AddValue("pktSize", "Packet size in bytes", pktSize);
329 cmd.AddValue("numOfUpLoadBulkFlows",
330 "Number of upload bulk transfer flows",
331 numOfUpLoadBulkFlows);
332 cmd.AddValue("numOfDownLoadBulkFlows",
333 "Number of download bulk transfer flows",
334 numOfDownLoadBulkFlows);
335 cmd.AddValue("numOfUpLoadOnOffFlows", "Number of upload OnOff flows", numOfUpLoadOnOffFlows);
336 cmd.AddValue("numOfDownLoadOnOffFlows",
337 "Number of download OnOff flows",
338 numOfDownLoadOnOffFlows);
339 cmd.AddValue("startTime", "Simulation start time", startTime);
340 cmd.AddValue("simDuration", "Simulation duration in seconds", simDuration);
341 cmd.AddValue("isPcapEnabled", "Flag to enable/disable pcap", isPcapEnabled);
342 cmd.AddValue("logging", "Flag to enable/disable logging", logging);
343 cmd.Parse(argc, argv);
344
345 float stopTime = startTime + simDuration;
346
347 std::string pcapFileName = fileNamePrefix + "-" + routerWanQueueDiscType;
348 std::string cwndTrFileName = fileNamePrefix + "-" + routerWanQueueDiscType + "-cwnd" + ".tr";
349 std::string attributeFileName = fileNamePrefix + "-" + routerWanQueueDiscType + ".attr";
350 std::string sojournTrFileName =
351 fileNamePrefix + "-" + routerWanQueueDiscType + "-sojourn" + ".tr";
352 std::string queueLengthTrFileName =
353 fileNamePrefix + "-" + routerWanQueueDiscType + "-length" + ".tr";
354 std::string everyDropTrFileName =
355 fileNamePrefix + "-" + routerWanQueueDiscType + "-drop" + ".tr";
356 std::string dropStateTrFileName =
357 fileNamePrefix + "-" + routerWanQueueDiscType + "-drop-state" + ".tr";
358 if (logging)
359 {
360 // LogComponentEnable ("CoDelPfifoFastAsymmetricTest", LOG_LEVEL_ALL);
361 // LogComponentEnable ("BulkSendApplication", LOG_LEVEL_INFO);
362 // LogComponentEnable ("PfifoFastQueue", LOG_LEVEL_ALL);
363 LogComponentEnable("CoDelQueueDisc", LOG_LEVEL_FUNCTION);
364 }
365
366 // Queue defaults
367 Config::SetDefault("ns3::PfifoFastQueueDisc::MaxSize",
368 QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueSize)));
369 Config::SetDefault("ns3::CoDelQueueDisc::MaxSize",
370 QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, queueSize)));
371
372 // Create the nodes
373 NS_LOG_INFO("Create nodes");
375 nodes.Create(4);
376 // Descriptive names
377 Names::Add("server", nodes.Get(0));
378 Names::Add("cmts", nodes.Get(1));
379 Names::Add("router", nodes.Get(2));
380 Names::Add("host", nodes.Get(3));
381 NodeContainer serverCmts;
382 serverCmts = NodeContainer(nodes.Get(0), nodes.Get(1));
383 NodeContainer cmtsRouter;
384 cmtsRouter = NodeContainer(nodes.Get(1), nodes.Get(2));
385 NodeContainer routerHost;
386 routerHost = NodeContainer(nodes.Get(2), nodes.Get(3));
387
388 // Enable checksum
389 if (isPcapEnabled)
390 {
391 GlobalValue::Bind("ChecksumEnabled", BooleanValue(true));
392 }
393
394 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(pktSize));
395
396 NS_LOG_INFO("Create channels and install net devices on nodes");
398
399 p2p.SetChannelAttribute("Delay", StringValue(serverCmtsDelay));
400 NetDeviceContainer serverCmtsDev = p2p.Install(serverCmts);
401 Names::Add("server/lan", serverCmtsDev.Get(0));
402 Names::Add("cmts/lan", serverCmtsDev.Get(1));
403 Ptr<PointToPointNetDevice> serverLanDev =
404 DynamicCast<PointToPointNetDevice>(serverCmtsDev.Get(0));
405 serverLanDev->SetAttribute("DataRate", StringValue(serverLanDataRate));
406 Ptr<PointToPointNetDevice> cmtsLanDev =
407 DynamicCast<PointToPointNetDevice>(serverCmtsDev.Get(1));
408 cmtsLanDev->SetAttribute("DataRate", StringValue(cmtsLanDataRate));
409
410 p2p.SetChannelAttribute("Delay", StringValue(cmtsRouterDelay));
411 NetDeviceContainer cmtsRouterDev = p2p.Install(cmtsRouter);
412 Names::Add("cmts/wan", cmtsRouterDev.Get(0));
413 Names::Add("router/wan", cmtsRouterDev.Get(1));
414 Ptr<PointToPointNetDevice> cmtsWanDev =
415 DynamicCast<PointToPointNetDevice>(cmtsRouterDev.Get(0));
416 cmtsWanDev->SetAttribute("DataRate", StringValue(cmtsWanDataRate));
417 Ptr<PointToPointNetDevice> routerWanDev =
418 DynamicCast<PointToPointNetDevice>(cmtsRouterDev.Get(1));
419 routerWanDev->SetAttribute("DataRate", StringValue(routerWanDataRate));
420
421 p2p.SetChannelAttribute("Delay", StringValue(routerHostDelay));
422 NetDeviceContainer routerHostDev = p2p.Install(routerHost);
423 Names::Add("router/lan", routerHostDev.Get(0));
424 Names::Add("host/lan", routerHostDev.Get(1));
425 Ptr<PointToPointNetDevice> routerLanDev =
426 DynamicCast<PointToPointNetDevice>(routerHostDev.Get(0));
427 routerLanDev->SetAttribute("DataRate", StringValue(routerLanDataRate));
428 Ptr<PointToPointNetDevice> hostLanDev =
429 DynamicCast<PointToPointNetDevice>(routerHostDev.Get(1));
430 hostLanDev->SetAttribute("DataRate", StringValue(hostLanDataRate));
431
432 NS_LOG_INFO("Install Internet stack on all nodes");
434 stack.InstallAll();
435
436 TrafficControlHelper tchPfifo;
437 tchPfifo.SetRootQueueDisc("ns3::PfifoFastQueueDisc");
438
439 TrafficControlHelper tchCoDel;
440 tchCoDel.SetRootQueueDisc("ns3::CoDelQueueDisc");
441
442 tchPfifo.Install(serverCmtsDev);
443 tchPfifo.Install(cmtsWanDev);
444 if (routerWanQueueDiscType == "PfifoFast")
445 {
446 tchPfifo.Install(routerWanDev);
447 }
448 else if (routerWanQueueDiscType == "CoDel")
449 {
450 tchCoDel.Install(routerWanDev);
451 }
452 else
453 {
454 NS_LOG_DEBUG("Invalid router WAN queue disc type");
455 exit(1);
456 }
457 tchPfifo.Install(routerHostDev);
458
459 NS_LOG_INFO("Assign IP Addresses");
461 ipv4.SetBase("10.1.1.0", "255.255.255.0");
462 Ipv4InterfaceContainer serverCmtsInterface = ipv4.Assign(serverCmtsDev);
463 ipv4.SetBase("10.1.2.0", "255.255.255.0");
464 Ipv4InterfaceContainer cmtsRouterInterface = ipv4.Assign(cmtsRouterDev);
465 ipv4.SetBase("10.1.3.0", "255.255.255.0");
466 Ipv4InterfaceContainer routerHostInterface = ipv4.Assign(routerHostDev);
467
468 NS_LOG_INFO("Initialize Global Routing");
470
471 NS_LOG_INFO("Configure downstream");
472 uint16_t port1 = 50000;
473 Address sinkLocalAddress1(InetSocketAddress(Ipv4Address::GetAny(), port1));
474 PacketSinkHelper sinkHelper1("ns3::TcpSocketFactory", sinkLocalAddress1);
475 ApplicationContainer sinkApp1 = sinkHelper1.Install(routerHost.Get(1));
476 sinkApp1.Start(Seconds(0));
477 sinkApp1.Stop(Seconds(stopTime));
478 AddressValue remoteAddress1(InetSocketAddress(routerHostInterface.GetAddress(1), port1));
479 while (numOfDownLoadBulkFlows)
480 {
481 CreateBulkFlow(remoteAddress1, serverCmts.Get(0), pktSize, stopTime);
482 numOfDownLoadBulkFlows--;
483 }
484
485 while (numOfDownLoadOnOffFlows)
486 {
487 CreateOnOffFlow(remoteAddress1, serverCmts.Get(0), stopTime);
488 numOfDownLoadOnOffFlows--;
489 }
490
491 NS_LOG_INFO("Configure upstream");
492 uint16_t port2 = 50001;
493 Address sinkLocalAddress2(InetSocketAddress(Ipv4Address::GetAny(), port2));
494 PacketSinkHelper sinkHelper2("ns3::TcpSocketFactory", sinkLocalAddress2);
495 ApplicationContainer sinkApp2 = sinkHelper2.Install(serverCmts.Get(0));
496 sinkApp2.Start(Seconds(0));
497 sinkApp2.Stop(Seconds(stopTime));
498 AddressValue remoteAddress2(InetSocketAddress(serverCmtsInterface.GetAddress(0), port2));
499 while (numOfUpLoadBulkFlows)
500 {
501 CreateBulkFlow(remoteAddress2, routerHost.Get(1), pktSize, stopTime);
502 numOfUpLoadBulkFlows--;
503 }
504
505 while (numOfUpLoadOnOffFlows)
506 {
507 CreateOnOffFlow(remoteAddress2, routerHost.Get(1), stopTime);
508 numOfUpLoadOnOffFlows--;
509 }
510
511 Simulator::Schedule(Seconds(0.00001), &TraceCwnd, cwndTrFileName);
512 TraceEveryDrop(everyDropTrFileName);
513 if (routerWanQueueDiscType == "CoDel")
514 {
515 TraceSojourn(sojournTrFileName);
516 TraceQueueLength(queueLengthTrFileName);
517 TraceDroppingState(dropStateTrFileName);
518 }
519 if (isPcapEnabled)
520 {
521 p2p.EnablePcapAll(pcapFileName);
522 }
523
524 // Output config store to txt format
525 Config::SetDefault("ns3::ConfigStore::Filename", StringValue(attributeFileName));
526 Config::SetDefault("ns3::ConfigStore::FileFormat", StringValue("RawText"));
527 Config::SetDefault("ns3::ConfigStore::Mode", StringValue("Save"));
528 ConfigStore outputConfig;
529 outputConfig.ConfigureDefaults();
530 outputConfig.ConfigureAttributes();
531
534
536 return 0;
537}
a polymophic address class
Definition address.h:90
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.
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Manage ASCII trace files for device models.
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.
Parse command-line arguments.
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:764
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.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
Class for representing queue sizes.
Definition queue-size.h:85
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Hold variables of type string.
Definition string.h:45
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
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:34
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:883
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition config.cc:943
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition callback.h:745
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
NodeContainer nodes
stack
Definition first.py:33
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:291
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580
@ LOG_LEVEL_FUNCTION
LOG_FUNCTION and above.
Definition log.h:96
std::ofstream queueSize
uint32_t pktSize
packet size used for the simulation (in bytes)