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);
Describes an IPv6 address.
Access to the IPv6 forwarding table, interfaces, and configuration.
Helper class that adds ns3::Ipv6StaticRouting objects.
virtual Ptr< Ipv6RoutingProtocol > Create(Ptr< Node > node) const
Ipv6StaticRoutingHelper * Copy(void) const
Ptr< Ipv6StaticRouting > GetStaticRouting(Ptr< Ipv6 > ipv6) const
Get Ipv6StaticRouting pointer from IPv6 stack.
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<Node> and Ptr<NetDevice>
Ipv6StaticRoutingHelper()
Constructor.
holds a vector of ns3::NetDevice pointers
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.