32 #include "ns3/simulator.h"
48 m_ackTimer (
Timer::CANCEL_ON_DESTROY),
49 m_validSeqNo (vSeqNo), m_seqNo (seqNo), m_hops (hops),
51 m_reqCount (0), m_blackListState (false), m_blackListTimeout (
Simulator::
Now ())
81 for (std::vector<Ipv4Address>::const_iterator i =
m_precursorList.begin (); i
98 std::vector<Ipv4Address>::iterator i = std::remove (
m_precursorList.begin (),
132 for (std::vector<Ipv4Address>::const_iterator i =
m_precursorList.begin (); i
136 for (std::vector<Ipv4Address>::const_iterator j = prec.begin (); j
183 *os << std::setiosflags (std::ios::fixed) <<
184 std::setiosflags (std::ios::left) << std::setprecision (2) <<
186 *os <<
"\t" <<
m_hops <<
"\n";
194 m_badLinkLifetime (t)
205 NS_LOG_LOGIC (
"Route to " <<
id <<
" not found; m_ipv4AddressEntry is empty");
208 std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
240 NS_LOG_LOGIC (
"Route deletion to " << dst <<
" successful");
243 NS_LOG_LOGIC (
"Route deletion to " << dst <<
" not successful");
254 std::pair<std::map<Ipv4Address, RoutingTableEntry>::iterator,
bool> result =
256 return result.second;
263 std::map<Ipv4Address, RoutingTableEntry>::iterator i =
274 i->second.SetRreqCnt (0);
283 std::map<Ipv4Address, RoutingTableEntry>::iterator i =
287 NS_LOG_LOGIC (
"Route set entry state to " <<
id <<
" fails; not found");
290 i->second.SetFlag (state);
291 i->second.SetRreqCnt (0);
292 NS_LOG_LOGIC (
"Route set entry state to " <<
id <<
": new state is " << state);
301 unreachable.clear ();
302 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
305 if (i->second.GetNextHop () == nextHop)
307 NS_LOG_LOGIC (
"Unreachable insert " << i->first <<
" " << i->second.GetSeqNo ());
308 unreachable.insert (std::make_pair (i->first, i->second.GetSeqNo ()));
318 for (std::map<Ipv4Address, RoutingTableEntry>::iterator i =
321 for (std::map<Ipv4Address, uint32_t>::const_iterator j =
322 unreachable.begin (); j != unreachable.end (); ++j)
324 if ((i->first == j->first) && (i->second.GetFlag () ==
VALID))
326 NS_LOG_LOGIC (
"Invalidate route with destination address " << i->first);
339 for (std::map<Ipv4Address, RoutingTableEntry>::iterator i =
342 if (i->second.GetInterface () == iface)
344 std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
359 for (std::map<Ipv4Address, RoutingTableEntry>::iterator i =
362 if (i->second.GetLifeTime () <
Seconds (0))
364 if (i->second.GetFlag () ==
INVALID)
366 std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
370 else if (i->second.GetFlag () ==
VALID)
372 NS_LOG_LOGIC (
"Invalidate route with destination address " << i->first);
392 for (std::map<Ipv4Address, RoutingTableEntry>::iterator i =
393 table.begin (); i != table.end ();)
395 if (i->second.GetLifeTime () <
Seconds (0))
397 if (i->second.GetFlag () ==
INVALID)
399 std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
403 else if (i->second.GetFlag () ==
VALID)
405 NS_LOG_LOGIC (
"Invalidate route with destination address " << i->first);
423 std::map<Ipv4Address, RoutingTableEntry>::iterator i =
427 NS_LOG_LOGIC (
"Mark link unidirectional to " << neighbor <<
" fails; not found");
430 i->second.SetUnidirectional (
true);
431 i->second.SetBalcklistTimeout (blacklistTimeout);
432 i->second.SetRreqCnt (0);
433 NS_LOG_LOGIC (
"Set link to " << neighbor <<
" to unidirectional");
442 *stream->
GetStream () <<
"\nAODV Routing table\n"
443 <<
"Destination\tGateway\t\tInterface\tFlag\tExpire\t\tHops\n";
444 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
445 table.begin (); i != table.end (); ++i)
447 i->second.Print (stream);