A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3tcp-loss-test-suite.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
8
9#include "ns3/abort.h"
10#include "ns3/config.h"
11#include "ns3/data-rate.h"
12#include "ns3/error-model.h"
13#include "ns3/inet-socket-address.h"
14#include "ns3/internet-stack-helper.h"
15#include "ns3/ipv4-address-helper.h"
16#include "ns3/ipv4-global-routing-helper.h"
17#include "ns3/log.h"
18#include "ns3/node-container.h"
19#include "ns3/packet-sink-helper.h"
20#include "ns3/pcap-file.h"
21#include "ns3/point-to-point-helper.h"
22#include "ns3/pointer.h"
23#include "ns3/simulator.h"
24#include "ns3/string.h"
25#include "ns3/tcp-header.h"
26#include "ns3/tcp-socket-factory.h"
27#include "ns3/tcp-westwood-plus.h"
28#include "ns3/test.h"
29#include "ns3/uinteger.h"
30
31#include <iomanip>
32
33using namespace ns3;
34
35NS_LOG_COMPONENT_DEFINE("Ns3TcpLossTest");
36
37// The below boolean constants should only be changed to 'true'
38// during test debugging (i.e. do not commit the value 'true')
39
40// set to 'true' to have the test suite overwrite the response vectors
41// stored in the test directory. This should only be done if you are
42// convinced through other means (e.g. pcap tracing or logging) that the
43// revised vectors are the correct ones. In other words, don't simply
44// enable this to true to clear a failing test without looking at the
45// results closely.
46const bool WRITE_VECTORS = false; //!< Set to true to write response vectors.
47const bool WRITE_PCAP = false; //!< Set to true to write out pcap.
48const bool WRITE_LOGGING = false; //!< Set to true to write logging.
50 1187373557; //!< Some large random number -- we use to verify data was written by this program.
51const uint32_t PCAP_SNAPLEN = 64; //!< Don't bother to save much data.
52
53/**
54 * \ingroup system-tests-tcp
55 *
56 * \brief Tests of TCP implementation loss behavior.
57 */
59{
60 public:
62
63 /**
64 * Constructor.
65 *
66 * \param tcpModel The TCP model name.
67 * \param testCase Testcase number.
68 */
69 Ns3TcpLossTestCase(std::string tcpModel, uint32_t testCase);
70
72 {
73 }
74
75 private:
76 void DoSetup() override;
77 void DoRun() override;
78 void DoTeardown() override;
79
80 Ptr<OutputStreamWrapper> m_osw; //!< The output stream.
81 std::string m_pcapFilename; //!< The PCAP filename.
82 PcapFile m_pcapFile; //!< The PCAP ffile.
83 uint32_t m_testCase; //!< Testcase number.
84 uint32_t m_totalTxBytes; //!< Total number of bytes to send.
85 uint32_t m_currentTxBytes; //!< Current number of bytes sent.
86 bool m_writeVectors; //!< True if response vectors have to be written (and not read).
87 bool m_writeResults; //!< True if write PCAP files.
88 bool m_writeLogging; //!< True if write logging.
89 bool m_needToClose; //!< Check if the sending socket need to be closed.
90 std::string m_tcpModel; //!< The TCP model name.
91
92 /**
93 * Check that the transmitted packets are consistent with the trace.
94 * This callback is hooked to ns3::Ipv4L3Protocol/Tx.
95 *
96 * \param context The callback context (unused).
97 * \param packet The transmitted packet.
98 * \param ipv4 The IPv4 object that did send the packet (unused).
99 * \param interface The IPv4 interface that did send the packet (unused).
100 */
101 void Ipv4L3Tx(std::string context,
102 Ptr<const Packet> packet,
103 Ptr<Ipv4> ipv4,
104 uint32_t interface);
105 /**
106 * CWND trace.
107 *
108 * \param oldval The old value.
109 * \param newval The new value.
110 */
111 void CwndTracer(uint32_t oldval, uint32_t newval);
112 /**
113 * Write to the socket until the buffer is full.
114 *
115 * \param localSocket The output socket.
116 * \param txSpace The space left on the socket (unused).
117 */
118 void WriteUntilBufferFull(Ptr<Socket> localSocket, uint32_t txSpace);
119 /**
120 * Start transmitting a TCP flow.
121 *
122 * \param localSocket The sending socket.
123 * \param servAddress The IPv4 address of the server (i.e., the destination address).
124 * \param servPort The TCP port of the server (i.e., the destination port).
125 */
126 void StartFlow(Ptr<Socket> localSocket, Ipv4Address servAddress, uint16_t servPort);
127};
128
130 : TestCase("Check the operation of the TCP state machine for several cases"),
131 m_testCase(0),
132 m_totalTxBytes(200000),
133 m_currentTxBytes(0),
134 m_writeVectors(WRITE_VECTORS),
135 m_writeResults(WRITE_PCAP),
136 m_writeLogging(WRITE_LOGGING),
137 m_needToClose(true),
138 m_tcpModel("ns3::TcpWestwoodPlus")
139{
140}
141
143 : TestCase("Check the behaviour of TCP upon packet losses"),
144 m_testCase(testCase),
145 m_totalTxBytes(200000),
146 m_currentTxBytes(0),
147 m_writeVectors(WRITE_VECTORS),
148 m_writeResults(WRITE_PCAP),
149 m_writeLogging(WRITE_LOGGING),
150 m_needToClose(true),
151 m_tcpModel(tcpModel)
152{
153}
154
155void
157{
158 // This test was written before SACK was added to ns-3
159 Config::SetDefault("ns3::TcpSocketBase::Sack", BooleanValue(false));
160 // This test was written with initial window of 1 segment
161 Config::SetDefault("ns3::TcpSocket::InitialCwnd", UintegerValue(1));
162 // This test was written with the TCP Classic Recovery algorithm
163 Config::SetDefault("ns3::TcpL4Protocol::RecoveryType",
165
166 //
167 // We expect there to be a file called ns3tcp-state-response-vectors.pcap in
168 // the data directory
169 //
170 std::ostringstream oss;
171 oss << "ns3tcp-loss-" << m_tcpModel << m_testCase << "-response-vectors.pcap";
173
174 if (m_writeVectors)
175 {
176 m_pcapFile.Open(m_pcapFilename, std::ios::out | std::ios::binary);
178 }
179 else
180 {
181 m_pcapFile.Open(m_pcapFilename, std::ios::in | std::ios::binary);
183 "Wrong response vectors in directory: opening " << m_pcapFilename);
184 }
185}
186
187void
192
193void
195{
196 //
197 // We're not testing IP so remove and toss the header. In order to do this,
198 // though, we need to copy the packet since we have a const version.
199 //
200 Ptr<Packet> received = packet->Copy();
201 Ipv4Header ipHeader;
202 received->RemoveHeader(ipHeader);
203
204 //
205 // What is left is the TCP header and any data that may be sent. We aren't
206 // sending any TCP data, so we expect what remains is only TCP header, which
207 // is a small thing to save.
208 //
209 if (m_writeVectors)
210 {
211 //
212 // Save the TCP under test response for later testing.
213 //
214 Time tNow = Simulator::Now();
215 int64_t tMicroSeconds = tNow.GetMicroSeconds();
216
217 m_pcapFile.Write(uint32_t(tMicroSeconds / 1000000),
218 uint32_t(tMicroSeconds % 1000000),
219 received);
220 }
221 else
222 {
223 //
224 // Read the TCP under test expected response from the expected vector
225 // file and see if it still does the right thing.
226 //
227 uint8_t expectedBuffer[PCAP_SNAPLEN];
228 uint32_t tsSec;
229 uint32_t tsUsec;
230 uint32_t inclLen;
231 uint32_t origLen;
232 uint32_t readLen;
234 .Read(expectedBuffer, sizeof(expectedBuffer), tsSec, tsUsec, inclLen, origLen, readLen);
235
236 NS_LOG_INFO("read " << readLen << " bytes");
237
238 auto actual = new uint8_t[readLen];
239 received->CopyData(actual, readLen);
240
241 int result = memcmp(actual, expectedBuffer, readLen);
242
243 TcpHeader expectedHeader;
244 TcpHeader receivedHeader;
245 Ptr<Packet> expected = Create<Packet>(expectedBuffer, readLen);
246
247 expected->RemoveHeader(expectedHeader);
248 received->RemoveHeader(receivedHeader);
249
250 NS_LOG_DEBUG("Expected " << expectedHeader << " received: " << receivedHeader);
251
252 delete[] actual;
253
254 //
255 // Avoid streams of errors -- only report the first.
256 //
257 if (IsStatusSuccess())
258 {
260 0,
261 "Expected data comparison error: " << m_tcpModel << "-"
262 << m_testCase);
263 }
264 }
265}
266
267void
269{
270 if (m_writeLogging)
271 {
272 *(m_osw->GetStream()) << "Moving cwnd from " << oldval << " to " << newval << " at time "
273 << Simulator::Now().GetSeconds() << " seconds" << std::endl;
274 }
275}
276
277////////////////////////////////////////////////////////////////////
278// Implementing an "application" to send bytes over a TCP connection
279void
281{
283 {
285 uint32_t dataOffset = m_currentTxBytes % 1040;
286 uint32_t toWrite = 1040 - dataOffset;
287 uint32_t txAvail = localSocket->GetTxAvailable();
288 toWrite = std::min(toWrite, left);
289 toWrite = std::min(toWrite, txAvail);
290 if (txAvail == 0)
291 {
292 return;
293 }
294 if (m_writeLogging)
295 {
296 std::clog << "Submitting " << toWrite << " bytes to TCP socket" << std::endl;
297 }
298 int amountSent = localSocket->Send(nullptr, toWrite, 0);
299 NS_ASSERT(amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero
300 m_currentTxBytes += amountSent;
301 }
302 if (m_needToClose)
303 {
304 if (m_writeLogging)
305 {
306 std::clog << "Close socket at " << Simulator::Now().GetSeconds() << std::endl;
307 }
308 localSocket->Close();
309 m_needToClose = false;
310 }
311}
312
313void
314Ns3TcpLossTestCase::StartFlow(Ptr<Socket> localSocket, Ipv4Address servAddress, uint16_t servPort)
315{
316 if (m_writeLogging)
317 {
318 std::clog << "Starting flow at time " << Simulator::Now().GetSeconds() << std::endl;
319 }
320 localSocket->Connect(InetSocketAddress(servAddress, servPort)); // connect
321
322 // tell the tcp implementation to call WriteUntilBufferFull again
323 // if we blocked and new tx buffer space becomes available
324 localSocket->SetSendCallback(MakeCallback(&Ns3TcpLossTestCase::WriteUntilBufferFull, this));
325 WriteUntilBufferFull(localSocket, localSocket->GetTxAvailable());
326}
327
328void
330{
331 // Network topology
332 //
333 // 8Mb/s, 0.1ms 0.8Mb/s, 100ms
334 // s1-----------------r1-----------------k1
335 //
336 // Example corresponding to simulations in the paper "Simulation-based
337 // Comparisons of Tahoe, Reno, and SACK TCP
338
339 Config::SetDefault("ns3::TcpSocketBase::Sack", BooleanValue(false));
340
341 std::ostringstream tcpModel;
342 tcpModel << "ns3::Tcp" << m_tcpModel;
343 Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue(tcpModel.str()));
344
345 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(1000));
346 Config::SetDefault("ns3::TcpSocket::DelAckCount", UintegerValue(1));
347 Config::SetDefault("ns3::TcpSocketBase::Timestamp", BooleanValue(false));
348
349 if (m_writeLogging)
350 {
352 LogComponentEnable("Ns3TcpLossTest", LOG_LEVEL_ALL);
353 LogComponentEnable("ErrorModel", LOG_LEVEL_DEBUG);
354 LogComponentEnable("TcpWestwoodPlus", LOG_LEVEL_ALL);
355 LogComponentEnable("TcpCongestionOps", LOG_LEVEL_INFO);
356 LogComponentEnable("TcpSocketBase", LOG_LEVEL_INFO);
357 }
358
359 ////////////////////////////////////////////////////////
360 // Topology construction
361 //
362
363 // Create three nodes: s1, r1, and k1
364 NodeContainer s1r1;
365 s1r1.Create(2);
366
367 NodeContainer r1k1;
368 r1k1.Add(s1r1.Get(1));
369 r1k1.Create(1);
370
371 // Set up TCP/IP stack to all nodes (and create loopback device at device 0)
372 InternetStackHelper internet;
373 internet.InstallAll();
374
375 // Connect the nodes
377 p2p.SetDeviceAttribute("DataRate", DataRateValue(DataRate(8000000)));
378 p2p.SetChannelAttribute("Delay", TimeValue(Seconds(0.0001)));
379 NetDeviceContainer dev0 = p2p.Install(s1r1);
380 p2p.SetDeviceAttribute("DataRate", DataRateValue(DataRate(800000)));
381 p2p.SetChannelAttribute("Delay", TimeValue(Seconds(0.1)));
382 NetDeviceContainer dev1 = p2p.Install(r1k1);
383
384 // Add IP addresses to each network interfaces
386 ipv4.SetBase("10.1.3.0", "255.255.255.0");
387 ipv4.Assign(dev0);
388 ipv4.SetBase("10.1.2.0", "255.255.255.0");
389 Ipv4InterfaceContainer ipInterfs = ipv4.Assign(dev1);
390
391 // Set up routes to all nodes
393
394 ////////////////////////////////////////////////////////
395 // Send 20000 (totalTxBytes) bytes from node s1 to node k1
396 //
397
398 // Create a packet sink to receive packets on node k1
399 uint16_t servPort = 50000; // Destination port number
400 PacketSinkHelper sink("ns3::TcpSocketFactory",
402 ApplicationContainer apps = sink.Install(r1k1.Get(1));
403 apps.Start(Seconds(0.0));
404 apps.Stop(Seconds(100.0));
405
406 // Create a data source to send packets on node s0.
407 // Instead of full application, here use the socket directly by
408 // registering callbacks in function StarFlow().
410 localSocket->Bind();
412 this,
413 localSocket,
414 ipInterfs.GetAddress(1),
415 servPort);
416
417 Config::Connect("/NodeList/0/$ns3::Ipv4L3Protocol/Tx",
419
420 Config::ConnectWithoutContext("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
422
423 ////////////////////////////////////////////////////////
424 // Set up loss model at node k1
425 //
426 std::list<uint32_t> sampleList;
427 switch (m_testCase)
428 {
429 case 0:
430 break;
431 case 1:
432 // Force a loss for 15th data packet. TCP cwnd will be at 14 segments
433 // (14000 bytes) when duplicate acknowledgments start to come.
434 sampleList.push_back(16);
435 break;
436 case 2:
437 sampleList.push_back(16);
438 sampleList.push_back(17);
439 break;
440 case 3:
441 sampleList.push_back(16);
442 sampleList.push_back(17);
443 sampleList.push_back(18);
444 break;
445 case 4:
446 sampleList.push_back(16);
447 sampleList.push_back(17);
448 sampleList.push_back(18);
449 sampleList.push_back(19);
450 break;
451 default:
452 NS_FATAL_ERROR("Program fatal error: loss value " << m_testCase << " not supported.");
453 break;
454 }
455
457 pem->SetList(sampleList);
458 dev1.Get(1)->SetAttribute("ReceiveErrorModel", PointerValue(pem));
459
460 // One can toggle the comment for the following line on or off to see the
461 // effects of finite send buffer modelling. One can also change the size of
462 // that buffer.
463 // localSocket->SetAttribute("SndBufSize", UintegerValue(4096));
464
465 std::ostringstream oss;
466 oss << "tcp-loss-" << m_tcpModel << m_testCase << "-test-case";
467 if (m_writeResults)
468 {
469 p2p.EnablePcapAll(oss.str());
470 p2p.EnableAsciiAll(oss.str());
471 }
472
473 std::ostringstream oss2;
474 oss2 << "src/test/ns3tcp/Tcp" << m_tcpModel << "." << m_testCase << ".log";
475 AsciiTraceHelper ascii;
476 if (m_writeLogging)
477 {
478 m_osw = ascii.CreateFileStream(oss2.str());
479 *(m_osw->GetStream()) << std::setprecision(9) << std::fixed;
480 p2p.EnableAsciiAll(m_osw);
481 }
482
483 // Finally, set up the simulator to run. The 1000 second hard limit is a
484 // failsafe in case some change above causes the simulation to never end
488}
489
490/**
491 * \ingroup system-tests-tcp
492 *
493 * TCP implementation loss behavior TestSuite.
494 */
496{
497 public:
499};
500
502 : TestSuite("ns3-tcp-loss", Type::SYSTEM)
503{
504 // We can't use NS_TEST_SOURCEDIR variable here because we use subdirectories
505 SetDataDir("src/test/ns3tcp/response-vectors");
506 Packet::EnablePrinting(); // Enable packet metadata for all test cases
507
508 AddTestCase(new Ns3TcpLossTestCase("NewReno", 0), TestCase::Duration::QUICK);
509 AddTestCase(new Ns3TcpLossTestCase("NewReno", 1), TestCase::Duration::QUICK);
510 AddTestCase(new Ns3TcpLossTestCase("NewReno", 2), TestCase::Duration::QUICK);
511 AddTestCase(new Ns3TcpLossTestCase("NewReno", 3), TestCase::Duration::QUICK);
512 AddTestCase(new Ns3TcpLossTestCase("NewReno", 4), TestCase::Duration::QUICK);
513
514 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 0), TestCase::Duration::QUICK);
515 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 1), TestCase::Duration::QUICK);
516 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 2), TestCase::Duration::QUICK);
517 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 3), TestCase::Duration::QUICK);
518 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 4), TestCase::Duration::QUICK);
519}
520
521/// Do not forget to allocate an instance of this TestSuite.
Tests of TCP implementation loss behavior.
void CwndTracer(uint32_t oldval, uint32_t newval)
CWND trace.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_currentTxBytes
Current number of bytes sent.
void StartFlow(Ptr< Socket > localSocket, Ipv4Address servAddress, uint16_t servPort)
Start transmitting a TCP flow.
PcapFile m_pcapFile
The PCAP ffile.
bool m_writeVectors
True if response vectors have to be written (and not read).
uint32_t m_testCase
Testcase number.
Ptr< OutputStreamWrapper > m_osw
The output stream.
bool m_writeResults
True if write PCAP files.
bool m_writeLogging
True if write logging.
uint32_t m_totalTxBytes
Total number of bytes to send.
void WriteUntilBufferFull(Ptr< Socket > localSocket, uint32_t txSpace)
Write to the socket until the buffer is full.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
std::string m_pcapFilename
The PCAP filename.
void Ipv4L3Tx(std::string context, Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
Check that the transmitted packets are consistent with the trace.
std::string m_tcpModel
The TCP model name.
bool m_needToClose
Check if the sending socket need to be closed.
TCP implementation loss behavior TestSuite.
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.
Class for representing data rates.
Definition data-rate.h:78
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.
Ipv4 addresses are stored in host order in this class.
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.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
static void EnablePrinting()
Enable printing packets metadata.
Definition packet.cc:585
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
A class representing a pcap file.
Definition pcap-file.h:32
void Close()
Close the underlying file.
Definition pcap-file.cc:81
void Open(const std::string &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap file.
Definition pcap-file.cc:320
uint32_t GetDataLinkType()
Returns the data link type field of the pcap file as defined by the network field in the pcap global ...
Definition pcap-file.cc:130
void Read(uint8_t *const data, uint32_t maxBytes, uint32_t &tsSec, uint32_t &tsUsec, uint32_t &inclLen, uint32_t &origLen, uint32_t &readLen)
Read next packet from file.
Definition pcap-file.cc:468
void Init(uint32_t dataLinkType, uint32_t snapLen=SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ZONE_DEFAULT, bool swapMode=false, bool nanosecMode=false)
Initialize the pcap file associated with this object.
Definition pcap-file.cc:340
void Write(uint32_t tsSec, uint32_t tsUsec, const uint8_t *const data, uint32_t totalLen)
Write next packet to file.
Definition pcap-file.cc:433
Build a set of PointToPointNetDevice objects.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
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 EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:594
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition socket.cc:61
Hold variables of type string.
Definition string.h:45
static TypeId GetTypeId()
Get the type ID.
Header for the Transmission Control Protocol.
Definition tcp-header.h:36
static TypeId GetTypeId()
Get the type ID.
encapsulates test code
Definition test.h:1050
std::string CreateDataDirFilename(std::string filename)
Construct the full path to a file in the data directory.
Definition test.cc:413
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
bool IsStatusSuccess() const
Check if all tests passed.
Definition test.cc:465
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
Definition test.cc:472
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
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
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:402
a unique identifier for an interface.
Definition type-id.h:48
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:883
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:967
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition config.cc:943
#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_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#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
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:241
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition log.cc:291
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
@ LOG_LEVEL_ALL
Print everything.
Definition log.h:105
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition log.h:107
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition log.h:102
@ LOG_LEVEL_INFO
LOG_INFO and above.
Definition log.h:93
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
Definition log.cc:309
const uint32_t PCAP_LINK_TYPE
Some large random number – we use to verify data was written by this program.
const bool WRITE_VECTORS
Set to true to write response vectors.
const bool WRITE_PCAP
Set to true to write out pcap.
static Ns3TcpLossTestSuite g_ns3TcpLossTestSuite
Do not forget to allocate an instance of this TestSuite.
const bool WRITE_LOGGING
Set to true to write logging.
const uint32_t PCAP_SNAPLEN
Don't bother to save much data.
Ptr< PacketSink > sink
Pointer to the packet sink application.
Definition wifi-tcp.cc:44