28 #include "ns3/ipv4-packet-info-tag.h"
29 #include "ns3/ipv4-address.h"
31 #include "ns3/abort.h"
32 #include "ns3/attribute.h"
33 #include "ns3/simple-net-device.h"
34 #include "ns3/object-factory.h"
35 #include "ns3/socket-factory.h"
36 #include "ns3/udp-socket-factory.h"
37 #include "ns3/udp-socket.h"
38 #include "ns3/inet-socket-address.h"
39 #include "ns3/ipv4-l3-protocol.h"
40 #include "ns3/ipv4-raw-socket-factory.h"
41 #include "ns3/ipv4-interface.h"
42 #include "ns3/arp-l3-protocol.h"
43 #include "ns3/icmpv4-l4-protocol.h"
44 #include "ns3/ipv4-static-routing.h"
45 #include "ns3/ipv4-list-routing.h"
46 #include "ns3/udp-l4-protocol.h"
47 #include "ns3/tcp-l4-protocol.h"
48 #include "ns3/traffic-control-layer.h"
49 #include "ns3/simulator.h"
68 ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
88 virtual void DoRun (
void);
90 void DoSendData (
Ptr<Socket> socket, std::string to);
101 uint32_t availableData;
118 if (DynamicCast<UdpSocket> (socket) != 0)
126 socket->
SendTo (Create<Packet> (123), 0, realTo);
152 node1->AddDevice (device2);
167 socket->Bind (local);
168 socket->SetRecvPktInfo (
true);
172 Simulator::ScheduleWithContext (socket->GetNode ()->GetId (),
Seconds (0),
178 Simulator::ScheduleWithContext (socket2->GetNode ()->GetId (),
Seconds (0),
186 socket->Bind (local);
187 socket->SetRecvPktInfo (
true);
191 Simulator::ScheduleWithContext (socket->GetNode ()->GetId (),
Seconds (0),
197 Simulator::ScheduleWithContext (socket2->GetNode ()->GetId (),
Seconds (0),
200 Simulator::Destroy ();
211 :
TestSuite (
"ipv4-packet-info-tag", UNIT)
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Ipv4PacketInfoTagTestSuite()
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual Ptr< Socket > CreateSocket(void)=0
Object to create transport layer instances that provide a socket API to applications.
a polymophic address class
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ipv4PacketInfoTagTestSuite g_packetinfotagTests
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
virtual void SetUp(uint32_t interface)=0
#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.
static void AddInternetStack(Ptr< Node > node)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void DoSendData(Ptr< Socket > socket, std::string to)
Access to the Ipv4 forwarding table, interfaces, and configuration.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
This class implements Linux struct pktinfo in order to deliver ancillary information to the socket in...
Ipv4 addresses are stored in host order in this class.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
a class to store IPv4 address information on an interface
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual void SetMetric(uint32_t interface, uint16_t metric)=0
virtual bool AddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
void RxCb(Ptr< Socket > socket)
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.
void SetRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol)
Register a new routing protocol to be used by this Ipv4 stack.