38 : afterRoutingChange{ndn::make_unique<AfterRoutingChange>()}
39 , m_scheduler(scheduler)
40 , m_NO_NEXT_HOP{-12345}
73 clearDryRoutingTable();
80 calculateLsRoutingTable(pnlsr);
84 calculateHypRoutingTable(pnlsr);
88 calculateHypDryRoutingTable(pnlsr);
92 (*afterRoutingChange)(m_rTable);
99 " routing table can not be calculated :(");
104 " so Routing table can not be calculated :(");
106 clearDryRoutingTable();
109 (*afterRoutingChange)(m_rTable);
124 RoutingTable::calculateLsRoutingTable(
Nlsr&
nlsr)
140 RoutingTable::calculateHypRoutingTable(
Nlsr& nlsr)
157 RoutingTable::calculateHypDryRoutingTable(
Nlsr& nlsr)
176 NLSR_LOG_DEBUG(
"Scheduling routing table calculation in " << m_routingCalcInterval);
178 m_scheduler.scheduleEvent(m_routingCalcInterval,
194 NLSR_LOG_DEBUG(
"Adding " << nh <<
" for destination: " << destRouter);
200 m_rTable.push_back(rte);
210 std::list<RoutingTableEntry>::iterator it = std::find_if(m_rTable.begin(),
214 if (it != m_rTable.end()) {
221 RoutingTable::writeLog(
int hyperbolicState)
224 for (std::list<RoutingTableEntry>::iterator it = m_rTable.begin() ;
225 it != m_rTable.end(); ++it) {
228 (*it).getNexthopList().writeLog();
233 for (std::list<RoutingTableEntry>::iterator it = m_dryTable.begin() ;
234 it != m_dryTable.end(); ++it) {
237 (*it).getNexthopList().writeLog();
245 NLSR_LOG_DEBUG(
"Adding " << nh <<
" to dry table for destination: " << destRouter);
247 std::list<RoutingTableEntry>::iterator it = std::find_if(m_dryTable.begin(),
251 if (it == m_dryTable.end()) {
254 m_dryTable.push_back(rte);
257 (*it).getNexthopList().addNextHop(nh);
262 RoutingTable::clearRoutingTable()
264 if (m_rTable.size() > 0) {
270 RoutingTable::clearDryRoutingTable()
272 if (m_dryTable.size() > 0) {
NexthopList & getNexthopList()
bool getIsBuildAdjLsaSheduled()
ConfParameter & getConfParameter()
size_t getMapSize() const
void createFromCoordinateLsdb(IteratorType begin, IteratorType end)
NamePrefixTable & getNamePrefixTable()
#define NLSR_LOG_DEBUG(x)
const ndn::Name & getRouterPrefix() const
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California.
void calculate(Nlsr &pnlsr)
Calculates a list of next hops for each router in the network.
#define INIT_LOGGER(name)
const std::list< CoordinateLsa > & getCoordinateLsdb() const
AdjacencyList & getAdjacencyList()
static bool routingTableEntryCompare(RoutingTableEntry &rte, ndn::Name &destRouter)
void setIsRouteCalculationScheduled(bool ircs)
bool getIsRoutingTableCalculating()
const ndn::Name & getDestination() const
RoutingTable(ndn::Scheduler &scheduler)
void scheduleRoutingTableCalculation(Nlsr &pnlsr)
Schedules a calculation event in the event scheduler only if one isn't already scheduled.
bool doesLsaExist(const ndn::Name &key, const Lsa::Type &lsType)
bool getIsRouteCalculationScheduled()
void createFromAdjLsdb(IteratorType begin, IteratorType end)
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void addNextHop(const NextHop &nh)
Adds a next hop to the list.
void addNextHopToDryTable(const ndn::Name &destRouter, NextHop &nh)
Adds a next hop to a routing table entry in a dry run scenario.
void setIsRoutingTableCalculating(bool irtc)
RoutingTableEntry * findRoutingTableEntry(const ndn::Name &destRouter)
int32_t getHyperbolicState() const
void calculatePath(Map &pMap, RoutingTable &rt, Nlsr &pnlsr)
void calculatePaths(Map &map, RoutingTable &rt, Lsdb &lsdb, AdjacencyList &adjacencies)
void addNextHop(const ndn::Name &destRouter, NextHop &nh)
Adds a next hop to a routing table entry.
const std::list< AdjLsa > & getAdjLsdb() const
#define NLSR_LOG_TRACE(x)