Merge remote-tracking branch 'named-data/master' into release-0.2.0

Change-Id: I5c62c7de04027d40f083c871d6d5b6f42a6f8965
diff --git a/common.hpp b/common.hpp
index ef2ce3d..3b9d2ce 100644
--- a/common.hpp
+++ b/common.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_COMMON_HPP
 #define NFD_COMMON_HPP
@@ -39,8 +40,10 @@
 #define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
 #endif
 
+#include <cstddef>
 #include <list>
 #include <set>
+#include <queue>
 #include <vector>
 
 #include <ndn-cxx/common.hpp>
@@ -57,6 +60,8 @@
 
 namespace nfd {
 
+using std::size_t;
+
 using boost::noncopyable;
 using boost::scoped_ptr;
 
diff --git a/core/segment-publisher.hpp b/core/segment-publisher.hpp
new file mode 100644
index 0000000..b1aa4a9
--- /dev/null
+++ b/core/segment-publisher.hpp
@@ -0,0 +1,121 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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_CORE_SEGMENT_PUBLISHER_HPP
+#define NFD_CORE_SEGMENT_PUBLISHER_HPP
+
+#include "common.hpp"
+
+#include <ndn-cxx/encoding/encoding-buffer.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+
+namespace nfd {
+
+template <class FaceBase>
+class SegmentPublisher : noncopyable
+{
+public:
+  SegmentPublisher(FaceBase& face, const Name& prefix, ndn::KeyChain& keyChain)
+    : m_face(face)
+    , m_prefix(prefix)
+    , m_keyChain(keyChain)
+  {
+  }
+
+  virtual
+  ~SegmentPublisher()
+  {
+  }
+
+  static size_t
+  getMaxSegmentSize()
+  {
+    static const size_t MAX_SEGMENT_SIZE = ndn::MAX_NDN_PACKET_SIZE >> 1;
+    return MAX_SEGMENT_SIZE;
+  }
+
+  void
+  publish()
+  {
+    Name segmentPrefix(m_prefix);
+    segmentPrefix.appendVersion();
+
+    ndn::EncodingBuffer buffer;
+
+    generate(buffer);
+
+    const uint8_t* rawBuffer = buffer.buf();
+    const uint8_t* segmentBegin = rawBuffer;
+    const uint8_t* end = rawBuffer + buffer.size();
+
+    uint64_t segmentNo = 0;
+    do
+      {
+        const uint8_t* segmentEnd = segmentBegin + getMaxSegmentSize();
+        if (segmentEnd > end)
+          {
+            segmentEnd = end;
+          }
+
+        Name segmentName(segmentPrefix);
+        segmentName.appendSegment(segmentNo);
+
+        shared_ptr<Data> data(make_shared<Data>(segmentName));
+        data->setContent(segmentBegin, segmentEnd - segmentBegin);
+
+        segmentBegin = segmentEnd;
+        if (segmentBegin >= end)
+          {
+            data->setFinalBlockId(segmentName[-1]);
+          }
+
+        publishSegment(data);
+        segmentNo++;
+      }
+    while (segmentBegin < end);
+  }
+
+protected:
+
+  virtual size_t
+  generate(ndn::EncodingBuffer& outBuffer) =0;
+
+private:
+  void
+  publishSegment(shared_ptr<Data>& data)
+  {
+    m_keyChain.sign(*data);
+    m_face.put(*data);
+  }
+
+private:
+  FaceBase& m_face;
+  const Name m_prefix;
+  ndn::KeyChain& m_keyChain;
+};
+
+} // namespace nfd
+
+#endif // NFD_CORE_SEGMENT_PUBLISHER_HPP
diff --git a/daemon/face/datagram-face.hpp b/daemon/face/datagram-face.hpp
index dff2012..d065487 100644
--- a/daemon/face/datagram-face.hpp
+++ b/daemon/face/datagram-face.hpp
@@ -83,7 +83,8 @@
 protected:
   void
   handleSend(const boost::system::error_code& error,
-             const Block& wire);
+             size_t nBytesSent,
+             const Block& payload);
 
   void
   handleReceive(const boost::system::error_code& error,
@@ -129,9 +130,9 @@
 DatagramFace<T, U>::sendInterest(const Interest& interest)
 {
   this->onSendInterest(interest);
-  m_socket->async_send(boost::asio::buffer(interest.wireEncode().wire(),
-                                           interest.wireEncode().size()),
-                       bind(&DatagramFace<T, U>::handleSend, this, _1, interest.wireEncode()));
+  const Block& payload = interest.wireEncode();
+  m_socket->async_send(boost::asio::buffer(payload.wire(), payload.size()),
+                       bind(&DatagramFace<T, U>::handleSend, this, _1, _2, payload));
 
   // anything else should be done here?
 }
@@ -141,9 +142,9 @@
 DatagramFace<T, U>::sendData(const Data& data)
 {
   this->onSendData(data);
-  m_socket->async_send(boost::asio::buffer(data.wireEncode().wire(),
-                                           data.wireEncode().size()),
-                       bind(&DatagramFace<T, U>::handleSend, this, _1, data.wireEncode()));
+  const Block& payload = data.wireEncode();
+  m_socket->async_send(boost::asio::buffer(payload.wire(), payload.size()),
+                       bind(&DatagramFace<T, U>::handleSend, this, _1, _2, payload));
 
   // anything else should be done here?
 }
@@ -151,14 +152,15 @@
 template<class T, class U>
 inline void
 DatagramFace<T, U>::handleSend(const boost::system::error_code& error,
-                               const Block& wire)
+                               size_t nBytesSent,
+                               const Block& payload)
+// 'payload' is unused; it's needed to retain the underlying Buffer
 {
   if (error != 0) {
     if (error == boost::system::errc::operation_canceled) // when socket is closed by someone
       return;
 
-    if (!m_socket->is_open())
-    {
+    if (!m_socket->is_open()) {
       fail("Tunnel closed");
       return;
     }
@@ -170,12 +172,10 @@
 
     closeSocket();
 
-    if (error == boost::asio::error::eof)
-    {
+    if (error == boost::asio::error::eof) {
       fail("Tunnel closed");
     }
-    else
-    {
+    else {
       fail("Send operation failed, closing socket: " +
              error.category().message(error.value()));
     }
@@ -184,8 +184,8 @@
 
   NFD_LOG_TRACE("[id:" << this->getId()
                 << ",uri:" << this->getRemoteUri()
-                << "] Successfully sent: " << wire.size() << " bytes");
-  // do nothing (needed to retain validity of wire memory block
+                << "] Successfully sent: " << nBytesSent << " bytes");
+  this->getMutableCounters().getNOutBytes() += nBytesSent;
 }
 
 template<class T, class U>
@@ -226,8 +226,7 @@
       return;
 
     // this should be unnecessary, but just in case
-    if (!m_socket->is_open())
-    {
+    if (!m_socket->is_open()) {
       fail("Tunnel closed");
       return;
     }
@@ -239,12 +238,10 @@
 
     closeSocket();
 
-    if (error == boost::asio::error::eof)
-    {
+    if (error == boost::asio::error::eof) {
       fail("Tunnel closed");
     }
-    else
-    {
+    else {
       fail("Receive operation failed, closing socket: " +
              error.category().message(error.value()));
     }
@@ -254,6 +251,7 @@
   NFD_LOG_TRACE("[id:" << this->getId()
                 << ",uri:" << this->getRemoteUri()
                 << "] Received: " << nBytesReceived << " bytes");
+  this->getMutableCounters().getNInBytes() += nBytesReceived;
 
   Block element;
   bool isOk = Block::fromBuffer(buffer, nBytesReceived, element);
diff --git a/daemon/face/face-counter.hpp b/daemon/face/face-counter.hpp
deleted file mode 100644
index 152c5a1..0000000
--- a/daemon/face/face-counter.hpp
+++ /dev/null
@@ -1,142 +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_DAEMON_FACE_FACE_COUNTER_HPP
-#define NFD_DAEMON_FACE_FACE_COUNTER_HPP
-
-#include "common.hpp"
-
-namespace nfd {
-
-/** \class FaceCounter
- *  \brief represents a counter on face
- *
- *  \todo This class should be noncopyable
- */
-typedef uint64_t FaceCounter;
-
-
-/** \brief contains counters on face
- */
-class FaceCounters : noncopyable
-{
-public:
-  FaceCounters();
-
-  /// incoming Interest (total packets since Face establishment)
-  const FaceCounter&
-  getNInInterests() const;
-
-  FaceCounter&
-  getNInInterests();
-
-  /// incoming Data (total packets since Face establishment)
-  const FaceCounter&
-  getNInDatas() const;
-
-  FaceCounter&
-  getNInDatas();
-
-  /// outgoing Interest (total packets since Face establishment)
-  const FaceCounter&
-  getNOutInterests() const;
-
-  FaceCounter&
-  getNOutInterests();
-
-  /// outgoing Data (total packets since Face establishment)
-  const FaceCounter&
-  getNOutDatas() const;
-
-  FaceCounter&
-  getNOutDatas();
-
-private:
-  FaceCounter m_nInInterests;
-  FaceCounter m_nInDatas;
-  FaceCounter m_outInterests;
-  FaceCounter m_outDatas;
-};
-
-inline
-FaceCounters::FaceCounters()
-  : m_nInInterests(0)
-  , m_nInDatas(0)
-  , m_outInterests(0)
-  , m_outDatas(0)
-{
-}
-
-inline const FaceCounter&
-FaceCounters::getNInInterests() const
-{
-  return m_nInInterests;
-}
-
-inline FaceCounter&
-FaceCounters::getNInInterests()
-{
-  return m_nInInterests;
-}
-
-inline const FaceCounter&
-FaceCounters::getNInDatas() const
-{
-  return m_nInDatas;
-}
-
-inline FaceCounter&
-FaceCounters::getNInDatas()
-{
-  return m_nInDatas;
-}
-
-inline const FaceCounter&
-FaceCounters::getNOutInterests() const
-{
-  return m_outInterests;
-}
-
-inline FaceCounter&
-FaceCounters::getNOutInterests()
-{
-  return m_outInterests;
-}
-
-inline const FaceCounter&
-FaceCounters::getNOutDatas() const
-{
-  return m_outDatas;
-}
-
-inline FaceCounter&
-FaceCounters::getNOutDatas()
-{
-  return m_outDatas;
-}
-
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FACE_FACE_COUNTER_HPP
diff --git a/daemon/face/face-counters.hpp b/daemon/face/face-counters.hpp
new file mode 100644
index 0000000..6dc1d6a
--- /dev/null
+++ b/daemon/face/face-counters.hpp
@@ -0,0 +1,251 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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_DAEMON_FACE_FACE_COUNTERS_HPP
+#define NFD_DAEMON_FACE_FACE_COUNTERS_HPP
+
+#include "common.hpp"
+
+namespace nfd {
+
+/** \brief represents a counter of number of packets
+ */
+// PacketCounter is noncopyable, because increment should be called on the counter,
+// not a copy of it; it's implicitly convertible to uint64_t to be observed
+class PacketCounter : noncopyable
+{
+public:
+  typedef uint64_t rep;
+
+  PacketCounter()
+    : m_value(0)
+  {
+  }
+
+  operator rep() const
+  {
+    return m_value;
+  }
+
+  PacketCounter&
+  operator++()
+  {
+    ++m_value;
+    return *this;
+  }
+  // postfix ++ operator is not provided because it's not needed
+
+  void
+  set(rep value)
+  {
+    m_value = value;
+  }
+
+private:
+  rep m_value;
+};
+
+/** \brief represents a counter of number of bytes
+ */
+// ByteCounter is noncopyable, because increment should be called on the counter,
+// not a copy of it; it's implicitly convertible to uint64_t to be observed
+class ByteCounter : noncopyable
+{
+public:
+  typedef uint64_t rep;
+
+  ByteCounter()
+    : m_value(0)
+  {
+  }
+
+  operator rep() const
+  {
+    return m_value;
+  }
+
+  ByteCounter&
+  operator+=(rep n)
+  {
+    m_value += n;
+    return *this;
+  }
+
+  void
+  set(rep value)
+  {
+    m_value = value;
+  }
+
+private:
+  rep m_value;
+};
+
+/** \brief contains network layer packet counters
+ */
+class NetworkLayerCounters : noncopyable
+{
+public:
+  /// incoming Interest
+  const PacketCounter&
+  getNInInterests() const
+  {
+    return m_nInInterests;
+  }
+
+  PacketCounter&
+  getNInInterests()
+  {
+    return m_nInInterests;
+  }
+
+  /// incoming Data
+  const PacketCounter&
+  getNInDatas() const
+  {
+    return m_nInDatas;
+  }
+
+  PacketCounter&
+  getNInDatas()
+  {
+    return m_nInDatas;
+  }
+
+  /// outgoing Interest
+  const PacketCounter&
+  getNOutInterests() const
+  {
+    return m_nOutInterests;
+  }
+
+  PacketCounter&
+  getNOutInterests()
+  {
+    return m_nOutInterests;
+  }
+
+  /// outgoing Data
+  const PacketCounter&
+  getNOutDatas() const
+  {
+    return m_nOutDatas;
+  }
+
+  PacketCounter&
+  getNOutDatas()
+  {
+    return m_nOutDatas;
+  }
+
+protected:
+  /** \brief copy current obseverations to a struct
+   *  \param recipient an object with set methods for counters
+   */
+  template<typename R>
+  void
+  copyTo(R& recipient) const
+  {
+    recipient.setNInInterests(this->getNInInterests());
+    recipient.setNInDatas(this->getNInDatas());
+    recipient.setNOutInterests(this->getNOutInterests());
+    recipient.setNOutDatas(this->getNOutDatas());
+  }
+
+private:
+  PacketCounter m_nInInterests;
+  PacketCounter m_nInDatas;
+  PacketCounter m_nOutInterests;
+  PacketCounter m_nOutDatas;
+};
+
+/** \brief contains link layer byte counters
+ */
+class LinkLayerCounters : noncopyable
+{
+public:
+  /// received bytes
+  const ByteCounter&
+  getNInBytes() const
+  {
+    return m_nInBytes;
+  }
+
+  ByteCounter&
+  getNInBytes()
+  {
+    return m_nInBytes;
+  }
+
+  /// sent bytes
+  const ByteCounter&
+  getNOutBytes() const
+  {
+    return m_nOutBytes;
+  }
+
+  ByteCounter&
+  getNOutBytes()
+  {
+    return m_nOutBytes;
+  }
+
+protected:
+  /** \brief copy current obseverations to a struct
+   *  \param recipient an object with set methods for counters
+   */
+  template<typename R>
+  void
+  copyTo(R& recipient) const
+  {
+    recipient.setNInBytes(this->getNInBytes());
+    recipient.setNOutBytes(this->getNOutBytes());
+  }
+
+private:
+  ByteCounter m_nInBytes;
+  ByteCounter m_nOutBytes;
+};
+
+/** \brief contains counters on face
+ */
+class FaceCounters : public NetworkLayerCounters, public LinkLayerCounters
+{
+public:
+  /** \brief copy current obseverations to a struct
+   *  \param recipient an object with set methods for counters
+   */
+  template<typename R>
+  void
+  copyTo(R& recipient) const
+  {
+    this->NetworkLayerCounters::copyTo(recipient);
+    this->LinkLayerCounters::copyTo(recipient);
+  }
+};
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_FACE_COUNTERS_HPP
diff --git a/daemon/face/face.cpp b/daemon/face/face.cpp
index 2c81a9a..bbf2a08 100644
--- a/daemon/face/face.cpp
+++ b/daemon/face/face.cpp
@@ -21,7 +21,7 @@
  *
  * 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 "face.hpp"
 #include "face-flags.hpp"
@@ -29,12 +29,6 @@
 
 namespace nfd {
 
-static inline void
-increaseCounter(FaceCounter& counter)
-{
-  ++counter;
-}
-
 Face::Face(const FaceUri& remoteUri, const FaceUri& localUri, bool isLocal)
   : m_id(INVALID_FACEID)
   , m_isLocal(isLocal)
@@ -43,10 +37,10 @@
   , m_isOnDemand(false)
   , m_isFailed(false)
 {
-  onReceiveInterest += bind(&increaseCounter, ref(m_counters.getNInInterests()));
-  onReceiveData     += bind(&increaseCounter, ref(m_counters.getNInDatas()));
-  onSendInterest    += bind(&increaseCounter, ref(m_counters.getNOutInterests()));
-  onSendData        += bind(&increaseCounter, ref(m_counters.getNOutDatas()));
+  onReceiveInterest += bind(&PacketCounter::operator++, &m_counters.getNInInterests());
+  onReceiveData     += bind(&PacketCounter::operator++, &m_counters.getNInDatas());
+  onSendInterest    += bind(&PacketCounter::operator++, &m_counters.getNOutInterests());
+  onSendData        += bind(&PacketCounter::operator++, &m_counters.getNOutDatas());
 }
 
 Face::~Face()
@@ -59,7 +53,7 @@
   return m_id;
 }
 
-// this method is private and should be used only by the Forwarder
+// this method is private and should be used only by the FaceTable
 void
 Face::setId(FaceId faceId)
 {
@@ -134,17 +128,13 @@
 ndn::nfd::FaceStatus
 Face::getFaceStatus() const
 {
-  const FaceCounters& counters = getCounters();
-
   ndn::nfd::FaceStatus status;
   status.setFaceId(getId())
     .setRemoteUri(getRemoteUri().toString())
     .setLocalUri(getLocalUri().toString())
-    .setFlags(getFaceFlags(*this))
-    .setNInInterests(counters.getNInInterests())
-    .setNInDatas(counters.getNInDatas())
-    .setNOutInterests(counters.getNOutInterests())
-    .setNOutDatas(counters.getNOutDatas());
+    .setFlags(getFaceFlags(*this));
+
+  this->getCounters().copyTo(status);
 
   return status;
 }
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index 2660045..52c0894 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -21,7 +21,7 @@
  *
  * 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_DAEMON_FACE_FACE_HPP
 #define NFD_DAEMON_FACE_FACE_HPP
@@ -29,7 +29,7 @@
 #include "common.hpp"
 #include "core/event-emitter.hpp"
 #include "core/face-uri.hpp"
-#include "face-counter.hpp"
+#include "face-counters.hpp"
 
 #include <ndn-cxx/management/nfd-face-status.hpp>
 
@@ -40,8 +40,20 @@
  */
 typedef int FaceId;
 
+/// indicates an invalid FaceId
 const FaceId INVALID_FACEID = -1;
 
+/// identifies the InternalFace used in management
+const FaceId FACEID_INTERNAL_FACE = 1;
+/// identifies a packet comes from the ContentStore, in LocalControlHeader incomingFaceId
+const FaceId FACEID_CONTENT_STORE = 254;
+/// identifies the NullFace that drops every packet
+const FaceId FACEID_NULL = 255;
+/// upper bound of reserved FaceIds
+const FaceId FACEID_RESERVED_MAX = 255;
+
+
+/// pratical limit of packet size in octets
 const size_t MAX_NDN_PACKET_SIZE = 8800;
 
 
diff --git a/daemon/face/multicast-udp-face.cpp b/daemon/face/multicast-udp-face.cpp
index a69b1c2..34c6cd2 100644
--- a/daemon/face/multicast-udp-face.cpp
+++ b/daemon/face/multicast-udp-face.cpp
@@ -55,7 +55,7 @@
 {
   m_sendSocket->async_send_to(boost::asio::buffer(block.wire(), block.size()),
                               m_multicastGroup,
-                              bind(&MulticastUdpFace::handleSend, this, _1, block));
+                              bind(&MulticastUdpFace::handleSend, this, _1, _2, block));
 }
 
 void
diff --git a/daemon/face/null-face.cpp b/daemon/face/null-face.cpp
new file mode 100644
index 0000000..5d55693
--- /dev/null
+++ b/daemon/face/null-face.cpp
@@ -0,0 +1,54 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 "null-face.hpp"
+
+namespace nfd {
+
+// FIB might restrict creating a nexthop record toward non-local face in /localhost namespace.
+// NullFace has isLocal=true to enable creating a "blackhole" FIB entry under /localhost.
+
+NullFace::NullFace(const FaceUri& uri)
+  : Face(uri, uri, true)
+{
+}
+
+void
+NullFace::sendInterest(const Interest& interest)
+{
+}
+
+void
+NullFace::sendData(const Data& data)
+{
+}
+
+void
+NullFace::close()
+{
+  this->fail("close");
+}
+
+} // namespace nfd
diff --git a/daemon/face/null-face.hpp b/daemon/face/null-face.hpp
new file mode 100644
index 0000000..3dae571
--- /dev/null
+++ b/daemon/face/null-face.hpp
@@ -0,0 +1,60 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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_DAEMON_FACE_NULL_FACE_HPP
+#define NFD_DAEMON_FACE_NULL_FACE_HPP
+
+#include "face.hpp"
+
+namespace nfd {
+
+/**
+ * \brief a Face that has no underlying transport and drops every packet
+ */
+class NullFace : public Face
+{
+public:
+  explicit
+  NullFace(const FaceUri& uri = FaceUri("null://"));
+
+  virtual void
+  sendInterest(const Interest& interest);
+
+  /// send a Data
+  virtual void
+  sendData(const Data& data);
+
+  /** \brief Close the face
+   *
+   *  This terminates all communication on the face and cause
+   *  onFail() method event to be invoked
+   */
+  virtual void
+  close();
+};
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_NULL_FACE_HPP
diff --git a/daemon/face/stream-face.hpp b/daemon/face/stream-face.hpp
index f9b7cd9..8eb7af0 100644
--- a/daemon/face/stream-face.hpp
+++ b/daemon/face/stream-face.hpp
@@ -21,7 +21,7 @@
  *
  * 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_DAEMON_FACE_STREAM_FACE_HPP
 #define NFD_DAEMON_FACE_STREAM_FACE_HPP
@@ -66,15 +66,15 @@
   processErrorCode(const boost::system::error_code& error);
 
   void
-  handleSend(const boost::system::error_code& error,
-             const Block& header, const Block& payload);
+  sendFromQueue();
+
   void
   handleSend(const boost::system::error_code& error,
-             const Block& wire);
+             size_t nBytesSent);
 
   void
   handleReceive(const boost::system::error_code& error,
-                std::size_t bytes_recvd);
+                size_t nBytesReceived);
 
   void
   keepFaceAliveUntilAllHandlersExecuted(const shared_ptr<Face>& face);
@@ -87,7 +87,8 @@
 
 private:
   uint8_t m_inputBuffer[MAX_NDN_PACKET_SIZE];
-  std::size_t m_inputBufferSize;
+  size_t m_inputBufferSize;
+  std::queue<Block> m_sendQueue;
 
   friend struct StreamFaceSenderImpl<Protocol, FaceBase, Interest>;
   friend struct StreamFaceSenderImpl<Protocol, FaceBase, Data>;
@@ -143,10 +144,11 @@
   static void
   send(StreamFace<Protocol, FaceBase>& face, const Packet& packet)
   {
-    face.m_socket->async_send(boost::asio::buffer(packet.wireEncode().wire(),
-                                                  packet.wireEncode().size()),
-                              bind(&StreamFace<Protocol, FaceBase>::handleSend,
-                                   &face, _1, packet.wireEncode()));
+    bool wasQueueEmpty = face.m_sendQueue.empty();
+    face.m_sendQueue.push(packet.wireEncode());
+
+    if (wasQueueEmpty)
+      face.sendFromQueue();
   }
 };
 
@@ -157,29 +159,16 @@
   static void
   send(StreamFace<Protocol, LocalFace>& face, const Packet& packet)
   {
-    using namespace boost::asio;
+    bool wasQueueEmpty = face.m_sendQueue.empty();
 
-    if (face.isEmptyFilteredLocalControlHeader(packet.getLocalControlHeader()))
+    if (!face.isEmptyFilteredLocalControlHeader(packet.getLocalControlHeader()))
       {
-        const Block& payload = packet.wireEncode();
-        face.m_socket->async_send(buffer(payload.wire(), payload.size()),
-                                  bind(&StreamFace<Protocol, LocalFace>::handleSend,
-                                       &face, _1, packet.wireEncode()));
+        face.m_sendQueue.push(face.filterAndEncodeLocalControlHeader(packet));
       }
-    else
-      {
-        Block header = face.filterAndEncodeLocalControlHeader(packet);
-        const Block& payload = packet.wireEncode();
+    face.m_sendQueue.push(packet.wireEncode());
 
-        std::vector<const_buffer> buffers;
-        buffers.reserve(2);
-        buffers.push_back(buffer(header.wire(),  header.size()));
-        buffers.push_back(buffer(payload.wire(), payload.size()));
-
-        face.m_socket->async_send(buffers,
-                                  bind(&StreamFace<Protocol, LocalFace>::handleSend,
-                                       &face, _1, header, payload));
-      }
+    if (wasQueueEmpty)
+      face.sendFromQueue();
   }
 };
 
@@ -202,6 +191,15 @@
 
 template<class T, class U>
 inline void
+StreamFace<T, U>::sendFromQueue()
+{
+  const Block& block = this->m_sendQueue.front();
+  boost::asio::async_write(*this->m_socket, boost::asio::buffer(block),
+                           bind(&StreamFace<T, U>::handleSend, this, _1, _2));
+}
+
+template<class T, class U>
+inline void
 StreamFace<T, U>::close()
 {
   if (!m_socket->is_open())
@@ -259,49 +257,43 @@
 template<class T, class U>
 inline void
 StreamFace<T, U>::handleSend(const boost::system::error_code& error,
-                             const Block& wire)
+                             size_t nBytesSent)
 {
   if (error)
     return processErrorCode(error);
 
-  NFD_LOG_TRACE("[id:" << this->getId()
-                << ",uri:" << this->getRemoteUri()
-                << "] Successfully sent: " << wire.size() << " bytes");
-}
-
-template<class T, class U>
-inline void
-StreamFace<T, U>::handleSend(const boost::system::error_code& error,
-                             const Block& header, const Block& payload)
-{
-  if (error)
-    return processErrorCode(error);
+  BOOST_ASSERT(!m_sendQueue.empty());
 
   NFD_LOG_TRACE("[id:" << this->getId()
                 << ",uri:" << this->getRemoteUri()
-                << "] Successfully sent: " << (header.size()+payload.size()) << " bytes");
+                << "] Successfully sent: " << nBytesSent << " bytes");
+  this->getMutableCounters().getNOutBytes() += nBytesSent;
+
+  m_sendQueue.pop();
+  if (!m_sendQueue.empty())
+    sendFromQueue();
 }
 
 template<class T, class U>
 inline void
 StreamFace<T, U>::handleReceive(const boost::system::error_code& error,
-                             std::size_t bytes_recvd)
+                                size_t nBytesReceived)
 {
   if (error)
     return processErrorCode(error);
 
   NFD_LOG_TRACE("[id:" << this->getId()
                 << ",uri:" << this->getRemoteUri()
-                << "] Received: " << bytes_recvd << " bytes");
+                << "] Received: " << nBytesReceived << " bytes");
+  this->getMutableCounters().getNInBytes() += nBytesReceived;
 
-  m_inputBufferSize += bytes_recvd;
-  // do magic
+  m_inputBufferSize += nBytesReceived;
 
-  std::size_t offset = 0;
+  size_t offset = 0;
 
   bool isOk = true;
   Block element;
-  while(m_inputBufferSize - offset > 0)
+  while (m_inputBufferSize - offset > 0)
     {
       isOk = Block::fromBuffer(m_inputBuffer + offset, m_inputBufferSize - offset, element);
       if (!isOk)
@@ -374,6 +366,10 @@
   // handlers are dispatched
   io.post(bind(&StreamFace<T, U>::keepFaceAliveUntilAllHandlersExecuted,
                this, this->shared_from_this()));
+
+  // clear send queue
+  std::queue<Block> emptyQueue;
+  std::swap(emptyQueue, m_sendQueue);
 }
 
 } // namespace nfd
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index 8d1e780..151f235 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "udp-channel.hpp"
 #include "core/global-io.hpp"
@@ -200,7 +201,7 @@
 
 void
 UdpChannel::newPeer(const boost::system::error_code& error,
-                    std::size_t nBytesReceived)
+                    size_t nBytesReceived)
 {
   NFD_LOG_DEBUG("UdpChannel::newPeer from " << m_newRemoteEndpoint);
 
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index fed232a..da2b14b 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_FACE_UDP_CHANNEL_HPP
 #define NFD_DAEMON_FACE_UDP_CHANNEL_HPP
@@ -124,7 +125,7 @@
    *        associated with any UdpFace
    */
   void
-  newPeer(const boost::system::error_code& error, std::size_t nBytesReceived);
+  newPeer(const boost::system::error_code& error, size_t nBytesReceived);
 
   void
   handleEndpointResolution(const boost::system::error_code& error,
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index 10dbdfd..a95c562 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "face-table.hpp"
 #include "forwarder.hpp"
@@ -32,7 +33,7 @@
 
 FaceTable::FaceTable(Forwarder& forwarder)
   : m_forwarder(forwarder)
-  , m_lastFaceId(0)
+  , m_lastFaceId(FACEID_RESERVED_MAX)
 {
 }
 
@@ -44,18 +45,32 @@
 void
 FaceTable::add(shared_ptr<Face> face)
 {
-  if (face->getId() != INVALID_FACEID &&
-      m_faces.count(face->getId()) > 0)
-    {
-      NFD_LOG_DEBUG("Trying to add existing face id=" << face->getId() << " to the face table");
-      return;
-    }
+  if (face->getId() != INVALID_FACEID && m_faces.count(face->getId()) > 0) {
+    NFD_LOG_WARN("Trying to add existing face id=" << face->getId() << " to the face table");
+    return;
+  }
 
   FaceId faceId = ++m_lastFaceId;
+  BOOST_ASSERT(faceId > FACEID_RESERVED_MAX);
+  this->addImpl(face, faceId);
+}
+
+void
+FaceTable::addReserved(shared_ptr<Face> face, FaceId faceId)
+{
+  BOOST_ASSERT(face->getId() == INVALID_FACEID);
+  BOOST_ASSERT(m_faces.count(face->getId()) == 0);
+  BOOST_ASSERT(faceId <= FACEID_RESERVED_MAX);
+  this->addImpl(face, faceId);
+}
+
+void
+FaceTable::addImpl(shared_ptr<Face> face, FaceId faceId)
+{
   face->setId(faceId);
   m_faces[faceId] = face;
-  NFD_LOG_INFO("Added face id=" << faceId << " remote=" << face->getRemoteUri() <<
-                                              " local=" << face->getLocalUri());
+  NFD_LOG_INFO("Added face id=" << faceId << " remote=" << face->getRemoteUri()
+                                          << " local=" << face->getLocalUri());
 
   face->onReceiveInterest += bind(&Forwarder::onInterest,
                                   &m_forwarder, ref(*face), _1);
diff --git a/daemon/fw/face-table.hpp b/daemon/fw/face-table.hpp
index 8f7dcb2..a255cfe 100644
--- a/daemon/fw/face-table.hpp
+++ b/daemon/fw/face-table.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_FW_FACE_TABLE_HPP
 #define NFD_DAEMON_FW_FACE_TABLE_HPP
@@ -35,7 +36,7 @@
 
 /** \brief container of all Faces
  */
-class FaceTable
+class FaceTable : noncopyable
 {
 public:
   explicit
@@ -47,6 +48,10 @@
   VIRTUAL_WITH_TESTS void
   add(shared_ptr<Face> face);
 
+  /// add a special Face with a reserved FaceId
+  VIRTUAL_WITH_TESTS void
+  addReserved(shared_ptr<Face> face, FaceId faceId);
+
   VIRTUAL_WITH_TESTS shared_ptr<Face>
   get(FaceId id) const;
 
@@ -88,8 +93,11 @@
   EventEmitter<shared_ptr<Face> > onRemove;
 
 private:
+  void
+  addImpl(shared_ptr<Face> face, FaceId faceId);
+
   // remove is private because it's a subscriber of face.onFail event.
-  // face->close() closes a face and would trigger .remove(face)
+  // face->close() closes a face and triggers .remove(face)
   void
   remove(shared_ptr<Face> face);
 
diff --git a/daemon/fw/forwarder-counter.hpp b/daemon/fw/forwarder-counter.hpp
deleted file mode 100644
index be74928..0000000
--- a/daemon/fw/forwarder-counter.hpp
+++ /dev/null
@@ -1,49 +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_DAEMON_FW_FORWARDER_COUNTER_HPP
-#define NFD_DAEMON_FW_FORWARDER_COUNTER_HPP
-
-#include "face/face-counter.hpp"
-
-namespace nfd {
-
-/** \class ForwarderCounter
- *  \brief represents a counter on forwarder
- *
- *  \todo This class should be noncopyable
- */
-typedef uint64_t ForwarderCounter;
-
-
-/** \brief contains counters on forwarder
- */
-class ForwarderCounters : public FaceCounters
-{
-};
-
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_FW_FORWARDER_COUNTER_HPP
diff --git a/daemon/fw/forwarder-counters.hpp b/daemon/fw/forwarder-counters.hpp
new file mode 100644
index 0000000..ba3b57c
--- /dev/null
+++ b/daemon/fw/forwarder-counters.hpp
@@ -0,0 +1,51 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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_DAEMON_FW_FORWARDER_COUNTERS_HPP
+#define NFD_DAEMON_FW_FORWARDER_COUNTERS_HPP
+
+#include "face/face-counters.hpp"
+
+namespace nfd {
+
+/** \brief contains counters on forwarder
+ */
+class ForwarderCounters : public NetworkLayerCounters
+{
+public:
+  /** \brief copy current obseverations to a struct
+   *  \param recipient an object with set methods for counters
+   */
+  template<typename R>
+  void
+  copyTo(R& recipient) const
+  {
+    this->NetworkLayerCounters::copyTo(recipient);
+  }
+};
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_FW_FORWARDER_COUNTERS_HPP
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 0e2f0d2..d3fb541 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -59,7 +59,7 @@
   NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
                 " interest=" << interest.getName());
   const_cast<Interest&>(interest).setIncomingFaceId(inFace.getId());
-  m_counters.getNInInterests() ++;
+  ++m_counters.getNInInterests();
 
   // /localhost scope control
   bool isViolatingLocalhost = !inFace.isLocal() &&
@@ -92,6 +92,7 @@
     // CS lookup
     const Data* csMatch = m_cs.find(interest);
     if (csMatch != 0) {
+      const_cast<Data*>(csMatch)->setIncomingFaceId(FACEID_CONTENT_STORE);
       // XXX should we lookup PIT for other Interests that also match csMatch?
 
       // goto outgoing Data pipeline
@@ -187,7 +188,7 @@
 
   // send Interest
   outFace.sendInterest(*interest);
-  m_counters.getNOutInterests() ++;
+  ++m_counters.getNOutInterests();
 }
 
 void
@@ -227,7 +228,7 @@
   // receive Data
   NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());
   const_cast<Data&>(data).setIncomingFaceId(inFace.getId());
-  m_counters.getNInDatas() ++;
+  ++m_counters.getNInDatas();
 
   // /localhost scope control
   bool isViolatingLocalhost = !inFace.isLocal() &&
@@ -331,7 +332,7 @@
 
   // send Data
   outFace.sendData(data);
-  m_counters.getNOutDatas() ++;
+  ++m_counters.getNOutDatas();
 }
 
 static inline bool
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index acb0451..8c5ed79 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -27,7 +27,7 @@
 
 #include "common.hpp"
 #include "core/scheduler.hpp"
-#include "forwarder-counter.hpp"
+#include "forwarder-counters.hpp"
 #include "face-table.hpp"
 #include "table/fib.hpp"
 #include "table/pit.hpp"
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index 3b17ab1..838dd9a 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -166,7 +166,7 @@
       // going out of this strategy's namespace
       return;
     }
-    this->getMeasurements().extendLifetime(*measurementsEntry, MEASUREMENTS_LIFETIME);
+    this->getMeasurements().extendLifetime(measurementsEntry, MEASUREMENTS_LIFETIME);
 
     shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
       this->getMeasurementsEntryInfo(measurementsEntry);
@@ -187,7 +187,7 @@
       // going out of this strategy's namespace
       return;
     }
-    this->getMeasurements().extendLifetime(*measurementsEntry, MEASUREMENTS_LIFETIME);
+    this->getMeasurements().extendLifetime(measurementsEntry, MEASUREMENTS_LIFETIME);
 
     shared_ptr<MeasurementsEntryInfo> measurementsEntryInfo =
       this->getMeasurementsEntryInfo(measurementsEntry);
diff --git a/daemon/main.cpp b/daemon/main.cpp
index 70717c6..e275668 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -31,6 +31,7 @@
 #include "core/global-io.hpp"
 #include "core/privilege-helper.hpp"
 #include "fw/forwarder.hpp"
+#include "face/null-face.hpp"
 #include "mgmt/internal-face.hpp"
 #include "mgmt/fib-manager.hpp"
 #include "mgmt/face-manager.hpp"
@@ -78,6 +79,10 @@
 
     initializeManagement();
 
+    m_forwarder->getFaceTable().addReserved(make_shared<NullFace>(), FACEID_NULL);
+    m_forwarder->getFaceTable().addReserved(
+      make_shared<NullFace>(FaceUri("contentstore://")), FACEID_CONTENT_STORE);
+
     PrivilegeHelper::drop();
   }
 
@@ -124,20 +129,23 @@
 
     m_fibManager = make_shared<FibManager>(ref(m_forwarder->getFib()),
                                            bind(&Forwarder::getFace, m_forwarder.get(), _1),
-                                           m_internalFace);
+                                           m_internalFace,
+                                           ndn::ref(m_keyChain));
 
     m_faceManager = make_shared<FaceManager>(ref(m_forwarder->getFaceTable()),
-                                             m_internalFace);
+                                             m_internalFace,
+                                             ndn::ref(m_keyChain));
 
     m_strategyChoiceManager =
       make_shared<StrategyChoiceManager>(ref(m_forwarder->getStrategyChoice()),
-                                         m_internalFace);
+                                         m_internalFace,
+                                         ndn::ref(m_keyChain));
 
     m_statusServer = make_shared<StatusServer>(m_internalFace,
-                                               ref(*m_forwarder));
+                                               ref(*m_forwarder),
+                                               ndn::ref(m_keyChain));
 
     ConfigFile config((IgnoreRibAndLogSections()));
-
     general::setConfigFile(config);
 
     TablesConfigSection tablesConfig(m_forwarder->getCs(),
@@ -145,12 +153,11 @@
                                      m_forwarder->getFib(),
                                      m_forwarder->getStrategyChoice(),
                                      m_forwarder->getMeasurements());
-
     tablesConfig.setConfigFile(config);
 
     m_internalFace->getValidator().setConfigFile(config);
 
-    m_forwarder->addFace(m_internalFace);
+    m_forwarder->getFaceTable().addReserved(m_internalFace, FACEID_INTERNAL_FACE);
 
     m_faceManager->setConfigFile(config);
 
@@ -315,6 +322,7 @@
 
   shared_ptr<std::ofstream>         m_logFile;
   std::basic_streambuf<char>*       m_originalStreamBuf;
+  ndn::KeyChain                     m_keyChain;
 };
 
 } // namespace nfd
diff --git a/daemon/mgmt/app-face.cpp b/daemon/mgmt/app-face.cpp
deleted file mode 100644
index 2c9c9b5..0000000
--- a/daemon/mgmt/app-face.cpp
+++ /dev/null
@@ -1,35 +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 "app-face.hpp"
-
-namespace nfd {
-
-void
-AppFace::sign(Data& data)
-{
-  m_keyChain.sign(data);
-}
-
-} // namespace nfd
diff --git a/daemon/mgmt/app-face.hpp b/daemon/mgmt/app-face.hpp
index 476fda7..13442a8 100644
--- a/daemon/mgmt/app-face.hpp
+++ b/daemon/mgmt/app-face.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_MGMT_APP_FACE_HPP
 #define NFD_DAEMON_MGMT_APP_FACE_HPP
@@ -41,16 +42,10 @@
                     OnInterest onInterest) = 0;
 
   virtual void
-  sign(Data& data);
-
-  virtual void
   put(const Data& data) = 0;
 
   virtual
   ~AppFace() { }
-
-protected:
-  ndn::KeyChain m_keyChain;
 };
 
 } // namespace nfd
diff --git a/daemon/mgmt/channel-status-publisher.cpp b/daemon/mgmt/channel-status-publisher.cpp
index c212f72..8abe2fb 100644
--- a/daemon/mgmt/channel-status-publisher.cpp
+++ b/daemon/mgmt/channel-status-publisher.cpp
@@ -37,9 +37,10 @@
 
 
 ChannelStatusPublisher::ChannelStatusPublisher(const FactoryMap& factories,
-                                               shared_ptr<AppFace> face,
-                                               const Name& prefix)
-  : SegmentPublisher(face, prefix)
+                                               AppFace& face,
+                                               const Name& prefix,
+                                               ndn::KeyChain& keyChain)
+  : SegmentPublisher(face, prefix, keyChain)
   , m_factories(factories)
 {
 
diff --git a/daemon/mgmt/channel-status-publisher.hpp b/daemon/mgmt/channel-status-publisher.hpp
index b204258..ef660a3 100644
--- a/daemon/mgmt/channel-status-publisher.hpp
+++ b/daemon/mgmt/channel-status-publisher.hpp
@@ -26,20 +26,22 @@
 #ifndef NFD_DAEMON_MGMT_CHANNEL_STATUS_PUBLISHER_HPP
 #define NFD_DAEMON_MGMT_CHANNEL_STATUS_PUBLISHER_HPP
 
-#include "mgmt/segment-publisher.hpp"
+#include "core/segment-publisher.hpp"
+#include "mgmt/app-face.hpp"
 
 namespace nfd {
 
 class ProtocolFactory;
 
-class ChannelStatusPublisher : public SegmentPublisher
+class ChannelStatusPublisher : public SegmentPublisher<AppFace>
 {
 public:
   typedef std::map< std::string/*protocol*/, shared_ptr<ProtocolFactory> > FactoryMap;
 
   ChannelStatusPublisher(const FactoryMap& factories,
-                         shared_ptr<AppFace> face,
-                         const Name& prefix);
+                         AppFace& face,
+                         const Name& prefix,
+                         ndn::KeyChain& keyChain);
 
   virtual
   ~ChannelStatusPublisher();
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index b6cca36..c8bc267 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -113,12 +113,13 @@
 const size_t FaceManager::CHANNELS_LIST_DATASET_NCOMPS = CHANNELS_LIST_DATASET_PREFIX.size();
 
 FaceManager::FaceManager(FaceTable& faceTable,
-                         shared_ptr<InternalFace> face)
-  : ManagerBase(face, FACE_MANAGER_PRIVILEGE)
+                         shared_ptr<InternalFace> face,
+                         ndn::KeyChain& keyChain)
+  : ManagerBase(face, FACE_MANAGER_PRIVILEGE, keyChain)
   , m_faceTable(faceTable)
-  , m_faceStatusPublisher(m_faceTable, m_face, FACES_LIST_DATASET_PREFIX)
-  , m_channelStatusPublisher(m_factories, m_face, CHANNELS_LIST_DATASET_PREFIX)
-  , m_notificationStream(m_face, FACE_EVENTS_PREFIX)
+  , m_faceStatusPublisher(m_faceTable, *m_face, FACES_LIST_DATASET_PREFIX, keyChain)
+  , m_channelStatusPublisher(m_factories, *m_face, CHANNELS_LIST_DATASET_PREFIX, keyChain)
+  , m_notificationStream(m_face, FACE_EVENTS_PREFIX, keyChain)
   , m_signedVerbDispatch(SIGNED_COMMAND_VERBS,
                          SIGNED_COMMAND_VERBS +
                          (sizeof(SIGNED_COMMAND_VERBS) / sizeof(SignedVerbAndProcessor)))
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index 0a5579e..ec5decf 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -61,7 +61,8 @@
    */
 
   FaceManager(FaceTable& faceTable,
-              shared_ptr<InternalFace> face);
+              shared_ptr<InternalFace> face,
+              ndn::KeyChain& keyChain);
 
   virtual
   ~FaceManager();
diff --git a/daemon/mgmt/face-status-publisher.cpp b/daemon/mgmt/face-status-publisher.cpp
index 62531d2..04542c8 100644
--- a/daemon/mgmt/face-status-publisher.cpp
+++ b/daemon/mgmt/face-status-publisher.cpp
@@ -34,9 +34,10 @@
 
 
 FaceStatusPublisher::FaceStatusPublisher(const FaceTable& faceTable,
-                                         shared_ptr<AppFace> face,
-                                         const Name& prefix)
-  : SegmentPublisher(face, prefix)
+                                         AppFace& face,
+                                         const Name& prefix,
+                                         ndn::KeyChain& keyChain)
+  : SegmentPublisher(face, prefix, keyChain)
   , m_faceTable(faceTable)
 {
 
diff --git a/daemon/mgmt/face-status-publisher.hpp b/daemon/mgmt/face-status-publisher.hpp
index 935426d..5091165 100644
--- a/daemon/mgmt/face-status-publisher.hpp
+++ b/daemon/mgmt/face-status-publisher.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,23 +21,25 @@
  *
  * 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_DAEMON_MGMT_FACE_STATUS_PUBLISHER_HPP
 #define NFD_DAEMON_MGMT_FACE_STATUS_PUBLISHER_HPP
 
-#include "mgmt/segment-publisher.hpp"
+#include "core/segment-publisher.hpp"
+#include "mgmt/app-face.hpp"
 
 namespace nfd {
 
 class FaceTable;
 
-class FaceStatusPublisher : public SegmentPublisher
+class FaceStatusPublisher : public SegmentPublisher<AppFace>
 {
 public:
   FaceStatusPublisher(const FaceTable& faceTable,
-                      shared_ptr<AppFace> face,
-                      const Name& prefix);
+                      AppFace& face,
+                      const Name& prefix,
+                      ndn::KeyChain& keyChain);
 
   virtual
   ~FaceStatusPublisher();
diff --git a/daemon/mgmt/fib-enumeration-publisher.cpp b/daemon/mgmt/fib-enumeration-publisher.cpp
index 4278c98..b7bad51 100644
--- a/daemon/mgmt/fib-enumeration-publisher.cpp
+++ b/daemon/mgmt/fib-enumeration-publisher.cpp
@@ -33,9 +33,10 @@
 NFD_LOG_INIT("FibEnumerationPublisher");
 
 FibEnumerationPublisher::FibEnumerationPublisher(const Fib& fib,
-                                                 shared_ptr<AppFace> face,
-                                                 const Name& prefix)
-  : SegmentPublisher(face, prefix)
+                                                 AppFace& face,
+                                                 const Name& prefix,
+                                                 ndn::KeyChain& keyChain)
+  : SegmentPublisher(face, prefix, keyChain)
   , m_fib(fib)
 {
 }
diff --git a/daemon/mgmt/fib-enumeration-publisher.hpp b/daemon/mgmt/fib-enumeration-publisher.hpp
index 2aa7539..2ff5c31 100644
--- a/daemon/mgmt/fib-enumeration-publisher.hpp
+++ b/daemon/mgmt/fib-enumeration-publisher.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,23 +21,25 @@
  *
  * 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_DAEMON_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
 #define NFD_DAEMON_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
 
-#include "mgmt/segment-publisher.hpp"
+#include "core/segment-publisher.hpp"
+#include "mgmt/app-face.hpp"
 
 namespace nfd {
 
 class Fib;
 
-class FibEnumerationPublisher : public SegmentPublisher
+class FibEnumerationPublisher : public SegmentPublisher<AppFace>
 {
 public:
   FibEnumerationPublisher(const Fib& fib,
-                          shared_ptr<AppFace> face,
-                          const Name& prefix);
+                          AppFace& face,
+                          const Name& prefix,
+                          ndn::KeyChain& keyChain);
 
   virtual
   ~FibEnumerationPublisher();
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index 98c4578..bda1681 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "fib-manager.hpp"
 
@@ -76,11 +77,12 @@
 
 FibManager::FibManager(Fib& fib,
                        function<shared_ptr<Face>(FaceId)> getFace,
-                       shared_ptr<InternalFace> face)
-  : ManagerBase(face, FIB_PRIVILEGE)
+                       shared_ptr<InternalFace> face,
+                       ndn::KeyChain& keyChain)
+  : ManagerBase(face, FIB_PRIVILEGE, keyChain)
   , m_managedFib(fib)
   , m_getFace(getFace)
-  , m_fibEnumerationPublisher(fib, face, LIST_COMMAND_PREFIX)
+  , m_fibEnumerationPublisher(fib, *face, LIST_COMMAND_PREFIX, keyChain)
   , m_signedVerbDispatch(SIGNED_COMMAND_VERBS,
                          SIGNED_COMMAND_VERBS +
                          (sizeof(SIGNED_COMMAND_VERBS) / sizeof(SignedVerbAndProcessor)))
diff --git a/daemon/mgmt/fib-manager.hpp b/daemon/mgmt/fib-manager.hpp
index 4591088..c8c21ea 100644
--- a/daemon/mgmt/fib-manager.hpp
+++ b/daemon/mgmt/fib-manager.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_MGMT_FIB_MANAGER_HPP
 #define NFD_DAEMON_MGMT_FIB_MANAGER_HPP
@@ -43,7 +44,8 @@
 
   FibManager(Fib& fib,
              function<shared_ptr<Face>(FaceId)> getFace,
-             shared_ptr<InternalFace> face);
+             shared_ptr<InternalFace> face,
+             ndn::KeyChain& keyChain);
 
   virtual
   ~FibManager();
diff --git a/daemon/mgmt/manager-base.cpp b/daemon/mgmt/manager-base.cpp
index 60f3bc9..ca1e00d 100644
--- a/daemon/mgmt/manager-base.cpp
+++ b/daemon/mgmt/manager-base.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "manager-base.hpp"
 #include "core/logger.hpp"
@@ -29,8 +30,10 @@
 
 NFD_LOG_INIT("ManagerBase");
 
-ManagerBase::ManagerBase(shared_ptr<InternalFace> face, const std::string& privilege)
+ManagerBase::ManagerBase(shared_ptr<InternalFace> face, const std::string& privilege,
+                         ndn::KeyChain& keyChain)
   : m_face(face)
+  , m_keyChain(keyChain)
 {
   face->getValidator().addSupportedPrivilege(privilege);
 }
@@ -92,7 +95,7 @@
   shared_ptr<Data> responseData(make_shared<Data>(name));
   responseData->setContent(encodedControl);
 
-  m_face->sign(*responseData);
+  m_keyChain.sign(*responseData);
   m_face->put(*responseData);
 }
 
diff --git a/daemon/mgmt/manager-base.hpp b/daemon/mgmt/manager-base.hpp
index 2eac9e3..15c19ee 100644
--- a/daemon/mgmt/manager-base.hpp
+++ b/daemon/mgmt/manager-base.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_MGMT_MANAGER_BASE_HPP
 #define NFD_DAEMON_MGMT_MANAGER_BASE_HPP
@@ -51,7 +52,9 @@
     Error(const std::string& what) : std::runtime_error(what) {}
   };
 
-  ManagerBase(shared_ptr<InternalFace> face, const std::string& privilege);
+  ManagerBase(shared_ptr<InternalFace> face,
+              const std::string& privilege,
+              ndn::KeyChain& keyChain);
 
   virtual
   ~ManagerBase();
@@ -112,6 +115,7 @@
 
 protected:
   shared_ptr<InternalFace> m_face;
+  ndn::KeyChain& m_keyChain;
 };
 
 inline void
diff --git a/daemon/mgmt/notification-stream.hpp b/daemon/mgmt/notification-stream.hpp
index 8d727d7..06c3b5a 100644
--- a/daemon/mgmt/notification-stream.hpp
+++ b/daemon/mgmt/notification-stream.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +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_DAEMON_MGMT_NOTIFICATION_STREAM_HPP
 #define NFD_DAEMON_MGMT_NOTIFICATION_STREAM_HPP
 
@@ -31,7 +33,7 @@
 class NotificationStream
 {
 public:
-  NotificationStream(shared_ptr<AppFace> face, const Name& prefix);
+  NotificationStream(shared_ptr<AppFace> face, const Name& prefix, ndn::KeyChain& keyChain);
 
   ~NotificationStream();
 
@@ -42,13 +44,17 @@
   shared_ptr<AppFace> m_face;
   const Name m_prefix;
   uint64_t m_sequenceNo;
+  ndn::KeyChain& m_keyChain;
 };
 
 inline
-NotificationStream::NotificationStream(shared_ptr<AppFace> face, const Name& prefix)
+NotificationStream::NotificationStream(shared_ptr<AppFace> face,
+                                       const Name& prefix,
+                                       ndn::KeyChain& keyChain)
   : m_face(face)
   , m_prefix(prefix)
   , m_sequenceNo(0)
+  , m_keyChain(keyChain)
 {
 }
 
@@ -62,7 +68,7 @@
   data->setContent(notification.wireEncode());
   data->setFreshnessPeriod(time::seconds(1));
 
-  m_face->sign(*data);
+  m_keyChain.sign(*data);
   m_face->put(*data);
 
   ++m_sequenceNo;
diff --git a/daemon/mgmt/segment-publisher.cpp b/daemon/mgmt/segment-publisher.cpp
deleted file mode 100644
index 01f3d12..0000000
--- a/daemon/mgmt/segment-publisher.cpp
+++ /dev/null
@@ -1,101 +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 "segment-publisher.hpp"
-
-#include "core/logger.hpp"
-#include "face/face.hpp"
-
-#include <ndn-cxx/util/time.hpp>
-
-namespace nfd {
-
-NFD_LOG_INIT("SegmentPublisher");
-
-SegmentPublisher::SegmentPublisher(shared_ptr<AppFace> face,
-                                   const Name& prefix)
-  : m_face(face)
-  , m_prefix(prefix)
-{
-
-}
-
-
-SegmentPublisher::~SegmentPublisher()
-{
-
-}
-
-void
-SegmentPublisher::publish()
-{
-  Name segmentPrefix(m_prefix);
-  segmentPrefix.appendVersion();
-
-  static const size_t  MAX_SEGMENT_SIZE = MAX_NDN_PACKET_SIZE >> 1;
-
-  ndn::EncodingBuffer buffer;
-
-  generate(buffer);
-
-  const uint8_t* rawBuffer = buffer.buf();
-  const uint8_t* segmentBegin = rawBuffer;
-  const uint8_t* end = rawBuffer + buffer.size();
-
-  uint64_t segmentNo = 0;
-  while (segmentBegin < end)
-    {
-      const uint8_t* segmentEnd = segmentBegin + MAX_SEGMENT_SIZE;
-      if (segmentEnd > end)
-        {
-          segmentEnd = end;
-        }
-
-      Name segmentName(segmentPrefix);
-      segmentName.appendSegment(segmentNo);
-
-      shared_ptr<Data> data(make_shared<Data>(segmentName));
-      data->setContent(segmentBegin, segmentEnd - segmentBegin);
-
-      segmentBegin = segmentEnd;
-      if (segmentBegin >= end)
-        {
-          NFD_LOG_DEBUG("final block is " << segmentNo);
-          data->setFinalBlockId(segmentName[-1]);
-        }
-
-      NFD_LOG_DEBUG("publishing segment #" << segmentNo);
-      publishSegment(data);
-      segmentNo++;
-    }
-}
-
-void
-SegmentPublisher::publishSegment(shared_ptr<Data>& data)
-{
-  m_face->sign(*data);
-  m_face->put(*data);
-}
-
-} // namespace nfd
diff --git a/daemon/mgmt/segment-publisher.hpp b/daemon/mgmt/segment-publisher.hpp
deleted file mode 100644
index eeefda7..0000000
--- a/daemon/mgmt/segment-publisher.hpp
+++ /dev/null
@@ -1,65 +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_DAEMON_MGMT_SEGMENT_PUBLISHER_HPP
-#define NFD_DAEMON_MGMT_SEGMENT_PUBLISHER_HPP
-
-#include "common.hpp"
-#include "mgmt/app-face.hpp"
-
-#include <ndn-cxx/encoding/encoding-buffer.hpp>
-
-namespace nfd {
-
-class AppFace;
-
-class SegmentPublisher : noncopyable
-{
-public:
-  SegmentPublisher(shared_ptr<AppFace> face,
-                   const Name& prefix);
-
-  virtual
-  ~SegmentPublisher();
-
-  void
-  publish();
-
-protected:
-
-  virtual size_t
-  generate(ndn::EncodingBuffer& outBuffer) =0;
-
-private:
-  void
-  publishSegment(shared_ptr<Data>& data);
-
-private:
-  shared_ptr<AppFace> m_face;
-  const Name m_prefix;
-};
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_MGMT_SEGMENT_PUBLISHER_HPP
diff --git a/daemon/mgmt/status-server.cpp b/daemon/mgmt/status-server.cpp
index 148061c..8861b9a 100644
--- a/daemon/mgmt/status-server.cpp
+++ b/daemon/mgmt/status-server.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "status-server.hpp"
 #include "fw/forwarder.hpp"
@@ -31,10 +32,11 @@
 const Name StatusServer::DATASET_PREFIX = "ndn:/localhost/nfd/status";
 const time::milliseconds StatusServer::RESPONSE_FRESHNESS = time::milliseconds(5000);
 
-StatusServer::StatusServer(shared_ptr<AppFace> face, Forwarder& forwarder)
+StatusServer::StatusServer(shared_ptr<AppFace> face, Forwarder& forwarder, ndn::KeyChain& keyChain)
   : m_face(face)
   , m_forwarder(forwarder)
   , m_startTimestamp(time::system_clock::now())
+  , m_keyChain(keyChain)
 {
   m_face->setInterestFilter(DATASET_PREFIX, bind(&StatusServer::onInterest, this, _2));
 }
@@ -52,7 +54,7 @@
   shared_ptr<ndn::nfd::ForwarderStatus> status = this->collectStatus();
   data->setContent(status->wireEncode());
 
-  m_face->sign(*data);
+  m_keyChain.sign(*data);
   m_face->put(*data);
 }
 
@@ -71,11 +73,7 @@
   status->setNMeasurementsEntries(m_forwarder.getMeasurements().size());
   status->setNCsEntries(m_forwarder.getCs().size());
 
-  const ForwarderCounters& counters = m_forwarder.getCounters();
-  status->setNInInterests(counters.getNInInterests());
-  status->setNInDatas(counters.getNInDatas());
-  status->setNOutInterests(counters.getNOutInterests());
-  status->setNOutDatas(counters.getNOutDatas());
+  m_forwarder.getCounters().copyTo(*status);
 
   return status;
 }
diff --git a/daemon/mgmt/status-server.hpp b/daemon/mgmt/status-server.hpp
index c046adf..16dbf8e 100644
--- a/daemon/mgmt/status-server.hpp
+++ b/daemon/mgmt/status-server.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_MGMT_STATUS_SERVER_HPP
 #define NFD_DAEMON_MGMT_STATUS_SERVER_HPP
@@ -35,7 +36,7 @@
 class StatusServer : noncopyable
 {
 public:
-  StatusServer(shared_ptr<AppFace> face, Forwarder& forwarder);
+  StatusServer(shared_ptr<AppFace> face, Forwarder& forwarder, ndn::KeyChain& keyChain);
 
 private:
   void
@@ -51,6 +52,7 @@
   shared_ptr<AppFace> m_face;
   Forwarder& m_forwarder;
   time::system_clock::TimePoint m_startTimestamp;
+  ndn::KeyChain& m_keyChain;
 };
 
 } // namespace nfd
diff --git a/daemon/mgmt/strategy-choice-manager.cpp b/daemon/mgmt/strategy-choice-manager.cpp
index b51badc..1193900 100644
--- a/daemon/mgmt/strategy-choice-manager.cpp
+++ b/daemon/mgmt/strategy-choice-manager.cpp
@@ -1,12 +1,12 @@
 /* -*- 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,
- *                     The University of Memphis
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -21,7 +21,7 @@
  *
  * 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 "strategy-choice-manager.hpp"
 #include "table/strategy-choice.hpp"
@@ -46,10 +46,11 @@
 const Name StrategyChoiceManager::LIST_DATASET_PREFIX("/localhost/nfd/strategy-choice/list");
 
 StrategyChoiceManager::StrategyChoiceManager(StrategyChoice& strategyChoice,
-                                             shared_ptr<InternalFace> face)
-  : ManagerBase(face, STRATEGY_CHOICE_PRIVILEGE)
+                                             shared_ptr<InternalFace> face,
+                                             ndn::KeyChain& keyChain)
+  : ManagerBase(face, STRATEGY_CHOICE_PRIVILEGE, keyChain)
   , m_strategyChoice(strategyChoice)
-  , m_listPublisher(strategyChoice, m_face, LIST_DATASET_PREFIX)
+  , m_listPublisher(strategyChoice, *m_face, LIST_DATASET_PREFIX, keyChain)
 {
   face->setInterestFilter("/localhost/nfd/strategy-choice",
                           bind(&StrategyChoiceManager::onStrategyChoiceRequest, this, _2));
diff --git a/daemon/mgmt/strategy-choice-manager.hpp b/daemon/mgmt/strategy-choice-manager.hpp
index f3a0ed5..c2ccd53 100644
--- a/daemon/mgmt/strategy-choice-manager.hpp
+++ b/daemon/mgmt/strategy-choice-manager.hpp
@@ -1,12 +1,12 @@
 /* -*- 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,
- *                     The University of Memphis
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -21,7 +21,7 @@
  *
  * 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_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP
 #define NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP
@@ -41,7 +41,8 @@
 {
 public:
   StrategyChoiceManager(StrategyChoice& strategyChoice,
-                        shared_ptr<InternalFace> face);
+                        shared_ptr<InternalFace> face,
+                        ndn::KeyChain& keyChain);
 
   virtual
   ~StrategyChoiceManager();
diff --git a/daemon/mgmt/strategy-choice-publisher.cpp b/daemon/mgmt/strategy-choice-publisher.cpp
index add1b73..163ac3a 100644
--- a/daemon/mgmt/strategy-choice-publisher.cpp
+++ b/daemon/mgmt/strategy-choice-publisher.cpp
@@ -35,9 +35,10 @@
 
 
 StrategyChoicePublisher::StrategyChoicePublisher(const StrategyChoice& strategyChoice,
-                                                 shared_ptr<AppFace> face,
-                                                 const Name& prefix)
-  : SegmentPublisher(face, prefix)
+                                                 AppFace& face,
+                                                 const Name& prefix,
+                                                 ndn::KeyChain& keyChain)
+  : SegmentPublisher(face, prefix, keyChain)
   , m_strategyChoice(strategyChoice)
 {
 
diff --git a/daemon/mgmt/strategy-choice-publisher.hpp b/daemon/mgmt/strategy-choice-publisher.hpp
index d19a92e..8322b63 100644
--- a/daemon/mgmt/strategy-choice-publisher.hpp
+++ b/daemon/mgmt/strategy-choice-publisher.hpp
@@ -26,18 +26,20 @@
 #ifndef NFD_DAEMON_MGMT_STRATEGY_CHOICE_PUBLISHER_HPP
 #define NFD_DAEMON_MGMT_STRATEGY_CHOICE_PUBLISHER_HPP
 
-#include "mgmt/segment-publisher.hpp"
+#include "core/segment-publisher.hpp"
+#include "mgmt/app-face.hpp"
 
 namespace nfd {
 
 class StrategyChoice;
 
-class StrategyChoicePublisher : public SegmentPublisher
+class StrategyChoicePublisher : public SegmentPublisher<AppFace>
 {
 public:
   StrategyChoicePublisher(const StrategyChoice& strategyChoice,
-                          shared_ptr<AppFace> face,
-                          const Name& prefix);
+                          AppFace& face,
+                          const Name& prefix,
+                          ndn::KeyChain& keyChain);
 
   virtual
   ~StrategyChoicePublisher();
diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp
index 516de57..3672b66 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "fib.hpp"
 #include "pit-entry.hpp"
@@ -114,24 +115,28 @@
 }
 
 void
+Fib::erase(shared_ptr<name_tree::Entry> nameTreeEntry)
+{
+  nameTreeEntry->setFibEntry(shared_ptr<fib::Entry>());
+  m_nameTree.eraseEntryIfEmpty(nameTreeEntry);
+  --m_nItems;
+}
+
+void
 Fib::erase(const Name& prefix)
 {
   shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(prefix);
-  if (static_cast<bool>(nameTreeEntry))
-  {
-    nameTreeEntry->setFibEntry(shared_ptr<fib::Entry>());
-    --m_nItems;
+  if (static_cast<bool>(nameTreeEntry)) {
+    this->erase(nameTreeEntry);
   }
 }
 
 void
 Fib::erase(const fib::Entry& entry)
 {
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(entry);
-  if (static_cast<bool>(nameTreeEntry))
-  {
-    nameTreeEntry->setFibEntry(shared_ptr<fib::Entry>());
-    --m_nItems;
+  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(entry);
+  if (static_cast<bool>(nameTreeEntry)) {
+    this->erase(nameTreeEntry);
   }
 }
 
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
index e5aaf15..615462f 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_TABLE_FIB_HPP
 #define NFD_DAEMON_TABLE_FIB_HPP
@@ -128,6 +129,9 @@
   shared_ptr<fib::Entry>
   findLongestPrefixMatch(shared_ptr<name_tree::Entry> nameTreeEntry) const;
 
+  void
+  erase(shared_ptr<name_tree::Entry> nameTreeEntry);
+
 private:
   NameTree& m_nameTree;
   size_t m_nItems;
diff --git a/daemon/table/measurements-accessor.cpp b/daemon/table/measurements-accessor.cpp
index 8ecb0fd..81b1432 100644
--- a/daemon/table/measurements-accessor.cpp
+++ b/daemon/table/measurements-accessor.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "measurements-accessor.hpp"
 
diff --git a/daemon/table/measurements-accessor.hpp b/daemon/table/measurements-accessor.hpp
index 2db0ccb..2108435 100644
--- a/daemon/table/measurements-accessor.hpp
+++ b/daemon/table/measurements-accessor.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_DAEMON_TABLE_MEASUREMENTS_ACCESSOR_HPP
 #define NFD_DAEMON_TABLE_MEASUREMENTS_ACCESSOR_HPP
@@ -68,7 +69,7 @@
    *  The entry will be kept until at least now()+lifetime.
    */
   void
-  extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime);
+  extendLifetime(shared_ptr<measurements::Entry> entry, const time::nanoseconds& lifetime);
 
 private:
   /** \brief perform access control to Measurements entry
@@ -109,7 +110,8 @@
 }
 
 inline void
-MeasurementsAccessor::extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime)
+MeasurementsAccessor::extendLifetime(shared_ptr<measurements::Entry> entry,
+                                     const time::nanoseconds& lifetime)
 {
   m_measurements.extendLifetime(entry, lifetime);
 }
diff --git a/daemon/table/measurements.cpp b/daemon/table/measurements.cpp
index a63c602..4943bf4 100644
--- a/daemon/table/measurements.cpp
+++ b/daemon/table/measurements.cpp
@@ -100,7 +100,15 @@
     return shared_ptr<measurements::Entry>();
   }
 
-  return this->get(child->getName().getPrefix(-1));
+  shared_ptr<name_tree::Entry> nameTreeChild = m_nameTree.get(*child);
+  shared_ptr<name_tree::Entry> nameTreeEntry = nameTreeChild->getParent();
+  if (static_cast<bool>(nameTreeEntry)) {
+    return this->get(nameTreeEntry);
+  }
+  else {
+    BOOST_ASSERT(nameTreeChild->getPrefix().size() == 0); // root entry has no parent
+    return shared_ptr<measurements::Entry>();
+  }
 }
 
 shared_ptr<measurements::Entry>
@@ -124,33 +132,38 @@
 }
 
 void
-Measurements::extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime)
+Measurements::extendLifetime(shared_ptr<measurements::Entry> entry,
+                             const time::nanoseconds& lifetime)
 {
-  shared_ptr<measurements::Entry> ret = this->findExactMatch(entry.getName());
-  if (static_cast<bool>(ret))
-  {
-    time::steady_clock::TimePoint expiry = time::steady_clock::now() + lifetime;
-    if (ret->m_expiry >= expiry) // has longer lifetime, not extending
-      return;
-    scheduler::cancel(entry.m_cleanup);
-    entry.m_expiry = expiry;
-    entry.m_cleanup = scheduler::schedule(lifetime,
-                         bind(&Measurements::cleanup, this, ret));
+  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(*entry);
+  if (!static_cast<bool>(nameTreeEntry) ||
+      nameTreeEntry->getMeasurementsEntry().get() != entry.get()) {
+    // entry is already gone; it is a dangling reference
+    return;
   }
+
+  time::steady_clock::TimePoint expiry = time::steady_clock::now() + lifetime;
+  if (entry->m_expiry >= expiry) {
+    // has longer lifetime, not extending
+    return;
+  }
+
+  scheduler::cancel(entry->m_cleanup);
+  entry->m_expiry = expiry;
+  entry->m_cleanup = scheduler::schedule(lifetime, bind(&Measurements::cleanup, this, entry));
 }
 
 void
 Measurements::cleanup(shared_ptr<measurements::Entry> entry)
 {
-  BOOST_ASSERT(entry);
+  BOOST_ASSERT(static_cast<bool>(entry));
 
-  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.findExactMatch(entry->getName());
-  if (static_cast<bool>(nameTreeEntry))
-  {
+  shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.get(*entry);
+  if (static_cast<bool>(nameTreeEntry)) {
     nameTreeEntry->setMeasurementsEntry(shared_ptr<measurements::Entry>());
+    m_nameTree.eraseEntryIfEmpty(nameTreeEntry);
     m_nItems--;
   }
-
 }
 
 } // namespace nfd
diff --git a/daemon/table/measurements.hpp b/daemon/table/measurements.hpp
index 1ace0b9..7478c58 100644
--- a/daemon/table/measurements.hpp
+++ b/daemon/table/measurements.hpp
@@ -86,7 +86,7 @@
    *  The entry will be kept until at least now()+lifetime.
    */
   void
-  extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime);
+  extendLifetime(shared_ptr<measurements::Entry> entry, const time::nanoseconds& lifetime);
 
   size_t
   size() const;
diff --git a/daemon/table/name-tree-entry.cpp b/daemon/table/name-tree-entry.cpp
index 0e4d821..017dbfe 100644
--- a/daemon/table/name-tree-entry.cpp
+++ b/daemon/table/name-tree-entry.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,9 +21,7 @@
  *
  * 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/>.
- **/
-
-// Name Tree Entry (i.e., Name Prefix Entry)
+ */
 
 #include "name-tree-entry.hpp"
 
@@ -41,7 +40,7 @@
   // resolve hash collisions
   // So before erasing a single node, make sure its m_next == 0
   // See eraseEntryIfEmpty in name-tree.cpp
-  if (m_next)
+  if (m_next != 0)
     delete m_next;
 }
 
@@ -55,6 +54,42 @@
 {
 }
 
+bool
+Entry::isEmpty() const
+{
+  return m_children.empty() &&
+         !static_cast<bool>(m_fibEntry) &&
+         m_pitEntries.empty() &&
+         !static_cast<bool>(m_measurementsEntry) &&
+         !static_cast<bool>(m_strategyChoiceEntry);
+}
+
+void
+Entry::setFibEntry(shared_ptr<fib::Entry> fibEntry)
+{
+  if (static_cast<bool>(fibEntry)) {
+    BOOST_ASSERT(!static_cast<bool>(fibEntry->m_nameTreeEntry));
+  }
+
+  if (static_cast<bool>(m_fibEntry)) {
+    m_fibEntry->m_nameTreeEntry.reset();
+  }
+  m_fibEntry = fibEntry;
+  if (static_cast<bool>(m_fibEntry)) {
+    m_fibEntry->m_nameTreeEntry = this->shared_from_this();
+  }
+}
+
+void
+Entry::insertPitEntry(shared_ptr<pit::Entry> pitEntry)
+{
+  BOOST_ASSERT(static_cast<bool>(pitEntry));
+  BOOST_ASSERT(!static_cast<bool>(pitEntry->m_nameTreeEntry));
+
+  m_pitEntries.push_back(pitEntry);
+  pitEntry->m_nameTreeEntry = this->shared_from_this();
+}
+
 void
 Entry::erasePitEntry(shared_ptr<pit::Entry> pitEntry)
 {
@@ -70,5 +105,37 @@
   pitEntry->m_nameTreeEntry.reset();
 }
 
+void
+Entry::setMeasurementsEntry(shared_ptr<measurements::Entry> measurementsEntry)
+{
+  if (static_cast<bool>(measurementsEntry)) {
+    BOOST_ASSERT(!static_cast<bool>(measurementsEntry->m_nameTreeEntry));
+  }
+
+  if (static_cast<bool>(m_measurementsEntry)) {
+    m_measurementsEntry->m_nameTreeEntry.reset();
+  }
+  m_measurementsEntry = measurementsEntry;
+  if (static_cast<bool>(m_measurementsEntry)) {
+    m_measurementsEntry->m_nameTreeEntry = this->shared_from_this();
+  }
+}
+
+void
+Entry::setStrategyChoiceEntry(shared_ptr<strategy_choice::Entry> strategyChoiceEntry)
+{
+  if (static_cast<bool>(strategyChoiceEntry)) {
+    BOOST_ASSERT(!static_cast<bool>(strategyChoiceEntry->m_nameTreeEntry));
+  }
+
+  if (static_cast<bool>(m_strategyChoiceEntry)) {
+    m_strategyChoiceEntry->m_nameTreeEntry.reset();
+  }
+  m_strategyChoiceEntry = strategyChoiceEntry;
+  if (static_cast<bool>(m_strategyChoiceEntry)) {
+    m_strategyChoiceEntry->m_nameTreeEntry = this->shared_from_this();
+  }
+}
+
 } // namespace name_tree
 } // namespace nfd
diff --git a/daemon/table/name-tree-entry.hpp b/daemon/table/name-tree-entry.hpp
index 48c9af7..d0e3587 100644
--- a/daemon/table/name-tree-entry.hpp
+++ b/daemon/table/name-tree-entry.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,9 +21,7 @@
  *
  * 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/>.
- **/
-
-// Name Tree Entry (i.e., Name Prefix Entry)
+ */
 
 #ifndef NFD_DAEMON_TABLE_NAME_TREE_ENTRY_HPP
 #define NFD_DAEMON_TABLE_NAME_TREE_ENTRY_HPP
@@ -95,6 +94,7 @@
   bool
   isEmpty() const;
 
+public: // attached table entries
   void
   setFibEntry(shared_ptr<fib::Entry> fibEntry);
 
@@ -187,37 +187,12 @@
   return !m_children.empty();
 }
 
-inline bool
-Entry::isEmpty() const
-{
-  return m_children.empty() &&
-         !static_cast<bool>(m_fibEntry) &&
-         m_pitEntries.empty() &&
-         !static_cast<bool>(m_measurementsEntry);
-}
-
 inline shared_ptr<fib::Entry>
 Entry::getFibEntry() const
 {
   return m_fibEntry;
 }
 
-inline void
-Entry::setFibEntry(shared_ptr<fib::Entry> fibEntry)
-{
-  if (static_cast<bool>(fibEntry)) {
-    BOOST_ASSERT(!static_cast<bool>(fibEntry->m_nameTreeEntry));
-  }
-
-  if (static_cast<bool>(m_fibEntry)) {
-    m_fibEntry->m_nameTreeEntry.reset();
-  }
-  m_fibEntry = fibEntry;
-  if (static_cast<bool>(m_fibEntry)) {
-    m_fibEntry->m_nameTreeEntry = this->shared_from_this();
-  }
-}
-
 inline bool
 Entry::hasPitEntries() const
 {
@@ -230,60 +205,18 @@
   return m_pitEntries;
 }
 
-inline void
-Entry::insertPitEntry(shared_ptr<pit::Entry> pitEntry)
-{
-  BOOST_ASSERT(static_cast<bool>(pitEntry));
-  BOOST_ASSERT(!static_cast<bool>(pitEntry->m_nameTreeEntry));
-
-  m_pitEntries.push_back(pitEntry);
-  pitEntry->m_nameTreeEntry = this->shared_from_this();
-}
-
 inline shared_ptr<measurements::Entry>
 Entry::getMeasurementsEntry() const
 {
   return m_measurementsEntry;
 }
 
-inline void
-Entry::setMeasurementsEntry(shared_ptr<measurements::Entry> measurementsEntry)
-{
-  if (static_cast<bool>(measurementsEntry)) {
-    BOOST_ASSERT(!static_cast<bool>(measurementsEntry->m_nameTreeEntry));
-  }
-
-  if (static_cast<bool>(m_measurementsEntry)) {
-    m_measurementsEntry->m_nameTreeEntry.reset();
-  }
-  m_measurementsEntry = measurementsEntry;
-  if (static_cast<bool>(m_measurementsEntry)) {
-    m_measurementsEntry->m_nameTreeEntry = this->shared_from_this();
-  }
-}
-
 inline shared_ptr<strategy_choice::Entry>
 Entry::getStrategyChoiceEntry() const
 {
   return m_strategyChoiceEntry;
 }
 
-inline void
-Entry::setStrategyChoiceEntry(shared_ptr<strategy_choice::Entry> strategyChoiceEntry)
-{
-  if (static_cast<bool>(strategyChoiceEntry)) {
-    BOOST_ASSERT(!static_cast<bool>(strategyChoiceEntry->m_nameTreeEntry));
-  }
-
-  if (static_cast<bool>(m_strategyChoiceEntry)) {
-    m_strategyChoiceEntry->m_nameTreeEntry.reset();
-  }
-  m_strategyChoiceEntry = strategyChoiceEntry;
-  if (static_cast<bool>(m_strategyChoiceEntry)) {
-    m_strategyChoiceEntry->m_nameTreeEntry = this->shared_from_this();
-  }
-}
-
 } // namespace name_tree
 } // namespace nfd
 
diff --git a/daemon/table/name-tree.hpp b/daemon/table/name-tree.hpp
index 2f404bf..027f852 100644
--- a/daemon/table/name-tree.hpp
+++ b/daemon/table/name-tree.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,9 +21,7 @@
  *
  * 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/>.
- **/
-
-// Name Tree (Name Prefix Hash Table)
+ */
 
 #ifndef NFD_DAEMON_TABLE_NAME_TREE_HPP
 #define NFD_DAEMON_TABLE_NAME_TREE_HPP
@@ -121,17 +120,12 @@
   shared_ptr<name_tree::Entry>
   findExactMatch(const Name& prefix) const;
 
-  shared_ptr<name_tree::Entry>
-  findExactMatch(const fib::Entry& fibEntry) const;
-
   /**
-   * \brief Erase a Name Tree Entry if this entry is empty.
-   * \details If a Name Tree Entry contains no Children, no FIB, no PIT, and
-   * no Measurements entries, then it can be erased. In addition, its parent entry
-   * will also be examined by following the parent pointer until all empty entries
-   * are erased.
-   * \param entry The pointer to the entry to be erased. The entry pointer should
-   * returned by the findExactMatch(), lookup(), or findLongestPrefixMatch() functions.
+   * \brief Delete a Name Tree Entry if this entry is empty.
+   * \param entry The entry to be deleted if empty.
+   * \note This function must be called after a table entry is detached from Name Tree
+   *       entry. The function deletes a Name Tree entry if nothing is attached to it and
+   *       it has no children, then repeats the same process on its ancestors.
    */
   bool
   eraseEntryIfEmpty(shared_ptr<name_tree::Entry> entry);
@@ -297,12 +291,6 @@
 }
 
 inline shared_ptr<name_tree::Entry>
-NameTree::findExactMatch(const fib::Entry& fibEntry) const
-{
-  return fibEntry.m_nameTreeEntry;
-}
-
-inline shared_ptr<name_tree::Entry>
 NameTree::get(const fib::Entry& fibEntry) const
 {
   return fibEntry.m_nameTreeEntry;
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index 5839771..e089a09 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -129,10 +129,7 @@
 bool
 Entry::addNonce(uint32_t nonce)
 {
-  std::pair<std::set<uint32_t>::iterator, bool> insertResult =
-    m_nonces.insert(nonce);
-
-  return insertResult.second;
+  return m_nonceList.add(nonce);
 }
 
 InRecordCollection::iterator
@@ -173,7 +170,7 @@
   }
 
   it->update(interest);
-  m_nonces.insert(interest.getNonce());
+  m_nonceList.add(interest.getNonce());
   return it;
 }
 
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index fb89e27..420bb29 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -26,6 +26,7 @@
 #ifndef NFD_DAEMON_TABLE_PIT_ENTRY_HPP
 #define NFD_DAEMON_TABLE_PIT_ENTRY_HPP
 
+#include "pit-nonce-list.hpp"
 #include "pit-in-record.hpp"
 #include "pit-out-record.hpp"
 #include "core/scheduler.hpp"
@@ -155,7 +156,7 @@
   EventId m_stragglerTimer;
 
 private:
-  std::set<uint32_t> m_nonces;
+  pit::NonceList m_nonceList;
   shared_ptr<const Interest> m_interest;
   InRecordCollection m_inRecords;
   OutRecordCollection m_outRecords;
diff --git a/daemon/table/pit-nonce-list.cpp b/daemon/table/pit-nonce-list.cpp
new file mode 100644
index 0000000..02502ab
--- /dev/null
+++ b/daemon/table/pit-nonce-list.cpp
@@ -0,0 +1,66 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 "pit-nonce-list.hpp"
+
+namespace nfd {
+namespace pit {
+
+// The NonceList has limited capacity to avoid memory explosion
+// if PIT entry is constantly refreshed (NFD Bug #1770).
+// Current implementation keeps nonces in a set to detect duplicates,
+// and a queue to evict the oldest nonce when capacity limit is reached.
+// A limitation is that a nonce first appeared at time 0 and duplicated at time 10
+// could be evicted before a nonce appeared only once at time 5;
+// this limitation should not affect normal operation.
+
+const size_t NonceList::CAPACITY = 256;
+
+NonceList::NonceList()
+{
+}
+
+bool
+NonceList::add(uint32_t nonce)
+{
+  bool isNew = m_nonceSet.insert(nonce).second;
+  if (!isNew)
+    return false;
+
+  m_nonceQueue.push(nonce);
+  BOOST_ASSERT(m_nonceSet.size() == m_nonceQueue.size());
+
+  if (m_nonceSet.size() > CAPACITY) {
+    size_t nErased = m_nonceSet.erase(m_nonceQueue.front());
+    BOOST_ASSERT(nErased == 1);
+    m_nonceQueue.pop();
+    BOOST_ASSERT(m_nonceSet.size() == m_nonceQueue.size());
+    BOOST_ASSERT(m_nonceSet.size() <= CAPACITY);
+  }
+  return true;
+}
+
+} // namespace pit
+} // namespace nfd
diff --git a/daemon/table/pit-nonce-list.hpp b/daemon/table/pit-nonce-list.hpp
new file mode 100644
index 0000000..393ae34
--- /dev/null
+++ b/daemon/table/pit-nonce-list.hpp
@@ -0,0 +1,64 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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_DAEMON_TABLE_PIT_NONCE_LIST_HPP
+#define NFD_DAEMON_TABLE_PIT_NONCE_LIST_HPP
+
+#include "common.hpp"
+
+namespace nfd {
+namespace pit {
+
+/** \brief represents a Nonce list
+ */
+class NonceList : noncopyable
+{
+public:
+  NonceList();
+
+  /** \brief records a nonce
+   *  \return true if nonce is new; false if nonce is seen before
+   */
+  bool
+  add(uint32_t nonce);
+
+  size_t
+  size() const
+  {
+    return m_nonceSet.size();
+  }
+
+public:
+  static const size_t CAPACITY;
+
+private:
+  std::set<uint32_t> m_nonceSet;
+  std::queue<uint32_t> m_nonceQueue;
+};
+
+} // namespace pit
+} // namespace nfd
+
+#endif // NFD_DAEMON_TABLE_PIT_NONCE_LIST_HPP
diff --git a/daemon/table/strategy-choice.cpp b/daemon/table/strategy-choice.cpp
index 34c583e..aa5db1b 100644
--- a/daemon/table/strategy-choice.cpp
+++ b/daemon/table/strategy-choice.cpp
@@ -21,7 +21,7 @@
  *
  * 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 "strategy-choice.hpp"
 #include "core/logger.hpp"
@@ -120,6 +120,7 @@
   this->changeStrategy(entry, oldStrategy.shared_from_this(), parentStrategy.shared_from_this());
 
   nameTreeEntry->setStrategyChoiceEntry(shared_ptr<Entry>());
+  m_nameTree.eraseEntryIfEmpty(nameTreeEntry);
   --m_nItems;
 }
 
diff --git a/docs/_static/nfd-status.xsd b/docs/_static/nfd-status.xsd
index 829ba7c..6a080a7 100644
--- a/docs/_static/nfd-status.xsd
+++ b/docs/_static/nfd-status.xsd
@@ -18,6 +18,13 @@
   </xs:sequence>
 </xs:complexType>
 
+<xs:complexType name="bidirectionalByteCountersType">
+  <xs:sequence>
+    <xs:element type="xs:nonNegativeInteger" name="incomingBytes"/>
+    <xs:element type="xs:nonNegativeInteger" name="outgoingBytes"/>
+  </xs:sequence>
+</xs:complexType>
+
 <xs:complexType name="generalStatusType">
   <xs:sequence>
     <xs:element type="xs:string" name="version"/>
@@ -47,8 +54,8 @@
 
 <xs:complexType name="faceFlagsType">
   <xs:sequence>
-    <xs:element type="xs:string" name="local" maxOccurs="1" minOccurs="0"/>
-    <xs:element type="xs:string" name="on-demand" maxOccurs="1" minOccurs="0"/>
+    <xs:element type="xs:string" name="local" minOccurs="0"/>
+    <xs:element type="xs:string" name="on-demand" minOccurs="0"/>
   </xs:sequence>
 </xs:complexType>
 
@@ -57,9 +64,10 @@
     <xs:element type="xs:nonNegativeInteger" name="faceId"/>
     <xs:element type="xs:anyURI" name="remoteUri"/>
     <xs:element type="xs:anyURI" name="localUri"/>
-    <xs:element type="xs:duration" name="expirationPeriod" maxOccurs="1" minOccurs="0"/>
+    <xs:element type="xs:duration" name="expirationPeriod" minOccurs="0"/>
     <xs:element type="nfd:bidirectionalPacketCountersType" name="packetCounters"/>
-    <xs:element type="nfd:faceFlagsType" name="flags" maxOccurs="1" minOccurs="0"/>
+    <xs:element type="nfd:bidirectionalByteCountersType" name="byteCounters"/>
+    <xs:element type="nfd:faceFlagsType" name="flags" minOccurs="0"/>
   </xs:sequence>
 </xs:complexType>
 
@@ -95,6 +103,35 @@
   </xs:sequence>
 </xs:complexType>
 
+<xs:complexType name="routeType">
+  <xs:sequence>
+    <xs:element type="xs:nonNegativeInteger" name="faceId"/>
+    <xs:element type="xs:nonNegativeInteger" name="origin"/>
+    <xs:element type="xs:nonNegativeInteger" name="cost"/>
+    <xs:element type="xs:nonNegativeInteger" name="flags"/>
+    <xs:element type="xs:duration" name="expirationPeriod" minOccurs="0"/>
+  </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="ribEntryType">
+  <xs:sequence>
+    <xs:element type="xs:anyURI" name="prefix"/>
+    <xs:element name="routes">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element type="nfd:routeType" name="route" maxOccurs="unbounded"/>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+  </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="ribType">
+  <xs:sequence>
+    <xs:element type="nfd:ribEntryType" name="ribEntry" maxOccurs="unbounded" minOccurs="0"/>
+  </xs:sequence>
+</xs:complexType>
+
 <xs:complexType name="strategyType">
   <xs:sequence>
     <xs:element type="xs:anyURI" name="name"/>
@@ -122,6 +159,7 @@
       <xs:element type="nfd:channelsType" name="channels"/>
       <xs:element type="nfd:facesType" name="faces"/>
       <xs:element type="nfd:fibType" name="fib"/>
+      <xs:element type="nfd:ribType" name="rib"/>
       <xs:element type="nfd:strategyChoicesType" name="strategyChoices"/>
     </xs:sequence>
   </xs:complexType>
diff --git a/docs/manpages/nfd-status.rst b/docs/manpages/nfd-status.rst
index 5a52ae2..a4d7c04 100644
--- a/docs/manpages/nfd-status.rst
+++ b/docs/manpages/nfd-status.rst
@@ -31,6 +31,9 @@
 ``-b``
   Retrieve FIB information.
 
+``-r``
+  Retrieve RIB information.
+
 ``-s``
   Retrieve configured strategy choice for NDN namespaces.
 
@@ -50,37 +53,46 @@
 Get all status information from NFD::
 
     $ nfd-status
+
     General NFD status:
-                   version=1000
-                 startTime=20140621T165241.938000
-               currentTime=20140621T170712.007000
-                    uptime=870 seconds
-          nNameTreeEntries=8
-               nFibEntries=2
+                   version=2000
+                 startTime=20140725T232341.374000
+               currentTime=20140725T233240
+                    uptime=538 seconds
+          nNameTreeEntries=10
+               nFibEntries=3
                nPitEntries=2
       nMeasurementsEntries=0
-                nCsEntries=24
-              nInInterests=33
-             nOutInterests=31
-                  nInDatas=24
-                 nOutDatas=18
+                nCsEntries=56
+              nInInterests=55
+             nOutInterests=54
+                  nInDatas=56
+                 nOutDatas=47
     Channels:
+      ws://[::]:9696
       unix:///private/var/run/nfd.sock
       udp6://[::]:6363
       udp4://0.0.0.0:6363
       tcp6://[::]:6363
       tcp4://0.0.0.0:6363
     Faces:
-      faceid=1 remote=internal:// local=internal:// counters={in={0i 26d} out={34i 0d}}
-      faceid=2 remote=udp4://224.0.23.170:56363 local=udp4://192.168.1.103:56363 counters={in={0i 0d} out={0i 0d}}
-      faceid=3 remote=udp4://224.0.23.170:56363 local=udp4://127.0.0.1:56363 counters={in={0i 0d} out={0i 0d}}
-      faceid=4 remote=ether://[01:00:5e:00:17:aa] local=dev://bridge0 counters={in={0i 0d} out={0i 0d}}
-      faceid=5 remote=ether://[01:00:5e:00:17:aa] local=dev://en0 counters={in={0i 0d} out={0i 0d}}
-      faceid=6 remote=ether://[01:00:5e:00:17:aa] local=dev://en1 counters={in={0i 0d} out={0i 0d}}
-      faceid=7 remote=fd://27 local=unix:///private/var/run/nfd.sock counters={in={23i 0d} out={0i 8d}}
-      faceid=10 remote=fd://28 local=unix:///private/var/run/nfd.sock counters={in={3i 0d} out={0i 2d}}
+      faceid=1 remote=internal:// local=internal:// counters={in={0i 52d 0B} out={51i 0d 0B}} local
+      faceid=254 remote=contentstore:// local=contentstore:// counters={in={0i 0d 0B} out={0i 0d 0B}} local
+      faceid=255 remote=null:// local=null:// counters={in={0i 0d 0B} out={0i 0d 0B}} local
+      faceid=256 remote=udp4://224.0.23.170:56363 local=udp4://129.82.138.211:56363 counters={in={0i 0d 0B} out={0i 0d 0B}}
+      faceid=257 remote=udp4://224.0.23.170:56363 local=udp4://127.0.0.1:56363 counters={in={0i 0d 0B} out={0i 0d 0B}}
+      faceid=258 remote=ether://[01:00:5e:00:17:aa] local=dev://bridge0 counters={in={0i 0d 0B} out={0i 0d 0B}}
+      faceid=259 remote=ether://[01:00:5e:00:17:aa] local=dev://en0 counters={in={0i 0d 0B} out={0i 0d 0B}}
+      faceid=260 remote=ether://[01:00:5e:00:17:aa] local=dev://en1 counters={in={0i 0d 0B} out={0i 0d 0B}}
+      faceid=261 remote=ether://[01:00:5e:00:17:aa] local=dev://en2 counters={in={0i 0d 0B} out={0i 0d 0B}}
+      faceid=262 remote=fd://30 local=unix:///private/var/run/nfd.sock counters={in={24i 6d 4880B} out={6i 16d 8417B}} local on-demand
+      faceid=268 remote=fd://31 local=unix:///private/var/run/nfd.sock counters={in={1i 0d 410B} out={0i 1d 764B}} local on-demand
+      faceid=269 remote=fd://32 local=unix:///private/var/run/nfd.sock counters={in={3i 0d 137B} out={0i 2d 925B}} local on-demand
     FIB:
       /localhost/nfd nexthops={faceid=1 (cost=0)}
-      /localhost/nfd/rib nexthops={faceid=7 (cost=0)}
+      /example/testApp nexthops={faceid=268 (cost=0)}
+      /localhost/nfd/rib nexthops={faceid=262 (cost=0)}
+    Rib:
+     /example/testApp route={faceid=268 (origin=0 cost=0 flags=1)}
     Strategy choices:
       / strategy=/localhost/nfd/strategy/best-route
diff --git a/rib/main.cpp b/rib/main.cpp
index b123b04..bfea4f7 100644
--- a/rib/main.cpp
+++ b/rib/main.cpp
@@ -1,12 +1,12 @@
 /* -*- 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,
- *                     The University of Memphis
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -21,7 +21,7 @@
  *
  * 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 <getopt.h>
 
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 28a1e3e..993d84b 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -45,19 +45,30 @@
   RibManager::COMMAND_UNSIGNED_NCOMPS +
   4; // (timestamp, nonce, signed info tlv, signature tlv)
 
-const RibManager::VerbAndProcessor RibManager::COMMAND_VERBS[] =
+const RibManager::SignedVerbAndProcessor RibManager::SIGNED_COMMAND_VERBS[] =
   {
-    VerbAndProcessor(
-                     Name::Component("register"),
-                     &RibManager::registerEntry
-                     ),
+    SignedVerbAndProcessor(
+                           Name::Component("register"),
+                           &RibManager::registerEntry
+                           ),
 
-    VerbAndProcessor(
-                     Name::Component("unregister"),
-                     &RibManager::unregisterEntry
-                     ),
+    SignedVerbAndProcessor(
+                           Name::Component("unregister"),
+                           &RibManager::unregisterEntry
+                           ),
   };
 
+const RibManager::UnsignedVerbAndProcessor RibManager::UNSIGNED_COMMAND_VERBS[] =
+  {
+    UnsignedVerbAndProcessor(
+                             Name::Component("list"),
+                             &RibManager::listEntries
+                             ),
+  };
+
+const Name RibManager::LIST_COMMAND_PREFIX("/localhost/nfd/rib/list");
+const size_t RibManager::LIST_COMMAND_NCOMPS = LIST_COMMAND_PREFIX.size();
+
 RibManager::RibManager(ndn::Face& face)
   : m_face(face)
   , m_nfdController(m_face)
@@ -65,9 +76,14 @@
   , m_localhopValidator(m_face)
   , m_faceMonitor(m_face)
   , m_isLocalhopEnabled(false)
+  , m_ribStatusPublisher(m_managedRib, face, LIST_COMMAND_PREFIX, m_keyChain)
   , m_lastTransactionId(0)
-  , m_verbDispatch(COMMAND_VERBS,
-                   COMMAND_VERBS + (sizeof(COMMAND_VERBS) / sizeof(VerbAndProcessor)))
+  , m_signedVerbDispatch(SIGNED_COMMAND_VERBS,
+                         SIGNED_COMMAND_VERBS +
+                         (sizeof(SIGNED_COMMAND_VERBS) / sizeof(SignedVerbAndProcessor)))
+  , m_unsignedVerbDispatch(UNSIGNED_COMMAND_VERBS,
+                           UNSIGNED_COMMAND_VERBS +
+                           (sizeof(UNSIGNED_COMMAND_VERBS) / sizeof(UnsignedVerbAndProcessor)))
 {
 }
 
@@ -137,11 +153,11 @@
 {
   const Block& encodedControl = response.wireEncode();
 
-  Data responseData(name);
-  responseData.setContent(encodedControl);
+  shared_ptr<Data> responseData = make_shared<Data>(name);
+  responseData->setContent(encodedControl);
 
-  m_keyChain.sign(responseData);
-  m_face.put(responseData);
+  m_keyChain.sign(*responseData);
+  m_face.put(*responseData);
 }
 
 void
@@ -156,9 +172,22 @@
 void
 RibManager::onLocalhostRequest(const Interest& request)
 {
-  m_localhostValidator.validate(request,
-                                bind(&RibManager::onCommandValidated, this, _1),
-                                bind(&RibManager::onCommandValidationFailed, this, _1, _2));
+  const Name& command = request.getName();
+  const Name::Component& verb = command.get(COMMAND_PREFIX.size());
+
+  UnsignedVerbDispatchTable::const_iterator unsignedVerbProcessor = m_unsignedVerbDispatch.find(verb);
+
+  if (unsignedVerbProcessor != m_unsignedVerbDispatch.end())
+    {
+      NFD_LOG_DEBUG("command result: processing unsigned verb: " << verb);
+      (unsignedVerbProcessor->second)(this, request);
+    }
+  else
+    {
+      m_localhostValidator.validate(request,
+                                    bind(&RibManager::onCommandValidated, this, _1),
+                                    bind(&RibManager::onCommandValidationFailed, this, _1, _2));
+    }
 }
 
 void
@@ -179,8 +208,8 @@
   const Name::Component& verb = command[COMMAND_PREFIX.size()];
   const Name::Component& parameterComponent = command[COMMAND_PREFIX.size() + 1];
 
-  VerbDispatchTable::const_iterator verbProcessor = m_verbDispatch.find(verb);
-  if (verbProcessor != m_verbDispatch.end())
+  SignedVerbDispatchTable::const_iterator verbProcessor = m_signedVerbDispatch.find(verb);
+  if (verbProcessor != m_signedVerbDispatch.end())
     {
       ControlParameters parameters;
       if (!extractParameters(parameterComponent, parameters))
@@ -227,7 +256,8 @@
   faceEntry.cost = parameters.getCost();
   faceEntry.flags = parameters.getFlags();
 
-  if (parameters.getExpirationPeriod() != time::milliseconds::max())
+  if (parameters.hasExpirationPeriod() &&
+      parameters.getExpirationPeriod() != time::milliseconds::max())
     {
       faceEntry.expires = time::steady_clock::now() + parameters.getExpirationPeriod();
 
@@ -675,5 +705,22 @@
   sendUpdatesToFib(shared_ptr<const Interest>(), parameters);
 }
 
+void
+RibManager::listEntries(const Interest& request)
+{
+  const Name& command = request.getName();
+  const size_t commandNComps = command.size();
+
+  if (commandNComps < LIST_COMMAND_NCOMPS ||
+      !LIST_COMMAND_PREFIX.isPrefixOf(command))
+    {
+      NFD_LOG_DEBUG("command result: malformed");
+      sendResponse(command, 400, "Malformed command");
+      return;
+    }
+
+  m_ribStatusPublisher.publish();
+}
+
 } // namespace rib
 } // namespace nfd
diff --git a/rib/rib-manager.hpp b/rib/rib-manager.hpp
index 6566d1f..a19d211 100644
--- a/rib/rib-manager.hpp
+++ b/rib/rib-manager.hpp
@@ -29,6 +29,7 @@
 #include "rib.hpp"
 #include "face-monitor.hpp"
 #include "core/config-file.hpp"
+#include "rib-status-publisher.hpp"
 
 #include <ndn-cxx/security/validator-config.hpp>
 #include <ndn-cxx/management/nfd-controller.hpp>
@@ -198,6 +199,9 @@
   void
   invalidateTransaction(const TransactionId transactionId);
 
+  void
+  listEntries(const Interest& request);
+
 private:
   Rib m_managedRib;
   ndn::Face& m_face;
@@ -208,6 +212,8 @@
   FaceMonitor m_faceMonitor;
   bool m_isLocalhopEnabled;
 
+  RibStatusPublisher m_ribStatusPublisher;
+
   /** \brief The last transaction ID for FIB update response messages.
    *         Each group of FIB updates applied to the FIB is assigned an incrementing
    *         ID that is used to track the number of successfully applied updates.
@@ -226,14 +232,14 @@
 
   typedef function<void(RibManager*,
                         const shared_ptr<const Interest>& request,
-                        ControlParameters& parameters)> VerbProcessor;
+                        ControlParameters& parameters)> SignedVerbProcessor;
 
-  typedef std::map<name::Component, VerbProcessor> VerbDispatchTable;
+  typedef std::map<name::Component, SignedVerbProcessor> SignedVerbDispatchTable;
 
-  typedef std::pair<name::Component, VerbProcessor> VerbAndProcessor;
+  typedef std::pair<name::Component, SignedVerbProcessor> SignedVerbAndProcessor;
 
 
-  const VerbDispatchTable m_verbDispatch;
+  const SignedVerbDispatchTable m_signedVerbDispatch;
 
   static const Name COMMAND_PREFIX; // /localhost/nrd
   static const Name REMOTE_COMMAND_PREFIX; // /localhop/nrd
@@ -246,7 +252,17 @@
   // 8 with signed Interest support.
   static const size_t COMMAND_SIGNED_NCOMPS;
 
-  static const VerbAndProcessor COMMAND_VERBS[];
+  static const SignedVerbAndProcessor SIGNED_COMMAND_VERBS[];
+
+  typedef function<void(RibManager*, const Interest&)> UnsignedVerbProcessor;
+  typedef std::map<Name::Component, UnsignedVerbProcessor> UnsignedVerbDispatchTable;
+  typedef std::pair<Name::Component, UnsignedVerbProcessor> UnsignedVerbAndProcessor;
+
+  const UnsignedVerbDispatchTable m_unsignedVerbDispatch;
+  static const UnsignedVerbAndProcessor UNSIGNED_COMMAND_VERBS[];
+
+  static const Name LIST_COMMAND_PREFIX;
+  static const size_t LIST_COMMAND_NCOMPS;
 };
 
 } // namespace rib
diff --git a/rib/rib-status-publisher.cpp b/rib/rib-status-publisher.cpp
new file mode 100644
index 0000000..76a164c
--- /dev/null
+++ b/rib/rib-status-publisher.cpp
@@ -0,0 +1,97 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 "rib/rib-status-publisher.hpp"
+#include "rib/rib.hpp"
+#include "core/logger.hpp"
+
+#include <ndn-cxx/management/nfd-rib-entry.hpp>
+#include <ndn-cxx/face.hpp>
+
+namespace nfd {
+namespace rib {
+
+NFD_LOG_INIT("RibStatusPublisher");
+
+RibStatusPublisher::RibStatusPublisher(const Rib& rib,
+                                       ndn::Face& face,
+                                       const Name& prefix,
+                                       ndn::KeyChain& keyChain)
+  : SegmentPublisher<ndn::Face>(face, prefix, keyChain)
+  , m_rib(rib)
+{
+}
+
+RibStatusPublisher::~RibStatusPublisher()
+{
+}
+
+size_t
+RibStatusPublisher::generate(ndn::EncodingBuffer& outBuffer)
+{
+  size_t totalLength = 0;
+
+  for (Rib::const_iterator ribIt = m_rib.begin(); ribIt != m_rib.end(); ++ribIt)
+    {
+      RibEntry& entry = *ribIt->second;
+
+      const Name& prefix = entry.getName();
+      size_t ribEntryLength = 0;
+
+      ndn::nfd::RibEntry tlvEntry;
+      const RibEntry::FaceList& faces = entry.getFaces();
+
+      for (RibEntry::FaceList::const_iterator faceIt = faces.begin();
+           faceIt != faces.end(); ++faceIt)
+        {
+          const FaceEntry& face = *faceIt;
+
+          ndn::nfd::Route route;
+          route
+            .setFaceId(face.faceId)
+            .setOrigin(face.origin)
+            .setCost(face.cost)
+            .setFlags(face.flags);
+          if (face.expires < time::steady_clock::TimePoint::max()) {
+            route.setExpirationPeriod(time::duration_cast<time::milliseconds>
+                                      (face.expires - time::steady_clock::now()));
+          }
+          tlvEntry.addRoute(route);
+        }
+
+      tlvEntry.setName(prefix);
+      ribEntryLength += tlvEntry.wireEncode(outBuffer);
+
+      NFD_LOG_DEBUG("generate: rib entry length = " << ribEntryLength);
+
+      totalLength += ribEntryLength;
+    }
+  NFD_LOG_DEBUG("generate: Total length = " << totalLength);
+  return totalLength;
+}
+
+
+} // namespace rib
+} // namespace nfd
diff --git a/rib/rib-status-publisher.hpp b/rib/rib-status-publisher.hpp
new file mode 100644
index 0000000..8673983
--- /dev/null
+++ b/rib/rib-status-publisher.hpp
@@ -0,0 +1,60 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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_RIB_RIB_STATUS_PUBLISHER_HPP
+#define NFD_RIB_RIB_STATUS_PUBLISHER_HPP
+
+#include "core/segment-publisher.hpp"
+#include <ndn-cxx/face.hpp>
+
+namespace nfd {
+namespace rib {
+
+class Rib;
+
+class RibStatusPublisher : public SegmentPublisher<ndn::Face>
+{
+public:
+  RibStatusPublisher(const Rib& rib,
+                     ndn::Face& face,
+                     const Name& prefix,
+                     ndn::KeyChain& keyChain);
+
+  virtual
+  ~RibStatusPublisher();
+
+protected:
+  virtual size_t
+  generate(ndn::EncodingBuffer& outBuffer);
+
+private:
+  const Rib& m_rib;
+};
+
+
+} // namespace rib
+} // namespace nfd
+
+#endif
diff --git a/tests/core/segment-publisher.cpp b/tests/core/segment-publisher.cpp
new file mode 100644
index 0000000..da35376
--- /dev/null
+++ b/tests/core/segment-publisher.cpp
@@ -0,0 +1,168 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 "core/segment-publisher.hpp"
+
+#include "tests/test-common.hpp"
+#include "tests/dummy-face.hpp"
+
+#include <ndn-cxx/encoding/tlv.hpp>
+
+#include <boost/foreach.hpp>
+
+namespace nfd {
+namespace tests {
+
+NFD_LOG_INIT("SegmentPublisherTest");
+
+template<size_t N=10000>
+class TestSegmentPublisher : public SegmentPublisher<DummyFace>
+{
+public:
+  TestSegmentPublisher(DummyFace& face,
+                       const Name& prefix,
+                       ndn::KeyChain& keyChain)
+    : SegmentPublisher(face, prefix, keyChain)
+    , m_totalPayloadLength(0)
+  {
+
+  }
+
+  virtual
+  ~TestSegmentPublisher()
+  {
+  }
+
+  uint16_t
+  getLimit() const
+  {
+    return N;
+  }
+
+  size_t
+  getTotalPayloadLength() const
+  {
+    return m_totalPayloadLength;
+  }
+
+protected:
+
+  virtual size_t
+  generate(ndn::EncodingBuffer& outBuffer)
+  {
+    size_t totalLength = 0;
+    for (uint64_t i = 0; i < N; i++)
+      {
+        totalLength += prependNonNegativeIntegerBlock(outBuffer, ndn::Tlv::Content, i);
+      }
+    m_totalPayloadLength += totalLength;
+    return totalLength;
+  }
+
+protected:
+  size_t m_totalPayloadLength;
+};
+
+template<size_t N>
+class SegmentPublisherFixture : public BaseFixture
+{
+public:
+  SegmentPublisherFixture()
+    : m_face(makeDummyFace())
+    , m_publisher(*m_face, "/localhost/nfd/SegmentPublisherFixture", m_keyChain)
+  {
+  }
+
+  void
+  validate(const Data& data)
+  {
+    Block payload = data.getContent();
+    NFD_LOG_DEBUG("payload size (w/o Content TLV): " << payload.value_size());
+
+    m_buffer.appendByteArray(payload.value(), payload.value_size());
+
+    uint64_t segmentNo = data.getName()[-1].toSegment();
+    if (data.getFinalBlockId() != data.getName()[-1])
+      {
+        return;
+      }
+
+    NFD_LOG_DEBUG("got final block: #" << segmentNo);
+
+    // wrap data in a single Content TLV for easy parsing
+    m_buffer.prependVarNumber(m_buffer.size());
+    m_buffer.prependVarNumber(ndn::Tlv::Content);
+
+    BOOST_TEST_CHECKPOINT("creating parser");
+    ndn::Block parser(m_buffer.buf(), m_buffer.size());
+    BOOST_TEST_CHECKPOINT("parsing aggregated response");
+    parser.parse();
+
+    BOOST_REQUIRE_EQUAL(parser.elements_size(), m_publisher.getLimit());
+
+    uint64_t expectedNo = m_publisher.getLimit() - 1;
+    for (Block::element_const_iterator i = parser.elements_begin();
+         i != parser.elements_end();
+         ++i)
+      {
+        uint64_t number = readNonNegativeInteger(*i);
+        BOOST_REQUIRE_EQUAL(number, expectedNo);
+        --expectedNo;
+      }
+  }
+
+protected:
+  shared_ptr<DummyFace> m_face;
+  TestSegmentPublisher<N> m_publisher;
+  ndn::EncodingBuffer m_buffer;
+  ndn::KeyChain m_keyChain;
+};
+
+using boost::mpl::int_;
+typedef boost::mpl::vector<int_<10000>, int_<100>, int_<10>, int_<0> > DatasetSizes;
+
+BOOST_AUTO_TEST_SUITE(SegmentPublisher)
+
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(Generate, T, DatasetSizes, SegmentPublisherFixture<T::value>)
+{
+  this->m_publisher.publish();
+  this->m_face->processEvents();
+
+  size_t nSegments = this->m_publisher.getTotalPayloadLength() /
+                       this->m_publisher.getMaxSegmentSize();
+  if (this->m_publisher.getTotalPayloadLength() % this->m_publisher.getMaxSegmentSize() != 0 ||
+      nSegments == 0)
+    ++nSegments;
+
+  BOOST_CHECK_EQUAL(this->m_face->m_sentDatas.size(), nSegments);
+  BOOST_FOREACH(const Data& data, this->m_face->m_sentDatas) {
+    this->validate(data);
+  }
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/face-counters.cpp b/tests/daemon/face/face-counters.cpp
new file mode 100644
index 0000000..3be0d88
--- /dev/null
+++ b/tests/daemon/face/face-counters.cpp
@@ -0,0 +1,79 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 "face/face-counters.hpp"
+#include "dummy-face.hpp"
+
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace tests {
+
+BOOST_FIXTURE_TEST_SUITE(FaceFaceCounters, BaseFixture)
+
+BOOST_AUTO_TEST_CASE(PacketCnt)
+{
+  PacketCounter counter;
+
+  uint64_t observation = counter;//implicit convertible
+  BOOST_CHECK_EQUAL(observation, 0);
+
+  ++counter;
+  BOOST_CHECK_EQUAL(static_cast<int>(counter), 1);
+  ++counter;
+  ++counter;
+  BOOST_CHECK_EQUAL(static_cast<int>(counter), 3);
+}
+
+BOOST_AUTO_TEST_CASE(ByteCnt)
+{
+  ByteCounter counter;
+
+  uint64_t observation = counter;//implicit convertible
+  BOOST_CHECK_EQUAL(observation, 0);
+
+  counter += 20;
+  BOOST_CHECK_EQUAL(static_cast<int>(counter), 20);
+  counter += 80;
+  counter += 90;
+  BOOST_CHECK_EQUAL(static_cast<int>(counter), 190);
+}
+
+BOOST_AUTO_TEST_CASE(Counters)
+{
+  DummyFace face;
+  const FaceCounters& counters = face.getCounters();
+  BOOST_CHECK_EQUAL(counters.getNInInterests() , 0);
+  BOOST_CHECK_EQUAL(counters.getNInDatas()     , 0);
+  BOOST_CHECK_EQUAL(counters.getNOutInterests(), 0);
+  BOOST_CHECK_EQUAL(counters.getNOutDatas()    , 0);
+  BOOST_CHECK_EQUAL(counters.getNInBytes()     , 0);
+  BOOST_CHECK_EQUAL(counters.getNOutBytes()    , 0);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/face.cpp b/tests/daemon/face/face.cpp
index b82e0fa..143dfe6 100644
--- a/tests/daemon/face/face.cpp
+++ b/tests/daemon/face/face.cpp
@@ -59,16 +59,6 @@
                          LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID), false);
 }
 
-BOOST_AUTO_TEST_CASE(Counters)
-{
-  DummyFace face;
-  const FaceCounters& counters = face.getCounters();
-  BOOST_CHECK_EQUAL(counters.getNInInterests() , 0);
-  BOOST_CHECK_EQUAL(counters.getNInDatas()     , 0);
-  BOOST_CHECK_EQUAL(counters.getNOutInterests(), 0);
-  BOOST_CHECK_EQUAL(counters.getNOutDatas()    , 0);
-}
-
 class FaceFailTestFace : public DummyFace
 {
 public:
diff --git a/tests/daemon/face/null.cpp b/tests/daemon/face/null.cpp
new file mode 100644
index 0000000..db90410
--- /dev/null
+++ b/tests/daemon/face/null.cpp
@@ -0,0 +1,51 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 "face/null-face.hpp"
+
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace tests {
+
+BOOST_FIXTURE_TEST_SUITE(FaceNull, BaseFixture)
+
+BOOST_AUTO_TEST_CASE(Send)
+{
+  shared_ptr<NullFace> face = make_shared<NullFace>();
+
+  shared_ptr<Interest> interest = makeInterest("/A");
+  BOOST_CHECK_NO_THROW(face->sendInterest(*interest));
+
+  shared_ptr<Data> data = makeData("/B");
+  BOOST_CHECK_NO_THROW(face->sendData(*data));
+
+  BOOST_CHECK_NO_THROW(face->close());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/tcp.cpp b/tests/daemon/face/tcp.cpp
index 2861be3..fa527e9 100644
--- a/tests/daemon/face/tcp.cpp
+++ b/tests/daemon/face/tcp.cpp
@@ -261,6 +261,7 @@
   face1->sendInterest(*interest1);
   face1->sendInterest(*interest1);
   face1->sendData    (*data1    );
+  size_t nBytesSent1 = interest1->wireEncode().size() * 3 + data1->wireEncode().size();
   face2->sendInterest(*interest2);
   face2->sendData    (*data2    );
   face2->sendData    (*data2    );
@@ -269,7 +270,6 @@
   BOOST_CHECK_MESSAGE(limitedIo.run(8, time::seconds(10)) == LimitedIo::EXCEED_OPS,
                       "TcpChannel error: cannot send or receive Interest/Data packets");
 
-
   BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 3);
   BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 3);
@@ -280,17 +280,22 @@
   BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1->getName());
   BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1->getName());
 
+  // needed to ensure NOutBytes counters are accurate
+  limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(1));
+
   const FaceCounters& counters1 = face1->getCounters();
   BOOST_CHECK_EQUAL(counters1.getNInInterests() , 1);
   BOOST_CHECK_EQUAL(counters1.getNInDatas()     , 3);
   BOOST_CHECK_EQUAL(counters1.getNOutInterests(), 3);
   BOOST_CHECK_EQUAL(counters1.getNOutDatas()    , 1);
+  BOOST_CHECK_EQUAL(counters1.getNOutBytes(), nBytesSent1);
 
   const FaceCounters& counters2 = face2->getCounters();
   BOOST_CHECK_EQUAL(counters2.getNInInterests() , 3);
   BOOST_CHECK_EQUAL(counters2.getNInDatas()     , 1);
   BOOST_CHECK_EQUAL(counters2.getNOutInterests(), 1);
   BOOST_CHECK_EQUAL(counters2.getNOutDatas()    , 3);
+  BOOST_CHECK_EQUAL(counters2.getNInBytes(), nBytesSent1);
 }
 
 BOOST_FIXTURE_TEST_CASE(EndToEnd6, EndToEndFixture)
diff --git a/tests/daemon/face/udp.cpp b/tests/daemon/face/udp.cpp
index f2d3417..40485ca 100644
--- a/tests/daemon/face/udp.cpp
+++ b/tests/daemon/face/udp.cpp
@@ -379,6 +379,8 @@
   BOOST_CHECK_EQUAL(face2->getRemoteUri().toString(), "udp4://127.0.0.1:20070");
   BOOST_CHECK_EQUAL(face2->getLocalUri().toString(), "udp4://127.0.0.1:20071");
   BOOST_CHECK_EQUAL(face2->isLocal(), false);
+  BOOST_CHECK_EQUAL(face2->getCounters().getNOutBytes(), 0);
+  BOOST_CHECK_EQUAL(face2->getCounters().getNInBytes(), 0);
   // face1 is not created yet
 
   shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
@@ -410,6 +412,7 @@
   face2->sendData    (data2    );
   face2->sendData    (data2    );
   face2->sendData    (data2    );
+  size_t nBytesSent2 = interest2.wireEncode().size() + data2.wireEncode().size() * 3;
 
   BOOST_CHECK_MESSAGE(limitedIo.run(5,//4 send + 1 listen return
                       time::seconds(4)) == LimitedIo::EXCEED_OPS,
@@ -428,7 +431,6 @@
   BOOST_CHECK_MESSAGE(limitedIo.run(4, time::seconds(4)) == LimitedIo::EXCEED_OPS,
                       "UdpChannel error: cannot send or receive Interest/Data packets");
 
-
   BOOST_REQUIRE_EQUAL(face1_receivedInterests.size(), 1);
   BOOST_REQUIRE_EQUAL(face1_receivedDatas    .size(), 3);
   BOOST_REQUIRE_EQUAL(face2_receivedInterests.size(), 3);
@@ -445,6 +447,7 @@
 
   face2->sendData    (data3    );
   face2->sendInterest(interest3);
+  nBytesSent2 += data3.wireEncode().size() + interest3.wireEncode().size();
 
   BOOST_CHECK_MESSAGE(limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
                       "UdpChannel error: cannot send or receive Interest/Data packets");
@@ -460,12 +463,14 @@
   BOOST_CHECK_EQUAL(counters1.getNInDatas()     , 4);
   BOOST_CHECK_EQUAL(counters1.getNOutInterests(), 3);
   BOOST_CHECK_EQUAL(counters1.getNOutDatas()    , 1);
+  BOOST_CHECK_EQUAL(counters1.getNInBytes(), nBytesSent2);
 
   const FaceCounters& counters2 = face2->getCounters();
   BOOST_CHECK_EQUAL(counters2.getNInInterests() , 3);
   BOOST_CHECK_EQUAL(counters2.getNInDatas()     , 1);
   BOOST_CHECK_EQUAL(counters2.getNOutInterests(), 2);
   BOOST_CHECK_EQUAL(counters2.getNOutDatas()    , 4);
+  BOOST_CHECK_EQUAL(counters2.getNOutBytes(), nBytesSent2);
 }
 
 BOOST_FIXTURE_TEST_CASE(EndToEnd6, EndToEndFixture)
diff --git a/tests/daemon/face/unix-stream.cpp b/tests/daemon/face/unix-stream.cpp
index cb48db4..24154ec 100644
--- a/tests/daemon/face/unix-stream.cpp
+++ b/tests/daemon/face/unix-stream.cpp
@@ -213,10 +213,12 @@
   face1->sendInterest(*interest1);
   face1->sendInterest(*interest1);
   face1->sendData    (*data1    );
+  size_t nBytesSent1 = interest1->wireEncode().size() * 3 + data1->wireEncode().size();
   face2->sendInterest(*interest2);
   face2->sendData    (*data2    );
   face2->sendData    (*data2    );
   face2->sendData    (*data2    );
+  size_t nBytesSent2 = interest2->wireEncode().size() + data2->wireEncode().size() * 3;
 
   BOOST_CHECK_MESSAGE(limitedIo.run(8, time::seconds(1)) == LimitedIo::EXCEED_OPS,
                       "UnixStreamChannel error: cannot send or receive Interest/Data packets");
@@ -231,11 +233,16 @@
   BOOST_CHECK_EQUAL(face2_receivedInterests[0].getName(), interest1->getName());
   BOOST_CHECK_EQUAL(face2_receivedDatas    [0].getName(), data1->getName());
 
+  // needed to ensure NOutBytes counters are accurate
+  limitedIo.run(LimitedIo::UNLIMITED_OPS, time::seconds(1));
+
   const FaceCounters& counters1 = face1->getCounters();
   BOOST_CHECK_EQUAL(counters1.getNInInterests() , 1);
   BOOST_CHECK_EQUAL(counters1.getNInDatas()     , 3);
   BOOST_CHECK_EQUAL(counters1.getNOutInterests(), 3);
   BOOST_CHECK_EQUAL(counters1.getNOutDatas()    , 1);
+  BOOST_CHECK_EQUAL(counters1.getNInBytes(), nBytesSent2);
+  BOOST_CHECK_EQUAL(counters1.getNOutBytes(), nBytesSent1);
 
   const FaceCounters& counters2 = face2->getCounters();
   BOOST_CHECK_EQUAL(counters2.getNInInterests() , 3);
diff --git a/tests/daemon/fw/face-table.cpp b/tests/daemon/fw/face-table.cpp
index 3f49525..0dd8432 100644
--- a/tests/daemon/fw/face-table.cpp
+++ b/tests/daemon/fw/face-table.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "fw/face-table.hpp"
 #include "fw/forwarder.hpp"
@@ -61,6 +62,8 @@
   BOOST_CHECK_NE(face1->getId(), INVALID_FACEID);
   BOOST_CHECK_NE(face2->getId(), INVALID_FACEID);
   BOOST_CHECK_NE(face1->getId(), face2->getId());
+  BOOST_CHECK_GT(face1->getId(), FACEID_RESERVED_MAX);
+  BOOST_CHECK_GT(face2->getId(), FACEID_RESERVED_MAX);
 
   FaceId oldId1 = face1->getId();
   faceTable.add(face1);
@@ -79,6 +82,18 @@
   BOOST_CHECK_EQUAL(onRemoveHistory[0], onAddHistory[0]);
 }
 
+BOOST_AUTO_TEST_CASE(AddReserved)
+{
+  Forwarder forwarder;
+  FaceTable& faceTable = forwarder.getFaceTable();
+
+  shared_ptr<Face> face1 = make_shared<DummyFace>();
+  BOOST_CHECK_EQUAL(face1->getId(), INVALID_FACEID);
+
+  faceTable.addReserved(face1, 5);
+  BOOST_CHECK_EQUAL(face1->getId(), 5);
+}
+
 BOOST_AUTO_TEST_CASE(Enumerate)
 {
   Forwarder forwarder;
diff --git a/tests/daemon/mgmt/channel-status-publisher.cpp b/tests/daemon/mgmt/channel-status-publisher.cpp
index 04625af..6d33f4d 100644
--- a/tests/daemon/mgmt/channel-status-publisher.cpp
+++ b/tests/daemon/mgmt/channel-status-publisher.cpp
@@ -39,7 +39,7 @@
 public:
   ChannelStatusPublisherFixture()
     : m_face(make_shared<InternalFace>())
-    , m_publisher(m_factories, m_face, "/localhost/nfd/faces/channels")
+    , m_publisher(m_factories, *m_face, "/localhost/nfd/faces/channels", m_keyChain)
     , m_finished(false)
   {
   }
@@ -120,6 +120,8 @@
   std::set<std::string> m_matchedEntries;
 
   bool m_finished;
+
+  ndn::KeyChain m_keyChain;
 };
 
 BOOST_FIXTURE_TEST_SUITE(MgmtChannelStatusPublisher, ChannelStatusPublisherFixture)
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index 92ec987..601724a 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -257,13 +257,14 @@
 protected:
   shared_ptr<InternalFace> m_face;
   bool m_callbackFired;
+  ndn::KeyChain m_testKeyChain;
 };
 
 class FaceManagerFixture : public TestFaceTableFixture, public TestFaceManagerCommon
 {
 public:
   FaceManagerFixture()
-    : m_manager(m_faceTable, m_face)
+    : m_manager(m_faceTable, m_face, m_testKeyChain)
   {
     m_manager.setConfigFile(m_config);
   }
@@ -923,7 +924,7 @@
 public:
 
   ValidatedFaceRequestFixture()
-    : FaceManager(TestFaceTableFixture::m_faceTable, TestFaceManagerCommon::m_face),
+    : FaceManager(TestFaceTableFixture::m_faceTable, TestFaceManagerCommon::m_face, m_testKeyChain),
       m_createFaceFired(false),
       m_destroyFaceFired(false)
   {
@@ -1048,7 +1049,7 @@
 {
 public:
   LocalControlFixture()
-    : FaceManager(FaceTableFixture::m_faceTable, TestFaceManagerCommon::m_face)
+    : FaceManager(FaceTableFixture::m_faceTable, TestFaceManagerCommon::m_face, m_testKeyChain)
   {
   }
 };
@@ -1417,7 +1418,8 @@
 public:
   FaceFixture()
     : FaceManager(FaceTableFixture::m_faceTable,
-                  TestFaceManagerCommon::m_face)
+                  TestFaceManagerCommon::m_face,
+                  m_testKeyChain)
     , m_receivedNotification(false)
   {
 
@@ -1587,13 +1589,13 @@
 
   ControlParameters resultParameters;
   resultParameters.setUri("dummy://");
-  resultParameters.setFaceId(1);
+  resultParameters.setFaceId(FACEID_RESERVED_MAX + 1);
 
   shared_ptr<DummyFace> dummy(make_shared<DummyFace>());
 
   ndn::nfd::FaceEventNotification expectedFaceEvent;
   expectedFaceEvent.setKind(ndn::nfd::FACE_EVENT_CREATED)
-                   .setFaceId(1)
+                   .setFaceId(FACEID_RESERVED_MAX + 1)
                    .setRemoteUri(dummy->getRemoteUri().toString())
                    .setLocalUri(dummy->getLocalUri().toString())
                    .setFlags(0);
@@ -1674,7 +1676,7 @@
 {
 public:
   FaceListFixture()
-    : m_manager(m_table, m_face)
+    : m_manager(m_table, m_face, m_testKeyChain)
   {
 
   }
@@ -1687,6 +1689,7 @@
 
 protected:
   FaceManager m_manager;
+  ndn::KeyChain m_testKeyChain;
 };
 
 BOOST_FIXTURE_TEST_CASE(TestFaceList, FaceListFixture)
@@ -1694,26 +1697,14 @@
   Name commandName("/localhost/nfd/faces/list");
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  // MAX_SEGMENT_SIZE == 4400, FaceStatus size with filler counters is 55
-  // 55 divides 4400 (== 80), so only use 79 FaceStatuses and then two smaller ones
-  // to force a FaceStatus to span Data packets
-  for (int i = 0; i < 79; i++)
+  // MAX_SEGMENT_SIZE == 4400, FaceStatus size with filler counters is 75
+  // use 59 FaceStatuses to force a FaceStatus to span Data packets
+  for (int i = 0; i < 59; i++)
     {
       shared_ptr<TestCountersFace> dummy(make_shared<TestCountersFace>());
 
       uint64_t filler = std::numeric_limits<uint64_t>::max() - 1;
-      dummy->setCounters(filler, filler, filler, filler);
-
-      m_referenceFaces.push_back(dummy);
-
-      add(dummy);
-    }
-
-  for (int i = 0; i < 2; i++)
-    {
-      shared_ptr<TestCountersFace> dummy(make_shared<TestCountersFace>());
-      uint64_t filler = std::numeric_limits<uint32_t>::max() - 1;
-      dummy->setCounters(filler, filler, filler, filler);
+      dummy->setCounters(filler, filler, filler, filler, filler, filler);
 
       m_referenceFaces.push_back(dummy);
 
diff --git a/tests/daemon/mgmt/face-status-publisher-common.hpp b/tests/daemon/mgmt/face-status-publisher-common.hpp
index 0cfe6a2..b2a485e 100644
--- a/tests/daemon/mgmt/face-status-publisher-common.hpp
+++ b/tests/daemon/mgmt/face-status-publisher-common.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_TESTS_NFD_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
 #define NFD_TESTS_NFD_MGMT_FACE_STATUS_PUBLISHER_COMMON_HPP
@@ -53,16 +54,20 @@
   }
 
   void
-  setCounters(FaceCounter nInInterests,
-              FaceCounter nInDatas,
-              FaceCounter nOutInterests,
-              FaceCounter nOutDatas)
+  setCounters(PacketCounter::rep nInInterests,
+              PacketCounter::rep nInDatas,
+              PacketCounter::rep nOutInterests,
+              PacketCounter::rep nOutDatas,
+              ByteCounter::rep nInBytes,
+              ByteCounter::rep nOutBytes)
   {
     FaceCounters& counters = getMutableCounters();
-    counters.getNInInterests()  = nInInterests;
-    counters.getNInDatas()      = nInDatas;
-    counters.getNOutInterests() = nOutInterests;
-    counters.getNOutDatas()     = nOutDatas;
+    counters.getNInInterests().set(nInInterests);
+    counters.getNInDatas().set(nInDatas);
+    counters.getNOutInterests().set(nOutInterests);
+    counters.getNOutDatas().set(nOutDatas);
+    counters.getNInBytes().set(nInBytes);
+    counters.getNOutBytes().set(nOutBytes);
   }
 
 
@@ -102,7 +107,7 @@
   FaceStatusPublisherFixture()
     : m_table(m_forwarder)
     , m_face(make_shared<InternalFace>())
-    , m_publisher(m_table, m_face, "/localhost/nfd/FaceStatusPublisherFixture")
+    , m_publisher(m_table, *m_face, "/localhost/nfd/FaceStatusPublisherFixture", m_keyChain)
     , m_finished(false)
   {
 
@@ -135,6 +140,8 @@
     BOOST_CHECK_EQUAL(status.getNInDatas(), counters.getNInDatas());
     BOOST_CHECK_EQUAL(status.getNOutInterests(), counters.getNOutInterests());
     BOOST_CHECK_EQUAL(status.getNOutDatas(), counters.getNOutDatas());
+    BOOST_CHECK_EQUAL(status.getNInBytes(), counters.getNInBytes());
+    BOOST_CHECK_EQUAL(status.getNOutBytes(), counters.getNOutBytes());
   }
 
   void
@@ -181,6 +188,7 @@
   FaceStatusPublisher m_publisher;
   ndn::EncodingBuffer m_buffer;
   std::list<shared_ptr<Face> > m_referenceFaces;
+  ndn::KeyChain m_keyChain;
 
 protected:
   bool m_finished;
diff --git a/tests/daemon/mgmt/face-status-publisher.cpp b/tests/daemon/mgmt/face-status-publisher.cpp
index 836ea2d..145fe0e 100644
--- a/tests/daemon/mgmt/face-status-publisher.cpp
+++ b/tests/daemon/mgmt/face-status-publisher.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "face-status-publisher-common.hpp"
 
@@ -36,26 +37,14 @@
   Name commandName("/localhost/nfd/faces/list");
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
 
-  // MAX_SEGMENT_SIZE == 4400, FaceStatus size with filler counters is 55
-  // 55 divides 4400 (== 80), so only use 79 FaceStatuses and then two smaller ones
-  // to force a FaceStatus to span Data packets
-  for (int i = 0; i < 79; i++)
+  // MAX_SEGMENT_SIZE == 4400, FaceStatus size with filler counters is 75
+  // use 59 FaceStatuses to force a FaceStatus to span Data packets
+  for (int i = 0; i < 59; i++)
     {
       shared_ptr<TestCountersFace> dummy(make_shared<TestCountersFace>());
 
       uint64_t filler = std::numeric_limits<uint64_t>::max() - 1;
-      dummy->setCounters(filler, filler, filler, filler);
-
-      m_referenceFaces.push_back(dummy);
-
-      add(dummy);
-    }
-
-  for (int i = 0; i < 2; i++)
-    {
-      shared_ptr<TestCountersFace> dummy(make_shared<TestCountersFace>());
-      uint64_t filler = std::numeric_limits<uint32_t>::max() - 1;
-      dummy->setCounters(filler, filler, filler, filler);
+      dummy->setCounters(filler, filler, filler, filler, filler, filler);
 
       m_referenceFaces.push_back(dummy);
 
diff --git a/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
index 301d396..bfb19d9 100644
--- a/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
+++ b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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_TESTS_NFD_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
 #define NFD_TESTS_NFD_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
@@ -77,7 +78,7 @@
   FibEnumerationPublisherFixture()
     : m_fib(m_nameTree)
     , m_face(make_shared<InternalFace>())
-    , m_publisher(m_fib, m_face, "/localhost/nfd/FibEnumerationPublisherFixture")
+    , m_publisher(m_fib, *m_face, "/localhost/nfd/FibEnumerationPublisherFixture", m_keyChain)
     , m_finished(false)
   {
   }
@@ -208,6 +209,7 @@
   FibEnumerationPublisher m_publisher;
   ndn::EncodingBuffer m_buffer;
   std::set<shared_ptr<fib::Entry> > m_referenceEntries;
+  ndn::KeyChain m_keyChain;
 
 protected:
   bool m_finished;
diff --git a/tests/daemon/mgmt/fib-enumeration-publisher.cpp b/tests/daemon/mgmt/fib-enumeration-publisher.cpp
index 3cb5849..ed330aa 100644
--- a/tests/daemon/mgmt/fib-enumeration-publisher.cpp
+++ b/tests/daemon/mgmt/fib-enumeration-publisher.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "mgmt/fib-enumeration-publisher.hpp"
 
diff --git a/tests/daemon/mgmt/fib-manager.cpp b/tests/daemon/mgmt/fib-manager.cpp
index 2305c2c..8101cd4 100644
--- a/tests/daemon/mgmt/fib-manager.cpp
+++ b/tests/daemon/mgmt/fib-manager.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "mgmt/fib-manager.hpp"
 #include "table/fib.hpp"
@@ -161,7 +162,7 @@
 
 protected:
   FibManagerFixture()
-    : m_manager(ref(m_fib), bind(&FibManagerFixture::getFace, this, _1), m_face)
+    : m_manager(ref(m_fib), bind(&FibManagerFixture::getFace, this, _1), m_face, m_keyChain)
     , m_callbackFired(false)
   {
   }
@@ -171,6 +172,7 @@
 
   std::vector<shared_ptr<Face> > m_faces;
   bool m_callbackFired;
+  ndn::KeyChain m_keyChain;
 };
 
 template <typename T> class AuthorizedCommandFixture:
diff --git a/tests/daemon/mgmt/internal-face.cpp b/tests/daemon/mgmt/internal-face.cpp
index e76d80f..2215c0e 100644
--- a/tests/daemon/mgmt/internal-face.cpp
+++ b/tests/daemon/mgmt/internal-face.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "mgmt/internal-face.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
@@ -85,6 +86,9 @@
     m_noOnInterestFired = false;
   }
 
+protected:
+  ndn::KeyChain m_keyChain;
+
 private:
   std::vector<shared_ptr<Face> > m_faces;
   bool m_onInterestFired;
@@ -111,7 +115,7 @@
   face->onReceiveData += bind(&validatePutData, ref(didPutData), dataName, _1);
 
   Data testData(dataName);
-  face->sign(testData);
+  m_keyChain.sign(testData);
   face->put(testData);
 
   BOOST_REQUIRE(didPutData);
diff --git a/tests/daemon/mgmt/manager-base.cpp b/tests/daemon/mgmt/manager-base.cpp
index 74fcb6e..58a6fd4 100644
--- a/tests/daemon/mgmt/manager-base.cpp
+++ b/tests/daemon/mgmt/manager-base.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "mgmt/manager-base.hpp"
 #include "mgmt/internal-face.hpp"
@@ -38,7 +39,7 @@
 public:
 
   ManagerBaseTest()
-    : ManagerBase(make_shared<InternalFace>(), "TEST-PRIVILEGE"),
+    : ManagerBase(make_shared<InternalFace>(), "TEST-PRIVILEGE", m_keyChain),
       m_callbackFired(false)
   {
 
@@ -141,6 +142,7 @@
 private:
 
   bool m_callbackFired;
+  ndn::KeyChain m_keyChain;
 
 };
 
diff --git a/tests/daemon/mgmt/notification-stream.cpp b/tests/daemon/mgmt/notification-stream.cpp
index 32f5a20..f64e50b 100644
--- a/tests/daemon/mgmt/notification-stream.cpp
+++ b/tests/daemon/mgmt/notification-stream.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "mgmt/notification-stream.hpp"
 #include "mgmt/internal-face.hpp"
@@ -80,6 +81,7 @@
   const std::string m_prefix;
   const std::string m_message;
   uint64_t m_sequenceNo;
+  ndn::KeyChain m_keyChain;
 };
 
 BOOST_FIXTURE_TEST_SUITE(MgmtNotificationStream, NotificationStreamFixture)
@@ -115,7 +117,7 @@
 BOOST_AUTO_TEST_CASE(TestPostEvent)
 {
   shared_ptr<InternalFace> face(make_shared<InternalFace>());
-  NotificationStream notificationStream(face, "/localhost/nfd/NotificationStreamTest");
+  NotificationStream notificationStream(face, "/localhost/nfd/NotificationStreamTest", m_keyChain);
 
   face->onReceiveData += bind(&NotificationStreamFixture::validateCallback, this, _1);
 
diff --git a/tests/daemon/mgmt/segment-publisher.cpp b/tests/daemon/mgmt/segment-publisher.cpp
deleted file mode 100644
index 43e4523..0000000
--- a/tests/daemon/mgmt/segment-publisher.cpp
+++ /dev/null
@@ -1,151 +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 "mgmt/segment-publisher.hpp"
-#include "mgmt/internal-face.hpp"
-#include "mgmt/app-face.hpp"
-
-#include "tests/test-common.hpp"
-#include <ndn-cxx/encoding/tlv.hpp>
-
-namespace nfd {
-namespace tests {
-
-NFD_LOG_INIT("SegmentPublisherTest");
-
-class TestSegmentPublisher : public SegmentPublisher
-{
-public:
-  TestSegmentPublisher(shared_ptr<AppFace> face,
-                       const Name& prefix,
-                       const uint64_t limit=10000)
-    : SegmentPublisher(face, prefix)
-    , m_limit((limit == 0)?(1):(limit))
-  {
-
-  }
-
-  virtual
-  ~TestSegmentPublisher()
-  {
-
-  }
-
-  uint16_t
-  getLimit() const
-  {
-    return m_limit;
-  }
-
-protected:
-
-  virtual size_t
-  generate(ndn::EncodingBuffer& outBuffer)
-  {
-    size_t totalLength = 0;
-    for (uint64_t i = 0; i < m_limit; i++)
-      {
-        totalLength += prependNonNegativeIntegerBlock(outBuffer, ndn::Tlv::Content, i);
-      }
-    return totalLength;
-  }
-
-protected:
-  const uint64_t m_limit;
-};
-
-class SegmentPublisherFixture : public BaseFixture
-{
-public:
-  SegmentPublisherFixture()
-    : m_face(make_shared<InternalFace>())
-    , m_publisher(m_face, "/localhost/nfd/SegmentPublisherFixture")
-    , m_finished(false)
-  {
-
-  }
-
-  void
-  validate(const Data& data)
-  {
-    Block payload = data.getContent();
-    NFD_LOG_DEBUG("payload size (w/o Content TLV): " << payload.value_size());
-
-    m_buffer.appendByteArray(payload.value(), payload.value_size());
-
-    uint64_t segmentNo = data.getName()[-1].toSegment();
-    if (data.getFinalBlockId() != data.getName()[-1])
-      {
-        return;
-      }
-
-    NFD_LOG_DEBUG("got final block: #" << segmentNo);
-
-    // wrap data in a single Content TLV for easy parsing
-    m_buffer.prependVarNumber(m_buffer.size());
-    m_buffer.prependVarNumber(ndn::Tlv::Content);
-
-    BOOST_TEST_CHECKPOINT("creating parser");
-    ndn::Block parser(m_buffer.buf(), m_buffer.size());
-    BOOST_TEST_CHECKPOINT("parsing aggregated response");
-    parser.parse();
-
-    BOOST_REQUIRE_EQUAL(parser.elements_size(), m_publisher.getLimit());
-
-    uint64_t expectedNo = m_publisher.getLimit() - 1;
-    for (Block::element_const_iterator i = parser.elements_begin();
-         i != parser.elements_end();
-         ++i)
-      {
-        uint64_t number = readNonNegativeInteger(*i);
-        BOOST_REQUIRE_EQUAL(number, expectedNo);
-        --expectedNo;
-      }
-    m_finished = true;
-  }
-
-protected:
-  shared_ptr<InternalFace> m_face;
-  TestSegmentPublisher m_publisher;
-  ndn::EncodingBuffer m_buffer;
-
-protected:
-  bool m_finished;
-};
-
-BOOST_FIXTURE_TEST_SUITE(MgmtSegmentPublisher, SegmentPublisherFixture)
-
-BOOST_AUTO_TEST_CASE(Generate)
-{
-  m_face->onReceiveData +=
-    bind(&SegmentPublisherFixture::validate, this, _1);
-
-  m_publisher.publish();
-  BOOST_REQUIRE(m_finished);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/mgmt/status-server.cpp b/tests/daemon/mgmt/status-server.cpp
index d9f3129..5757f46 100644
--- a/tests/daemon/mgmt/status-server.cpp
+++ b/tests/daemon/mgmt/status-server.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "mgmt/status-server.hpp"
 #include "fw/forwarder.hpp"
@@ -50,7 +51,8 @@
   Forwarder forwarder;
   shared_ptr<InternalFace> internalFace = make_shared<InternalFace>();
   internalFace->onReceiveData += &interceptResponse;
-  StatusServer statusServer(internalFace, ref(forwarder));
+  ndn::KeyChain keyChain;
+  StatusServer statusServer(internalFace, ref(forwarder), keyChain);
   time::system_clock::TimePoint t2 = time::system_clock::now();
 
   // populate tables
diff --git a/tests/daemon/mgmt/strategy-choice-manager.cpp b/tests/daemon/mgmt/strategy-choice-manager.cpp
index 9f6818e..587c576 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "mgmt/strategy-choice-manager.hpp"
 #include "face/face.hpp"
@@ -49,7 +50,7 @@
   StrategyChoiceManagerFixture()
     : m_strategyChoice(m_forwarder.getStrategyChoice())
     , m_face(make_shared<InternalFace>())
-    , m_manager(m_strategyChoice, m_face)
+    , m_manager(m_strategyChoice, m_face, m_keyChain)
     , m_callbackFired(false)
   {
     m_strategyChoice.install(make_shared<DummyStrategy>(ref(m_forwarder),
@@ -171,6 +172,7 @@
   StrategyChoice& m_strategyChoice;
   shared_ptr<InternalFace> m_face;
   StrategyChoiceManager m_manager;
+  ndn::KeyChain m_keyChain;
 
 private:
   bool m_callbackFired;
diff --git a/tests/daemon/mgmt/strategy-choice-publisher.cpp b/tests/daemon/mgmt/strategy-choice-publisher.cpp
index b3190d4..fda3e1e 100644
--- a/tests/daemon/mgmt/strategy-choice-publisher.cpp
+++ b/tests/daemon/mgmt/strategy-choice-publisher.cpp
@@ -1,12 +1,12 @@
 /* -*- 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,
- *                     The University of Memphis
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -21,7 +21,7 @@
  *
  * 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_TESTS_NFD_MGMT_STRATEGY_CHOICE_PUBLISHER_HPP
 #define NFD_TESTS_NFD_MGMT_STRATEGY_CHOICE_PUBLISHER_HPP
@@ -46,7 +46,7 @@
   StrategyChoicePublisherFixture()
     : m_strategyChoice(m_forwarder.getStrategyChoice())
     , m_face(make_shared<InternalFace>())
-    , m_publisher(m_strategyChoice, m_face, "/localhost/nfd/strategy-choice/list")
+    , m_publisher(m_strategyChoice, *m_face, "/localhost/nfd/strategy-choice/list", m_keyChain)
     , STRATEGY_A(make_shared<DummyStrategy>(boost::ref(m_forwarder),
                                             "/localhost/nfd/strategy/dummy-strategy-a"))
     , STRATEGY_B(make_shared<DummyStrategy>(boost::ref(m_forwarder),
@@ -129,6 +129,8 @@
   std::set<std::string> m_matchedEntries;
 
   bool m_finished;
+
+  ndn::KeyChain m_keyChain;
 };
 
 
diff --git a/tests/daemon/table/fib.cpp b/tests/daemon/table/fib.cpp
index bdf2fca..d40f15d 100644
--- a/tests/daemon/table/fib.cpp
+++ b/tests/daemon/table/fib.cpp
@@ -1,11 +1,12 @@
 /* -*- 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
+ * 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,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * 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 "table/fib.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
@@ -288,7 +289,7 @@
 }
 
 void
-validateRemove(Fib& fib, const Name& target)
+validateErase(Fib& fib, const Name& target)
 {
   fib.erase(target);
 
@@ -299,14 +300,14 @@
     }
 }
 
-BOOST_AUTO_TEST_CASE(Remove)
+BOOST_AUTO_TEST_CASE(Erase)
 {
   NameTree emptyNameTree;
   Fib emptyFib(emptyNameTree);
 
   emptyFib.erase("/does/not/exist"); // crash test
 
-  validateRemove(emptyFib, "/");
+  validateErase(emptyFib, "/");
 
   emptyFib.erase("/still/does/not/exist"); // crash test
 
@@ -320,19 +321,19 @@
   // check if we remove the right thing and leave
   // everything else alone
 
-  validateRemove(fib, "/A/B");
+  validateErase(fib, "/A/B");
   validateFindExactMatch(fib, "/A");
   validateFindExactMatch(fib, "/A/B/C");
   validateFindExactMatch(fib, "/");
 
-  validateRemove(fib, "/A/B/C");
+  validateErase(fib, "/A/B/C");
   validateFindExactMatch(fib, "/A");
   validateFindExactMatch(fib, "/");
 
-  validateRemove(fib, "/A");
+  validateErase(fib, "/A");
   validateFindExactMatch(fib, "/");
 
-  validateRemove(fib, "/");
+  validateErase(fib, "/");
   validateNoExactMatch(fib, "/");
 
   NameTree gapNameTree;
@@ -345,6 +346,17 @@
   validateFindExactMatch(gapFib, "/X/Y/Z");
 }
 
+BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
+{
+  NameTree nameTree;
+  Fib fib(nameTree);
+  size_t nNameTreeEntriesBefore = nameTree.size();
+
+  fib.insert("ndn:/A/B/C");
+  fib.erase("ndn:/A/B/C");
+  BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
+}
+
 BOOST_AUTO_TEST_CASE(Iterator)
 {
   NameTree nameTree;
diff --git a/tests/daemon/table/measurements.cpp b/tests/daemon/table/measurements.cpp
index c2afb96..30b71c4 100644
--- a/tests/daemon/table/measurements.cpp
+++ b/tests/daemon/table/measurements.cpp
@@ -84,8 +84,8 @@
                CHECK2 < EXTEND_C &&
                EXTEND_C < CHECK3);
 
-  measurements.extendLifetime(*entryA, EXTEND_A);
-  measurements.extendLifetime(*entryC, EXTEND_C);
+  measurements.extendLifetime(entryA, EXTEND_A);
+  measurements.extendLifetime(entryC, EXTEND_C);
   // remaining lifetime:
   //   A = initial lifetime, because it's extended by less duration
   //   B = initial lifetime
@@ -115,6 +115,22 @@
   BOOST_CHECK_EQUAL(measurements.size(), 0);
 }
 
+BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
+{
+  LimitedIo limitedIo;
+  NameTree nameTree;
+  Measurements measurements(nameTree);
+  size_t nNameTreeEntriesBefore = nameTree.size();
+
+  shared_ptr<measurements::Entry> entry = measurements.get("/A");
+  BOOST_CHECK_EQUAL(
+    limitedIo.run(LimitedIo::UNLIMITED_OPS,
+                  Measurements::getInitialLifetime() + time::milliseconds(10)),
+    LimitedIo::EXCEED_TIME);
+  BOOST_CHECK_EQUAL(measurements.size(), 0);
+  BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
diff --git a/tests/daemon/table/pit.cpp b/tests/daemon/table/pit.cpp
index 9e623c1..566421f 100644
--- a/tests/daemon/table/pit.cpp
+++ b/tests/daemon/table/pit.cpp
@@ -33,6 +33,27 @@
 
 BOOST_FIXTURE_TEST_SUITE(TablePit, BaseFixture)
 
+BOOST_AUTO_TEST_CASE(NonceList)
+{
+  BOOST_REQUIRE_GE(pit::NonceList::CAPACITY, 32);
+  BOOST_REQUIRE_LE(pit::NonceList::CAPACITY, 4096);
+
+  pit::NonceList nl;
+  for (uint32_t nonce = 0; nonce < static_cast<uint32_t>(pit::NonceList::CAPACITY); ++nonce) {
+    BOOST_CHECK_EQUAL(nl.add(nonce), true);
+  }
+  BOOST_CHECK_EQUAL(nl.size(), pit::NonceList::CAPACITY);
+
+  BOOST_CHECK_EQUAL(nl.add(32), false);
+  BOOST_CHECK_EQUAL(nl.size(), pit::NonceList::CAPACITY);
+
+  BOOST_CHECK_EQUAL(nl.add(4096), true);
+  BOOST_CHECK_EQUAL(nl.size(), pit::NonceList::CAPACITY);
+
+  BOOST_CHECK_EQUAL(nl.add(0), true);// 0 is evicted
+  BOOST_CHECK_EQUAL(nl.size(), pit::NonceList::CAPACITY);
+}
+
 BOOST_AUTO_TEST_CASE(EntryInOutRecords)
 {
   shared_ptr<Face> face1 = make_shared<DummyFace>();
@@ -331,6 +352,18 @@
 
 }
 
+BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
+{
+  NameTree nameTree;
+  Pit pit(nameTree);
+  size_t nNameTreeEntriesBefore = nameTree.size();
+
+  shared_ptr<Interest> interest = makeInterest("/37xWVvQ2K");
+  shared_ptr<pit::Entry> entry = pit.insert(*interest).first;
+  pit.erase(entry);
+  BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
+}
+
 BOOST_AUTO_TEST_CASE(FindAllDataMatches)
 {
   Name nameA   ("ndn:/A");
diff --git a/tests/daemon/table/strategy-choice.cpp b/tests/daemon/table/strategy-choice.cpp
index e8f4ca3..0f48538 100644
--- a/tests/daemon/table/strategy-choice.cpp
+++ b/tests/daemon/table/strategy-choice.cpp
@@ -21,7 +21,7 @@
  *
  * 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 "table/strategy-choice.hpp"
 #include "tests/daemon/fw/dummy-strategy.hpp"
@@ -188,6 +188,28 @@
   BOOST_CHECK(!static_cast<bool>(measurements.get("ndn:/A/C")->getStrategyInfo<PStrategyInfo>()));
 }
 
+BOOST_AUTO_TEST_CASE(EraseNameTreeEntry)
+{
+  Forwarder forwarder;
+  NameTree& nameTree = forwarder.getNameTree();
+  StrategyChoice& table = forwarder.getStrategyChoice();
+
+  Name nameP("ndn:/strategy/P");
+  Name nameQ("ndn:/strategy/Q");
+  shared_ptr<Strategy> strategyP = make_shared<DummyStrategy>(ref(forwarder), nameP);
+  shared_ptr<Strategy> strategyQ = make_shared<DummyStrategy>(ref(forwarder), nameQ);
+  table.install(strategyP);
+  table.install(strategyQ);
+
+  table.insert("ndn:/", nameP);
+
+  size_t nNameTreeEntriesBefore = nameTree.size();
+
+  table.insert("ndn:/A/B", nameQ);
+  table.erase("ndn:/A/B");
+  BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
diff --git a/tests/rib/dummy-face.hpp b/tests/dummy-face.hpp
similarity index 87%
rename from tests/rib/dummy-face.hpp
rename to tests/dummy-face.hpp
index 4fde76f..84da29f 100644
--- a/tests/rib/dummy-face.hpp
+++ b/tests/dummy-face.hpp
@@ -23,15 +23,16 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef RIB_TESTS_UNIT_TESTS_TRANSPORT_DUMMY_FACE_HPP
-#define RIB_TESTS_UNIT_TESTS_TRANSPORT_DUMMY_FACE_HPP
+#ifndef NFD_TESTS_DUMMY_FACE_HPP
+#define NFD_TESTS_DUMMY_FACE_HPP
 
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/transport/transport.hpp>
 
-namespace ndn {
+namespace nfd {
+namespace tests {
 
-class DummyTransport : public Transport
+class DummyTransport : public ndn::Transport
 {
 public:
   void
@@ -58,10 +59,10 @@
   virtual void
   send(const Block& wire)
   {
-    if (wire.type() == Tlv::Interest) {
+    if (wire.type() == tlv::Interest) {
       m_sentInterests->push_back(Interest(wire));
     }
-    else if (wire.type() == Tlv::Data) {
+    else if (wire.type() == tlv::Data) {
       m_sentDatas->push_back(Data(wire));
     }
   }
@@ -80,7 +81,7 @@
 
 /** \brief a Face for unit testing
  */
-class DummyFace : public Face
+class DummyFace : public ndn::Face
 {
 public:
   explicit
@@ -115,6 +116,7 @@
   return make_shared<DummyFace>(make_shared<DummyTransport>());
 }
 
-} // namespace ndn
+} // namespace tests
+} // namespace nfd
 
-#endif // RIB_TESTS_UNIT_TESTS_TRANSPORT_DUMMY_FACE_HPP
+#endif // NFD_TESTS_DUMMY_FACE_HPP
diff --git a/tests/rib/rib-manager.cpp b/tests/rib/rib-manager.cpp
index b878e30..797f01e 100644
--- a/tests/rib/rib-manager.cpp
+++ b/tests/rib/rib-manager.cpp
@@ -26,7 +26,8 @@
 #include "rib/rib-manager.hpp"
 
 #include "tests/test-common.hpp"
-#include "rib/dummy-face.hpp"
+#include "tests/dummy-face.hpp"
+#include "rib/rib-status-publisher-common.hpp"
 
 namespace nfd {
 namespace rib {
@@ -40,7 +41,7 @@
     , ADD_NEXTHOP_VERB("add-nexthop")
     , REMOVE_NEXTHOP_VERB("remove-nexthop")
   {
-    face = ndn::makeDummyFace();
+    face = nfd::tests::makeDummyFace();
 
     manager = make_shared<RibManager>(ndn::ref(*face));
     manager->registerWithNfd();
@@ -78,7 +79,7 @@
 
 public:
   shared_ptr<RibManager> manager;
-  shared_ptr<ndn::DummyFace> face;
+  shared_ptr<nfd::tests::DummyFace> face;
 
   const Name COMMAND_PREFIX;
   const Name::Component ADD_NEXTHOP_VERB;
@@ -111,7 +112,7 @@
 
 typedef RibManagerFixture UnauthorizedRibManager;
 
-BOOST_FIXTURE_TEST_SUITE(RibRibManager, RibManagerFixture)
+BOOST_FIXTURE_TEST_SUITE(RibManager, RibManagerFixture)
 
 BOOST_FIXTURE_TEST_CASE(Basic, AuthorizedRibManager)
 {
@@ -219,6 +220,39 @@
   BOOST_REQUIRE_EQUAL(face->m_sentInterests.size(), 0);
 }
 
+BOOST_FIXTURE_TEST_CASE(RibStatusRequest, AuthorizedRibManager)
+{
+  FaceEntry entry;
+  Name name("/");
+  entry.faceId = 1;
+  entry.origin = 128;
+  entry.cost = 32;
+  entry.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
+
+  ControlParameters parameters;
+  parameters
+    .setName(name)
+    .setFaceId(entry.faceId)
+    .setOrigin(entry.origin)
+    .setCost(entry.cost)
+    .setFlags(entry.flags)
+    .setExpirationPeriod(ndn::time::milliseconds::max());
+
+  Name commandName("/localhost/nfd/rib/register");
+
+  BOOST_REQUIRE_EQUAL(face->m_sentInterests.size(), 0);
+
+  receiveCommandInterest(commandName, parameters);
+  face->m_sentInterests.clear();
+  face->m_sentDatas.clear();
+
+  face->receive(Interest("/localhost/nfd/rib/list"));
+  face->processEvents(time::milliseconds(1));
+
+  BOOST_REQUIRE_EQUAL(face->m_sentDatas.size(), 1);
+  RibStatusPublisherFixture::decodeRibEntryBlock(face->m_sentDatas[0], name, entry);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
diff --git a/tests/rib/rib-status-publisher-common.hpp b/tests/rib/rib-status-publisher-common.hpp
new file mode 100644
index 0000000..11728a0
--- /dev/null
+++ b/tests/rib/rib-status-publisher-common.hpp
@@ -0,0 +1,93 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 RIB_TESTS_UNIT_TESTS_RIB_STATUS_PUBLISHER_COMMON_HPP
+#define RIB_TESTS_UNIT_TESTS_RIB_STATUS_PUBLISHER_COMMON_HPP
+
+#include "rib/rib-status-publisher.hpp"
+
+#include "tests/test-common.hpp"
+#include "rib/rib.hpp"
+
+#include <ndn-cxx/management/nfd-control-parameters.hpp>
+#include <ndn-cxx/management/nfd-rib-entry.hpp>
+#include <ndn-cxx/encoding/tlv.hpp>
+
+namespace nfd {
+namespace rib {
+namespace tests {
+
+using ndn::nfd::ControlParameters;
+
+class RibStatusPublisherFixture : public nfd::tests::BaseFixture
+{
+public:
+  static void
+  validateRibEntry(const Block& block, const Name& referenceName, const FaceEntry& referenceFace)
+  {
+    ndn::nfd::RibEntry entry;
+    BOOST_REQUIRE_NO_THROW(entry.wireDecode(block));
+
+    BOOST_CHECK_EQUAL(entry.getName(), referenceName);
+
+    std::list<ndn::nfd::Route> routes = entry.getRoutes();
+
+    std::list<ndn::nfd::Route>::iterator it = routes.begin();
+    BOOST_CHECK_EQUAL(it->getFaceId(), referenceFace.faceId);
+    BOOST_CHECK_EQUAL(it->getOrigin(), referenceFace.origin);
+    BOOST_CHECK_EQUAL(it->getCost(), referenceFace.cost);
+    BOOST_CHECK_EQUAL(it->getFlags(), referenceFace.flags);
+  }
+
+  static void
+  decodeRibEntryBlock(const Data& data, const Name& referenceName, const FaceEntry& referenceFace)
+  {
+    ndn::EncodingBuffer buffer;
+
+    Block payload = data.getContent();
+
+    buffer.appendByteArray(payload.value(), payload.value_size());
+    buffer.prependVarNumber(buffer.size());
+    buffer.prependVarNumber(ndn::Tlv::Content);
+
+    ndn::Block parser(buffer.buf(), buffer.size());
+    parser.parse();
+
+    Block::element_const_iterator i = parser.elements_begin();
+
+    if (i->type() != ndn::tlv::nfd::RibEntry) {
+      BOOST_FAIL("expected RibEntry, got type #" << i->type());
+    }
+    else {
+      validateRibEntry(*i, referenceName, referenceFace);
+    }
+  }
+};
+
+#endif // RIB_TESTS_UNIT_TESTS_RIB_STATUS_PUBLISHER_COMMON_HPP
+
+} // namespace tests
+} // namespace rib
+} // namespace nfd
diff --git a/tests/rib/rib-status-publisher.cpp b/tests/rib/rib-status-publisher.cpp
new file mode 100644
index 0000000..ac68c63
--- /dev/null
+++ b/tests/rib/rib-status-publisher.cpp
@@ -0,0 +1,65 @@
+/* -*- 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,
+ *                      The University of Memphis
+ *
+ * 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 "rib/rib-status-publisher.hpp"
+
+#include "rib-status-publisher-common.hpp"
+#include "tests/dummy-face.hpp"
+
+namespace nfd {
+namespace rib {
+namespace tests {
+
+BOOST_FIXTURE_TEST_SUITE(RibStatusPublisherSuite, RibStatusPublisherFixture)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  Rib rib;
+
+  FaceEntry entry;
+  Name name("/");
+  entry.faceId = 1;
+  entry.origin = 128;
+  entry.cost = 32;
+  entry.flags = ndn::nfd::ROUTE_FLAG_CAPTURE;
+  rib.insert(name, entry);
+
+  ndn::KeyChain keyChain;
+  shared_ptr<nfd::tests::DummyFace> face = nfd::tests::makeDummyFace();
+  RibStatusPublisher publisher(rib, *face, "/localhost/nfd/rib/list", keyChain);
+
+  publisher.publish();
+  face->processEvents(time::milliseconds(1));
+
+  BOOST_REQUIRE_EQUAL(face->m_sentDatas.size(), 1);
+  decodeRibEntryBlock(face->m_sentDatas[0], name, entry);
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace rib
+} // namespace nfd
diff --git a/tools/nfd-status-http-server-files/nfd-status.xsl b/tools/nfd-status-http-server-files/nfd-status.xsl
new file mode 100644
index 0000000..e7cc55a
--- /dev/null
+++ b/tools/nfd-status-http-server-files/nfd-status.xsl
@@ -0,0 +1,311 @@
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:nfd="ndn:/localhost/nfd/status/1">
+<xsl:output method="html" encoding="utf-8" indent="yes" />
+
+<xsl:template match="/">
+  <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text>
+  <html>
+  <head>
+  <title>NFD Status</title>
+  <link rel="stylesheet" type="text/css" href="style.css" />
+  </head>
+  <body>
+  <header>
+    <h1>NFD Status</h1>
+  </header>
+  <article>
+    <div id="content">
+      <xsl:apply-templates/>
+    </div>
+  </article>
+  <footer>
+    <xsl:variable name="version">
+      <xsl:apply-templates select="nfd:nfdStatus/nfd:generalStatus/nfd:version"/>
+    </xsl:variable>
+    <span class="grey">Powered by </span><a target="_blank" href="http://named-data.net/doc/NFD/{$version}/"><span class="green">NFD version <xsl:value-of select="$version"/></span></a><span class="grey">.</span>
+  </footer>
+  </body>
+  </html>
+</xsl:template>
+
+<xsl:template match="nfd:version">
+  <xsl:variable name="major"><xsl:value-of select="floor(. div 1000000) mod 1000"/></xsl:variable>
+  <xsl:variable name="minor"><xsl:value-of select="floor(. div 1000) mod 1000"/></xsl:variable>
+  <xsl:variable name="patch"><xsl:value-of select=". mod 1000"/></xsl:variable>
+
+  <xsl:value-of select="$major"/>.<xsl:value-of select="$minor"/>.<xsl:value-of select="$patch"/>
+</xsl:template>
+
+<xsl:template name="formatDate">
+  <xsl:param name="date" />
+  <xsl:value-of select="substring($date, 0, 11)"/>&#160;<xsl:value-of select="substring($date, 12, 8)"/>
+</xsl:template>
+
+<xsl:template name="formatDuration">
+  <xsl:param name="duration" />
+  <xsl:variable name="seconds"><xsl:value-of select="substring($duration, 3, string-length($duration)-3)" /></xsl:variable>
+  <xsl:variable name="days"><xsl:value-of select="round($seconds div 86400)" /></xsl:variable>
+  <xsl:variable name="hours"><xsl:value-of select="round($seconds div 3600)" /></xsl:variable>
+  <xsl:variable name="minutes"><xsl:value-of select="round($seconds div 60)" /></xsl:variable>
+  <xsl:variable name="uptime">
+  <xsl:choose>
+    <xsl:when test="$days > 0">
+      <xsl:value-of select="$days"/> days
+    </xsl:when>
+    <xsl:when test="$hours > 0">
+      <xsl:value-of select="$hours"/> hours
+    </xsl:when>
+    <xsl:when test="$minutes > 0">
+      <xsl:value-of select="$minutes"/> minutes
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$seconds"/> seconds
+    </xsl:otherwise>
+  </xsl:choose>
+  </xsl:variable>
+  <xsl:value-of select="$uptime"/>
+</xsl:template>
+
+<xsl:template match="nfd:generalStatus">
+  <h2>General NFD status</h2>
+  <table class="item-list">
+    <thead>
+      <tr>
+        <th>Version</th>
+        <th>Start time</th>
+        <th>Current time</th>
+        <th>Uptime</th>
+        <th>NameTree Entries</th>
+        <th>FIB entries</th>
+        <th>PIT entries</th>
+        <th>Measurements entries</th>
+        <th>CS entries</th>
+        <th>In Interests</th>
+        <th>Out Interests</th>
+        <th>In Data</th>
+        <th>Out Data</th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr class="center">
+        <td><xsl:apply-templates select="nfd:version"/></td>
+        <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:startTime" /></xsl:call-template></td>
+        <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:currentTime" /></xsl:call-template></td>
+        <td><xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:uptime" /></xsl:call-template></td>
+        <td><xsl:value-of select="nfd:nNameTreeEntries"/></td>
+        <td><xsl:value-of select="nfd:nFibEntries"/></td>
+        <td><xsl:value-of select="nfd:nPitEntries"/></td>
+        <td><xsl:value-of select="nfd:nMeasurementsEntries"/></td>
+        <td><xsl:value-of select="nfd:nCsEntries"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
+      </tr>
+    </tbody>
+  </table>
+</xsl:template>
+
+<xsl:template match="nfd:channels">
+  <h2>Channels</h2>
+  <table class="item-list">
+    <thead>
+      <tr>
+        <th>Channel URI</th>
+      </tr>
+    </thead>
+    <tbody>
+      <xsl:for-each select="nfd:channel">
+        <xsl:variable name="style">
+          <xsl:choose>
+            <xsl:when test="position() mod 2 = 1">
+              <xsl:text>odd</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>even</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <tr class="{$style}">
+          <td><xsl:value-of select="nfd:localUri"/></td>
+        </tr>
+      </xsl:for-each>
+    </tbody>
+  </table>
+</xsl:template>
+
+<xsl:template match="nfd:faces">
+  <h2>Faces</h2>
+  <table class="item-list">
+    <thead>
+      <tr>
+        <th>Face ID</th>
+        <th>Remote URI</th>
+        <th>Local URI</th>
+        <th>In Interests</th>
+        <th>In Data</th>
+        <th>In Bytes</th>
+        <th>Out Interests</th>
+        <th>Out Data</th>
+        <th>Out Bytes</th>
+      </tr>
+    </thead>
+    <tbody>
+      <xsl:for-each select="nfd:face">
+      <xsl:variable name="style">
+        <xsl:choose>
+          <xsl:when test="position() mod 2 = 1">
+            <xsl:text>odd</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>even</xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <tr class="{$style}">
+        <td><xsl:value-of select="nfd:faceId"/></td>
+        <td><xsl:value-of select="nfd:remoteUri"/></td>
+        <td><xsl:value-of select="nfd:localUri"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
+        <td><xsl:value-of select="nfd:byteCounters/nfd:incomingBytes"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
+        <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
+        <td><xsl:value-of select="nfd:byteCounters/nfd:outgoingBytes"/></td>
+      </tr>
+      </xsl:for-each>
+    </tbody>
+  </table>
+</xsl:template>
+
+<xsl:template match="nfd:fib">
+  <h2>FIB</h2>
+  <table class="item-list">
+    <thead>
+      <tr>
+        <th width="20%">Prefix</th>
+        <th>NextHops</th>
+      </tr>
+    </thead>
+    <tbody>
+      <xsl:for-each select="nfd:fibEntry">
+        <xsl:variable name="style">
+          <xsl:choose>
+            <xsl:when test="position() mod 2 = 1">
+              <xsl:text>odd</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>even</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <tr class="{$style}">
+        <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
+        <td>
+          <table class="item-sublist">
+            <tr>
+              <th>FaceId</th>
+              <xsl:for-each select="nfd:nextHops/nfd:nextHop">
+                <td><xsl:value-of select="nfd:faceId"/></td>
+              </xsl:for-each>
+            </tr>
+            <tr>
+              <th>Cost</th>
+              <xsl:for-each select="nfd:nextHops/nfd:nextHop">
+                <td><xsl:value-of select="nfd:cost"/></td>
+              </xsl:for-each>
+            </tr>
+          </table>
+        </td>
+      </tr>
+      </xsl:for-each>
+    </tbody>
+  </table>
+</xsl:template>
+
+<xsl:template match="nfd:rib">
+  <h2>RIB</h2>
+  <table class="item-list">
+    <thead>
+      <tr>
+        <th width="20%">Prefix</th>
+        <th>Routes</th>
+      </tr>
+    </thead>
+    <tbody>
+      <xsl:for-each select="nfd:ribEntry">
+        <xsl:variable name="style">
+          <xsl:choose>
+            <xsl:when test="position() mod 2 = 1">
+              <xsl:text>odd</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>even</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <tr class="{$style}">
+        <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
+        <td>
+          <table class="item-sublist">
+            <tr>
+              <th>FaceId</th>
+              <xsl:for-each select="nfd:routes/nfd:route">
+                <td><xsl:value-of select="nfd:faceId"/></td>
+              </xsl:for-each>
+            </tr>
+            <tr>
+              <th>Origin</th>
+              <xsl:for-each select="nfd:routes/nfd:route">
+                <td><xsl:value-of select="nfd:origin"/></td>
+              </xsl:for-each>
+            </tr>
+            <tr>
+              <th>Cost</th>
+              <xsl:for-each select="nfd:routes/nfd:route">
+                <td><xsl:value-of select="nfd:cost"/></td>
+              </xsl:for-each>
+            </tr>
+            <tr>
+              <th>Flags</th>
+              <xsl:for-each select="nfd:routes/nfd:route">
+                <td><xsl:value-of select="nfd:flags"/></td>
+              </xsl:for-each>
+            </tr>
+            <tr>
+              <th>Expires in</th>
+              <xsl:for-each select="nfd:routes/nfd:route">
+                <td>
+                  <xsl:choose>
+                    <xsl:when test="nfd:expirationPeriod">
+                      <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      Never
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </td>
+              </xsl:for-each>
+            </tr>
+          </table>
+        </td>
+      </tr>
+      </xsl:for-each>
+    </tbody>
+  </table>
+</xsl:template>
+
+<xsl:template match="nfd:strategyChoices">
+  <h2>Strategy Choices</h2>
+  <table class="item-list">
+    <thead>
+      <tr>
+        <th width="20%">Namespace</th>
+        <th>Strategy Name</th>
+      </tr>
+    </thead>
+    <tbody>
+      <xsl:for-each select="nfd:strategyChoice">
+      <tr>
+        <td><xsl:value-of select="nfd:namespace"/></td>
+        <td><xsl:value-of select="nfd:strategy/nfd:name"/></td>
+      </tr>
+      </xsl:for-each>
+    </tbody>
+  </table>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/nfd-status-http-server-files/reset.css b/tools/nfd-status-http-server-files/reset.css
new file mode 100644
index 0000000..0af7c26
--- /dev/null
+++ b/tools/nfd-status-http-server-files/reset.css
@@ -0,0 +1,207 @@
+/* `XHTML, HTML4, HTML5 Reset
+----------------------------------------------------------------------------------------------------*/
+
+a,
+abbr,
+acronym,
+address,
+applet,
+article,
+aside,
+audio,
+b,
+big,
+blockquote,
+body,
+canvas,
+caption,
+center,
+cite,
+code,
+dd,
+del,
+details,
+dfn,
+dialog,
+div,
+dl,
+dt,
+em,
+embed,
+fieldset,
+figcaption,
+figure,
+font,
+footer,
+form,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+header,
+hgroup,
+hr,
+html,
+i,
+iframe,
+img,
+ins,
+kbd,
+label,
+legend,
+li,
+mark,
+menu,
+meter,
+nav,
+object,
+ol,
+output,
+p,
+pre,
+progress,
+q,
+rp,
+rt,
+ruby,
+s,
+samp,
+section,
+small,
+span,
+strike,
+strong,
+sub,
+summary,
+sup,
+table,
+tbody,
+td,
+tfoot,
+th,
+thead,
+time,
+tr,
+tt,
+u,
+ul,
+var,
+video,
+xmp {
+  border: 0;
+  margin: 0;
+  padding: 0;
+  font-size: 100%;
+}
+
+html,
+body {
+  height: 100%;
+}
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+menu,
+nav,
+section {
+/*
+  Override the default (display: inline) for
+  browsers that do not recognize HTML5 tags.
+
+  IE8 (and lower) requires a shiv:
+  http://ejohn.org/blog/html5-shiv
+*/
+  display: block;
+}
+
+b,
+strong {
+/*
+  Makes browsers agree.
+  IE + Opera = font-weight: bold.
+  Gecko + WebKit = font-weight: bolder.
+*/
+  font-weight: bold;
+}
+
+img {
+  color: transparent;
+  font-size: 0;
+  vertical-align: middle;
+/*
+  For IE.
+  http://css-tricks.com/ie-fix-bicubic-scaling-for-images
+*/
+  -ms-interpolation-mode: bicubic;
+}
+
+li {
+/*
+  For IE6 + IE7:
+
+  "display: list-item" keeps bullets from
+  disappearing if hasLayout is triggered.
+*/
+  display: list-item;
+  list-style: none;
+}
+
+table {
+  border-collapse: collapse;
+  border-spacing: 0;
+}
+
+th,
+td,
+caption {
+  font-weight: normal;
+  vertical-align: top;
+  text-align: left;
+}
+
+q {
+  quotes: none;
+}
+
+q:before,
+q:after {
+  content: '';
+  content: none;
+}
+
+sub,
+sup,
+small {
+  font-size: 75%;
+}
+
+sub,
+sup {
+  line-height: 0;
+  position: relative;
+  vertical-align: baseline;
+}
+
+sub {
+  bottom: -0.25em;
+}
+
+sup {
+  top: -0.5em;
+}
+
+svg {
+/*
+  For IE9. Without, occasionally draws shapes
+  outside the boundaries of <svg> rectangle.
+*/
+  overflow: hidden;
+}
\ No newline at end of file
diff --git a/tools/nfd-status-http-server-files/robots.txt b/tools/nfd-status-http-server-files/robots.txt
new file mode 100644
index 0000000..1f53798
--- /dev/null
+++ b/tools/nfd-status-http-server-files/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /
diff --git a/tools/nfd-status-http-server-files/style.css b/tools/nfd-status-http-server-files/style.css
new file mode 100644
index 0000000..176da83
--- /dev/null
+++ b/tools/nfd-status-http-server-files/style.css
@@ -0,0 +1,183 @@
+@import 'reset.css';
+@import 'text.css';
+
+@charset "utf-8";
+
+body {
+    background-color: #ffffff;
+    color: #000000;
+    font-family: sans-serif;
+}
+
+li {
+    margin: 0;
+}
+
+header, nav, article, footer, address {
+    display: block;
+}
+
+header {
+    margin: 20px;
+    width: 90%;
+}
+
+header h1 {
+    height: 50px;
+    padding-left: 55px;
+    padding-top: 6px;
+}
+
+article {
+    margin: 20px auto 20px;
+    width: 90%;
+    padding-bottom: 20px;
+}
+
+footer {
+    margin: 20px auto 0;
+    width: 90%;
+
+    padding-bottom: 2px;
+    text-align: right;
+
+    position: fixed;
+    font-height: 10px;
+    bottom: 0;
+    left: 5%;
+}
+
+h1 {
+    font-family: sans-serif;
+}
+
+h3 {
+    font-family: sans-serif;
+}
+
+h5 {
+    font-family: sans-serif;
+    color: #727272;
+}
+
+/* MISC */
+.grey {
+    color: #727272;
+    font-weight: 200;
+}
+
+.green {
+    color: #2D9A65;
+    font-weight: 200;
+}
+
+.red {
+    color: red;
+    font-weight: 200;
+    font-size: 2.4em;
+}
+
+.hidden {
+    display: none;
+}
+
+/* */
+.item-list
+{
+    border-radius: 6px;
+
+    margin-top: 10px;
+    margin-bottom: 10px;
+    font-family: sans-serif;
+    width: 100%;
+    text-align: left;
+}
+
+.item-list th
+{
+    font-weight: normal;
+    padding: 8px;
+    background: #EAF4EF;
+    border-top: 1px solid #99CCB2;
+    color: #727272;
+    text-align: left;
+}
+
+.item-list th.border-left {
+}
+
+.item-list td
+{
+    padding: 2px;
+    border-bottom: 1px solid #fff;
+    color: #000;
+    border-top: 1px solid transparent;
+}
+
+.item-sublist
+{
+    border-collapse:collapse;
+    border:1px solid gray;
+
+    padding: 4px;
+    font-family: sans-serif;
+    text-align: center;
+    margin-bottom: 0;
+}
+
+.item-sublist th
+{
+    background-color: transparent;
+    font-weight: bold;
+    padding: 4px;
+    text-align: center;
+
+    border-collapse:collapse;
+    border:1px solid gray;
+}
+
+.item-sublist th.border-left {
+}
+
+.item-sublist td
+{
+    border-collapse:collapse;
+    border:1px solid gray;
+
+    padding: 2px;
+    color: #000;
+    text-align: center;
+    min-width: 20px;
+}
+
+
+tr.center td
+{
+    text-align: center;
+}
+
+.border-left {
+    border-left: 1px solid #99CCB2;
+}
+
+.border-right {
+    border-right: 1px solid #99CCB2;
+}
+
+tfoot {
+    border-bottom: 2px solid #99CCB2;
+    background: #EAF4EF;
+}
+
+.item-list tfoot td {
+    padding: 0;
+}
+
+.odd {
+    background-color: #eeeeee;
+}
+
+.highlighted {
+    background-color: #cccccc;
+    cursor: pointer;
+}
diff --git a/tools/nfd-status-http-server-files/text.css b/tools/nfd-status-http-server-files/text.css
new file mode 100644
index 0000000..b115a70
--- /dev/null
+++ b/tools/nfd-status-http-server-files/text.css
@@ -0,0 +1,106 @@
+/*
+  960 Grid System ~ Text CSS.
+  Learn more ~ http://960.gs/
+
+  Licensed under GPL and MIT.
+*/
+
+/* `Basic HTML
+----------------------------------------------------------------------------------------------------*/
+
+body {
+    font: 13px Arial, Helvetica, sans-serif;
+}
+
+hr {
+  border: 0 #ccc solid;
+  border-top-width: 1px;
+  clear: both;
+  height: 0;
+}
+
+/* `Headings
+----------------------------------------------------------------------------------------------------*/
+
+h1 {
+	font-size: 2.4em;
+}
+
+h2 {
+	font-size: 1.8em;
+}
+
+h3 {
+	font-size: 1.4em;
+}
+
+/* h1 { */
+/*   font-size: 25px; */
+/* } */
+
+/* h2 { */
+/*   font-size: 23px; */
+/* } */
+
+/* h3 { */
+/*   font-size: 21px; */
+/* } */
+
+h4 {
+  font-size: 19px;
+}
+
+h5 {
+  font-size: 17px;
+}
+
+h6 {
+  font-size: 15px;
+}
+
+/* `Spacing
+----------------------------------------------------------------------------------------------------*/
+
+/* ol { */
+/*   list-style: decimal; */
+/* } */
+
+/* ul { */
+/*   list-style: disc; */
+/* } */
+
+/* li { */
+/*   margin-left: 30px; */
+/* } */
+
+p,
+dl,
+hr,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+ol,
+ul,
+pre,
+table,
+address,
+fieldset,
+figure {
+  margin-bottom: 10px;
+}
+
+pre {
+    /* padding: 0px 24px; */
+    white-space: pre-wrap;
+    background-color: #F9F9F9;
+    border: 1px dashed #2F6FAB;
+    color: black;
+    padding: 1em;
+    font-size: 13px;
+}
+code {
+    font-family: Consolas, Monaco, Andale Mono, monospace;
+}
\ No newline at end of file
diff --git a/tools/nfd-status-http-server.py b/tools/nfd-status-http-server.py
index 6e0f167..f127d40 100755
--- a/tools/nfd-status-http-server.py
+++ b/tools/nfd-status-http-server.py
@@ -24,94 +24,76 @@
 NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
+from BaseHTTPServer import HTTPServer
+from SimpleHTTPServer import SimpleHTTPRequestHandler
 from SocketServer import ThreadingMixIn
 import sys
-import commands
+import subprocess
 import StringIO
 import urlparse
 import logging
 import cgi
 import argparse
 import socket
+import os
 
 
-class StatusHandler(BaseHTTPRequestHandler):
+class StatusHandler(SimpleHTTPRequestHandler):
     """ The handler class to handle requests."""
     def do_GET(self):
         # get the url info to decide how to respond
         parsedPath = urlparse.urlparse(self.path)
-        resultMessage = ""
-        if parsedPath.path == "/robots.txt":
-            if self.server.robots == False:
-                # return User-agent: * Disallow: / to disallow robots
-                resultMessage = "User-agent: * \nDisallow: /\n"
+        if parsedPath.path == "/":
+            # get current nfd status, and use it as result message
+            (res, resultMessage) = self.getNfdStatus()
+            self.send_response(200)
+            if res == 0:
+                self.send_header("Content-type", "text/xml; charset=UTF-8")
+            else:
+                self.send_header("Content-type", "text/html; charset=UTF-8")
+
+            self.end_headers()
+            self.wfile.write(resultMessage)
+        elif parsedPath.path == "/robots.txt" and self.server.robots == True:
+            resultMessage = ""
             self.send_response(200)
             self.send_header("Content-type", "text/plain")
-        elif parsedPath.path == "/":
-            # get current nfd status, and use it as result message
-            resultMessage = self.getNfdStatus()
-            self.send_response(200)
-            self.send_header("Content-type", "text/html; charset=UTF-8")
+            self.end_headers()
+            self.wfile.write(resultMessage)
         else:
-            # non-existing content
-            resultMessage = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 '\
-                   + 'Transitional//EN" '\
-                   + '"http://www.w3.org/TR/html4/loose.dtd">\n'\
-                   + '<html><head><title>Object not '\
-                   + 'found!</title><meta http-equiv="Content-type" ' \
-                   + 'content="text/html;charset=UTF-8"></head>\n'\
-                   + '<body><h1>Object not found!</h1>'\
-                   + '<p>The requested URL was not found on this server.</p>'\
-                   + '<h2>Error 404</h2>'\
-                   + '</body></html>'
-            self.send_response(404)
-            self.send_header("Content-type", "text/html; charset=UTF-8")
-
-        self.end_headers()
-        self.wfile.write(resultMessage)
+            SimpleHTTPRequestHandler.do_GET(self)
 
     def log_message(self, format, *args):
         if self.server.verbose:
             logging.info("%s - %s\n" % (self.address_string(),
-                         format % args))
+                        format % args))
 
     def getNfdStatus(self):
         """
-        This function tries to call nfd-status command
-        to get nfd's current status, after convert it
-        to html format, return it to the caller
+        This function is to call nfd-status command
+        to get xml format output
         """
-        (res, output) = commands.getstatusoutput('nfd-status')
-
-        htmlStr = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional'\
-                + '//EN" "http://www.w3.org/TR/html4/loose.dtd">\n'\
-                + '<html><head><title>NFD status</title>'\
-                + '<meta http-equiv="Content-type" content="text/html;'\
-                + 'charset=UTF-8"></head>\n<body>'
+        sp = subprocess.Popen(['nfd-status', '-x'], stdout=subprocess.PIPE)
+        res = sp.wait()
         if res == 0:
-            # parse the output
-            buf = StringIO.StringIO(output)
-            firstLine = 0
-            for line in buf:
-                if line.endswith(":\n"):
-                    if firstLine != 0:
-                        htmlStr += "</ul>\n"
-                    firstLine += 1
-                    htmlStr += "<b>" + cgi.escape(line.strip()) + "</b><br>\n"\
-                             + "<ul>\n"
-                    continue
-                line = line.strip()
-                htmlStr += "<li>" + cgi.escape(line) + "</li>\n"
-            buf.close()
-            htmlStr += "</ul>\n"
+            # add the xml-stylesheet processing instruction after the 1st '>' symbol
+            output = sp.stdout.read()
+            newLineIndex = output.index('>') + 1
+            resultStr = output[:newLineIndex]\
+                      + "<?xml-stylesheet type=\"text/xsl\" href=\"nfd-status.xsl\"?>"\
+                      + output[newLineIndex:]
+            return (res, resultStr)
         else:
+            htmlStr = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional'\
+                    + '//EN" "http://www.w3.org/TR/html4/loose.dtd">\n'\
+                    + '<html><head><title>NFD status</title>'\
+                    + '<meta http-equiv="Content-type" content="text/html;'\
+                    + 'charset=UTF-8"></head>\n<body>'
             # return connection error code
             htmlStr = htmlStr + "<p>Cannot connect to NFD,"\
                     + " Code = " + str(res) + "</p>\n"
-        htmlStr = htmlStr + "</body></html>"
-        return htmlStr
-
+            htmlStr = htmlStr + "</body></html>"
+            return (res, htmlStr)
 
 class ThreadHttpServer(ThreadingMixIn, HTTPServer):
     """ Handle requests using threads """
@@ -162,6 +144,8 @@
                         help="Specify the HTTP server IP address.")
     parser.add_argument("-r", default=False, dest="robots", action="store_true",
                         help="Enable HTTP robots to crawl; disabled by default.")
+    parser.add_argument("-f", default="@DATAROOTDIR@/ndn", metavar="Server Directory", dest="serverDir",
+                        help="Specify the working directory of nfd-status-http-server, default is @DATAROOTDIR@/ndn.")
     parser.add_argument("-v", default=False, dest="verbose", action="store_true",
                         help="Verbose mode.")
     parser.add_argument("--version", default=False, dest="version", action="store_true",
@@ -177,6 +161,9 @@
     localAddr = args["addr"]
     verbose = args["verbose"]
     robots = args["robots"]
+    serverDirectory = args["serverDir"]
+
+    os.chdir(serverDirectory)
 
     # setting log message format
     logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s',
diff --git a/tools/nfd-status.cpp b/tools/nfd-status.cpp
index d06e8fb..3262a28 100644
--- a/tools/nfd-status.cpp
+++ b/tools/nfd-status.cpp
@@ -36,6 +36,7 @@
 #include <ndn-cxx/management/nfd-channel-status.hpp>
 #include <ndn-cxx/management/nfd-face-status.hpp>
 #include <ndn-cxx/management/nfd-fib-entry.hpp>
+#include <ndn-cxx/management/nfd-rib-entry.hpp>
 #include <ndn-cxx/management/nfd-strategy-choice.hpp>
 
 #include <boost/algorithm/string/replace.hpp>
@@ -53,6 +54,7 @@
     , m_needChannelStatusRetrieval(false)
     , m_needFaceStatusRetrieval(false)
     , m_needFibEnumerationRetrieval(false)
+    , m_needRibStatusRetrieval(false)
     , m_needStrategyChoiceRetrieval(false)
     , m_isOutputXml(false)
   {
@@ -69,6 +71,7 @@
       "  [-c] - retrieve channel status information\n"
       "  [-f] - retrieve face status information\n"
       "  [-b] - retrieve FIB information\n"
+      "  [-r] - retrieve RIB information\n"
       "  [-s] - retrieve configured strategy choice for NDN namespaces\n"
       "  [-x] - output NFD status information in XML format\n"
       "\n"
@@ -110,6 +113,12 @@
   }
 
   void
+  enableRibStatusRetrieval()
+  {
+    m_needRibStatusRetrieval = true;
+  }
+
+  void
   enableXmlOutput()
   {
     m_isOutputXml = true;
@@ -381,17 +390,24 @@
             std::cout << "<incomingPackets>";
             std::cout << "<nInterests>"       << faceStatus.getNInInterests()
                       << "</nInterests>";
-            std::cout << "<nDatas>"           << faceStatus.getNInInterests()
+            std::cout << "<nDatas>"           << faceStatus.getNInDatas()
                       << "</nDatas>";
             std::cout << "</incomingPackets>";
             std::cout << "<outgoingPackets>";
             std::cout << "<nInterests>"       << faceStatus.getNOutInterests()
                       << "</nInterests>";
-            std::cout << "<nDatas>"           << faceStatus.getNOutInterests()
+            std::cout << "<nDatas>"           << faceStatus.getNOutDatas()
                       << "</nDatas>";
             std::cout << "</outgoingPackets>";
             std::cout << "</packetCounters>";
 
+            std::cout << "<byteCounters>";
+            std::cout << "<incomingBytes>"    << faceStatus.getNInBytes()
+                      << "</incomingBytes>";
+            std::cout << "<outgoingBytes>"    << faceStatus.getNOutBytes()
+                      << "</outgoingBytes>";
+            std::cout << "</byteCounters>";
+
             if (faceStatus.getFlags() != 0) {
               std::cout << "<flags>";
               if (faceStatus.isLocal()) {
@@ -435,9 +451,11 @@
             }
             std::cout << " counters={"
                       << "in={" << faceStatus.getNInInterests() << "i "
-                      << faceStatus.getNInDatas() << "d}"
+                      << faceStatus.getNInDatas() << "d "
+                      << faceStatus.getNInBytes() << "B}"
                       << " out={" << faceStatus.getNOutInterests() << "i "
-                      << faceStatus.getNOutDatas() << "d}"
+                      << faceStatus.getNOutDatas() << "d "
+                      << faceStatus.getNOutBytes() << "B}"
                       << "}";
             if (faceStatus.isLocal())
               std::cout << " local";
@@ -629,6 +647,118 @@
   }
 
   void
+  fetchRibStatusInformation()
+  {
+    m_buffer = make_shared<OBufferStream>();
+
+    Interest interest("/localhost/nfd/rib/list");
+    interest.setChildSelector(1);
+    interest.setMustBeFresh(true);
+
+    m_face.expressInterest(interest,
+                           bind(&NfdStatus::fetchSegments, this, _2,
+                                &NfdStatus::afterFetchedRibStatusInformation),
+                           bind(&NfdStatus::onTimeout, this));
+  }
+
+  void
+  afterFetchedRibStatusInformation()
+  {
+    ConstBufferPtr buf = m_buffer->buf();
+    if (m_isOutputXml)
+      {
+        std::cout << "<rib>";
+
+        Block block;
+        size_t offset = 0;
+        while (offset < buf->size())
+          {
+            bool ok = Block::fromBuffer(buf, offset, block);
+            if (!ok)
+              {
+                std::cerr << "ERROR: cannot decode RibEntry TLV";
+                break;
+              }
+            offset += block.size();
+
+            nfd::RibEntry ribEntry(block);
+
+            std::cout << "<ribEntry>";
+            std::string prefix(ribEntry.getName().toUri());
+            escapeSpecialCharacters(&prefix);
+            std::cout << "<prefix>" << prefix << "</prefix>";
+            std::cout << "<routes>";
+            for (std::list<nfd::Route>::const_iterator
+                   nextRoute = ribEntry.begin();
+                 nextRoute != ribEntry.end();
+                 ++nextRoute)
+              {
+                std::cout << "<route>" ;
+                std::cout << "<faceId>"  << nextRoute->getFaceId() << "</faceId>";
+                std::cout << "<origin>"  << nextRoute->getOrigin() << "</origin>";
+                std::cout << "<cost>"    << nextRoute->getCost()   << "</cost>";
+                std::cout << "<flags>"   << nextRoute->getFlags()  << "</flags>";
+                if (!nextRoute->hasInfiniteExpirationPeriod()) {
+                  std::cout << "<expirationPeriod>PT"
+                            << time::duration_cast<time::seconds>(nextRoute->getExpirationPeriod())
+                                 .count() << "S"
+                            << "</expirationPeriod>";
+                }
+                std::cout << "</route>";
+              }
+            std::cout << "</routes>";
+            std::cout << "</ribEntry>";
+          }
+
+        std::cout << "</rib>";
+      }
+    else
+      {
+        std::cout << "Rib:" << std::endl;
+
+        Block block;
+        size_t offset = 0;
+        while (offset < buf->size())
+          {
+            bool ok = Block::fromBuffer(buf, offset, block);
+            if (!ok)
+              {
+                std::cerr << "ERROR: cannot decode RibEntry TLV" << std::endl;
+                break;
+              }
+
+            offset += block.size();
+
+            nfd::RibEntry ribEntry(block);
+
+            std::cout << " " << ribEntry.getName().toUri() << " route={";
+            for (std::list<nfd::Route>::const_iterator
+                   nextRoute = ribEntry.begin();
+                 nextRoute != ribEntry.end();
+                 ++nextRoute)
+              {
+                if (nextRoute != ribEntry.begin())
+                  std::cout << ", ";
+                std::cout << "faceid="   << nextRoute->getFaceId()
+                          << " (origin="  << nextRoute->getOrigin()
+                          << " cost="    << nextRoute->getCost()
+                          << " flags="   << nextRoute->getFlags();
+                if (!nextRoute->hasInfiniteExpirationPeriod()) {
+                  std::cout << " expires="
+                            << time::duration_cast<time::seconds>(nextRoute->getExpirationPeriod())
+                               .count() << "s";
+                }
+                std::cout << ")";
+              }
+            std::cout << "}" << std::endl;
+          }
+       }
+
+    runNextStep();
+  }
+
+
+  void
   fetchInformation()
   {
     if (m_isOutputXml ||
@@ -636,12 +766,14 @@
          !m_needChannelStatusRetrieval &&
          !m_needFaceStatusRetrieval &&
          !m_needFibEnumerationRetrieval &&
+         !m_needRibStatusRetrieval &&
          !m_needStrategyChoiceRetrieval))
       {
         enableVersionRetrieval();
         enableChannelStatusRetrieval();
         enableFaceStatusRetrieval();
         enableFibEnumerationRetrieval();
+        enableRibStatusRetrieval();
         enableStrategyChoiceRetrieval();
       }
 
@@ -660,6 +792,9 @@
     if (m_needFibEnumerationRetrieval)
       m_fetchSteps.push_back(bind(&NfdStatus::fetchFibEnumerationInformation, this));
 
+    if (m_needRibStatusRetrieval)
+      m_fetchSteps.push_back(bind(&NfdStatus::fetchRibStatusInformation, this));
+
     if (m_needStrategyChoiceRetrieval)
       m_fetchSteps.push_back(bind(&NfdStatus::fetchStrategyChoiceInformation, this));
 
@@ -705,6 +840,7 @@
   bool m_needChannelStatusRetrieval;
   bool m_needFaceStatusRetrieval;
   bool m_needFibEnumerationRetrieval;
+  bool m_needRibStatusRetrieval;
   bool m_needStrategyChoiceRetrieval;
   bool m_isOutputXml;
   Face m_face;
@@ -721,7 +857,7 @@
   int option;
   ndn::NfdStatus nfdStatus(argv[0]);
 
-  while ((option = getopt(argc, argv, "hvcfbsxV")) != -1) {
+  while ((option = getopt(argc, argv, "hvcfbrsxV")) != -1) {
     switch (option) {
     case 'h':
       nfdStatus.usage();
@@ -738,6 +874,9 @@
     case 'b':
       nfdStatus.enableFibEnumerationRetrieval();
       break;
+    case 'r':
+      nfdStatus.enableRibStatusRetrieval();
+      break;
     case 's':
       nfdStatus.enableStrategyChoiceRetrieval();
       break;
diff --git a/tools/nfdc.cpp b/tools/nfdc.cpp
index a0e1c56..8578e43 100644
--- a/tools/nfdc.cpp
+++ b/tools/nfdc.cpp
@@ -228,8 +228,10 @@
     .setName(m_name)
     .setCost(m_cost)
     .setFlags(m_flags)
-    .setOrigin(m_origin)
-    .setExpirationPeriod(m_expires);
+    .setOrigin(m_origin);
+
+  if (m_expires != DEFAULT_EXPIRATION_PERIOD)
+    parameters.setExpirationPeriod(m_expires);
 
   if (!isValidUri(m_commandLineArguments[1])) {
     try { //So the uri is not valid, may be a faceId is provided.
@@ -261,10 +263,12 @@
     .setName(m_name)
     .setCost(m_cost)
     .setFlags(m_flags)
-    .setExpirationPeriod(m_expires)
     .setOrigin(m_origin)
     .setFaceId(faceCreateResult.getFaceId());
 
+  if (m_expires != DEFAULT_EXPIRATION_PERIOD)
+    ribParameters.setExpirationPeriod(m_expires);
+
   m_controller.start<RibRegisterCommand>(ribParameters,
                                          bind(&Nfdc::onSuccess, this, _1,
                                                 "Successful in name registration"),
diff --git a/wscript b/wscript
index 93c6a2d..7a03afd 100644
--- a/wscript
+++ b/wscript
@@ -190,13 +190,6 @@
         IF_HAVE_LIBPCAP="" if bld.env['HAVE_LIBPCAP'] else "; ",
         IF_HAVE_WEBSOCKET="" if bld.env['HAVE_WEBSOCKET'] else "; ")
 
-    bld(features='subst',
-        source='tools/nfd-status-http-server.py',
-        target='bin/nfd-status-http-server',
-        install_path="${BINDIR}",
-        chmod=Utils.O755,
-        VERSION=VERSION)
-
     if bld.env['SPHINX_BUILD']:
         bld(features="sphinx",
             builder="man",
@@ -206,7 +199,7 @@
             install_path="${MANDIR}/",
             VERSION=VERSION)
 
-    for script in bld.path.ant_glob('tools/*.sh'):
+    for script in bld.path.ant_glob(['tools/*.sh', 'tools/*.py']):
         bld(features='subst',
             source='tools/%s' % (str(script)),
             target='bin/%s' % (str(script.change_ext(''))),
@@ -214,6 +207,9 @@
             chmod=Utils.O755,
             VERSION=VERSION)
 
+    bld.install_files("${DATAROOTDIR}/ndn",
+                      bld.path.ant_glob('tools/nfd-status-http-server-files/*'))
+
 def docs(bld):
     from waflib import Options
     Options.commands = ['doxygen', 'sphinx'] + Options.commands