23 #include "ns3/node-list.h" 24 #include "ns3/names.h" 27 #include "ns3/ipv6-static-routing-helper.h" 61 return ipv6->GetAddress (interface, j).GetAddress ();
66 m_interfaces.push_back (std::make_pair (ipv6, interface));
71 Ptr<Ipv6> ipv6 = Names::Find<Ipv6> (ipv6Name);
72 m_interfaces.push_back (std::make_pair (ipv6, interface));
106 NS_ASSERT_MSG (routing != 0,
"Default router setup failed because no Ipv6StaticRouting was found on the node.");
114 uint32_t routerIndex = 0;
116 for (uint32_t index = 0; index <
m_interfaces.size (); index++)
122 if (addr == routerAddress)
134 NS_ASSERT_MSG (found !=
true,
"No such address in the interfaces. Aborting.");
136 for (uint32_t other = 0; other <
m_interfaces.size (); other++)
138 if (other != routerIndex)
145 NS_ASSERT_MSG (routing != 0,
"Default router setup failed because no Ipv6StaticRouting was found on the node.");
154 NS_ASSERT_MSG (i != router,
"A node shouldn't set itself as the default router, isn't it? Aborting.");
165 NS_ASSERT_MSG (routing != 0,
"Default router setup failed because no Ipv6StaticRouting was found on the node.");
172 uint32_t routerIndex = 0;
174 for (uint32_t index = 0; index <
m_interfaces.size (); index++)
180 if (addr == routerAddr)
192 NS_ASSERT_MSG (found !=
true,
"No such address in the interfaces. Aborting.");
194 NS_ASSERT_MSG (i != routerIndex,
"A node shouldn't set itself as the default router, isn't it? Aborting.");
202 NS_ASSERT_MSG (routing != 0,
"Default router setup failed because no Ipv6StaticRouting was found on the node.");
229 uint32_t nodeIndex = 0;
231 for (uint32_t index = 0; index <
m_interfaces.size (); index++)
249 NS_ASSERT_MSG (found !=
true,
"No such address in the interfaces. Aborting.");
Ipv6Address GetAddress() const
Get the IPv6 address.
Smart pointer class similar to boost::intrusive_ptr.
Keep track of a set of IPv6 interfaces.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
void SetDefaultRouteInAllNodes(uint32_t router)
Set the default route for all the devices (except the router itself).
void Add(Ptr< Ipv6 > ipv6, uint32_t interface)
Add a couple IPv6/interface.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
IPv6 address associated with an interface.
Link-local address (fe80::/64)
Ipv6InterfaceContainer()
Constructor.
Iterator Begin(void) const
Get an iterator which refers to the first pair in the container.
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.
std::vector< std::pair< Ptr< Ipv6 >, uint32_t > >::const_iterator Iterator
Container Const Iterator for pairs of Ipv6 smart pointer / Interface Index.
InterfaceVector m_interfaces
List of IPv6 stack and interfaces index.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
uint32_t GetN(void) const
void SetDefaultRoute(uint32_t i, uint32_t router)
Set the default route for the specified index.
Ipv6Address GetLinkLocalAddress(uint32_t i)
Get the link-local address for the specified index.
uint32_t GetInterfaceIndex(uint32_t i) const
Get the interface index for the specified node index.
Ptr< Ipv6StaticRouting > GetStaticRouting(Ptr< Ipv6 > ipv6) const
Get Ipv6StaticRouting pointer from IPv6 stack.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Helper class that adds ns3::Ipv6StaticRouting objects.
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
Describes an IPv6 address.
Ipv6InterfaceAddress::Scope_e GetScope() const
Get address scope.