routing-table-calculator.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
23 #include "lsdb.hpp"
24 #include "map.hpp"
25 #include "nexthop.hpp"
26 #include "nlsr.hpp"
27 #include "logger.hpp"
28 #include "adjacent.hpp"
29 
30 #include <iostream>
31 #include <boost/math/constants/constants.hpp>
32 #include <ndn-cxx/util/logger.hpp>
33 #include <cmath>
34 
35 namespace nlsr {
36 
37 INIT_LOGGER(route.RoutingTableCalculator);
38 
39 const int LinkStateRoutingTableCalculator::EMPTY_PARENT = -12345;
40 const double LinkStateRoutingTableCalculator::INF_DISTANCE = 2147483647;
41 const int LinkStateRoutingTableCalculator::NO_MAPPING_NUM = -1;
42 const int LinkStateRoutingTableCalculator::NO_NEXT_HOP = -12345;
43 
44 void
46 {
47  adjMatrix = new double*[m_nRouters];
48 
49  for (size_t i = 0; i < m_nRouters; ++i) {
50  adjMatrix[i] = new double[m_nRouters];
51  }
52 }
53 
54 void
56 {
57  for (size_t i = 0; i < m_nRouters; i++) {
58  for (size_t j = 0; j < m_nRouters; j++) {
60  }
61  }
62 }
63 
64 void
65 RoutingTableCalculator::makeAdjMatrix(const std::list<AdjLsa>& adjLsaList, Map& pMap)
66 {
67  // For each LSA represented in the map
68  for (const auto& adjLsa : adjLsaList) {
69  ndn::optional<int32_t> row = pMap.getMappingNoByRouterName(adjLsa.getOrigRouter());
70 
71  std::list<Adjacent> adl = adjLsa.getAdl().getAdjList();
72  // For each adjacency represented in the LSA
73  for (const auto& adjacent : adl) {
74  ndn::optional<int32_t> col = pMap.getMappingNoByRouterName(adjacent.getName());
75  double cost = adjacent.getLinkCost();
76 
77  if (row && col && *row < static_cast<int32_t>(m_nRouters)
78  && *col < static_cast<int32_t>(m_nRouters))
79  {
80  adjMatrix[*row][*col] = cost;
81  }
82  }
83  }
84 
85  // Links that do not have the same cost for both directions should
86  // have their costs corrected:
87  //
88  // If the cost of one side of the link is NON_ADJACENT_COST (i.e. broken) or negative,
89  // both direction of the link should have their cost corrected to NON_ADJACENT_COST.
90  //
91  // Otherwise, both sides of the link should use the larger of the two costs.
92  //
93  // Additionally, this means that we can halve the amount of space
94  // that the matrix uses by only maintaining a triangle.
95  // - But that is not yet implemented.
96  for (size_t row = 0; row < m_nRouters; ++row) {
97  for (size_t col = 0; col < m_nRouters; ++col) {
98  double toCost = adjMatrix[row][col];
99  double fromCost = adjMatrix[col][row];
100 
101  if (fromCost != toCost) {
102  double correctedCost = Adjacent::NON_ADJACENT_COST;
103 
104  if (toCost >= 0 && fromCost >= 0) {
105  // If both sides of the link are up, use the larger cost else break the link
106  correctedCost = std::max(toCost, fromCost);
107  }
108 
109  NLSR_LOG_WARN("Cost between [" << row << "][" << col << "] and [" << col << "][" << row <<
110  "] are not the same (" << toCost << " != " << fromCost << "). " <<
111  "Correcting to cost: " << correctedCost);
112 
113  adjMatrix[row][col] = correctedCost;
114  adjMatrix[col][row] = correctedCost;
115  }
116  }
117  }
118 }
119 
120 void
122 {
123  if (!ndn_cxx_getLogger().isLevelEnabled(ndn::util::LogLevel::DEBUG)) {
124  return;
125  }
126 
127  NLSR_LOG_DEBUG("-----------Legend (routerName -> index)------");
128  std::string routerIndex;
129  std::string indexToNameMapping;
130  std::string lengthOfDash = "--";
131 
132  for (size_t i = 0; i < m_nRouters; i++) {
133  routerIndex += boost::lexical_cast<std::string>(i);
134  routerIndex += " ";
135  lengthOfDash += "--";
136  NLSR_LOG_DEBUG("Router:" + map.getRouterNameByMappingNo(i)->toUri() +
137  " Index:" + boost::lexical_cast<std::string>(i));
138  }
139  NLSR_LOG_DEBUG(" |" + routerIndex);
140  NLSR_LOG_DEBUG(lengthOfDash);
141 
142  for (size_t i = 0; i < m_nRouters; i++) {
143  std::string line;
144  for (size_t j = 0; j < m_nRouters; j++) {
145  line += boost::lexical_cast<std::string>(adjMatrix[i][j]);
146  line += " ";
147  }
148  line = boost::lexical_cast<std::string>(i) + "|" + line;
149  NLSR_LOG_DEBUG(line);
150  }
151 }
152 
153 void
154 RoutingTableCalculator::adjustAdMatrix(int source, int link, double linkCost)
155 {
156  for (int i = 0; i < static_cast<int>(m_nRouters); i++) {
157  if (i == link) {
158  adjMatrix[source][i] = linkCost;
159  }
160  else {
161  // if "i" is not a link to the source, set it's cost to a non adjacent value.
163  }
164  }
165 }
166 
167 int
169 {
170  int noLink = 0;
171 
172  for (size_t i = 0; i < m_nRouters; i++) {
173  if (adjMatrix[sRouter][i] >= 0 && i != static_cast<size_t>(sRouter)) { // make sure "i" is not self
174  noLink++;
175  }
176  }
177  return noLink;
178 }
179 
180 void
182  double* linkCosts, int source)
183 {
184  int j = 0;
185 
186  for (size_t i = 0; i < m_nRouters; i++) {
187  if (adjMatrix[source][i] >= 0 && i != static_cast<size_t>(source)) {// make sure "i" is not self
188  links[j] = i;
189  linkCosts[j] = adjMatrix[source][i];
190  j++;
191  }
192  }
193 }
194 
195 void
197 {
198  for (size_t i = 0; i < m_nRouters; ++i) {
199  delete [] adjMatrix[i];
200  }
201  delete [] adjMatrix;
202 }
203 
204 void
206 {
207  links = new int[vNoLink];
208 }
209 
210 void
212 {
213  linkCosts = new double[vNoLink];
214 }
215 
216 
217 void
219 {
220  delete [] links;
221 }
222 void
224 {
225  delete [] linkCosts;
226 }
227 
228 void
230  ConfParameter& confParam,
231  const std::list<AdjLsa>& adjLsaList)
232 {
233  NLSR_LOG_DEBUG("LinkStateRoutingTableCalculator::calculatePath Called");
235  initMatrix();
236  makeAdjMatrix(adjLsaList, pMap);
237  writeAdjMatrixLog(pMap);
238  ndn::optional<int32_t> sourceRouter =
239  pMap.getMappingNoByRouterName(confParam.getRouterPrefix());
240  allocateParent(); // These two matrices are used in Dijkstra's algorithm.
241  allocateDistance(); //
242  // We only bother to do the calculation if we have a router by that name.
243  if (sourceRouter && confParam.getMaxFacesPerPrefix() == 1) {
244  // In the single path case we can simply run Dijkstra's algorithm.
245  doDijkstraPathCalculation(*sourceRouter);
246  // Inform the routing table of the new next hops.
247  addAllLsNextHopsToRoutingTable(confParam.getAdjacencyList(), rt, pMap, *sourceRouter);
248  }
249  else {
250  // Multi Path
251  setNoLink(getNumOfLinkfromAdjMatrix(*sourceRouter));
252  allocateLinks();
254  // Gets a sparse listing of adjacencies for path calculation
255  getLinksFromAdjMatrix(links, linkCosts, *sourceRouter);
256  for (int i = 0 ; i < vNoLink; i++) {
257  // Simulate that only the current neighbor is accessible
258  adjustAdMatrix(*sourceRouter, links[i], linkCosts[i]);
259  writeAdjMatrixLog(pMap);
260  // Do Dijkstra's algorithm using the current neighbor as your start.
261  doDijkstraPathCalculation(*sourceRouter);
262  // Update the routing table with the calculations.
263  addAllLsNextHopsToRoutingTable(confParam.getAdjacencyList(), rt, pMap, *sourceRouter);
264  }
265  freeLinks();
266  freeLinksCosts();
267  }
268  freeParent();
269  freeDistance();
270  freeAdjMatrix();
271 }
272 
273 void
274 LinkStateRoutingTableCalculator::doDijkstraPathCalculation(int sourceRouter)
275 {
276  int i;
277  int v, u;
278  int* Q = new int[m_nRouters]; // Each cell represents the router with that mapping no.
279  int head = 0;
280  // Initiate the parent
281  for (i = 0 ; i < static_cast<int>(m_nRouters); i++) {
282  m_parent[i] = EMPTY_PARENT;
283  // Array where the ith element is the distance to the router with mapping no i.
284  m_distance[i] = INF_DISTANCE;
285  Q[i] = i;
286  }
287  if (sourceRouter != NO_MAPPING_NUM) {
288  // Distance to source from source is always 0.
289  m_distance[sourceRouter] = 0;
290  sortQueueByDistance(Q, m_distance, head, m_nRouters);
291  // While we haven't visited every node.
292  while (head < static_cast<int>(m_nRouters)) {
293  u = Q[head]; // Set u to be the current node pointed to by head.
294  if (m_distance[u] == INF_DISTANCE) {
295  break; // This can only happen when there are no accessible nodes.
296  }
297  // Iterate over the adjacent nodes to u.
298  for (v = 0 ; v < static_cast<int>(m_nRouters); v++) {
299  // If the current node is accessible.
300  if (adjMatrix[u][v] >= 0) {
301  // And we haven't visited it yet.
302  if (isNotExplored(Q, v, head + 1, m_nRouters)) {
303  // And if the distance to this node + from this node to v
304  // is less than the distance from our source node to v
305  // that we got when we built the adj LSAs
306  if (m_distance[u] + adjMatrix[u][v] < m_distance[v]) {
307  // Set the new distance
308  m_distance[v] = m_distance[u] + adjMatrix[u][v] ;
309  // Set how we get there.
310  m_parent[v] = u;
311  }
312  }
313  }
314  }
315  // Increment the head position, resort the list by distance from where we are.
316  head++;
317  sortQueueByDistance(Q, m_distance, head, m_nRouters);
318  }
319  }
320  delete [] Q;
321 }
322 
323 void
324 LinkStateRoutingTableCalculator::addAllLsNextHopsToRoutingTable(AdjacencyList& adjacencies,
325  RoutingTable& rt, Map& pMap,
326  uint32_t sourceRouter)
327 {
328  NLSR_LOG_DEBUG("LinkStateRoutingTableCalculator::addAllNextHopsToRoutingTable Called");
329 
330  int nextHopRouter = 0;
331 
332  // For each router we have
333  for (size_t i = 0; i < m_nRouters ; i++) {
334  if (i != sourceRouter) {
335 
336  // Obtain the next hop that was determined by the algorithm
337  nextHopRouter = getLsNextHop(i, sourceRouter);
338  // If this router is accessible at all
339  if (nextHopRouter != NO_NEXT_HOP) {
340 
341  // Fetch its distance
342  double routeCost = m_distance[i];
343  // Fetch its actual name
344  ndn::optional<ndn::Name> nextHopRouterName= pMap.getRouterNameByMappingNo(nextHopRouter);
345  if (nextHopRouterName) {
346  std::string nextHopFace =
347  adjacencies.getAdjacent(*nextHopRouterName).getFaceUri().toString();
348  // Add next hop to routing table
349  NextHop nh(nextHopFace, routeCost);
350  rt.addNextHop(*(pMap.getRouterNameByMappingNo(i)), nh);
351 
352  }
353  }
354  }
355  }
356 }
357 
358 int
359 LinkStateRoutingTableCalculator::getLsNextHop(int dest, int source)
360 {
361  int nextHop = NO_NEXT_HOP;
362  while (m_parent[dest] != EMPTY_PARENT) {
363  nextHop = dest;
364  dest = m_parent[dest];
365  }
366  if (dest != source) {
367  nextHop = NO_NEXT_HOP;
368  }
369  return nextHop;
370 }
371 
372 void
373 LinkStateRoutingTableCalculator::sortQueueByDistance(int* Q,
374  double* dist,
375  int start, int element)
376 {
377  for (int i = start ; i < element ; i++) {
378  for (int j = i + 1; j < element; j++) {
379  if (dist[Q[j]] < dist[Q[i]]) {
380  int tempU = Q[j];
381  Q[j] = Q[i];
382  Q[i] = tempU;
383  }
384  }
385  }
386 }
387 
388 int
389 LinkStateRoutingTableCalculator::isNotExplored(int* Q,
390  int u, int start, int element)
391 {
392  int ret = 0;
393  for (int i = start; i < element; i++) {
394  if (Q[i] == u) {
395  ret = 1;
396  break;
397  }
398  }
399  return ret;
400 }
401 
402 void
403 LinkStateRoutingTableCalculator::allocateParent()
404 {
405  m_parent = new int[m_nRouters];
406 }
407 
408 void
409 LinkStateRoutingTableCalculator::allocateDistance()
410 {
411  m_distance = new double[m_nRouters];
412 }
413 
414 void
415 LinkStateRoutingTableCalculator::freeParent()
416 {
417  delete [] m_parent;
418 }
419 
420 void LinkStateRoutingTableCalculator::freeDistance()
421 {
422  delete [] m_distance;
423 }
424 
425 const double HyperbolicRoutingCalculator::MATH_PI = boost::math::constants::pi<double>();
426 
427 const double HyperbolicRoutingCalculator::UNKNOWN_DISTANCE = -1.0;
428 const double HyperbolicRoutingCalculator::UNKNOWN_RADIUS = -1.0;
429 
430 void
432  Lsdb& lsdb, AdjacencyList& adjacencies)
433 {
434  NLSR_LOG_TRACE("Calculating hyperbolic paths");
435 
436  ndn::optional<int32_t> thisRouter = map.getMappingNoByRouterName(m_thisRouterName);
437 
438  // Iterate over directly connected neighbors
439  std::list<Adjacent> neighbors = adjacencies.getAdjList();
440  for (std::list<Adjacent>::iterator adj = neighbors.begin(); adj != neighbors.end(); ++adj) {
441 
442  // Don't calculate nexthops using an inactive router
443  if (adj->getStatus() == Adjacent::STATUS_INACTIVE) {
444  NLSR_LOG_TRACE(adj->getName() << " is inactive; not using it as a nexthop");
445  continue;
446  }
447 
448  ndn::Name srcRouterName = adj->getName();
449 
450  // Don't calculate nexthops for this router to other routers
451  if (srcRouterName == m_thisRouterName) {
452  continue;
453  }
454 
455  std::string srcFaceUri = adj->getFaceUri().toString();
456 
457  // Install nexthops for this router to the neighbor; direct neighbors have a 0 cost link
458  addNextHop(srcRouterName, srcFaceUri, 0, rt);
459 
460  ndn::optional<int32_t> src = map.getMappingNoByRouterName(srcRouterName);
461 
462  if (!src) {
463  NLSR_LOG_WARN(adj->getName() << " does not exist in the router map!");
464  continue;
465  }
466 
467  // Get hyperbolic distance from direct neighbor to every other router
468  for (int dest = 0; dest < static_cast<int>(m_nRouters); ++dest) {
469  // Don't calculate nexthops to this router or from a router to itself
470  if (thisRouter && dest != *thisRouter && dest != *src) {
471 
472  ndn::optional<ndn::Name> destRouterName = map.getRouterNameByMappingNo(dest);
473  if (destRouterName) {
474  double distance = getHyperbolicDistance(lsdb, srcRouterName, *destRouterName);
475 
476  // Could not compute distance
477  if (distance == UNKNOWN_DISTANCE) {
478  NLSR_LOG_WARN("Could not calculate hyperbolic distance from " << srcRouterName
479  << " to " << *destRouterName);
480  continue;
481  }
482  addNextHop(*destRouterName, srcFaceUri, distance, rt);
483  }
484  }
485  }
486  }
487 }
488 
489 double
490 HyperbolicRoutingCalculator::getHyperbolicDistance(Lsdb& lsdb, ndn::Name src, ndn::Name dest)
491 {
492  NLSR_LOG_TRACE("Calculating hyperbolic distance from " << src << " to " << dest);
493 
494  double distance = UNKNOWN_DISTANCE;
495 
496  ndn::Name srcLsaKey = src;
497  srcLsaKey.append(std::to_string(Lsa::Type::COORDINATE));
498 
499  CoordinateLsa* srcLsa = lsdb.findCoordinateLsa(srcLsaKey);
500 
501  ndn::Name destLsaKey = dest;
502  destLsaKey.append(std::to_string(Lsa::Type::COORDINATE));
503 
504  CoordinateLsa* destLsa = lsdb.findCoordinateLsa(destLsaKey);
505 
506  // Coordinate LSAs do not exist for these routers
507  if (srcLsa == nullptr || destLsa == nullptr) {
508  return UNKNOWN_DISTANCE;
509  }
510 
511  std::vector<double> srcTheta = srcLsa->getCorTheta();
512  std::vector<double> destTheta = destLsa->getCorTheta();
513 
514  double srcRadius = srcLsa->getCorRadius();
515  double destRadius = destLsa->getCorRadius();
516 
517  double diffTheta = calculateAngularDistance(srcTheta, destTheta);
518 
519  if (srcRadius == UNKNOWN_RADIUS || destRadius == UNKNOWN_RADIUS ||
520  diffTheta == UNKNOWN_DISTANCE) {
521  return UNKNOWN_DISTANCE;
522  }
523 
524  // double r_i, double r_j, double delta_theta, double zeta = 1 (default)
525  distance = calculateHyperbolicDistance(srcRadius, destRadius, diffTheta);
526 
527  NLSR_LOG_TRACE("Distance from " << src << " to " << dest << " is " << distance);
528 
529  return distance;
530 }
531 
532 double
533 HyperbolicRoutingCalculator::calculateAngularDistance(std::vector<double> angleVectorI,
534  std::vector<double> angleVectorJ)
535 {
536  // It is not possible for angle vector size to be zero as ensured by conf-file-processor
537 
538  // https://en.wikipedia.org/wiki/N-sphere#Spherical_coordinates
539 
540  // Check if two vector lengths are the same
541  if (angleVectorI.size() != angleVectorJ.size()) {
542  NLSR_LOG_ERROR("Angle vector sizes do not match");
543  return UNKNOWN_DISTANCE;
544  }
545 
546  // Check if all angles are within the [0, PI] and [0, 2PI] ranges
547  if (angleVectorI.size() > 1) {
548  for (unsigned int k = 0; k < angleVectorI.size() - 1; k++) {
549  if ((angleVectorI[k] > M_PI && angleVectorI[k] < 0.0) ||
550  (angleVectorJ[k] > M_PI && angleVectorJ[k] < 0.0)) {
551  NLSR_LOG_ERROR("Angle outside [0, PI]");
552  return UNKNOWN_DISTANCE;
553  }
554  }
555  }
556  if (angleVectorI[angleVectorI.size()-1] > 2.*M_PI ||
557  angleVectorI[angleVectorI.size()-1] < 0.0) {
558  NLSR_LOG_ERROR("Angle not within [0, 2PI]");
559  return UNKNOWN_DISTANCE;
560  }
561 
562  if (angleVectorI[angleVectorI.size()-1] > 2.*M_PI ||
563  angleVectorI[angleVectorI.size()-1] < 0.0) {
564  NLSR_LOG_ERROR("Angle not within [0, 2PI]");
565  return UNKNOWN_DISTANCE;
566  }
567 
568  // deltaTheta = arccos(vectorI . vectorJ) -> do the inner product
569  double innerProduct = 0.0;
570 
571  // Calculate x0 of the vectors
572  double x0i = std::cos(angleVectorI[0]);
573  double x0j = std::cos(angleVectorJ[0]);
574 
575  // Calculate xn of the vectors
576  double xni = std::sin(angleVectorI[angleVectorI.size() - 1]);
577  double xnj = std::sin(angleVectorJ[angleVectorJ.size() - 1]);
578 
579  // Do the aggregation of the (n-1) coordinates (if there is more than one angle)
580  // i.e contraction of all (n-1)-dimensional angular coordinates to one variable
581  for (unsigned int k = 0; k < angleVectorI.size() - 1; k++) {
582  xni *= std::sin(angleVectorI[k]);
583  xnj *= std::sin(angleVectorJ[k]);
584  }
585  innerProduct += (x0i * x0j) + (xni * xnj);
586 
587  // If d > 1
588  if (angleVectorI.size() > 1) {
589  for (unsigned int m = 1; m < angleVectorI.size(); m++) {
590  // calculate euclidean coordinates given the angles and assuming R_sphere = 1
591  double xmi = std::cos(angleVectorI[m]);
592  double xmj = std::cos(angleVectorJ[m]);
593  for (unsigned int l = 0; l < m; l++) {
594  xmi *= std::sin(angleVectorI[l]);
595  xmj *= std::sin(angleVectorJ[l]);
596  }
597  innerProduct += xmi * xmj;
598  }
599  }
600 
601  // ArcCos of the inner product gives the angular distance
602  // between two points on a d-dimensional sphere
603  return std::acos(innerProduct);
604 }
605 
606 double
607 HyperbolicRoutingCalculator::calculateHyperbolicDistance(double rI, double rJ,
608  double deltaTheta)
609 {
610  if (deltaTheta == UNKNOWN_DISTANCE) {
611  return UNKNOWN_DISTANCE;
612  }
613 
614  // Usually, we set zeta = 1 in all experiments
615  double zeta = 1;
616 
617  if (deltaTheta <= 0.0 || rI <= 0.0 || rJ <= 0.0) {
618  NLSR_LOG_ERROR("Delta theta or rI or rJ is <= 0");
619  NLSR_LOG_ERROR("Please make sure that no two nodes have the exact same HR coordinates");
620  return UNKNOWN_DISTANCE;
621  }
622 
623  double xij = (1. / zeta) * std::acosh(std::cosh(zeta*rI) * std::cosh(zeta*rJ) -
624  std::sinh(zeta*rI)*std::sinh(zeta*rJ)*std::cos(deltaTheta));
625  return xij;
626 }
627 
628 void
629 HyperbolicRoutingCalculator::addNextHop(ndn::Name dest, std::string faceUri,
630  double cost, RoutingTable& rt)
631 {
632  NextHop hop(faceUri, cost);
633  hop.setHyperbolic(true);
634 
635  NLSR_LOG_TRACE("Calculated " << hop << " for destination: " << dest);
636 
637  if (m_isDryRun) {
638  rt.addNextHopToDryTable(dest, hop);
639  }
640  else {
641  rt.addNextHop(dest, hop);
642  }
643 }
644 
645 } // namespace nlsr
void writeAdjMatrixLog(const Map &map) const
Writes a formated adjacent matrix to DEBUG log.
#define NLSR_LOG_WARN(x)
Definition: logger.hpp:40
A class to house all the configuration parameters for NLSR.
void getLinksFromAdjMatrix(int *links, double *linkCosts, int source)
Populates temp. variables with the link costs for some router.
ndn::optional< ndn::Name > getRouterNameByMappingNo(int32_t mn) const
Definition: map.cpp:48
void calculatePath(Map &map, RoutingTable &rt, Lsdb &lsdb, AdjacencyList &adjacencies)
const ndn::FaceUri & getFaceUri() const
Definition: adjacent.hpp:69
void allocateAdjMatrix()
Allocate the space needed for the adj. matrix.
void adjustAdMatrix(int source, int link, double linkCost)
Adjust a link cost in the adj. matrix.
static const double NON_ADJACENT_COST
Definition: adjacent.hpp:161
AdjacencyList & getAdjacencyList()
ndn::optional< int32_t > getMappingNoByRouterName(const ndn::Name &rName)
Definition: map.cpp:61
#define NLSR_LOG_DEBUG(x)
Definition: logger.hpp:38
const ndn::Name & getRouterPrefix() const
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
Adjacent getAdjacent(const ndn::Name &adjName)
#define INIT_LOGGER(name)
Definition: logger.hpp:35
void makeAdjMatrix(const std::list< AdjLsa > &adjLsaList, Map &pMap)
Constructs an adj. matrix to calculate with.
uint32_t getMaxFacesPerPrefix() const
void initMatrix()
set NON_ADJACENT_COST i.e. -12345 to every cell of the matrix to ensure that the memory is safe...
CoordinateLsa * findCoordinateLsa(const ndn::Name &key)
Finds a cor. LSA in the LSDB.
Definition: lsdb.cpp:383
#define NLSR_LOG_ERROR(x)
Definition: logger.hpp:41
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void calculatePath(Map &pMap, RoutingTable &rt, ConfParameter &confParam, const std::list< AdjLsa > &adjLsaList)
const std::vector< double > getCorTheta() const
Definition: lsa.hpp:346
void addNextHopToDryTable(const ndn::Name &destRouter, NextHop &nh)
Adds a next hop to a routing table entry in a dry run scenario.
int getNumOfLinkfromAdjMatrix(int sRouter)
Returns how many links a router in the matrix has.
void setHyperbolic(bool b)
void addNextHop(const ndn::Name &destRouter, NextHop &nh)
Adds a next hop to a routing table entry.
std::list< Adjacent > & getAdjList()
#define NLSR_LOG_TRACE(x)
Definition: logger.hpp:37
double getCorRadius() const
Definition: lsa.hpp:334