A few code reorganizations

Change-Id: If4632fecc7085e5448226c2061e08546757eda9b
diff --git a/core/auditor.cpp b/core/auditor.cpp
index b2db2b7..ce17b04 100644
--- a/core/auditor.cpp
+++ b/core/auditor.cpp
@@ -23,7 +23,8 @@
 
 #include <ndn-cxx/util/digest.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 bool
 Auditor::doesExist(const NonNegativeInteger& seqNo,
@@ -74,7 +75,7 @@
   size_t childLevel = 0;
   ndn::ConstBufferPtr childHash = hash;
 
-  NonNegativeInteger parentSeqMask = (~0) << 1;
+  NonNegativeInteger parentSeqMask = (~0ul) << 1;
   NonNegativeInteger parentSeqNo = childSeqNo & parentSeqMask;
   size_t parentLevel = 1;
 
@@ -237,4 +238,5 @@
   return true;
 }
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/auditor.hpp b/core/auditor.hpp
index 87e67b5..f47e856 100644
--- a/core/auditor.hpp
+++ b/core/auditor.hpp
@@ -29,7 +29,8 @@
 #include <ndn-cxx/encoding/buffer.hpp>
 #include <vector>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class Auditor
 {
@@ -57,6 +58,7 @@
             const Name& loggerName);
 };
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_AUDITOR_HPP
diff --git a/core/conf/checker.cpp b/core/conf/checker.cpp
index d00bb34..30d6d2b 100644
--- a/core/conf/checker.cpp
+++ b/core/conf/checker.cpp
@@ -23,7 +23,8 @@
 
 #include <boost/algorithm/string.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 Checker::~Checker()
@@ -173,4 +174,5 @@
 }
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/conf/checker.hpp b/core/conf/checker.hpp
index 17117aa..f618f92 100644
--- a/core/conf/checker.hpp
+++ b/core/conf/checker.hpp
@@ -30,7 +30,8 @@
 #include <boost/filesystem.hpp>
 #include <boost/lexical_cast.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 class Checker
@@ -93,6 +94,7 @@
 };
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CONF_CHECKER_HPP
diff --git a/core/conf/config-file.cpp b/core/conf/config-file.cpp
index ffb8051..fd1902b 100644
--- a/core/conf/config-file.cpp
+++ b/core/conf/config-file.cpp
@@ -22,7 +22,8 @@
 #include "config-file.hpp"
 #include <boost/property_tree/info_parser.hpp>
 #include <boost/filesystem.hpp>
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 ConfigFile::ConfigFile(const std::string& filename)
@@ -94,4 +95,5 @@
 }
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/conf/config-file.hpp b/core/conf/config-file.hpp
index e86def2..1ed2fab 100644
--- a/core/conf/config-file.hpp
+++ b/core/conf/config-file.hpp
@@ -25,7 +25,8 @@
 #include "common.hpp"
 #include "config.hpp"
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 class ConfigFile
 {
@@ -74,6 +75,7 @@
 };
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CONF_CONFIG_FILE_HPP
diff --git a/core/conf/config.hpp b/core/conf/config.hpp
index 7bffe63..c515d70 100644
--- a/core/conf/config.hpp
+++ b/core/conf/config.hpp
@@ -24,7 +24,8 @@
 
 #include <boost/property_tree/ptree.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 typedef boost::property_tree::ptree ConfigSection;
@@ -40,6 +41,7 @@
 };
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CONF_CONFIG_HPP
diff --git a/core/conf/filter.cpp b/core/conf/filter.cpp
index 7f4c945..bb18236 100644
--- a/core/conf/filter.cpp
+++ b/core/conf/filter.cpp
@@ -23,7 +23,8 @@
 
 #include <boost/algorithm/string.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 Filter::~Filter()
@@ -154,4 +155,5 @@
 }
 
 } // namespace conf
+} // namespace delorean
 } // namespace ndn
diff --git a/core/conf/filter.hpp b/core/conf/filter.hpp
index 65a58ce..7c26720 100644
--- a/core/conf/filter.hpp
+++ b/core/conf/filter.hpp
@@ -26,7 +26,8 @@
 #include "config.hpp"
 #include <ndn-cxx/util/regex.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 /**
@@ -105,6 +106,7 @@
 };
 
 } // namespace conf
+} // namespace delorean
 } // namespace ndn
 
 #endif // NDN_DELOREAN_CONF_FILTER_HPP
diff --git a/core/conf/key-locator-checker.cpp b/core/conf/key-locator-checker.cpp
index 8e21677..c2f808d 100644
--- a/core/conf/key-locator-checker.cpp
+++ b/core/conf/key-locator-checker.cpp
@@ -23,7 +23,8 @@
 
 #include <boost/algorithm/string.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 KeyLocatorChecker::~KeyLocatorChecker()
@@ -274,4 +275,5 @@
 }
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/conf/key-locator-checker.hpp b/core/conf/key-locator-checker.hpp
index 97f270b..7cc2937 100644
--- a/core/conf/key-locator-checker.hpp
+++ b/core/conf/key-locator-checker.hpp
@@ -26,7 +26,8 @@
 #include "config.hpp"
 #include <ndn-cxx/util/regex.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 class KeyLocatorCheckerFactory;
@@ -122,6 +123,7 @@
 
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CONF_KEY_LOCATOR_CHECKER_HPP
diff --git a/core/conf/rule.cpp b/core/conf/rule.cpp
index 55dc59d..efaac3e 100644
--- a/core/conf/rule.cpp
+++ b/core/conf/rule.cpp
@@ -21,7 +21,8 @@
 
 #include "rule.hpp"
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 Rule::Rule(const std::string& id)
@@ -78,4 +79,5 @@
 }
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/conf/rule.hpp b/core/conf/rule.hpp
index 47a70fd..2133efe 100644
--- a/core/conf/rule.hpp
+++ b/core/conf/rule.hpp
@@ -25,7 +25,8 @@
 #include "filter.hpp"
 #include "checker.hpp"
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace conf {
 
 class Rule
@@ -68,6 +69,7 @@
 };
 
 } // namespace conf
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CONF_RULE_HPP
diff --git a/core/db.cpp b/core/db.cpp
index 22474df..d87707f 100644
--- a/core/db.cpp
+++ b/core/db.cpp
@@ -25,7 +25,8 @@
 #include <string>
 #include <boost/filesystem.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 static const std::string INITIALIZATION =
   "CREATE TABLE IF NOT EXISTS                    \n"
@@ -306,4 +307,5 @@
   return m_nextLeafSeqNo;
 }
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/db.hpp b/core/db.hpp
index b722efe..071371f 100644
--- a/core/db.hpp
+++ b/core/db.hpp
@@ -29,7 +29,8 @@
 
 struct sqlite3;
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class Db : noncopyable
 {
@@ -79,6 +80,7 @@
   NonNegativeInteger m_nextLeafSeqNo;
 };
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_DB_HPP
diff --git a/core/leaf.cpp b/core/leaf.cpp
index 36dd275..1046b15 100644
--- a/core/leaf.cpp
+++ b/core/leaf.cpp
@@ -25,7 +25,8 @@
 #include <ndn-cxx/encoding/block-helpers.hpp>
 #include <ndn-cxx/util/crypto.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 const Name Leaf::EMPTY_NAME;
 const size_t Leaf::N_LOGGER_LEAF_SUFFIX = 4;
@@ -251,4 +252,5 @@
     throw Error("No more sub-TLV in LoggerLeaf");
 }
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/leaf.hpp b/core/leaf.hpp
index 4ee11d3..fa07cab 100644
--- a/core/leaf.hpp
+++ b/core/leaf.hpp
@@ -27,7 +27,8 @@
 #include "util/timestamp.hpp"
 #include <ndn-cxx/encoding/buffer.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class Leaf
 {
@@ -138,6 +139,7 @@
   Name m_loggerName;
 };
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_LEAF_HPP
diff --git a/core/logger-response.cpp b/core/logger-response.cpp
index c36f932..4b67ed5 100644
--- a/core/logger-response.cpp
+++ b/core/logger-response.cpp
@@ -22,7 +22,8 @@
 #include "logger-response.hpp"
 #include "tlv.hpp"
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 LoggerResponse::LoggerResponse()
   : m_code(-1)
@@ -128,4 +129,5 @@
     throw Error("No more sub-TLV in log response");
 }
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/logger-response.hpp b/core/logger-response.hpp
index d773ab2..2ba5491 100644
--- a/core/logger-response.hpp
+++ b/core/logger-response.hpp
@@ -26,7 +26,8 @@
 #include "util/non-negative-integer.hpp"
 #include <ndn-cxx/encoding/buffer.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class LoggerResponse
 {
@@ -93,6 +94,7 @@
   mutable Block m_wire;
 };
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_LOGGER_RESPONSE_HPP
diff --git a/core/logger.cpp b/core/logger.cpp
index 983a44d..8349f7b 100644
--- a/core/logger.cpp
+++ b/core/logger.cpp
@@ -23,7 +23,8 @@
 #include "tlv.hpp"
 #include "conf/config-file.hpp"
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 const int Logger::N_DATA_FETCHING_RETRIAL = 2;
 
@@ -302,4 +303,5 @@
 }
 
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/logger.hpp b/core/logger.hpp
index f685495..08b910e 100644
--- a/core/logger.hpp
+++ b/core/logger.hpp
@@ -28,11 +28,13 @@
 #include "policy-checker.hpp"
 #include "merkle-tree.hpp"
 #include "util/non-negative-integer.hpp"
+
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 #include <ndn-cxx/security/validator-config.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class Logger
 {
@@ -135,6 +137,7 @@
   PolicyChecker m_policyChecker;
 };
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_LOGGER_HPP
diff --git a/core/merkle-tree.cpp b/core/merkle-tree.cpp
index 2219d2f..300456a 100644
--- a/core/merkle-tree.cpp
+++ b/core/merkle-tree.cpp
@@ -21,7 +21,8 @@
 
 #include "merkle-tree.hpp"
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 MerkleTree::MerkleTree(Db& db)
   : m_db(db)
@@ -215,4 +216,5 @@
   m_pendingTrees[newSibling->getPeakIndex().level] = newSibling;
 }
 
-}// namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/merkle-tree.hpp b/core/merkle-tree.hpp
index f1baa46..c388fe9 100644
--- a/core/merkle-tree.hpp
+++ b/core/merkle-tree.hpp
@@ -27,7 +27,8 @@
 #include "sub-tree-binary.hpp"
 #include <vector>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class MerkleTree
 {
@@ -103,6 +104,7 @@
   std::map<size_t, shared_ptr<SubTreeBinary>> m_pendingTrees;
 };
 
-}// namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_MERKLE_TREE_HPP
diff --git a/core/node.cpp b/core/node.cpp
index d0882e4..74716e6 100644
--- a/core/node.cpp
+++ b/core/node.cpp
@@ -24,7 +24,8 @@
 #include <ndn-cxx/util/digest.hpp>
 #include <boost/lexical_cast.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 ndn::ConstBufferPtr Node::EMPTY_HASH;
 
@@ -121,4 +122,5 @@
   return EMPTY_HASH;
 }
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/node.hpp b/core/node.hpp
index a9cb487..ef0db61 100644
--- a/core/node.hpp
+++ b/core/node.hpp
@@ -26,7 +26,8 @@
 #include "util/non-negative-integer.hpp"
 #include <ndn-cxx/encoding/buffer.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class Node
 {
@@ -119,6 +120,7 @@
 typedef shared_ptr<Node> NodePtr;
 typedef shared_ptr<const Node> ConstNodePtr;
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_NODE_HPP
diff --git a/core/policy-checker.cpp b/core/policy-checker.cpp
index 97464a1..34e2582 100644
--- a/core/policy-checker.cpp
+++ b/core/policy-checker.cpp
@@ -24,7 +24,8 @@
 #include <ndn-cxx/security/validator.hpp>
 #include <boost/algorithm/string.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 using ndn::time::system_clock;
 
@@ -55,8 +56,6 @@
 void
 PolicyChecker::onConfigRule(const conf::ConfigSection& section)
 {
-  using namespace nsl::conf;
-
   auto it = section.begin();
 
   // Get rule.id
@@ -82,7 +81,7 @@
     throw Error("Unrecognized <rule.for>: " + usage + " in rule: " + ruleId);
 
   // Get rule.filter(s)
-  std::vector<shared_ptr<Filter> > filters;
+  std::vector<shared_ptr<conf::Filter> > filters;
   for (; it != section.end(); it++) {
     if (!boost::iequals(it->first, "filter")) {
       if (boost::iequals(it->first, "checker"))
@@ -90,17 +89,17 @@
       throw Error("Expect <rule.filter> in rule: " + ruleId);
     }
 
-    filters.push_back(FilterFactory::create(it->second));
+    filters.push_back(conf::FilterFactory::create(it->second));
     continue;
   }
 
   // Get rule.checker(s)
-  std::vector<shared_ptr<Checker> > checkers;
+  std::vector<shared_ptr<conf::Checker> > checkers;
   for (; it != section.end(); it++) {
     if (!boost::iequals(it->first, "checker"))
       throw Error("Expect <rule.checker> in rule: " + ruleId);
 
-    checkers.push_back(CheckerFactory::create(it->second));
+    checkers.push_back(conf::CheckerFactory::create(it->second));
     continue;
   }
 
@@ -167,4 +166,5 @@
 }
 
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/policy-checker.hpp b/core/policy-checker.hpp
index 1194316..2f04788 100644
--- a/core/policy-checker.hpp
+++ b/core/policy-checker.hpp
@@ -30,7 +30,8 @@
 #include <ndn-cxx/security/identity-certificate.hpp>
 
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 class PolicyChecker
 {
@@ -71,6 +72,7 @@
   DataRuleList m_dataRules;
 };
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_POLICY_CHECKER_HPP
diff --git a/core/sub-tree-binary.cpp b/core/sub-tree-binary.cpp
index 26cef84..ad3b7a2 100644
--- a/core/sub-tree-binary.cpp
+++ b/core/sub-tree-binary.cpp
@@ -25,7 +25,8 @@
 #include <ndn-cxx/util/crypto.hpp>
 #include <ndn-cxx/security/digest-sha256.hpp>
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 const time::milliseconds SubTreeBinary::INCOMPLETE_FRESHNESS_PERIOD(60000);
 const std::string SubTreeBinary::COMPONENT_COMPLETE("complete");
@@ -468,4 +469,5 @@
     updateParentNode(parentNode);
 }
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
diff --git a/core/sub-tree-binary.hpp b/core/sub-tree-binary.hpp
index ba52e1b..56fd66d 100644
--- a/core/sub-tree-binary.hpp
+++ b/core/sub-tree-binary.hpp
@@ -24,7 +24,8 @@
 
 #include "node.hpp"
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 typedef std::function<void(const Node::Index&)> CompleteCallback;
 typedef std::function<void(const Node::Index&,
@@ -177,6 +178,7 @@
 typedef shared_ptr<SubTreeBinary> SubTreeBinaryPtr;
 typedef shared_ptr<const SubTreeBinary> ConstSubTreeBinaryPtr;
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_SUB_TREE_HPP
diff --git a/core/tlv.hpp b/core/tlv.hpp
index d36f772..eb66e53 100644
--- a/core/tlv.hpp
+++ b/core/tlv.hpp
@@ -22,7 +22,8 @@
 #ifndef NDN_DELOREAN_CORE_TLV_HPP
 #define NDN_DELOREAN_CORE_TLV_HPP
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 namespace tlv {
 
 /**
@@ -47,6 +48,7 @@
 };
 
 } // namespace tlv
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_CORE_TLV_HPP
diff --git a/core/util/non-negative-integer.hpp b/core/util/non-negative-integer.hpp
index 08afe34..5b034f7 100644
--- a/core/util/non-negative-integer.hpp
+++ b/core/util/non-negative-integer.hpp
@@ -22,10 +22,12 @@
 #ifndef NDN_DELOREAN_UTIL_NON_NEGATIVE_INTEGER_HPP
 #define NDN_DELOREAN_UTIL_NON_NEGATIVE_INTEGER_HPP
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 typedef uint64_t NonNegativeInteger;
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_UTIL_NON_NEGATIVE_INTEGER_HPP
diff --git a/core/util/timestamp.hpp b/core/util/timestamp.hpp
index a35a09d..cecc046 100644
--- a/core/util/timestamp.hpp
+++ b/core/util/timestamp.hpp
@@ -22,10 +22,12 @@
 #ifndef NDN_DELOREAN_UTIL_TIMESTAMP_HPP
 #define NDN_DELOREAN_UTIL_TIMESTAMP_HPP
 
-namespace nsl {
+namespace ndn {
+namespace delorean {
 
 typedef uint64_t Timestamp;
 
-} // namespace nsl
+} // namespace delorean
+} // namespace ndn
 
 #endif // NDN_DELOREAN_UTIL_TIMESTAMP_HPP