rib: remote prefix registration
resolve 3 bugs:
There are redundant registrations/unregistrations if loading the
config file multiple times.
Remote registration/unregistration will fail if localhop_security
is enabled.
Unstable RemoteRegistrator/UnregisterAdvanced test case.
Change-Id: I4437292e9f6c0e340c761ef7556a9bdc703ac06c
refs: #2294
diff --git a/rib/remote-registrator.hpp b/rib/remote-registrator.hpp
index 41be218..0d9eea3 100644
--- a/rib/remote-registrator.hpp
+++ b/rib/remote-registrator.hpp
@@ -36,6 +36,7 @@
#include <ndn-cxx/management/nfd-control-command.hpp>
#include <ndn-cxx/management/nfd-control-parameters.hpp>
#include <ndn-cxx/management/nfd-command-options.hpp>
+#include <ndn-cxx/util/signal.hpp>
namespace nfd {
namespace rib {
@@ -72,6 +73,20 @@
loadConfig(const ConfigSection& configSection);
/**
+ * @brief enable remote registration/unregistration.
+ *
+ */
+ void
+ enable();
+
+ /**
+ * @brief disable remote registration/unregistration.
+ *
+ */
+ void
+ disable();
+
+ /**
* @brief register a prefix to remote hub(s).
*
* For the input prefix, we find the longest identity
@@ -197,7 +212,6 @@
void
clearRefreshEvents();
-
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
* When a locally registered prefix triggles remote
@@ -217,16 +231,17 @@
ndn::nfd::Controller& m_nfdController;
ndn::KeyChain& m_keyChain;
Rib& m_rib;
-
+ ndn::util::signal::ScopedConnection m_afterInsertConnection;
+ ndn::util::signal::ScopedConnection m_afterEraseConnection;
ndn::nfd::ControlParameters m_controlParameters;
ndn::nfd::CommandOptions m_commandOptions;
time::seconds m_refreshInterval;
bool m_hasConnectedHub;
int m_nRetries;
- static const Name RM_LOCAL_PREFIX; // /localhost
- static const Name RM_HUB_PREFIX; // /localhop/nfd
- static const name::Component RM_IGNORE_COMMPONENT; // rib
+ static const Name LOCAL_REGISTRATION_PREFIX; // /localhost
+ static const Name REMOTE_HUB_PREFIX; // /localhop/nfd/rib
+ static const name::Component IGNORE_COMMPONENT; // rib
};
} // namespace rib