A Discrete-Event Network Simulator
API
tcp-validation.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 Cable Television Laboratories, Inc.
4  * Copyright (c) 2020 Tom Henderson (adapted for DCTCP testing)
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions, and the following disclaimer,
11  * without modification.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * 3. The names of the authors may not be used to endorse or promote products
16  * derived from this software without specific prior written permission.
17  *
18  * Alternatively, provided that this notice is retained in full, this
19  * software may be distributed under the terms of the GNU General
20  * Public License ("GPL") version 2, in which case the provisions of the
21  * GPL apply INSTEAD OF those given above.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 // This program is designed to observe long-running TCP congestion control
37 // behavior over a configurable bottleneck link. The program is also
38 // instrumented to check progam data against validated results, when
39 // the validation option is enabled.
40 //
41 // ---> downstream (primary data transfer from servers to clients)
42 // <--- upstream (return acks and ICMP echo response)
43 //
44 // ---- bottleneck link ----
45 // servers ---| WR |--------------------| LR |--- clients
46 // ---- ----
47 // ns-3 node IDs:
48 // nodes 0-2 3 4 5-7
49 //
50 // - The box WR is notionally a WAN router, aggregating all server links
51 // - The box LR is notionally a LAN router, aggregating all client links
52 // - Three servers are connected to WR, three clients are connected to LR
53 //
54 // clients and servers are configured for ICMP measurements and TCP throughput
55 // and latency measurements in the downstream direction
56 //
57 // All link rates are enforced by a point-to-point (P2P) ns-3 model with full
58 // duplex operation. Dynamic queue limits
59 // (BQL) are enabled to allow for queueing to occur at the priority queue layer;
60 // the notional P2P hardware device queue is limited to three packets.
61 //
62 // One-way link delays and link rates
63 // -----------------------------------
64 // (1) server to WR links, 1000 Mbps, 1us delay
65 // (2) bottleneck link: configurable rate, configurable delay
66 // (3) client to LR links, 1000 Mbps, 1us delay
67 //
68 // By default, ns-3 FQ-CoDel model is installed on all interfaces, but
69 // the bottleneck queue uses CoDel by default and is configurable.
70 //
71 // The ns-3 FQ-CoDel model uses ns-3 defaults:
72 // - 100ms interval
73 // - 5ms target
74 // - drop batch size of 64 packets
75 // - minbytes of 1500
76 //
77 // Default simulation time is 70 sec. For single flow experiments, the flow is
78 // started at simulation time 5 sec; if a second flow is used, it starts
79 // at 15 sec.
80 //
81 // ping frequency is set at 100ms.
82 //
83 // A command-line option to enable a step-threshold CE threshold
84 // from the CoDel queue model is provided.
85 //
86 // Measure:
87 // - ping RTT
88 // - TCP RTT estimate
89 // - TCP throughput
90 //
91 // IPv4 addressing
92 // ----------------------------
93 // pingServer 10.1.1.2 (ping source)
94 // firstServer 10.1.2.2 (data sender)
95 // secondServer 10.1.3.2 (data sender)
96 // pingClient 192.168.1.2
97 // firstClient 192.168.2.2
98 // secondClient 192.168.3.2
99 //
100 // Program Options:
101 // ---------------
102 // --firstTcpType: first TCP type (cubic, dctcp, or reno) [cubic]
103 // --secondTcpType: second TCP type (cubic, dctcp, or reno) []
104 // --queueType: bottleneck queue type (fq, codel, pie, or red) [codel]
105 // --baseRtt: base RTT [+80ms]
106 // --ceThreshold: CoDel CE threshold (for DCTCP) [+1ms]
107 // --linkRate: data rate of bottleneck link [50000000bps]
108 // --stopTime: simulation stop time [+1.16667min]
109 // --queueUseEcn: use ECN on queue [false]
110 // --enablePcap: enable Pcap [false]
111 // --validate: validation case to run []
112 //
113 // validation cases (and syntax of how to run):
114 // ------------
115 // Case 'dctcp-10ms': DCTCP single flow, 10ms base RTT, 50 Mbps link, ECN enabled, CoDel:
116 // ./waf --run 'tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=10ms --queueUseEcn=1 --stopTime=15s --validate=1 --validation=dctcp-10ms'
117 // - Throughput between 48 Mbps and 49 Mbps for time greater than 5.6s
118 // - DCTCP alpha below 0.1 for time greater than 5.4s
119 // - DCTCP alpha between 0.06 and 0.085 for time greater than 7s
120 //
121 // Case 'dctcp-80ms': DCTCP single flow, 80ms base RTT, 50 Mbps link, ECN enabled, CoDel:
122 // ./waf --run 'tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=80ms --queueUseEcn=1 --stopTime=40s --validate=1 --validation=dctcp-80ms'
123 // - Throughput less than 20 Mbps for time less than 14s
124 // - Throughput less than 48 Mbps for time less than 30s
125 // - Throughput between 47.5 Mbps and 48.5 for time greater than 32s
126 // - DCTCP alpha above 0.1 for time less than 7.5
127 // - DCTCP alpha below 0.01 for time greater than 11 and less than 30
128 // - DCTCP alpha between 0.015 and 0.025 for time greater than 34
129 //
130 // Case 'cubic-50ms-no-ecn': CUBIC single flow, 50ms base RTT, 50 Mbps link, ECN disabled, CoDel:
131 // ./waf --run 'tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=1 --validation=cubic-50ms-no-ecn'
132 // - Maximum value of cwnd is 511 segments at 5.4593 seconds
133 // - cwnd decreases to 173 segments at 5.80304 seconds
134 // - cwnd reaches another local maxima around 14.2815 seconds of 236 segments
135 // - cwnd reaches a second maximum around 18.048 seconds of 234 segments
136 //
137 // Case 'cubic-50ms-ecn': CUBIC single flow, 50ms base RTT, 50 Mbps link, ECN enabled, CoDel:
138 // ./waf --run 'tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=1 --validation=cubic-50ms-no-ecn'
139 // - Maximum value of cwnd is 511 segments at 5.4593 seconds
140 // - cwnd decreases to 173 segments at 5.7939 seconds
141 // - cwnd reaches another local maxima around 14.3477 seconds of 236 segments
142 // - cwnd reaches a second maximum around 18.064 seconds of 234 segments
143 
144 #include <iostream>
145 #include <fstream>
146 #include <string>
147 #include "ns3/core-module.h"
148 #include "ns3/network-module.h"
149 #include "ns3/applications-module.h"
150 #include "ns3/traffic-control-module.h"
151 #include "ns3/internet-module.h"
152 #include "ns3/internet-apps-module.h"
153 #include "ns3/point-to-point-module.h"
154 
155 using namespace ns3;
156 
157 NS_LOG_COMPONENT_DEFINE ("TcpValidation");
158 
159 // These variables are declared outside of main() so that they can
160 // be used in trace sinks.
161 uint32_t g_firstBytesReceived = 0;
163 uint32_t g_marksObserved = 0;
164 uint32_t g_dropsObserved = 0;
165 std::string g_validate = ""; // Empty string disables this mode
166 bool g_validationFailed = false;
167 
168 void
169 TraceFirstCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
170 {
171  // TCP segment size is configured below to be 1448 bytes
172  // so that we can report cwnd in units of segments
173  if (g_validate == "")
174  {
175  *ofStream << Simulator::Now ().GetSeconds () << " " << static_cast<double> (newCwnd) / 1448 << std::endl;
176  }
177  // Validation checks; both the ECN enabled and disabled cases are similar
178  if (g_validate == "cubic-50ms-no-ecn" || g_validate == "cubic-50ms-ecn")
179  {
180  double now = Simulator::Now ().GetSeconds ();
181  double cwnd = static_cast<double> (newCwnd) / 1448;
182  if ((now > 5.43) && (now < 5.465) && (cwnd < 500))
183  {
184  g_validationFailed = true;
185  }
186  else if ((now > 5.795) && (now < 6) && (cwnd > 190))
187  {
188  g_validationFailed = true;
189  }
190  else if ((now > 14) && (now < 14.328) && (cwnd < 225))
191  {
192  g_validationFailed = true;
193  }
194  else if ((now > 17) && (now < 18.2) && (cwnd < 225))
195  {
196  g_validationFailed = true;
197  }
198  }
199 }
200 
201 void
202 TraceFirstDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
203 {
204  if (g_validate == "")
205  {
206  *ofStream << Simulator::Now ().GetSeconds () << " " << alpha << std::endl;
207  }
208  // Validation checks
209  if (g_validate == "dctcp-80ms")
210  {
211  double now = Simulator::Now ().GetSeconds ();
212  if ((now < 7.5) && (alpha < 0.1))
213  {
214  g_validationFailed = true;
215  }
216  else if ((now > 11) && (now < 30) && (alpha > 0.01))
217  {
218  g_validationFailed = true;
219  }
220  else if ((now > 34) && (alpha < 0.015) && (alpha > 0.025))
221  {
222  g_validationFailed = true;
223  }
224  }
225  else if (g_validate == "dctcp-10ms")
226  {
227  double now = Simulator::Now ().GetSeconds ();
228  if ((now > 5.6) && (alpha > 0.1))
229  {
230  g_validationFailed = true;
231  }
232  if ((now > 7) && ((alpha > 0.09) || (alpha < 0.055)))
233  {
234  g_validationFailed = true;
235  }
236  }
237 }
238 
239 void
240 TraceFirstRtt (std::ofstream* ofStream, Time oldRtt, Time newRtt)
241 {
242  if (g_validate == "")
243  {
244  *ofStream << Simulator::Now ().GetSeconds () << " " << newRtt.GetSeconds () * 1000 << std::endl;
245  }
246 }
247 
248 void
249 TraceSecondCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
250 {
251  // TCP segment size is configured below to be 1448 bytes
252  // so that we can report cwnd in units of segments
253  if (g_validate == "")
254  {
255  *ofStream << Simulator::Now ().GetSeconds () << " " << static_cast<double> (newCwnd) / 1448 << std::endl;
256  }
257 }
258 
259 void
260 TraceSecondRtt (std::ofstream* ofStream, Time oldRtt, Time newRtt)
261 {
262  if (g_validate == "")
263  {
264  *ofStream << Simulator::Now ().GetSeconds () << " " << newRtt.GetSeconds () * 1000 << std::endl;
265  }
266 }
267 
268 void
269 TraceSecondDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
270 {
271  if (g_validate == "")
272  {
273  *ofStream << Simulator::Now ().GetSeconds () << " " << alpha << std::endl;
274  }
275 }
276 
277 void
278 TracePingRtt (std::ofstream* ofStream, Time rtt)
279 {
280  if (g_validate == "")
281  {
282  *ofStream << Simulator::Now ().GetSeconds () << " " << rtt.GetSeconds () * 1000 << std::endl;
283  }
284 }
285 
286 void
288 {
289  g_firstBytesReceived += packet->GetSize ();
290 }
291 
292 void
294 {
295  g_secondBytesReceived += packet->GetSize ();
296 }
297 
298 void
299 TraceQueueDrop (std::ofstream* ofStream, Ptr<const QueueDiscItem> item)
300 {
301  if (g_validate == "")
302  {
303  *ofStream << Simulator::Now ().GetSeconds () << " " << std::hex << item->Hash () << std::endl;
304  }
305  g_dropsObserved++;
306 }
307 
308 void
309 TraceQueueMark (std::ofstream* ofStream, Ptr<const QueueDiscItem> item, const char* reason)
310 {
311  if (g_validate == "")
312  {
313  *ofStream << Simulator::Now ().GetSeconds () << " " << std::hex << item->Hash () << std::endl;
314  }
315  g_marksObserved++;
316 }
317 
318 void
319 TraceQueueLength (std::ofstream* ofStream, DataRate queueLinkRate, uint32_t oldVal, uint32_t newVal)
320 {
321  // output in units of ms
322  if (g_validate == "")
323  {
324  *ofStream << Simulator::Now ().GetSeconds () << " " << std::fixed << static_cast<double> (newVal * 8) / (queueLinkRate.GetBitRate () / 1000) << std::endl;
325  }
326 }
327 
328 void
329 TraceMarksFrequency (std::ofstream* ofStream, Time marksSamplingInterval)
330 {
331  if (g_validate == "")
332  {
333  *ofStream << Simulator::Now ().GetSeconds () << " " << g_marksObserved << std::endl;
334  }
335  g_marksObserved = 0;
336  Simulator::Schedule (marksSamplingInterval, &TraceMarksFrequency, ofStream, marksSamplingInterval);
337 }
338 
339 void
340 TraceFirstThroughput (std::ofstream* ofStream, Time throughputInterval)
341 {
342  double throughput = g_firstBytesReceived * 8 / throughputInterval.GetSeconds () / 1e6;
343  if (g_validate == "")
344  {
345  *ofStream << Simulator::Now ().GetSeconds () << " " << throughput << std::endl;
346  }
348  Simulator::Schedule (throughputInterval, &TraceFirstThroughput, ofStream, throughputInterval);
349  if (g_validate == "dctcp-80ms")
350  {
351  double now = Simulator::Now ().GetSeconds ();
352  if ((now < 14) && (throughput > 20))
353  {
354  g_validationFailed = true;
355  }
356  if ((now < 30) && (throughput > 48))
357  {
358  g_validationFailed = true;
359  }
360  if ((now > 32) && ((throughput < 47.5) || (throughput > 48.5)))
361  {
362  g_validationFailed = true;
363  }
364  }
365  else if (g_validate == "dctcp-10ms")
366  {
367  double now = Simulator::Now ().GetSeconds ();
368  if ((now > 5.6) && ((throughput < 48) || (throughput > 49)))
369  {
370  g_validationFailed = true;
371  }
372  }
373 }
374 
375 void
376 TraceSecondThroughput (std::ofstream* ofStream, Time throughputInterval)
377 {
378  if (g_validate == "")
379  {
380  *ofStream << Simulator::Now ().GetSeconds () << " " << g_secondBytesReceived * 8 / throughputInterval.GetSeconds () / 1e6 << std::endl;
381  }
383  Simulator::Schedule (throughputInterval, &TraceSecondThroughput, ofStream, throughputInterval);
384 }
385 
386 void
387 ScheduleFirstTcpCwndTraceConnection (std::ofstream* ofStream)
388 {
389  Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeBoundCallback (&TraceFirstCwnd, ofStream));
390 }
391 
392 void
393 ScheduleFirstTcpRttTraceConnection (std::ofstream* ofStream)
394 {
395  Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/RTT", MakeBoundCallback (&TraceFirstRtt, ofStream));
396 }
397 
398 void
399 ScheduleFirstDctcpTraceConnection (std::ofstream* ofStream)
400 {
401  Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionOps/$ns3::TcpDctcp/CongestionEstimate", MakeBoundCallback (&TraceFirstDctcp, ofStream));
402 }
403 
404 void
405 ScheduleSecondDctcpTraceConnection (std::ofstream* ofStream)
406 {
407  Config::ConnectWithoutContextFailSafe ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/CongestionOps/$ns3::TcpDctcp/CongestionEstimate", MakeBoundCallback (&TraceSecondDctcp, ofStream));
408 }
409 
410 void
412 {
413  Config::ConnectWithoutContextFailSafe ("/NodeList/6/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&TraceFirstRx));
414 }
415 
416 void
417 ScheduleSecondTcpCwndTraceConnection (std::ofstream* ofStream)
418 {
419  Config::ConnectWithoutContext ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeBoundCallback (&TraceSecondCwnd, ofStream));
420 }
421 
422 void
423 ScheduleSecondTcpRttTraceConnection (std::ofstream* ofStream)
424 {
425  Config::ConnectWithoutContext ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/RTT", MakeBoundCallback (&TraceSecondRtt, ofStream));
426 }
427 
428 void
430 {
431  Config::ConnectWithoutContext ("/NodeList/7/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&TraceSecondRx));
432 }
433 
434 int
435 main (int argc, char *argv[])
436 {
438  // variables not configured at command line //
440  uint32_t pingSize = 100; // bytes
441  bool enableSecondTcp = false;
442  bool enableLogging = false;
443  Time pingInterval = MilliSeconds (100);
444  Time marksSamplingInterval = MilliSeconds (100);
445  Time throughputSamplingInterval = MilliSeconds (200);
446  std::string pingTraceFile = "tcp-validation-ping.dat";
447  std::string firstTcpRttTraceFile = "tcp-validation-first-tcp-rtt.dat";
448  std::string firstTcpCwndTraceFile = "tcp-validation-first-tcp-cwnd.dat";
449  std::string firstDctcpTraceFile = "tcp-validation-first-dctcp-alpha.dat";
450  std::string firstTcpThroughputTraceFile = "tcp-validation-first-tcp-throughput.dat";
451  std::string secondTcpRttTraceFile = "tcp-validation-second-tcp-rtt.dat";
452  std::string secondTcpCwndTraceFile = "tcp-validation-second-tcp-cwnd.dat";
453  std::string secondTcpThroughputTraceFile = "tcp-validation-second-tcp-throughput.dat";
454  std::string secondDctcpTraceFile = "tcp-validation-second-dctcp-alpha.dat";
455  std::string queueMarkTraceFile = "tcp-validation-queue-mark.dat";
456  std::string queueDropTraceFile = "tcp-validation-queue-drop.dat";
457  std::string queueMarksFrequencyTraceFile = "tcp-validation-queue-marks-frequency.dat";
458  std::string queueLengthTraceFile = "tcp-validation-queue-length.dat";
459 
461  // variables configured at command line //
463  std::string firstTcpType = "cubic";
464  std::string secondTcpType = "";
465  std::string queueType = "codel";
466  Time stopTime = Seconds (70);
467  Time baseRtt = MilliSeconds (80);
468  DataRate linkRate ("50Mbps");
469  bool queueUseEcn = false;
470  Time ceThreshold = MilliSeconds (1);
471  bool enablePcap = false;
472 
474  // Override ns-3 defaults //
476  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1448));
477  // Increase default buffer sizes to improve throughput over long delay paths
478  //Config::SetDefault ("ns3::TcpSocket::SndBufSize",UintegerValue (8192000));
479  //Config::SetDefault ("ns3::TcpSocket::RcvBufSize",UintegerValue (8192000));
480  Config::SetDefault ("ns3::TcpSocket::SndBufSize",UintegerValue (32768000));
481  Config::SetDefault ("ns3::TcpSocket::RcvBufSize",UintegerValue (32768000));
482  Config::SetDefault ("ns3::TcpSocket::InitialCwnd", UintegerValue (10));
483  Config::SetDefault ("ns3::TcpL4Protocol::RecoveryType", TypeIdValue (TcpPrrRecovery::GetTypeId ()));
484 
486  // command-line argument parsing //
489  cmd.AddValue ("firstTcpType", "first TCP type (cubic, dctcp, or reno)", firstTcpType);
490  cmd.AddValue ("secondTcpType", "second TCP type (cubic, dctcp, or reno)", secondTcpType);
491  cmd.AddValue ("queueType", "bottleneck queue type (fq, codel, pie, or red)", queueType);
492  cmd.AddValue ("baseRtt", "base RTT", baseRtt);
493  cmd.AddValue ("ceThreshold", "CoDel CE threshold (for DCTCP)", ceThreshold);
494  cmd.AddValue ("linkRate", "data rate of bottleneck link", linkRate);
495  cmd.AddValue ("stopTime", "simulation stop time", stopTime);
496  cmd.AddValue ("queueUseEcn", "use ECN on queue", queueUseEcn);
497  cmd.AddValue ("enablePcap", "enable Pcap", enablePcap);
498  cmd.AddValue ("validate", "validation case to run", g_validate);
499  cmd.Parse (argc, argv);
500 
501  // If validation is selected, perform some configuration checks
502  if (g_validate != "")
503  {
504  NS_ABORT_MSG_UNLESS (g_validate == "dctcp-10ms"
505  || g_validate == "dctcp-80ms"
506  || g_validate == "cubic-50ms-no-ecn"
507  || g_validate == "cubic-50ms-ecn", "Unknown test");
508  if (g_validate == "dctcp-10ms" || g_validate == "dctcp-80ms")
509  {
510  NS_ABORT_MSG_UNLESS (firstTcpType == "dctcp", "Incorrect TCP");
511  NS_ABORT_MSG_UNLESS (secondTcpType == "", "Incorrect TCP");
512  NS_ABORT_MSG_UNLESS (linkRate == DataRate ("50Mbps"), "Incorrect data rate");
513  NS_ABORT_MSG_UNLESS (queueUseEcn == true, "Incorrect ECN configuration");
514  NS_ABORT_MSG_UNLESS (stopTime >= Seconds (15), "Incorrect stopTime");
515  if (g_validate == "dctcp-10ms")
516  {
517  NS_ABORT_MSG_UNLESS (baseRtt == MilliSeconds (10), "Incorrect RTT");
518  }
519  else if (g_validate == "dctcp-80ms")
520  {
521  NS_ABORT_MSG_UNLESS (baseRtt == MilliSeconds (80), "Incorrect RTT");
522  }
523  }
524  else if (g_validate == "cubic-50ms-no-ecn" || g_validate == "cubic-50ms-ecn")
525  {
526  NS_ABORT_MSG_UNLESS (firstTcpType == "cubic", "Incorrect TCP");
527  NS_ABORT_MSG_UNLESS (secondTcpType == "", "Incorrect TCP");
528  NS_ABORT_MSG_UNLESS (baseRtt == MilliSeconds (50), "Incorrect RTT");
529  NS_ABORT_MSG_UNLESS (linkRate == DataRate ("50Mbps"), "Incorrect data rate");
530  NS_ABORT_MSG_UNLESS (stopTime >= Seconds (20), "Incorrect stopTime");
531  if (g_validate == "cubic-50ms-no-ecn")
532  {
533  NS_ABORT_MSG_UNLESS (queueUseEcn == false, "Incorrect ECN configuration");
534  }
535  else if (g_validate == "cubic-50ms-ecn")
536  {
537  NS_ABORT_MSG_UNLESS (queueUseEcn == true, "Incorrect ECN configuration");
538  }
539  }
540  }
541 
542  if (enableLogging)
543  {
546  }
547 
548  Time oneWayDelay = baseRtt / 2;
549 
550  TypeId firstTcpTypeId;
551  if (firstTcpType == "reno")
552  {
553  firstTcpTypeId = TcpLinuxReno::GetTypeId ();
554  }
555  else if (firstTcpType == "cubic")
556  {
557  firstTcpTypeId = TcpCubic::GetTypeId ();
558  }
559  else if (firstTcpType == "dctcp")
560  {
561  firstTcpTypeId = TcpDctcp::GetTypeId ();
562  Config::SetDefault ("ns3::CoDelQueueDisc::CeThreshold", TimeValue (ceThreshold));
563  Config::SetDefault ("ns3::FqCoDelQueueDisc::CeThreshold", TimeValue (ceThreshold));
564  if (queueUseEcn == false)
565  {
566  std::cout << "Warning: using DCTCP with queue ECN disabled" << std::endl;
567  }
568  }
569  else
570  {
571  NS_FATAL_ERROR ("Fatal error: tcp unsupported");
572  }
573  TypeId secondTcpTypeId;
574  if (secondTcpType == "reno")
575  {
576  enableSecondTcp = true;
577  secondTcpTypeId = TcpLinuxReno::GetTypeId ();
578  }
579  else if (secondTcpType == "cubic")
580  {
581  enableSecondTcp = true;
582  secondTcpTypeId = TcpCubic::GetTypeId ();
583  }
584  else if (secondTcpType == "dctcp")
585  {
586  enableSecondTcp = true;
587  secondTcpTypeId = TcpDctcp::GetTypeId ();
588  }
589  else if (secondTcpType == "")
590  {
591  enableSecondTcp = false;
592  NS_LOG_DEBUG ("No second TCP selected");
593  }
594  else
595  {
596  NS_FATAL_ERROR ("Fatal error: tcp unsupported");
597  }
598  TypeId queueTypeId;
599  if (queueType == "fq")
600  {
601  queueTypeId = FqCoDelQueueDisc::GetTypeId ();
602  }
603  else if (queueType == "codel")
604  {
605  queueTypeId = CoDelQueueDisc::GetTypeId ();
606  }
607  else if (queueType == "pie")
608  {
609  queueTypeId = PieQueueDisc::GetTypeId ();
610  }
611  else if (queueType == "red")
612  {
613  queueTypeId = RedQueueDisc::GetTypeId ();
614  }
615  else
616  {
617  NS_FATAL_ERROR ("Fatal error: queueType unsupported");
618  }
619 
620  if (queueUseEcn)
621  {
622  Config::SetDefault ("ns3::CoDelQueueDisc::UseEcn", BooleanValue (true));
623  Config::SetDefault ("ns3::FqCoDelQueueDisc::UseEcn", BooleanValue (true));
624  Config::SetDefault ("ns3::PieQueueDisc::UseEcn", BooleanValue (true));
625  Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true));
626  }
627  // Enable TCP to use ECN regardless
628  Config::SetDefault ("ns3::TcpSocketBase::UseEcn", StringValue ("On"));
629 
630  // Report on configuration
631  NS_LOG_DEBUG ("first TCP: " << firstTcpTypeId.GetName () << "; second TCP: " << secondTcpTypeId.GetName () << "; queue: " << queueTypeId.GetName () << "; ceThreshold: " << ceThreshold.GetSeconds () * 1000 << "ms");
632 
633  // Write traces only if we are not in validation mode (g_validate == "")
634  std::ofstream pingOfStream;
635  std::ofstream firstTcpRttOfStream;
636  std::ofstream firstTcpCwndOfStream;
637  std::ofstream firstTcpThroughputOfStream;
638  std::ofstream firstTcpDctcpOfStream;
639  std::ofstream secondTcpRttOfStream;
640  std::ofstream secondTcpCwndOfStream;
641  std::ofstream secondTcpThroughputOfStream;
642  std::ofstream secondTcpDctcpOfStream;
643  std::ofstream queueDropOfStream;
644  std::ofstream queueMarkOfStream;
645  std::ofstream queueMarksFrequencyOfStream;
646  std::ofstream queueLengthOfStream;
647  if (g_validate == "")
648  {
649  pingOfStream.open (pingTraceFile.c_str (), std::ofstream::out);
650  firstTcpRttOfStream.open (firstTcpRttTraceFile.c_str (), std::ofstream::out);
651  firstTcpCwndOfStream.open (firstTcpCwndTraceFile.c_str (), std::ofstream::out);
652  firstTcpThroughputOfStream.open (firstTcpThroughputTraceFile.c_str (), std::ofstream::out);
653  if (firstTcpType == "dctcp")
654  {
655  firstTcpDctcpOfStream.open (firstDctcpTraceFile.c_str (), std::ofstream::out);
656  }
657  if (enableSecondTcp)
658  {
659  secondTcpRttOfStream.open (secondTcpRttTraceFile.c_str (), std::ofstream::out);
660  secondTcpCwndOfStream.open (secondTcpCwndTraceFile.c_str (), std::ofstream::out);
661  secondTcpThroughputOfStream.open (secondTcpThroughputTraceFile.c_str (), std::ofstream::out);
662  if (secondTcpType == "dctcp")
663  {
664  secondTcpDctcpOfStream.open (secondDctcpTraceFile.c_str (), std::ofstream::out);
665  }
666  }
667  queueDropOfStream.open (queueDropTraceFile.c_str (), std::ofstream::out);
668  queueMarkOfStream.open (queueMarkTraceFile.c_str (), std::ofstream::out);
669  queueMarksFrequencyOfStream.open (queueMarksFrequencyTraceFile.c_str (), std::ofstream::out);
670  queueLengthOfStream.open (queueLengthTraceFile.c_str (), std::ofstream::out);
671  }
672 
674  // scenario setup //
676  Ptr<Node> pingServer = CreateObject<Node> ();
677  Ptr<Node> firstServer = CreateObject<Node> ();
678  Ptr<Node> secondServer = CreateObject<Node> ();
679  Ptr<Node> wanRouter = CreateObject<Node> ();
680  Ptr<Node> lanRouter = CreateObject<Node> ();
681  Ptr<Node> pingClient = CreateObject<Node> ();
682  Ptr<Node> firstClient = CreateObject<Node> ();
683  Ptr<Node> secondClient = CreateObject<Node> ();
684 
685  // Device containers
686  NetDeviceContainer pingServerDevices;
687  NetDeviceContainer firstServerDevices;
688  NetDeviceContainer secondServerDevices;
689  NetDeviceContainer wanLanDevices;
690  NetDeviceContainer pingClientDevices;
691  NetDeviceContainer firstClientDevices;
692  NetDeviceContainer secondClientDevices;
693 
694  PointToPointHelper p2p;
695  p2p.SetQueue ("ns3::DropTailQueue", "MaxSize", QueueSizeValue (QueueSize ("3p")));
696  p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("1000Mbps")));
697  // Add delay only on the WAN links
698  p2p.SetChannelAttribute ("Delay", TimeValue (MicroSeconds (1)));
699  pingServerDevices = p2p.Install (wanRouter, pingServer);
700  firstServerDevices = p2p.Install (wanRouter, firstServer);
701  secondServerDevices = p2p.Install (wanRouter, secondServer);
702  p2p.SetChannelAttribute ("Delay", TimeValue (oneWayDelay));
703  wanLanDevices = p2p.Install (wanRouter, lanRouter);
704  p2p.SetQueue ("ns3::DropTailQueue", "MaxSize", QueueSizeValue (QueueSize ("3p")));
705  p2p.SetChannelAttribute ("Delay", TimeValue (MicroSeconds (1)));
706  pingClientDevices = p2p.Install (lanRouter, pingClient);
707  firstClientDevices = p2p.Install (lanRouter, firstClient);
708  secondClientDevices = p2p.Install (lanRouter, secondClient);
709 
710  // Limit the bandwidth on the wanRouter->lanRouter interface
711  Ptr<PointToPointNetDevice> p = wanLanDevices.Get (0)->GetObject<PointToPointNetDevice> ();
712  p->SetAttribute ("DataRate", DataRateValue (linkRate));
713 
714  InternetStackHelper stackHelper;
715  stackHelper.Install (pingServer);
716  Ptr<TcpL4Protocol> proto;
717  stackHelper.Install (firstServer);
718  proto = firstServer->GetObject<TcpL4Protocol> ();
719  proto->SetAttribute ("SocketType", TypeIdValue (firstTcpTypeId));
720  stackHelper.Install (secondServer);
721  stackHelper.Install (wanRouter);
722  stackHelper.Install (lanRouter);
723  stackHelper.Install (pingClient);
724 
725  stackHelper.Install (firstClient);
726  // Set the per-node TCP type here
727  proto = firstClient->GetObject<TcpL4Protocol> ();
728  proto->SetAttribute ("SocketType", TypeIdValue (firstTcpTypeId));
729  stackHelper.Install (secondClient);
730 
731  if (enableSecondTcp)
732  {
733  proto = secondClient->GetObject<TcpL4Protocol> ();
734  proto->SetAttribute ("SocketType", TypeIdValue (secondTcpTypeId));
735  proto = secondServer->GetObject<TcpL4Protocol> ();
736  proto->SetAttribute ("SocketType", TypeIdValue (secondTcpTypeId));
737  }
738 
739  // InternetStackHelper will install a base TrafficControLayer on the node,
740  // but the Ipv4AddressHelper below will install the default FqCoDelQueueDisc
741  // on all single device nodes. The below code overrides the configuration
742  // that is normally done by the Ipv4AddressHelper::Install() method by
743  // instead explicitly configuring the queue discs we want on each device.
744  TrafficControlHelper tchFq;
745  tchFq.SetRootQueueDisc ("ns3::FqCoDelQueueDisc");
746  tchFq.SetQueueLimits ("ns3::DynamicQueueLimits", "HoldTime", StringValue ("1ms"));
747  tchFq.Install (pingServerDevices);
748  tchFq.Install (firstServerDevices);
749  tchFq.Install (secondServerDevices);
750  tchFq.Install (wanLanDevices.Get (1));
751  tchFq.Install (pingClientDevices);
752  tchFq.Install (firstClientDevices);
753  tchFq.Install (secondClientDevices);
754  // Install queue for bottleneck link
755  TrafficControlHelper tchBottleneck;
756  tchBottleneck.SetRootQueueDisc (queueTypeId.GetName ());
757  tchBottleneck.SetQueueLimits ("ns3::DynamicQueueLimits", "HoldTime", StringValue ("1ms"));
758  tchBottleneck.Install (wanLanDevices.Get (0));
759 
760  Ipv4AddressHelper ipv4;
761  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
762  Ipv4InterfaceContainer pingServerIfaces = ipv4.Assign (pingServerDevices);
763  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
764  Ipv4InterfaceContainer firstServerIfaces = ipv4.Assign (firstServerDevices);
765  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
766  Ipv4InterfaceContainer secondServerIfaces = ipv4.Assign (secondServerDevices);
767  ipv4.SetBase ("172.16.1.0", "255.255.255.0");
768  Ipv4InterfaceContainer wanLanIfaces = ipv4.Assign (wanLanDevices);
769  ipv4.SetBase ("192.168.1.0", "255.255.255.0");
770  Ipv4InterfaceContainer pingClientIfaces = ipv4.Assign (pingClientDevices);
771  ipv4.SetBase ("192.168.2.0", "255.255.255.0");
772  Ipv4InterfaceContainer firstClientIfaces = ipv4.Assign (firstClientDevices);
773  ipv4.SetBase ("192.168.3.0", "255.255.255.0");
774  Ipv4InterfaceContainer secondClientIfaces = ipv4.Assign (secondClientDevices);
775 
777 
779  // application setup //
781  V4PingHelper pingHelper ("192.168.1.2");
782  pingHelper.SetAttribute ("Interval", TimeValue (pingInterval));
783  pingHelper.SetAttribute ("Size", UintegerValue (pingSize));
784  ApplicationContainer pingContainer = pingHelper.Install (pingServer);
785  Ptr<V4Ping> v4Ping = pingContainer.Get (0)->GetObject<V4Ping> ();
786  v4Ping->TraceConnectWithoutContext ("Rtt", MakeBoundCallback (&TracePingRtt, &pingOfStream));
787  pingContainer.Start (Seconds (1));
788  pingContainer.Stop (stopTime - Seconds (1));
789 
790  ApplicationContainer firstApp;
791  uint16_t firstPort = 5000;
792  BulkSendHelper tcp ("ns3::TcpSocketFactory", Address ());
793  // set to large value: e.g. 1000 Mb/s for 60 seconds = 7500000000 bytes
794  tcp.SetAttribute ("MaxBytes", UintegerValue (7500000000));
795  // Configure first TCP client/server pair
796  InetSocketAddress firstDestAddress (firstClientIfaces.GetAddress (1), firstPort);
797  tcp.SetAttribute ("Remote", AddressValue (firstDestAddress));
798  firstApp = tcp.Install (firstServer);
799  firstApp.Start (Seconds (5));
800  firstApp.Stop (stopTime - Seconds (1));
801 
802  Address firstSinkAddress (InetSocketAddress (Ipv4Address::GetAny (), firstPort));
803  ApplicationContainer firstSinkApp;
804  PacketSinkHelper firstSinkHelper ("ns3::TcpSocketFactory", firstSinkAddress);
805  firstSinkApp = firstSinkHelper.Install (firstClient);
806  firstSinkApp.Start (Seconds (5));
807  firstSinkApp.Stop (stopTime - MilliSeconds (500));
808 
809  // Configure second TCP client/server pair
810  if (enableSecondTcp)
811  {
812  BulkSendHelper tcp ("ns3::TcpSocketFactory", Address ());
813  uint16_t secondPort = 5000;
814  ApplicationContainer secondApp;
815  InetSocketAddress secondDestAddress (secondClientIfaces.GetAddress (1), secondPort);
816  tcp.SetAttribute ("Remote", AddressValue (secondDestAddress));
817  secondApp = tcp.Install (secondServer);
818  secondApp.Start (Seconds (15));
819  secondApp.Stop (stopTime - Seconds (1));
820 
821  Address secondSinkAddress (InetSocketAddress (Ipv4Address::GetAny (), secondPort));
822  PacketSinkHelper secondSinkHelper ("ns3::TcpSocketFactory", secondSinkAddress);
823  ApplicationContainer secondSinkApp;
824  secondSinkApp = secondSinkHelper.Install (secondClient);
825  secondSinkApp.Start (Seconds (15));
826  secondSinkApp.Stop (stopTime - MilliSeconds (500));
827  }
828 
829  // Setup traces that can be hooked now
831  Ptr<QueueDisc> qd;
832  // Trace drops and marks for bottleneck
833  tc = wanLanDevices.Get (0)->GetNode ()->GetObject<TrafficControlLayer> ();
834  qd = tc->GetRootQueueDiscOnDevice (wanLanDevices.Get (0));
835  qd->TraceConnectWithoutContext ("Drop", MakeBoundCallback (&TraceQueueDrop, &queueDropOfStream));
836  qd->TraceConnectWithoutContext ("Mark", MakeBoundCallback (&TraceQueueMark, &queueMarkOfStream));
837  qd->TraceConnectWithoutContext ("BytesInQueue", MakeBoundCallback (&TraceQueueLength, &queueLengthOfStream, linkRate));
838 
839  // Setup scheduled traces; TCP traces must be hooked after socket creation
840  Simulator::Schedule (Seconds (5) + MilliSeconds (100), &ScheduleFirstTcpRttTraceConnection, &firstTcpRttOfStream);
841  Simulator::Schedule (Seconds (5) + MilliSeconds (100), &ScheduleFirstTcpCwndTraceConnection, &firstTcpCwndOfStream);
843  if (firstTcpType == "dctcp")
844  {
845  Simulator::Schedule (Seconds (5) + MilliSeconds (100), &ScheduleFirstDctcpTraceConnection, &firstTcpDctcpOfStream);
846  }
847  Simulator::Schedule (throughputSamplingInterval, &TraceFirstThroughput, &firstTcpThroughputOfStream, throughputSamplingInterval);
848  if (enableSecondTcp)
849  {
850  // Setup scheduled traces; TCP traces must be hooked after socket creation
851  Simulator::Schedule (Seconds (15) + MilliSeconds (100), &ScheduleSecondTcpRttTraceConnection, &secondTcpRttOfStream);
852  Simulator::Schedule (Seconds (15) + MilliSeconds (100), &ScheduleSecondTcpCwndTraceConnection, &secondTcpCwndOfStream);
854  Simulator::Schedule (throughputSamplingInterval, &TraceSecondThroughput, &secondTcpThroughputOfStream, throughputSamplingInterval);
855  if (secondTcpType == "dctcp")
856  {
857  Simulator::Schedule (Seconds (15) + MilliSeconds (100), &ScheduleSecondDctcpTraceConnection, &secondTcpDctcpOfStream);
858  }
859  }
860  Simulator::Schedule (marksSamplingInterval, &TraceMarksFrequency, &queueMarksFrequencyOfStream, marksSamplingInterval);
861 
862  if (enablePcap)
863  {
864  p2p.EnablePcapAll ("tcp-validation", false);
865  }
866 
868  Simulator::Run ();
870 
871  if (g_validate == "")
872  {
873  pingOfStream.close ();
874  firstTcpCwndOfStream.close ();
875  firstTcpRttOfStream.close ();
876  if (firstTcpType == "dctcp")
877  {
878  firstTcpDctcpOfStream.close ();
879  }
880  firstTcpThroughputOfStream.close ();
881  if (enableSecondTcp)
882  {
883  secondTcpCwndOfStream.close ();
884  secondTcpRttOfStream.close ();
885  secondTcpThroughputOfStream.close ();
886  if (secondTcpType == "dctcp")
887  {
888  secondTcpDctcpOfStream.close ();
889  }
890  }
891  queueDropOfStream.close ();
892  queueMarkOfStream.close ();
893  queueMarksFrequencyOfStream.close ();
894  queueLengthOfStream.close ();
895  }
896 
897  if (g_validationFailed)
898  {
899  NS_FATAL_ERROR ("Validation failed");
900  }
901 }
902 
void ScheduleSecondTcpRttTraceConnection(std::ofstream *ofStream)
holds a vector of ns3::Application pointers.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
std::string GetName(void) const
Get the name.
Definition: type-id.cc:977
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Prefix all trace prints with simulation node.
Definition: log.h:120
an Inet address class
static Ipv4Address GetAny(void)
void TraceSecondThroughput(std::ofstream *ofStream, Time throughputInterval)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
QueueDiscContainer Install(NetDeviceContainer c)
Class for representing queue sizes.
Definition: queue-size.h:94
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
void TraceFirstThroughput(std::ofstream *ofStream, Time throughputInterval)
holds a vector of std::pair of Ptr<Ipv4> and interface index.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
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:41
Introspection did not find any typical Config paths.
NetDeviceContainer Install(NodeContainer c)
void ScheduleSecondDctcpTraceConnection(std::ofstream *ofStream)
bool enablePcap
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
void SetQueueLimits(std::string type, Args &&... args)
Helper function used to add a queue limits object to the transmission queues of the devices...
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 TypeId GetTypeId(void)
Get the type ID.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
static TypeId GetTypeId(void)
Get the type ID.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
cmd
Definition: second.py:35
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.
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:241
a polymophic address class
Definition: address.h:90
TCP socket creation and multiplexing/demultiplexing.
static TypeId GetTypeId(void)
Get the type ID.
Class for representing data rates.
Definition: data-rate.h:88
uint32_t g_dropsObserved
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
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 ...
AttributeValue implementation for Time.
Definition: nstime.h:1353
void TraceSecondCwnd(std::ofstream *ofStream, uint32_t oldCwnd, uint32_t newCwnd)
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
void TraceMarksFrequency(std::ofstream *ofStream, Time marksSamplingInterval)
Hold an unsigned integer type.
Definition: uinteger.h:44
void ScheduleSecondTcpCwndTraceConnection(std::ofstream *ofStream)
holds a vector of ns3::NetDevice pointers
void TracePingRtt(std::ofstream *ofStream, Time rtt)
AttributeValue implementation for TypeId.
Definition: type-id.h:595
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-dctcp.cc:33
A Device for a Point to Point Network Link.
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:899
Build a set of QueueDisc objects.
virtual uint32_t Hash(uint32_t perturbation=0) const
Computes the hash of various fields of the packet header.
Definition: queue-item.cc:143
void ScheduleFirstPacketSinkConnection(void)
static TypeId GetTypeId(void)
Get the type ID.
Time stopTime
uint32_t g_firstBytesReceived
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
void TraceFirstRx(Ptr< const Packet > packet, const Address &address)
Parse command-line arguments.
Definition: command-line.h:227
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...
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
void ScheduleFirstDctcpTraceConnection(std::ofstream *ofStream)
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
void ScheduleSecondPacketSinkConnection(void)
bool ConnectWithoutContextFailSafe(std::string path, const CallbackBase &cb)
This function will attempt to find all trace sources which match the input path and will then connect...
Definition: config.cc:907
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
Prefix all trace prints with simulation time.
Definition: log.h:119
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t g_secondBytesReceived
address
Definition: first.py:44
bool g_validationFailed
void ScheduleFirstTcpCwndTraceConnection(std::ofstream *ofStream)
void TraceQueueMark(std::ofstream *ofStream, Ptr< const QueueDiscItem > item, const char *reason)
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-cubic.cc:33
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
LogLevel
Logging severity classes and levels.
Definition: log.h:93
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
static TypeId GetTypeId(void)
Get the type ID.
uint32_t g_marksObserved
AttributeValue implementation for Address.
Definition: address.h:278
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...
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition: abort.h:144
std::string g_validate
void TraceSecondRtt(std::ofstream *ofStream, Time oldRtt, Time newRtt)
static TypeId GetTypeId(void)
Get the type ID.
AttributeValue implementation for DataRate.
Definition: data-rate.h:229
Prefix all trace prints with function.
Definition: log.h:118
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
an application which sends one ICMP ECHO request, waits for a REPLYs and reports the calculated RTT...
Definition: v4ping.h:41
void TraceQueueDrop(std::ofstream *ofStream, Ptr< const QueueDiscItem > item)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
void TraceFirstDctcp(std::ofstream *ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
Print everything.
Definition: log.h:116
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void ScheduleFirstTcpRttTraceConnection(std::ofstream *ofStream)
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
void TraceQueueLength(std::ofstream *ofStream, DataRate queueLinkRate, uint32_t oldVal, uint32_t newVal)
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
a unique identifier for an interface.
Definition: type-id.h:58
virtual Ptr< QueueDisc > GetRootQueueDiscOnDevice(Ptr< NetDevice > device) const
This method can be used to get the root queue disc installed on a device.
Create a IPv4 ping application and associate it to a node.
Definition: v4ping-helper.h:37
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
void TraceSecondDctcp(std::ofstream *ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void TraceFirstCwnd(std::ofstream *ofStream, uint32_t oldCwnd, uint32_t newCwnd)
void TraceFirstRtt(std::ofstream *ofStream, Time oldRtt, Time newRtt)
void TraceSecondRx(Ptr< const Packet > packet, const Address &address)
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.