26 #include "ns3/ipv6-address.h"
27 #include "ns3/ipv6-packet-info-tag.h"
29 #include "ns3/abort.h"
30 #include "ns3/attribute.h"
31 #include "ns3/simple-net-device.h"
32 #include "ns3/object-factory.h"
33 #include "ns3/socket-factory.h"
34 #include "ns3/udp-socket-factory.h"
35 #include "ns3/udp-socket.h"
36 #include "ns3/ipv6-l3-protocol.h"
37 #include "ns3/ipv6-raw-socket-factory.h"
38 #include "ns3/ipv6-interface.h"
39 #include "ns3/icmpv6-l4-protocol.h"
40 #include "ns3/ipv6-static-routing.h"
41 #include "ns3/ipv6-list-routing.h"
42 #include "ns3/inet6-socket-address.h"
43 #include "ns3/simulator.h"
44 #include "ns3/uinteger.h"
45 #include "ns3/boolean.h"
76 virtual void DoRun (
void);
78 void DoSendData (
Ptr<Socket> socket, std::string to);
89 uint32_t availableData;
93 m_receivedPacket = socket->
Recv (std::numeric_limits<uint32_t>::max (), 0);
106 if (DynamicCast<UdpSocket> (socket) != 0)
114 socket->
SendTo (Create<Packet> (123), 0, realTo);
140 node1->AddDevice (device2);
155 socket->SetAttribute (
"Protocol",
UintegerValue (Ipv6Header::IPV6_ICMPV6));
156 socket->Bind (local);
157 socket->SetRecvPktInfo (
true);
161 Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
167 std::stringstream dst;
169 Simulator::ScheduleWithContext (socket2->GetNode ()->GetId (), Seconds (0),
174 #ifdef UDP6_SUPPORTED
179 socket->Bind (local);
180 socket->SetRecvPktInfo (
true);
184 Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0),
190 Simulator::ScheduleWithContext (socket2->GetNode ()->GetId (), Seconds (0),
194 #endif // UDP6_SUPPORTED
196 Simulator::Destroy ();
208 :
TestSuite (
"ipv6-packet-info-tag", UNIT)
virtual void SetMetric(uint32_t interface, uint16_t metric)=0
Set metric on specified Ipv6 interface.
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
uint32_t GetSize(void) const
virtual Ptr< Socket > CreateSocket(void)=0
virtual void DoRun(void)
Implementation to actually run this TestCase.
Object to create transport layer instances that provide a socket API to applications.
virtual void AddRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol, int16_t priority)
Register a new routing protocol to be used in this IPv4 stack.
a polymophic address class
void RxCb(Ptr< Socket > socket)
Ipv6Address GetAddress() const
Get the IPv6 address.
Hold an unsigned integer type.
static void AddInternetStack(Ptr< Node > node)
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void AggregateObject(Ptr< Object > other)
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Add a NetDevice interface.
virtual void RegisterExtensions()
Register the IPv6 Extensions.
Describes an IPv6 address.
void SetRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol)
Set routing protocol for this stack.
uint32_t AddDevice(Ptr< NetDevice > device)
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
void Insert(Ptr< IpL4Protocol > protocol)
Add an L4 protocol.
virtual void RegisterOptions()
Register the IPv6 Options.
void DoSendData(Ptr< Socket > socket, std::string to)
Describes an IPv6 prefix.
virtual bool AddAddress(uint32_t interface, Ipv6InterfaceAddress address)=0
Add an address on the specified IPv6 interface.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
This class implements a tag that carries socket ancillary data to the socket interface.
Ipv6PacketInfoTagTestSuite g_packetinfotagTests
Ptr< T > GetObject(void) const
Ipv6PacketInfoTagTestSuite()
virtual void SetUp(uint32_t interface)=0
Set the interface into the "up" state.
#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.
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.