**breaking** route: consolidate routing tlv into route
refs: #5116
Plus some misc improvements
Change-Id: Id0902fec65160b4368b1b5066f460433aced98ed
diff --git a/tools/nlsrc.cpp b/tools/nlsrc.cpp
index a943b85..b54eb43 100644
--- a/tools/nlsrc.cpp
+++ b/tools/nlsrc.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "nlsrc.hpp"
@@ -273,10 +273,7 @@
void
Nlsrc::fetchRtables()
{
- fetchFromRt<nlsr::tlv::RoutingTableStatus>(
- [this] (const nlsr::tlv::RoutingTableStatus& rts) {
- recordRtable(rts);
- });
+ fetchFromRt<nlsr::RoutingTableStatus>([this] (const auto& rts) { recordRtable(rts); });
}
template <class T>
@@ -373,24 +370,10 @@
}
void
-Nlsrc::recordRtable(const nlsr::tlv::RoutingTableStatus& rts)
+Nlsrc::recordRtable(const nlsr::RoutingTableStatus& rts)
{
std::ostringstream os;
-
- ndn::Name firstDes;
- for (const auto& rt : rts.getRoutingtable()) {
- if (firstDes.empty()) {
- firstDes = rt.getDestination().getName();
- os << rt << std::endl;
- continue;
- }
-
- if (firstDes == rt.getDestination().getName()) {
- os << "\n------Dry-run Hyperbolic Routing Tables:------- \n " << std::endl;
- }
- os << rt << std::endl;
- }
-
+ os << rts;
m_rtString = os.str();
}
@@ -423,8 +406,7 @@
Nlsrc::printRT()
{
if (!m_rtString.empty()) {
- std::cout << "Routing Table" << std::endl;
- std::cout << m_rtString << std::endl;
+ std::cout << m_rtString;
}
else {
std::cout << "Routing Table is not calculated yet" << std::endl;
diff --git a/tools/nlsrc.hpp b/tools/nlsrc.hpp
index aab636c..938e82c 100644
--- a/tools/nlsrc.hpp
+++ b/tools/nlsrc.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
@@ -17,12 +17,12 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "lsa/adj-lsa.hpp"
#include "lsa/coordinate-lsa.hpp"
#include "lsa/name-lsa.hpp"
-#include "tlv/routing-table-status.hpp"
+#include "route/routing-table.hpp"
#include <boost/noncopyable.hpp>
#include <ndn-cxx/face.hpp>
@@ -123,7 +123,7 @@
recordLsa(const nlsr::Lsa& lsa);
void
- recordRtable(const nlsr::tlv::RoutingTableStatus& rts);
+ recordRtable(const nlsr::RoutingTableStatus& rts);
void
printLsdb();