diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 3fcd654..a2ec12b 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -16,7 +16,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "routing-table.hpp"
 #include "nlsr.hpp"
@@ -26,6 +26,7 @@
 #include "routing-table-entry.hpp"
 #include "name-prefix-table.hpp"
 #include "logger.hpp"
+#include "tlv-nlsr.hpp"
 
 #include <list>
 #include <string>
@@ -94,24 +95,22 @@
         // Inform the NPT that updates have been made
         NLSR_LOG_DEBUG("Calling Update NPT With new Route");
         (*afterRoutingChange)(m_rTable);
-        writeLog();
+        NLSR_LOG_DEBUG(*this);
         m_namePrefixTable.writeLog();
         m_fib.writeLog();
       }
       else {
-        NLSR_LOG_DEBUG("Adjacency building is scheduled, so"
-                   " routing table can not be calculated :(");
+        NLSR_LOG_DEBUG("Adjacency building is scheduled, so routing table can not be calculated :(");
       }
     }
     else {
-      NLSR_LOG_DEBUG("No Adj LSA of router itself,"
-                 " so Routing table can not be calculated :(");
+      NLSR_LOG_DEBUG("No Adj LSA of router itself, so Routing table can not be calculated :(");
       clearRoutingTable();
       clearDryRoutingTable(); // for dry run options
       // need to update NPT here
       NLSR_LOG_DEBUG("Calling Update NPT With new Route");
       (*afterRoutingChange)(m_rTable);
-      writeLog();
+      NLSR_LOG_DEBUG(*this);
       m_namePrefixTable.writeLog();
       m_fib.writeLog();
       // debugging purpose end
@@ -199,26 +198,6 @@
 }
 
 void
-RoutingTable::writeLog()
-{
-  NLSR_LOG_DEBUG("---------------Routing Table------------------");
-  for (const auto& rte : m_rTable) {
-    NLSR_LOG_DEBUG("Destination: " << rte.getDestination());
-    NLSR_LOG_DEBUG("Nexthops: ");
-    rte.getNexthopList().writeLog();
-  }
-
-  if (m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN) {
-    NLSR_LOG_DEBUG("--------Hyperbolic Routing Table(Dry)---------");
-    for (const auto& rte : m_dryTable) {
-      NLSR_LOG_DEBUG("Destination: " << rte.getDestination());
-      NLSR_LOG_DEBUG("Nexthops: ");
-      rte.getNexthopList().writeLog();
-    }
-  }
-}
-
-void
 RoutingTable::addNextHopToDryTable(const ndn::Name& destRouter, NextHop& nh)
 {
   NLSR_LOG_DEBUG("Adding " << nh << " to dry table for destination: " << destRouter);
@@ -251,4 +230,100 @@
   }
 }
 
+template<ndn::encoding::Tag TAG>
+size_t
+RoutingTableStatus::wireEncode(ndn::EncodingImpl<TAG>& block) const
+{
+  size_t totalLength = 0;
+
+  for (auto it = m_dryTable.rbegin(); it != m_dryTable.rend(); ++it) {
+    totalLength += it->wireEncode(block);
+  }
+
+  for (auto it = m_rTable.rbegin(); it != m_rTable.rend(); ++it) {
+    totalLength += it->wireEncode(block);
+  }
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::RoutingTable);
+
+  return totalLength;
+}
+
+NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(RoutingTableStatus);
+
+const ndn::Block&
+RoutingTableStatus::wireEncode() const
+{
+  if (m_wire.hasWire()) {
+    return m_wire;
+  }
+
+  ndn::EncodingEstimator estimator;
+  size_t estimatedSize = wireEncode(estimator);
+
+  ndn::EncodingBuffer buffer(estimatedSize, 0);
+  wireEncode(buffer);
+
+  m_wire = buffer.block();
+
+  return m_wire;
+}
+
+void
+RoutingTableStatus::wireDecode(const ndn::Block& wire)
+{
+  m_rTable.clear();
+
+  m_wire = wire;
+
+  if (m_wire.type() != ndn::tlv::nlsr::RoutingTable) {
+    std::stringstream error;
+    error << "Expected RoutingTableStatus Block, but Block is of a different type: #"
+          << m_wire.type();
+    BOOST_THROW_EXCEPTION(Error(error.str()));
+  }
+
+  m_wire.parse();
+
+  auto val = m_wire.elements_begin();
+
+  std::set<ndn::Name> destinations;
+  for (; val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::RoutingTableEntry; ++val) {
+    auto entry = RoutingTableEntry(*val);
+
+    if (destinations.emplace(entry.getDestination()).second) {
+      m_rTable.push_back(entry);
+    }
+    else {
+      // If destination already exists then this is the start of dry HR table
+      m_dryTable.push_back(entry);
+    }
+  }
+
+  if (val != m_wire.elements_end()) {
+    std::stringstream error;
+    error << "Expected the end of elements, but Block is of a different type: #"
+          << val->type();
+    BOOST_THROW_EXCEPTION(Error(error.str()));
+  }
+}
+
+std::ostream&
+operator<<(std::ostream& os, const RoutingTableStatus& rts)
+{
+  os << "Routing Table:\n";
+  for (const auto& rte : rts.getRoutingTableEntry()) {
+    os << rte;
+  }
+
+  if (!rts.getDryRoutingTableEntry().empty()) {
+    os << "Dry-Run Hyperbolic Routing Table:\n";
+    for (const auto& rte : rts.getDryRoutingTableEntry()) {
+      os << rte;
+    }
+  }
+  return os;
+}
+
 } // namespace nlsr
