A Discrete-Event Network Simulator
API
adaptive-red-tests.cc
Go to the documentation of this file.
1
2/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3/*
4 * Copyright (c) 2015 NITK Surathkal
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Author: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
20 *
21 */
22
67#include "ns3/core-module.h"
68#include "ns3/network-module.h"
69#include "ns3/internet-module.h"
70#include "ns3/flow-monitor-helper.h"
71#include "ns3/point-to-point-module.h"
72#include "ns3/applications-module.h"
73#include "ns3/traffic-control-module.h"
74
75using namespace ns3;
76
77NS_LOG_COMPONENT_DEFINE ("AdaptiveRedTests");
78
81
82// The times
89
95
101
102std::stringstream filePlotQueueDisc;
103std::stringstream filePlotQueueDiscAvg;
104
110void
112{
113 uint32_t qSize = queue->GetCurrentSize ().GetValue ();
114
115 avgQueueDiscSize += qSize;
116 checkTimes++;
117
118 // check queue disc size every 1/100 of a second
119 Simulator::Schedule (Seconds (0.01), &CheckQueueDiscSize, queue);
120
121 std::ofstream fPlotQueueDisc (filePlotQueueDisc.str ().c_str (), std::ios::out | std::ios::app);
122 fPlotQueueDisc << Simulator::Now ().GetSeconds () << " " << qSize << std::endl;
123 fPlotQueueDisc.close ();
124
125 std::ofstream fPlotQueueDiscAvg (filePlotQueueDiscAvg.str ().c_str (), std::ios::out | std::ios::app);
126 fPlotQueueDiscAvg << Simulator::Now ().GetSeconds () << " " << avgQueueDiscSize / checkTimes << 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;
175 AddressValue remoteAddress (InetSocketAddress (i3i4.GetAddress (1), port));
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", "Run test 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14 or 15", aredTest);
217 cmd.AddValue ("pathOut", "Path to save results from --writeForPlot/--writePcap/--writeFlowMonitor", pathOut);
218 cmd.AddValue ("writeForPlot", "Write results for plot (gnuplot)", writeForPlot);
219 cmd.AddValue ("writePcap", "Write results in pcapfile", writePcap);
220 cmd.AddValue ("writeFlowMonitor", "Enable Flow Monitor and write their results", flowMonitor);
221
222 cmd.Parse (argc, argv);
223 if ((aredTest < 1) || (aredTest == 5) || (aredTest > 15))
224 {
225 std::cout << "Invalid test number. Supported tests are 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14 or 15" << std::endl;
226 exit (1);
227 }
228
229 NS_LOG_INFO ("Create nodes");
231 c.Create (6);
232 Names::Add ( "N0", c.Get (0));
233 Names::Add ( "N1", c.Get (1));
234 Names::Add ( "N2", c.Get (2));
235 Names::Add ( "N3", c.Get (3));
236 Names::Add ( "N4", c.Get (4));
237 Names::Add ( "N5", c.Get (5));
238 n0n2 = NodeContainer (c.Get (0), c.Get (2));
239 n1n2 = NodeContainer (c.Get (1), c.Get (2));
240 n2n3 = NodeContainer (c.Get (2), c.Get (3));
241 n3n4 = NodeContainer (c.Get (3), c.Get (4));
242 n3n5 = NodeContainer (c.Get (3), c.Get (5));
243
244 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpNewReno"));
245 // 42 = headers size
246 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000 - 42));
247 Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
248 GlobalValue::Bind ("ChecksumEnabled", BooleanValue (false));
249
250 uint32_t meanPktSize = 1000;
251
252 // RED params
253 NS_LOG_INFO ("Set RED params");
254 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("1000p"));
255 Config::SetDefault ("ns3::RedQueueDisc::MeanPktSize", UintegerValue (meanPktSize));
256 Config::SetDefault ("ns3::RedQueueDisc::Wait", BooleanValue (true));
257 Config::SetDefault ("ns3::RedQueueDisc::Gentle", BooleanValue (true));
258 Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.002));
259 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5));
260 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15));
261
262 if (aredTest == 1) // test 1: red1
263 {
264 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
265 }
266 else if (aredTest == 2) // test 2: red1Adapt
267 {
268 Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
269 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
270 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
271 }
272 else if (aredTest == 3) //test 3: red1ECN
273 {
274 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
275 Config::SetDefault ("ns3::TcpSocketBase::UseEcn", StringValue ("On"));
276 Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true));
277 }
278 else if (aredTest == 4) // test 4: red1AdaptECN
279 {
280 Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
281 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
282 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
283 Config::SetDefault ("ns3::TcpSocketBase::UseEcn", StringValue ("On"));
284 Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true));
285 }
286 else if (aredTest == 7) // test 7: fastlinkAutowq
287 {
288 Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.0));
289 }
290 else if (aredTest == 8) // test 8: fastlinkAutothresh
291 {
292 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (0));
293 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (0));
294 }
295 else if (aredTest == 9) // test 9: fastlinkAdaptive
296 {
297 Config::SetDefault ("ns3::RedQueueDisc::AdaptMaxP", BooleanValue (true));
298 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
299 }
300 else if (aredTest == 10) // test 10: fastlinkAllAdapt
301 {
302 Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
303 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
304 }
305 else if (aredTest == 11) // test 11: fastlinkAllAdaptECN
306 {
307 Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
308 Config::SetDefault ("ns3::RedQueueDisc::UseHardDrop", BooleanValue (false));
309 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
310 Config::SetDefault ("ns3::TcpSocketBase::UseEcn", StringValue ("On"));
311 Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true));
312 }
313 else if (aredTest == 12) // test 12: fastlinkAllAdapt1
314 {
315 Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
316 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
317 Config::SetDefault ("ns3::RedQueueDisc::TargetDelay", TimeValue (Seconds (0.2)));
318 }
319 else if (aredTest == 13) // test 13: longlink
320 {
321 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("100p"));
322 }
323 else if (aredTest == 14) // test 14: longlinkAdapt
324 {
325 Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
326 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
327 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("100p"));
328 }
329 else if (aredTest == 15) // test 15: longlinkAdapt1
330 {
331 Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (-1.0));
332 Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (0));
333 Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (0));
334 Config::SetDefault ("ns3::RedQueueDisc::AdaptMaxP", BooleanValue (true));
335 Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
336 Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("100p"));
337 }
338
339 NS_LOG_INFO ("Install internet stack on all nodes.");
340 InternetStackHelper internet;
341 internet.Install (c);
342
343 TrafficControlHelper tchPfifo;
344 uint16_t handle = tchPfifo.SetRootQueueDisc ("ns3::PfifoFastQueueDisc");
345 tchPfifo.AddInternalQueues (handle, 3, "ns3::DropTailQueue", "MaxSize", StringValue ("1000p"));
346
348 tchRed.SetRootQueueDisc ("ns3::RedQueueDisc", "LinkBandwidth", StringValue (aredLinkDataRate),
349 "LinkDelay", StringValue (aredLinkDelay));
350
351 NS_LOG_INFO ("Create channels");
353
354 NetDeviceContainer devn0n2;
355 NetDeviceContainer devn1n2;
356 NetDeviceContainer devn2n3;
357 NetDeviceContainer devn3n4;
358 NetDeviceContainer devn3n5;
359
360 QueueDiscContainer queueDiscs;
361
362 if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4)
363 {
364 p2p.SetQueue ("ns3::DropTailQueue");
365 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
366 p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
367 devn0n2 = p2p.Install (n0n2);
368 tchPfifo.Install (devn0n2);
369
370 p2p.SetQueue ("ns3::DropTailQueue");
371 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
372 p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
373 devn1n2 = p2p.Install (n1n2);
374 tchPfifo.Install (devn1n2);
375
376 p2p.SetQueue ("ns3::DropTailQueue");
377 p2p.SetDeviceAttribute ("DataRate", StringValue (aredLinkDataRate));
378 p2p.SetChannelAttribute ("Delay", StringValue (aredLinkDelay));
379 devn2n3 = p2p.Install (n2n3);
380 // only backbone link has ARED queue disc
381 queueDiscs = tchRed.Install (devn2n3);
382
383 p2p.SetQueue ("ns3::DropTailQueue");
384 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
385 p2p.SetChannelAttribute ("Delay", StringValue ("4ms"));
386 devn3n4 = p2p.Install (n3n4);
387 tchPfifo.Install (devn3n4);
388
389 p2p.SetQueue ("ns3::DropTailQueue");
390 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
391 p2p.SetChannelAttribute ("Delay", StringValue ("5ms"));
392 devn3n5 = p2p.Install (n3n5);
393 tchPfifo.Install (devn3n5);
394 }
395 else if (aredTest == 13 || aredTest == 14 || aredTest == 15)
396 {
397 p2p.SetQueue ("ns3::DropTailQueue");
398 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
399 p2p.SetChannelAttribute ("Delay", StringValue ("0ms"));
400 devn0n2 = p2p.Install (n0n2);
401 tchPfifo.Install (devn0n2);
402
403 p2p.SetQueue ("ns3::DropTailQueue");
404 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
405 p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
406 devn1n2 = p2p.Install (n1n2);
407 tchPfifo.Install (devn1n2);
408
409 p2p.SetQueue ("ns3::DropTailQueue");
410 p2p.SetDeviceAttribute ("DataRate", StringValue (aredLinkDataRate));
411 p2p.SetChannelAttribute ("Delay", StringValue ("100ms"));
412 devn2n3 = p2p.Install (n2n3);
413 // only backbone link has ARED queue disc
414 queueDiscs = tchRed.Install (devn2n3);
415
416 p2p.SetQueue ("ns3::DropTailQueue");
417 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
418 p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
419 devn3n4 = p2p.Install (n3n4);
420 tchPfifo.Install (devn3n4);
421
422 p2p.SetQueue ("ns3::DropTailQueue");
423 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
424 p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
425 devn3n5 = p2p.Install (n3n5);
426 tchPfifo.Install (devn3n5);
427 }
428 else if (aredTest == 6 || aredTest == 7 || aredTest == 8 || aredTest == 9 || aredTest == 10 || aredTest == 11 || aredTest == 12)
429 {
430 p2p.SetQueue ("ns3::DropTailQueue");
431 p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
432 p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
433 devn0n2 = p2p.Install (n0n2);
434 tchPfifo.Install (devn0n2);
435
436 p2p.SetQueue ("ns3::DropTailQueue");
437 p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
438 p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
439 devn1n2 = p2p.Install (n1n2);
440 tchPfifo.Install (devn1n2);
441
442 p2p.SetQueue ("ns3::DropTailQueue");
443 p2p.SetDeviceAttribute ("DataRate", StringValue ("15Mbps"));
444 p2p.SetChannelAttribute ("Delay", StringValue (aredLinkDelay));
445 devn2n3 = p2p.Install (n2n3);
446 // only backbone link has ARED queue disc
447 queueDiscs = tchRed.Install (devn2n3);
448
449 p2p.SetQueue ("ns3::DropTailQueue");
450 p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
451 p2p.SetChannelAttribute ("Delay", StringValue ("4ms"));
452 devn3n4 = p2p.Install (n3n4);
453 tchPfifo.Install (devn3n4);
454
455 p2p.SetQueue ("ns3::DropTailQueue");
456 p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
457 p2p.SetChannelAttribute ("Delay", StringValue ("5ms"));
458 devn3n5 = p2p.Install (n3n5);
459 tchPfifo.Install (devn3n5);
460 }
461
462 NS_LOG_INFO ("Assign IP Addresses");
464
465 ipv4.SetBase ("10.1.1.0", "255.255.255.0");
466 i0i2 = ipv4.Assign (devn0n2);
467
468 ipv4.SetBase ("10.1.2.0", "255.255.255.0");
469 i1i2 = ipv4.Assign (devn1n2);
470
471 ipv4.SetBase ("10.1.3.0", "255.255.255.0");
472 i2i3 = ipv4.Assign (devn2n3);
473
474 ipv4.SetBase ("10.1.4.0", "255.255.255.0");
475 i3i4 = ipv4.Assign (devn3n4);
476
477 ipv4.SetBase ("10.1.5.0", "255.255.255.0");
478 i3i5 = ipv4.Assign (devn3n5);
479
480 // Set up the routing
481 Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
482
483 BuildAppsTest (aredTest);
484
485 if (writePcap)
486 {
488 std::stringstream stmp;
489 stmp << pathOut << "/ared";
490 ptp.EnablePcapAll (stmp.str ().c_str ());
491 }
492
493 Ptr<FlowMonitor> flowmon;
494 if (flowMonitor)
495 {
496 FlowMonitorHelper flowmonHelper;
497 flowmon = flowmonHelper.InstallAll ();
498 }
499
500 if (writeForPlot)
501 {
502 filePlotQueueDisc << pathOut << "/" << "ared-queue-disc.plotme";
503 filePlotQueueDiscAvg << pathOut << "/" << "ared-queue-disc_avg.plotme";
504
505 remove (filePlotQueueDisc.str ().c_str ());
506 remove (filePlotQueueDiscAvg.str ().c_str ());
507 Ptr<QueueDisc> queue = queueDiscs.Get (0);
508 Simulator::ScheduleNow (&CheckQueueDiscSize, queue);
509 }
510
511 Simulator::Stop (Seconds (sink_stop_time));
513
514 QueueDisc::Stats st = queueDiscs.Get (0)->GetStats ();
515
516 if (st.GetNDroppedPackets (RedQueueDisc::UNFORCED_DROP) == 0 &&
517 st.GetNMarkedPackets (RedQueueDisc::UNFORCED_MARK) == 0)
518 {
519 std::cout << "There should be some unforced drops or marks" << std::endl;
520 exit (1);
521 }
522
523 if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4 || aredTest == 13)
524 {
525 if (st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP) == 0)
526 {
527 std::cout << "There should be some drops due to queue full" << std::endl;
528 exit (1);
529 }
530 }
531 else
532 {
533 if (st.GetNDroppedPackets (QueueDisc::INTERNAL_QUEUE_DROP) != 0)
534 {
535 std::cout << "There should be zero drops due to queue full" << std::endl;
536 exit (1);
537 }
538 }
539
540 if (flowMonitor)
541 {
542 std::stringstream stmp;
543 stmp << pathOut << "/ared.flowmon";
544
545 flowmon->SerializeToXmlFile (stmp.str ().c_str (), false, false);
546 }
547
548 if (printAredStats)
549 {
550 std::cout << "*** ARED stats from Node 2 queue ***" << std::endl;
551 std::cout << st << std::endl;
552 }
553
554 Simulator::Destroy ();
555
556 return 0;
557}
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.
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
a polymophic address class
Definition: address.h:91
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the 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:229
Class for representing data rates.
Definition: data-rate.h:89
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
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:43
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(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
Definition: queue-disc.cc:521
const Stats & GetStats(void)
Retrieve all the collected statistics.
Definition: queue-disc.cc:419
uint32_t GetValue() const
Get the underlying value.
Definition: queue-size.cc:174
Hold variables of type string.
Definition: string.h:41
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
AttributeValue implementation for Time.
Definition: nstime.h:1309
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:44
uint16_t port
Definition: dsdv-manet.cc:45
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:206
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:282
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ LOG_LEVEL_INFO
LOG_INFO and above.
Definition: log.h:108
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
cmd
Definition: second.py:43
Structure that keeps the queue disc statistics.
Definition: queue-disc.h:186
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
Definition: queue-disc.cc:109
uint32_t GetNMarkedPackets(std::string reason) const
Get the number of packets marked for the given reason.
Definition: queue-disc.cc:151