src: Recreating face in case of face deletion by NFD
Change-Id: Idd1d0b7f521e574ace38d6f671a682622d98209d
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index dd56c1b..c3b4795 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -30,6 +30,7 @@
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/certificate-cache-ttl.hpp>
#include <ndn-cxx/util/scheduler.hpp>
+#include <ndn-cxx/management/nfd-face-event-notification.hpp>
#include "conf-parameter.hpp"
#include "adjacency-list.hpp"
@@ -41,6 +42,7 @@
#include "route/fib.hpp"
#include "communication/sync-logic-handler.hpp"
#include "hello-protocol.hpp"
+#include "face-monitor.hpp"
#include "validator.hpp"
@@ -62,10 +64,6 @@
};
public:
- typedef ndn::function<void(const ndn::nfd::ControlParameters&)> CommandSucceedCallback;
-
- typedef ndn::function<void(uint32_t/*code*/,const std::string&/*reason*/)> CommandFailCallback;
-
Nlsr()
: m_scheduler(m_nlsrFace.getIoService())
, m_confParam()
@@ -88,9 +86,8 @@
, m_certificateCache(new ndn::CertificateCacheTtl(m_nlsrFace.getIoService()))
, m_validator(m_nlsrFace, DEFAULT_BROADCAST_PREFIX, m_certificateCache)
- , m_controller(m_nlsrFace)
- , m_nFacesToCreate(0)
- , m_nFacesCreated(0)
+ , m_faceMonitor(m_nlsrFace.getIoService(),
+ ndn::bind(&Nlsr::onFaceEventNotification, this, _1))
{}
void
@@ -272,9 +269,6 @@
initialize();
void
- start();
-
- void
intializeKey();
void
@@ -333,7 +327,7 @@
private:
void
- registerPrefixes();
+ setStrategies();
void
registerKeyPrefix();
@@ -345,25 +339,13 @@
onKeyPrefixRegSuccess(const ndn::Name& name);
void
- onCreateFaceSuccess(const ndn::nfd::ControlParameters& commandSuccessResult);
-
- void
- onCreateFaceFailure(int32_t code, const std::string& error);
-
- void
- createFaces();
-
- void
onDestroyFaceSuccess(const ndn::nfd::ControlParameters& commandSuccessResult);
void
onDestroyFaceFailure(int32_t code, const std::string& error);
void
- destroyFace(const std::string& faceUri);
-
- void
- destroyFaceInNfd(const ndn::nfd::ControlParameters& faceDestroyResult);
+ onFaceEventNotification(const ndn::nfd::FaceEventNotification& faceEventNotification);
private:
typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > CertMap;
@@ -395,9 +377,7 @@
ndn::Name m_defaultIdentity;
ndn::Name m_defaultCertName;
- ndn::nfd::Controller m_controller;
- int32_t m_nFacesToCreate;
- int32_t m_nFacesCreated;
+ FaceMonitor m_faceMonitor;
};
} //namespace nlsr