10#include "ns3/ipv4-address.h"
11#include "ns3/ipv4-list-routing.h"
12#include "ns3/ipv4-route.h"
13#include "ns3/ipv4-routing-protocol.h"
52 NS_ASSERT_MSG(ipv4rp,
"No routing protocol associated with Ipv4");
55 NS_LOG_LOGIC(
"Static routing found as the main IPv4 routing protocol.");
62 for (
uint32_t i = 0; i < lrp->GetNRoutingProtocols(); i++)
88 std::vector<uint32_t> outputInterfaces;
89 for (
auto i = output.
Begin(); i != output.
End(); ++i)
92 int32_t interface = ipv4->GetInterfaceForDevice(nd);
94 "Ipv4StaticRoutingHelper::AddMulticastRoute(): "
95 "Expected an interface associated with the device nd");
96 outputInterfaces.push_back(interface);
99 int32_t inputInterface = ipv4->GetInterfaceForDevice(input);
101 "Ipv4StaticRoutingHelper::AddMulticastRoute(): "
102 "Expected an interface associated with the device input");
105 if (!ipv4StaticRouting)
108 "Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): "
109 "Expected an Ipv4StaticRouting associated with this node");
111 ipv4StaticRouting->AddMulticastRoute(source, group, inputInterface, outputInterfaces);
118 std::string inputName,
140 std::string inputName,
152 int32_t interfaceSrc = ipv4->GetInterfaceForDevice(nd);
154 "Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): "
155 "Expected an interface associated with the device");
158 if (!ipv4StaticRouting)
161 "Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): "
162 "Expected an Ipv4StaticRouting associated with this node");
164 ipv4StaticRouting->SetDefaultMulticastRoute(interfaceSrc);
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
Helper class that adds ns3::Ipv4StaticRouting objects.
Ipv4StaticRoutingHelper * Copy() const override
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
Ipv4StaticRoutingHelper()
void AddMulticastRoute(Ptr< Node > n, Ipv4Address source, Ipv4Address group, Ptr< NetDevice > input, NetDeviceContainer output)
Add a multicast route to a node and net device using explicit Ptr<Node> and Ptr<NetDevice>
void SetDefaultMulticastRoute(Ptr< Node > n, Ptr< NetDevice > nd)
Add a default route to the static routing protocol to forward packets out a particular interface.
Ptr< Ipv4RoutingProtocol > Create(Ptr< Node > node) const override
static Ptr< T > Find(std::string path)
Given a name path string, look to see if there's an object in the system with that associated to it.
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.
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 ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.