22 #include "ns3/ipv4-route.h"
24 #include "ns3/ipv4-static-routing.h"
38 .AddConstructor<Ipv4ListRouting> ()
65 (*rprotoIter).second = 0;
77 <<
"Ipv4ListRouting table" << std::endl;
81 *stream->
GetStream () <<
" Priority: " << (*i).first <<
" Protocol: " << (*i).second->GetInstanceTypeId () << std::endl;
82 (*i).second->PrintRoutingTable (stream);
110 NS_LOG_LOGIC (
"Checking protocol " << (*i).second->GetInstanceTypeId () <<
" with priority " << (*i).first);
112 route = (*i).second->RouteOutput (p, header, oif, sockerr);
132 NS_LOG_FUNCTION (
this << p << header << idev << &ucb << &mcb << &lcb << &ecb);
148 lcb (packetCopy, header, iif);
154 lcb (p, header, iif);
161 NS_LOG_LOGIC (
"Forwarding disabled for this interface");
171 downstreamLcb = MakeNullCallback<void, Ptr<const Packet>,
const Ipv4Header &, uint32_t > ();
173 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
178 if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, downstreamLcb, ecb))
180 NS_LOG_LOGIC (
"Route found to forward packet in protocol " << (*rprotoIter).second->GetInstanceTypeId ().GetName ());
192 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
197 (*rprotoIter).second->NotifyInterfaceUp (interface);
204 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
209 (*rprotoIter).second->NotifyInterfaceDown (interface);
216 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
221 (*rprotoIter).second->NotifyAddAddress (interface, address);
228 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
233 (*rprotoIter).second->NotifyRemoveAddress (interface, address);
241 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
246 (*rprotoIter).second->SetIpv4 (ipv4);
276 NS_FATAL_ERROR (
"Ipv4ListRouting::GetRoutingProtocol(): index " << index <<
" out of range");
279 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
284 priority = (*rprotoIter).first;
285 return (*rprotoIter).second;
295 return a.first > b.first;