25 #include "ns3/socket-factory.h" 
   26 #include "ns3/ipv6-raw-socket-factory.h" 
   27 #include "ns3/simulator.h" 
   28 #include "ns3/simple-channel.h" 
   29 #include "ns3/simple-net-device.h" 
   30 #include "ns3/drop-tail-queue.h" 
   31 #include "ns3/socket.h" 
   35 #include "ns3/inet6-socket-address.h" 
   36 #include "ns3/boolean.h" 
   37 #include "ns3/uinteger.h" 
   39 #include "ns3/ipv6-l3-protocol.h" 
   40 #include "ns3/icmpv6-l4-protocol.h" 
   41 #include "ns3/ipv6-list-routing.h" 
   42 #include "ns3/ipv6-static-routing.h" 
   46 #include <netinet/in.h> 
   47 #include <sys/socket.h> 
   48 #include <sys/types.h> 
   75   void DoSendData (
Ptr<Socket> socket, std::string to);
 
   79   virtual void DoRun (
void);
 
   90   : 
TestCase (
"Ipv6 Raw socket implementation") 
 
  106   uint32_t availableData;
 
  111   NS_ASSERT (availableData == m_receivedPacket->GetSize ());
 
  116   uint32_t availableData;
 
  122   NS_ASSERT (availableData == m_receivedPacket2->GetSize ());
 
  140   Simulator::ScheduleWithContext (socket->
GetNode ()->
GetId (), Seconds (0),
 
  151   Ptr<Node> rxNode = CreateObject<Node> ();
 
  155     rxDev1 = CreateObject<SimpleNetDevice> ();
 
  156     rxDev1->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
 
  162     ipv6->
SetUp (netdev_idx);
 
  166     rxDev2 = CreateObject<SimpleNetDevice> ();
 
  167     rxDev2->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
 
  173     ipv6->
SetUp (netdev_idx);
 
  177   Ptr<Node> txNode = CreateObject<Node> ();
 
  181     txDev1 = CreateObject<SimpleNetDevice> ();
 
  182     txDev1->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
 
  188     ipv6->
SetUp (netdev_idx);
 
  192     txDev2 = CreateObject<SimpleNetDevice> ();
 
  193     txDev2->
SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
 
  199     ipv6->
SetUp (netdev_idx);
 
  216   rxSocket->SetAttribute (
"Protocol", 
UintegerValue (Ipv6Header::IPV6_ICMPV6));
 
  231   SendData (txSocket, 
"2001:db8:0::1");
 
  265   Simulator::Destroy ();
 
void ReceivePkt(Ptr< Socket > socket)
 
Access to the IPv6 forwarding table, interfaces, and configuration. 
 
void ReceivePacket(Ptr< Socket > socket)
 
#define NS_ASSERT(condition)
 
IPv6 address associated with an interface. 
 
uint32_t GetSize(void) const 
 
virtual Ptr< Socket > CreateSocket(void)=0
 
void ReceivePkt2(Ptr< Socket > socket)
 
virtual void AddRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol, int16_t priority)
Register a new routing protocol to be used in this IPv4 stack. 
 
Ipv6RawTestSuite g_ipv6rawTestSuite
 
a polymophic address class 
 
void ReceivePacket2(Ptr< Socket > socket, Ptr< Packet > packet, const Address &from)
 
API to create IPv6 RAW socket instances. 
 
static void AddInternetStack(Ptr< Node > node)
 
Hold an unsigned integer type. 
 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
 
void SendData(Ptr< Socket > socket, std::string to)
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read. 
 
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
 
void AggregateObject(Ptr< Object > other)
 
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket. 
 
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket. 
 
void ReceivePacket(Ptr< Socket > socket, Ptr< Packet > packet, const Address &from)
 
void DoSendData(Ptr< Socket > socket, std::string to)
 
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)
 
uint32_t GetId(void) const 
 
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with. 
 
void Insert(Ptr< IpL4Protocol > protocol)
Add an L4 protocol. 
 
virtual void SetAddress(Address address)
Set the address of this interface. 
 
Ptr< Packet > m_receivedPacket
 
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. 
 
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address. 
 
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 
 
void Dispose(void)
Run the DoDispose methods of this object and all the objects aggregated to it. 
 
Ptr< Packet > m_receivedPacket2
 
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.