A Discrete-Event Network Simulator
API
adaptive-red-tests.cc
Go to the documentation of this file.
1
2/*
3 * Copyright (c) 2015 NITK Surathkal
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: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
19 *
20 */
21
66#include "ns3/applications-module.h"
67#include "ns3/core-module.h"
68#include "ns3/flow-monitor-helper.h"
69#include "ns3/internet-module.h"
70#include "ns3/network-module.h"
71#include "ns3/point-to-point-module.h"
72#include "ns3/traffic-control-module.h"
73
74using namespace ns3;
75
76NS_LOG_COMPONENT_DEFINE("AdaptiveRedTests");
77
80
81// The times
88
94
100
101std::stringstream filePlotQueueDisc;
102std::stringstream filePlotQueueDiscAvg;
103
109void
111{
112 uint32_t qSize = queue->GetCurrentSize().GetValue();
113
114 avgQueueDiscSize += qSize;
115 checkTimes++;
116
117 // check queue disc size every 1/100 of a second
118 Simulator::Schedule(Seconds(0.01), &CheckQueueDiscSize, queue);
119
120 std::ofstream fPlotQueueDisc(filePlotQueueDisc.str(), std::ios::out | std::ios::app);
121 fPlotQueueDisc << Simulator::Now().GetSeconds() << " " << qSize << std::endl;
122 fPlotQueueDisc.close();
123
124 std::ofstream fPlotQueueDiscAvg(filePlotQueueDiscAvg.str(), std::ios::out | std::ios::app);
125 fPlotQueueDiscAvg << Simulator::Now().GetSeconds() << " " << avgQueueDiscSize / checkTimes
126 << std::endl;
127 fPlotQueueDiscAvg.close();
128}
129
135void
137{
138 // SINK is in the right side
139 uint16_t port = 50000;
140 Address sinkLocalAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
141 PacketSinkHelper sinkHelper("ns3::TcpSocketFactory", sinkLocalAddress);
142 ApplicationContainer sinkApp = sinkHelper.Install(n3n4.Get(1));
143 sinkApp.Start(Seconds(sink_start_time));
144 sinkApp.Stop(Seconds(sink_stop_time));
145
146 // Connection one
147 // Clients are in left side
148 /*
149 * Create the OnOff applications to send TCP to the server
150 * onoffhelper is a client that send data to TCP destination
151 */
152 OnOffHelper clientHelper1("ns3::TcpSocketFactory", Address());
153 clientHelper1.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
154 clientHelper1.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
155 clientHelper1.SetAttribute("PacketSize", UintegerValue(1000));
156
157 // Connection two
158 OnOffHelper clientHelper2("ns3::TcpSocketFactory", Address());
159 clientHelper2.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
160 clientHelper2.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
161 clientHelper2.SetAttribute("PacketSize", UintegerValue(1000));
162
163 if (test == 6 || test == 7 || test == 8 || test == 9 || test == 10 || test == 12)
164 {
165 clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("100Mb/s")));
166 clientHelper2.SetAttribute("DataRate", DataRateValue(DataRate("100Mb/s")));
167 }
168 else
169 {
170 clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
171 clientHelper2.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
172 }
173
174 ApplicationContainer clientApps1;
176 clientHelper1.SetAttribute("Remote", remoteAddress);
177 clientApps1.Add(clientHelper1.Install(n0n2.Get(0)));
178 clientApps1.Start(Seconds(client_start_time));
179 clientApps1.Stop(Seconds(client_stop_time));
180
181 ApplicationContainer clientApps2;
182 clientHelper2.SetAttribute("Remote", remoteAddress);
183 clientApps2.Add(clientHelper2.Install(n1n2.Get(0)));
184 clientApps2.Start(Seconds(client_start_time));
185 clientApps2.Stop(Seconds(client_stop_time));
186}
187
188int
189main(int argc, char* argv[])
190{
191 LogComponentEnable("RedQueueDisc", LOG_LEVEL_INFO);
192
193 uint32_t aredTest;
194 std::string aredLinkDataRate = "1.5Mbps";
195 std::string aredLinkDelay = "20ms";
196
197 std::string pathOut;
198 bool writeForPlot = false;
199 bool writePcap = false;
200 bool flowMonitor = false;
201
202 bool printAredStats = true;
203
204 global_start_time = 0.0;
207 global_stop_time = 7.0;
210
211 // Configuration and command line parameter parsing
212 aredTest = 1;
213 // Will only save in the directory if enable opts below
214 pathOut = "."; // Current directory
215 CommandLine cmd(__FILE__);
216 cmd.AddValue("testNumber",
217 "Run test 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14 or 15",
218 aredTest);
219 cmd.AddValue("pathOut",
220 "Path to save results from --writeForPlot/--writePcap/--writeFlowMonitor",
221 pathOut);
222 cmd.AddValue("writeForPlot", "Write results for plot (gnuplot)", writeForPlot);
223 cmd.AddValue("writePcap", "Write results in pcapfile", writePcap);
224 cmd.AddValue("writeFlowMonitor", "Enable Flow Monitor and write their results", flowMonitor);
225
226 cmd.Parse(argc, argv);
227 if ((aredTest < 1) || (aredTest == 5) || (aredTest > 15))
228 {
229 std::cout << "Invalid test number. Supported tests are 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, "
230 "13, 14 or 15"
231 << std::endl;
232 exit(1);
233 }
234
235 NS_LOG_INFO("Create nodes");
237 c.Create(6);
238 Names::Add("N0", c.Get(0));
239 Names::Add("N1", c.Get(1));
240 Names::Add("N2", c.Get(2));
241 Names::Add("N3", c.Get(3));
242 Names::Add("N4", c.Get(4));
243 Names::Add("N5", c.Get(5));
244 n0n2 = NodeContainer(c.Get(0), c.Get(2));
245 n1n2 = NodeContainer(c.Get(1), c.Get(2));
246 n2n3 = NodeContainer(c.Get(2), c.Get(3));
247 n3n4 = NodeContainer(c.Get(3), c.Get(4));
248 n3n5 = NodeContainer(c.Get(3), c.Get(5));
249
250 Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::TcpNewReno"));
251 // 42 = headers size
252 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(1000 - 42));
253 Config::SetDefault("ns3::TcpSocket::DelAckCount", UintegerValue(1));
254 GlobalValue::Bind("ChecksumEnabled", BooleanValue(false));
255
256 uint32_t meanPktSize = 1000;
257
258 // RED params
259 NS_LOG_INFO("Set RED params");
260 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("1000p"));
261 Config::SetDefault("ns3::RedQueueDisc::MeanPktSize", UintegerValue(meanPktSize));
262 Config::SetDefault("ns3::RedQueueDisc::Wait", BooleanValue(true));
263 Config::SetDefault("ns3::RedQueueDisc::Gentle", BooleanValue(true));
264 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(0.002));
265 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(5));
266 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(15));
267
268 if (aredTest == 1) // test 1: red1
269 {
270 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
271 }
272 else if (aredTest == 2) // test 2: red1Adapt
273 {
274 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
275 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
276 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
277 }
278 else if (aredTest == 3) // test 3: red1ECN
279 {
280 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
281 Config::SetDefault("ns3::TcpSocketBase::UseEcn", StringValue("On"));
282 Config::SetDefault("ns3::RedQueueDisc::UseEcn", BooleanValue(true));
283 }
284 else if (aredTest == 4) // test 4: red1AdaptECN
285 {
286 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
287 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
288 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
289 Config::SetDefault("ns3::TcpSocketBase::UseEcn", StringValue("On"));
290 Config::SetDefault("ns3::RedQueueDisc::UseEcn", BooleanValue(true));
291 }
292 else if (aredTest == 7) // test 7: fastlinkAutowq
293 {
294 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(0.0));
295 }
296 else if (aredTest == 8) // test 8: fastlinkAutothresh
297 {
298 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(0));
299 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(0));
300 }
301 else if (aredTest == 9) // test 9: fastlinkAdaptive
302 {
303 Config::SetDefault("ns3::RedQueueDisc::AdaptMaxP", BooleanValue(true));
304 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
305 }
306 else if (aredTest == 10) // test 10: fastlinkAllAdapt
307 {
308 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
309 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
310 }
311 else if (aredTest == 11) // test 11: fastlinkAllAdaptECN
312 {
313 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
314 Config::SetDefault("ns3::RedQueueDisc::UseHardDrop", BooleanValue(false));
315 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
316 Config::SetDefault("ns3::TcpSocketBase::UseEcn", StringValue("On"));
317 Config::SetDefault("ns3::RedQueueDisc::UseEcn", BooleanValue(true));
318 }
319 else if (aredTest == 12) // test 12: fastlinkAllAdapt1
320 {
321 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
322 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
323 Config::SetDefault("ns3::RedQueueDisc::TargetDelay", TimeValue(Seconds(0.2)));
324 }
325 else if (aredTest == 13) // test 13: longlink
326 {
327 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("100p"));
328 }
329 else if (aredTest == 14) // test 14: longlinkAdapt
330 {
331 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
332 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
333 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("100p"));
334 }
335 else if (aredTest == 15) // test 15: longlinkAdapt1
336 {
337 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(-1.0));
338 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(0));
339 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(0));
340 Config::SetDefault("ns3::RedQueueDisc::AdaptMaxP", BooleanValue(true));
341 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
342 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("100p"));
343 }
344
345 NS_LOG_INFO("Install internet stack on all nodes.");
346 InternetStackHelper internet;
347 internet.Install(c);
348
349 TrafficControlHelper tchPfifo;
350 uint16_t handle = tchPfifo.SetRootQueueDisc("ns3::PfifoFastQueueDisc");
351 tchPfifo.AddInternalQueues(handle, 3, "ns3::DropTailQueue", "MaxSize", StringValue("1000p"));
352
354 tchRed.SetRootQueueDisc("ns3::RedQueueDisc",
355 "LinkBandwidth",
356 StringValue(aredLinkDataRate),
357 "LinkDelay",
358 StringValue(aredLinkDelay));
359
360 NS_LOG_INFO("Create channels");
362
363 NetDeviceContainer devn0n2;
364 NetDeviceContainer devn1n2;
365 NetDeviceContainer devn2n3;
366 NetDeviceContainer devn3n4;
367 NetDeviceContainer devn3n5;
368
369 QueueDiscContainer queueDiscs;
370
371 if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4)
372 {
373 p2p.SetQueue("ns3::DropTailQueue");
374 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
375 p2p.SetChannelAttribute("Delay", StringValue("2ms"));
376 devn0n2 = p2p.Install(n0n2);
377 tchPfifo.Install(devn0n2);
378
379 p2p.SetQueue("ns3::DropTailQueue");
380 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
381 p2p.SetChannelAttribute("Delay", StringValue("3ms"));
382 devn1n2 = p2p.Install(n1n2);
383 tchPfifo.Install(devn1n2);
384
385 p2p.SetQueue("ns3::DropTailQueue");
386 p2p.SetDeviceAttribute("DataRate", StringValue(aredLinkDataRate));
387 p2p.SetChannelAttribute("Delay", StringValue(aredLinkDelay));
388 devn2n3 = p2p.Install(n2n3);
389 // only backbone link has ARED queue disc
390 queueDiscs = tchRed.Install(devn2n3);
391
392 p2p.SetQueue("ns3::DropTailQueue");
393 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
394 p2p.SetChannelAttribute("Delay", StringValue("4ms"));
395 devn3n4 = p2p.Install(n3n4);
396 tchPfifo.Install(devn3n4);
397
398 p2p.SetQueue("ns3::DropTailQueue");
399 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
400 p2p.SetChannelAttribute("Delay", StringValue("5ms"));
401 devn3n5 = p2p.Install(n3n5);
402 tchPfifo.Install(devn3n5);
403 }
404 else if (aredTest == 13 || aredTest == 14 || aredTest == 15)
405 {
406 p2p.SetQueue("ns3::DropTailQueue");
407 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
408 p2p.SetChannelAttribute("Delay", StringValue("0ms"));
409 devn0n2 = p2p.Install(n0n2);
410 tchPfifo.Install(devn0n2);
411
412 p2p.SetQueue("ns3::DropTailQueue");
413 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
414 p2p.SetChannelAttribute("Delay", StringValue("1ms"));
415 devn1n2 = p2p.Install(n1n2);
416 tchPfifo.Install(devn1n2);
417
418 p2p.SetQueue("ns3::DropTailQueue");
419 p2p.SetDeviceAttribute("DataRate", StringValue(aredLinkDataRate));
420 p2p.SetChannelAttribute("Delay", StringValue("100ms"));
421 devn2n3 = p2p.Install(n2n3);
422 // only backbone link has ARED queue disc
423 queueDiscs = tchRed.Install(devn2n3);
424
425 p2p.SetQueue("ns3::DropTailQueue");
426 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
427 p2p.SetChannelAttribute("Delay", StringValue("2ms"));
428 devn3n4 = p2p.Install(n3n4);
429 tchPfifo.Install(devn3n4);
430
431 p2p.SetQueue("ns3::DropTailQueue");
432 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
433 p2p.SetChannelAttribute("Delay", StringValue("3ms"));
434 devn3n5 = p2p.Install(n3n5);
435 tchPfifo.Install(devn3n5);
436 }
437 else if (aredTest == 6 || aredTest == 7 || aredTest == 8 || aredTest == 9 || aredTest == 10 ||
438 aredTest == 11 || aredTest == 12)
439 {
440 p2p.SetQueue("ns3::DropTailQueue");
441 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
442 p2p.SetChannelAttribute("Delay", StringValue("2ms"));
443 devn0n2 = p2p.Install(n0n2);
444 tchPfifo.Install(devn0n2);
445
446 p2p.SetQueue("ns3::DropTailQueue");
447 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
448 p2p.SetChannelAttribute("Delay", StringValue("3ms"));
449 devn1n2 = p2p.Install(n1n2);
450 tchPfifo.Install(devn1n2);
451
452 p2p.SetQueue("ns3::DropTailQueue");
453 p2p.SetDeviceAttribute("DataRate", StringValue("15Mbps"));
454 p2p.SetChannelAttribute("Delay", StringValue(aredLinkDelay));
455 devn2n3 = p2p.Install(n2n3);
456 // only backbone link has ARED queue disc
457 queueDiscs = tchRed.Install(devn2n3);
458
459 p2p.SetQueue("ns3::DropTailQueue");
460 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
461 p2p.SetChannelAttribute("Delay", StringValue("4ms"));
462 devn3n4 = p2p.Install(n3n4);
463 tchPfifo.Install(devn3n4);
464
465 p2p.SetQueue("ns3::DropTailQueue");
466 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
467 p2p.SetChannelAttribute("Delay", StringValue("5ms"));
468 devn3n5 = p2p.Install(n3n5);
469 tchPfifo.Install(devn3n5);
470 }
471
472 NS_LOG_INFO("Assign IP Addresses");
474
475 ipv4.SetBase("10.1.1.0", "255.255.255.0");
476 i0i2 = ipv4.Assign(devn0n2);
477
478 ipv4.SetBase("10.1.2.0", "255.255.255.0");
479 i1i2 = ipv4.Assign(devn1n2);
480
481 ipv4.SetBase("10.1.3.0", "255.255.255.0");
482 i2i3 = ipv4.Assign(devn2n3);
483
484 ipv4.SetBase("10.1.4.0", "255.255.255.0");
485 i3i4 = ipv4.Assign(devn3n4);
486
487 ipv4.SetBase("10.1.5.0", "255.255.255.0");
488 i3i5 = ipv4.Assign(devn3n5);
489
490 // Set up the routing
491 Ipv4GlobalRoutingHelper::PopulateRoutingTables();
492
493 BuildAppsTest(aredTest);
494
495 if (writePcap)
496 {
498 std::stringstream stmp;
499 stmp << pathOut << "/ared";
500 ptp.EnablePcapAll(stmp.str());
501 }
502
503 Ptr<FlowMonitor> flowmon;
504 if (flowMonitor)
505 {
506 FlowMonitorHelper flowmonHelper;
507 flowmon = flowmonHelper.InstallAll();
508 }
509
510 if (writeForPlot)
511 {
512 filePlotQueueDisc << pathOut << "/"
513 << "ared-queue-disc.plotme";
514 filePlotQueueDiscAvg << pathOut << "/"
515 << "ared-queue-disc_avg.plotme";
516
517 remove(filePlotQueueDisc.str().c_str());
518 remove(filePlotQueueDiscAvg.str().c_str());
519 Ptr<QueueDisc> queue = queueDiscs.Get(0);
520 Simulator::ScheduleNow(&CheckQueueDiscSize, queue);
521 }
522
523 Simulator::Stop(Seconds(sink_stop_time));
524 Simulator::Run();
525
526 QueueDisc::Stats st = queueDiscs.Get(0)->GetStats();
527
528 if (st.GetNDroppedPackets(RedQueueDisc::UNFORCED_DROP) == 0 &&
529 st.GetNMarkedPackets(RedQueueDisc::UNFORCED_MARK) == 0)
530 {
531 std::cout << "There should be some unforced drops or marks" << std::endl;
532 exit(1);
533 }
534
535 if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4 || aredTest == 13)
536 {
537 if (st.GetNDroppedPackets(QueueDisc::INTERNAL_QUEUE_DROP) == 0)
538 {
539 std::cout << "There should be some drops due to queue full" << std::endl;
540 exit(1);
541 }
542 }
543 else
544 {
545 if (st.GetNDroppedPackets(QueueDisc::INTERNAL_QUEUE_DROP) != 0)
546 {
547 std::cout << "There should be zero drops due to queue full" << std::endl;
548 exit(1);
549 }
550 }
551
552 if (flowMonitor)
553 {
554 std::stringstream stmp;
555 stmp << pathOut << "/ared.flowmon";
556
557 flowmon->SerializeToXmlFile(stmp.str(), false, false);
558 }
559
560 if (printAredStats)
561 {
562 std::cout << "*** ARED stats from Node 2 queue ***" << std::endl;
563 std::cout << st << std::endl;
564 }
565
566 Simulator::Destroy();
567
568 return 0;
569}
Ipv4InterfaceContainer i0i2
IPv4 interface container i0 + i2.
std::stringstream filePlotQueueDisc
Output file name for queue disc size.
void BuildAppsTest(uint32_t test)
Setup the apps.
double client_start_time
Client start time.
double sink_stop_time
Sink stop time.
double sink_start_time
Sink start time.
double global_stop_time
Global stop time.
std::stringstream filePlotQueueDiscAvg
Output file name for queue disc average.
NodeContainer n2n3
Nodecontainer n2 + n3.
void CheckQueueDiscSize(Ptr< QueueDisc > queue)
Check the queue disc size and write its stats to the output files.
NodeContainer n1n2
Nodecontainer n1 + n2.
double avgQueueDiscSize
Average QueueDisc size.
NodeContainer n3n4
Nodecontainer n3 + n4.
double global_start_time
Global start time.
Ipv4InterfaceContainer i1i2
IPv4 interface container i1 + i2.
Ipv4InterfaceContainer i3i4
IPv4 interface container i3 + i4.
NodeContainer n0n2
Nodecontainer n0 + n2.
double client_stop_time
Client stop time.
uint32_t checkTimes
Number of times the queues have been checked.
NodeContainer n3n5
Nodecontainer n3 + n5.
Ipv4InterfaceContainer i3i5
IPv4 interface container i3 + i5.
Ipv4InterfaceContainer i2i3
IPv4 interface container i2 + i3.
a polymophic address class
Definition: address.h:100
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
void Start(Time start)
Start all of the Applications in this container at the start time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Parse command-line arguments.
Definition: command-line.h:232
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Helper to enable IP flow monitoring on a set of Nodes.
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
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.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
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 ...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
void SetQueue(std::string type, Ts &&... args)
Each point to point net device must have a queue to pass packets through.
NetDeviceContainer Install(NodeContainer c)
Holds a vector of ns3::QueueDisc pointers.
Ptr< QueueDisc > Get(std::size_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
QueueSize GetCurrentSize()
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
Definition: queue-disc.cc:519
const Stats & GetStats()
Retrieve all the collected statistics.
Definition: queue-disc.cc:416
uint32_t GetValue() const
Get the underlying value.
Definition: queue-size.cc:183
Hold variables of type string.
Definition: string.h:56
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
AttributeValue implementation for Time.
Definition: nstime.h:1423
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.
void AddInternalQueues(uint16_t handle, uint16_t count, std::string type, Args &&... args)
Helper function used to add the given number of internal queues (of the given type and with the given...
Hold an unsigned integer type.
Definition: uinteger.h:45
uint16_t port
Definition: dsdv-manet.cc:45
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:328
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:296
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const char *name, LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:296
@ LOG_LEVEL_INFO
LOG_INFO and above.
Definition: log.h:107
cmd
Definition: second.py:33
Structure that keeps the queue disc statistics.
Definition: queue-disc.h:188
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
Definition: queue-disc.cc:111
uint32_t GetNMarkedPackets(std::string reason) const
Get the number of packets marked for the given reason.
Definition: queue-disc.cc:153