src: Reorganizing source code in preparation to merge NRD code

Note that as of this commit, there are several changes in location of
compiled binaries in `build/` folder:

* `nfd` has been moved to `build/bin/nfd`
* `unit-tests` has been split into `unit-tests-core` and `unit-tests-daemon`

Change-Id: I2c830c117879edbaa5457d6423c13f0273285919
Refs: #1486
diff --git a/daemon/mgmt/app-face.hpp b/daemon/mgmt/app-face.hpp
index 79513aa..1539b9e 100644
--- a/daemon/mgmt/app-face.hpp
+++ b/daemon/mgmt/app-face.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_APP_FACE_HPP
-#define NFD_MGMT_APP_FACE_HPP
+#ifndef NFD_DAEMON_MGMT_APP_FACE_HPP
+#define NFD_DAEMON_MGMT_APP_FACE_HPP
 
 #include "common.hpp"
 
@@ -55,4 +55,4 @@
 
 } // namespace nfd
 
-#endif //NFD_MGMT_APP_FACE_HPP
+#endif // NFD_DAEMON_MGMT_APP_FACE_HPP
diff --git a/daemon/mgmt/command-validator.hpp b/daemon/mgmt/command-validator.hpp
index ea85e99..8456db3 100644
--- a/daemon/mgmt/command-validator.hpp
+++ b/daemon/mgmt/command-validator.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_COMMAND_VALIDATOR_HPP
-#define NFD_MGMT_COMMAND_VALIDATOR_HPP
+#ifndef NFD_DAEMON_MGMT_COMMAND_VALIDATOR_HPP
+#define NFD_DAEMON_MGMT_COMMAND_VALIDATOR_HPP
 
 #include "common.hpp"
 #include "config-file.hpp"
@@ -113,4 +113,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_COMMAND_VALIDATOR_HPP
+#endif // NFD_DAEMON_MGMT_COMMAND_VALIDATOR_HPP
diff --git a/daemon/mgmt/config-file.cpp b/daemon/mgmt/config-file.cpp
deleted file mode 100644
index 3be86c9..0000000
--- a/daemon/mgmt/config-file.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "config-file.hpp"
-#include "core/logger.hpp"
-
-#include <boost/property_tree/info_parser.hpp>
-#include <fstream>
-
-namespace nfd {
-
-NFD_LOG_INIT("ConfigFile");
-
-ConfigFile::ConfigFile()
-{
-}
-
-void
-ConfigFile::addSectionHandler(const std::string& sectionName,
-                              ConfigSectionHandler subscriber)
-{
-  m_subscriptions[sectionName] = subscriber;
-}
-
-void
-ConfigFile::parse(const std::string& filename, bool isDryRun)
-{
-  std::ifstream inputFile;
-  inputFile.open(filename.c_str());
-  if (!inputFile.good() || !inputFile.is_open())
-    {
-      std::string msg = "Failed to read configuration file: ";
-      msg += filename;
-      throw Error(msg);
-    }
-  parse(inputFile, isDryRun, filename);
-  inputFile.close();
-}
-
-void
-ConfigFile::parse(const std::string& input, bool isDryRun, const std::string& filename)
-{
-  std::istringstream inputStream(input);
-  parse(inputStream, isDryRun, filename);
-}
-
-
-void
-ConfigFile::parse(std::istream& input, bool isDryRun, const std::string& filename)
-{
-  try
-    {
-      boost::property_tree::read_info(input, m_global);
-    }
-  catch (const boost::property_tree::info_parser_error& error)
-    {
-      std::stringstream msg;
-      msg << "Failed to parse configuration file";
-      msg << " " << filename;
-      msg << " " << error.message() << " line " << error.line();
-      throw Error(msg.str());
-    }
-
-  process(isDryRun, filename);
-}
-
-void
-ConfigFile::process(bool isDryRun, const std::string& filename)
-{
-  BOOST_ASSERT(!filename.empty());
-  // NFD_LOG_DEBUG("processing..." << ((isDryRun)?("dry run"):("")));
-
-  if (m_global.begin() == m_global.end())
-    {
-      std::string msg = "Error processing configuration file";
-      msg += ": ";
-      msg += filename;
-      msg += " no data";
-      throw Error(msg);
-    }
-
-  for (ConfigSection::const_iterator i = m_global.begin(); i != m_global.end(); ++i)
-    {
-      const std::string& sectionName = i->first;
-      const ConfigSection& section = i->second;
-
-      SubscriptionTable::iterator subscriberIt = m_subscriptions.find(sectionName);
-      if (subscriberIt != m_subscriptions.end())
-        {
-          ConfigSectionHandler subscriber = subscriberIt->second;
-          subscriber(section, isDryRun, filename);
-        }
-      else
-        {
-          std::string msg = "Error processing configuration file";
-          msg += " ";
-          msg += filename;
-          msg += " no module subscribed for section: " + sectionName;
-          throw Error(msg);
-        }
-    }
-}
-
-}
diff --git a/daemon/mgmt/config-file.hpp b/daemon/mgmt/config-file.hpp
deleted file mode 100644
index d20b0ea..0000000
--- a/daemon/mgmt/config-file.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef NFD_MGMT_CONFIG_FILE_HPP
-#define NFD_MGMT_CONFIG_FILE_HPP
-
-#include "common.hpp"
-
-#include <boost/property_tree/ptree.hpp>
-
-namespace nfd {
-
-typedef boost::property_tree::ptree ConfigSection;
-
-/// \brief callback for config file sections
-typedef function<void(const ConfigSection&, bool, const std::string&)> ConfigSectionHandler;
-
-class ConfigFile : noncopyable
-{
-public:
-
-  class Error : public std::runtime_error
-  {
-  public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-
-    }
-  };
-
-  ConfigFile();
-
-  /// \brief setup notification of configuration file sections
-  void
-  addSectionHandler(const std::string& sectionName,
-                    ConfigSectionHandler subscriber);
-
-
-  /**
-   * \param filename file to parse
-   * \param isDryRun true if performing a dry run of configuration, false otherwise
-   * \throws ConfigFile::Error if file not found
-   * \throws ConfigFile::Error if parse error
-   */
-  void
-  parse(const std::string& filename, bool isDryRun);
-
-  /**
-   * \param input configuration (as a string) to parse
-   * \param isDryRun true if performing a dry run of configuration, false otherwise
-   * \param filename optional convenience argument to provide more detailed error messages
-   * \throws ConfigFile::Error if file not found
-   * \throws ConfigFile::Error if parse error
-   */
-  void
-  parse(const std::string& input, bool isDryRun, const std::string& filename);
-
-  /**
-   * \param input stream to parse
-   * \param isDryRun true if performing a dry run of configuration, false otherwise
-   * \param filename optional convenience argument to provide more detailed error messages
-   * \throws ConfigFile::Error if parse error
-   */
-  void
-  parse(std::istream& input, bool isDryRun, const std::string& filename);
-
-private:
-
-  void
-  process(bool isDryRun, const std::string& filename);
-
-private:
-
-  typedef std::map<std::string, ConfigSectionHandler> SubscriptionTable;
-
-  SubscriptionTable m_subscriptions;
-
-  ConfigSection m_global;
-};
-
-} // namespace nfd
-
-
-#endif // NFD_MGMT_CONFIG_FILE_HPP
diff --git a/daemon/mgmt/face-flags.hpp b/daemon/mgmt/face-flags.hpp
index d5541ae..c4809a0 100644
--- a/daemon/mgmt/face-flags.hpp
+++ b/daemon/mgmt/face-flags.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_FACE_FLAGS_HPP
-#define NFD_MGMT_FACE_FLAGS_HPP
+#ifndef NFD_DAEMON_MGMT_FACE_FLAGS_HPP
+#define NFD_DAEMON_MGMT_FACE_FLAGS_HPP
 
 #include "face/face.hpp"
 #include <ndn-cpp-dev/management/nfd-face-flags.hpp>
@@ -45,4 +45,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_FACE_FLAGS_HPP
+#endif // NFD_DAEMON_MGMT_FACE_FLAGS_HPP
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 7861935..79822f7 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -31,7 +31,7 @@
 #include "fw/face-table.hpp"
 #include "face/tcp-factory.hpp"
 #include "face/udp-factory.hpp"
-#include "mgmt/config-file.hpp"
+#include "core/config-file.hpp"
 
 #ifdef HAVE_UNIX_SOCKETS
 #include "face/unix-stream-factory.hpp"
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index d1ba482..ed33975 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_FACE_MANAGER_HPP
-#define NFD_MGMT_FACE_MANAGER_HPP
+#ifndef NFD_DAEMON_MGMT_FACE_MANAGER_HPP
+#define NFD_DAEMON_MGMT_FACE_MANAGER_HPP
 
 #include "common.hpp"
 #include "face/local-face.hpp"
@@ -224,4 +224,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_FACE_MANAGER_HPP
+#endif // NFD_DAEMON_MGMT_FACE_MANAGER_HPP
diff --git a/daemon/mgmt/face-status-publisher.hpp b/daemon/mgmt/face-status-publisher.hpp
index 7013ae7..935426d 100644
--- a/daemon/mgmt/face-status-publisher.hpp
+++ b/daemon/mgmt/face-status-publisher.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_FACE_STATUS_PUBLISHER_HPP
-#define NFD_MGMT_FACE_STATUS_PUBLISHER_HPP
+#ifndef NFD_DAEMON_MGMT_FACE_STATUS_PUBLISHER_HPP
+#define NFD_DAEMON_MGMT_FACE_STATUS_PUBLISHER_HPP
 
 #include "mgmt/segment-publisher.hpp"
 
@@ -52,4 +52,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_FACE_STATUS_PUBLISHER_HPP
+#endif // NFD_DAEMON_MGMT_FACE_STATUS_PUBLISHER_HPP
diff --git a/daemon/mgmt/fib-enumeration-publisher.hpp b/daemon/mgmt/fib-enumeration-publisher.hpp
index 0baf3bc..2aa7539 100644
--- a/daemon/mgmt/fib-enumeration-publisher.hpp
+++ b/daemon/mgmt/fib-enumeration-publisher.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
-#define NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
+#ifndef NFD_DAEMON_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
+#define NFD_DAEMON_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
 
 #include "mgmt/segment-publisher.hpp"
 
@@ -52,4 +52,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
+#endif // NFD_DAEMON_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
diff --git a/daemon/mgmt/fib-manager.hpp b/daemon/mgmt/fib-manager.hpp
index 4c3bf8d..4591088 100644
--- a/daemon/mgmt/fib-manager.hpp
+++ b/daemon/mgmt/fib-manager.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_FIB_MANAGER_HPP
-#define NFD_MGMT_FIB_MANAGER_HPP
+#ifndef NFD_DAEMON_MGMT_FIB_MANAGER_HPP
+#define NFD_DAEMON_MGMT_FIB_MANAGER_HPP
 
 #include "common.hpp"
 #include "mgmt/manager-base.hpp"
@@ -109,4 +109,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_FIB_MANAGER_HPP
+#endif // NFD_DAEMON_MGMT_FIB_MANAGER_HPP
diff --git a/daemon/mgmt/internal-face.hpp b/daemon/mgmt/internal-face.hpp
index 479f256..ff89ac8 100644
--- a/daemon/mgmt/internal-face.hpp
+++ b/daemon/mgmt/internal-face.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_INTERNAL_FACE_HPP
-#define NFD_MGMT_INTERNAL_FACE_HPP
+#ifndef NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
+#define NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
 
 #include "face/face.hpp"
 #include "app-face.hpp"
@@ -94,4 +94,4 @@
 
 } // namespace nfd
 
-#endif //NFD_MGMT_INTERNAL_FACE_HPP
+#endif // NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
diff --git a/daemon/mgmt/manager-base.hpp b/daemon/mgmt/manager-base.hpp
index 5002dec..5d19b2a 100644
--- a/daemon/mgmt/manager-base.hpp
+++ b/daemon/mgmt/manager-base.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_MANAGER_BASE_HPP
-#define NFD_MGMT_MANAGER_BASE_HPP
+#ifndef NFD_DAEMON_MGMT_MANAGER_BASE_HPP
+#define NFD_DAEMON_MGMT_MANAGER_BASE_HPP
 
 #include "common.hpp"
 
@@ -159,4 +159,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_MANAGER_BASE_HPP
+#endif // NFD_DAEMON_MGMT_MANAGER_BASE_HPP
diff --git a/daemon/mgmt/notification-stream.hpp b/daemon/mgmt/notification-stream.hpp
index 6c45835..8d727d7 100644
--- a/daemon/mgmt/notification-stream.hpp
+++ b/daemon/mgmt/notification-stream.hpp
@@ -21,8 +21,8 @@
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
-#ifndef NFD_MGMT_NOTIFICATION_STREAM_HPP
-#define NFD_MGMT_NOTIFICATION_STREAM_HPP
+#ifndef NFD_DAEMON_MGMT_NOTIFICATION_STREAM_HPP
+#define NFD_DAEMON_MGMT_NOTIFICATION_STREAM_HPP
 
 #include "mgmt/app-face.hpp"
 
@@ -76,4 +76,4 @@
 } // namespace nfd
 
 
-#endif // NFD_MGMT_NOTIFICATION_STREAM_HPP
+#endif // NFD_DAEMON_MGMT_NOTIFICATION_STREAM_HPP
diff --git a/daemon/mgmt/segment-publisher.hpp b/daemon/mgmt/segment-publisher.hpp
index ebab6e9..a01ff76 100644
--- a/daemon/mgmt/segment-publisher.hpp
+++ b/daemon/mgmt/segment-publisher.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_SEGMENT_PUBLISHER_HPP
-#define NFD_MGMT_SEGMENT_PUBLISHER_HPP
+#ifndef NFD_DAEMON_MGMT_SEGMENT_PUBLISHER_HPP
+#define NFD_DAEMON_MGMT_SEGMENT_PUBLISHER_HPP
 
 #include "common.hpp"
 #include "mgmt/app-face.hpp"
@@ -62,4 +62,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_SEGMENT_PUBLISHER_HPP
+#endif // NFD_DAEMON_MGMT_SEGMENT_PUBLISHER_HPP
diff --git a/daemon/mgmt/status-server.cpp b/daemon/mgmt/status-server.cpp
index bb42a0e..148061c 100644
--- a/daemon/mgmt/status-server.cpp
+++ b/daemon/mgmt/status-server.cpp
@@ -24,7 +24,7 @@
 
 #include "status-server.hpp"
 #include "fw/forwarder.hpp"
-#include "core/version.hpp"
+#include "version.hpp"
 
 namespace nfd {
 
diff --git a/daemon/mgmt/status-server.hpp b/daemon/mgmt/status-server.hpp
index 6848f5b..60cbf39 100644
--- a/daemon/mgmt/status-server.hpp
+++ b/daemon/mgmt/status-server.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_STATUS_SERVER_HPP
-#define NFD_MGMT_STATUS_SERVER_HPP
+#ifndef NFD_DAEMON_MGMT_STATUS_SERVER_HPP
+#define NFD_DAEMON_MGMT_STATUS_SERVER_HPP
 
 #include "mgmt/app-face.hpp"
 #include <ndn-cpp-dev/management/nfd-forwarder-status.hpp>
@@ -55,4 +55,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_STATUS_SERVER_HPP
+#endif // NFD_DAEMON_MGMT_STATUS_SERVER_HPP
diff --git a/daemon/mgmt/strategy-choice-manager.hpp b/daemon/mgmt/strategy-choice-manager.hpp
index c79a2ac..94cdb11 100644
--- a/daemon/mgmt/strategy-choice-manager.hpp
+++ b/daemon/mgmt/strategy-choice-manager.hpp
@@ -22,8 +22,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP
-#define NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP
+#ifndef NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP
+#define NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP
 
 #include "mgmt/manager-base.hpp"
 
@@ -77,4 +77,4 @@
 
 } // namespace nfd
 
-#endif // NFD_MGMT_STRATEGY_CHOICE_MANAGER_HPP
+#endif // NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP