A Discrete-Event Network Simulator
API
ns3tcp-state-test-suite.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2010 University of Washington
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <iomanip>
20#include <string>
21
22#include "ns3/log.h"
23#include "ns3/abort.h"
24#include "ns3/test.h"
25#include "ns3/pcap-file.h"
26#include "ns3/config.h"
27#include "ns3/string.h"
28#include "ns3/uinteger.h"
29#include "ns3/boolean.h"
30#include "ns3/data-rate.h"
31#include "ns3/inet-socket-address.h"
32#include "ns3/point-to-point-helper.h"
33#include "ns3/internet-stack-helper.h"
34#include "ns3/traffic-control-helper.h"
35#include "ns3/ipv4-global-routing-helper.h"
36#include "ns3/ipv4-address-helper.h"
37#include "ns3/packet-sink-helper.h"
38#include "ns3/tcp-socket-factory.h"
39#include "ns3/node-container.h"
40#include "ns3/simulator.h"
41#include "ns3/error-model.h"
42#include "ns3/pointer.h"
44#include "ns3/tcp-header.h"
45
46using namespace ns3;
47
48NS_LOG_COMPONENT_DEFINE ("Ns3TcpStateTest");
49
50// The below boolean constants should only be changed to 'true'
51// during test debugging (i.e. do not commit the value 'true')
52
53// set to 'true' to have the test suite overwrite the response vectors
54// stored in the test directory. This should only be done if you are
55// convinced through other means (e.g. pcap tracing or logging) that the
56// revised vectors are the correct ones. In other words, don't simply
57// enable this to true to clear a failing test without looking at the
58// results closely.
59const bool WRITE_VECTORS = false;
60const bool WRITE_PCAP = false;
61const bool WRITE_LOGGING = false;
62const uint32_t PCAP_LINK_TYPE = 1187373554;
64
65
72{
73public:
81 {
82 }
83
84private:
85 virtual void DoSetup (void);
86 virtual void DoRun (void);
87 virtual void DoTeardown (void);
88
89 std::string m_pcapFilename;
98
108 void Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
118 void Ipv4L3Rx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
125 void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace);
133 void StartFlow (Ptr<Socket> localSocket,
134 Ipv4Address servAddress,
135 uint16_t servPort);
136
137};
138
140 : TestCase ("Check the operation of the TCP state machine for several cases"),
141 m_testCase (0),
142 m_totalTxBytes (20000),
143 m_currentTxBytes (0),
144 m_writeVectors (WRITE_VECTORS),
145 m_writeResults (WRITE_PCAP),
146 m_writeLogging (WRITE_LOGGING),
147 m_needToClose (true)
148{
149}
150
152 : TestCase ("Check the operation of the TCP state machine for several cases"),
153 m_testCase (testCase),
154 m_totalTxBytes (20000),
155 m_currentTxBytes (0),
156 m_writeVectors (WRITE_VECTORS),
157 m_writeResults (WRITE_PCAP),
158 m_writeLogging (WRITE_LOGGING),
159 m_needToClose (true)
160{
161}
162
163void
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-state" << m_testCase << "-response-vectors.pcap";
173 NS_LOG_INFO ("m_pcapFilename=" << m_pcapFilename);
174
175 if (m_writeVectors)
176 {
177 m_pcapFile.Open (m_pcapFilename, std::ios::out | std::ios::binary);
179 }
180 else
181 {
182 m_pcapFile.Open (m_pcapFilename, std::ios::in | std::ios::binary);
184 "Wrong response vectors in directory: opening " <<
186 }
187}
188
189void
191{
192 m_pcapFile.Close ();
193}
194
195void
197{
198 Ptr<Packet> received = packet->Copy ();
199 Ipv4Header ipHeader;
200 TcpHeader tcpHeader;
201 received->RemoveHeader (ipHeader);
202 received->RemoveHeader (tcpHeader);
203
204 NS_LOG_DEBUG ("Received: " << tcpHeader);
205}
206
207void
209{
210 //
211 // We're not testing IP so remove and toss the header. In order to do this,
212 // though, we need to copy the packet since we have a const version.
213 //
214 Ptr<Packet> received = packet->Copy ();
215 Ipv4Header ipHeader;
216 received->RemoveHeader (ipHeader);
217
218 //
219 // What is left is the TCP header and any data that may be sent. We aren't
220 // sending any TCP data, so we expect what remains is only TCP header, which
221 // is a small thing to save.
222 //
223 if (m_writeVectors)
224 {
225 //
226 // Save the TCP under test response for later testing.
227 //
228 Time tNow = Simulator::Now ();
229 int64_t tMicroSeconds = tNow.GetMicroSeconds ();
230
231 m_pcapFile.Write (uint32_t (tMicroSeconds / 1000000),
232 uint32_t (tMicroSeconds % 1000000),
233 received);
234 }
235 else
236 {
237 //
238 // Read the TCP under test expected response from the expected vector
239 // file and see if it still does the right thing.
240 //
241 uint8_t expectedBuffer[PCAP_SNAPLEN];
242 uint32_t tsSec, tsUsec, inclLen, origLen, readLen;
243 m_pcapFile.Read (expectedBuffer, sizeof(expectedBuffer), tsSec, tsUsec, inclLen, origLen, readLen);
244
245 NS_LOG_INFO ("read " << readLen << " bytes");
246
247 uint8_t *actual = new uint8_t[readLen];
248 received->CopyData (actual, readLen);
249
250 int result = memcmp (actual, expectedBuffer, readLen);
251
252 TcpHeader expectedHeader, receivedHeader;
253 Ptr<Packet> expected = Create<Packet> (expectedBuffer, readLen);
254
255 expected->RemoveHeader (expectedHeader);
256 received->RemoveHeader (receivedHeader);
257
258 NS_LOG_DEBUG ("Expected " << expectedHeader << " received: " << receivedHeader);
259
260 delete [] actual;
261
262 //
263 // Avoid streams of errors -- only report the first.
264 //
265 if (IsStatusSuccess ())
266 {
267 NS_TEST_EXPECT_MSG_EQ (result, 0, "Expected data comparison error");
268 }
269 }
270}
271
273// Implementing an "application" to send bytes over a TCP connection
274void
276{
278 {
280 uint32_t dataOffset = m_currentTxBytes % 1040;
281 uint32_t toWrite = 1040 - dataOffset;
282 uint32_t txAvail = localSocket->GetTxAvailable ();
283 toWrite = std::min (toWrite, left);
284 toWrite = std::min (toWrite, txAvail);
285 if (txAvail == 0)
286 {
287 return;
288 }
289 if (m_writeLogging)
290 {
291 std::clog << "Submitting "
292 << toWrite << " bytes to TCP socket" << std::endl;
293 }
294 int amountSent = localSocket->Send (0, toWrite, 0);
295 NS_ASSERT (amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero
296 m_currentTxBytes += amountSent;
297 }
298 if (m_needToClose)
299 {
300 if (m_writeLogging)
301 {
302 std::clog << "Close socket at "
304 << std::endl;
305 }
306 localSocket->Close ();
307 m_needToClose = false;
308 }
309}
310
311void
313 Ipv4Address servAddress,
314 uint16_t servPort)
315{
316 if (m_writeLogging)
317 {
318 std::clog << "Starting flow at time "
320 << std::endl;
321 }
322
323 localSocket->Connect (InetSocketAddress (servAddress, servPort)); // connect
324
325 // tell the tcp implementation to call WriteUntilBufferFull again
326 // if we blocked and new tx buffer space becomes available
327 localSocket->SetSendCallback (MakeCallback
329 this));
330 WriteUntilBufferFull (localSocket, localSocket->GetTxAvailable ());
331}
332
333void
335{
336 // Network topology
337 //
338 // 10Mb/s, 0.1ms 10Mb/s, 0.1ms
339 // n0-----------------n1-----------------n2
340
341 std::string tcpModel ("ns3::TcpNewReno");
342
343 Config::SetDefault ("ns3::TcpSocketBase::Sack", BooleanValue (false));
344 Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue (tcpModel));
345 Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000));
346 Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
347 Config::SetDefault ("ns3::DropTailQueue<Packet>::MaxSize", StringValue ("20p"));
348 Config::SetDefault ("ns3::TcpSocketBase::Timestamp", BooleanValue (false));
349
350 if (m_writeLogging)
351 {
353 LogComponentEnable ("ErrorModel", LOG_LEVEL_DEBUG);
354 LogComponentEnable ("Ns3TcpStateTest", LOG_LEVEL_DEBUG);
355 LogComponentEnable ("TcpCongestionOps", LOG_LEVEL_INFO);
356 LogComponentEnable ("TcpSocketBase", LOG_LEVEL_INFO);
357 }
358
360 // Topology construction
361 //
362
363 // Create three nodes
364 NodeContainer n0n1;
365 n0n1.Create (2);
366
368 n1n2.Add (n0n1.Get (1));
369 n1n2.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 (1000000)));
378 p2p.SetChannelAttribute ("Delay", TimeValue (Seconds (0.0001)));
379 NetDeviceContainer dev0 = p2p.Install (n0n1);
380 NetDeviceContainer dev1 = p2p.Install (n1n2);
381
382 // Use PfifoFast queue disc
384 tch.SetRootQueueDisc ("ns3::PfifoFastQueueDisc");
385 tch.Install (dev0);
386 tch.Install (dev1);
387
388 // Add IP addresses to each network interfaces
390 ipv4.SetBase ("10.1.3.0", "255.255.255.0");
391 ipv4.Assign (dev0);
392 ipv4.SetBase ("10.1.2.0", "255.255.255.0");
393 Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev1);
394
395 // Set up routes to all nodes
396 Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
397
399 // A flow from node n0 to node n2
400 //
401
402 // Create a packet sink to receive packets on node n2
403 uint16_t servPort = 50000; // Destination port number
404 PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), servPort));
405 ApplicationContainer sinkApps = sink.Install (n1n2.Get (1));
406 sinkApps.Start (Seconds (0.0));
407 sinkApps.Stop (Seconds (100.0));
408
409 // Create a data source to send packets on node n0
410 // Instead of full application, here use the socket directly by
411 // registering callbacks in function StarFlow().
412 Ptr<Socket> localSocket = Socket::CreateSocket (n0n1.Get (0),
413 TcpSocketFactory::GetTypeId ());
414 localSocket->Bind ();
415 Simulator::ScheduleNow (&Ns3TcpStateTestCase::StartFlow, this,
416 localSocket, ipInterfs.GetAddress (1), servPort);
417
418 Config::Connect ("/NodeList/0/$ns3::Ipv4L3Protocol/Tx",
420
421 Config::Connect ("/NodeList/0/$ns3::Ipv4L3Protocol/Rx",
423
425 // Set up different test cases: Lost model at node n1, different file size
426 //
427
428 std::list<uint32_t> dropListN0;
429 std::list<uint32_t> dropListN1;
430 std::string caseDescription;
431 switch (m_testCase)
432 {
433 case 0:
434 m_totalTxBytes = 1000;
435 caseDescription = "Verify connection establishment";
436 break;
437 case 1:
438 m_totalTxBytes = 100 * 1000;
439 caseDescription = "Verify a bigger (100 pkts) transfer: Sliding window operation, etc.";
440 break;
441 case 2:
442 m_totalTxBytes = 1000;
443 caseDescription = "Survive a SYN lost";
444 dropListN0.push_back (0);
445 break;
446 case 3:
447 m_totalTxBytes = 2000;
448 caseDescription = "Survive a SYN+ACK lost";
449 dropListN1.push_back (0);
450 break;
451 case 4:
452 m_totalTxBytes = 2000;
453 caseDescription = "Survive a ACK (last packet in 3-way handshake) lost";
454 dropListN0.push_back (1);
455 break;
456 case 5:
457 m_totalTxBytes = 0;
458 caseDescription = "Immediate FIN upon SYN_RCVD";
459 m_needToClose = false;
460 dropListN0.push_back (1); // Hide the ACK in 3WHS
461 Simulator::Schedule (Seconds (0.002), &Socket::Close, localSocket);
462 break;
463 case 6:
464 m_totalTxBytes = 5000;
465 caseDescription = "Simulated simultaneous close";
466 dropListN1.push_back (5); // Hide the ACK-to-FIN from n2
467 break;
468 case 7:
469 m_totalTxBytes = 5000;
470 caseDescription = "FIN check 1: Loss of initiator's FIN. Wait until app close";
471 m_needToClose = false;
472 dropListN0.push_back (7); // Hide the FIN from n0
473 Simulator::Schedule (Seconds (0.04), &Socket::Close, localSocket);
474 break;
475 case 8:
476 m_totalTxBytes = 5000;
477 caseDescription = "FIN check 2: Loss responder's FIN. FIN will be resent after last ack timeout";
478 dropListN1.push_back (6); // Hide the FIN from n2
479 break;
480 default:
481 NS_FATAL_ERROR ("Program fatal error: specified test case not supported: "
482 << m_testCase);
483 break;
484 }
485
486 Ptr<ReceiveListErrorModel> errN0 = CreateObject<ReceiveListErrorModel> ();
487 errN0->SetList (dropListN0);
488 dev0.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (errN0));
489
490 Ptr<ReceiveListErrorModel> errN1 = CreateObject<ReceiveListErrorModel> ();
491 errN1->SetList (dropListN1);
492 dev1.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (errN1));
493
494 std::ostringstream oss;
495 oss << "tcp-state" << m_testCase << "-test-case";
496 if (m_writeResults)
497 {
498 p2p.EnablePcapAll (oss.str ());
499 p2p.EnableAsciiAll (oss.str ());
500 }
501
502 if (m_writeLogging)
503 {
504 Ptr<OutputStreamWrapper> osw = Create<OutputStreamWrapper> (&std::clog);
505 *(osw->GetStream ()) << std::setprecision (9) << std::fixed;
506 p2p.EnableAsciiAll (osw);
507
508 std::clog << std::endl << "Running TCP test-case " << m_testCase << ": "
509 << caseDescription << std::endl;
510 }
511
512 // Finally, set up the simulator to run. The 1000 second hard limit is a
513 // failsafe in case some change above causes the simulation to never end
514 Simulator::Stop (Seconds (1000));
515 Simulator::Run ();
516 Simulator::Destroy ();
517}
518
525{
526public:
528};
529
531 : TestSuite ("ns3-tcp-state", SYSTEM)
532{
533 // We can't use NS_TEST_SOURCEDIR variable here because we use subdirectories
534 SetDataDir ("src/test/ns3tcp/response-vectors");
535 Packet::EnablePrinting (); // Enable packet metadata for all test cases
536
537 AddTestCase (new Ns3TcpStateTestCase (0), TestCase::QUICK);
538 AddTestCase (new Ns3TcpStateTestCase (1), TestCase::QUICK);
539 AddTestCase (new Ns3TcpStateTestCase (2), TestCase::QUICK);
540 AddTestCase (new Ns3TcpStateTestCase (3), TestCase::QUICK);
541 AddTestCase (new Ns3TcpStateTestCase (4), TestCase::QUICK);
542 AddTestCase (new Ns3TcpStateTestCase (5), TestCase::QUICK);
543 AddTestCase (new Ns3TcpStateTestCase (6), TestCase::QUICK);
544 AddTestCase (new Ns3TcpStateTestCase (7), TestCase::QUICK);
545 AddTestCase (new Ns3TcpStateTestCase (8), TestCase::QUICK);
546}
547
#define min(a, b)
Definition: 80211b.c:42
NodeContainer n1n2
Tests of TCP implementation state machine behavior.
bool m_writeVectors
True if response vectors have to be written (and not read).
void StartFlow(Ptr< Socket > localSocket, Ipv4Address servAddress, uint16_t servPort)
Start transmitting a TCP flow.
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.
uint32_t m_totalTxBytes
Total number of bytes to send.
uint32_t m_currentTxBytes
Current number of bytes sent.
std::string m_pcapFilename
The PCAP filename.
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool m_writeLogging
True if write logging.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
void Ipv4L3Rx(std::string context, Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
Check that the received packets are consitent with the trace.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
void WriteUntilBufferFull(Ptr< Socket > localSocket, uint32_t txSpace)
Write to the socket until the buffer is full.
PcapFile m_pcapFile
The PCAP ffile.
bool m_needToClose
Check if the sending socket need to be closed.
bool m_writeResults
True if write PCAP files.
uint32_t m_testCase
Testcase number.
TCP implementation state machine 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...
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Class for representing data rates.
Definition: data-rate.h:89
AttributeValue implementation for DataRate.
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
void InstallAll(void) 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:41
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(NodeContainer other)
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.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
std::ostream * GetStream(void)
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:280
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Definition: packet.cc:378
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
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 Open(std::string const &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap file.
Definition: pcap-file.cc:325
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:469
void Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const *const data, uint32_t totalLen)
Write next packet to file.
Definition: pcap-file.cc:434
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:345
uint32_t GetDataLinkType(void)
Returns the data link type field of the pcap file as defined by the network field in the pcap global ...
Definition: pcap-file.cc:137
void Close(void)
Close the underlying file.
Definition: pcap-file.cc:88
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:121
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual int Close(void)=0
Close a socket.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
virtual uint32_t GetTxAvailable(void) 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:41
Header for the Transmission Control Protocol.
Definition: tcp-header.h:45
encapsulates test code
Definition: test.h:994
bool IsStatusSuccess(void) const
Check if all tests passed.
Definition: test.cc:458
std::string CreateDataDirFilename(std::string filename)
Construct the full path to a file in the data directory.
Definition: test.cc:412
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
Definition: test.cc:465
A suite of tests to run.
Definition: test.h:1188
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:387
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
AttributeValue implementation for Time.
Definition: nstime.h:1308
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.
Hold an unsigned integer type.
Definition: uinteger.h:44
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
#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:165
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
#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:240
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ 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(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:385
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:1648
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.
static Ns3TcpStateTestSuite g_ns3TcpLossTestSuite
Do not forget to allocate an instance of this TestSuite.
const bool WRITE_PCAP
Set to true to write out pcap.
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
Definition: wifi-tcp.cc:56