A Discrete-Event Network Simulator
API
red-tests.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Authors: Marcos Talau <talau@users.sourceforge.net>
17  * Duy Nguyen <duy@soe.ucsc.edu>
18  * Modified by: Pasquale Imputato <p.imputato@gmail.com>
19  *
20  */
21 
41 #include "ns3/core-module.h"
42 #include "ns3/network-module.h"
43 #include "ns3/internet-module.h"
44 #include "ns3/flow-monitor-helper.h"
45 #include "ns3/point-to-point-module.h"
46 #include "ns3/applications-module.h"
47 #include "ns3/traffic-control-module.h"
48 
49 using namespace ns3;
50 
51 NS_LOG_COMPONENT_DEFINE ("RedTests");
52 
53 uint32_t checkTimes;
54 double avgQueueSize;
55 
56 // The times
63 
69 
75 
76 std::stringstream filePlotQueue;
77 std::stringstream filePlotQueueAvg;
78 
79 void
81 {
82  uint32_t qSize = queue->GetCurrentSize ().GetValue ();
83 
84  avgQueueSize += qSize;
85  checkTimes++;
86 
87  // check queue size every 1/100 of a second
88  Simulator::Schedule (Seconds (0.01), &CheckQueueSize, queue);
89 
90  std::ofstream fPlotQueue (filePlotQueue.str ().c_str (), std::ios::out|std::ios::app);
91  fPlotQueue << Simulator::Now ().GetSeconds () << " " << qSize << std::endl;
92  fPlotQueue.close ();
93 
94  std::ofstream fPlotQueueAvg (filePlotQueueAvg.str ().c_str (), std::ios::out|std::ios::app);
95  fPlotQueueAvg << Simulator::Now ().GetSeconds () << " " << avgQueueSize / checkTimes << std::endl;
96  fPlotQueueAvg.close ();
97 }
98 
99 void
100 BuildAppsTest (uint32_t test)
101 {
102  if ( (test == 1) || (test == 3) )
103  {
104  // SINK is in the right side
105  uint16_t port = 50000;
106  Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
107  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
108  ApplicationContainer sinkApp = sinkHelper.Install (n3n4.Get (1));
109  sinkApp.Start (Seconds (sink_start_time));
110  sinkApp.Stop (Seconds (sink_stop_time));
111 
112  // Connection one
113  // Clients are in left side
114  /*
115  * Create the OnOff applications to send TCP to the server
116  * onoffhelper is a client that send data to TCP destination
117  */
118  OnOffHelper clientHelper1 ("ns3::TcpSocketFactory", Address ());
119  clientHelper1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
120  clientHelper1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
121  clientHelper1.SetAttribute
122  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
123  clientHelper1.SetAttribute
124  ("PacketSize", UintegerValue (1000));
125 
126  ApplicationContainer clientApps1;
127  AddressValue remoteAddress
129  clientHelper1.SetAttribute ("Remote", remoteAddress);
130  clientApps1.Add (clientHelper1.Install (n0n2.Get (0)));
131  clientApps1.Start (Seconds (client_start_time));
132  clientApps1.Stop (Seconds (client_stop_time));
133 
134  // Connection two
135  OnOffHelper clientHelper2 ("ns3::TcpSocketFactory", Address ());
136  clientHelper2.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
137  clientHelper2.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
138  clientHelper2.SetAttribute
139  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
140  clientHelper2.SetAttribute
141  ("PacketSize", UintegerValue (1000));
142 
143  ApplicationContainer clientApps2;
144  clientHelper2.SetAttribute ("Remote", remoteAddress);
145  clientApps2.Add (clientHelper2.Install (n1n2.Get (0)));
146  clientApps2.Start (Seconds (3.0));
147  clientApps2.Stop (Seconds (client_stop_time));
148  }
149  else // 4 or 5
150  {
151  // SINKs
152  // #1
153  uint16_t port1 = 50001;
154  Address sinkLocalAddress1 (InetSocketAddress (Ipv4Address::GetAny (), port1));
155  PacketSinkHelper sinkHelper1 ("ns3::TcpSocketFactory", sinkLocalAddress1);
156  ApplicationContainer sinkApp1 = sinkHelper1.Install (n3n4.Get (1));
157  sinkApp1.Start (Seconds (sink_start_time));
158  sinkApp1.Stop (Seconds (sink_stop_time));
159  // #2
160  uint16_t port2 = 50002;
161  Address sinkLocalAddress2 (InetSocketAddress (Ipv4Address::GetAny (), port2));
162  PacketSinkHelper sinkHelper2 ("ns3::TcpSocketFactory", sinkLocalAddress2);
163  ApplicationContainer sinkApp2 = sinkHelper2.Install (n3n5.Get (1));
164  sinkApp2.Start (Seconds (sink_start_time));
165  sinkApp2.Stop (Seconds (sink_stop_time));
166  // #3
167  uint16_t port3 = 50003;
168  Address sinkLocalAddress3 (InetSocketAddress (Ipv4Address::GetAny (), port3));
169  PacketSinkHelper sinkHelper3 ("ns3::TcpSocketFactory", sinkLocalAddress3);
170  ApplicationContainer sinkApp3 = sinkHelper3.Install (n0n2.Get (0));
171  sinkApp3.Start (Seconds (sink_start_time));
172  sinkApp3.Stop (Seconds (sink_stop_time));
173  // #4
174  uint16_t port4 = 50004;
175  Address sinkLocalAddress4 (InetSocketAddress (Ipv4Address::GetAny (), port4));
176  PacketSinkHelper sinkHelper4 ("ns3::TcpSocketFactory", sinkLocalAddress4);
177  ApplicationContainer sinkApp4 = sinkHelper4.Install (n1n2.Get (0));
178  sinkApp4.Start (Seconds (sink_start_time));
179  sinkApp4.Stop (Seconds (sink_stop_time));
180 
181  // Connection #1
182  /*
183  * Create the OnOff applications to send TCP to the server
184  * onoffhelper is a client that send data to TCP destination
185  */
186  OnOffHelper clientHelper1 ("ns3::TcpSocketFactory", Address ());
187  clientHelper1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
188  clientHelper1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
189  clientHelper1.SetAttribute
190  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
191  clientHelper1.SetAttribute
192  ("PacketSize", UintegerValue (1000));
193 
194  ApplicationContainer clientApps1;
195  AddressValue remoteAddress1
196  (InetSocketAddress (i3i4.GetAddress (1), port1));
197  clientHelper1.SetAttribute ("Remote", remoteAddress1);
198  clientApps1.Add (clientHelper1.Install (n0n2.Get (0)));
199  clientApps1.Start (Seconds (client_start_time));
200  clientApps1.Stop (Seconds (client_stop_time));
201 
202  // Connection #2
203  OnOffHelper clientHelper2 ("ns3::TcpSocketFactory", Address ());
204  clientHelper2.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
205  clientHelper2.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
206  clientHelper2.SetAttribute
207  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
208  clientHelper2.SetAttribute
209  ("PacketSize", UintegerValue (1000));
210 
211  ApplicationContainer clientApps2;
212  AddressValue remoteAddress2
213  (InetSocketAddress (i3i5.GetAddress (1), port2));
214  clientHelper2.SetAttribute ("Remote", remoteAddress2);
215  clientApps2.Add (clientHelper2.Install (n1n2.Get (0)));
216  clientApps2.Start (Seconds (2.0));
217  clientApps2.Stop (Seconds (client_stop_time));
218 
219  // Connection #3
220  OnOffHelper clientHelper3 ("ns3::TcpSocketFactory", Address ());
221  clientHelper3.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
222  clientHelper3.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
223  clientHelper3.SetAttribute
224  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
225  clientHelper3.SetAttribute
226  ("PacketSize", UintegerValue (1000));
227 
228  ApplicationContainer clientApps3;
229  AddressValue remoteAddress3
230  (InetSocketAddress (i0i2.GetAddress (0), port3));
231  clientHelper3.SetAttribute ("Remote", remoteAddress3);
232  clientApps3.Add (clientHelper3.Install (n3n4.Get (1)));
233  clientApps3.Start (Seconds (3.5));
234  clientApps3.Stop (Seconds (client_stop_time));
235 
236  // Connection #4
237  OnOffHelper clientHelper4 ("ns3::TcpSocketFactory", Address ());
238  clientHelper4.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
239  clientHelper4.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
240  clientHelper4.SetAttribute
241  ("DataRate", DataRateValue (DataRate ("40b/s")));
242  clientHelper4.SetAttribute
243  ("PacketSize", UintegerValue (5 * 8)); // telnet
244 
245  ApplicationContainer clientApps4;
246  AddressValue remoteAddress4
247  (InetSocketAddress (i1i2.GetAddress (0), port4));
248  clientHelper4.SetAttribute ("Remote", remoteAddress4);
249  clientApps4.Add (clientHelper4.Install (n3n5.Get (1)));
250  clientApps4.Start (Seconds (1.0));
251  clientApps4.Stop (Seconds (client_stop_time));
252  }
253 }
254 
255 int
256 main (int argc, char *argv[])
257 {
258  LogComponentEnable ("RedQueueDisc", LOG_LEVEL_INFO);
259 
260  uint32_t redTest;
261  std::string redLinkDataRate = "1.5Mbps";
262  std::string redLinkDelay = "20ms";
263 
264  std::string pathOut;
265  bool writeForPlot = false;
266  bool writePcap = false;
267  bool flowMonitor = false;
268 
269  bool printRedStats = true;
270 
271  global_start_time = 0.0;
272  global_stop_time = 11;
277 
278  // Configuration and command line parameter parsing
279  redTest = 1;
280  // Will only save in the directory if enable opts below
281  pathOut = "."; // Current directory
282  CommandLine cmd (__FILE__);
283  cmd.AddValue ("testNumber", "Run test 1, 3, 4 or 5", redTest);
284  cmd.AddValue ("pathOut", "Path to save results from --writeForPlot/--writePcap/--writeFlowMonitor", pathOut);
285  cmd.AddValue ("writeForPlot", "<0/1> to write results for plot (gnuplot)", writeForPlot);
286  cmd.AddValue ("writePcap", "<0/1> to write results in pcapfile", writePcap);
287  cmd.AddValue ("writeFlowMonitor", "<0/1> to enable Flow Monitor and write their results", flowMonitor);
288 
289  cmd.Parse (argc, argv);
290  if ( (redTest != 1) && (redTest != 3) && (redTest != 4) && (redTest != 5) )
291  {
292  NS_ABORT_MSG ("Invalid test number. Supported tests are 1, 3, 4 or 5");
293  }
294 
295  NS_LOG_INFO ("Create nodes");
296  NodeContainer c;
297  c.Create (6);
298  Names::Add ( "N0", c.Get (0));
299  Names::Add ( "N1", c.Get (1));
300  Names::Add ( "N2", c.Get (2));
301  Names::Add ( "N3", c.Get (3));
302  Names::Add ( "N4", c.Get (4));
303  Names::Add ( "N5", c.Get (5));
304  n0n2 = NodeContainer (c.Get (0), c.Get (2));
305  n1n2 = NodeContainer (c.Get (1), c.Get (2));
306  n2n3 = NodeContainer (c.Get (2), c.Get (3));
307  n3n4 = NodeContainer (c.Get (3), c.Get (4));
308  n3n5 = NodeContainer (c.Get (3), c.Get (5));
309 
310  Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpNewReno"));
311  // 42 = headers size
312  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000 - 42));
313  Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
314  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (false));
315 
316  uint32_t meanPktSize = 500;
317 
318  // RED params
319  NS_LOG_INFO ("Set RED params");
320  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("1000p"));
321  Config::SetDefault ("ns3::RedQueueDisc::MeanPktSize", UintegerValue (meanPktSize));
322  Config::SetDefault ("ns3::RedQueueDisc::Wait", BooleanValue (true));
323  Config::SetDefault ("ns3::RedQueueDisc::Gentle", BooleanValue (true));
324  Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.002));
325  Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5));
326  Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15));
327 
328  if (redTest == 3) // test like 1, but with bad params
329  {
330  Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (10));
331  Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.003));
332  }
333  else if (redTest == 5) // test 5, same of test 4, but in byte mode
334  {
335  Config::SetDefault ("ns3::RedQueueDisc::MaxSize",
336  QueueSizeValue (QueueSize (QueueSizeUnit::BYTES, 1000 * meanPktSize)));
337  Config::SetDefault ("ns3::RedQueueDisc::Ns1Compat", BooleanValue (true));
338  Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5 * meanPktSize));
339  Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15 * meanPktSize));
340  }
341 
342  NS_LOG_INFO ("Install internet stack on all nodes.");
343  InternetStackHelper internet;
344  internet.Install (c);
345 
346  TrafficControlHelper tchPfifo;
347  uint16_t handle = tchPfifo.SetRootQueueDisc ("ns3::PfifoFastQueueDisc");
348  tchPfifo.AddInternalQueues (handle, 3, "ns3::DropTailQueue", "MaxSize", StringValue ("1000p"));
349 
350  TrafficControlHelper tchRed;
351  tchRed.SetRootQueueDisc ("ns3::RedQueueDisc", "LinkBandwidth", StringValue (redLinkDataRate),
352  "LinkDelay", StringValue (redLinkDelay));
353 
354  NS_LOG_INFO ("Create channels");
355  PointToPointHelper p2p;
356 
357  p2p.SetQueue ("ns3::DropTailQueue");
358  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
359  p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
360  NetDeviceContainer devn0n2 = p2p.Install (n0n2);
361  tchPfifo.Install (devn0n2);
362 
363  p2p.SetQueue ("ns3::DropTailQueue");
364  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
365  p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
366  NetDeviceContainer devn1n2 = p2p.Install (n1n2);
367  tchPfifo.Install (devn1n2);
368 
369  p2p.SetQueue ("ns3::DropTailQueue");
370  p2p.SetDeviceAttribute ("DataRate", StringValue (redLinkDataRate));
371  p2p.SetChannelAttribute ("Delay", StringValue (redLinkDelay));
372  NetDeviceContainer devn2n3 = p2p.Install (n2n3);
373  // only backbone link has RED queue disc
374  QueueDiscContainer queueDiscs = tchRed.Install (devn2n3);
375 
376  p2p.SetQueue ("ns3::DropTailQueue");
377  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
378  p2p.SetChannelAttribute ("Delay", StringValue ("4ms"));
379  NetDeviceContainer devn3n4 = p2p.Install (n3n4);
380  tchPfifo.Install (devn3n4);
381 
382  p2p.SetQueue ("ns3::DropTailQueue");
383  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
384  p2p.SetChannelAttribute ("Delay", StringValue ("5ms"));
385  NetDeviceContainer devn3n5 = p2p.Install (n3n5);
386  tchPfifo.Install (devn3n5);
387 
388  NS_LOG_INFO ("Assign IP Addresses");
389  Ipv4AddressHelper ipv4;
390 
391  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
392  i0i2 = ipv4.Assign (devn0n2);
393 
394  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
395  i1i2 = ipv4.Assign (devn1n2);
396 
397  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
398  i2i3 = ipv4.Assign (devn2n3);
399 
400  ipv4.SetBase ("10.1.4.0", "255.255.255.0");
401  i3i4 = ipv4.Assign (devn3n4);
402 
403  ipv4.SetBase ("10.1.5.0", "255.255.255.0");
404  i3i5 = ipv4.Assign (devn3n5);
405 
406  // Set up the routing
408 
409  if (redTest == 5)
410  {
411  // like in ns2 test, r2 -> r1, have a queue in packet mode
412  Ptr<QueueDisc> queue = queueDiscs.Get (1);
413 
414  queue->SetMaxSize (QueueSize ("1000p"));
415  StaticCast<RedQueueDisc> (queue)->SetTh (5, 15);
416  }
417 
418  BuildAppsTest (redTest);
419 
420  if (writePcap)
421  {
422  PointToPointHelper ptp;
423  std::stringstream stmp;
424  stmp << pathOut << "/red";
425  ptp.EnablePcapAll (stmp.str ().c_str ());
426  }
427 
428  Ptr<FlowMonitor> flowmon;
429  if (flowMonitor)
430  {
431  FlowMonitorHelper flowmonHelper;
432  flowmon = flowmonHelper.InstallAll ();
433  }
434 
435  if (writeForPlot)
436  {
437  filePlotQueue << pathOut << "/" << "red-queue.plotme";
438  filePlotQueueAvg << pathOut << "/" << "red-queue_avg.plotme";
439 
440  remove (filePlotQueue.str ().c_str ());
441  remove (filePlotQueueAvg.str ().c_str ());
442  Ptr<QueueDisc> queue = queueDiscs.Get (0);
444  }
445 
447  Simulator::Run ();
448 
449  if (flowMonitor)
450  {
451  std::stringstream stmp;
452  stmp << pathOut << "/red.flowmon";
453 
454  flowmon->SerializeToXmlFile (stmp.str ().c_str (), false, false);
455  }
456 
457  if (printRedStats)
458  {
459  QueueDisc::Stats st = queueDiscs.Get (0)->GetStats ();
460  std::cout << "*** RED stats from Node 2 queue disc ***" << std::endl;
461  std::cout << st << std::endl;
462 
463  st = queueDiscs.Get (1)->GetStats ();
464  std::cout << "*** RED stats from Node 3 queue disc ***" << std::endl;
465  std::cout << st << std::endl;
466  }
467 
469 
470  return 0;
471 }
a polymophic address class
Definition: address.h:91
AttributeValue implementation for Address.
Definition: address.h:278
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.
Definition: data-rate.h:298
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.
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.
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...
static Ipv4Address GetAny(void)
static void PopulateRoutingTables(void)
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:768
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 SetQueue(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue())
Each point to point net device must have a queue to pass packets through.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
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
bool SetMaxSize(QueueSize size)
Set the maximum size of the queue disc.
Definition: queue-disc.cc:480
const Stats & GetStats(void)
Retrieve all the collected statistics.
Definition: queue-disc.cc:419
Class for representing queue sizes.
Definition: queue-size.h:95
uint32_t GetValue() const
Get the underlying value.
Definition: queue-size.cc:174
AttributeValue implementation for QueueSize.
Definition: queue-size.h:221
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:587
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
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:379
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_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
@ BYTES
Use number of bytes for queue size.
Definition: queue-size.h:45
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ LOG_LEVEL_INFO
LOG_INFO and above.
Definition: log.h:107
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:35
Ipv4InterfaceContainer i0i2
Definition: red-tests.cc:70
void BuildAppsTest(uint32_t test)
Definition: red-tests.cc:100
double client_start_time
Definition: red-tests.cc:61
double sink_stop_time
Definition: red-tests.cc:60
double sink_start_time
Definition: red-tests.cc:59
double global_stop_time
Definition: red-tests.cc:58
NodeContainer n2n3
Definition: red-tests.cc:66
double avgQueueSize
Definition: red-tests.cc:54
NodeContainer n1n2
Definition: red-tests.cc:65
NodeContainer n3n4
Definition: red-tests.cc:67
std::stringstream filePlotQueueAvg
Definition: red-tests.cc:77
void CheckQueueSize(Ptr< QueueDisc > queue)
Definition: red-tests.cc:80
std::stringstream filePlotQueue
Definition: red-tests.cc:76
double global_start_time
Definition: red-tests.cc:57
Ipv4InterfaceContainer i1i2
Definition: red-tests.cc:71
Ipv4InterfaceContainer i3i4
Definition: red-tests.cc:73
NodeContainer n0n2
Definition: red-tests.cc:64
double client_stop_time
Definition: red-tests.cc:62
uint32_t checkTimes
Definition: red-tests.cc:51
NodeContainer n3n5
Definition: red-tests.cc:68
Ipv4InterfaceContainer i3i5
Definition: red-tests.cc:74
Ipv4InterfaceContainer i2i3
Definition: red-tests.cc:72
Structure that keeps the queue disc statistics.
Definition: queue-disc.h:186