23 #include "ns3/names.h"
26 #include "ns3/ipv6-route.h"
27 #include "ns3/ipv6-list-routing.h"
28 #include "ns3/assert.h"
29 #include "ns3/ipv6-address.h"
30 #include "ns3/ipv6-routing-protocol.h"
55 return CreateObject<Ipv6StaticRouting> ();
63 NS_ASSERT_MSG (ipv6rp,
"No routing protocol associated with Ipv6");
64 if (DynamicCast<Ipv6StaticRouting> (ipv6rp))
66 NS_LOG_LOGIC (
"Static routing found as the main IPv4 routing protocol.");
67 return DynamicCast<Ipv6StaticRouting> (ipv6rp);
69 if (DynamicCast<Ipv6ListRouting> (ipv6rp))
73 for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
77 if (DynamicCast<Ipv6StaticRouting> (temp))
80 return DynamicCast<Ipv6StaticRouting> (temp);
100 std::vector<uint32_t> outputInterfaces;
104 int32_t
interface = ipv6->GetInterfaceForDevice (nd);
106 "Ipv6StaticRoutingHelper::AddMulticastRoute (): "
107 "Expected an interface associated with the device nd");
108 outputInterfaces.push_back (interface);
111 int32_t inputInterface = ipv6->GetInterfaceForDevice (input);
113 "Ipv6StaticRoutingHelper::AddMulticastRoute (): "
114 "Expected an interface associated with the device input");
117 if (!ipv6StaticRouting)
120 "Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (): "
121 "Expected an Ipv6StaticRouting associated with this node");
123 ipv6StaticRouting->AddMulticastRoute (source, group, inputInterface, outputInterfaces);
131 std::string inputName,
155 std::string inputName,
165 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
170 int32_t interfaceSrc = ipv6->GetInterfaceForDevice (nd);
172 "Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (): "
173 "Expected an interface associated with the device");
176 if (!ipv6StaticRouting)
179 "Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (): "
180 "Expected an Ipv6StaticRouting associated with this node");
182 ipv6StaticRouting->SetDefaultMulticastRoute (interfaceSrc);
186 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
190 Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
191 SetDefaultMulticastRoute (n, nd);
195 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
199 Ptr<Node> n = Names::Find<Node> (nName);
200 SetDefaultMulticastRoute (n, nd);
204 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
208 Ptr<Node> n = Names::Find<Node> (nName);
209 Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
210 SetDefaultMulticastRoute (n, nd);
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
Access to the IPv6 forwarding table, interfaces, and configuration.
void AddMulticastRoute(Ptr< Node > n, Ipv6Address source, Ipv6Address group, Ptr< NetDevice > input, NetDeviceContainer output)
Add a multicast route to a node and net device using explicit Ptr and Ptr ...
Ptr< Ipv6StaticRouting > GetStaticRouting(Ptr< Ipv6 > ipv6) const
Get Ipv6StaticRouting pointer from IPv6 stack.
virtual Ptr< Ipv6RoutingProtocol > Create(Ptr< Node > node) const
holds a vector of ns3::NetDevice pointers
Ipv6StaticRoutingHelper()
Constructor.
#define NS_LOG_LOGIC(msg)
Helper class that adds ns3::Ipv6StaticRouting objects.
Ipv6StaticRoutingHelper * Copy(void) const
NS_LOG_COMPONENT_DEFINE("Ipv6StaticRoutingHelper")
#define NS_ASSERT_MSG(condition, message)
Describes an IPv6 address.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< T > GetObject(void) const