A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
icmp-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Ritsumeikan University, Shiga, Japan.
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Alberto Gallegos Ramonet <ramonet@fc.ritsumei.ac.jp>
7 */
8
9// Test program for the Internet Control Message Protocol (ICMP) responses.
10//
11// IcmpEchoReplyTestCase scenario:
12//
13// n0 <------------------> n1
14// i(0,0) i(1,0)
15//
16// Test that sends a single ICMP echo packet with TTL = 1 from n0 to n1,
17// n1 receives the packet and send an ICMP echo reply.
18//
19//
20// IcmpTimeExceedTestCase scenario:
21//
22// channel1 channel2
23// n0 <------------------> n1 <---------------------> n2
24// i(0,0) i(1,0) i2(1,0)
25// i2(0,0)
26//
27// Test that sends a single ICMP echo packet with TTL = 1 from n0 to n4,
28// however, the TTL is not enough and n1 reply to n0 with an ICMP time exceed.
29//
30//
31// IcmpV6EchoReplyTestCase scenario:
32//
33// n0 <-------------------> n1
34// i(0,1) i(1,1)
35//
36// Test that sends a single ICMPV6 ECHO request with hopLimit = 1 from n0 to n1,
37// n1 receives the packet and send an ICMPV6 echo reply.
38//
39// IcmpV6TimeExceedTestCase scenario:
40//
41// channel1 channel2
42// n0 <------------------> n1 <---------------------> n2
43// i(0,0) i(1,0) i2(1,0)
44// i2(0,0)
45//
46// Test that sends a single ICMPV6 echo packet with hopLimit = 1 from n0 to n4,
47// however, the hopLimit is not enough and n1 reply to n0 with an ICMPV6 time exceed error.
48
49#include "ns3/assert.h"
50#include "ns3/icmpv4.h"
51#include "ns3/icmpv6-header.h"
52#include "ns3/internet-stack-helper.h"
53#include "ns3/ipv4-address-helper.h"
54#include "ns3/ipv4-global-routing-helper.h"
55#include "ns3/ipv6-address-helper.h"
56#include "ns3/ipv6-routing-helper.h"
57#include "ns3/ipv6-static-routing-helper.h"
58#include "ns3/log.h"
59#include "ns3/node.h"
60#include "ns3/simple-net-device-helper.h"
61#include "ns3/simple-net-device.h"
62#include "ns3/simulator.h"
63#include "ns3/socket-factory.h"
64#include "ns3/socket.h"
65#include "ns3/test.h"
66#include "ns3/uinteger.h"
67
68using namespace ns3;
69
70/**
71 * \ingroup internet-apps
72 * \defgroup icmp-test ICMP protocol tests
73 */
74
75/**
76 * \ingroup icmp-test
77 * \ingroup tests
78 *
79 * \brief ICMP Echo Reply Test
80 */
82{
83 public:
85 ~IcmpEchoReplyTestCase() override;
86
87 /**
88 * Send data
89 * \param socket output socket
90 * \param dst destination address
91 */
92 void SendData(Ptr<Socket> socket, Ipv4Address dst);
93 /**
94 * Receive data
95 * \param socket input socket
96 */
97 void ReceivePkt(Ptr<Socket> socket);
98
99 private:
100 void DoRun() override;
101 Ptr<Packet> m_receivedPacket; //!< received packet
102};
103
105 : TestCase("ICMP:EchoReply test case")
106{
107}
108
112
113void
115{
117 Icmpv4Echo echo;
118 echo.SetSequenceNumber(1);
119 echo.SetIdentifier(0);
120 p->AddHeader(echo);
121
122 Icmpv4Header header;
124 header.SetCode(0);
125 p->AddHeader(header);
126
127 Address realTo = InetSocketAddress(dst, 1234);
128
129 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(p, 0, realTo),
130 (int)p->GetSize(),
131 " Unable to send ICMP Echo Packet");
132}
133
134void
136{
137 Address from;
138 Ptr<Packet> p = socket->RecvFrom(0xffffffff, 0, from);
139 m_receivedPacket = p->Copy();
140
141 Ipv4Header ipv4;
142 p->RemoveHeader(ipv4);
143 NS_TEST_EXPECT_MSG_EQ(ipv4.GetProtocol(), 1, " The received Packet is not an ICMP packet");
144
145 Icmpv4Header icmp;
146 p->RemoveHeader(icmp);
147
150 " The received Packet is not a ICMPV4_ECHO_REPLY");
151}
152
153void
155{
157 n.Create(2);
158
159 InternetStackHelper internet;
160 internet.Install(n);
161
162 // link the two nodes
165 n.Get(0)->AddDevice(txDev);
166 n.Get(1)->AddDevice(rxDev);
168 rxDev->SetChannel(channel1);
169 txDev->SetChannel(channel1);
171 d.Add(txDev);
172 d.Add(rxDev);
173
175
176 ipv4.SetBase("10.0.0.0", "255.255.255.252");
177 Ipv4InterfaceContainer i = ipv4.Assign(d);
178
179 Ptr<Socket> socket;
180 socket = Socket::CreateSocket(n.Get(0), TypeId::LookupByName("ns3::Ipv4RawSocketFactory"));
181 socket->SetAttribute("Protocol", UintegerValue(1)); // ICMP protocol
182 socket->SetRecvCallback(MakeCallback(&IcmpEchoReplyTestCase::ReceivePkt, this));
183
185 NS_TEST_EXPECT_MSG_EQ(socket->Bind(src), 0, " Socket Binding failed");
186
187 // Set a TTL big enough
188 socket->SetIpTtl(1);
189 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
190 Seconds(0),
192 this,
193 socket,
194 i.GetAddress(1, 0));
196
198 28,
199 " Unexpected ICMPV4_ECHO_REPLY packet size");
200
202}
203
204/**
205 * \ingroup icmp-test
206 * \ingroup tests
207 *
208 * \brief ICMP Time Exceed Reply Test
209 */
211{
212 public:
214 ~IcmpTimeExceedTestCase() override;
215
216 /**
217 * Send data
218 * \param socket output socket
219 * \param dst destination address
220 */
221 void SendData(Ptr<Socket> socket, Ipv4Address dst);
222 /**
223 * Receive data
224 * \param socket input socket
225 */
226 void ReceivePkt(Ptr<Socket> socket);
227
228 private:
229 void DoRun() override;
230 Ptr<Packet> m_receivedPacket; //!< received packet
231};
232
234 : TestCase("ICMP:TimeExceedReply test case")
235{
236}
237
241
242void
244{
246 Icmpv4Echo echo;
247 echo.SetSequenceNumber(1);
248 echo.SetIdentifier(0);
249 p->AddHeader(echo);
250
251 Icmpv4Header header;
253 header.SetCode(0);
254 p->AddHeader(header);
255
256 Address realTo = InetSocketAddress(dst, 1234);
257
258 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(p, 0, realTo),
259 (int)p->GetSize(),
260 " Unable to send ICMP Echo Packet");
261}
262
263void
265{
266 Address from;
267 Ptr<Packet> p = socket->RecvFrom(0xffffffff, 0, from);
268 m_receivedPacket = p->Copy();
269
270 Ipv4Header ipv4;
271 p->RemoveHeader(ipv4);
272 NS_TEST_EXPECT_MSG_EQ(ipv4.GetProtocol(), 1, "The received packet is not an ICMP packet");
273
274 NS_TEST_EXPECT_MSG_EQ(ipv4.GetSource(),
275 Ipv4Address("10.0.0.2"),
276 "ICMP Time Exceed Response should come from 10.0.0.2");
277
278 Icmpv4Header icmp;
279 p->RemoveHeader(icmp);
280
283 "The received packet is not a ICMPV4_TIME_EXCEEDED packet ");
284}
285
286void
288{
290 NodeContainer n0n1;
292 n.Create(3);
293 n0n1.Add(n.Get(0));
294 n0n1.Add(n.Get(1));
295 n1n2.Add(n.Get(1));
296 n1n2.Add(n.Get(2));
297
300
301 SimpleNetDeviceHelper simpleHelper;
302 simpleHelper.SetNetDevicePointToPointMode(true);
303
304 SimpleNetDeviceHelper simpleHelper2;
305 simpleHelper2.SetNetDevicePointToPointMode(true);
306
307 NetDeviceContainer devices;
308 devices = simpleHelper.Install(n0n1, channel);
309 NetDeviceContainer devices2;
310 devices2 = simpleHelper2.Install(n1n2, channel2);
311
312 InternetStackHelper internet;
313 internet.Install(n);
314
315 Ipv4AddressHelper address;
316 address.SetBase("10.0.0.0", "255.255.255.255");
317 Ipv4InterfaceContainer i = address.Assign(devices);
318
319 address.SetBase("10.0.1.0", "255.255.255.255");
320 Ipv4InterfaceContainer i2 = address.Assign(devices2);
321
323
324 Ptr<Socket> socket;
325 socket = Socket::CreateSocket(n.Get(0), TypeId::LookupByName("ns3::Ipv4RawSocketFactory"));
326 socket->SetAttribute("Protocol", UintegerValue(1)); // ICMP protocol
327 socket->SetRecvCallback(MakeCallback(&IcmpTimeExceedTestCase::ReceivePkt, this));
328
330 NS_TEST_EXPECT_MSG_EQ(socket->Bind(src), 0, " Socket Binding failed");
331
332 // The ttl is not big enough , causing an ICMP Time Exceeded response
333 socket->SetIpTtl(1);
334 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
335 Seconds(0),
337 this,
338 socket,
339 i2.GetAddress(1, 0));
341
343 56,
344 " Unexpected ICMP Time Exceed Response packet size");
345
347}
348
349/**
350 * \ingroup icmp-test
351 * \ingroup tests
352 *
353 * \brief ICMPV6 Echo Reply Test
354 */
356{
357 public:
359 ~IcmpV6EchoReplyTestCase() override;
360
361 /**
362 * Send data
363 * \param socket output socket
364 * \param dst destination address
365 */
366 void SendData(Ptr<Socket> socket, Ipv6Address dst);
367 /**
368 * Receive data
369 * \param socket input socket
370 */
371 void ReceivePkt(Ptr<Socket> socket);
372
373 private:
374 void DoRun() override;
375 Ptr<Packet> m_receivedPacket; //!< received packet
376};
377
379 : TestCase("ICMPV6:EchoReply test case")
380{
381}
382
386
387void
389{
391 Icmpv6Echo echo(true);
392 echo.SetSeq(1);
393 echo.SetId(0XB1ED);
394 p->AddHeader(echo);
395
396 Icmpv6Header header;
398 header.SetCode(0);
399 p->AddHeader(header);
400
401 Address realTo = Inet6SocketAddress(dst, 1234);
402
403 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(p, 0, realTo),
404 (int)p->GetSize(),
405 " Unable to send ICMP Echo Packet");
406}
407
408void
410{
411 Address from;
412 Ptr<Packet> p = socket->RecvFrom(from);
413 Ptr<Packet> pkt = p->Copy();
414
416 {
417 Ipv6Header ipv6;
418 p->RemoveHeader(ipv6);
419
422 "The received Packet is not an ICMPV6 packet");
423 Icmpv6Header icmpv6;
424 p->RemoveHeader(icmpv6);
425
427 {
428 m_receivedPacket = pkt->Copy();
429 }
430 }
431}
432
433void
435{
437 n.Create(2);
438
439 InternetStackHelper internet;
440 internet.Install(n);
441
442 // link the two nodes
445 txDev->SetAddress(Mac48Address("00:00:00:00:00:01"));
446 rxDev->SetAddress(Mac48Address("00:00:00:00:00:02"));
447 n.Get(0)->AddDevice(txDev);
448 n.Get(1)->AddDevice(rxDev);
450 rxDev->SetChannel(channel1);
451 txDev->SetChannel(channel1);
453 d.Add(txDev);
454 d.Add(rxDev);
455
457
458 ipv6.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
459 Ipv6InterfaceContainer i = ipv6.Assign(d);
460
461 Ptr<Socket> socket;
462 socket = Socket::CreateSocket(n.Get(0), TypeId::LookupByName("ns3::Ipv6RawSocketFactory"));
463 socket->SetAttribute("Protocol", UintegerValue(Ipv6Header::IPV6_ICMPV6));
464 socket->SetRecvCallback(MakeCallback(&IcmpV6EchoReplyTestCase::ReceivePkt, this));
465
467 NS_TEST_EXPECT_MSG_EQ(socket->Bind(src), 0, " SocketV6 Binding failed");
468
469 // Set a TTL big enough
470 socket->SetIpTtl(1);
471
472 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
473 Seconds(0),
475 this,
476 socket,
477 i.GetAddress(1, 1));
479
481 52,
482 " Unexpected ICMPV6_ECHO_REPLY packet size");
483
485}
486
487/**
488 * \ingroup icmp-test
489 * \ingroup tests
490 *
491 * \brief ICMPV6 Time Exceed response test
492 */
494{
495 public:
497 ~IcmpV6TimeExceedTestCase() override;
498
499 /**
500 * Send data
501 * \param socket output socket
502 * \param dst destination address
503 */
504 void SendData(Ptr<Socket> socket, Ipv6Address dst);
505 /**
506 * Receive data
507 * \param socket input socket
508 */
509 void ReceivePkt(Ptr<Socket> socket);
510
511 private:
512 void DoRun() override;
513 Ptr<Packet> m_receivedPacket; //!< received packet
514};
515
517 : TestCase("ICMPV6:TimeExceed test case")
518{
519}
520
524
525void
527{
529 Icmpv6Echo echo(true);
530 echo.SetSeq(1);
531 echo.SetId(0XB1ED);
532 p->AddHeader(echo);
533
534 Icmpv6Header header;
536 header.SetCode(0);
537 p->AddHeader(header);
538
539 Address realTo = Inet6SocketAddress(dst, 1234);
540
541 socket->SendTo(p, 0, realTo);
542}
543
544void
546{
547 Address from;
548 Ptr<Packet> p = socket->RecvFrom(from);
549 Ptr<Packet> pkt = p->Copy();
550
552 {
553 Ipv6Header ipv6;
554 p->RemoveHeader(ipv6);
555
558 "The received Packet is not an ICMPV6 packet");
559
560 Icmpv6Header icmpv6;
561 p->RemoveHeader(icmpv6);
562
563 // Ignore any packet except ICMPV6_ERROR_TIME_EXCEEDED
565 {
566 m_receivedPacket = pkt->Copy();
567 }
568 }
569}
570
571void
573{
575 NodeContainer n0n1;
577 n.Create(3);
578 n0n1.Add(n.Get(0));
579 n0n1.Add(n.Get(1));
580 n1n2.Add(n.Get(1));
581 n1n2.Add(n.Get(2));
582
585
586 SimpleNetDeviceHelper simpleHelper;
587 simpleHelper.SetNetDevicePointToPointMode(true);
588
589 SimpleNetDeviceHelper simpleHelper2;
590 simpleHelper2.SetNetDevicePointToPointMode(true);
591
592 NetDeviceContainer devices;
593 devices = simpleHelper.Install(n0n1, channel);
594
595 NetDeviceContainer devices2;
596 devices2 = simpleHelper2.Install(n1n2, channel2);
597
598 InternetStackHelper internet;
599 internet.Install(n);
600
601 Ipv6AddressHelper address;
602
603 address.NewNetwork();
604 address.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
605
606 Ipv6InterfaceContainer interfaces = address.Assign(devices);
607 interfaces.SetForwarding(1, true);
608 interfaces.SetDefaultRouteInAllNodes(1);
609 address.SetBase(Ipv6Address("2001:2::"), Ipv6Prefix(64));
610 Ipv6InterfaceContainer interfaces2 = address.Assign(devices2);
611
612 interfaces2.SetForwarding(0, true);
613 interfaces2.SetDefaultRouteInAllNodes(0);
614
615 Ptr<Socket> socket;
616 socket = Socket::CreateSocket(n.Get(0), TypeId::LookupByName("ns3::Ipv6RawSocketFactory"));
617 socket->SetAttribute("Protocol", UintegerValue(Ipv6Header::IPV6_ICMPV6));
618 socket->SetRecvCallback(MakeCallback(&IcmpV6TimeExceedTestCase::ReceivePkt, this));
619
621 NS_TEST_EXPECT_MSG_EQ(socket->Bind(src), 0, " SocketV6 Binding failed");
622
623 // In Ipv6 TTL is renamed hop limit in IPV6.
624 // The hop limit is not big enough , causing an ICMPV6 Time Exceeded error
625 socket->SetIpv6HopLimit(1);
626
627 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
628 Seconds(0),
630 this,
631 socket,
632 interfaces2.GetAddress(1, 1));
634
636 100,
637 " Unexpected ICMPV6_ECHO_REPLY packet size");
638
640}
641
642/**
643 * \ingroup icmp-test
644 * \ingroup tests
645 *
646 * \brief ICMP TestSuite
647 */
648
650{
651 public:
653};
654
656 : TestSuite("icmp", Type::UNIT)
657{
658 AddTestCase(new IcmpEchoReplyTestCase, TestCase::Duration::QUICK);
659 AddTestCase(new IcmpTimeExceedTestCase, TestCase::Duration::QUICK);
660 AddTestCase(new IcmpV6EchoReplyTestCase, TestCase::Duration::QUICK);
661 AddTestCase(new IcmpV6TimeExceedTestCase, TestCase::Duration::QUICK);
662}
663
664static IcmpTestSuite icmpTestSuite; //!< Static variable for test initialization
NodeContainer n1n2
Nodecontainer n1 + n2.
ICMP Echo Reply Test.
Definition icmp-test.cc:82
void DoRun() override
Implementation to actually run this TestCase.
Definition icmp-test.cc:154
void ReceivePkt(Ptr< Socket > socket)
Receive data.
Definition icmp-test.cc:135
void SendData(Ptr< Socket > socket, Ipv4Address dst)
Send data.
Definition icmp-test.cc:114
Ptr< Packet > m_receivedPacket
received packet
Definition icmp-test.cc:101
~IcmpEchoReplyTestCase() override
Definition icmp-test.cc:109
ICMP TestSuite.
Definition icmp-test.cc:650
ICMP Time Exceed Reply Test.
Definition icmp-test.cc:211
~IcmpTimeExceedTestCase() override
Definition icmp-test.cc:238
void DoRun() override
Implementation to actually run this TestCase.
Definition icmp-test.cc:287
void ReceivePkt(Ptr< Socket > socket)
Receive data.
Definition icmp-test.cc:264
Ptr< Packet > m_receivedPacket
received packet
Definition icmp-test.cc:230
void SendData(Ptr< Socket > socket, Ipv4Address dst)
Send data.
Definition icmp-test.cc:243
ICMPV6 Echo Reply Test.
Definition icmp-test.cc:356
~IcmpV6EchoReplyTestCase() override
Definition icmp-test.cc:383
void DoRun() override
Implementation to actually run this TestCase.
Definition icmp-test.cc:434
Ptr< Packet > m_receivedPacket
received packet
Definition icmp-test.cc:375
void SendData(Ptr< Socket > socket, Ipv6Address dst)
Send data.
Definition icmp-test.cc:388
void ReceivePkt(Ptr< Socket > socket)
Receive data.
Definition icmp-test.cc:409
ICMPV6 Time Exceed response test.
Definition icmp-test.cc:494
void DoRun() override
Implementation to actually run this TestCase.
Definition icmp-test.cc:572
~IcmpV6TimeExceedTestCase() override
Definition icmp-test.cc:521
void ReceivePkt(Ptr< Socket > socket)
Receive data.
Definition icmp-test.cc:545
Ptr< Packet > m_receivedPacket
received packet
Definition icmp-test.cc:513
void SendData(Ptr< Socket > socket, Ipv6Address dst)
Send data.
Definition icmp-test.cc:526
a polymophic address class
Definition address.h:90
ICMP Echo header.
Definition icmpv4.h:99
void SetIdentifier(uint16_t id)
Set the Echo identifier.
Definition icmpv4.cc:139
void SetSequenceNumber(uint16_t seq)
Set the Echo sequence number.
Definition icmpv4.cc:146
Base class for all the ICMP packet headers.
Definition icmpv4.h:32
void SetCode(uint8_t code)
Set ICMP code.
Definition icmpv4.cc:112
void SetType(uint8_t type)
Set ICMP type.
Definition icmpv4.cc:105
uint8_t GetType() const
Get ICMP type.
Definition icmpv4.cc:119
ICMPv6 Echo message.
void SetId(uint16_t id)
Set the ID of the packet.
void SetSeq(uint16_t seq)
Set the sequence number.
ICMPv6 header.
uint8_t GetType() const
Get the type field.
void SetCode(uint8_t code)
Set the code field.
void SetType(uint8_t type)
Set the type.
An Inet6 address class.
static bool IsMatchingType(const Address &addr)
If the address match.
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
Helper class to auto-assign global IPv6 unicast addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Describes an IPv6 address.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
Packet header for IPv6.
Definition ipv6-header.h:24
uint8_t GetNextHeader() const
Get the next header.
Keep track of a set of IPv6 interfaces.
void SetForwarding(uint32_t i, bool state)
Set the state of the stack (act as a router or as an host) for the specified index.
void SetDefaultRouteInAllNodes(uint32_t router)
Set the default route for all the devices (except the router itself).
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
Describes an IPv6 prefix.
an EUI-48 address
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
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.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition node.cc:124
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition packet.h:850
Smart pointer class similar to boost::intrusive_ptr.
build a set of SimpleNetDevice objects
void SetNetDevicePointToPointMode(bool pointToPointMode)
SimpleNetDevice is Broadcast capable and ARP needing.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition simulator.h:577
static void Run()
Run the simulation.
Definition simulator.cc:167
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
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:872
Hold an unsigned integer type.
Definition uinteger.h:34
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
static IcmpTestSuite icmpTestSuite
Static variable for test initialization.
Definition icmp-test.cc:664
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