src: Update source code to use new API and fix compilation errors due to missing headers

Change-Id: I295fbcdcd6ab114a565d9b7531387728a6596884
Refs: 1629
diff --git a/tools/ndngetfile.cpp b/tools/ndngetfile.cpp
index 2a26962..fd9dc6a 100644
--- a/tools/ndngetfile.cpp
+++ b/tools/ndngetfile.cpp
@@ -19,6 +19,7 @@
 
 #include "ndngetfile.hpp"
 #include <boost/lexical_cast.hpp>
+#include <fstream>
 
 namespace repo {
 
diff --git a/tools/ndnputfile.cpp b/tools/ndnputfile.cpp
index 1c56934..2103eb1 100644
--- a/tools/ndnputfile.cpp
+++ b/tools/ndnputfile.cpp
@@ -22,12 +22,15 @@
 
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
 #include <ndn-cxx/util/command-interest-generator.hpp>
 #include <fstream>
 #include <string>
 #include <stdlib.h>
+#include <stdint.h>
 #include <boost/filesystem.hpp>
-
+#include <boost/lexical_cast.hpp>
+#include <boost/asio.hpp>
 #include <boost/iostreams/operations.hpp>
 #include <boost/iostreams/read.hpp>
 
@@ -97,6 +100,9 @@
   onSingleInterest(const ndn::Name& prefix, const ndn::Interest& interest);
 
   void
+  onRegisterSuccess(const ndn::Name& prefix);
+
+  void
   onRegisterFailed(const ndn::Name& prefix, const std::string& reason);
 
   void
@@ -212,13 +218,9 @@
                              ndn::bind(&NdnPutFile::onSingleInterest, this, _1, _2)
                              :
                              ndn::bind(&NdnPutFile::onInterest, this, _1, _2),
+                           ndn::bind(&NdnPutFile::onRegisterSuccess, this, _1),
                            ndn::bind(&NdnPutFile::onRegisterFailed, this, _1, _2));
 
-  // @todo Move startCommand
-  // setInterestFilter doesn't currently have "onSuccess" callback,
-  // so insertCommand needs to be started right away
-  startInsertCommand();
-
   if (hasTimeout)
     m_scheduler.scheduleEvent(timeout, ndn::bind(&NdnPutFile::stopProcess, this));
 
@@ -226,6 +228,12 @@
 }
 
 void
+NdnPutFile::onRegisterSuccess(const Name& prefix)
+{
+  startInsertCommand();
+}
+
+void
 NdnPutFile::startInsertCommand()
 {
   RepoCommandParameter parameters;