24 #include "ns3/packet.h"
25 #include "ns3/simulator.h"
26 #include "ns3/ipv6-route.h"
27 #include "ns3/net-device.h"
41 .AddConstructor<Ipv6StaticRouting> ()
87 <<
"Ipv6StaticRouting table" << std::endl;
92 *os << route << std::endl;
99 NS_LOG_FUNCTION (
this << dst << nextHop << interface << prefixToUse << metric);
111 NS_LOG_FUNCTION (
this << network << networkPrefix << nextHop << interface << metric);
119 NS_LOG_FUNCTION (
this << network << networkPrefix << nextHop << interface << prefixToUse << metric);
243 uint16_t longestMask = 0;
244 uint32_t shortestMetric = 0xffffffff;
250 NS_ASSERT_MSG (interface,
"Try to send on link-local multicast address, and no interface index is given!");
251 rtentry = Create<Ipv6Route> ();
253 rtentry->SetDestination (dst);
255 rtentry->SetOutputDevice (interface);
262 uint32_t metric = it->second;
267 NS_LOG_LOGIC (
"Searching for route to " << dst <<
", mask length " << maskLen <<
", metric " << metric);
271 NS_LOG_LOGIC (
"Found global network route " << j <<
", mask length " << maskLen <<
", metric " << metric);
276 if (maskLen < longestMask)
282 if (maskLen > longestMask)
284 shortestMetric = 0xffffffff;
287 longestMask = maskLen;
288 if (metric > shortestMetric)
290 NS_LOG_LOGIC (
"Equal mask length, but previous metric shorter, skipping");
294 shortestMetric = metric;
297 rtentry = Create<Ipv6Route> ();
312 rtentry->SetDestination (route->
GetDest ());
321 NS_LOG_LOGIC (
"Matching route via " << rtentry->GetDestination () <<
" (throught " << rtentry->GetGateway () <<
") at the end");
368 NS_LOG_LOGIC (
"Find source specific multicast route" << *i);
376 mrtentry = Create<Ipv6MulticastRoute> ();
377 mrtentry->SetGroup (route->
GetGroup ());
378 mrtentry->SetOrigin (route->
GetOrigin ());
404 uint32_t shortestMetric = 0xffffffff;
410 uint32_t metric = it->second;
420 if (metric > shortestMetric)
424 shortestMetric = metric;
558 mcb (mrtentry, p, header);
584 NS_LOG_LOGIC (
"For me (destination " << addr <<
" match)");
590 lcb (p, header, iif);
599 NS_LOG_LOGIC (
"Forwarding disabled for this interface");
609 NS_LOG_LOGIC (
"Found unicast destination- calling unicast callback");
610 ucb (rtentry, p, header);
615 NS_LOG_LOGIC (
"Did not find unicast destination- returning false");
707 NS_LOG_INFO (
this << dst << mask << nextHop << interface << prefixToUse);
737 if (dst == entry && prefix == mask && rtentry->
GetInterface () == interface)