**breaking** consolidate src/tlv/*lsa* into src/lsa/*lsa*
Lsa de/serialize functions are replaced by wireEncode/Decode.
Update LSA wire formats. Change TLV assignments as required.
Update nlsrc to print using new encoding.
refs: #4787
Change-Id: Ie8d40b7836d51ea5bb444c8db208dc2b3a0d1cec
diff --git a/src/route/fib-entry.hpp b/src/route/fib-entry.hpp
index 248c0fd..e5542e1 100644
--- a/src/route/fib-entry.hpp
+++ b/src/route/fib-entry.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index cd2b28c..90cddee 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index 25677e3..ba4d87b 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
diff --git a/src/route/map.cpp b/src/route/map.cpp
index f5f928e..3f6513c 100644
--- a/src/route/map.cpp
+++ b/src/route/map.cpp
@@ -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-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -21,7 +21,7 @@
#include "map.hpp"
#include "nlsr.hpp"
#include "adjacent.hpp"
-#include "lsa.hpp"
+#include "lsa/lsa.hpp"
#include "lsdb.hpp"
#include "logger.hpp"
diff --git a/src/route/map.hpp b/src/route/map.hpp
index b4aa396..c9511bf 100644
--- a/src/route/map.hpp
+++ b/src/route/map.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -24,7 +24,6 @@
#include "common.hpp"
#include "map-entry.hpp"
-#include <iostream>
#include <list>
#include <boost/cstdint.hpp>
@@ -81,7 +80,7 @@
{
BOOST_STATIC_ASSERT_MSG(is_iterator<IteratorType>::value, "IteratorType must be an iterator!");
for (auto lsa = begin; lsa != end; lsa++) {
- addEntry(lsa->getOrigRouter());
+ addEntry(lsa->getOriginRouter());
for (const auto& adjacent : lsa->getAdl().getAdjList()) {
addEntry(adjacent.getName());
}
@@ -98,7 +97,7 @@
{
BOOST_STATIC_ASSERT_MSG(is_iterator<IteratorType>::value, "IteratorType must be an iterator!");
for (auto lsa = begin; lsa != end; lsa++) {
- addEntry(lsa->getOrigRouter());
+ addEntry(lsa->getOriginRouter());
}
}
diff --git a/src/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index 65e935c..b38bbea 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
diff --git a/src/route/name-prefix-table.hpp b/src/route/name-prefix-table.hpp
index 8349453..370e515 100644
--- a/src/route/name-prefix-table.hpp
+++ b/src/route/name-prefix-table.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
diff --git a/src/route/nexthop-list.hpp b/src/route/nexthop-list.hpp
index d9f60f4..e405889 100644
--- a/src/route/nexthop-list.hpp
+++ b/src/route/nexthop-list.hpp
@@ -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-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -24,10 +24,8 @@
#include "nexthop.hpp"
#include "adjacent.hpp"
-#include <set>
-#include <iostream>
-#include <boost/cstdint.hpp>
#include <ndn-cxx/face.hpp>
+#include <set>
namespace nlsr {
diff --git a/src/route/nexthop.hpp b/src/route/nexthop.hpp
index 4b41308..e24df7b 100644
--- a/src/route/nexthop.hpp
+++ b/src/route/nexthop.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2017, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -17,8 +17,9 @@
* 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/>.
**/
-#ifndef NLSR_NEXTHOP_HPP
-#define NLSR_NEXTHOP_HPP
+
+#ifndef NLSR_ROUTE_NEXTHOP_HPP
+#define NLSR_ROUTE_NEXTHOP_HPP
#include "test-access-control.hpp"
@@ -27,6 +28,7 @@
#include <boost/cstdint.hpp>
namespace nlsr {
+
class NextHop
{
public:
@@ -121,4 +123,4 @@
} // namespace nlsr
-#endif //NLSR_NEXTHOP_HPP
+#endif // NLSR_ROUTE_NEXTHOP_HPP
diff --git a/src/route/routing-table-calculator.cpp b/src/route/routing-table-calculator.cpp
index eb821e8..04cc78f 100644
--- a/src/route/routing-table-calculator.cpp
+++ b/src/route/routing-table-calculator.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -27,7 +27,6 @@
#include "logger.hpp"
#include "adjacent.hpp"
-#include <iostream>
#include <boost/math/constants/constants.hpp>
#include <ndn-cxx/util/logger.hpp>
#include <cmath>
@@ -66,7 +65,7 @@
{
// For each LSA represented in the map
for (const auto& adjLsa : adjLsaList) {
- ndn::optional<int32_t> row = pMap.getMappingNoByRouterName(adjLsa.getOrigRouter());
+ ndn::optional<int32_t> row = pMap.getMappingNoByRouterName(adjLsa.getOriginRouter());
std::list<Adjacent> adl = adjLsa.getAdl().getAdjList();
// For each adjacency represented in the LSA
@@ -499,12 +498,12 @@
double distance = UNKNOWN_DISTANCE;
ndn::Name srcLsaKey = src;
- srcLsaKey.append(std::to_string(Lsa::Type::COORDINATE));
+ srcLsaKey.append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE));
CoordinateLsa* srcLsa = lsdb.findCoordinateLsa(srcLsaKey);
ndn::Name destLsaKey = dest;
- destLsaKey.append(std::to_string(Lsa::Type::COORDINATE));
+ destLsaKey.append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE));
CoordinateLsa* destLsa = lsdb.findCoordinateLsa(destLsaKey);
diff --git a/src/route/routing-table-calculator.hpp b/src/route/routing-table-calculator.hpp
index 683eb58..16d64d7 100644
--- a/src/route/routing-table-calculator.hpp
+++ b/src/route/routing-table-calculator.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -23,11 +23,11 @@
#define NLSR_ROUTING_TABLE_CALCULATOR_HPP
#include "common.hpp"
-#include "lsa.hpp"
+#include "lsa/lsa.hpp"
+#include "lsa/adj-lsa.hpp"
#include "conf-parameter.hpp"
#include <list>
-#include <iostream>
#include <boost/cstdint.hpp>
#include <ndn-cxx/name.hpp>
diff --git a/src/route/routing-table-entry.hpp b/src/route/routing-table-entry.hpp
index fd98c32..83731b9 100644
--- a/src/route/routing-table-entry.hpp
+++ b/src/route/routing-table-entry.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -24,7 +24,6 @@
#include "nexthop-list.hpp"
-#include <iostream>
#include <ndn-cxx/name.hpp>
namespace nlsr {
diff --git a/src/route/routing-table-pool-entry.cpp b/src/route/routing-table-pool-entry.cpp
index 9102ed0..b214535 100644
--- a/src/route/routing-table-pool-entry.cpp
+++ b/src/route/routing-table-pool-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
diff --git a/src/route/routing-table-pool-entry.hpp b/src/route/routing-table-pool-entry.hpp
index 14e7c7d..48212c3 100644
--- a/src/route/routing-table-pool-entry.hpp
+++ b/src/route/routing-table-pool-entry.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2017, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -25,7 +25,6 @@
#include "routing-table-entry.hpp"
#include "nexthop-list.hpp"
-#include <iostream>
#include <ndn-cxx/name.hpp>
#include <unordered_map>
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 60b05f9..3fcd654 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -64,12 +64,12 @@
if ((!isHrEnabled &&
m_lsdb
.doesLsaExist(ndn::Name{m_confParam.getRouterPrefix()}
- .append(std::to_string(Lsa::Type::ADJACENCY)), Lsa::Type::ADJACENCY))
+ .append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY)), Lsa::Type::ADJACENCY))
||
(isHrEnabled &&
m_lsdb
.doesLsaExist(ndn::Name{m_confParam.getRouterPrefix()}
- .append(std::to_string(Lsa::Type::COORDINATE)), Lsa::Type::COORDINATE))) {
+ .append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE)), Lsa::Type::COORDINATE))) {
if (m_lsdb.getIsBuildAdjLsaSheduled() != 1) {
NLSR_LOG_TRACE("Clearing old routing table");
clearRoutingTable();
diff --git a/src/route/routing-table.hpp b/src/route/routing-table.hpp
index c149eb7..af2ba93 100644
--- a/src/route/routing-table.hpp
+++ b/src/route/routing-table.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -28,9 +28,6 @@
#include "lsdb.hpp"
#include "route/fib.hpp"
-#include <iostream>
-#include <utility>
-#include <string>
#include <boost/cstdint.hpp>
#include <ndn-cxx/util/scheduler.hpp>