28 .SetGroupName(
"Internet")
54 (*rprotoIter).second =
nullptr;
65 <<
", Time: " <<
Now().
As(unit)
67 <<
", Ipv4ListRouting table" << std::endl;
70 *stream->GetStream() <<
" Priority: " << (*i).first
71 <<
" Protocol: " << (*i).second->GetInstanceTypeId() << std::endl;
72 (*i).second->PrintRoutingTable(stream, unit);
84 protocol->Initialize();
100 NS_LOG_LOGIC(
"Checking protocol " << (*i).second->GetInstanceTypeId() <<
" with priority "
103 route = (*i).second->RouteOutput(p, header, oif, sockerr);
127 NS_LOG_FUNCTION(
this << p << header << idev << &ucb << &mcb << &lcb << &ecb);
143 lcb(packetCopy, header, iif);
171 if ((*rprotoIter).second->RouteInput(p, header, idev, ucb, mcb, downstreamLcb, ecb))
173 NS_LOG_LOGIC(
"Route found to forward packet in protocol "
174 << (*rprotoIter).second->GetInstanceTypeId().GetName());
189 (*rprotoIter).second->NotifyInterfaceUp(interface);
200 (*rprotoIter).second->NotifyInterfaceDown(interface);
211 (*rprotoIter).second->NotifyAddAddress(interface, address);
222 (*rprotoIter).second->NotifyRemoveAddress(interface, address);
234 (*rprotoIter).second->SetIpv4(ipv4);
242 NS_LOG_FUNCTION(
this << routingProtocol->GetInstanceTypeId() << priority);
247 routingProtocol->SetIpv4(
m_ipv4);
264 NS_FATAL_ERROR(
"Ipv4ListRouting::GetRoutingProtocol(): index " << index
273 priority = (*rprotoIter).first;
274 return (*rprotoIter).second;
284 return a.first > b.first;
virtual bool IsForwarding(uint32_t interface) const =0
virtual bool IsDestinationAddress(Ipv4Address address, uint32_t iif) const =0
Determine whether address and interface corresponding to received packet can be accepted for local de...
virtual int32_t GetInterfaceForDevice(Ptr< const NetDevice > device) const =0
a class to store IPv4 address information on an interface
std::pair< int16_t, Ptr< Ipv4RoutingProtocol > > Ipv4RoutingProtocolEntry
Container identifying an IPv4 Routing Protocol entry in the list.
static TypeId GetTypeId()
Get the type ID of this class.
void DoDispose() override
Destructor implementation.
Ipv4RoutingProtocolList m_routingProtocols
List of routing protocols.
void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address) override
Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override
Query routing cache for an existing route, for an outbound packet.
void SetIpv4(Ptr< Ipv4 > ipv4) override
virtual uint32_t GetNRoutingProtocols() const
void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override
Print the Routing Table entries.
bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb) override
Route an input packet (to be forwarded or locally delivered)
~Ipv4ListRouting() override
virtual void AddRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol, int16_t priority)
Register a new routing protocol to be used in this IPv4 stack.
Ptr< Ipv4 > m_ipv4
Ipv4 this protocol is associated with.
static bool Compare(const Ipv4RoutingProtocolEntry &a, const Ipv4RoutingProtocolEntry &b)
Compare two routing protocols.
void NotifyInterfaceDown(uint32_t interface) override
void DoInitialize() override
Initialize() implementation.
virtual Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(uint32_t index, int16_t &priority) const
Return pointer to routing protocol stored at index, with the first protocol (index 0) the highest pri...
void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address) override
void NotifyInterfaceUp(uint32_t interface) override
Abstract base class for IPv4 routing protocols.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
virtual void DoInitialize()
Initialize() implementation.
Smart pointer class similar to boost::intrusive_ptr.
SocketErrno
Enumeration of the possible errors returned by a socket.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Unit
The unit to use to interpret a number representing time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Callback< R, Args... > MakeNullCallback()
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#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 ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.