25#include "ns3/attribute.h"
26#include "ns3/boolean.h"
27#include "ns3/icmpv6-l4-protocol.h"
28#include "ns3/inet6-socket-address.h"
29#include "ns3/internet-stack-helper.h"
30#include "ns3/ipv6-address.h"
31#include "ns3/ipv6-interface.h"
32#include "ns3/ipv6-l3-protocol.h"
33#include "ns3/ipv6-list-routing.h"
34#include "ns3/ipv6-packet-info-tag.h"
35#include "ns3/ipv6-raw-socket-factory.h"
36#include "ns3/ipv6-static-routing.h"
39#include "ns3/object-factory.h"
40#include "ns3/simple-net-device-helper.h"
41#include "ns3/simple-net-device.h"
42#include "ns3/simulator.h"
43#include "ns3/socket-factory.h"
45#include "ns3/traffic-control-layer.h"
46#include "ns3/udp-socket-factory.h"
47#include "ns3/udp-socket.h"
48#include "ns3/uinteger.h"
88 void DoRun()
override;
113 availableData = socket->GetRxAvailable();
114 m_receivedPacket = socket->Recv(std::numeric_limits<uint32_t>::max(), 0);
119 found = m_receivedPacket->RemovePacketTag(tag);
127 if (DynamicCast<UdpSocket>(socket))
134 socket->SendTo(Create<Packet>(123), 0, realTo);
150 internet.SetIpv4StackInstall(
false);
153 node0->AddDevice(device);
154 internet.Install(node0);
159 uint32_t index = ipv6->AddInterface(device);
162 ipv6->AddAddress(index, ifaceAddr1);
163 ipv6->SetMetric(index, 1);
167 node1->AddDevice(device2);
168 internet.Install(node1);
169 ipv6 = node1->GetObject<
Ipv6>();
173 index = ipv6->AddInterface(device2);
176 ipv6->AddAddress(index, ifaceAddr2);
177 ipv6->SetMetric(index, 1);
186 socket->SetRecvPktInfo(
true);
201 std::stringstream dst;
214 socket = factory->CreateSocket();
217 socket->SetRecvPktInfo(
true);
230 socket2 = factory2->CreateSocket();
259 :
TestSuite(
"ipv6-packet-info-tag", UNIT)
void RxCb(Ptr< Socket > socket)
Receive callback.
void DoSendData(Ptr< Socket > socket, std::string to)
Send data.
void DoRun() override
Implementation to actually run this TestCase.
IPv6 PacketInfoTag TestSuite.
Ipv6PacketInfoTagTestSuite()
a polymophic address class
AttributeValue implementation for Boolean.
An implementation of the ICMPv6 protocol.
aggregate IP/TCP/UDP functionality to existing Nodes.
Describes an IPv6 address.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
Ipv6Address GetAddress() const
Get the IPv6 address.
This class implements a tag that carries socket ancillary data to the socket interface.
Describes an IPv6 prefix.
static TypeId GetTypeId()
Get the type ID of this class.
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 SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
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, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
static TypeId GetTypeId()
Get the type ID.
Hold an unsigned integer type.
#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 Ipv6PacketInfoTagTestSuite 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...