diff --git a/src/tlv/adjacency-lsa.cpp b/src/tlv/adjacency-lsa.cpp
new file mode 100644
index 0000000..e346e8a
--- /dev/null
+++ b/src/tlv/adjacency-lsa.cpp
@@ -0,0 +1,146 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "adjacency-lsa.hpp"
+#include "tlv-nlsr.hpp"
+
+#include <ndn-cxx/util/concepts.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+BOOST_CONCEPT_ASSERT((ndn::WireEncodable<AdjacencyLsa>));
+BOOST_CONCEPT_ASSERT((ndn::WireDecodable<AdjacencyLsa>));
+static_assert(std::is_base_of<ndn::tlv::Error, AdjacencyLsa::Error>::value,
+              "AdjacencyLsa::Error must inherit from tlv::Error");
+
+AdjacencyLsa::AdjacencyLsa()
+  : m_hasAdjacencies(false)
+{
+}
+
+AdjacencyLsa::AdjacencyLsa(const ndn::Block& block)
+{
+  wireDecode(block);
+}
+
+template<bool T>
+size_t
+AdjacencyLsa::wireEncode(ndn::EncodingImpl<T>& block) const
+{
+  size_t totalLength = 0;
+
+  for (std::list<Adjacency>::const_reverse_iterator it = m_adjacencies.rbegin();
+       it != m_adjacencies.rend(); ++it) {
+    totalLength += it->wireEncode(block);
+  }
+
+  totalLength += m_lsaInfo.wireEncode(block);
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::AdjacencyLsa);
+
+  return totalLength;
+}
+
+template size_t
+AdjacencyLsa::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
+
+template size_t
+AdjacencyLsa::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
+
+const ndn::Block&
+AdjacencyLsa::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
+AdjacencyLsa::wireDecode(const ndn::Block& wire)
+{
+  m_hasAdjacencies = false;
+  m_adjacencies.clear();
+
+  m_wire = wire;
+
+  if (m_wire.type() != ndn::tlv::nlsr::AdjacencyLsa) {
+    std::stringstream error;
+    error << "Expected AdjacencyLsa Block, but Block is of a different type: #"
+          << m_wire.type();
+    throw Error(error.str());
+  }
+
+  m_wire.parse();
+
+  ndn::Block::element_const_iterator val = m_wire.elements_begin();
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::LsaInfo) {
+    m_lsaInfo.wireDecode(*val);
+    ++val;
+  }
+  else {
+    throw Error("Missing required LsaInfo field");
+  }
+
+  for (; val != m_wire.elements_end(); ++val) {
+    if (val->type() == ndn::tlv::nlsr::Adjacency) {
+      m_adjacencies.push_back(Adjacency(*val));
+      m_hasAdjacencies = true;
+    }
+    else {
+      std::stringstream error;
+      error << "Expected Adjacency Block, but Block is of a different type: #"
+            << m_wire.type();
+      throw Error(error.str());
+    }
+  }
+}
+
+std::ostream&
+operator<<(std::ostream& os, const AdjacencyLsa& adjacencyLsa)
+{
+  os << "AdjacencyLsa("
+     << adjacencyLsa.getLsaInfo();
+
+  for (const auto& adjacency : adjacencyLsa) {
+    os << ", " << adjacency;
+  }
+
+  os << ")";
+
+  return os;
+}
+
+} // namespace tlv
+} // namespace nlsr
diff --git a/src/tlv/adjacency-lsa.hpp b/src/tlv/adjacency-lsa.hpp
new file mode 100644
index 0000000..2fe5fc3
--- /dev/null
+++ b/src/tlv/adjacency-lsa.hpp
@@ -0,0 +1,154 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NLSR_TLV_ADJACENCY_LSA_HPP
+#define NLSR_TLV_ADJACENCY_LSA_HPP
+
+#include "lsa-info.hpp"
+#include "adjacency.hpp"
+
+#include <ndn-cxx/util/time.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/encoding/encoding-buffer.hpp>
+#include <ndn-cxx/encoding/tlv.hpp>
+#include <ndn-cxx/name.hpp>
+
+#include <list>
+
+namespace nlsr {
+namespace tlv  {
+
+/**
+ * @brief Data abstraction for AdjacencyLsa
+ *
+ * AdjacencyLsa := ADJACENCY-LSA-TYPE TLV-LENGTH
+ *                   LsaInfo
+ *                   Adjacency*
+ *
+ * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
+class AdjacencyLsa
+{
+public:
+  class Error : public ndn::tlv::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : ndn::tlv::Error(what)
+    {
+    }
+  };
+
+  typedef std::list<Adjacency> AdjacencyList;
+  typedef AdjacencyList::const_iterator iterator;
+
+  AdjacencyLsa();
+
+  explicit
+  AdjacencyLsa(const ndn::Block& block);
+
+  const LsaInfo&
+  getLsaInfo() const
+  {
+    return m_lsaInfo;
+  }
+
+  AdjacencyLsa&
+  setLsaInfo(const LsaInfo& lsaInfo)
+  {
+    m_lsaInfo = lsaInfo;
+    m_wire.reset();
+    return *this;
+  }
+
+  bool
+  hasAdjacencies() const
+  {
+    return m_hasAdjacencies;
+  }
+
+  const std::list<Adjacency>&
+  getAdjacencies() const
+  {
+    return m_adjacencies;
+  }
+
+  AdjacencyLsa&
+  addAdjacency(const Adjacency& adjacency)
+  {
+    m_adjacencies.push_back(adjacency);
+    m_wire.reset();
+    m_hasAdjacencies = true;
+    return *this;
+  }
+
+  AdjacencyLsa&
+  clearAdjacencies()
+  {
+    m_adjacencies.clear();
+    m_hasAdjacencies = false;
+    return *this;
+  }
+
+  template<bool T>
+  size_t
+  wireEncode(ndn::EncodingImpl<T>& block) const;
+
+  const ndn::Block&
+  wireEncode() const;
+
+  void
+  wireDecode(const ndn::Block& wire);
+
+  iterator
+  begin() const;
+
+  iterator
+  end() const;
+
+private:
+  LsaInfo m_lsaInfo;
+  bool m_hasAdjacencies;
+  AdjacencyList m_adjacencies;
+
+  mutable ndn::Block m_wire;
+};
+
+inline AdjacencyLsa::iterator
+AdjacencyLsa::begin() const
+{
+  return m_adjacencies.begin();
+}
+
+inline AdjacencyLsa::iterator
+AdjacencyLsa::end() const
+{
+  return m_adjacencies.end();
+}
+
+std::ostream&
+operator<<(std::ostream& os, const AdjacencyLsa& adjacencyLsa);
+
+} // namespace tlv
+} // namespace nlsr
+
+#endif // NLSR_TLV_ADJACENCY_LSA_HPP
diff --git a/src/tlv/adjacency.cpp b/src/tlv/adjacency.cpp
new file mode 100644
index 0000000..e9912b0
--- /dev/null
+++ b/src/tlv/adjacency.cpp
@@ -0,0 +1,148 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "adjacency.hpp"
+#include "tlv-nlsr.hpp"
+
+#include <ndn-cxx/util/concepts.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+BOOST_CONCEPT_ASSERT((ndn::WireEncodable<Adjacency>));
+BOOST_CONCEPT_ASSERT((ndn::WireDecodable<Adjacency>));
+static_assert(std::is_base_of<ndn::tlv::Error, Adjacency::Error>::value,
+              "Adjacency::Error must inherit from tlv::Error");
+
+Adjacency::Adjacency()
+  : m_cost(0)
+{
+}
+
+Adjacency::Adjacency(const ndn::Block& block)
+{
+  wireDecode(block);
+}
+
+template<bool T>
+size_t
+Adjacency::wireEncode(ndn::EncodingImpl<T>& block) const
+{
+  size_t totalLength = 0;
+
+  totalLength += ndn::prependNonNegativeIntegerBlock(block,
+                                                     ndn::tlv::nlsr::Cost,
+                                                     m_cost);
+
+  totalLength += block.prependByteArrayBlock(
+    ndn::tlv::nlsr::Uri, reinterpret_cast<const uint8_t*>(m_uri.c_str()), m_uri.size());
+
+  totalLength += m_name.wireEncode(block);
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::Adjacency);
+
+  return totalLength;
+}
+
+template size_t
+Adjacency::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
+
+template size_t
+Adjacency::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
+
+const ndn::Block&
+Adjacency::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
+Adjacency::wireDecode(const ndn::Block& wire)
+{
+  m_name.clear();
+  m_uri = "";
+  m_cost = 0;
+
+  m_wire = wire;
+
+  if (m_wire.type() != ndn::tlv::nlsr::Adjacency) {
+    std::stringstream error;
+    error << "Expected Adjacency Block, but Block is of a different type: #"
+          << m_wire.type();
+    throw Error(error.str());
+  }
+
+  m_wire.parse();
+
+  ndn::Block::element_const_iterator val = m_wire.elements_begin();
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::Name) {
+    m_name.wireDecode(*val);
+    ++val;
+  }
+  else {
+    throw Error("Missing required Name field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::Uri) {
+    m_uri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("Missing required Uri field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::Cost) {
+    m_cost = ndn::readNonNegativeInteger(*val);
+    ++val;
+  }
+  else {
+    throw Error("Missing required Cost field");
+  }
+}
+
+std::ostream&
+operator<<(std::ostream& os, const Adjacency& adjacency)
+{
+  os << "Adjacency("
+     << "Name: " << adjacency.getName() << ", "
+     << "Uri: " << adjacency.getUri() << ", "
+     << "Cost: " << adjacency.getCost() << ")";
+
+  return os;
+}
+
+} // namespace tlv
+} // namespace nlsr
diff --git a/src/tlv/adjacency.hpp b/src/tlv/adjacency.hpp
new file mode 100644
index 0000000..517bf42
--- /dev/null
+++ b/src/tlv/adjacency.hpp
@@ -0,0 +1,128 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NLSR_TLV_ADJACENCY_HPP
+#define NLSR_TLV_ADJACENCY_HPP
+
+#include <ndn-cxx/util/time.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/encoding/encoding-buffer.hpp>
+#include <ndn-cxx/encoding/tlv.hpp>
+#include <ndn-cxx/name.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+/**
+ * @brief Data abstraction for Adjacency
+ *
+ * Adjacency := ADJACENCY-TYPE TLV-LENGTH
+ *                Name
+ *                Uri
+ *                Cost
+ *
+ * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
+class Adjacency
+{
+public:
+  class Error : public ndn::tlv::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : ndn::tlv::Error(what)
+    {
+    }
+  };
+
+  Adjacency();
+
+  explicit
+  Adjacency(const ndn::Block& block);
+
+  const ndn::Name&
+  getName() const
+  {
+    return m_name;
+  }
+
+  Adjacency&
+  setName(const ndn::Name& name)
+  {
+    m_name = name;
+    m_wire.reset();
+    return *this;
+  }
+
+  const std::string&
+  getUri() const
+  {
+    return m_uri;
+  }
+
+  Adjacency&
+  setUri(const std::string& uri)
+  {
+    m_uri = uri;
+    m_wire.reset();
+    return *this;
+  }
+
+  uint64_t
+  getCost() const
+  {
+    return m_cost;
+  }
+
+  Adjacency&
+  setCost(uint64_t cost)
+  {
+    m_cost = cost;
+    m_wire.reset();
+    return *this;
+  }
+
+  template<bool T>
+  size_t
+  wireEncode(ndn::EncodingImpl<T>& block) const;
+
+  const ndn::Block&
+  wireEncode() const;
+
+  void
+  wireDecode(const ndn::Block& wire);
+
+private:
+  ndn::Name m_name;
+  std::string m_uri;
+  uint64_t m_cost;
+
+  mutable ndn::Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const Adjacency& adjacency);
+
+} // namespace tlv
+} // namespace nlsr
+
+#endif // NLSR_TLV_ADJACENCY_HPP
diff --git a/src/tlv/coordinate-lsa.cpp b/src/tlv/coordinate-lsa.cpp
new file mode 100644
index 0000000..efbac11
--- /dev/null
+++ b/src/tlv/coordinate-lsa.cpp
@@ -0,0 +1,168 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "coordinate-lsa.hpp"
+#include "tlv-nlsr.hpp"
+
+#include <ndn-cxx/util/concepts.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+BOOST_CONCEPT_ASSERT((ndn::WireEncodable<CoordinateLsa>));
+BOOST_CONCEPT_ASSERT((ndn::WireDecodable<CoordinateLsa>));
+static_assert(std::is_base_of<ndn::tlv::Error, CoordinateLsa::Error>::value,
+              "CoordinateLsa::Error must inherit from tlv::Error");
+
+CoordinateLsa::CoordinateLsa()
+  : m_hyperbolicRadius(0.0)
+  , m_hyperbolicAngle(0.0)
+{
+}
+
+CoordinateLsa::CoordinateLsa(const ndn::Block& block)
+{
+  wireDecode(block);
+}
+
+template<bool T>
+size_t
+CoordinateLsa::wireEncode(ndn::EncodingImpl<T>& block) const
+{
+  size_t totalLength = 0;
+  size_t doubleLength = 10;
+
+  const uint8_t* doubleBytes1 = reinterpret_cast<const uint8_t*>(&m_hyperbolicAngle);
+  totalLength += block.prependByteArrayBlock(ndn::tlv::nlsr::Double, doubleBytes1, 8);
+  totalLength += block.prependVarNumber(doubleLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::HyperbolicAngle);
+
+  const uint8_t* doubleBytes2 = reinterpret_cast<const uint8_t*>(&m_hyperbolicRadius);
+  totalLength += block.prependByteArrayBlock(ndn::tlv::nlsr::Double, doubleBytes2, 8);
+  totalLength += block.prependVarNumber(doubleLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::HyperbolicRadius);
+
+  totalLength += m_lsaInfo.wireEncode(block);
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::CoordinateLsa);
+
+  return totalLength;
+}
+
+template size_t
+CoordinateLsa::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
+
+template size_t
+CoordinateLsa::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
+
+const ndn::Block&
+CoordinateLsa::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
+CoordinateLsa::wireDecode(const ndn::Block& wire)
+{
+  m_hyperbolicRadius = 0.0;
+  m_hyperbolicAngle = 0.0;
+
+  m_wire = wire;
+
+  if (m_wire.type() != ndn::tlv::nlsr::CoordinateLsa) {
+    std::stringstream error;
+    error << "Expected CoordinateLsa Block, but Block is of a different type: #"
+          << m_wire.type();
+    throw Error(error.str());
+  }
+
+  m_wire.parse();
+
+  ndn::Block::element_const_iterator val = m_wire.elements_begin();
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::LsaInfo) {
+    m_lsaInfo.wireDecode(*val);
+    ++val;
+  }
+  else {
+    throw Error("Missing required LsaInfo field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::HyperbolicRadius) {
+    val->parse();
+    ndn::Block::element_const_iterator it = val->elements_begin();
+    if (it != val->elements_end() && it->type() == ndn::tlv::nlsr::Double) {
+      m_hyperbolicRadius = *reinterpret_cast<const double*>(it->value());
+    }
+    else {
+      throw Error("HyperbolicRadius: Missing required Double field");
+    }
+
+    ++val;
+  }
+  else {
+    throw Error("Missing required HyperbolicRadius field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::HyperbolicAngle) {
+    val->parse();
+    ndn::Block::element_const_iterator it = val->elements_begin();
+    if (it != val->elements_end() && it->type() == ndn::tlv::nlsr::Double) {
+      m_hyperbolicAngle = *reinterpret_cast<const double*>(it->value());
+    }
+    else {
+      throw Error("HyperbolicAngle: Missing required Double field");
+    }
+
+    ++val;
+  }
+  else {
+    throw Error("Missing required HyperbolicAngle field");
+  }
+}
+
+std::ostream&
+operator<<(std::ostream& os, const CoordinateLsa& coordinateLsa)
+{
+  os << "CoordinateLsa("
+     << coordinateLsa.getLsaInfo() << ", "
+     << "HyperbolicRadius: " << coordinateLsa.getHyperbolicRadius() << ", "
+     << "HyperbolicAngle: " << coordinateLsa.getHyperbolicAngle() << ")";
+
+  return os;
+}
+
+} // namespace tlv
+} // namespace nlsr
diff --git a/src/tlv/coordinate-lsa.hpp b/src/tlv/coordinate-lsa.hpp
new file mode 100644
index 0000000..c769dfd
--- /dev/null
+++ b/src/tlv/coordinate-lsa.hpp
@@ -0,0 +1,130 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NLSR_TLV_COORDINATE_LSA_HPP
+#define NLSR_TLV_COORDINATE_LSA_HPP
+
+#include "lsa-info.hpp"
+
+#include <ndn-cxx/util/time.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/encoding/encoding-buffer.hpp>
+#include <ndn-cxx/encoding/tlv.hpp>
+#include <ndn-cxx/name.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+/**
+ * @brief Data abstraction for CoordinateLsa
+ *
+ * CoordinateLsa := COORDINATE-LSA-TYPE TLV-LENGTH
+ *                    LsaInfo
+ *                    HyperbolicRadius
+ *                    HyperbolicAngle
+ *
+ * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
+class CoordinateLsa
+{
+public:
+  class Error : public ndn::tlv::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : ndn::tlv::Error(what)
+    {
+    }
+  };
+
+  CoordinateLsa();
+
+  explicit
+  CoordinateLsa(const ndn::Block& block);
+
+  const LsaInfo&
+  getLsaInfo() const
+  {
+    return m_lsaInfo;
+  }
+
+  CoordinateLsa&
+  setLsaInfo(const LsaInfo& lsaInfo)
+  {
+    m_lsaInfo = lsaInfo;
+    m_wire.reset();
+    return *this;
+  }
+
+  double
+  getHyperbolicRadius() const
+  {
+    return m_hyperbolicRadius;
+  }
+
+  CoordinateLsa&
+  setHyperbolicRadius(double hyperbolicRadius)
+  {
+    m_hyperbolicRadius = hyperbolicRadius;
+    m_wire.reset();
+    return *this;
+  }
+
+  double
+  getHyperbolicAngle() const
+  {
+    return m_hyperbolicAngle;
+  }
+
+  CoordinateLsa&
+  setHyperbolicAngle(double hyperbolicAngle)
+  {
+    m_hyperbolicAngle = hyperbolicAngle;
+    m_wire.reset();
+    return *this;
+  }
+
+  template<bool T>
+  size_t
+  wireEncode(ndn::EncodingImpl<T>& block) const;
+
+  const ndn::Block&
+  wireEncode() const;
+
+  void
+  wireDecode(const ndn::Block& wire);
+
+private:
+  LsaInfo m_lsaInfo;
+  double m_hyperbolicRadius;
+  double m_hyperbolicAngle;
+
+  mutable ndn::Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const CoordinateLsa& coordinateLsa);
+
+} // namespace tlv
+} // namespace nlsr
+
+#endif // NLSR_TLV_COORDINATE_LSA_HPP
diff --git a/src/tlv/lsa-info.cpp b/src/tlv/lsa-info.cpp
new file mode 100644
index 0000000..5349c31
--- /dev/null
+++ b/src/tlv/lsa-info.cpp
@@ -0,0 +1,174 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "lsa-info.hpp"
+#include "tlv-nlsr.hpp"
+
+#include <ndn-cxx/util/concepts.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+BOOST_CONCEPT_ASSERT((ndn::WireEncodable<LsaInfo>));
+BOOST_CONCEPT_ASSERT((ndn::WireDecodable<LsaInfo>));
+static_assert(std::is_base_of<ndn::tlv::Error, LsaInfo::Error>::value,
+              "LsaInfo::Error must inherit from tlv::Error");
+
+const ndn::time::milliseconds LsaInfo::INFINITE_EXPIRATION_PERIOD(ndn::time::milliseconds::max());
+
+LsaInfo::LsaInfo()
+  : m_sequenceNumber(0)
+  , m_expirationPeriod(INFINITE_EXPIRATION_PERIOD)
+  , m_hasInfiniteExpirationPeriod(true)
+{
+}
+
+LsaInfo::LsaInfo(const ndn::Block& block)
+{
+  wireDecode(block);
+}
+
+template<bool T>
+size_t
+LsaInfo::wireEncode(ndn::EncodingImpl<T>& block) const
+{
+  size_t totalLength = 0;
+
+  // Absence of an ExpirationPeriod signifies non-expiration
+  if (!m_hasInfiniteExpirationPeriod) {
+    totalLength += ndn::prependNonNegativeIntegerBlock(block,
+                                                       ndn::tlv::nlsr::ExpirationPeriod,
+                                                       m_expirationPeriod.count());
+  }
+
+  totalLength += ndn::prependNonNegativeIntegerBlock(block,
+                                                     ndn::tlv::nlsr::SequenceNumber,
+                                                     m_sequenceNumber);
+
+  totalLength += ndn::prependNestedBlock(block, ndn::tlv::nlsr::OriginRouter, m_originRouter);
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::LsaInfo);
+
+  return totalLength;
+}
+
+template size_t
+LsaInfo::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
+
+template size_t
+LsaInfo::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
+
+const ndn::Block&
+LsaInfo::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
+LsaInfo::wireDecode(const ndn::Block& wire)
+{
+  m_originRouter.clear();
+  m_sequenceNumber = 0;
+  m_expirationPeriod = ndn::time::milliseconds::min();
+
+  m_wire = wire;
+
+  if (m_wire.type() != ndn::tlv::nlsr::LsaInfo) {
+    std::stringstream error;
+    error << "Expected LsaInfo Block, but Block is of a different type: #"
+          << m_wire.type();
+    throw Error(error.str());
+  }
+
+  m_wire.parse();
+
+  ndn::Block::element_const_iterator val = m_wire.elements_begin();
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::OriginRouter) {
+    val->parse();
+    ndn::Block::element_const_iterator it = val->elements_begin();
+
+    if (it != val->elements_end() && it->type() == ndn::tlv::Name) {
+      m_originRouter.wireDecode(*it);
+    }
+    else {
+      throw Error("OriginRouter: Missing required Name field");
+    }
+
+    ++val;
+  }
+  else {
+    throw Error("Missing required OriginRouter field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::SequenceNumber) {
+    m_sequenceNumber = ndn::readNonNegativeInteger(*val);
+    ++val;
+  }
+  else {
+    throw Error("Missing required SequenceNumber field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::ExpirationPeriod) {
+    m_expirationPeriod = ndn::time::milliseconds(ndn::readNonNegativeInteger(*val));
+    m_hasInfiniteExpirationPeriod = false;
+  }
+  else {
+    m_expirationPeriod = INFINITE_EXPIRATION_PERIOD;
+    m_hasInfiniteExpirationPeriod = true;
+  }
+}
+
+std::ostream&
+operator<<(std::ostream& os, const LsaInfo& lsaInfo)
+{
+  os << "LsaInfo("
+     << "OriginRouter: " << lsaInfo.getOriginRouter() << ", "
+     << "SequenceNumber: " << lsaInfo.getSequenceNumber() << ", ";
+
+  if (!lsaInfo.hasInfiniteExpirationPeriod()) {
+    os << "ExpirationPeriod: " << lsaInfo.getExpirationPeriod();
+  }
+  else {
+    os << "ExpirationPeriod: Infinity";
+  }
+
+  os << ")";
+
+  return os;
+}
+
+} // namespace tlv
+} // namespace nlsr
diff --git a/src/tlv/lsa-info.hpp b/src/tlv/lsa-info.hpp
new file mode 100644
index 0000000..a5cf7bf
--- /dev/null
+++ b/src/tlv/lsa-info.hpp
@@ -0,0 +1,140 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NLSR_TLV_LSA_INFO_HPP
+#define NLSR_TLV_LSA_INFO_HPP
+
+#include <ndn-cxx/util/time.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/encoding/encoding-buffer.hpp>
+#include <ndn-cxx/encoding/tlv.hpp>
+#include <ndn-cxx/name.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+/**
+ * @brief Data abstraction for LsaInfo
+ *
+ * LsaInfo := LSA-TYPE TLV-LENGTH
+ *              OriginRouter
+ *              SequenceNumber
+ *              ExpirationPeriod?
+ *
+ * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
+class LsaInfo
+{
+public:
+  class Error : public ndn::tlv::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : ndn::tlv::Error(what)
+    {
+    }
+  };
+
+  LsaInfo();
+
+  explicit
+  LsaInfo(const ndn::Block& block);
+
+  const ndn::Name&
+  getOriginRouter() const
+  {
+    return m_originRouter;
+  }
+
+  LsaInfo&
+  setOriginRouter(const ndn::Name& name)
+  {
+    m_originRouter = name;
+    m_wire.reset();
+    return *this;
+  }
+
+  uint64_t
+  getSequenceNumber() const
+  {
+    return m_sequenceNumber;
+  }
+
+  LsaInfo&
+  setSequenceNumber(uint64_t sequenceNumber)
+  {
+    m_sequenceNumber = sequenceNumber;
+    m_wire.reset();
+    return *this;
+  }
+
+  static const ndn::time::milliseconds INFINITE_EXPIRATION_PERIOD;
+
+  const ndn::time::milliseconds&
+  getExpirationPeriod() const
+  {
+    return m_expirationPeriod;
+  }
+
+  LsaInfo&
+  setExpirationPeriod(const ndn::time::milliseconds& expirationPeriod)
+  {
+    m_expirationPeriod = expirationPeriod;
+
+    m_hasInfiniteExpirationPeriod = (m_expirationPeriod == INFINITE_EXPIRATION_PERIOD);
+
+    m_wire.reset();
+    return *this;
+  }
+
+  bool
+  hasInfiniteExpirationPeriod() const
+  {
+    return m_hasInfiniteExpirationPeriod;
+  }
+
+  template<bool T>
+  size_t
+  wireEncode(ndn::EncodingImpl<T>& block) const;
+
+  const ndn::Block&
+  wireEncode() const;
+
+  void
+  wireDecode(const ndn::Block& wire);
+
+private:
+  ndn::Name m_originRouter;
+  uint64_t m_sequenceNumber;
+  ndn::time::milliseconds m_expirationPeriod;
+  bool m_hasInfiniteExpirationPeriod;
+
+  mutable ndn::Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const LsaInfo& lsaInfo);
+
+} // namespace tlv
+} // namespace nlsr
+
+#endif // NLSR_TLV_LSA_INFO_HPP
diff --git a/src/tlv/lsdb-status.cpp b/src/tlv/lsdb-status.cpp
new file mode 100644
index 0000000..dae40d3
--- /dev/null
+++ b/src/tlv/lsdb-status.cpp
@@ -0,0 +1,192 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "lsdb-status.hpp"
+#include "tlv-nlsr.hpp"
+
+#include <ndn-cxx/util/concepts.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+BOOST_CONCEPT_ASSERT((ndn::WireEncodable<LsdbStatus>));
+BOOST_CONCEPT_ASSERT((ndn::WireDecodable<LsdbStatus>));
+static_assert(std::is_base_of<ndn::tlv::Error, LsdbStatus::Error>::value,
+              "LsdbStatus::Error must inherit from tlv::Error");
+
+LsdbStatus::LsdbStatus()
+  : m_hasAdjacencyLsas(false)
+  , m_hasCoordinateLsas(false)
+  , m_hasNameLsas(false)
+{
+}
+
+LsdbStatus::LsdbStatus(const ndn::Block& block)
+{
+  wireDecode(block);
+}
+
+template<bool T>
+size_t
+LsdbStatus::wireEncode(ndn::EncodingImpl<T>& block) const
+{
+  size_t totalLength = 0;
+
+  for (std::list<NameLsa>::const_reverse_iterator it = m_nameLsas.rbegin();
+       it != m_nameLsas.rend(); ++it) {
+    totalLength += it->wireEncode(block);
+  }
+
+  for (std::list<CoordinateLsa>::const_reverse_iterator it = m_coordinateLsas.rbegin();
+       it != m_coordinateLsas.rend(); ++it) {
+    totalLength += it->wireEncode(block);
+  }
+
+  for (std::list<AdjacencyLsa>::const_reverse_iterator it = m_adjacencyLsas.rbegin();
+       it != m_adjacencyLsas.rend(); ++it) {
+    totalLength += it->wireEncode(block);
+  }
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::LsdbStatus);
+
+  return totalLength;
+}
+
+template size_t
+LsdbStatus::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
+
+template size_t
+LsdbStatus::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
+
+const ndn::Block&
+LsdbStatus::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
+LsdbStatus::wireDecode(const ndn::Block& wire)
+{
+  m_adjacencyLsas.clear();
+  m_coordinateLsas.clear();
+  m_nameLsas.clear();
+
+  m_hasAdjacencyLsas = false;
+  m_hasCoordinateLsas = false;
+  m_hasNameLsas = false;
+
+  m_wire = wire;
+
+  if (m_wire.type() != ndn::tlv::nlsr::LsdbStatus) {
+    std::stringstream error;
+    error << "Expected LsdbStatus Block, but Block is of a different type: #"
+          << m_wire.type();
+    throw Error(error.str());
+  }
+
+  m_wire.parse();
+
+  ndn::Block::element_const_iterator val = m_wire.elements_begin();
+
+  for (; val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::AdjacencyLsa; ++val) {
+    m_adjacencyLsas.push_back(AdjacencyLsa(*val));
+    m_hasAdjacencyLsas = true;
+  }
+
+  for (; val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::CoordinateLsa; ++val) {
+    m_coordinateLsas.push_back(CoordinateLsa(*val));
+    m_hasCoordinateLsas = true;
+  }
+
+  for (; val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::NameLsa; ++val) {
+    m_nameLsas.push_back(NameLsa(*val));
+    m_hasNameLsas = true;
+  }
+
+  if (val != m_wire.elements_end()) {
+    std::stringstream error;
+    error << "Expected the end of elements, but Block is of a different type: #"
+          << val->type();
+    throw Error(error.str());
+  }
+}
+
+std::ostream&
+operator<<(std::ostream& os, const LsdbStatus& lsdbStatus)
+{
+  os << "LsdbStatus(";
+
+  bool isFirst = true;
+
+  for (const auto& adjacencyLsa : lsdbStatus.getAdjacencyLsas()) {
+    if (isFirst) {
+      isFirst = false;
+    }
+    else {
+      os << ", ";
+    }
+
+    os << adjacencyLsa;
+  }
+
+  for (const auto& coordinateLsa : lsdbStatus.getCoordinateLsas()) {
+    if (isFirst) {
+      isFirst = false;
+    }
+    else {
+      os << ", ";
+    }
+
+    os << coordinateLsa;
+  }
+
+  for (const auto& nameLsa : lsdbStatus.getNameLsas()) {
+    if (isFirst) {
+      isFirst = false;
+    }
+    else {
+      os << ", ";
+    }
+
+    os << nameLsa;
+  }
+
+  os << ")";
+
+  return os;
+}
+
+} // namespace tlv
+} // namespace nlsr
diff --git a/src/tlv/lsdb-status.hpp b/src/tlv/lsdb-status.hpp
new file mode 100644
index 0000000..cc66d49
--- /dev/null
+++ b/src/tlv/lsdb-status.hpp
@@ -0,0 +1,187 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NLSR_TLV_LSDB_STATUS_HPP
+#define NLSR_TLV_LSDB_STATUS_HPP
+
+#include "adjacency-lsa.hpp"
+#include "coordinate-lsa.hpp"
+#include "name-lsa.hpp"
+
+#include <ndn-cxx/util/time.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/encoding/encoding-buffer.hpp>
+#include <ndn-cxx/encoding/tlv.hpp>
+#include <ndn-cxx/name.hpp>
+
+#include <list>
+
+namespace nlsr {
+namespace tlv  {
+
+/**
+ * @brief Data abstraction for LsdbStatus
+ *
+ * LsdbStatus := LSDB-STATUS-TYPE TLV-LENGTH
+ *                 AdjacencyLsa*
+ *                 CoordinateLsa*
+ *                 NameLsa*
+ *
+ * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
+class LsdbStatus
+{
+public:
+  class Error : public ndn::tlv::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : ndn::tlv::Error(what)
+    {
+    }
+  };
+
+  typedef std::list<AdjacencyLsa> AdjacencyLsaList;
+  typedef std::list<CoordinateLsa> CoordinateLsaList;
+  typedef std::list<NameLsa> NameLsaList;
+
+  LsdbStatus();
+
+  explicit
+  LsdbStatus(const ndn::Block& block);
+
+  const std::list<AdjacencyLsa>&
+  getAdjacencyLsas() const
+  {
+    return m_adjacencyLsas;
+  }
+
+  LsdbStatus&
+  addAdjacencyLsa(const AdjacencyLsa& adjacencyLsa)
+  {
+    m_adjacencyLsas.push_back(adjacencyLsa);
+    m_wire.reset();
+    m_hasAdjacencyLsas = true;
+    return *this;
+  }
+
+  LsdbStatus&
+  clearAdjacencyLsas()
+  {
+    m_adjacencyLsas.clear();
+    m_hasAdjacencyLsas = false;
+    return *this;
+  }
+
+  bool
+  hasAdjacencyLsas()
+  {
+    return m_hasAdjacencyLsas;
+  }
+
+  const std::list<CoordinateLsa>&
+  getCoordinateLsas() const
+  {
+    return m_coordinateLsas;
+  }
+
+  LsdbStatus&
+  addCoordinateLsa(const CoordinateLsa& coordinateLsa)
+  {
+    m_coordinateLsas.push_back(coordinateLsa);
+    m_wire.reset();
+    m_hasCoordinateLsas = true;
+    return *this;
+  }
+
+  LsdbStatus&
+  clearCoordinateLsas()
+  {
+    m_coordinateLsas.clear();
+    m_hasCoordinateLsas = false;
+    return *this;
+  }
+
+  bool
+  hasCoordinateLsas()
+  {
+    return m_hasCoordinateLsas;
+  }
+
+  const std::list<NameLsa>&
+  getNameLsas() const
+  {
+    return m_nameLsas;
+  }
+
+  LsdbStatus&
+  addNameLsa(const NameLsa& nameLsa)
+  {
+    m_nameLsas.push_back(nameLsa);
+    m_wire.reset();
+    m_hasNameLsas = true;
+    return *this;
+  }
+
+  LsdbStatus&
+  clearNameLsas()
+  {
+    m_nameLsas.clear();
+    m_hasNameLsas = false;
+    return *this;
+  }
+
+  bool
+  hasNameLsas()
+  {
+    return m_hasNameLsas;
+  }
+
+  template<bool T>
+  size_t
+  wireEncode(ndn::EncodingImpl<T>& block) const;
+
+  const ndn::Block&
+  wireEncode() const;
+
+  void
+  wireDecode(const ndn::Block& wire);
+
+private:
+  AdjacencyLsaList m_adjacencyLsas;
+  CoordinateLsaList m_coordinateLsas;
+  NameLsaList m_nameLsas;
+
+  bool m_hasAdjacencyLsas;
+  bool m_hasCoordinateLsas;
+  bool m_hasNameLsas;
+
+  mutable ndn::Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const LsdbStatus& lsdbStatus);
+
+} // namespace tlv
+} // namespace nlsr
+
+#endif // NLSR_TLV_LSDB_STATUS_HPP
diff --git a/src/tlv/name-lsa.cpp b/src/tlv/name-lsa.cpp
new file mode 100644
index 0000000..c60b0b4
--- /dev/null
+++ b/src/tlv/name-lsa.cpp
@@ -0,0 +1,146 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "name-lsa.hpp"
+#include "tlv-nlsr.hpp"
+
+#include <ndn-cxx/util/concepts.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
+namespace nlsr {
+namespace tlv  {
+
+BOOST_CONCEPT_ASSERT((ndn::WireEncodable<NameLsa>));
+BOOST_CONCEPT_ASSERT((ndn::WireDecodable<NameLsa>));
+static_assert(std::is_base_of<ndn::tlv::Error, NameLsa::Error>::value,
+              "NameLsa::Error must inherit from tlv::Error");
+
+NameLsa::NameLsa()
+  : m_hasNames(false)
+{
+}
+
+NameLsa::NameLsa(const ndn::Block& block)
+{
+  wireDecode(block);
+}
+
+template<bool T>
+size_t
+NameLsa::wireEncode(ndn::EncodingImpl<T>& block) const
+{
+  size_t totalLength = 0;
+
+  for (std::list<ndn::Name>::const_reverse_iterator it = m_names.rbegin();
+       it != m_names.rend(); ++it) {
+    totalLength += it->wireEncode(block);
+  }
+
+  totalLength += m_lsaInfo.wireEncode(block);
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(ndn::tlv::nlsr::NameLsa);
+
+  return totalLength;
+}
+
+template size_t
+NameLsa::wireEncode<true>(ndn::EncodingImpl<true>& block) const;
+
+template size_t
+NameLsa::wireEncode<false>(ndn::EncodingImpl<false>& block) const;
+
+const ndn::Block&
+NameLsa::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
+NameLsa::wireDecode(const ndn::Block& wire)
+{
+  m_hasNames = false;
+  m_names.clear();
+
+  m_wire = wire;
+
+  if (m_wire.type() != ndn::tlv::nlsr::NameLsa) {
+    std::stringstream error;
+    error << "Expected NameLsa Block, but Block is of a different type: #"
+          << m_wire.type();
+    throw Error(error.str());
+  }
+
+  m_wire.parse();
+
+  ndn::Block::element_const_iterator val = m_wire.elements_begin();
+
+  if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::LsaInfo) {
+    m_lsaInfo.wireDecode(*val);
+    ++val;
+  }
+  else {
+    throw Error("Missing required LsaInfo field");
+  }
+
+  for (; val != m_wire.elements_end(); ++val) {
+    if (val->type() == ndn::tlv::Name) {
+      m_names.push_back(ndn::Name(*val));
+      m_hasNames = true;
+    }
+    else {
+      std::stringstream error;
+      error << "Expected Name Block, but Block is of a different type: #"
+            << m_wire.type();
+      throw Error(error.str());
+    }
+  }
+}
+
+std::ostream&
+operator<<(std::ostream& os, const NameLsa& nameLsa)
+{
+  os << "NameLsa("
+     << nameLsa.getLsaInfo();
+
+  for (const auto& name : nameLsa) {
+    os << ", Name: " << name;
+  }
+
+  os << ")";
+
+  return os;
+}
+
+} // namespace tlv
+} // namespace nlsr
diff --git a/src/tlv/name-lsa.hpp b/src/tlv/name-lsa.hpp
new file mode 100644
index 0000000..2b58283
--- /dev/null
+++ b/src/tlv/name-lsa.hpp
@@ -0,0 +1,153 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NLSR_TLV_NAME_LSA_HPP
+#define NLSR_TLV_NAME_LSA_HPP
+
+#include "lsa-info.hpp"
+
+#include <ndn-cxx/util/time.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/encoding/encoding-buffer.hpp>
+#include <ndn-cxx/encoding/tlv.hpp>
+#include <ndn-cxx/name.hpp>
+
+#include <list>
+
+namespace nlsr {
+namespace tlv  {
+
+/**
+ * @brief Data abstraction for NameLsa
+ *
+ * NameLsa := NAME-LSA-TYPE TLV-LENGTH
+ *              LsaInfo
+ *              Name+
+ *
+ * @sa http://redmine.named-data.net/projects/nlsr/wiki/LSDB_DataSet
+ */
+class NameLsa
+{
+public:
+  class Error : public ndn::tlv::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : ndn::tlv::Error(what)
+    {
+    }
+  };
+
+  typedef std::list<ndn::Name> NameList;
+  typedef NameList::const_iterator iterator;
+
+  NameLsa();
+
+  explicit
+  NameLsa(const ndn::Block& block);
+
+  const LsaInfo&
+  getLsaInfo() const
+  {
+    return m_lsaInfo;
+  }
+
+  NameLsa&
+  setLsaInfo(const LsaInfo& lsaInfo)
+  {
+    m_lsaInfo = lsaInfo;
+    m_wire.reset();
+    return *this;
+  }
+
+  bool
+  hasNames() const
+  {
+    return m_hasNames;
+  }
+
+  const std::list<ndn::Name>&
+  getNames() const
+  {
+    return m_names;
+  }
+
+  NameLsa&
+  addName(const ndn::Name& name)
+  {
+    m_names.push_back(name);
+    m_wire.reset();
+    m_hasNames = true;
+    return *this;
+  }
+
+  NameLsa&
+  clearNames()
+  {
+    m_names.clear();
+    m_hasNames = false;
+    return *this;
+  }
+
+  template<bool T>
+  size_t
+  wireEncode(ndn::EncodingImpl<T>& block) const;
+
+  const ndn::Block&
+  wireEncode() const;
+
+  void
+  wireDecode(const ndn::Block& wire);
+
+  iterator
+  begin() const;
+
+  iterator
+  end() const;
+
+private:
+  LsaInfo m_lsaInfo;
+  bool m_hasNames;
+  NameList m_names;
+
+  mutable ndn::Block m_wire;
+};
+
+inline NameLsa::iterator
+NameLsa::begin() const
+{
+  return m_names.begin();
+}
+
+inline NameLsa::iterator
+NameLsa::end() const
+{
+  return m_names.end();
+}
+
+std::ostream&
+operator<<(std::ostream& os, const NameLsa& nameLsa);
+
+} // namespace tlv
+} // namespace nlsr
+
+#endif // NLSR_TLV_NAME_LSA_HPP
diff --git a/src/tlv/tlv-nlsr.hpp b/src/tlv/tlv-nlsr.hpp
new file mode 100644
index 0000000..60b2ca3
--- /dev/null
+++ b/src/tlv/tlv-nlsr.hpp
@@ -0,0 +1,53 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR 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.
+ *
+ * NLSR 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
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef NLSR_TLV_NLSR_HPP
+#define NLSR_TLV_NLSR_HPP
+
+#include <ndn-cxx/encoding/tlv.hpp>
+
+namespace ndn  {
+namespace tlv  {
+namespace nlsr {
+
+// LSDB DataSet
+enum {
+  LsaInfo          = 128,
+  OriginRouter     = 129,
+  SequenceNumber   = 130,
+  AdjacencyLsa     = 131,
+  Adjacency        = 132,
+  CoordinateLsa    = 133,
+  Double           = 134,
+  HyperbolicRadius = 135,
+  HyperbolicAngle  = 136,
+  NameLsa          = 137,
+  LsdbStatus       = 138,
+  ExpirationPeriod = 139,
+  Cost             = 140,
+  Uri              = 141
+};
+
+} // namespace nlsr
+} // namespace tlv
+} // namespace ndn
+
+#endif // NLSR_TLV_NLSR_HPP
