14#include "ns3/arp-l3-protocol.h"
15#include "ns3/attribute.h"
16#include "ns3/icmpv4-l4-protocol.h"
17#include "ns3/inet-socket-address.h"
18#include "ns3/internet-stack-helper.h"
19#include "ns3/ipv4-address.h"
20#include "ns3/ipv4-interface.h"
21#include "ns3/ipv4-l3-protocol.h"
22#include "ns3/ipv4-list-routing.h"
23#include "ns3/ipv4-packet-info-tag.h"
24#include "ns3/ipv4-raw-socket-factory.h"
25#include "ns3/ipv4-static-routing.h"
28#include "ns3/object-factory.h"
29#include "ns3/simple-net-device-helper.h"
30#include "ns3/simple-net-device.h"
31#include "ns3/simulator.h"
32#include "ns3/socket-factory.h"
33#include "ns3/tcp-l4-protocol.h"
35#include "ns3/traffic-control-layer.h"
36#include "ns3/udp-l4-protocol.h"
37#include "ns3/udp-socket-factory.h"
38#include "ns3/udp-socket.h"
55 void DoRun()
override;
81 availableData = socket->GetRxAvailable();
82 m_receivedPacket = socket->Recv(std::numeric_limits<uint32_t>::max(), 0);
87 found = m_receivedPacket->RemovePacketTag(tag);
118 internet.SetIpv6StackInstall(
false);
121 node0->AddDevice(device);
122 internet.Install(node0);
125 uint32_t index = ipv4->AddInterface(device);
127 ipv4->AddAddress(index, ifaceAddr1);
128 ipv4->SetMetric(index, 1);
132 node1->AddDevice(device2);
133 internet.Install(node1);
134 ipv4 = node1->GetObject<
Ipv4>();
136 index = ipv4->AddInterface(device2);
138 ipv4->AddAddress(index, ifaceAddr2);
139 ipv4->SetMetric(index, 1);
147 socket->SetRecvPktInfo(
true);
171 socket = factory->CreateSocket();
174 socket->SetRecvPktInfo(
true);
187 socket2 = factory2->CreateSocket();
void DoRun() override
Implementation to actually run this TestCase.
void DoSendData(Ptr< Socket > socket, std::string to)
Send data.
void RxCb(Ptr< Socket > socket)
Receive callback.
IPv4 PacketInfoTag TestSuite.
Ipv4PacketInfoTagTestSuite()
a polymophic address class
aggregate IP/TCP/UDP functionality to existing Nodes.
Ipv4 addresses are stored in host order in this class.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
a class to store IPv4 address information on an interface
This class implements Linux struct pktinfo in order to deliver ancillary information to the socket in...
static TypeId GetTypeId()
Get the type ID.
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.
Smart pointer class similar to boost::intrusive_ptr.
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...
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static void Run()
Run the simulation.
Object to create transport layer instances that provide a socket API to applications.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static TypeId GetTypeId()
Get the type ID.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
static Ipv4PacketInfoTagTestSuite g_packetinfotagTests
Static variable for test initialization.
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...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.