all: cleanup common.hpp and import typenames from ndn namespace.

This allows us to compile NFD in C++11 mode, making use of std::shared_ptr,
std::function, std::bind, etc. rather than their boost equivalents
(provided that ndn-cpp-dev is also compiled in C++11 mode). This is an
experimental feature and may not work properly.

Change-Id: I310529f78e1e428a8530b087983130d1ef3a9d88
diff --git a/daemon/common.hpp b/daemon/common.hpp
index e60dbc7..ec7a612 100644
--- a/daemon/common.hpp
+++ b/daemon/common.hpp
@@ -39,53 +39,42 @@
 #define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
 #endif
 
+#include <ndn-cpp-dev/common.hpp>
 #include <ndn-cpp-dev/interest.hpp>
 #include <ndn-cpp-dev/data.hpp>
 
-#include <boost/utility.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
-#include <boost/ref.hpp>
-#include <boost/asio.hpp>
 #include <boost/assert.hpp>
-#include <boost/functional/hash.hpp>
-#include <boost/algorithm/string.hpp>
 #include <boost/lexical_cast.hpp>
-
-#include <vector>
-#include <list>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <istream>
-#include <fstream>
-#include <algorithm>
-#include <numeric>
+#include <boost/noncopyable.hpp>
+#include <boost/ref.hpp>
+#include <boost/scoped_ptr.hpp>
 
 namespace nfd {
 
 using boost::noncopyable;
-using boost::shared_ptr;
-using boost::enable_shared_from_this;
-using boost::make_shared;
-using boost::static_pointer_cast;
-using boost::dynamic_pointer_cast;
-using boost::weak_ptr;
-using boost::function;
-using boost::bind;
+using boost::scoped_ptr;
+
+using ndn::shared_ptr;
+using ndn::weak_ptr;
+using ndn::enable_shared_from_this;
+using ndn::make_shared;
+using ndn::static_pointer_cast;
+using ndn::dynamic_pointer_cast;
+using ndn::const_pointer_cast;
+using ndn::function;
+using ndn::bind;
 
 using ndn::Interest;
 using ndn::Data;
 using ndn::Name;
-namespace name = ndn::name;
 using ndn::Exclude;
 using ndn::Block;
+
 namespace tlv {
 using namespace ndn::Tlv;
 }
 
+namespace name = ndn::name;
 namespace time = ndn::time;
 
 } // namespace nfd
diff --git a/daemon/core/version.hpp b/daemon/core/version.hpp
index df92064..79b0be7 100644
--- a/daemon/core/version.hpp
+++ b/daemon/core/version.hpp
@@ -25,8 +25,6 @@
 #ifndef NFD_CORE_VERSION_HPP
 #define NFD_CORE_VERSION_HPP
 
-#include "common.hpp"
-
 namespace nfd {
 
 /** NFD version follows Semantic Versioning 2.0.0 specification
diff --git a/daemon/mgmt/command-validator.cpp b/daemon/mgmt/command-validator.cpp
index 22b8257..ac08228 100644
--- a/daemon/mgmt/command-validator.cpp
+++ b/daemon/mgmt/command-validator.cpp
@@ -29,6 +29,7 @@
 #include <ndn-cpp-dev/security/identity-certificate.hpp>
 
 #include <boost/filesystem.hpp>
+#include <fstream>
 
 namespace nfd {
 
diff --git a/daemon/mgmt/config-file.cpp b/daemon/mgmt/config-file.cpp
index 4af6f91..3be86c9 100644
--- a/daemon/mgmt/config-file.cpp
+++ b/daemon/mgmt/config-file.cpp
@@ -26,6 +26,7 @@
 #include "core/logger.hpp"
 
 #include <boost/property_tree/info_parser.hpp>
+#include <fstream>
 
 namespace nfd {
 
@@ -33,7 +34,6 @@
 
 ConfigFile::ConfigFile()
 {
-
 }
 
 void
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 29f2b9e..95b01e0 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -23,16 +23,15 @@
  **/
 
 #include "face-manager.hpp"
-#include "face-flags.hpp"
 
+#include "face-flags.hpp"
 #include "core/logger.hpp"
 #include "core/face-uri.hpp"
 #include "core/network-interface.hpp"
 #include "fw/face-table.hpp"
 #include "face/tcp-factory.hpp"
 #include "face/udp-factory.hpp"
-
-#include <ndn-cpp-dev/management/nfd-face-event-notification.hpp>
+#include "mgmt/config-file.hpp"
 
 #ifdef HAVE_UNIX_SOCKETS
 #include "face/unix-stream-factory.hpp"
@@ -42,6 +41,8 @@
 #include "face/ethernet-factory.hpp"
 #endif // HAVE_PCAP
 
+#include <ndn-cpp-dev/management/nfd-face-event-notification.hpp>
+
 namespace nfd {
 
 NFD_LOG_INIT("FaceManager");
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index e0b4c6c..d1ba482 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -26,14 +26,10 @@
 #define NFD_MGMT_FACE_MANAGER_HPP
 
 #include "common.hpp"
-#include "face/face.hpp"
 #include "face/local-face.hpp"
-#include "mgmt/app-face.hpp"
 #include "mgmt/manager-base.hpp"
-#include "mgmt/config-file.hpp"
 #include "mgmt/face-status-publisher.hpp"
 #include "mgmt/notification-stream.hpp"
-#include "fw/face-table.hpp"
 
 #include <ndn-cpp-dev/management/nfd-control-parameters.hpp>
 #include <ndn-cpp-dev/management/nfd-control-response.hpp>
@@ -42,9 +38,12 @@
 
 const std::string FACE_MANAGER_PRIVILEGE = "faces";
 
-class ProtocolFactory;
-class NetworkInterfaceInfo;
+class ConfigFile;
+class Face;
+class FaceTable;
 class LocalFace;
+class NetworkInterfaceInfo;
+class ProtocolFactory;
 
 class FaceManager : public ManagerBase
 {
diff --git a/daemon/mgmt/face-status-publisher.cpp b/daemon/mgmt/face-status-publisher.cpp
index 2dc62d6..3e0ec42 100644
--- a/daemon/mgmt/face-status-publisher.cpp
+++ b/daemon/mgmt/face-status-publisher.cpp
@@ -25,6 +25,8 @@
 #include "face-status-publisher.hpp"
 #include "face-flags.hpp"
 #include "core/logger.hpp"
+#include "fw/face-table.hpp"
+
 #include <ndn-cpp-dev/management/nfd-face-status.hpp>
 
 namespace nfd {
diff --git a/daemon/mgmt/face-status-publisher.hpp b/daemon/mgmt/face-status-publisher.hpp
index 17e758d..7013ae7 100644
--- a/daemon/mgmt/face-status-publisher.hpp
+++ b/daemon/mgmt/face-status-publisher.hpp
@@ -25,11 +25,12 @@
 #ifndef NFD_MGMT_FACE_STATUS_PUBLISHER_HPP
 #define NFD_MGMT_FACE_STATUS_PUBLISHER_HPP
 
-#include "fw/face-table.hpp"
 #include "mgmt/segment-publisher.hpp"
 
 namespace nfd {
 
+class FaceTable;
+
 class FaceStatusPublisher : public SegmentPublisher
 {
 public:
diff --git a/daemon/mgmt/fib-enumeration-publisher.cpp b/daemon/mgmt/fib-enumeration-publisher.cpp
index cf40d87..daa5908 100644
--- a/daemon/mgmt/fib-enumeration-publisher.cpp
+++ b/daemon/mgmt/fib-enumeration-publisher.cpp
@@ -23,8 +23,8 @@
  **/
 
 #include "fib-enumeration-publisher.hpp"
-
 #include "core/logger.hpp"
+#include "table/fib.hpp"
 
 #include <ndn-cpp-dev/management/nfd-fib-entry.hpp>
 
@@ -38,12 +38,10 @@
   : SegmentPublisher(face, prefix)
   , m_fib(fib)
 {
-
 }
 
 FibEnumerationPublisher::~FibEnumerationPublisher()
 {
-
 }
 
 size_t
diff --git a/daemon/mgmt/fib-enumeration-publisher.hpp b/daemon/mgmt/fib-enumeration-publisher.hpp
index 7a33482..0baf3bc 100644
--- a/daemon/mgmt/fib-enumeration-publisher.hpp
+++ b/daemon/mgmt/fib-enumeration-publisher.hpp
@@ -25,11 +25,12 @@
 #ifndef NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
 #define NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
 
-#include "table/fib.hpp"
 #include "mgmt/segment-publisher.hpp"
 
 namespace nfd {
 
+class Fib;
+
 class FibEnumerationPublisher : public SegmentPublisher
 {
 public:
diff --git a/daemon/mgmt/fib-manager.hpp b/daemon/mgmt/fib-manager.hpp
index eef58fa..4c3bf8d 100644
--- a/daemon/mgmt/fib-manager.hpp
+++ b/daemon/mgmt/fib-manager.hpp
@@ -26,14 +26,12 @@
 #define NFD_MGMT_FIB_MANAGER_HPP
 
 #include "common.hpp"
-#include "face/face.hpp"
-#include "mgmt/app-face.hpp"
-#include "fw/strategy.hpp"
 #include "mgmt/manager-base.hpp"
 #include "mgmt/fib-enumeration-publisher.hpp"
 
 namespace nfd {
 
+class Face;
 class Forwarder;
 class Fib;
 
diff --git a/daemon/table/cs.hpp b/daemon/table/cs.hpp
index a1769ea..f52585b 100644
--- a/daemon/table/cs.hpp
+++ b/daemon/table/cs.hpp
@@ -36,8 +36,7 @@
 #include <boost/multi_index/sequenced_index.hpp>
 #include <boost/multi_index/identity.hpp>
 
-using namespace ::boost;
-using namespace ::boost::multi_index;
+#include <queue>
 
 namespace nfd {
 
@@ -69,26 +68,26 @@
 class byStaleness;
 class byArrival;
 
-typedef multi_index_container<
+typedef boost::multi_index_container<
   cs::Entry*,
-  indexed_by<
+  boost::multi_index::indexed_by<
 
     // by arrival (FIFO)
-    sequenced<
-      tag<byArrival>
+    boost::multi_index::sequenced<
+      boost::multi_index::tag<byArrival>
     >,
 
     // index by staleness time
-    ordered_non_unique<
-      tag<byStaleness>,
-      identity<cs::Entry*>,
+    boost::multi_index::ordered_non_unique<
+      boost::multi_index::tag<byStaleness>,
+      boost::multi_index::identity<cs::Entry*>,
       StalenessComparator
     >,
 
     // unsolicited Data is in the front
-    ordered_non_unique<
-      tag<unsolicited>,
-      identity<cs::Entry*>,
+    boost::multi_index::ordered_non_unique<
+      boost::multi_index::tag<unsolicited>,
+      boost::multi_index::identity<cs::Entry*>,
       UnsolicitedComparator
     >
 
diff --git a/daemon/table/name-tree.cpp b/daemon/table/name-tree.cpp
index c4380ce..101014a 100644
--- a/daemon/table/name-tree.cpp
+++ b/daemon/table/name-tree.cpp
@@ -27,6 +27,8 @@
 #include "name-tree.hpp"
 #include "core/logger.hpp"
 
+#include <boost/functional/hash.hpp>
+
 namespace nfd {
 
 NFD_LOG_INIT("NameTree");