**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/publisher/dataset-interest-handler.cpp b/src/publisher/dataset-interest-handler.cpp
index f31cdbd..a574622 100644
--- a/src/publisher/dataset-interest-handler.cpp
+++ b/src/publisher/dataset-interest-handler.cpp
@@ -67,25 +67,8 @@
DatasetInterestHandler::publishAdjStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
ndn::mgmt::StatusDatasetContext& context)
{
- NLSR_LOG_DEBUG("Received interest: " << interest);
-
- auto lsaRange = std::make_pair<std::list<AdjLsa>::const_iterator,
- std::list<AdjLsa>::const_iterator>(
- m_lsdb.getAdjLsdb().cbegin(), m_lsdb.getAdjLsdb().cend());
- for (auto lsa = lsaRange.first; lsa != lsaRange.second; lsa++) {
- tlv::AdjacencyLsa tlvLsa;
- std::shared_ptr<tlv::LsaInfo> tlvLsaInfo = tlv::makeLsaInfo(*lsa);
- tlvLsa.setLsaInfo(*tlvLsaInfo);
-
- for (const Adjacent& adj : lsa->getAdl().getAdjList()) {
- tlv::Adjacency tlvAdj;
- tlvAdj.setName(adj.getName());
- tlvAdj.setUri(adj.getFaceUri().toString());
- tlvAdj.setCost(adj.getLinkCost());
- tlvLsa.addAdjacency(tlvAdj);
- }
- const ndn::Block& wire = tlvLsa.wireEncode();
- context.append(wire);
+ for (const auto& adjLsa : m_lsdb.getAdjLsdb()) {
+ context.append(adjLsa.wireEncode());
}
context.end();
}
@@ -94,21 +77,8 @@
DatasetInterestHandler::publishCoordinateStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
ndn::mgmt::StatusDatasetContext& context)
{
- auto lsaRange = std::make_pair<std::list<CoordinateLsa>::const_iterator,
- std::list<CoordinateLsa>::const_iterator>(
- m_lsdb.getCoordinateLsdb().cbegin(), m_lsdb.getCoordinateLsdb().cend());
-
- NLSR_LOG_DEBUG("Received interest: " << interest);
- for (auto lsa = lsaRange.first; lsa != lsaRange.second; lsa++) {
- tlv::CoordinateLsa tlvLsa;
- std::shared_ptr<tlv::LsaInfo> tlvLsaInfo = tlv::makeLsaInfo(*lsa);
- tlvLsa.setLsaInfo(*tlvLsaInfo);
-
- tlvLsa.setHyperbolicRadius(lsa->getCorRadius());
- tlvLsa.setHyperbolicAngle(lsa->getCorTheta());
-
- const ndn::Block& wire = tlvLsa.wireEncode();
- context.append(wire);
+ for (const auto& coordinateLsa : m_lsdb.getCoordinateLsdb()) {
+ context.append(coordinateLsa.wireEncode());
}
context.end();
}
@@ -117,21 +87,8 @@
DatasetInterestHandler::publishNameStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
ndn::mgmt::StatusDatasetContext& context)
{
- auto lsaRange = std::make_pair<std::list<NameLsa>::const_iterator, std::list<NameLsa>::const_iterator>(
- m_lsdb.getNameLsdb().cbegin(), m_lsdb.getNameLsdb().cend());
- NLSR_LOG_DEBUG("Received interest: " << interest);
- for (auto lsa = lsaRange.first; lsa != lsaRange.second; lsa++) {
- tlv::NameLsa tlvLsa;
-
- std::shared_ptr<tlv::LsaInfo> tlvLsaInfo = tlv::makeLsaInfo(*lsa);
- tlvLsa.setLsaInfo(*tlvLsaInfo);
-
- for (const ndn::Name& name : lsa->getNpl().getNames()) {
- tlvLsa.addName(name);
- }
-
- const ndn::Block& wire = tlvLsa.wireEncode();
- context.append(wire);
+ for (const auto& nameLsa : m_lsdb.getNameLsdb()) {
+ context.append(nameLsa.wireEncode());
}
context.end();
}