src: Changing namespace ndn to namespace nfd

Also, this commit imports used classes from ::ndn namespace (from
NDN-CPP library) directly to ::nfd namespace.

refs: #1163

Change-Id: I9cc9d72e00af495b4ed0c84e6d418a7c9ba986cb
diff --git a/daemon/common.hpp b/daemon/common.hpp
index a98719d..c377a65 100644
--- a/daemon/common.hpp
+++ b/daemon/common.hpp
@@ -25,7 +25,7 @@
 #include <list>
 #include <set>
 
-namespace ndn {
+namespace nfd {
 
 using boost::noncopyable;
 using boost::shared_ptr;
@@ -34,6 +34,15 @@
 using boost::function;
 using boost::bind;
 
-} // namespace ndn
+using ndn::Interest;
+using ndn::Data;
+using ndn::Name;
+using ndn::Exclude;
+using ndn::Block;
+namespace tlv {
+using namespace ndn::Tlv;
+}
+
+} // namespace nfd
 
 #endif // NFD_COMMON_HPP
diff --git a/daemon/core/monotonic_deadline_timer.hpp b/daemon/core/monotonic_deadline_timer.hpp
index 543cd7a..c158fe4 100644
--- a/daemon/core/monotonic_deadline_timer.hpp
+++ b/daemon/core/monotonic_deadline_timer.hpp
@@ -17,15 +17,15 @@
 namespace asio {
 
 template <> 
-struct time_traits<ndn::time::monotonic_clock>
+struct time_traits<nfd::time::monotonic_clock>
 {
-  typedef ndn::time::Point time_type;
-  typedef ndn::time::Duration duration_type;
+  typedef nfd::time::Point time_type;
+  typedef nfd::time::Duration duration_type;
 
   static time_type
   now()
   {
-    return ndn::time::now();
+    return nfd::time::now();
   }
 
   static time_type
@@ -53,7 +53,7 @@
   }
 };
 
-typedef basic_deadline_timer<ndn::time::monotonic_clock> monotonic_deadline_timer; 
+typedef basic_deadline_timer<nfd::time::monotonic_clock> monotonic_deadline_timer; 
 
 } // namespace asio
 } // namespace boost
diff --git a/daemon/core/scheduler.cpp b/daemon/core/scheduler.cpp
index c4fc1d8..f9f9996 100644
--- a/daemon/core/scheduler.cpp
+++ b/daemon/core/scheduler.cpp
@@ -6,7 +6,7 @@
 
 #include "scheduler.hpp"
 
-namespace ndn {
+namespace nfd {
 
 struct EventIdImpl
 {
@@ -173,4 +173,4 @@
 }
 
 
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/core/scheduler.hpp b/daemon/core/scheduler.hpp
index d5d57aa..4b2e2d4 100644
--- a/daemon/core/scheduler.hpp
+++ b/daemon/core/scheduler.hpp
@@ -10,7 +10,7 @@
 #include "common.hpp"
 #include "monotonic_deadline_timer.hpp"
 
-namespace ndn {
+namespace nfd {
 
 struct EventIdImpl; ///< \brief Private storage of information about the event
 /**
@@ -94,6 +94,6 @@
   boost::asio::monotonic_deadline_timer m_deadlineTimer;
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_CORE_SCHEDULER_HPP
diff --git a/daemon/core/time.cpp b/daemon/core/time.cpp
index 712779d..c216df4 100644
--- a/daemon/core/time.cpp
+++ b/daemon/core/time.cpp
@@ -9,7 +9,7 @@
 #include <stdexcept>
 #include <sys/time.h>
 
-namespace ndn {
+namespace nfd {
 namespace time {
 
 Point
@@ -42,4 +42,4 @@
 }
 
 } // namespace time
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/core/time.hpp b/daemon/core/time.hpp
index 3b0d002..5efd082 100644
--- a/daemon/core/time.hpp
+++ b/daemon/core/time.hpp
@@ -9,7 +9,7 @@
 
 #include "common.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace time {
 
 class monotonic_clock;
@@ -156,6 +156,6 @@
 
 
 } // namespace time
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_CORE_TIME_H
diff --git a/daemon/face/channel-factory.hpp b/daemon/face/channel-factory.hpp
index a2d7ff9..184703a 100644
--- a/daemon/face/channel-factory.hpp
+++ b/daemon/face/channel-factory.hpp
@@ -9,7 +9,7 @@
 
 #include "common.hpp"
 
-namespace ndn {
+namespace nfd {
 
 /**
  * \brief Base class for all channel factories
@@ -34,6 +34,6 @@
   ChannelMap m_channels;  
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_FACE_CHANNEL_FACTORY_HPP
diff --git a/daemon/face/face.cpp b/daemon/face/face.cpp
index 1aa5184..6518117 100644
--- a/daemon/face/face.cpp
+++ b/daemon/face/face.cpp
@@ -6,7 +6,7 @@
 
 #include "face.hpp"
 
-namespace ndn {
+namespace nfd {
 
 Face::Face(FaceId id)
   : m_id(id)
@@ -49,4 +49,4 @@
 }
 
 
-} //namespace ndn
+} //namespace nfd
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index f014545..d6da710 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -10,7 +10,7 @@
 #include "common.hpp"
 #include "util/event-emitter.hpp"
 
-namespace ndn {
+namespace nfd {
 
 /** \class FaceId
  *  \brief identifies a face
@@ -85,6 +85,6 @@
   std::string m_description;
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_FACE_FACE_H
diff --git a/daemon/face/stream-face.hpp b/daemon/face/stream-face.hpp
index 8fd39a1..e0ea05b 100644
--- a/daemon/face/stream-face.hpp
+++ b/daemon/face/stream-face.hpp
@@ -9,7 +9,7 @@
 
 #include "face.hpp"
 
-namespace ndn {
+namespace nfd {
 
 template <class T>
 class StreamFace : public Face
@@ -90,20 +90,20 @@
     offset += element.size();
 
     /// @todo Ensure lazy field decoding process
-    if (element.type() == Tlv::Interest)
+    if (element.type() == tlv::Interest)
       {
         shared_ptr<Interest> i = make_shared<Interest>();
         i->wireDecode(element);
         onReceiveInterest(*i);
       }
-    else if (element.type() == Tlv::Data)
+    else if (element.type() == tlv::Data)
       {
         shared_ptr<Data> d = make_shared<Data>();
         d->wireDecode(element);
         onReceiveData(*d);
       }
     // @todo Add local header support
-    // else if (element.type() == Tlv::LocalHeader)
+    // else if (element.type() == tlv::LocalHeader)
     //   {
     //     shared_ptr<Interest> i = make_shared<Interest>();
     //     i->wireDecode(element);
@@ -115,7 +115,7 @@
         // ignore unknown packet and proceed
       }
   }
-  catch(const Tlv::Error&) {
+  catch(const tlv::Error&) {
     if (m_inputBufferSize == MAX_NDN_PACKET_SIZE && offset == 0)
       {
         onFail("Received input is invalid or too large to process, closing down the face");
@@ -144,6 +144,6 @@
 }
 
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_FACE_STREAM_FACE_HPP
diff --git a/daemon/face/tcp-channel-factory.cpp b/daemon/face/tcp-channel-factory.cpp
index 4c6df87..be3a9d4 100644
--- a/daemon/face/tcp-channel-factory.cpp
+++ b/daemon/face/tcp-channel-factory.cpp
@@ -6,7 +6,7 @@
 
 #include "tcp-channel-factory.hpp"
 
-namespace ndn {
+namespace nfd {
 
 TcpChannelFactory::TcpChannelFactory(boost::asio::io_service& ioService)
   : m_ioService(ioService)
@@ -38,7 +38,7 @@
   tcp::resolver::iterator end;
   tcp::resolver::iterator i = resolver.resolve(query);
   if (i == end)
-    return shared_ptr<ndn::TcpChannel>();
+    return shared_ptr<TcpChannel>();
 
   return create(*i);
 }
@@ -50,7 +50,7 @@
   if (i != m_channels.end())
     return i->second;
   else
-    return shared_ptr<ndn::TcpChannel>();
+    return shared_ptr<TcpChannel>();
 }
 
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/face/tcp-channel-factory.hpp b/daemon/face/tcp-channel-factory.hpp
index 1baeb58..5027d41 100644
--- a/daemon/face/tcp-channel-factory.hpp
+++ b/daemon/face/tcp-channel-factory.hpp
@@ -10,7 +10,7 @@
 #include "channel-factory.hpp"
 #include "tcp-channel.hpp"
 
-namespace ndn {
+namespace nfd {
 
 class TcpChannelFactory : public ChannelFactory<tcp::Endpoint, TcpChannel>
 {
@@ -73,6 +73,6 @@
   boost::asio::io_service& m_ioService;
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_FACE_TCP_CHANNEL_FACTORY_HPP
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 9da453e..25244f8 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -6,7 +6,7 @@
 
 #include "tcp-channel.hpp"
 
-namespace ndn {
+namespace nfd {
 
 using namespace boost::asio;
 
@@ -193,4 +193,4 @@
 }
 
 
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/face/tcp-channel.hpp b/daemon/face/tcp-channel.hpp
index 8536203..bd0388a 100644
--- a/daemon/face/tcp-channel.hpp
+++ b/daemon/face/tcp-channel.hpp
@@ -15,7 +15,7 @@
 typedef boost::asio::ip::tcp::endpoint Endpoint;
 } // namespace tcp
 
-namespace ndn {
+namespace nfd {
 
 /**
  * \brief Class implementing TCP-based channel to create faces
@@ -125,6 +125,6 @@
   shared_ptr<boost::asio::ip::tcp::acceptor> m_acceptor;
 };
 
-} // namespace ndn
+} // namespace nfd
  
 #endif // NFD_FACE_TCP_CHANNEL_HPP
diff --git a/daemon/face/tcp-face.cpp b/daemon/face/tcp-face.cpp
index eb3ac94..79f9b8c 100644
--- a/daemon/face/tcp-face.cpp
+++ b/daemon/face/tcp-face.cpp
@@ -6,7 +6,7 @@
 
 #include "tcp-face.hpp"
 
-namespace ndn {
+namespace nfd {
 
 TcpFace::TcpFace(FaceId id,
                  const shared_ptr<TcpFace::protocol::socket>& socket)
@@ -34,4 +34,4 @@
   // anything else should be done here?
 }
 
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/face/tcp-face.hpp b/daemon/face/tcp-face.hpp
index 3d2bb53..c76cbc8 100644
--- a/daemon/face/tcp-face.hpp
+++ b/daemon/face/tcp-face.hpp
@@ -9,7 +9,7 @@
 
 #include "stream-face.hpp"
 
-namespace ndn
+namespace nfd
 {
 
 /**
@@ -32,6 +32,6 @@
   sendData(const Data& data);
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_FACE_TCP_FACE_HPP
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index e47fb5f..15881e3 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -6,7 +6,7 @@
 
 #include "forwarder.hpp"
 
-namespace ndn {
+namespace nfd {
 
 Forwarder::Forwarder(boost::asio::io_service& ioService)
 {
@@ -33,4 +33,4 @@
 {
 }
 
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 3f9947a..6395f29 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -10,7 +10,7 @@
 #include "common.hpp"
 #include "face/face.hpp"
 
-namespace ndn {
+namespace nfd {
 
 /**
  * Forwarder is the main class of NFD.
diff --git a/daemon/table/cs-entry.hpp b/daemon/table/cs-entry.hpp
index 1726d87..2502105 100644
--- a/daemon/table/cs-entry.hpp
+++ b/daemon/table/cs-entry.hpp
@@ -9,7 +9,7 @@
 
 #include "common.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace cs {
 
 /** \class Entry
@@ -21,6 +21,6 @@
 };
 
 } // namespace cs
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_CS_ENTRY_HPP
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index c0dc4e2..d85b2d0 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -8,7 +8,7 @@
 
 #include "cs.hpp"
 
-namespace ndn {
+namespace nfd {
 
 Cs::Cs()
 {
@@ -31,4 +31,4 @@
 }
 
 
-} //namespace ndn
+} //namespace nfd
diff --git a/daemon/table/cs.hpp b/daemon/table/cs.hpp
index 9404015..0db5ad7 100644
--- a/daemon/table/cs.hpp
+++ b/daemon/table/cs.hpp
@@ -10,7 +10,7 @@
 #include "common.hpp"
 #include "cs-entry.hpp"
 
-namespace ndn {
+namespace nfd {
 
 /** \class Cs
  *  \brief represents the ContentStore
@@ -39,6 +39,6 @@
   find(const Interest& interest);
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_CS_HPP
diff --git a/daemon/table/fib-entry.cpp b/daemon/table/fib-entry.cpp
index a00a582..5b64e6b 100644
--- a/daemon/table/fib-entry.cpp
+++ b/daemon/table/fib-entry.cpp
@@ -7,7 +7,7 @@
 #include "fib-entry.hpp"
 #include <algorithm>
 
-namespace ndn {
+namespace nfd {
 namespace fib {
 
 Entry::Entry(const Name& prefix)
@@ -64,4 +64,4 @@
 
 
 } // namespace fib
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/fib-entry.hpp b/daemon/table/fib-entry.hpp
index 67f5056..20d0206 100644
--- a/daemon/table/fib-entry.hpp
+++ b/daemon/table/fib-entry.hpp
@@ -9,7 +9,7 @@
 
 #include "fib-nexthop.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace fib {
 
 /** \class NextHopList
@@ -71,6 +71,6 @@
 
 
 } // namespace fib
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_FIB_ENTRY_HPP
diff --git a/daemon/table/fib-nexthop.cpp b/daemon/table/fib-nexthop.cpp
index 06bbdcb..178d853 100644
--- a/daemon/table/fib-nexthop.cpp
+++ b/daemon/table/fib-nexthop.cpp
@@ -6,7 +6,7 @@
 
 #include "fib-nexthop.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace fib {
 
 NextHop::NextHop(shared_ptr<Face> face)
@@ -38,4 +38,4 @@
 }
 
 } // namespace fib
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/fib-nexthop.hpp b/daemon/table/fib-nexthop.hpp
index c3e2cf0..5961b42 100644
--- a/daemon/table/fib-nexthop.hpp
+++ b/daemon/table/fib-nexthop.hpp
@@ -10,7 +10,7 @@
 #include "common.hpp"
 #include "face/face.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace fib {
 
 /** \class NextHop
@@ -38,6 +38,6 @@
 };
 
 } // namespace fib
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_FIB_NEXTHOP_HPP
diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp
index 1d8fe3a..532ad97 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -8,7 +8,7 @@
 #include <algorithm>
 #include <numeric>
 
-namespace ndn {
+namespace nfd {
 
 Fib::Fib()
 {
@@ -75,4 +75,4 @@
 }
 
 
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
index 0c88eaa..53a34c7 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -8,7 +8,7 @@
 #define NFD_TABLE_FIB_HPP
 
 #include "fib-entry.hpp"
-namespace ndn {
+namespace nfd {
 
 /** \class Fib
  *  \brief represents the FIB
@@ -43,6 +43,6 @@
   std::list<shared_ptr<fib::Entry> > m_table;
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_FIB_HPP
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index e11abef..094ea6e 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -7,7 +7,7 @@
 #include "pit-entry.hpp"
 #include <algorithm>
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 Entry::Entry(const Interest& interest)
@@ -93,4 +93,4 @@
 
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index 97de5e2..00e8a79 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -10,7 +10,7 @@
 #include "pit-in-record.hpp"
 #include "pit-out-record.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 /** \class InRecordCollection
@@ -88,6 +88,6 @@
 }
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_PIT_ENTRY_HPP
diff --git a/daemon/table/pit-face-record.cpp b/daemon/table/pit-face-record.cpp
index 89aef1e..cbcd3b1 100644
--- a/daemon/table/pit-face-record.cpp
+++ b/daemon/table/pit-face-record.cpp
@@ -6,7 +6,7 @@
 
 #include "pit-face-record.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 FaceRecord::FaceRecord(shared_ptr<Face> face)
@@ -35,4 +35,4 @@
 
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/pit-face-record.hpp b/daemon/table/pit-face-record.hpp
index d2dfe2c..b51c0bc 100644
--- a/daemon/table/pit-face-record.hpp
+++ b/daemon/table/pit-face-record.hpp
@@ -10,7 +10,7 @@
 #include "face/face.hpp"
 #include "core/time.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 /** \class FaceRecord
@@ -78,6 +78,6 @@
 }
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_PIT_FACE_RECORD_HPP
diff --git a/daemon/table/pit-in-record.cpp b/daemon/table/pit-in-record.cpp
index 662f074..6963da2 100644
--- a/daemon/table/pit-in-record.cpp
+++ b/daemon/table/pit-in-record.cpp
@@ -6,7 +6,7 @@
 
 #include "pit-in-record.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 InRecord::InRecord(shared_ptr<Face> face)
@@ -21,4 +21,4 @@
 
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/pit-in-record.hpp b/daemon/table/pit-in-record.hpp
index 9539ce3..1f4e1e1 100644
--- a/daemon/table/pit-in-record.hpp
+++ b/daemon/table/pit-in-record.hpp
@@ -9,7 +9,7 @@
 
 #include "pit-face-record.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 /** \class InRecord
@@ -25,6 +25,6 @@
 };
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_PIT_IN_RECORD_HPP
diff --git a/daemon/table/pit-out-record.cpp b/daemon/table/pit-out-record.cpp
index ce4db8c..064236f 100644
--- a/daemon/table/pit-out-record.cpp
+++ b/daemon/table/pit-out-record.cpp
@@ -6,7 +6,7 @@
 
 #include "pit-out-record.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 OutRecord::OutRecord(shared_ptr<Face> face)
@@ -20,4 +20,4 @@
 }
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp
index 83ff3e1..635de98 100644
--- a/daemon/table/pit-out-record.hpp
+++ b/daemon/table/pit-out-record.hpp
@@ -9,7 +9,7 @@
 
 #include "pit-face-record.hpp"
 
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 /** \class OutRecord
@@ -25,6 +25,6 @@
 };
 
 } // namespace pit
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_PIT_IN_RECORD_HPP
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 7742266..168a64e 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -7,7 +7,7 @@
 #include "pit.hpp"
 #include <algorithm>
 
-namespace ndn {
+namespace nfd {
 
 Pit::Pit()
 {
@@ -73,4 +73,4 @@
   m_table.remove(pitEntry);
 }
 
-} // namespace ndn
+} // namespace nfd
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index 44dc252..9dd2e1e 100644
--- a/daemon/table/pit.hpp
+++ b/daemon/table/pit.hpp
@@ -8,7 +8,7 @@
 #define NFD_TABLE_PIT_HPP
 
 #include "pit-entry.hpp"
-namespace ndn {
+namespace nfd {
 namespace pit {
 
 /** \class DataMatchResult
@@ -52,6 +52,6 @@
   std::list<shared_ptr<pit::Entry> > m_table;
 };
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_TABLE_PIT_HPP
diff --git a/daemon/util/event-emitter.hpp b/daemon/util/event-emitter.hpp
index 4499eaa..0e30970 100644
--- a/daemon/util/event-emitter.hpp
+++ b/daemon/util/event-emitter.hpp
@@ -9,7 +9,7 @@
 
 #include "common.hpp"
 
-namespace ndn {
+namespace nfd {
 
 struct empty {};
 
@@ -320,6 +320,6 @@
 }
 
 
-} // namespace ndn
+} // namespace nfd
 
 #endif // NFD_UTIL_EVENT_EMITTER_HPP