A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  *
19  */
20 
40 #include "ns3/core-module.h"
41 #include "ns3/network-module.h"
42 #include "ns3/internet-module.h"
43 #include "ns3/flow-monitor-helper.h"
44 #include "ns3/point-to-point-module.h"
45 #include "ns3/applications-module.h"
46 
47 using namespace ns3;
48 
49 NS_LOG_COMPONENT_DEFINE ("RedTests");
50 
51 uint32_t checkTimes;
52 double avgQueueSize;
53 
54 // The times
61 
67 
73 
74 std::stringstream filePlotQueue;
75 std::stringstream filePlotQueueAvg;
76 
77 void
79 {
80  uint32_t qSize = StaticCast<RedQueue> (queue)->GetQueueSize ();
81 
82  avgQueueSize += qSize;
83  checkTimes++;
84 
85  // check queue size every 1/100 of a second
86  Simulator::Schedule (Seconds (0.01), &CheckQueueSize, queue);
87 
88  std::ofstream fPlotQueue (filePlotQueue.str ().c_str (), std::ios::out|std::ios::app);
89  fPlotQueue << Simulator::Now ().GetSeconds () << " " << qSize << std::endl;
90  fPlotQueue.close ();
91 
92  std::ofstream fPlotQueueAvg (filePlotQueueAvg.str ().c_str (), std::ios::out|std::ios::app);
93  fPlotQueueAvg << Simulator::Now ().GetSeconds () << " " << avgQueueSize / checkTimes << std::endl;
94  fPlotQueueAvg.close ();
95 }
96 
97 void
98 BuildAppsTest (uint32_t test)
99 {
100  if ( (test == 1) || (test == 3) )
101  {
102  // SINK is in the right side
103  uint16_t port = 50000;
104  Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
105  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
106  ApplicationContainer sinkApp = sinkHelper.Install (n3n4.Get (1));
107  sinkApp.Start (Seconds (sink_start_time));
108  sinkApp.Stop (Seconds (sink_stop_time));
109 
110  // Connection one
111  // Clients are in left side
112  /*
113  * Create the OnOff applications to send TCP to the server
114  * onoffhelper is a client that send data to TCP destination
115  */
116  OnOffHelper clientHelper1 ("ns3::TcpSocketFactory", Address ());
117  clientHelper1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
118  clientHelper1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
119  clientHelper1.SetAttribute
120  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
121  clientHelper1.SetAttribute
122  ("PacketSize", UintegerValue (1000));
123 
124  ApplicationContainer clientApps1;
125  AddressValue remoteAddress
127  clientHelper1.SetAttribute ("Remote", remoteAddress);
128  clientApps1.Add (clientHelper1.Install (n0n2.Get (0)));
129  clientApps1.Start (Seconds (client_start_time));
130  clientApps1.Stop (Seconds (client_stop_time));
131 
132  // Connection two
133  OnOffHelper clientHelper2 ("ns3::TcpSocketFactory", Address ());
134  clientHelper2.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
135  clientHelper2.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
136  clientHelper2.SetAttribute
137  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
138  clientHelper2.SetAttribute
139  ("PacketSize", UintegerValue (1000));
140 
141  ApplicationContainer clientApps2;
142  clientHelper2.SetAttribute ("Remote", remoteAddress);
143  clientApps2.Add (clientHelper2.Install (n1n2.Get (0)));
144  clientApps2.Start (Seconds (3.0));
145  clientApps2.Stop (Seconds (client_stop_time));
146  }
147  else // 4 or 5
148  {
149  // SINKs
150  // #1
151  uint16_t port1 = 50001;
152  Address sinkLocalAddress1 (InetSocketAddress (Ipv4Address::GetAny (), port1));
153  PacketSinkHelper sinkHelper1 ("ns3::TcpSocketFactory", sinkLocalAddress1);
154  ApplicationContainer sinkApp1 = sinkHelper1.Install (n3n4.Get (1));
155  sinkApp1.Start (Seconds (sink_start_time));
156  sinkApp1.Stop (Seconds (sink_stop_time));
157  // #2
158  uint16_t port2 = 50002;
159  Address sinkLocalAddress2 (InetSocketAddress (Ipv4Address::GetAny (), port2));
160  PacketSinkHelper sinkHelper2 ("ns3::TcpSocketFactory", sinkLocalAddress2);
161  ApplicationContainer sinkApp2 = sinkHelper2.Install (n3n5.Get (1));
162  sinkApp2.Start (Seconds (sink_start_time));
163  sinkApp2.Stop (Seconds (sink_stop_time));
164  // #3
165  uint16_t port3 = 50003;
166  Address sinkLocalAddress3 (InetSocketAddress (Ipv4Address::GetAny (), port3));
167  PacketSinkHelper sinkHelper3 ("ns3::TcpSocketFactory", sinkLocalAddress3);
168  ApplicationContainer sinkApp3 = sinkHelper3.Install (n0n2.Get (0));
169  sinkApp3.Start (Seconds (sink_start_time));
170  sinkApp3.Stop (Seconds (sink_stop_time));
171  // #4
172  uint16_t port4 = 50004;
173  Address sinkLocalAddress4 (InetSocketAddress (Ipv4Address::GetAny (), port4));
174  PacketSinkHelper sinkHelper4 ("ns3::TcpSocketFactory", sinkLocalAddress4);
175  ApplicationContainer sinkApp4 = sinkHelper4.Install (n1n2.Get (0));
176  sinkApp4.Start (Seconds (sink_start_time));
177  sinkApp4.Stop (Seconds (sink_stop_time));
178 
179  // Connection #1
180  /*
181  * Create the OnOff applications to send TCP to the server
182  * onoffhelper is a client that send data to TCP destination
183  */
184  OnOffHelper clientHelper1 ("ns3::TcpSocketFactory", Address ());
185  clientHelper1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
186  clientHelper1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
187  clientHelper1.SetAttribute
188  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
189  clientHelper1.SetAttribute
190  ("PacketSize", UintegerValue (1000));
191 
192  ApplicationContainer clientApps1;
193  AddressValue remoteAddress1
194  (InetSocketAddress (i3i4.GetAddress (1), port1));
195  clientHelper1.SetAttribute ("Remote", remoteAddress1);
196  clientApps1.Add (clientHelper1.Install (n0n2.Get (0)));
197  clientApps1.Start (Seconds (client_start_time));
198  clientApps1.Stop (Seconds (client_stop_time));
199 
200  // Connection #2
201  OnOffHelper clientHelper2 ("ns3::TcpSocketFactory", Address ());
202  clientHelper2.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
203  clientHelper2.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
204  clientHelper2.SetAttribute
205  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
206  clientHelper2.SetAttribute
207  ("PacketSize", UintegerValue (1000));
208 
209  ApplicationContainer clientApps2;
210  AddressValue remoteAddress2
211  (InetSocketAddress (i3i5.GetAddress (1), port2));
212  clientHelper2.SetAttribute ("Remote", remoteAddress2);
213  clientApps2.Add (clientHelper2.Install (n1n2.Get (0)));
214  clientApps2.Start (Seconds (2.0));
215  clientApps2.Stop (Seconds (client_stop_time));
216 
217  // Connection #3
218  OnOffHelper clientHelper3 ("ns3::TcpSocketFactory", Address ());
219  clientHelper3.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
220  clientHelper3.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
221  clientHelper3.SetAttribute
222  ("DataRate", DataRateValue (DataRate ("10Mb/s")));
223  clientHelper3.SetAttribute
224  ("PacketSize", UintegerValue (1000));
225 
226  ApplicationContainer clientApps3;
227  AddressValue remoteAddress3
228  (InetSocketAddress (i0i2.GetAddress (0), port3));
229  clientHelper3.SetAttribute ("Remote", remoteAddress3);
230  clientApps3.Add (clientHelper3.Install (n3n4.Get (1)));
231  clientApps3.Start (Seconds (3.5));
232  clientApps3.Stop (Seconds (client_stop_time));
233 
234  // Connection #4
235  OnOffHelper clientHelper4 ("ns3::TcpSocketFactory", Address ());
236  clientHelper4.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
237  clientHelper4.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
238  clientHelper4.SetAttribute
239  ("DataRate", DataRateValue (DataRate ("40b/s")));
240  clientHelper4.SetAttribute
241  ("PacketSize", UintegerValue (5 * 8)); // telnet
242 
243  ApplicationContainer clientApps4;
244  AddressValue remoteAddress4
245  (InetSocketAddress (i1i2.GetAddress (0), port4));
246  clientHelper4.SetAttribute ("Remote", remoteAddress4);
247  clientApps4.Add (clientHelper4.Install (n3n5.Get (1)));
248  clientApps4.Start (Seconds (1.0));
249  clientApps4.Stop (Seconds (client_stop_time));
250  }
251 }
252 
253 int
254 main (int argc, char *argv[])
255 {
256  // LogComponentEnable ("RedExamples", LOG_LEVEL_INFO);
257  // LogComponentEnable ("TcpNewReno", LOG_LEVEL_INFO);
258  // LogComponentEnable ("RedQueue", LOG_LEVEL_FUNCTION);
259  LogComponentEnable ("RedQueue", LOG_LEVEL_INFO);
260 
261  uint32_t redTest;
262  std::string redLinkDataRate = "1.5Mbps";
263  std::string redLinkDelay = "20ms";
264 
265  std::string pathOut;
266  bool writeForPlot = false;
267  bool writePcap = false;
268  bool flowMonitor = false;
269 
270  bool printRedStats = true;
271 
272  global_start_time = 0.0;
273  global_stop_time = 11;
278 
279  // Configuration and command line parameter parsing
280  redTest = 1;
281  // Will only save in the directory if enable opts below
282  pathOut = "."; // Current directory
283  CommandLine cmd;
284  cmd.AddValue ("testNumber", "Run test 1, 3, 4 or 5", redTest);
285  cmd.AddValue ("pathOut", "Path to save results from --writeForPlot/--writePcap/--writeFlowMonitor", pathOut);
286  cmd.AddValue ("writeForPlot", "<0/1> to write results for plot (gnuplot)", writeForPlot);
287  cmd.AddValue ("writePcap", "<0/1> to write results in pcapfile", writePcap);
288  cmd.AddValue ("writeFlowMonitor", "<0/1> to enable Flow Monitor and write their results", flowMonitor);
289 
290  cmd.Parse (argc, argv);
291  if ( (redTest != 1) && (redTest != 3) && (redTest != 4) && (redTest != 5) )
292  {
293  NS_ABORT_MSG ("Invalid test number. Supported tests are 1, 3, 4 or 5");
294  }
295 
296  NS_LOG_INFO ("Create nodes");
297  NodeContainer c;
298  c.Create (6);
299  Names::Add ( "N0", c.Get (0));
300  Names::Add ( "N1", c.Get (1));
301  Names::Add ( "N2", c.Get (2));
302  Names::Add ( "N3", c.Get (3));
303  Names::Add ( "N4", c.Get (4));
304  Names::Add ( "N5", c.Get (5));
305  n0n2 = NodeContainer (c.Get (0), c.Get (2));
306  n1n2 = NodeContainer (c.Get (1), c.Get (2));
307  n2n3 = NodeContainer (c.Get (2), c.Get (3));
308  n3n4 = NodeContainer (c.Get (3), c.Get (4));
309  n3n5 = NodeContainer (c.Get (3), c.Get (5));
310 
311  Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpReno"));
312  // 42 = headers size
313  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000 - 42));
314  Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
315  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (false));
316 
317  uint32_t meanPktSize = 500;
318 
319  // RED params
320  NS_LOG_INFO ("Set RED params");
321  Config::SetDefault ("ns3::RedQueue::Mode", StringValue ("QUEUE_MODE_PACKETS"));
322  Config::SetDefault ("ns3::RedQueue::MeanPktSize", UintegerValue (meanPktSize));
323  Config::SetDefault ("ns3::RedQueue::Wait", BooleanValue (true));
324  Config::SetDefault ("ns3::RedQueue::Gentle", BooleanValue (true));
325  Config::SetDefault ("ns3::RedQueue::QW", DoubleValue (0.002));
326  Config::SetDefault ("ns3::RedQueue::MinTh", DoubleValue (5));
327  Config::SetDefault ("ns3::RedQueue::MaxTh", DoubleValue (15));
328  Config::SetDefault ("ns3::RedQueue::QueueLimit", UintegerValue (25));
329 
330  if (redTest == 3) // test like 1, but with bad params
331  {
332  Config::SetDefault ("ns3::RedQueue::MaxTh", DoubleValue (10));
333  Config::SetDefault ("ns3::RedQueue::QW", DoubleValue (0.003));
334  }
335  else if (redTest == 5) // test 5, same of test 4, but in byte mode
336  {
337  Config::SetDefault ("ns3::RedQueue::Mode", StringValue ("QUEUE_MODE_BYTES"));
338  Config::SetDefault ("ns3::RedQueue::Ns1Compat", BooleanValue (true));
339  Config::SetDefault ("ns3::RedQueue::MinTh", DoubleValue (5 * meanPktSize));
340  Config::SetDefault ("ns3::RedQueue::MaxTh", DoubleValue (15 * meanPktSize));
341  Config::SetDefault ("ns3::RedQueue::QueueLimit", UintegerValue (25 * meanPktSize));
342  }
343 
344  NS_LOG_INFO ("Install internet stack on all nodes.");
345  InternetStackHelper internet;
346  internet.Install (c);
347 
348  NS_LOG_INFO ("Create channels");
349  PointToPointHelper p2p;
350 
351  p2p.SetQueue ("ns3::DropTailQueue");
352  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
353  p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
354  NetDeviceContainer devn0n2 = p2p.Install (n0n2);
355 
356  p2p.SetQueue ("ns3::DropTailQueue");
357  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
358  p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
359  NetDeviceContainer devn1n2 = p2p.Install (n1n2);
360 
361  p2p.SetQueue ("ns3::RedQueue", // only backbone link has RED queue
362  "LinkBandwidth", StringValue (redLinkDataRate),
363  "LinkDelay", StringValue (redLinkDelay));
364  p2p.SetDeviceAttribute ("DataRate", StringValue (redLinkDataRate));
365  p2p.SetChannelAttribute ("Delay", StringValue (redLinkDelay));
366  NetDeviceContainer devn2n3 = p2p.Install (n2n3);
367 
368  p2p.SetQueue ("ns3::DropTailQueue");
369  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
370  p2p.SetChannelAttribute ("Delay", StringValue ("4ms"));
371  NetDeviceContainer devn3n4 = p2p.Install (n3n4);
372 
373  p2p.SetQueue ("ns3::DropTailQueue");
374  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
375  p2p.SetChannelAttribute ("Delay", StringValue ("5ms"));
376  NetDeviceContainer devn3n5 = p2p.Install (n3n5);
377 
378  NS_LOG_INFO ("Assign IP Addresses");
379  Ipv4AddressHelper ipv4;
380 
381  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
382  i0i2 = ipv4.Assign (devn0n2);
383 
384  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
385  i1i2 = ipv4.Assign (devn1n2);
386 
387  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
388  i2i3 = ipv4.Assign (devn2n3);
389 
390  ipv4.SetBase ("10.1.4.0", "255.255.255.0");
391  i3i4 = ipv4.Assign (devn3n4);
392 
393  ipv4.SetBase ("10.1.5.0", "255.255.255.0");
394  i3i5 = ipv4.Assign (devn3n5);
395 
396  // Set up the routing
398 
399  if (redTest == 5)
400  {
401  // like in ns2 test, r2 -> r1, have a queue in packet mode
402  Ptr<PointToPointNetDevice> nd = StaticCast<PointToPointNetDevice> (devn2n3.Get (1));
403  Ptr<Queue> queue = nd->GetQueue ();
404 
405  StaticCast<RedQueue> (queue)->SetMode (RedQueue::QUEUE_MODE_PACKETS);
406  StaticCast<RedQueue> (queue)->SetTh (5, 15);
407  StaticCast<RedQueue> (queue)->SetQueueLimit (25);
408  }
409 
410  BuildAppsTest (redTest);
411 
412  if (writePcap)
413  {
414  PointToPointHelper ptp;
415  std::stringstream stmp;
416  stmp << pathOut << "/red";
417  ptp.EnablePcapAll (stmp.str ().c_str ());
418  }
419 
420  Ptr<FlowMonitor> flowmon;
421  if (flowMonitor)
422  {
423  FlowMonitorHelper flowmonHelper;
424  flowmon = flowmonHelper.InstallAll ();
425  }
426 
427  if (writeForPlot)
428  {
429  filePlotQueue << pathOut << "/" << "red-queue.plotme";
430  filePlotQueueAvg << pathOut << "/" << "red-queue_avg.plotme";
431 
432  remove (filePlotQueue.str ().c_str ());
433  remove (filePlotQueueAvg.str ().c_str ());
434  Ptr<PointToPointNetDevice> nd = StaticCast<PointToPointNetDevice> (devn2n3.Get (0));
435  Ptr<Queue> queue = nd->GetQueue ();
437  }
438 
439  Simulator::Stop (Seconds (sink_stop_time));
440  Simulator::Run ();
441 
442  if (flowMonitor)
443  {
444  std::stringstream stmp;
445  stmp << pathOut << "/red.flowmon";
446 
447  flowmon->SerializeToXmlFile (stmp.str ().c_str (), false, false);
448  }
449 
450  if (printRedStats)
451  {
452  Ptr<PointToPointNetDevice> nd = StaticCast<PointToPointNetDevice> (devn2n3.Get (0));
453  RedQueue::Stats st = StaticCast<RedQueue> (nd->GetQueue ())->GetStats ();
454  std::cout << "*** RED stats from Node 2 queue ***" << std::endl;
455  std::cout << "\t " << st.unforcedDrop << " drops due prob mark" << std::endl;
456  std::cout << "\t " << st.forcedDrop << " drops due hard mark" << std::endl;
457  std::cout << "\t " << st.qLimDrop << " drops due queue full" << std::endl;
458 
459  nd = StaticCast<PointToPointNetDevice> (devn2n3.Get (1));
460  st = StaticCast<RedQueue> (nd->GetQueue ())->GetStats ();
461  std::cout << "*** RED stats from Node 3 queue ***" << std::endl;
462  std::cout << "\t " << st.unforcedDrop << " drops due prob mark" << std::endl;
463  std::cout << "\t " << st.forcedDrop << " drops due hard mark" << std::endl;
464  std::cout << "\t " << st.qLimDrop << " drops due queue full" << std::endl;
465  }
466 
468 
469  return 0;
470 }
holds a vector of ns3::Application pointers.
an Inet address class
void BuildAppsTest(uint32_t test)
Definition: red-tests.cc:98
static Ipv4Address GetAny(void)
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
Ptr< Queue > GetQueue(void) const
Get a copy of the attached Queue.
Hold a bool native type.
Definition: boolean.h:38
NodeContainer n1n2
Definition: red-tests.cc:63
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
holds a vector of std::pair of Ptr and interface index.
Ipv4InterfaceContainer i2i3
Definition: red-tests.cc:70
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation.
hold variables of type string
Definition: string.h:19
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
NodeContainer n3n4
Definition: red-tests.cc:65
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.
static void Run(void)
Run the simulation until one of:
Definition: simulator.cc:157
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Definition: log.h:298
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
double client_stop_time
Definition: red-tests.cc:60
Build a set of PointToPointNetDevice objects.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:824
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
Ipv4InterfaceContainer i3i5
Definition: red-tests.cc:72
uint16_t port
Definition: dsdv-manet.cc:44
a polymophic address class
Definition: address.h:86
double avgQueueSize
Definition: red-tests.cc:52
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr obj.
Definition: names.cc:616
Class for representing data rates.
Definition: data-rate.h:71
double GetSeconds(void) const
Definition: nstime.h:274
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 ...
NodeContainer n3n5
Definition: red-tests.cc:66
Hold an unsigned integer type.
Definition: uinteger.h:46
holds a vector of ns3::NetDevice pointers
Ipv4InterfaceContainer i3i4
Definition: red-tests.cc:71
Ipv4InterfaceContainer i0i2
Definition: red-tests.cc:68
void CheckQueueSize(Ptr< Queue > queue)
Definition: red-tests.cc:78
double global_start_time
Definition: red-tests.cc:55
static void Bind(std::string name, const AttributeValue &value)
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
double sink_start_time
Definition: red-tests.cc:57
Parse command-line arguments.
Definition: command-line.h:152
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Definition: simulator.cc:121
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:667
keep track of a set of node pointers.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Helper to enable IPv4 flow monitoring on a set of Nodes.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:985
NodeContainer n0n2
Definition: red-tests.cc:62
static Time Now(void)
Return the "current simulation time".
Definition: simulator.cc:180
std::stringstream filePlotQueue
Definition: red-tests.cc:74
std::stringstream filePlotQueueAvg
Definition: red-tests.cc:75
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
double client_start_time
Definition: red-tests.cc:59
Use number of packets for maximum queue size.
Definition: queue.h:124
#define NS_ABORT_MSG(msg)
Abnormal program termination.
Definition: abort.h:43
hold objects of type ns3::Address
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
hold objects of type ns3::DataRate
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Definition: command-line.h:408
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Definition: simulator.cc:165
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
Ipv4InterfaceContainer i1i2
Definition: red-tests.cc:69
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
uint32_t checkTimes
Definition: red-tests.cc:51
double global_stop_time
Definition: red-tests.cc:56
int main(int argc, char *argv[])
Definition: red-tests.cc:254
NodeContainer n2n3
Definition: red-tests.cc:64
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
void Parse(int argc, char *argv[])
Parse the program arguments.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Hold a floating point type.
Definition: double.h:41
double sink_stop_time
Definition: red-tests.cc:58
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void test(void)
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
void LogComponentEnable(char const *name, enum LogLevel level)
Definition: log.cc:311
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const