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/socket.h"    28 #include "ns3/boolean.h"    33 #include "ns3/inet6-socket-address.h"    35 #include "ns3/internet-stack-helper.h"    36 #include "ns3/ipv6-address-helper.h"    37 #include "ns3/ipv6-l3-protocol.h"    38 #include "ns3/icmpv6-l4-protocol.h"    39 #include "ns3/udp-l4-protocol.h"    40 #include "ns3/ripng.h"    41 #include "ns3/ripng-helper.h"    42 #include "ns3/node-container.h"    64   void DoSendData (
Ptr<Socket> socket, std::string to);
    73   virtual void DoRun (
void);
    90   uint32_t availableData;
   113   Simulator::Stop (
Seconds (66));
   122   Ptr<Node> txNode = CreateObject<Node> ();
   123   Ptr<Node> rxNode = CreateObject<Node> ();
   124   Ptr<Node> routerA = CreateObject<Node> ();
   125   Ptr<Node> routerB = CreateObject<Node> ();
   126   Ptr<Node> routerC = CreateObject<Node> ();
   135   internetv6routers.
Install (routers);
   148     txDev = CreateObject<SimpleNetDevice> ();
   157     fwDev1routerA = CreateObject<SimpleNetDevice> ();
   159     routerA->AddDevice (fwDev1routerA);
   161   net1.
Add (fwDev1routerA);
   164     fwDev2routerA = CreateObject<SimpleNetDevice> ();
   166     routerA->AddDevice (fwDev2routerA);
   168   net2.
Add (fwDev2routerA);
   173     fwDev1routerB = CreateObject<SimpleNetDevice> ();
   175     routerB->AddDevice (fwDev1routerB);
   177   net2.
Add (fwDev1routerB);
   180     fwDev2routerB = CreateObject<SimpleNetDevice> ();
   182     routerB->AddDevice (fwDev2routerB);
   184   net3.
Add (fwDev2routerB);
   189     fwDev1routerC = CreateObject<SimpleNetDevice> ();
   191     routerC->AddDevice (fwDev1routerC);
   193   net3.
Add (fwDev1routerC);
   196     fwDev2routerC = CreateObject<SimpleNetDevice> ();
   198     routerC->AddDevice (fwDev2routerC);
   200   net4.
Add (fwDev2routerC);
   205     rxDev = CreateObject<SimpleNetDevice> ();
   207     rxNode->AddDevice (rxDev);
   262   SendData (txSocket, 
"2001:2::200:ff:fe00:8");
   267   Simulator::Destroy ();
   296   virtual void DoRun (
void);
   307   : 
TestCase (
"RIPng counting to infinity")
   313   uint32_t availableData;
   319   (void) availableData;
   336   Simulator::Stop (
Seconds (66));
   345   Ptr<Node> txNode = CreateObject<Node> ();
   346   Ptr<Node> rxNode = CreateObject<Node> ();
   347   Ptr<Node> routerA = CreateObject<Node> ();
   348   Ptr<Node> routerB = CreateObject<Node> ();
   349   Ptr<Node> routerC = CreateObject<Node> ();
   365   internetv6routers.
Install (routers);
   378     txDev = CreateObject<SimpleNetDevice> ();
   387     fwDev1routerA = CreateObject<SimpleNetDevice> ();
   389     routerA->AddDevice (fwDev1routerA);
   391   net1.
Add (fwDev1routerA);
   394     fwDev2routerA = CreateObject<SimpleNetDevice> ();
   396     routerA->AddDevice (fwDev2routerA);
   398   net2.
Add (fwDev2routerA);
   403     fwDev1routerB = CreateObject<SimpleNetDevice> ();
   405     routerB->AddDevice (fwDev1routerB);
   407   net2.
Add (fwDev1routerB);
   410     fwDev2routerB = CreateObject<SimpleNetDevice> ();
   412     routerB->AddDevice (fwDev2routerB);
   414   net3.
Add (fwDev2routerB);
   419     fwDev1routerC = CreateObject<SimpleNetDevice> ();
   421     routerC->AddDevice (fwDev1routerC);
   423   net3.
Add (fwDev1routerC);
   426     fwDev2routerC = CreateObject<SimpleNetDevice> ();
   428     routerC->AddDevice (fwDev2routerC);
   430   net4.
Add (fwDev2routerC);
   435     rxDev = CreateObject<SimpleNetDevice> ();
   437     rxNode->AddDevice (rxDev);
   491   SendData (txSocket, 
"2001:2::200:ff:fe00:8");
   494   Simulator::Destroy ();
   509   virtual void DoRun (
void);
   524   : 
TestCase (
"RIPng Split Horizon strategy")
   531   uint32_t availableData;
   536   Ipv6Address senderAddress = Inet6SocketAddress::ConvertFrom (srcAddr).GetIpv6 ();
   538   if (senderAddress == 
"fe80::200:ff:fe00:4")
   545       for (std::list<RipNgRte>::iterator iter = rtes.begin ();
   546           iter != rtes.end (); iter++)
   548           if (iter->GetPrefix () == 
"2001:1::")
   550               bool correct = 
false;
   551               if (iter->GetRouteMetric () == 16)
   556               else if (iter->GetRouteMetric () == 2)
   561               NS_TEST_EXPECT_MSG_EQ (correct, 
true, 
"RIPng: unexpected metric value: " << iter->GetRouteMetric ());
   568   (void) availableData;
   576   Ptr<Node> fakeNode = CreateObject<Node> ();
   577   Ptr<Node> listener = CreateObject<Node> ();
   579   Ptr<Node> routerA = CreateObject<Node> ();
   580   Ptr<Node> routerB = CreateObject<Node> ();
   591   internetv6routers.
Install (routers);
   594   internetv6nodes.
Install (listeners);
   602     silentDev = CreateObject<SimpleNetDevice> ();
   606   net0.
Add (silentDev);
   611     silentDevRouterA = CreateObject<SimpleNetDevice> ();
   613     routerA->AddDevice (silentDevRouterA);
   615   net0.
Add (silentDevRouterA);
   618     fwDevRouterA = CreateObject<SimpleNetDevice> ();
   620     routerA->AddDevice (fwDevRouterA);
   622   net1.
Add (fwDevRouterA);
   627     fwDevRouterB = CreateObject<SimpleNetDevice> ();
   629     routerB->AddDevice (fwDevRouterB);
   631   net1.
Add (fwDevRouterB);
   636     listenerDev = CreateObject<SimpleNetDevice> ();
   638     listener->AddDevice (listenerDev);
   640   net1.
Add (listenerDev);
   674   Simulator::Stop (
Seconds (66));
   678   Simulator::Destroy ();
 Ptr< Packet > m_receivedPacket
Received packet. 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
uint32_t GetId(void) const
Keep track of a set of IPv6 interfaces. 
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed. 
void SetDefaultRouteInAllNodes(uint32_t router)
Set the default route for all the devices (except the router itself). 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
aggregate IP/TCP/UDP functionality to existing Nodes. 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID. 
Helper class that adds RIPng routing to nodes. 
virtual Ptr< Socket > CreateSocket(void)=0
void ReceivePktProbe(Ptr< Socket > socket)
Receive data. 
void ReceivePkt(Ptr< Socket > socket)
Receive data. 
void SetForwarding(uint32_t i, bool state)
Set the state of the stack (act as a router or as an host) for the specified index. 
a polymophic address class 
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses. 
IPv6 RIPng SplitHorizon strategy Test. 
Hold variables of type enum. 
void DoSendData(Ptr< Socket > socket, std::string to)
Send data. 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container. 
void SetInterfaceMetric(Ptr< Node > node, uint32_t interface, uint8_t metric)
Set a metric for an interface. 
RipNg::SplitHorizonType_e m_detectedStrategy
Strategy detected. 
holds a vector of ns3::NetDevice pointers 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
RipNg::SplitHorizonType_e m_setStrategy
Strategy set. 
IPv6 RIPng count to infinity Test. 
void SendData(Ptr< Socket > socket, std::string to)
Send data. 
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
keep track of a set of node pointers. 
void Set(std::string name, const AttributeValue &value)
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket. 
Ipv6RipngCountToInfinityTest()
void DoSendData(Ptr< Socket > socket, std::string to)
Send data. 
Ipv6RipngSplitHorizonStrategyTest(RipNg::SplitHorizonType_e strategy)
Constructor. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device. 
Ptr< Packet > m_receivedPacket
Received packet. 
Helper class to auto-assign global IPv6 unicast addresses. 
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Describes an IPv6 address. 
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node. 
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with. 
void SendData(Ptr< Socket > socket, std::string to)
Send data. 
virtual void SetAddress(Address address)
Set the address of this interface. 
Time Seconds(double value)
Construct a Time in the indicated unit. 
void RemoveAllByteTags(void)
Remove all byte tags stored in this packet. 
Describes an IPv6 prefix. 
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. 
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. 
SplitHorizonType_e
Split Horizon strategy type. 
This test suite implements a Unit Test. 
Ipv6InterfaceContainer AssignWithoutAddress(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer but do not assign any IPv6 addresses. 
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device. 
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
static Ipv6RipngTestSuite g_ipv6ripngTestSuite
Static variable for test initialization. 
void ReceivePkt(Ptr< Socket > socket)
Receive data. 
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.