prefix-discovery: fetch routable-prefixes from /localhop/nfd
Change-Id: I77ddb51cf0f8bd298d2ccb32ccc62128465b290b
diff --git a/src/controller-backend.cpp b/src/controller-backend.cpp
index 771154a..df341c9 100644
--- a/src/controller-backend.cpp
+++ b/src/controller-backend.cpp
@@ -11,6 +11,7 @@
#include "controller-backend.hpp"
#ifndef Q_MOC_RUN
+#include <ndn-cxx/util/segment-fetcher.hpp>
#include "invitation.hpp"
#include "logging.h"
#endif
@@ -232,11 +233,11 @@
}
void
-ControllerBackend::onLocalPrefix(const Interest& interest, Data& data)
+ControllerBackend::onLocalPrefix(const ndn::ConstBufferPtr& data)
{
Name prefix;
- Block contentBlock = data.getContent();
+ Block contentBlock(tlv::Content, data);
try {
contentBlock.parse();
@@ -265,7 +266,7 @@
}
void
-ControllerBackend::onLocalPrefixTimeout(const Interest& interest)
+ControllerBackend::onLocalPrefixError(uint32_t code, const std::string& msg)
{
Name localPrefix("/private/local");
updateLocalPrefix(localPrefix);
@@ -335,14 +336,15 @@
void
ControllerBackend::onUpdateLocalPrefixAction()
{
- // Name interestName();
- Interest interest("/localhop/ndn-autoconf/routable-prefixes");
+ Interest interest("/localhop/nfd/rib/routable-prefixes");
interest.setInterestLifetime(time::milliseconds(1000));
interest.setMustBeFresh(true);
- m_face.expressInterest(interest,
- bind(&ControllerBackend::onLocalPrefix, this, _1, _2),
- bind(&ControllerBackend::onLocalPrefixTimeout, this, _1));
+ ndn::util::SegmentFetcher::fetch(m_face,
+ interest,
+ ndn::util::DontVerifySegment(),
+ bind(&ControllerBackend::onLocalPrefix, this, _1),
+ bind(&ControllerBackend::onLocalPrefixError, this, _1, _2));
}
void
diff --git a/src/controller-backend.hpp b/src/controller-backend.hpp
index a449aa4..d7bda46 100644
--- a/src/controller-backend.hpp
+++ b/src/controller-backend.hpp
@@ -77,10 +77,10 @@
std::string failureInfo);
void
- onLocalPrefix(const Interest& interest, Data& data);
+ onLocalPrefix(const ndn::ConstBufferPtr& data);
void
- onLocalPrefixTimeout(const Interest& interest);
+ onLocalPrefixError(uint32_t code, const std::string& msg);
void
updateLocalPrefix(const Name& localPrefix);