publisher: add LSDB dataset publishers
refs #2280
Change-Id: Ifb1920ef9b807610890b0d0a04f24141d39f011d
diff --git a/src/tlv/lsa-info.cpp b/src/tlv/lsa-info.cpp
index 5349c31..e81bdc9 100644
--- a/src/tlv/lsa-info.cpp
+++ b/src/tlv/lsa-info.cpp
@@ -170,5 +170,21 @@
return os;
}
+std::shared_ptr<LsaInfo>
+makeLsaInfo(const Lsa& lsa)
+{
+ std::shared_ptr<LsaInfo> lsaInfo = std::make_shared<LsaInfo>();
+
+ lsaInfo->setOriginRouter(lsa.getOrigRouter());
+ lsaInfo->setSequenceNumber(lsa.getLsSeqNo());
+
+ ndn::time::system_clock::duration duration
+ = lsa.getExpirationTimePoint() - ndn::time::system_clock::now();
+
+ lsaInfo->setExpirationPeriod(ndn::time::duration_cast<ndn::time::milliseconds>(duration));
+
+ return lsaInfo;
+}
+
} // namespace tlv
} // namespace nlsr
diff --git a/src/tlv/lsa-info.hpp b/src/tlv/lsa-info.hpp
index a5cf7bf..0cb186c 100644
--- a/src/tlv/lsa-info.hpp
+++ b/src/tlv/lsa-info.hpp
@@ -28,6 +28,8 @@
#include <ndn-cxx/encoding/tlv.hpp>
#include <ndn-cxx/name.hpp>
+#include "lsa.hpp"
+
namespace nlsr {
namespace tlv {
@@ -134,6 +136,9 @@
std::ostream&
operator<<(std::ostream& os, const LsaInfo& lsaInfo);
+std::shared_ptr<LsaInfo>
+makeLsaInfo(const Lsa& lsa);
+
} // namespace tlv
} // namespace nlsr