A Discrete-Event Network Simulator
API
ns3tcp-loss-test-suite.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 University of Washington
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
19
20#include "ns3/abort.h"
21#include "ns3/config.h"
22#include "ns3/data-rate.h"
23#include "ns3/error-model.h"
24#include "ns3/inet-socket-address.h"
25#include "ns3/internet-stack-helper.h"
26#include "ns3/ipv4-address-helper.h"
27#include "ns3/ipv4-global-routing-helper.h"
28#include "ns3/log.h"
29#include "ns3/node-container.h"
30#include "ns3/packet-sink-helper.h"
31#include "ns3/pcap-file.h"
32#include "ns3/point-to-point-helper.h"
33#include "ns3/pointer.h"
34#include "ns3/simulator.h"
35#include "ns3/string.h"
36#include "ns3/tcp-header.h"
37#include "ns3/tcp-socket-factory.h"
38#include "ns3/tcp-westwood.h"
39#include "ns3/test.h"
40#include "ns3/uinteger.h"
41
42#include <iomanip>
43
44using namespace ns3;
45
46NS_LOG_COMPONENT_DEFINE("Ns3TcpLossTest");
47
48// The below boolean constants should only be changed to 'true'
49// during test debugging (i.e. do not commit the value 'true')
50
51// set to 'true' to have the test suite overwrite the response vectors
52// stored in the test directory. This should only be done if you are
53// convinced through other means (e.g. pcap tracing or logging) that the
54// revised vectors are the correct ones. In other words, don't simply
55// enable this to true to clear a failing test without looking at the
56// results closely.
57const bool WRITE_VECTORS = false;
58const bool WRITE_PCAP = false;
59const bool WRITE_LOGGING = false;
61 1187373557;
63
70{
71 public:
73
80 Ns3TcpLossTestCase(std::string tcpModel, uint32_t testCase);
81
83 {
84 }
85
86 private:
87 void DoSetup() override;
88 void DoRun() override;
89 void DoTeardown() override;
90
92 std::string m_pcapFilename;
101 std::string m_tcpModel;
102
112 void Ipv4L3Tx(std::string context,
113 Ptr<const Packet> packet,
114 Ptr<Ipv4> ipv4,
115 uint32_t interface);
122 void CwndTracer(uint32_t oldval, uint32_t newval);
129 void WriteUntilBufferFull(Ptr<Socket> localSocket, uint32_t txSpace);
137 void StartFlow(Ptr<Socket> localSocket, Ipv4Address servAddress, uint16_t servPort);
138};
139
141 : TestCase("Check the operation of the TCP state machine for several cases"),
142 m_testCase(0),
143 m_totalTxBytes(200000),
144 m_currentTxBytes(0),
145 m_writeVectors(WRITE_VECTORS),
146 m_writeResults(WRITE_PCAP),
147 m_writeLogging(WRITE_LOGGING),
148 m_needToClose(true),
149 m_tcpModel("ns3::TcpWestwood")
150{
151}
152
154 : TestCase("Check the behaviour of TCP upon packet losses"),
155 m_testCase(testCase),
156 m_totalTxBytes(200000),
157 m_currentTxBytes(0),
158 m_writeVectors(WRITE_VECTORS),
159 m_writeResults(WRITE_PCAP),
160 m_writeLogging(WRITE_LOGGING),
161 m_needToClose(true),
162 m_tcpModel(tcpModel)
163{
164}
165
166void
168{
169 // This test was written before SACK was added to ns-3
170 Config::SetDefault("ns3::TcpSocketBase::Sack", BooleanValue(false));
171 // This test was written with initial window of 1 segment
172 Config::SetDefault("ns3::TcpSocket::InitialCwnd", UintegerValue(1));
173 // This test was written with the TCP Classic Recovery algorithm
174 Config::SetDefault("ns3::TcpL4Protocol::RecoveryType",
176
177 //
178 // We expect there to be a file called ns3tcp-state-response-vectors.pcap in
179 // the data directory
180 //
181 std::ostringstream oss;
182 oss << "ns3tcp-loss-" << m_tcpModel << m_testCase << "-response-vectors.pcap";
184
185 if (m_writeVectors)
186 {
187 m_pcapFile.Open(m_pcapFilename, std::ios::out | std::ios::binary);
189 }
190 else
191 {
192 m_pcapFile.Open(m_pcapFilename, std::ios::in | std::ios::binary);
194 "Wrong response vectors in directory: opening " << m_pcapFilename);
195 }
196}
197
198void
200{
202}
203
204void
206{
207 //
208 // We're not testing IP so remove and toss the header. In order to do this,
209 // though, we need to copy the packet since we have a const version.
210 //
211 Ptr<Packet> received = packet->Copy();
212 Ipv4Header ipHeader;
213 received->RemoveHeader(ipHeader);
214
215 //
216 // What is left is the TCP header and any data that may be sent. We aren't
217 // sending any TCP data, so we expect what remains is only TCP header, which
218 // is a small thing to save.
219 //
220 if (m_writeVectors)
221 {
222 //
223 // Save the TCP under test response for later testing.
224 //
225 Time tNow = Simulator::Now();
226 int64_t tMicroSeconds = tNow.GetMicroSeconds();
227
228 m_pcapFile.Write(uint32_t(tMicroSeconds / 1000000),
229 uint32_t(tMicroSeconds % 1000000),
230 received);
231 }
232 else
233 {
234 //
235 // Read the TCP under test expected response from the expected vector
236 // file and see if it still does the right thing.
237 //
238 uint8_t expectedBuffer[PCAP_SNAPLEN];
239 uint32_t tsSec;
240 uint32_t tsUsec;
241 uint32_t inclLen;
242 uint32_t origLen;
243 uint32_t readLen;
245 .Read(expectedBuffer, sizeof(expectedBuffer), tsSec, tsUsec, inclLen, origLen, readLen);
246
247 NS_LOG_INFO("read " << readLen << " bytes");
248
249 uint8_t* actual = new uint8_t[readLen];
250 received->CopyData(actual, readLen);
251
252 int result = memcmp(actual, expectedBuffer, readLen);
253
254 TcpHeader expectedHeader;
255 TcpHeader receivedHeader;
256 Ptr<Packet> expected = Create<Packet>(expectedBuffer, readLen);
257
258 expected->RemoveHeader(expectedHeader);
259 received->RemoveHeader(receivedHeader);
260
261 NS_LOG_DEBUG("Expected " << expectedHeader << " received: " << receivedHeader);
262
263 delete[] actual;
264
265 //
266 // Avoid streams of errors -- only report the first.
267 //
268 if (IsStatusSuccess())
269 {
271 0,
272 "Expected data comparison error: " << m_tcpModel << "-"
273 << m_testCase);
274 }
275 }
276}
277
278void
280{
281 if (m_writeLogging)
282 {
283 *(m_osw->GetStream()) << "Moving cwnd from " << oldval << " to " << newval << " at time "
284 << Simulator::Now().GetSeconds() << " seconds" << std::endl;
285 }
286}
287
289// Implementing an "application" to send bytes over a TCP connection
290void
292{
294 {
296 uint32_t dataOffset = m_currentTxBytes % 1040;
297 uint32_t toWrite = 1040 - dataOffset;
298 uint32_t txAvail = localSocket->GetTxAvailable();
299 toWrite = std::min(toWrite, left);
300 toWrite = std::min(toWrite, txAvail);
301 if (txAvail == 0)
302 {
303 return;
304 }
305 if (m_writeLogging)
306 {
307 std::clog << "Submitting " << toWrite << " bytes to TCP socket" << std::endl;
308 }
309 int amountSent = localSocket->Send(nullptr, toWrite, 0);
310 NS_ASSERT(amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero
311 m_currentTxBytes += amountSent;
312 }
313 if (m_needToClose)
314 {
315 if (m_writeLogging)
316 {
317 std::clog << "Close socket at " << Simulator::Now().GetSeconds() << std::endl;
318 }
319 localSocket->Close();
320 m_needToClose = false;
321 }
322}
323
324void
325Ns3TcpLossTestCase::StartFlow(Ptr<Socket> localSocket, Ipv4Address servAddress, uint16_t servPort)
326{
327 if (m_writeLogging)
328 {
329 std::clog << "Starting flow at time " << Simulator::Now().GetSeconds() << std::endl;
330 }
331 localSocket->Connect(InetSocketAddress(servAddress, servPort)); // connect
332
333 // tell the tcp implementation to call WriteUntilBufferFull again
334 // if we blocked and new tx buffer space becomes available
336 WriteUntilBufferFull(localSocket, localSocket->GetTxAvailable());
337}
338
339void
341{
342 // Network topology
343 //
344 // 8Mb/s, 0.1ms 0.8Mb/s, 100ms
345 // s1-----------------r1-----------------k1
346 //
347 // Example corresponding to simulations in the paper "Simulation-based
348 // Comparisons of Tahoe, Reno, and SACK TCP
349
350 Config::SetDefault("ns3::TcpSocketBase::Sack", BooleanValue(false));
351
352 std::ostringstream tcpModel;
353 tcpModel << "ns3::Tcp" << m_tcpModel;
354 if (m_tcpModel == "WestwoodPlus")
355 {
356 Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue(TcpWestwood::GetTypeId()));
357 Config::SetDefault("ns3::TcpWestwood::ProtocolType", EnumValue(TcpWestwood::WESTWOODPLUS));
358 }
359 else
360 {
361 Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue(tcpModel.str()));
362 }
363
364 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(1000));
365 Config::SetDefault("ns3::TcpSocket::DelAckCount", UintegerValue(1));
366 Config::SetDefault("ns3::TcpSocketBase::Timestamp", BooleanValue(false));
367
368 if (m_writeLogging)
369 {
371 LogComponentEnable("Ns3TcpLossTest", LOG_LEVEL_ALL);
372 LogComponentEnable("ErrorModel", LOG_LEVEL_DEBUG);
373 LogComponentEnable("TcpWestwood", LOG_LEVEL_ALL);
374 LogComponentEnable("TcpCongestionOps", LOG_LEVEL_INFO);
375 LogComponentEnable("TcpSocketBase", LOG_LEVEL_INFO);
376 }
377
379 // Topology construction
380 //
381
382 // Create three nodes: s1, r1, and k1
383 NodeContainer s1r1;
384 s1r1.Create(2);
385
386 NodeContainer r1k1;
387 r1k1.Add(s1r1.Get(1));
388 r1k1.Create(1);
389
390 // Set up TCP/IP stack to all nodes (and create loopback device at device 0)
391 InternetStackHelper internet;
392 internet.InstallAll();
393
394 // Connect the nodes
396 p2p.SetDeviceAttribute("DataRate", DataRateValue(DataRate(8000000)));
397 p2p.SetChannelAttribute("Delay", TimeValue(Seconds(0.0001)));
398 NetDeviceContainer dev0 = p2p.Install(s1r1);
399 p2p.SetDeviceAttribute("DataRate", DataRateValue(DataRate(800000)));
400 p2p.SetChannelAttribute("Delay", TimeValue(Seconds(0.1)));
401 NetDeviceContainer dev1 = p2p.Install(r1k1);
402
403 // Add IP addresses to each network interfaces
405 ipv4.SetBase("10.1.3.0", "255.255.255.0");
406 ipv4.Assign(dev0);
407 ipv4.SetBase("10.1.2.0", "255.255.255.0");
408 Ipv4InterfaceContainer ipInterfs = ipv4.Assign(dev1);
409
410 // Set up routes to all nodes
411 Ipv4GlobalRoutingHelper::PopulateRoutingTables();
412
414 // Send 20000 (totalTxBytes) bytes from node s1 to node k1
415 //
416
417 // Create a packet sink to receive packets on node k1
418 uint16_t servPort = 50000; // Destination port number
419 PacketSinkHelper sink("ns3::TcpSocketFactory",
420 InetSocketAddress(Ipv4Address::GetAny(), servPort));
421 ApplicationContainer apps = sink.Install(r1k1.Get(1));
422 apps.Start(Seconds(0.0));
423 apps.Stop(Seconds(100.0));
424
425 // Create a data source to send packets on node s0.
426 // Instead of full application, here use the socket directly by
427 // registering callbacks in function StarFlow().
428 Ptr<Socket> localSocket = Socket::CreateSocket(s1r1.Get(0), TcpSocketFactory::GetTypeId());
429 localSocket->Bind();
430 Simulator::ScheduleNow(&Ns3TcpLossTestCase::StartFlow,
431 this,
432 localSocket,
433 ipInterfs.GetAddress(1),
434 servPort);
435
436 Config::Connect("/NodeList/0/$ns3::Ipv4L3Protocol/Tx",
438
439 Config::ConnectWithoutContext("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
441
443 // Set up loss model at node k1
444 //
445 std::list<uint32_t> sampleList;
446 switch (m_testCase)
447 {
448 case 0:
449 break;
450 case 1:
451 // Force a loss for 15th data packet. TCP cwnd will be at 14 segments
452 // (14000 bytes) when duplicate acknowledgments start to come.
453 sampleList.push_back(16);
454 break;
455 case 2:
456 sampleList.push_back(16);
457 sampleList.push_back(17);
458 break;
459 case 3:
460 sampleList.push_back(16);
461 sampleList.push_back(17);
462 sampleList.push_back(18);
463 break;
464 case 4:
465 sampleList.push_back(16);
466 sampleList.push_back(17);
467 sampleList.push_back(18);
468 sampleList.push_back(19);
469 break;
470 default:
471 NS_FATAL_ERROR("Program fatal error: loss value " << m_testCase << " not supported.");
472 break;
473 }
474
475 Ptr<ReceiveListErrorModel> pem = CreateObject<ReceiveListErrorModel>();
476 pem->SetList(sampleList);
477 dev1.Get(1)->SetAttribute("ReceiveErrorModel", PointerValue(pem));
478
479 // One can toggle the comment for the following line on or off to see the
480 // effects of finite send buffer modelling. One can also change the size of
481 // that buffer.
482 // localSocket->SetAttribute("SndBufSize", UintegerValue(4096));
483
484 std::ostringstream oss;
485 oss << "tcp-loss-" << m_tcpModel << m_testCase << "-test-case";
486 if (m_writeResults)
487 {
488 p2p.EnablePcapAll(oss.str());
489 p2p.EnableAsciiAll(oss.str());
490 }
491
492 std::ostringstream oss2;
493 oss2 << "src/test/ns3tcp/Tcp" << m_tcpModel << "." << m_testCase << ".log";
494 AsciiTraceHelper ascii;
495 if (m_writeLogging)
496 {
497 m_osw = ascii.CreateFileStream(oss2.str());
498 *(m_osw->GetStream()) << std::setprecision(9) << std::fixed;
500 }
501
502 // Finally, set up the simulator to run. The 1000 second hard limit is a
503 // failsafe in case some change above causes the simulation to never end
504 Simulator::Stop(Seconds(1000));
505 Simulator::Run();
506 Simulator::Destroy();
507}
508
515{
516 public:
518};
519
521 : TestSuite("ns3-tcp-loss", SYSTEM)
522{
523 // We can't use NS_TEST_SOURCEDIR variable here because we use subdirectories
524 SetDataDir("src/test/ns3tcp/response-vectors");
525 Packet::EnablePrinting(); // Enable packet metadata for all test cases
526
527 AddTestCase(new Ns3TcpLossTestCase("NewReno", 0), TestCase::QUICK);
528 AddTestCase(new Ns3TcpLossTestCase("NewReno", 1), TestCase::QUICK);
529 AddTestCase(new Ns3TcpLossTestCase("NewReno", 2), TestCase::QUICK);
530 AddTestCase(new Ns3TcpLossTestCase("NewReno", 3), TestCase::QUICK);
531 AddTestCase(new Ns3TcpLossTestCase("NewReno", 4), TestCase::QUICK);
532
533 AddTestCase(new Ns3TcpLossTestCase("Westwood", 0), TestCase::QUICK);
534 AddTestCase(new Ns3TcpLossTestCase("Westwood", 1), TestCase::QUICK);
535 AddTestCase(new Ns3TcpLossTestCase("Westwood", 2), TestCase::QUICK);
536 AddTestCase(new Ns3TcpLossTestCase("Westwood", 3), TestCase::QUICK);
537 AddTestCase(new Ns3TcpLossTestCase("Westwood", 4), TestCase::QUICK);
538
539 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 0), TestCase::QUICK);
540 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 1), TestCase::QUICK);
541 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 2), TestCase::QUICK);
542 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 3), TestCase::QUICK);
543 AddTestCase(new Ns3TcpLossTestCase("WestwoodPlus", 4), TestCase::QUICK);
544}
545
#define min(a, b)
Definition: 80211b.c:42
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 consitent 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)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void EnableAsciiAll(std::string prefix)
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes c...
Manage ASCII trace files for device models.
Definition: trace-helper.h:173
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.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
AttributeValue implementation for DataRate.
Hold variables of type enum.
Definition: enum.h:56
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
void InstallAll() const
Aggregate IPv4, IPv6, UDP, and TCP stacks to all nodes in the simulation.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
Packet header for IPv4.
Definition: ipv4-header.h:34
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.
std::ostream * GetStream()
Return a pointer to an ostream previously set in the wrapper.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:294
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Definition: packet.cc:400
Ptr< Packet > Copy() const
performs a COW copy of the packet.
Definition: packet.cc:131
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:43
void Close()
Close the underlying file.
Definition: pcap-file.cc:92
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:331
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:141
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:479
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:351
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:444
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)
Hold objects of type Ptr<T>.
Definition: pointer.h:37
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added.
Definition: socket.cc:119
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual int Close()=0
Close a socket.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
virtual uint32_t GetTxAvailable() const =0
Returns the number of bytes which can be sent in a single call to Send.
Hold variables of type string.
Definition: string.h:42
static TypeId GetTypeId()
Get the type ID.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:46
encapsulates test code
Definition: test.h:1060
std::string CreateDataDirFilename(std::string filename)
Construct the full path to a file in the data directory.
Definition: test.cc:423
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
bool IsStatusSuccess() const
Check if all tests passed.
Definition: test.cc:475
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
Definition: test.cc:482
A suite of tests to run.
Definition: test.h:1256
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:412
AttributeValue implementation for Time.
Definition: nstime.h:1425
a unique identifier for an interface.
Definition: type-id.h:60
AttributeValue implementation for TypeId.
Definition: type-id.h:600
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:975
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:951
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition: abort.h:144
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:160
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:328
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:296
#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:251
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
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:691
@ LOG_LEVEL_ALL
Print everything.
Definition: log.h:116
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition: log.h:118
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition: log.h:104
@ LOG_LEVEL_INFO
LOG_INFO and above.
Definition: log.h:107
void LogComponentEnable(const char *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:358
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:380
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:55