22 #include "ns3/ipv4-route.h"
24 #include "ns3/ipv4-static-routing.h"
38 .AddConstructor<Ipv4ListRouting> ()
65 (*rprotoIter).second = 0;
76 <<
"Ipv4ListRouting table" << std::endl;
80 *stream->
GetStream () <<
" Priority: " << (*i).first <<
" Protocol: " << (*i).second->GetInstanceTypeId () << std::endl;
81 (*i).second->PrintRoutingTable (stream);
108 NS_LOG_LOGIC (
"Checking protocol " << (*i).second->GetInstanceTypeId () <<
" with priority " << (*i).first);
110 route = (*i).second->RouteOutput (p, header, oif, sockerr);
146 lcb (packetCopy, header, iif);
152 lcb (p, header, iif);
159 NS_LOG_LOGIC (
"Forwarding disabled for this interface");
169 downstreamLcb = MakeNullCallback<void, Ptr<const Packet>,
const Ipv4Header &, uint32_t > ();
171 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
176 if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, downstreamLcb, ecb))
178 NS_LOG_LOGIC (
"Route found to forward packet in protocol " << (*rprotoIter).second->GetInstanceTypeId ().GetName ());
190 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
195 (*rprotoIter).second->NotifyInterfaceUp (interface);
202 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
207 (*rprotoIter).second->NotifyInterfaceDown (interface);
214 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
219 (*rprotoIter).second->NotifyAddAddress (interface, address);
226 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
231 (*rprotoIter).second->NotifyRemoveAddress (interface, address);
239 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
244 (*rprotoIter).second->SetIpv4 (ipv4);
274 NS_FATAL_ERROR (
"Ipv4ListRouting::GetRoutingProtocol(): index " << index <<
" out of range");
277 for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
282 priority = (*rprotoIter).first;
283 return (*rprotoIter).second;
292 return a.first > b.first;