20 #include "ns3/assert.h"
21 #include "ns3/ipv6-address.h"
22 #include "ns3/ipv6-list-routing.h"
23 #include "ns3/ipv6-route.h"
24 #include "ns3/ipv6-routing-protocol.h"
27 #include "ns3/names.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);
99 std::vector<uint32_t> outputInterfaces;
100 for (
auto i = output.
Begin(); i != output.
End(); ++i)
103 int32_t
interface = ipv6->GetInterfaceForDevice(nd);
105 "Ipv6StaticRoutingHelper::AddMulticastRoute (): "
106 "Expected an interface associated with the device nd");
107 outputInterfaces.push_back(interface);
110 int32_t inputInterface = ipv6->GetInterfaceForDevice(input);
112 "Ipv6StaticRoutingHelper::AddMulticastRoute (): "
113 "Expected an interface associated with the device input");
116 if (!ipv6StaticRouting)
119 "Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (): "
120 "Expected an Ipv6StaticRouting associated with this node");
122 ipv6StaticRouting->AddMulticastRoute(source, group, inputInterface, outputInterfaces);
129 std::string inputName,
151 std::string inputName,
161 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
166 int32_t interfaceSrc = ipv6->GetInterfaceForDevice (nd);
168 "Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (): "
169 "Expected an interface associated with the device");
172 if (!ipv6StaticRouting)
175 "Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (): "
176 "Expected an Ipv6StaticRouting associated with this node");
178 ipv6StaticRouting->SetDefaultMulticastRoute (interfaceSrc);
182 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
186 Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
187 SetDefaultMulticastRoute (n, nd);
191 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
195 Ptr<Node> n = Names::Find<Node> (nName);
196 SetDefaultMulticastRoute (n, nd);
200 Ipv6StaticRoutingHelper::SetDefaultMulticastRoute (
204 Ptr<Node> n = Names::Find<Node> (nName);
205 Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
206 SetDefaultMulticastRoute (n, nd);
Describes an IPv6 address.
Access to the IPv6 forwarding table, interfaces, and configuration.
Helper class that adds ns3::Ipv6StaticRouting objects.
Ptr< Ipv6RoutingProtocol > Create(Ptr< Node > node) const override
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 * Copy() const override
Ipv6StaticRoutingHelper()
Constructor.
holds a vector of ns3::NetDevice pointers
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< T > GetObject() 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.