A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-variants-comparison.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 ResiliNets, ITTC, University of Kansas
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Justin P. Rohrer, Truc Anh N. Nguyen <annguyen@ittc.ku.edu>, Siddharth Gangadhar
7 * <siddharth@ittc.ku.edu>
8 *
9 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
10 * ResiliNets Research Group https://resilinets.org/
11 * Information and Telecommunication Technology Center (ITTC)
12 * and Department of Electrical Engineering and Computer Science
13 * The University of Kansas Lawrence, KS USA.
14 *
15 * Work supported in part by NSF FIND (Future Internet Design) Program
16 * under grant CNS-0626918 (Postmodern Internet Architecture),
17 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
18 * US Department of Defense (DoD), and ITTC at The University of Kansas.
19 *
20 * "TCP Westwood(+) Protocol Implementation in ns-3"
21 * Siddharth Gangadhar, Trúc Anh Ngọc Nguyễn , Greeshma Umapathi, and James P.G. Sterbenz,
22 * ICST SIMUTools Workshop on ns-3 (WNS3), Cannes, France, March 2013
23 */
24
25#include "ns3/applications-module.h"
26#include "ns3/core-module.h"
27#include "ns3/enum.h"
28#include "ns3/error-model.h"
29#include "ns3/event-id.h"
30#include "ns3/flow-monitor-helper.h"
31#include "ns3/internet-module.h"
32#include "ns3/ipv4-global-routing-helper.h"
33#include "ns3/network-module.h"
34#include "ns3/point-to-point-module.h"
35#include "ns3/tcp-header.h"
36#include "ns3/traffic-control-module.h"
37#include "ns3/udp-header.h"
38
39#include <fstream>
40#include <iostream>
41#include <string>
42
43using namespace ns3;
44
45NS_LOG_COMPONENT_DEFINE("TcpVariantsComparison");
46
47static std::map<uint32_t, bool> firstCwnd; //!< First congestion window.
48static std::map<uint32_t, bool> firstSshThr; //!< First SlowStart threshold.
49static std::map<uint32_t, bool> firstRtt; //!< First RTT.
50static std::map<uint32_t, bool> firstRto; //!< First RTO.
51static std::map<uint32_t, Ptr<OutputStreamWrapper>> cWndStream; //!< Congstion window output stream.
52static std::map<uint32_t, Ptr<OutputStreamWrapper>>
53 ssThreshStream; //!< SlowStart threshold output stream.
54static std::map<uint32_t, Ptr<OutputStreamWrapper>> rttStream; //!< RTT output stream.
55static std::map<uint32_t, Ptr<OutputStreamWrapper>> rtoStream; //!< RTO output stream.
56static std::map<uint32_t, Ptr<OutputStreamWrapper>> nextTxStream; //!< Next TX output stream.
57static std::map<uint32_t, Ptr<OutputStreamWrapper>> nextRxStream; //!< Next RX output stream.
58static std::map<uint32_t, Ptr<OutputStreamWrapper>> inFlightStream; //!< In flight output stream.
59static std::map<uint32_t, uint32_t> cWndValue; //!< congestion window value.
60static std::map<uint32_t, uint32_t> ssThreshValue; //!< SlowStart threshold value.
61
62/**
63 * Get the Node Id From Context.
64 *
65 * \param context The context.
66 * \return the node ID.
67 */
68static uint32_t
69GetNodeIdFromContext(std::string context)
70{
71 const std::size_t n1 = context.find_first_of('/', 1);
72 const std::size_t n2 = context.find_first_of('/', n1 + 1);
73 return std::stoul(context.substr(n1 + 1, n2 - n1 - 1));
74}
75
76/**
77 * Congestion window tracer.
78 *
79 * \param context The context.
80 * \param oldval Old value.
81 * \param newval New value.
82 */
83static void
84CwndTracer(std::string context, uint32_t oldval, uint32_t newval)
85{
86 uint32_t nodeId = GetNodeIdFromContext(context);
87
88 if (firstCwnd[nodeId])
89 {
90 *cWndStream[nodeId]->GetStream() << "0.0 " << oldval << std::endl;
91 firstCwnd[nodeId] = false;
92 }
93 *cWndStream[nodeId]->GetStream() << Simulator::Now().GetSeconds() << " " << newval << std::endl;
94 cWndValue[nodeId] = newval;
95
96 if (!firstSshThr[nodeId])
97 {
98 *ssThreshStream[nodeId]->GetStream()
99 << Simulator::Now().GetSeconds() << " " << ssThreshValue[nodeId] << std::endl;
100 }
101}
102
103/**
104 * Slow start threshold tracer.
105 *
106 * \param context The context.
107 * \param oldval Old value.
108 * \param newval New value.
109 */
110static void
111SsThreshTracer(std::string context, uint32_t oldval, uint32_t newval)
112{
113 uint32_t nodeId = GetNodeIdFromContext(context);
114
115 if (firstSshThr[nodeId])
116 {
117 *ssThreshStream[nodeId]->GetStream() << "0.0 " << oldval << std::endl;
118 firstSshThr[nodeId] = false;
119 }
120 *ssThreshStream[nodeId]->GetStream()
121 << Simulator::Now().GetSeconds() << " " << newval << std::endl;
122 ssThreshValue[nodeId] = newval;
123
124 if (!firstCwnd[nodeId])
125 {
126 *cWndStream[nodeId]->GetStream()
127 << Simulator::Now().GetSeconds() << " " << cWndValue[nodeId] << std::endl;
128 }
129}
130
131/**
132 * RTT tracer.
133 *
134 * \param context The context.
135 * \param oldval Old value.
136 * \param newval New value.
137 */
138static void
139RttTracer(std::string context, Time oldval, Time newval)
140{
141 uint32_t nodeId = GetNodeIdFromContext(context);
142
143 if (firstRtt[nodeId])
144 {
145 *rttStream[nodeId]->GetStream() << "0.0 " << oldval.GetSeconds() << std::endl;
146 firstRtt[nodeId] = false;
147 }
148 *rttStream[nodeId]->GetStream()
149 << Simulator::Now().GetSeconds() << " " << newval.GetSeconds() << std::endl;
150}
151
152/**
153 * RTO tracer.
154 *
155 * \param context The context.
156 * \param oldval Old value.
157 * \param newval New value.
158 */
159static void
160RtoTracer(std::string context, Time oldval, Time newval)
161{
162 uint32_t nodeId = GetNodeIdFromContext(context);
163
164 if (firstRto[nodeId])
165 {
166 *rtoStream[nodeId]->GetStream() << "0.0 " << oldval.GetSeconds() << std::endl;
167 firstRto[nodeId] = false;
168 }
169 *rtoStream[nodeId]->GetStream()
170 << Simulator::Now().GetSeconds() << " " << newval.GetSeconds() << std::endl;
171}
172
173/**
174 * Next TX tracer.
175 *
176 * \param context The context.
177 * \param old Old sequence number.
178 * \param nextTx Next sequence number.
179 */
180static void
181NextTxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], SequenceNumber32 nextTx)
182{
183 uint32_t nodeId = GetNodeIdFromContext(context);
184
185 *nextTxStream[nodeId]->GetStream()
186 << Simulator::Now().GetSeconds() << " " << nextTx << std::endl;
187}
188
189/**
190 * In-flight tracer.
191 *
192 * \param context The context.
193 * \param old Old value.
194 * \param inFlight In flight value.
195 */
196static void
197InFlightTracer(std::string context, uint32_t old [[maybe_unused]], uint32_t inFlight)
198{
199 uint32_t nodeId = GetNodeIdFromContext(context);
200
201 *inFlightStream[nodeId]->GetStream()
202 << Simulator::Now().GetSeconds() << " " << inFlight << std::endl;
203}
204
205/**
206 * Next RX tracer.
207 *
208 * \param context The context.
209 * \param old Old sequence number.
210 * \param nextRx Next sequence number.
211 */
212static void
213NextRxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], SequenceNumber32 nextRx)
214{
215 uint32_t nodeId = GetNodeIdFromContext(context);
216
217 *nextRxStream[nodeId]->GetStream()
218 << Simulator::Now().GetSeconds() << " " << nextRx << std::endl;
219}
220
221/**
222 * Congestion window trace connection.
223 *
224 * \param cwnd_tr_file_name Congestion window trace file name.
225 * \param nodeId Node ID.
226 */
227static void
228TraceCwnd(std::string cwnd_tr_file_name, uint32_t nodeId)
229{
230 AsciiTraceHelper ascii;
231 cWndStream[nodeId] = ascii.CreateFileStream(cwnd_tr_file_name);
232 Config::Connect("/NodeList/" + std::to_string(nodeId) +
233 "/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
235}
236
237/**
238 * Slow start threshold trace connection.
239 *
240 * \param ssthresh_tr_file_name Slow start threshold trace file name.
241 * \param nodeId Node ID.
242 */
243static void
244TraceSsThresh(std::string ssthresh_tr_file_name, uint32_t nodeId)
245{
246 AsciiTraceHelper ascii;
247 ssThreshStream[nodeId] = ascii.CreateFileStream(ssthresh_tr_file_name);
248 Config::Connect("/NodeList/" + std::to_string(nodeId) +
249 "/$ns3::TcpL4Protocol/SocketList/0/SlowStartThreshold",
251}
252
253/**
254 * RTT trace connection.
255 *
256 * \param rtt_tr_file_name RTT trace file name.
257 * \param nodeId Node ID.
258 */
259static void
260TraceRtt(std::string rtt_tr_file_name, uint32_t nodeId)
261{
262 AsciiTraceHelper ascii;
263 rttStream[nodeId] = ascii.CreateFileStream(rtt_tr_file_name);
264 Config::Connect("/NodeList/" + std::to_string(nodeId) + "/$ns3::TcpL4Protocol/SocketList/0/RTT",
266}
267
268/**
269 * RTO trace connection.
270 *
271 * \param rto_tr_file_name RTO trace file name.
272 * \param nodeId Node ID.
273 */
274static void
275TraceRto(std::string rto_tr_file_name, uint32_t nodeId)
276{
277 AsciiTraceHelper ascii;
278 rtoStream[nodeId] = ascii.CreateFileStream(rto_tr_file_name);
279 Config::Connect("/NodeList/" + std::to_string(nodeId) + "/$ns3::TcpL4Protocol/SocketList/0/RTO",
281}
282
283/**
284 * Next TX trace connection.
285 *
286 * \param next_tx_seq_file_name Next TX trace file name.
287 * \param nodeId Node ID.
288 */
289static void
290TraceNextTx(std::string& next_tx_seq_file_name, uint32_t nodeId)
291{
292 AsciiTraceHelper ascii;
293 nextTxStream[nodeId] = ascii.CreateFileStream(next_tx_seq_file_name);
294 Config::Connect("/NodeList/" + std::to_string(nodeId) +
295 "/$ns3::TcpL4Protocol/SocketList/0/NextTxSequence",
297}
298
299/**
300 * In flight trace connection.
301 *
302 * \param in_flight_file_name In flight trace file name.
303 * \param nodeId Node ID.
304 */
305static void
306TraceInFlight(std::string& in_flight_file_name, uint32_t nodeId)
307{
308 AsciiTraceHelper ascii;
309 inFlightStream[nodeId] = ascii.CreateFileStream(in_flight_file_name);
310 Config::Connect("/NodeList/" + std::to_string(nodeId) +
311 "/$ns3::TcpL4Protocol/SocketList/0/BytesInFlight",
313}
314
315/**
316 * Next RX trace connection.
317 *
318 * \param next_rx_seq_file_name Next RX trace file name.
319 * \param nodeId Node ID.
320 */
321static void
322TraceNextRx(std::string& next_rx_seq_file_name, uint32_t nodeId)
323{
324 AsciiTraceHelper ascii;
325 nextRxStream[nodeId] = ascii.CreateFileStream(next_rx_seq_file_name);
326 Config::Connect("/NodeList/" + std::to_string(nodeId) +
327 "/$ns3::TcpL4Protocol/SocketList/1/RxBuffer/NextRxSequence",
329}
330
331int
332main(int argc, char* argv[])
333{
334 std::string transport_prot = "TcpWestwoodPlus";
335 double error_p = 0.0;
336 std::string bandwidth = "2Mbps";
337 std::string delay = "0.01ms";
338 std::string access_bandwidth = "10Mbps";
339 std::string access_delay = "45ms";
340 bool tracing = false;
341 std::string prefix_file_name = "TcpVariantsComparison";
342 uint64_t data_mbytes = 0;
343 uint32_t mtu_bytes = 400;
344 uint16_t num_flows = 1;
345 double duration = 100.0;
346 uint32_t run = 0;
347 bool flow_monitor = false;
348 bool pcap = false;
349 bool sack = true;
350 std::string queue_disc_type = "ns3::PfifoFastQueueDisc";
351 std::string recovery = "ns3::TcpClassicRecovery";
352
353 CommandLine cmd(__FILE__);
354 cmd.AddValue("transport_prot",
355 "Transport protocol to use: TcpNewReno, TcpLinuxReno, "
356 "TcpHybla, TcpHighSpeed, TcpHtcp, TcpVegas, TcpScalable, TcpVeno, "
357 "TcpBic, TcpYeah, TcpIllinois, TcpWestwoodPlus, TcpLedbat, "
358 "TcpLp, TcpDctcp, TcpCubic, TcpBbr",
359 transport_prot);
360 cmd.AddValue("error_p", "Packet error rate", error_p);
361 cmd.AddValue("bandwidth", "Bottleneck bandwidth", bandwidth);
362 cmd.AddValue("delay", "Bottleneck delay", delay);
363 cmd.AddValue("access_bandwidth", "Access link bandwidth", access_bandwidth);
364 cmd.AddValue("access_delay", "Access link delay", access_delay);
365 cmd.AddValue("tracing", "Flag to enable/disable tracing", tracing);
366 cmd.AddValue("prefix_name", "Prefix of output trace file", prefix_file_name);
367 cmd.AddValue("data", "Number of Megabytes of data to transmit", data_mbytes);
368 cmd.AddValue("mtu", "Size of IP packets to send in bytes", mtu_bytes);
369 cmd.AddValue("num_flows", "Number of flows", num_flows);
370 cmd.AddValue("duration", "Time to allow flows to run in seconds", duration);
371 cmd.AddValue("run", "Run index (for setting repeatable seeds)", run);
372 cmd.AddValue("flow_monitor", "Enable flow monitor", flow_monitor);
373 cmd.AddValue("pcap_tracing", "Enable or disable PCAP tracing", pcap);
374 cmd.AddValue("queue_disc_type",
375 "Queue disc type for gateway (e.g. ns3::CoDelQueueDisc)",
376 queue_disc_type);
377 cmd.AddValue("sack", "Enable or disable SACK option", sack);
378 cmd.AddValue("recovery", "Recovery algorithm type to use (e.g., ns3::TcpPrrRecovery", recovery);
379 cmd.Parse(argc, argv);
380
381 transport_prot = std::string("ns3::") + transport_prot;
382
385
386 // User may find it convenient to enable logging
387 // LogComponentEnable("TcpVariantsComparison", LOG_LEVEL_ALL);
388 // LogComponentEnable("BulkSendApplication", LOG_LEVEL_INFO);
389 // LogComponentEnable("PfifoFastQueueDisc", LOG_LEVEL_ALL);
390
391 // Calculate the ADU size
392 Header* temp_header = new Ipv4Header();
393 uint32_t ip_header = temp_header->GetSerializedSize();
394 NS_LOG_LOGIC("IP Header size is: " << ip_header);
395 delete temp_header;
396 temp_header = new TcpHeader();
397 uint32_t tcp_header = temp_header->GetSerializedSize();
398 NS_LOG_LOGIC("TCP Header size is: " << tcp_header);
399 delete temp_header;
400 uint32_t tcp_adu_size = mtu_bytes - 20 - (ip_header + tcp_header);
401 NS_LOG_LOGIC("TCP ADU size is: " << tcp_adu_size);
402
403 // Set the simulation start and stop time
404 double start_time = 0.1;
405 double stop_time = start_time + duration;
406
407 // 2 MB of TCP buffer
408 Config::SetDefault("ns3::TcpSocket::RcvBufSize", UintegerValue(1 << 21));
409 Config::SetDefault("ns3::TcpSocket::SndBufSize", UintegerValue(1 << 21));
410 Config::SetDefault("ns3::TcpSocketBase::Sack", BooleanValue(sack));
411
412 Config::SetDefault("ns3::TcpL4Protocol::RecoveryType",
414 // Select TCP variant
415 TypeId tcpTid;
416 NS_ABORT_MSG_UNLESS(TypeId::LookupByNameFailSafe(transport_prot, &tcpTid),
417 "TypeId " << transport_prot << " not found");
418 Config::SetDefault("ns3::TcpL4Protocol::SocketType",
419 TypeIdValue(TypeId::LookupByName(transport_prot)));
420
421 // Create gateways, sources, and sinks
422 NodeContainer gateways;
423 gateways.Create(1);
424 NodeContainer sources;
425 sources.Create(num_flows);
426 NodeContainer sinks;
427 sinks.Create(num_flows);
428
429 // Configure the error model
430 // Here we use RateErrorModel with packet error rate
432 uv->SetStream(50);
433 RateErrorModel error_model;
434 error_model.SetRandomVariable(uv);
436 error_model.SetRate(error_p);
437
438 PointToPointHelper UnReLink;
439 UnReLink.SetDeviceAttribute("DataRate", StringValue(bandwidth));
440 UnReLink.SetChannelAttribute("Delay", StringValue(delay));
441 UnReLink.SetDeviceAttribute("ReceiveErrorModel", PointerValue(&error_model));
442
444 stack.InstallAll();
445
446 TrafficControlHelper tchPfifo;
447 tchPfifo.SetRootQueueDisc("ns3::PfifoFastQueueDisc");
448
449 TrafficControlHelper tchCoDel;
450 tchCoDel.SetRootQueueDisc("ns3::CoDelQueueDisc");
451
453 address.SetBase("10.0.0.0", "255.255.255.0");
454
455 // Configure the sources and sinks net devices
456 // and the channels between the sources/sinks and the gateways
457 PointToPointHelper LocalLink;
458 LocalLink.SetDeviceAttribute("DataRate", StringValue(access_bandwidth));
459 LocalLink.SetChannelAttribute("Delay", StringValue(access_delay));
460
461 Ipv4InterfaceContainer sink_interfaces;
462
463 DataRate access_b(access_bandwidth);
464 DataRate bottle_b(bandwidth);
465 Time access_d(access_delay);
466 Time bottle_d(delay);
467
468 uint32_t size = static_cast<uint32_t>((std::min(access_b, bottle_b).GetBitRate() / 8) *
469 ((access_d + bottle_d) * 2).GetSeconds());
470
471 Config::SetDefault("ns3::PfifoFastQueueDisc::MaxSize",
472 QueueSizeValue(QueueSize(QueueSizeUnit::PACKETS, size / mtu_bytes)));
473 Config::SetDefault("ns3::CoDelQueueDisc::MaxSize",
474 QueueSizeValue(QueueSize(QueueSizeUnit::BYTES, size)));
475
476 for (uint32_t i = 0; i < num_flows; i++)
477 {
479 devices = LocalLink.Install(sources.Get(i), gateways.Get(0));
480 tchPfifo.Install(devices);
481 address.NewNetwork();
482 Ipv4InterfaceContainer interfaces = address.Assign(devices);
483
484 devices = UnReLink.Install(gateways.Get(0), sinks.Get(i));
485 if (queue_disc_type == "ns3::PfifoFastQueueDisc")
486 {
487 tchPfifo.Install(devices);
488 }
489 else if (queue_disc_type == "ns3::CoDelQueueDisc")
490 {
491 tchCoDel.Install(devices);
492 }
493 else
494 {
495 NS_FATAL_ERROR("Queue not recognized. Allowed values are ns3::CoDelQueueDisc or "
496 "ns3::PfifoFastQueueDisc");
497 }
498 address.NewNetwork();
499 interfaces = address.Assign(devices);
500 sink_interfaces.Add(interfaces.Get(1));
501 }
502
503 NS_LOG_INFO("Initialize Global Routing.");
505
506 uint16_t port = 50000;
508 PacketSinkHelper sinkHelper("ns3::TcpSocketFactory", sinkLocalAddress);
509
510 for (uint32_t i = 0; i < sources.GetN(); i++)
511 {
513 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(tcp_adu_size));
514 BulkSendHelper ftp("ns3::TcpSocketFactory", Address());
515 ftp.SetAttribute("Remote", remoteAddress);
516 ftp.SetAttribute("SendSize", UintegerValue(tcp_adu_size));
517 ftp.SetAttribute("MaxBytes", UintegerValue(data_mbytes * 1000000));
518
519 ApplicationContainer sourceApp = ftp.Install(sources.Get(i));
520 sourceApp.Start(Seconds(start_time * i));
521 sourceApp.Stop(Seconds(stop_time - 3));
522
523 sinkHelper.SetAttribute("Protocol", TypeIdValue(TcpSocketFactory::GetTypeId()));
524 ApplicationContainer sinkApp = sinkHelper.Install(sinks.Get(i));
525 sinkApp.Start(Seconds(start_time * i));
526 sinkApp.Stop(Seconds(stop_time));
527 }
528
529 // Set up tracing if enabled
530 if (tracing)
531 {
532 std::ofstream ascii;
533 Ptr<OutputStreamWrapper> ascii_wrap;
534 ascii.open(prefix_file_name + "-ascii");
535 ascii_wrap = new OutputStreamWrapper(prefix_file_name + "-ascii", std::ios::out);
536 stack.EnableAsciiIpv4All(ascii_wrap);
537
538 for (uint16_t index = 0; index < num_flows; index++)
539 {
540 std::string flowString;
541 if (num_flows > 1)
542 {
543 flowString = "-flow" + std::to_string(index);
544 }
545
546 firstCwnd[index + 1] = true;
547 firstSshThr[index + 1] = true;
548 firstRtt[index + 1] = true;
549 firstRto[index + 1] = true;
550
551 Simulator::Schedule(Seconds(start_time * index + 0.00001),
552 &TraceCwnd,
553 prefix_file_name + flowString + "-cwnd.data",
554 index + 1);
555 Simulator::Schedule(Seconds(start_time * index + 0.00001),
557 prefix_file_name + flowString + "-ssth.data",
558 index + 1);
559 Simulator::Schedule(Seconds(start_time * index + 0.00001),
560 &TraceRtt,
561 prefix_file_name + flowString + "-rtt.data",
562 index + 1);
563 Simulator::Schedule(Seconds(start_time * index + 0.00001),
564 &TraceRto,
565 prefix_file_name + flowString + "-rto.data",
566 index + 1);
567 Simulator::Schedule(Seconds(start_time * index + 0.00001),
569 prefix_file_name + flowString + "-next-tx.data",
570 index + 1);
571 Simulator::Schedule(Seconds(start_time * index + 0.00001),
573 prefix_file_name + flowString + "-inflight.data",
574 index + 1);
575 Simulator::Schedule(Seconds(start_time * index + 0.1),
577 prefix_file_name + flowString + "-next-rx.data",
578 num_flows + index + 1);
579 }
580 }
581
582 if (pcap)
583 {
584 UnReLink.EnablePcapAll(prefix_file_name, true);
585 LocalLink.EnablePcapAll(prefix_file_name, true);
586 }
587
588 // Flow monitor
589 FlowMonitorHelper flowHelper;
590 if (flow_monitor)
591 {
592 flowHelper.InstallAll();
593 }
594
595 Simulator::Stop(Seconds(stop_time));
597
598 if (flow_monitor)
599 {
600 flowHelper.SerializeToXmlFile(prefix_file_name + ".flowmonitor", true, true);
601 }
602
604 return 0;
605}
a polymophic address class
Definition address.h:90
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Manage ASCII trace files for device models.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes.
Parse command-line arguments.
Class for representing data rates.
Definition data-rate.h:78
Helper to enable IP flow monitoring on a set of Nodes.
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
Protocol header serialization and deserialization.
Definition header.h:33
virtual uint32_t GetSerializedSize() const =0
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static Ipv4Address GetAny()
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
Packet header for IPv4.
Definition ipv4-header.h:23
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void Add(const Ipv4InterfaceContainer &other)
Concatenate the entries in the other container with ours.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
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 class encapsulating an output stream.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Class for representing queue sizes.
Definition queue-size.h:85
Determine which packets are errored corresponding to an underlying distribution, rate,...
void SetRate(double rate)
void SetUnit(ErrorUnit error_unit)
void SetRandomVariable(Ptr< RandomVariableStream >)
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Hold variables of type string.
Definition string.h:45
Header for the Transmission Control Protocol.
Definition tcp-header.h:36
static TypeId GetTypeId()
Get the type ID.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
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.
a unique identifier for an interface.
Definition type-id.h:48
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:872
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
Get a TypeId by name.
Definition type-id.cc:886
Hold an unsigned integer type.
Definition uinteger.h:34
uint16_t port
Definition dsdv-manet.cc:33
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:883
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:967
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition abort.h:133
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
address
Definition first.py:36
devices
Definition first.py:31
stack
Definition first.py:33
interfaces
Definition first.py:39
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition callback.h:684
static void RttTracer(std::string context, Time oldval, Time newval)
RTT tracer.
static std::map< uint32_t, bool > firstCwnd
First congestion window.
static std::map< uint32_t, uint32_t > cWndValue
congestion window value.
static void TraceInFlight(std::string &in_flight_file_name, uint32_t nodeId)
In flight trace connection.
static void NextRxTracer(std::string context, SequenceNumber32 old, SequenceNumber32 nextRx)
Next RX tracer.
static std::map< uint32_t, Ptr< OutputStreamWrapper > > nextTxStream
Next TX output stream.
static std::map< uint32_t, Ptr< OutputStreamWrapper > > inFlightStream
In flight output stream.
static std::map< uint32_t, bool > firstSshThr
First SlowStart threshold.
static std::map< uint32_t, bool > firstRto
First RTO.
static std::map< uint32_t, Ptr< OutputStreamWrapper > > nextRxStream
Next RX output stream.
static uint32_t GetNodeIdFromContext(std::string context)
Get the Node Id From Context.
static std::map< uint32_t, Ptr< OutputStreamWrapper > > rtoStream
RTO output stream.
static void InFlightTracer(std::string context, uint32_t old, uint32_t inFlight)
In-flight tracer.
static void NextTxTracer(std::string context, SequenceNumber32 old, SequenceNumber32 nextTx)
Next TX tracer.
static std::map< uint32_t, uint32_t > ssThreshValue
SlowStart threshold value.
static void TraceRtt(std::string rtt_tr_file_name, uint32_t nodeId)
RTT trace connection.
static void TraceSsThresh(std::string ssthresh_tr_file_name, uint32_t nodeId)
Slow start threshold trace connection.
static std::map< uint32_t, bool > firstRtt
First RTT.
static void TraceNextTx(std::string &next_tx_seq_file_name, uint32_t nodeId)
Next TX trace connection.
static void CwndTracer(std::string context, uint32_t oldval, uint32_t newval)
Congestion window tracer.
static void SsThreshTracer(std::string context, uint32_t oldval, uint32_t newval)
Slow start threshold tracer.
static std::map< uint32_t, Ptr< OutputStreamWrapper > > ssThreshStream
SlowStart threshold output stream.
static std::map< uint32_t, Ptr< OutputStreamWrapper > > rttStream
RTT output stream.
static void TraceCwnd(std::string cwnd_tr_file_name, uint32_t nodeId)
Congestion window trace connection.
static void RtoTracer(std::string context, Time oldval, Time newval)
RTO tracer.
static void TraceNextRx(std::string &next_rx_seq_file_name, uint32_t nodeId)
Next RX trace connection.
static std::map< uint32_t, Ptr< OutputStreamWrapper > > cWndStream
Congstion window output stream.
static void TraceRto(std::string rto_tr_file_name, uint32_t nodeId)
RTO trace connection.
bool tracing
Flag to enable/disable generation of tracing files.