update: Process Name prefix update commands
refs #1834
Change-Id: I18c86d0743b4a10ce3a8681f202b59a86602e43f
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 1b7527d..8893272 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -45,7 +45,8 @@
#include "hello-protocol.hpp"
#include "test-access-control.hpp"
#include "publisher/lsdb-dataset-interest-handler.hpp"
-
+#include "utility/name-helper.hpp"
+#include "update/prefix-update-processor.hpp"
#include "validator.hpp"
@@ -87,6 +88,13 @@
, m_helloProtocol(*this, scheduler)
, m_certificateCache(new ndn::CertificateCacheTtl(ioService))
, m_validator(m_nlsrFace, DEFAULT_BROADCAST_PREFIX, m_certificateCache)
+ , m_prefixUpdateProcessor(m_nlsrFace,
+ m_namePrefixList,
+ m_nlsrLsdb,
+ m_syncLogicHandler,
+ DEFAULT_BROADCAST_PREFIX,
+ m_keyChain,
+ m_certificateCache)
, m_faceMonitor(m_nlsrFace)
, m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT)
{
@@ -101,6 +109,9 @@
onRegistrationSuccess(const ndn::Name& name);
void
+ onLocalhostRegistrationSuccess(const ndn::Name& name);
+
+ void
setInfoInterestFilter();
void
@@ -302,6 +313,12 @@
return m_defaultCertName;
}
+ update::PrefixUpdateProcessor&
+ getPrefixUpdateProcessor()
+ {
+ return m_prefixUpdateProcessor;
+ }
+
void
createFace(const std::string& faceUri,
const CommandSucceedCallback& onSuccess,
@@ -322,11 +339,23 @@
return m_firstHelloInterval;
}
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+ void
+ addCertificateToCache(ndn::shared_ptr<ndn::IdentityCertificate> certificate)
+ {
+ if (certificate != nullptr) {
+ m_certificateCache->insertCertificate(certificate);
+ }
+ }
+
private:
void
registerKeyPrefix();
void
+ registerLocalhostPrefix();
+
+ void
onKeyInterest(const ndn::Name& name, const ndn::Interest& interest);
void
@@ -347,6 +376,9 @@
m_firstHelloInterval = interval;
}
+public:
+ static const ndn::Name LOCALHOST_PREFIX;
+
private:
typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > CertMap;
@@ -377,6 +409,7 @@
ndn::KeyChain m_keyChain;
ndn::Name m_defaultIdentity;
ndn::Name m_defaultCertName;
+ update::PrefixUpdateProcessor m_prefixUpdateProcessor;
ndn::nfd::FaceMonitor m_faceMonitor;