22 #include "ns3/socket-factory.h"
23 #include "ns3/udp-socket-factory.h"
24 #include "ns3/simulator.h"
25 #include "ns3/simple-channel.h"
26 #include "ns3/simple-net-device.h"
27 #include "ns3/drop-tail-queue.h"
28 #include "ns3/socket.h"
29 #include "ns3/boolean.h"
33 #include "ns3/inet6-socket-address.h"
35 #include "ns3/ipv6-l3-protocol.h"
36 #include "ns3/icmpv6-l4-protocol.h"
37 #include "ns3/udp-l4-protocol.h"
38 #include "ns3/ipv6-static-routing.h"
71 void DoSendData (
Ptr<Socket> socket, std::string to);
75 virtual void DoRun (
void);
82 :
TestCase (
"UDP6 socket implementation")
88 uint32_t availableData;
109 Simulator::ScheduleWithContext (socket->
GetNode ()->
GetId (), Seconds (0),
120 Ptr<Node> rxNode = CreateObject<Node> ();
124 rxDev = CreateObject<SimpleNetDevice> ();
125 rxDev->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
131 ipv6->
SetUp (netdev_idx);
135 Ptr<Node> fwNode = CreateObject<Node> ();
139 fwDev1 = CreateObject<SimpleNetDevice> ();
140 fwDev1->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
146 ipv6->
SetUp (netdev_idx);
151 fwDev2 = CreateObject<SimpleNetDevice> ();
152 fwDev2->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
159 ipv6->
SetUp (netdev_idx);
163 Ptr<Node> txNode = CreateObject<Node> ();
167 txDev = CreateObject<SimpleNetDevice> ();
168 txDev->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
174 ipv6->
SetUp (netdev_idx);
214 Simulator::Destroy ();
Access to the IPv6 forwarding table, interfaces, and configuration.
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void DoSendData(Ptr< Socket > socket, std::string to)
#define NS_ASSERT(condition)
IPv6 address associated with an interface.
uint32_t GetSize(void) const
virtual Ptr< Socket > CreateSocket(void)=0
Ptr< Packet > m_receivedPacket
a polymophic address class
Ipv6ForwardingTestSuite g_ipv6forwardingTestSuite
Ipv6Address GetAddress() const
Get the IPv6 address.
virtual Ipv6InterfaceAddress GetAddress(uint32_t interface, uint32_t addressIndex) const =0
Get IPv6 address on specified IPv6 interface.
void ReceivePkt(Ptr< Socket > socket)
#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)
static void AddInternetStack6(Ptr< Node > node)
Doxygen introspection did not find any typical Config paths.
Ipv6ForwardingTestSuite()
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.
void SendData(Ptr< Socket > socket, std::string to)
virtual void RegisterExtensions()
Register the IPv6 Extensions.
Describes an IPv6 address.
void SetRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol)
Set routing protocol for this stack.
void SetDefaultRoute(Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address("::"), uint32_t metric=0)
Set the default route.
uint32_t AddDevice(Ptr< NetDevice > device)
uint32_t GetId(void) const
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
virtual void SetAddress(Address address)
Set the address of this interface.
void RemoveAllByteTags(void)
Remove all byte tags stored in this packet.
virtual void RegisterOptions()
Register the IPv6 Options.
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.
API to create UDP socket instances.
This test suite implements a Unit Test.
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
virtual void SetUp(uint32_t interface)=0
Set the interface into the "up" state.
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.