route: remove redundant function
refs: #4811 Change-Id: I31b1031f57a344e7c3176b917ffbad2f6b2bd821
This commit is contained in:
1 parent
7c13ba5448
commit
72b2b25cd2
5 files changed
+21
-43
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2018, The University of Memphis,
|
||||
* Copyright (c) 2014-2019, The University of Memphis,
|
||||
* Regents of the University of California,
|
||||
* Arizona Board of Regents.
|
||||
*
|
||||
@@ -425,8 +425,8 @@ const double HyperbolicRoutingCalculator::UNKNOWN_DISTANCE = -1.0;
|
||||
const double HyperbolicRoutingCalculator::UNKNOWN_RADIUS = -1.0;
|
||||
|
||||
void
|
||||
HyperbolicRoutingCalculator::calculatePaths(Map& map, RoutingTable& rt,
|
||||
Lsdb& lsdb, AdjacencyList& adjacencies)
|
||||
HyperbolicRoutingCalculator::calculatePath(Map& map, RoutingTable& rt,
|
||||
Lsdb& lsdb, AdjacencyList& adjacencies)
|
||||
{
|
||||
NLSR_LOG_TRACE("Calculating hyperbolic paths");
|
||||
|
||||
@@ -468,12 +468,12 @@ HyperbolicRoutingCalculator::calculatePaths(Map& map, RoutingTable& rt,
|
||||
|
||||
ndn::optional<ndn::Name> destRouterName = map.getRouterNameByMappingNo(dest);
|
||||
if (destRouterName) {
|
||||
double distance = getHyperbolicDistance(map, lsdb, srcRouterName, *destRouterName);
|
||||
double distance = getHyperbolicDistance(lsdb, srcRouterName, *destRouterName);
|
||||
|
||||
// Could not compute distance
|
||||
if (distance == UNKNOWN_DISTANCE) {
|
||||
NLSR_LOG_WARN("Could not calculate hyperbolic distance from " << srcRouterName << " to " <<
|
||||
*destRouterName);
|
||||
*destRouterName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -485,8 +485,7 @@ HyperbolicRoutingCalculator::calculatePaths(Map& map, RoutingTable& rt,
|
||||
}
|
||||
|
||||
double
|
||||
HyperbolicRoutingCalculator::getHyperbolicDistance(Map& map, Lsdb& lsdb,
|
||||
ndn::Name src, ndn::Name dest)
|
||||
HyperbolicRoutingCalculator::getHyperbolicDistance(Lsdb& lsdb, ndn::Name src, ndn::Name dest)
|
||||
{
|
||||
NLSR_LOG_TRACE("Calculating hyperbolic distance from " << src << " to " << dest);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2018, The University of Memphis,
|
||||
* Copyright (c) 2014-2019, The University of Memphis,
|
||||
* Regents of the University of California
|
||||
*
|
||||
* This file is part of NLSR (Named-data Link State Routing).
|
||||
@@ -215,11 +215,11 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
calculatePaths(Map& map, RoutingTable& rt, Lsdb& lsdb, AdjacencyList& adjacencies);
|
||||
calculatePath(Map& map, RoutingTable& rt, Lsdb& lsdb, AdjacencyList& adjacencies);
|
||||
|
||||
private:
|
||||
double
|
||||
getHyperbolicDistance(Map& map, Lsdb& lsdb, ndn::Name src, ndn::Name dest);
|
||||
getHyperbolicDistance(Lsdb& lsdb, ndn::Name src, ndn::Name dest);
|
||||
|
||||
void
|
||||
addNextHop(ndn::Name destinationRouter, std::string faceUri, double cost, RoutingTable& rt);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2018, The University of Memphis,
|
||||
* Copyright (c) 2014-2019, The University of Memphis,
|
||||
* Regents of the University of California
|
||||
*
|
||||
* This file is part of NLSR (Named-data Link State Routing).
|
||||
@@ -80,13 +80,13 @@ RoutingTable::calculate(Nlsr& pnlsr)
|
||||
|| (pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN)) {
|
||||
calculateLsRoutingTable(pnlsr);
|
||||
}
|
||||
//calculate hyperbolic routing
|
||||
// calculate hyperbolic
|
||||
if (pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_ON) {
|
||||
calculateHypRoutingTable(pnlsr);
|
||||
calculateHypRoutingTable(pnlsr, false);
|
||||
}
|
||||
//calculate dry hyperbolic routing
|
||||
if (pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN) {
|
||||
calculateHypDryRoutingTable(pnlsr);
|
||||
calculateHypRoutingTable(pnlsr, true);
|
||||
}
|
||||
// Inform the NPT that updates have been made
|
||||
NLSR_LOG_DEBUG("Calling Update NPT With new Route");
|
||||
@@ -134,11 +134,11 @@ RoutingTable::calculateLsRoutingTable(Nlsr& nlsr)
|
||||
|
||||
LinkStateRoutingTableCalculator calculator(nRouters);
|
||||
|
||||
calculator.calculatePath(map, std::ref(*this), nlsr);
|
||||
calculator.calculatePath(map, *this, nlsr);
|
||||
}
|
||||
|
||||
void
|
||||
RoutingTable::calculateHypRoutingTable(Nlsr& nlsr)
|
||||
RoutingTable::calculateHypRoutingTable(Nlsr& nlsr, bool isDryRun)
|
||||
{
|
||||
Map map;
|
||||
map.createFromCoordinateLsdb(nlsr.getLsdb().getCoordinateLsdb().begin(),
|
||||
@@ -147,27 +147,10 @@ RoutingTable::calculateHypRoutingTable(Nlsr& nlsr)
|
||||
|
||||
size_t nRouters = map.getMapSize();
|
||||
|
||||
HyperbolicRoutingCalculator calculator(nRouters, false,
|
||||
HyperbolicRoutingCalculator calculator(nRouters, isDryRun,
|
||||
nlsr.getConfParameter().getRouterPrefix());
|
||||
|
||||
calculator.calculatePaths(map, std::ref(*this),
|
||||
nlsr.getLsdb(), nlsr.getAdjacencyList());
|
||||
}
|
||||
|
||||
void
|
||||
RoutingTable::calculateHypDryRoutingTable(Nlsr& nlsr)
|
||||
{
|
||||
Map map;
|
||||
map.createFromAdjLsdb(nlsr.getLsdb().getAdjLsdb().begin(), nlsr.getLsdb().getAdjLsdb().end());
|
||||
map.writeLog();
|
||||
|
||||
size_t nRouters = map.getMapSize();
|
||||
|
||||
HyperbolicRoutingCalculator calculator(nRouters, true,
|
||||
nlsr.getConfParameter().getRouterPrefix());
|
||||
|
||||
calculator.calculatePaths(map, std::ref(*this),
|
||||
nlsr.getLsdb(), nlsr.getAdjacencyList());
|
||||
calculator.calculatePath(map, *this, nlsr.getLsdb(), nlsr.getAdjacencyList());
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2018, The University of Memphis,
|
||||
* Copyright (c) 2014-2019, The University of Memphis,
|
||||
* Regents of the University of California
|
||||
*
|
||||
* This file is part of NLSR (Named-data Link State Routing).
|
||||
@@ -118,11 +118,7 @@ private:
|
||||
|
||||
/*! \brief Calculates a HR routing table. */
|
||||
void
|
||||
calculateHypRoutingTable(Nlsr& pnlsr);
|
||||
|
||||
/*! \brief Calculates a dry-run HR routing table. */
|
||||
void
|
||||
calculateHypDryRoutingTable(Nlsr& pnlsr);
|
||||
calculateHypRoutingTable(Nlsr& pnlsr, bool isDryRun);
|
||||
|
||||
void
|
||||
clearRoutingTable();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2018, The University of Memphis,
|
||||
* Copyright (c) 2014-2019, The University of Memphis,
|
||||
* Regents of the University of California,
|
||||
* Arizona Board of Regents.
|
||||
*
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
void runTest(const double& expectedCost)
|
||||
{
|
||||
HyperbolicRoutingCalculator calculator(map.getMapSize(), false, ROUTER_A_NAME);
|
||||
calculator.calculatePaths(map, routingTable, lsdb, adjacencies);
|
||||
calculator.calculatePath(map, routingTable, lsdb, adjacencies);
|
||||
|
||||
RoutingTableEntry* entryB = routingTable.findRoutingTableEntry(ROUTER_B_NAME);
|
||||
|
||||
|
||||
Reference in new issue
Block a user