src: Updating code to compile with the latest ndn-cxx library
This commit includes updates against the latest Face API and replaces
uses of deprecated methods.
Change-Id: I33ad398d26f8faf9f9627ff329ce0936e0911ab2
diff --git a/tools/ndn-autoconfig-server.cpp b/tools/ndn-autoconfig-server.cpp
index 9873bde..bc038e3 100644
--- a/tools/ndn-autoconfig-server.cpp
+++ b/tools/ndn-autoconfig-server.cpp
@@ -77,6 +77,7 @@
{
m_face.setInterestFilter("/localhop/ndn-autoconf/hub",
ndn::bind(&NdnAutoconfigServer::onInterest, this, _1, _2),
+ ndn::RegisterPrefixSuccessCallback(),
ndn::bind(&NdnAutoconfigServer::onRegisterFailed, this, _1, _2));
m_face.processEvents();
}
diff --git a/tools/ndn-autoconfig.cpp b/tools/ndn-autoconfig.cpp
index fe8ce19..c996566 100644
--- a/tools/ndn-autoconfig.cpp
+++ b/tools/ndn-autoconfig.cpp
@@ -28,6 +28,8 @@
#include <ndn-cxx/management/nfd-controller.hpp>
#include <ndn-cxx/security/key-chain.hpp>
+#include <boost/lexical_cast.hpp>
+
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
@@ -155,7 +157,7 @@
for (ndn::Name::const_reverse_iterator i = identity.rbegin(); i != identity.rend(); i++)
{
- serverName.append(i->toEscapedString());
+ serverName.append(i->toUri());
serverName.append(".");
}
serverName += "_homehub._autoconf.named-data.net";
diff --git a/tools/ndn-tlv-peek.cpp b/tools/ndn-tlv-peek.cpp
index ec0a9b0..dc70175 100644
--- a/tools/ndn-tlv-peek.cpp
+++ b/tools/ndn-tlv-peek.cpp
@@ -47,8 +47,6 @@
, m_timeout(-1)
, m_prefixName("")
, m_isDataReceived(false)
- , m_ioService(new boost::asio::io_service)
- , m_face(m_ioService)
{
}
@@ -221,7 +219,6 @@
ndn::time::milliseconds m_timeout;
std::string m_prefixName;
bool m_isDataReceived;
- ndn::ptr_lib::shared_ptr<boost::asio::io_service> m_ioService;
ndn::Face m_face;
};
@@ -230,8 +227,8 @@
int
main(int argc, char* argv[])
{
+ ndntlvpeek::NdnTlvPeek ndnTlvPeek(argv[0]);
int option;
- ndntlvpeek::NdnTlvPeek ndnTlvPeek (argv[0]);
while ((option = getopt(argc, argv, "hfrm:M:l:pw:V")) != -1) {
switch (option) {
case 'h':
diff --git a/tools/ndn-tlv-poke.cpp b/tools/ndn-tlv-poke.cpp
index f90b735..3f5a3b6 100644
--- a/tools/ndn-tlv-poke.cpp
+++ b/tools/ndn-tlv-poke.cpp
@@ -188,6 +188,7 @@
m_face.setInterestFilter(m_prefixName,
ndn::bind(&NdnTlvPoke::onInterest,
this, _1, _2, dataPacket),
+ ndn::RegisterPrefixSuccessCallback(),
ndn::bind(&NdnTlvPoke::onRegisterFailed,
this, _1, _2));
}
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index 3d8dc98..a219e62 100644
--- a/tools/nfd-autoreg.cpp
+++ b/tools/nfd-autoreg.cpp
@@ -229,7 +229,7 @@
bind(&AutoregServer::onNotification, this, _2),
bind(&AutoregServer::onTimeout, this, _1));
- boost::asio::signal_set signalSet(*m_face.ioService(), SIGINT, SIGTERM);
+ boost::asio::signal_set signalSet(m_face.getIoService(), SIGINT, SIGTERM);
signalSet.async_wait(bind(&AutoregServer::signalHandler, this));
m_face.processEvents();
diff --git a/tools/nfd-status.cpp b/tools/nfd-status.cpp
index 1792961..57930e0 100644
--- a/tools/nfd-status.cpp
+++ b/tools/nfd-status.cpp
@@ -30,11 +30,14 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/encoding/buffer-stream.hpp>
#include <ndn-cxx/management/nfd-fib-entry.hpp>
#include <ndn-cxx/management/nfd-face-status.hpp>
#include <ndn-cxx/management/nfd-forwarder-status.hpp>
+#include <boost/algorithm/string/replace.hpp>
+
namespace ndn {
class NfdStatus
diff --git a/tools/nfdc.hpp b/tools/nfdc.hpp
index 787ca26..537667e 100644
--- a/tools/nfdc.hpp
+++ b/tools/nfdc.hpp
@@ -27,7 +27,6 @@
#define NFD_TOOLS_NFDC_HPP
#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/management/controller.hpp>
#include <ndn-cxx/management/nfd-controller.hpp>
namespace nfdc {