A Discrete-Event Network Simulator
API
ipv4-deduplication-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Universita' di Firenze
3 * Copyright (c) 2019 Caliola Engineering, LLC : RFC 6621 multicast packet de-duplication
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 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19 * Modified (2019): Jared Dulmage <jared.dulmage@caliola.com>
20 * Tests dissemination of multicast packets across a mesh
21 * network to all nodes over multiple hops. Tests check
22 * the number of received packets and dropped packets
23 * with RFC 6621 de-duplication enabled or disabled.
24 */
25
26#include "ns3/boolean.h"
27#include "ns3/config.h"
28#include "ns3/double.h"
29#include "ns3/inet-socket-address.h"
30#include "ns3/internet-stack-helper.h"
31#include "ns3/ipv4-address-helper.h"
32#include "ns3/ipv4-l3-protocol.h"
33#include "ns3/ipv4-list-routing-helper.h"
34#include "ns3/ipv4-static-routing-helper.h"
35#include "ns3/ipv4-static-routing.h"
36#include "ns3/log.h"
37#include "ns3/names.h"
38#include "ns3/node.h"
39#include "ns3/random-variable-stream.h"
40#include "ns3/simple-channel.h"
41#include "ns3/simple-net-device-helper.h"
42#include "ns3/simple-net-device.h"
43#include "ns3/simulator.h"
44#include "ns3/socket.h"
45#include "ns3/string.h"
46#include "ns3/test.h"
47#include "ns3/traffic-control-layer.h"
48#include "ns3/udp-socket-factory.h"
49#include "ns3/udp-socket.h"
50#include "ns3/uinteger.h"
51
52#include <functional>
53#include <limits>
54#include <string>
55
56using namespace ns3;
57
84{
90 void DoSendData(Ptr<Socket> socket, std::string to);
97 void DoSendPacket(Ptr<Socket> socket, Ptr<Packet> packet, std::string to);
103 void SendData(Ptr<Socket> socket, std::string to);
104
111 void SendPacket(Ptr<Socket> socket, Ptr<Packet> packet, std::string to);
112
117 void CheckPackets(const std::string& name);
118
123 void CheckDrops(const std::string& name);
124
125 static const Time DELAY;
126
133 static std::string MakeName(bool enable, Time expire);
134
138 enum MODE
139 {
143 }; // enabled, but expiration time too low
144
147 std::map<std::string, uint32_t>
149 std::map<std::string, uint32_t>
151
152 public:
153 void DoRun() override;
154
160 Ipv4DeduplicationTest(bool enable, Time expire = Seconds(1));
161
166 void ReceivePkt(Ptr<Socket> socket);
167
176 void DropPkt(const Ipv4Header& ipHeader,
177 Ptr<const Packet> packet,
179 Ptr<Ipv4> ipv4,
180 uint32_t interface);
181};
182
184
186 : TestCase(MakeName(enable, expire)),
187 m_mode(ENABLED),
188 m_expire(expire)
189{
190 if (!enable)
191 {
193 }
194 else if (m_expire < DELAY)
195 {
197 }
198}
199
200void
202{
203 uint32_t availableData;
204 availableData = socket->GetRxAvailable();
206 NS_TEST_ASSERT_MSG_EQ(availableData,
207 packet->GetSize(),
208 "Received packet size is not equal to the Rx buffer size");
209
210 auto node = socket->GetNode();
211 std::string name = Names::FindName(node);
212 m_packetCountMap.insert({name, 0}); // only inserts when not there
213 ++m_packetCountMap[name];
214}
215
216void
218 Ptr<const Packet> packet,
220 Ptr<Ipv4> ipv4,
221 uint32_t interface)
222{
223 switch (m_mode)
224 {
225 case ENABLED:
226 NS_TEST_EXPECT_MSG_EQ(reason, Ipv4L3Protocol::DROP_DUPLICATE, "Wrong reason for drop");
227 break;
228 case DISABLED:
229 NS_TEST_EXPECT_MSG_EQ(reason, Ipv4L3Protocol::DROP_TTL_EXPIRED, "Wrong reason for drop");
230 break;
231 case DEGENERATE:
232 // reason can be either
233 break;
234 };
235 auto node = ipv4->GetNetDevice(interface)->GetNode();
236 std::string name = Names::FindName(node);
237 m_dropCountMap.insert({name, 0});
238 ++m_dropCountMap[name];
239}
240
241void
243{
244 SendPacket(socket, Create<Packet>(123), to);
245}
246
247void
249{
250 Address realTo = InetSocketAddress(Ipv4Address(to.c_str()), 1234);
251 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(packet, 0, realTo), 123, "100");
252}
253
254void
256{
257 DoSendData(socket, to);
258}
259
260void
262{
263 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
264 MilliSeconds(50),
266 this,
267 socket,
268 packet,
269 to);
270}
271
272std::string
274{
275 std::ostringstream oss;
276 oss << "IP v4 RFC 6621 De-duplication: ";
277 if (!enabled)
278 {
279 oss << "disabled";
280 }
281 else if (expire > DELAY)
282 {
283 oss << "enabled";
284 }
285 else
286 {
287 oss << "degenerate";
288 }
289 oss << ", expire = " << expire.ToDouble(Time::MS) << "ms";
290
291 return oss.str();
292}
293
294void
296{
297 // multicast target
298 const std::string targetAddr = "239.192.100.1";
299 Config::SetDefault("ns3::Ipv4L3Protocol::EnableDuplicatePacketDetection",
301 Config::SetDefault("ns3::Ipv4L3Protocol::DuplicateExpire", TimeValue(m_expire));
302
303 // Create topology
304
305 // Create nodes
306 auto nodes = NodeContainer();
307 nodes.Create(5);
308
309 // Name nodes
310 Names::Add("A", nodes.Get(0));
311 Names::Add("B", nodes.Get(1));
312 Names::Add("C", nodes.Get(2));
313 Names::Add("D", nodes.Get(3));
314 Names::Add("E", nodes.Get(4));
315
316 SimpleNetDeviceHelper simplenet;
317 auto devices = simplenet.Install(nodes);
318 // name devices
319 Names::Add("A/dev", devices.Get(0));
320 Names::Add("B/dev", devices.Get(1));
321 Names::Add("C/dev", devices.Get(2));
322 Names::Add("D/dev", devices.Get(3));
323 Names::Add("E/dev", devices.Get(4));
324
325 Ipv4ListRoutingHelper listRouting;
326 Ipv4StaticRoutingHelper staticRouting;
327 listRouting.Add(staticRouting, 0);
328
329 InternetStackHelper internet;
330 internet.SetIpv6StackInstall(false);
331 internet.SetIpv4ArpJitter(true);
332 internet.SetRoutingHelper(listRouting);
333 internet.Install(nodes);
334
335 Ipv4AddressHelper ipv4address;
336 ipv4address.SetBase("10.0.0.0", "255.255.255.0");
337 ipv4address.Assign(devices);
338
339 // add static routes for each node / device
340 auto diter = devices.Begin();
341 for (auto end = nodes.End(), iter = nodes.Begin(); iter != end; ++iter)
342 {
343 // route for forwarding
344 staticRouting.AddMulticastRoute(*iter,
345 Ipv4Address::GetAny(),
346 targetAddr.c_str(),
347 *diter,
348 NetDeviceContainer(*diter));
349
350 // route for host
351 // Use host routing entry according to note in Ipv4StaticRouting::RouteOutput:
358 auto ipv4 = (*iter)->GetObject<Ipv4>();
359 NS_TEST_ASSERT_MSG_EQ((bool)ipv4,
360 true,
361 "Node " << Names::FindName(*iter) << " does not have Ipv4 aggregate");
362 auto routing = staticRouting.GetStaticRouting(ipv4);
363 routing->AddHostRouteTo(targetAddr.c_str(), ipv4->GetInterfaceForDevice(*diter), 0);
364
365 ++diter;
366 }
367
368 // set the topology, by default fully-connected
369 auto channel = devices.Get(0)->GetChannel();
370 auto simplechannel = channel->GetObject<SimpleChannel>();
371 // ensure some time progress between re-transmissions
372 simplechannel->SetAttribute("Delay", TimeValue(DELAY));
373 simplechannel->BlackList(Names::Find<SimpleNetDevice>("A/dev"),
374 Names::Find<SimpleNetDevice>("D/dev"));
375 simplechannel->BlackList(Names::Find<SimpleNetDevice>("D/dev"),
376 Names::Find<SimpleNetDevice>("A/dev"));
377
378 simplechannel->BlackList(Names::Find<SimpleNetDevice>("A/dev"),
379 Names::Find<SimpleNetDevice>("E/dev"));
380 simplechannel->BlackList(Names::Find<SimpleNetDevice>("E/dev"),
381 Names::Find<SimpleNetDevice>("A/dev"));
382
383 simplechannel->BlackList(Names::Find<SimpleNetDevice>("B/dev"),
384 Names::Find<SimpleNetDevice>("E/dev"));
385 simplechannel->BlackList(Names::Find<SimpleNetDevice>("E/dev"),
386 Names::Find<SimpleNetDevice>("B/dev"));
387
388 simplechannel->BlackList(Names::Find<SimpleNetDevice>("C/dev"),
389 Names::Find<SimpleNetDevice>("E/dev"));
390 simplechannel->BlackList(Names::Find<SimpleNetDevice>("E/dev"),
391 Names::Find<SimpleNetDevice>("C/dev"));
392
393 // Create the UDP sockets
394 std::list<Ptr<Socket>> sockets;
395 for (auto end = nodes.End(), iter = nodes.Begin(); iter != end; ++iter)
396 {
397 auto SocketFactory = (*iter)->GetObject<UdpSocketFactory>();
398 auto socket = SocketFactory->CreateSocket();
399 socket->SetAllowBroadcast(true);
400 NS_TEST_EXPECT_MSG_EQ(socket->Bind(InetSocketAddress(Ipv4Address::GetAny(), 1234)),
401 0,
402 "Could not bind socket for node " << Names::FindName(*iter));
403
404 auto udpSocket = socket->GetObject<UdpSocket>();
405 udpSocket->MulticastJoinGroup(0, Ipv4Address(targetAddr.c_str())); // future proof?
406 udpSocket->SetAttribute("IpMulticastTtl", StringValue("4"));
407
408 socket->SetRecvCallback(MakeCallback(&Ipv4DeduplicationTest::ReceivePkt, this));
409 sockets.push_back(socket);
410 }
411
412 // connect up drop traces
413 Config::ConnectWithoutContext("/NodeList/*/$ns3::Ipv4L3Protocol/Drop",
415
416 // start TX from A
417 auto txSocket = sockets.front();
418
419 // ------ Now the tests ------------
420
421 // Broadcast 1 packet
422 SendData(txSocket, targetAddr);
423 Simulator::Run();
424 Simulator::Destroy();
425
426 for (auto end = nodes.End(), iter = nodes.Begin(); iter != end; ++iter)
427 {
428 std::string name = Names::FindName(*iter);
429 CheckPackets(name);
430 CheckDrops(name);
431 }
432
433 m_packetCountMap.clear();
434 sockets.clear();
435 Names::Clear();
436}
437
438// NOTE:
439// The de-duplicate disabled received packets and drops can be
440// computed by forming the connectivity matrix C with 1's in
441// coordinates (row, column) where row and column nodes are connected.
442// Reception of packets with TTL n are v_(n-1) = v_n * C where
443// v_TTL = [1 0 0 0 0] (corresponding to nodes [A B C D E]).
444// The number of drops for each node is v_0 and the number of received
445// packets at each node is sum (v_TTL-1, ..., v_0).
446void
448{
449 // a priori determined packet receptions based on initial TTL of 4, disabled de-dup
450 std::map<std::string, uint32_t> packets = {{"A", 14},
451 {"B", 16},
452 {"C", 16},
453 {"D", 16},
454 {"E", 4}};
455
456 // a priori determined packet receptions based on
457 std::map<std::string, uint32_t> packetsDuped = {{"A", 0},
458 {"B", 1},
459 {"C", 1},
460 {"D", 1},
461 {"E", 1}};
462 // a priori determined packet receptions based on initial TTL of 4, degenerate de-dup
463 // There are TTL (4) rounds of packets. Each round a node will register a
464 // received packet if another connected node transmits. A misses the 1st round
465 // since it is the only one transmitting. D is not connected to A in 1st round
466 // either. E only hears a packet in the 3rd and 4th rounds.
467 std::map<std::string, uint32_t> degenerates = {{"A", 3},
468 {"B", 4},
469 {"C", 4},
470 {"D", 3},
471 {"E", 2}};
472
473 switch (m_mode)
474 {
475 case ENABLED:
477 packetsDuped[name],
478 "Wrong number of packets received for node " << name);
479 break;
480 case DISABLED:
482 packets[name],
483 "Wrong number of packets received for node " << name);
484 break;
485 case DEGENERATE:
487 degenerates[name],
488 "Wrong number of packets received for node " << name);
489 break;
490 };
491}
492
493void
494Ipv4DeduplicationTest::CheckDrops(const std::string& name)
495{
496 std::map<std::string, uint32_t> drops;
497 switch (m_mode)
498 {
499 case ENABLED:
500 // a priori determined packet drops based on initial TTL of 4, enabled de-dup;
501 // A hears from B & C -- > 2 drops
502 // D hears from B, C, AND E
503 // B (C) hears from A, C (B), D,
504 drops = {{"A", 2}, {"B", 2}, {"C", 2}, {"D", 2}, {"E", 0}};
505 break;
506 case DISABLED:
507 // a priori determined packet drops based on initial TTL of 4, disabled de-dup
508 drops = {{"A", 10}, {"B", 9}, {"C", 9}, {"D", 12}, {"E", 2}};
509 break;
510 case DEGENERATE:
511 // a priori determined packet drops based on initial TTL of 4, degenerate de-dup
512 // There are TTL (4) rounds of transmissions. Since all transmitters are
513 // synchronized, multiple packets are received each round when there are
514 // multiple transmitters. Only 1 packet per round is delivered, others are
515 // dropped. So this can be computed via "disabled" procedure described
516 // in check packets, but with only a 1 for each node in each round when packets
517 // are received. Drops are the sum of receptions using these indicator receive vectors
518 // subtracting 1 for each node (for the delivered packet) and adding 1
519 // at all nodes for TTL expiry.
520 drops = {{"A", 4}, {"B", 5}, {"C", 5}, {"D", 5}, {"E", 1}};
521 break;
522 }
523
524 if (drops[name])
525 {
527 true,
528 "No drops for node " << name);
530 drops[name],
531 "Wrong number of drops for node " << name);
532 }
533 else
534 {
536 true,
537 "Non-0 drops for node " << name);
538 }
539}
540
548{
549 public:
551
552 private:
553};
554
556 : TestSuite("ipv4-deduplication", UNIT)
557{
558 AddTestCase(new Ipv4DeduplicationTest(true), TestCase::QUICK);
559 AddTestCase(new Ipv4DeduplicationTest(false), TestCase::QUICK);
560 // degenerate case is enabled RFC but with too short an expiry
561 AddTestCase(new Ipv4DeduplicationTest(true, MicroSeconds(50)), TestCase::QUICK);
562}
563
566
592{
593 public:
595 void DoRun() override;
596
597 private:
598 std::vector<Ptr<Socket>> m_sockets;
599 std::vector<uint8_t> m_txPackets;
600 uint8_t m_target;
601
608 void DoSendData(Ptr<Socket> socket, Address to, uint8_t socketIndex);
609};
610
612 : TestCase("Ipv4Deduplication performance test")
613{
614 m_target = 40;
615}
616
617void
619{
620 // multicast target
621 const std::string targetAddr = "239.192.100.1";
622 Config::SetDefault("ns3::Ipv4L3Protocol::EnableDuplicatePacketDetection", BooleanValue(true));
623 Config::SetDefault("ns3::Ipv4L3Protocol::DuplicateExpire", TimeValue(Time("10s")));
624
625 // Create nodes
626 auto nodes = NodeContainer();
627 nodes.Create(20);
628
629 SimpleNetDeviceHelper simplenet;
630 auto devices = simplenet.Install(nodes);
631
632 Ipv4ListRoutingHelper listRouting;
633 Ipv4StaticRoutingHelper staticRouting;
634 listRouting.Add(staticRouting, 0);
635
636 InternetStackHelper internet;
637 internet.SetIpv6StackInstall(false);
638 internet.SetIpv4ArpJitter(true);
639 internet.SetRoutingHelper(listRouting);
640 internet.Install(nodes);
641
642 Ipv4AddressHelper ipv4address;
643 ipv4address.SetBase("10.0.0.0", "255.255.255.0");
644 ipv4address.Assign(devices);
645
646 // add static routes for each node / device
647 auto diter = devices.Begin();
648 for (auto iter = nodes.Begin(); iter != nodes.End(); ++iter)
649 {
650 // route for forwarding
651 staticRouting.AddMulticastRoute(*iter,
652 Ipv4Address::GetAny(),
653 targetAddr.c_str(),
654 *diter,
655 NetDeviceContainer(*diter));
656
657 // route for host
658 // Use host routing entry according to note in Ipv4StaticRouting::RouteOutput:
665 auto ipv4 = (*iter)->GetObject<Ipv4>();
666 NS_TEST_ASSERT_MSG_EQ((bool)ipv4,
667 true,
668 "Node " << (*iter)->GetId() << " does not have Ipv4 aggregate");
669 auto routing = staticRouting.GetStaticRouting(ipv4);
670 routing->AddHostRouteTo(targetAddr.c_str(), ipv4->GetInterfaceForDevice(*diter), 0);
671
672 ++diter;
673 }
674
675 // Create the UDP sockets
677 CreateObjectWithAttributes<UniformRandomVariable>("Max", DoubleValue(4));
678 Address to = InetSocketAddress(Ipv4Address(targetAddr.c_str()), 1234);
679 for (auto iter = nodes.Begin(); iter != nodes.End(); ++iter)
680 {
681 Ptr<SocketFactory> udpSocketFactory = (*iter)->GetObject<UdpSocketFactory>();
682 m_sockets.push_back(udpSocketFactory->CreateSocket());
683 m_txPackets.push_back(0);
684 }
685
686 for (uint32_t i = 0; i < nodes.GetN(); i++)
687 {
688 Simulator::ScheduleWithContext(m_sockets[i]->GetNode()->GetId(),
689 Seconds(4 + jitter->GetValue()),
691 this,
692 m_sockets[i],
693 to,
694 i);
695 }
696
697 Simulator::Run();
698 NS_LOG_UNCOND("Executed " << Simulator::GetEventCount() << " events");
699
700 for (auto iter = m_sockets.begin(); iter != m_sockets.end(); iter++)
701 {
702 (*iter)->Close();
703 }
704
705 Simulator::Destroy();
706}
707
708void
710{
711 socket->SendTo(Create<Packet>(512), 0, to);
712 if (m_txPackets[socketIndex] < m_target)
713 {
714 m_txPackets[socketIndex] += 1;
715 Simulator::ScheduleWithContext(m_sockets[socketIndex]->GetNode()->GetId(),
716 Seconds(.5),
718 this,
719 m_sockets[socketIndex],
720 to,
721 socketIndex);
722 }
723}
724
732{
733 public:
735};
736
738 : TestSuite("ipv4-deduplication-performance", PERFORMANCE)
739{
740 AddTestCase(new Ipv4DeduplicationPerformanceTest, TestCase::EXTENSIVE);
741}
742
#define max(a, b)
Definition: 80211b.c:43
IPv4 Deduplication Performance Test.
std::vector< Ptr< Socket > > m_sockets
sockets in use
uint8_t m_target
number of packets to transmit on each socket
void DoRun() override
Implementation to actually run this TestCase.
void DoSendData(Ptr< Socket > socket, Address to, uint8_t socketIndex)
Send data.
std::vector< uint8_t > m_txPackets
transmitted packets for each socket
IPv4 Deduplication Performance TestSuite.
IPv4 Deduplication Test.
void ReceivePkt(Ptr< Socket > socket)
Receive data.
Ipv4DeduplicationTest(bool enable, Time expire=Seconds(1))
Constructor.
std::map< std::string, uint32_t > m_dropCountMap
map of received packets (node name, counter)
void CheckDrops(const std::string &name)
Check packet drops.
void DoSendData(Ptr< Socket > socket, std::string to)
Send data.
Time m_expire
Expiration delay for duplicate cache entries.
void SendData(Ptr< Socket > socket, std::string to)
Send data.
void DoRun() override
Implementation to actually run this TestCase.
static const Time DELAY
Channel delay.
static std::string MakeName(bool enable, Time expire)
Creates the test name according to the parameters.
void DoSendPacket(Ptr< Socket > socket, Ptr< Packet > packet, std::string to)
Send data.
void DropPkt(const Ipv4Header &ipHeader, Ptr< const Packet > packet, Ipv4L3Protocol::DropReason reason, Ptr< Ipv4 > ipv4, uint32_t interface)
Register dropped packet.
std::map< std::string, uint32_t > m_packetCountMap
map of received packets (node name, counter)
void SendPacket(Ptr< Socket > socket, Ptr< Packet > packet, std::string to)
Send data.
void CheckPackets(const std::string &name)
Check packet receptions.
IPv4 Deduplication TestSuite.
a polymophic address class
Definition: address.h:92
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void SetIpv4ArpJitter(bool enable)
Enable/disable IPv4 ARP Jitter.
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
void SetIpv6StackInstall(bool enable)
Enable/disable IPv6 stack install.
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
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:79
DropReason
Reason why a packet has been dropped.
Helper class that adds ns3::Ipv4ListRouting objects.
void Add(const Ipv4RoutingHelper &routing, int16_t priority)
Helper class that adds ns3::Ipv4StaticRouting objects.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
void AddMulticastRoute(Ptr< Node > n, Ipv4Address source, Ipv4Address group, Ptr< NetDevice > input, NetDeviceContainer output)
Add a multicast route to a node and net device using explicit Ptr<Node> and Ptr<NetDevice>
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t GetId() const
Definition: node.cc:117
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:258
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
A simple channel, for simple things and testing.
build a set of SimpleNetDevice objects
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
Object to create transport layer instances that provide a socket API to applications.
virtual Ptr< Socket > CreateSocket()=0
virtual uint32_t GetRxAvailable() const =0
Return number of bytes which can be returned from one or multiple calls to Recv.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
virtual Ptr< Node > GetNode() const =0
Return the node this socket is associated with.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
Hold variables of type string.
Definition: string.h:42
encapsulates test code
Definition: test.h:1060
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
A suite of tests to run.
Definition: test.h:1256
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double ToDouble(enum Unit unit) const
Get the Time value expressed in a particular unit.
Definition: nstime.h:572
AttributeValue implementation for Time.
Definition: nstime.h:1425
API to create UDP socket instances.
(abstract) base class of all UdpSockets
Definition: udp-socket.h:48
virtual int MulticastJoinGroup(uint32_t interface, const Address &groupAddress)=0
Corresponds to socket option MCAST_JOIN_GROUP.
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:951
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:144
#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
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Definition: test.h:564
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
static Ipv4DeduplicationPerformanceTestSuite g_ipv4DeduplicationPerformanceTestSuite
Static variable for test initialization.
static Ipv4DeduplicationTestSuite g_ipv4DeduplicationTestSuite
Static variable for test initialization.
NodeContainer nodes
devices
Definition: first.py:35
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:850
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
channel
Definition: third.py:81