diff --git a/AUTHORS.md b/AUTHORS.md
index 29f1054..1ad663d 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -34,6 +34,7 @@
     * Yingdi Yu           <http://irl.cs.ucla.edu/~yingdi/web/index.html>
     * Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
     * Spyridon Mastorakis <http://cs.ucla.edu/~mastorakis/>
+    * Jiewen Tan          <alanwake@ucla.edu>
 
 
 ## Queries about NLSR
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
diff --git a/tests/tlv/test-adjacency-lsa.cpp b/tests/tlv/test-adjacency-lsa.cpp
new file mode 100644
index 0000000..16a7d1e
--- /dev/null
+++ b/tests/tlv/test-adjacency-lsa.cpp
@@ -0,0 +1,223 @@
+/* -*- 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 "tlv/adjacency-lsa.hpp"
+
+#include "../boost-test.hpp"
+
+namespace nlsr {
+namespace tlv  {
+namespace test {
+
+BOOST_AUTO_TEST_SUITE(TlvTestAdjacencyLsa)
+
+const uint8_t AdjacencyLsaWithAdjacenciesData[] =
+{
+  // Header
+  0x83, 0x3d,
+  // LsaInfo
+  0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+  0x80, 0x8b, 0x02, 0x27, 0x10,
+  // Adjacency
+  0x84, 0x13, 0x07, 0x07, 0x08, 0x05, 0x74, 0x65, 0x73, 0x74, 0x31, 0x8d, 0x05, 0x74,
+  0x65, 0x73, 0x74, 0x31, 0x8c, 0x01, 0x80,
+  // Adjacency
+  0x84, 0x13, 0x07, 0x07, 0x08, 0x05, 0x74, 0x65, 0x73, 0x74, 0x32, 0x8d, 0x05, 0x74,
+  0x65, 0x73, 0x74, 0x32, 0x8c, 0x01, 0x80
+};
+
+const uint8_t AdjacencyLsaWithoutAdjacenciesData[] =
+{
+  // Header
+  0x83, 0x13,
+  // LsaInfo
+  0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+  0x80, 0x8b, 0x02, 0x27, 0x10,
+};
+
+BOOST_AUTO_TEST_CASE(AdjacencyLsaEncodeWithAdjacencies)
+{
+  AdjacencyLsa adjacencyLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  adjacencyLsa.setLsaInfo(lsaInfo);
+
+  Adjacency adjacency1;
+  adjacency1.setName("test1");
+  adjacency1.setUri("test1");
+  adjacency1.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency1);
+
+  Adjacency adjacency2;
+  adjacency2.setName("test2");
+  adjacency2.setUri("test2");
+  adjacency2.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency2);
+
+  const ndn::Block& wire = adjacencyLsa.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(AdjacencyLsaWithAdjacenciesData,
+                                  AdjacencyLsaWithAdjacenciesData +
+                                    sizeof(AdjacencyLsaWithAdjacenciesData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyLsaDecodeWithAdjacencies)
+{
+  AdjacencyLsa adjacencyLsa;
+
+  adjacencyLsa.wireDecode(ndn::Block(AdjacencyLsaWithAdjacenciesData,
+                                      sizeof(AdjacencyLsaWithAdjacenciesData)));
+
+  LsaInfo lsaInfo = adjacencyLsa.getLsaInfo();
+  BOOST_CHECK_EQUAL(lsaInfo.getOriginRouter(), "test");
+  BOOST_CHECK_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_CHECK_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+
+  BOOST_CHECK_EQUAL(adjacencyLsa.hasAdjacencies(), true);
+  std::list<Adjacency> adjacencies = adjacencyLsa.getAdjacencies();
+  std::list<Adjacency>::const_iterator it = adjacencies.begin();
+  BOOST_CHECK_EQUAL(it->getName(), "test1");
+  BOOST_CHECK_EQUAL(it->getUri(), "test1");
+  BOOST_CHECK_EQUAL(it->getCost(), 128);
+
+  it++;
+  BOOST_CHECK_EQUAL(it->getName(), "test2");
+  BOOST_CHECK_EQUAL(it->getUri(), "test2");
+  BOOST_CHECK_EQUAL(it->getCost(), 128);
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyLsaEncodeWithoutAdjacencies)
+{
+  AdjacencyLsa adjacencyLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  adjacencyLsa.setLsaInfo(lsaInfo);
+
+  const ndn::Block& wire = adjacencyLsa.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(AdjacencyLsaWithoutAdjacenciesData,
+                                  AdjacencyLsaWithoutAdjacenciesData +
+                                    sizeof(AdjacencyLsaWithoutAdjacenciesData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyLsaDecodeWithoutAdjacencies)
+{
+  AdjacencyLsa adjacencyLsa;
+
+  adjacencyLsa.wireDecode(ndn::Block(AdjacencyLsaWithoutAdjacenciesData,
+                                      sizeof(AdjacencyLsaWithoutAdjacenciesData)));
+
+  LsaInfo lsaInfo = adjacencyLsa.getLsaInfo();
+  BOOST_CHECK_EQUAL(lsaInfo.getOriginRouter(), "test");
+  BOOST_CHECK_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_CHECK_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+
+  BOOST_CHECK_EQUAL(adjacencyLsa.hasAdjacencies(), false);
+}
+
+
+BOOST_AUTO_TEST_CASE(AdjacencyLsaClear)
+{
+  AdjacencyLsa adjacencyLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  adjacencyLsa.setLsaInfo(lsaInfo);
+
+  Adjacency adjacency1;
+  adjacency1.setName("test1");
+  adjacency1.setUri("test1");
+  adjacency1.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency1);
+  BOOST_CHECK_EQUAL(adjacencyLsa.getAdjacencies().size(), 1);
+
+  std::list<Adjacency> adjacencies = adjacencyLsa.getAdjacencies();
+  std::list<Adjacency>::const_iterator it = adjacencies.begin();
+  BOOST_CHECK_EQUAL(it->getName(), "test1");
+  BOOST_CHECK_EQUAL(it->getUri(), "test1");
+  BOOST_CHECK_EQUAL(it->getCost(), 128);
+
+  adjacencyLsa.clearAdjacencies();
+  BOOST_CHECK_EQUAL(adjacencyLsa.getAdjacencies().size(), 0);
+
+  Adjacency adjacency2;
+  adjacency2.setName("test2");
+  adjacency2.setUri("test2");
+  adjacency2.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency2);
+  BOOST_CHECK_EQUAL(adjacencyLsa.getAdjacencies().size(), 1);
+
+  adjacencies = adjacencyLsa.getAdjacencies();
+  it = adjacencies.begin();
+  BOOST_CHECK_EQUAL(it->getName(), "test2");
+  BOOST_CHECK_EQUAL(it->getUri(), "test2");
+  BOOST_CHECK_EQUAL(it->getCost(), 128);
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyLsaOutputStream)
+{
+  AdjacencyLsa adjacencyLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  adjacencyLsa.setLsaInfo(lsaInfo);
+
+  Adjacency adjacency1;
+  adjacency1.setName("test1");
+  adjacency1.setUri("test1");
+  adjacency1.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency1);
+
+  Adjacency adjacency2;
+  adjacency2.setName("test2");
+  adjacency2.setUri("test2");
+  adjacency2.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency2);
+
+  std::ostringstream os;
+  os << adjacencyLsa;
+
+  BOOST_CHECK_EQUAL(os.str(), "AdjacencyLsa("
+                                "LsaInfo("
+                                  "OriginRouter: /test, "
+                                  "SequenceNumber: 128, "
+                                  "ExpirationPeriod: 10000 milliseconds), "
+                                "Adjacency(Name: /test1, Uri: test1, Cost: 128), "
+                                "Adjacency(Name: /test2, Uri: test2, Cost: 128))");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace tlv
+} // namespace nlsr
diff --git a/tests/tlv/test-adjacency.cpp b/tests/tlv/test-adjacency.cpp
new file mode 100644
index 0000000..7c3ff53
--- /dev/null
+++ b/tests/tlv/test-adjacency.cpp
@@ -0,0 +1,91 @@
+/* -*- 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 "tlv/adjacency.hpp"
+
+#include "../boost-test.hpp"
+
+namespace nlsr {
+namespace tlv  {
+namespace test {
+
+BOOST_AUTO_TEST_SUITE(TlvTestAdjacency)
+
+const uint8_t AdjacencyData[] =
+{
+  // Header
+  0x84, 0x30,
+  // Name
+  0x07, 0x16, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x09, 0x61, 0x64, 0x6a, 0x61,
+  0x63, 0x65, 0x6e, 0x63, 0x79, 0x08, 0x03, 0x74, 0x6c, 0x76,
+  // Uri
+  0x8d, 0x13, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65,
+  0x6e, 0x63, 0x79, 0x2f, 0x74, 0x6c, 0x76,
+  // Cost
+  0x8c, 0x01, 0x80
+};
+
+BOOST_AUTO_TEST_CASE(AdjacencyEncode)
+{
+  Adjacency adjacency;
+  adjacency.setName("/test/adjacency/tlv");
+  adjacency.setUri("/test/adjacency/tlv");
+  adjacency.setCost(128);
+
+  const ndn::Block& wire = adjacency.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(AdjacencyData,
+                                  AdjacencyData + sizeof(AdjacencyData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyDecode)
+{
+  Adjacency adjacency;
+
+  adjacency.wireDecode(ndn::Block(AdjacencyData, sizeof(AdjacencyData)));
+
+  ndn::Name name("/test/adjacency/tlv");
+  BOOST_REQUIRE_EQUAL(adjacency.getName(), name);
+  BOOST_REQUIRE_EQUAL(adjacency.getUri(), "/test/adjacency/tlv");
+  BOOST_REQUIRE_EQUAL(adjacency.getCost(), 128);
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyOutputStream)
+{
+  Adjacency adjacency;
+  adjacency.setName("/test/adjacency/tlv");
+  adjacency.setUri("/test/adjacency/tlv");
+  adjacency.setCost(128);
+
+  std::ostringstream os;
+  os << adjacency;
+
+  BOOST_CHECK_EQUAL(os.str(), "Adjacency(Name: /test/adjacency/tlv, "
+                              "Uri: /test/adjacency/tlv, "
+                              "Cost: 128)");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace tlv
+} // namespace nlsr
diff --git a/tests/tlv/test-coordinate-lsa.cpp b/tests/tlv/test-coordinate-lsa.cpp
new file mode 100644
index 0000000..cb05ed4
--- /dev/null
+++ b/tests/tlv/test-coordinate-lsa.cpp
@@ -0,0 +1,107 @@
+/* -*- 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 "tlv/coordinate-lsa.hpp"
+
+#include "../boost-test.hpp"
+
+namespace nlsr {
+namespace tlv  {
+namespace test {
+
+BOOST_AUTO_TEST_SUITE(TlvTestCoordinateLsa)
+
+const uint8_t CoordinateLsaData[] =
+{
+  // Header
+  0x85, 0x2b,
+  // LsaInfo
+  0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+  0x80, 0x8b, 0x02, 0x27, 0x10,
+  // HyperbolicRadius
+  0x87, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
+  // HyperbolicAngle
+  0x88, 0x0a, 0x86, 0x08, 0x7b, 0x14, 0xae, 0x47, 0xe1, 0x7a, 0xfc, 0x3f
+};
+
+BOOST_AUTO_TEST_CASE(CoordinateLsaEncode)
+{
+  CoordinateLsa coordinateLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  coordinateLsa.setLsaInfo(lsaInfo);
+
+  coordinateLsa.setHyperbolicRadius(1.65);
+  coordinateLsa.setHyperbolicAngle(1.78);
+
+  const ndn::Block& wire = coordinateLsa.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(CoordinateLsaData,
+                                  CoordinateLsaData + sizeof(CoordinateLsaData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(CoordinateLsaDecode)
+{
+  CoordinateLsa coordinateLsa;
+
+  coordinateLsa.wireDecode(ndn::Block(CoordinateLsaData, sizeof(CoordinateLsaData)));
+
+  BOOST_REQUIRE_EQUAL(coordinateLsa.getLsaInfo().getOriginRouter(), "test");
+  BOOST_REQUIRE_EQUAL(coordinateLsa.getLsaInfo().getSequenceNumber(), 128);
+  BOOST_REQUIRE_EQUAL(coordinateLsa.getLsaInfo().getExpirationPeriod(),
+                      ndn::time::milliseconds(10000));
+  BOOST_REQUIRE_EQUAL(coordinateLsa.getHyperbolicRadius(), 1.65);
+  BOOST_REQUIRE_EQUAL(coordinateLsa.getHyperbolicAngle(), 1.78);
+}
+
+BOOST_AUTO_TEST_CASE(CoordinateLsaOutputStream)
+{
+  CoordinateLsa coordinateLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  coordinateLsa.setLsaInfo(lsaInfo);
+
+  coordinateLsa.setHyperbolicRadius(1.65);
+  coordinateLsa.setHyperbolicAngle(1.78);
+
+  std::ostringstream os;
+  os << coordinateLsa;
+
+  BOOST_CHECK_EQUAL(os.str(), "CoordinateLsa("
+                                "LsaInfo(OriginRouter: /test, "
+                                        "SequenceNumber: 128, "
+                                        "ExpirationPeriod: 10000 milliseconds), "
+                                "HyperbolicRadius: 1.65, "
+                                "HyperbolicAngle: 1.78)");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace tlv
+} // namespace nlsr
diff --git a/tests/tlv/test-lsa-info.cpp b/tests/tlv/test-lsa-info.cpp
new file mode 100644
index 0000000..dff4458
--- /dev/null
+++ b/tests/tlv/test-lsa-info.cpp
@@ -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/>.
+ **/
+
+#include "tlv/lsa-info.hpp"
+
+#include "../boost-test.hpp"
+
+namespace nlsr {
+namespace tlv  {
+namespace test {
+
+BOOST_AUTO_TEST_SUITE(TlvTestLsaInfo)
+
+const uint8_t LsaInfoData[] =
+{
+  // Header
+  0x80, 0x21,
+  // OriginRouter
+  0x81, 0x18, 0x07, 0x16, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x03, 0x6c, 0x73,
+  0x61, 0x08, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x08, 0x03, 0x74, 0x6c, 0x76,
+  // SequenceNumber
+  0x82, 0x01, 0x80,
+  // ExpirationPeriod
+  0x8b, 0x02, 0x27, 0x10
+};
+
+const uint8_t LsaInfoDataInfiniteExpirationPeriod[] =
+{
+  // Header
+  0x80, 0x1d,
+  // OriginRouter
+  0x81, 0x18, 0x07, 0x16, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x08, 0x03, 0x6c, 0x73,
+  0x61, 0x08, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x08, 0x03, 0x74, 0x6c, 0x76,
+  // SequenceNumber
+  0x82, 0x1, 0x80
+};
+
+BOOST_AUTO_TEST_CASE(LsaInfoEncode)
+{
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("/test/lsa/info/tlv");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+
+  const ndn::Block& wire = lsaInfo.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(LsaInfoData,
+                                  LsaInfoData + sizeof(LsaInfoData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(LsaInfoDecode)
+{
+  LsaInfo lsaInfo;
+
+  lsaInfo.wireDecode(ndn::Block(LsaInfoData, sizeof(LsaInfoData)));
+
+  ndn::Name originRouter("/test/lsa/info/tlv");
+  BOOST_REQUIRE_EQUAL(lsaInfo.getOriginRouter(), originRouter);
+  BOOST_REQUIRE_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_REQUIRE_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+  BOOST_REQUIRE_EQUAL(lsaInfo.hasInfiniteExpirationPeriod(), false);
+}
+
+BOOST_AUTO_TEST_CASE(LsaInfoInfiniteExpirationPeriodEncode)
+{
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("/test/lsa/info/tlv");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(LsaInfo::INFINITE_EXPIRATION_PERIOD);
+
+  const ndn::Block& wire = lsaInfo.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(LsaInfoDataInfiniteExpirationPeriod,
+                                  LsaInfoDataInfiniteExpirationPeriod +
+                                    sizeof(LsaInfoDataInfiniteExpirationPeriod),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(LsaInfoInfiniteExpirationPeriodDecode)
+{
+  LsaInfo lsaInfo;
+
+  lsaInfo.wireDecode(ndn::Block(LsaInfoDataInfiniteExpirationPeriod,
+                                sizeof(LsaInfoDataInfiniteExpirationPeriod)));
+
+  ndn::Name originRouter("/test/lsa/info/tlv");
+  BOOST_REQUIRE_EQUAL(lsaInfo.getOriginRouter(), originRouter);
+  BOOST_REQUIRE_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_REQUIRE_EQUAL(lsaInfo.getExpirationPeriod(), LsaInfo::INFINITE_EXPIRATION_PERIOD);
+  BOOST_REQUIRE_EQUAL(lsaInfo.hasInfiniteExpirationPeriod(), true);
+}
+
+BOOST_AUTO_TEST_CASE(LsaInfoOutputStream)
+{
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("/test/lsa/info/tlv");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+
+  std::ostringstream os;
+  os << lsaInfo;
+
+  BOOST_CHECK_EQUAL(os.str(), "LsaInfo(OriginRouter: /test/lsa/info/tlv, SequenceNumber: 128, "
+                              "ExpirationPeriod: 10000 milliseconds)");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace tlv
+} // namespace nlsr
diff --git a/tests/tlv/test-lsdb-status.cpp b/tests/tlv/test-lsdb-status.cpp
new file mode 100644
index 0000000..73a120f
--- /dev/null
+++ b/tests/tlv/test-lsdb-status.cpp
@@ -0,0 +1,337 @@
+/* -*- 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 "tlv/lsdb-status.hpp"
+
+#include "../boost-test.hpp"
+
+namespace nlsr {
+namespace tlv  {
+namespace test {
+
+BOOST_AUTO_TEST_SUITE(TlvTestLsdbStatus)
+
+const uint8_t LsdbStatusData1[] =
+{
+  // Header
+  0x8a, 0x7f,
+  // AdjacencyLsa
+  0x83, 0x32,
+    // LsaInfo
+    0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+    0x80, 0x8b, 0x02, 0x27, 0x10,
+    // Adjacency
+    0x84, 0x1d, 0x07, 0x0c, 0x08, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63,
+    0x79, 0x31, 0x8d, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63, 0x79, 0x31,
+    0x8c, 0x01, 0x80,
+  // CoordianteLsa
+  0x85, 0x2b,
+    // LsaInfo
+    0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+    0x80, 0x8b, 0x02, 0x27, 0x10,
+    // HyperbolicRadius
+    0x87, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
+    // HyperbolicAngle
+    0x88, 0x0a, 0x86, 0x08, 0x7b, 0x14, 0xae, 0x47, 0xe1, 0x7a, 0xfc, 0x3f,
+  // NameLsa
+  0x89, 0x1c,
+    // LsaInfo
+    0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+    0x80, 0x8b, 0x02, 0x27, 0x10,
+    // Name
+    0x07, 0x07, 0x08, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x31
+};
+
+const uint8_t LsdbStatusData2[] =
+{
+  // Header
+  0x8a, 0x00
+};
+
+const uint8_t LsdbStatusData3[] =
+{
+  // Header
+  0x8a, 0x7f,
+  // CoordianteLsa
+  0x85, 0x2b,
+    // LsaInfo
+    0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+    0x80, 0x8b, 0x02, 0x27, 0x10,
+    // HyperbolicRadius
+    0x87, 0x0a, 0x86, 0x08, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfa, 0x3f,
+    // HyperbolicAngle
+    0x88, 0x0a, 0x86, 0x08, 0x7b, 0x14, 0xae, 0x47, 0xe1, 0x7a, 0xfc, 0x3f,
+  // NameLsa
+  0x89, 0x1c,
+    // LsaInfo
+    0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+    0x80, 0x8b, 0x02, 0x27, 0x10,
+    // Name
+    0x07, 0x07, 0x08, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x31,
+  // AdjacencyLsa
+   0x83, 0x32,
+     // LsaInfo
+     0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+     0x80, 0x8b, 0x02, 0x27, 0x10,
+     // Adjacency
+     0x84, 0x1d, 0x07, 0x0c, 0x08, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63,
+     0x79, 0x31, 0x8d, 0x0a, 0x61, 0x64, 0x6a, 0x61, 0x63, 0x65, 0x6e, 0x63, 0x79, 0x31,
+     0x8c, 0x01, 0x80
+};
+
+BOOST_AUTO_TEST_CASE(LsdbStatusEncode1)
+{
+  LsdbStatus lsdbStatus;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+
+  // AdjacencyLsa
+  AdjacencyLsa adjacencyLsa;
+  adjacencyLsa.setLsaInfo(lsaInfo);
+
+  Adjacency adjacency1;
+  adjacency1.setName("adjacency1");
+  adjacency1.setUri("adjacency1");
+  adjacency1.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency1);
+
+  lsdbStatus.addAdjacencyLsa(adjacencyLsa);
+
+  // CoordinateLsa
+  CoordinateLsa coordinateLsa;
+  coordinateLsa.setLsaInfo(lsaInfo);
+
+  coordinateLsa.setHyperbolicRadius(1.65);
+  coordinateLsa.setHyperbolicAngle(1.78);
+
+  lsdbStatus.addCoordinateLsa(coordinateLsa);
+
+  // NameLsa
+  NameLsa nameLsa;
+  nameLsa.setLsaInfo(lsaInfo);
+  nameLsa.addName("name1");
+
+  lsdbStatus.addNameLsa(nameLsa);
+
+  const ndn::Block& wire = lsdbStatus.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(LsdbStatusData1,
+                                  LsdbStatusData1 + sizeof(LsdbStatusData1),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(LsdbStatusEncode2)
+{
+  LsdbStatus lsdbStatus;
+
+  const ndn::Block& wire = lsdbStatus.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(LsdbStatusData2,
+                                  LsdbStatusData2 + sizeof(LsdbStatusData2),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(LsdbStatusDecode1)
+{
+  LsdbStatus lsdbStatus;
+
+  lsdbStatus.wireDecode(ndn::Block(LsdbStatusData1, sizeof(LsdbStatusData1)));
+
+  std::list<AdjacencyLsa> adjacencyLsas = lsdbStatus.getAdjacencyLsas();
+  std::list<AdjacencyLsa>::const_iterator it1 = adjacencyLsas.begin();
+
+  LsaInfo lsaInfo = it1->getLsaInfo();
+  BOOST_CHECK_EQUAL(lsaInfo.getOriginRouter(), "test");
+  BOOST_CHECK_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_CHECK_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+
+  std::list<Adjacency> adjacencies = it1->getAdjacencies();
+  std::list<Adjacency>::const_iterator it2 = adjacencies.begin();
+  BOOST_CHECK_EQUAL(it2->getName(), "adjacency1");
+  BOOST_CHECK_EQUAL(it2->getUri(), "adjacency1");
+  BOOST_CHECK_EQUAL(it2->getCost(), 128);
+
+  BOOST_CHECK_EQUAL(lsdbStatus.hasAdjacencyLsas(), true);
+
+  std::list<CoordinateLsa> coordinateLsas = lsdbStatus.getCoordinateLsas();
+  std::list<CoordinateLsa>::const_iterator it3 = coordinateLsas.begin();
+
+  lsaInfo = it3->getLsaInfo();
+  BOOST_CHECK_EQUAL(lsaInfo.getOriginRouter(), "test");
+  BOOST_CHECK_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_CHECK_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+
+  BOOST_REQUIRE_EQUAL(it3->getHyperbolicRadius(), 1.65);
+  BOOST_REQUIRE_EQUAL(it3->getHyperbolicAngle(), 1.78);
+
+  BOOST_CHECK_EQUAL(lsdbStatus.hasCoordinateLsas(), true);
+
+  std::list<NameLsa> nameLsas = lsdbStatus.getNameLsas();
+  std::list<NameLsa>::const_iterator it4 = nameLsas.begin();
+
+  lsaInfo = it4->getLsaInfo();
+  BOOST_CHECK_EQUAL(lsaInfo.getOriginRouter(), "test");
+  BOOST_CHECK_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_CHECK_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+
+  std::list<ndn::Name> names = it4->getNames();
+  std::list<ndn::Name>::const_iterator it5 = names.begin();
+  BOOST_CHECK_EQUAL(*it5, "name1");
+
+  BOOST_CHECK_EQUAL(lsdbStatus.hasNameLsas(), true);
+}
+
+BOOST_AUTO_TEST_CASE(LsdbStatusDecode2)
+{
+  LsdbStatus lsdbStatus;
+
+  lsdbStatus.wireDecode(ndn::Block(LsdbStatusData2, sizeof(LsdbStatusData2)));
+
+  BOOST_CHECK_EQUAL(lsdbStatus.hasAdjacencyLsas(), false);
+  BOOST_CHECK_EQUAL(lsdbStatus.hasCoordinateLsas(), false);
+  BOOST_CHECK_EQUAL(lsdbStatus.hasNameLsas(), false);
+}
+
+BOOST_AUTO_TEST_CASE(LsdbStatusDecode3)
+{
+  LsdbStatus lsdbStatus;
+
+  BOOST_CHECK_THROW(lsdbStatus.wireDecode(ndn::Block(LsdbStatusData3, sizeof(LsdbStatusData3))),
+                    LsdbStatus::Error);
+}
+
+BOOST_AUTO_TEST_CASE(LsdbStatusClear)
+{
+  LsdbStatus lsdbStatus;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+
+  // AdjacencyLsa
+  AdjacencyLsa adjacencyLsa;
+  adjacencyLsa.setLsaInfo(lsaInfo);
+
+  Adjacency adjacency1;
+  adjacency1.setName("adjacency1");
+  adjacency1.setUri("adjacency1");
+  adjacency1.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency1);
+
+  lsdbStatus.addAdjacencyLsa(adjacencyLsa);
+  BOOST_CHECK_EQUAL(lsdbStatus.hasAdjacencyLsas(), true);
+  lsdbStatus.clearAdjacencyLsas();
+  BOOST_CHECK_EQUAL(lsdbStatus.hasAdjacencyLsas(), false);
+
+  // CoordinateLsa
+  CoordinateLsa coordinateLsa;
+  coordinateLsa.setLsaInfo(lsaInfo);
+
+  coordinateLsa.setHyperbolicRadius(1.65);
+  coordinateLsa.setHyperbolicAngle(1.78);
+
+  lsdbStatus.addCoordinateLsa(coordinateLsa);
+  BOOST_CHECK_EQUAL(lsdbStatus.hasCoordinateLsas(), true);
+  lsdbStatus.clearCoordinateLsas();
+  BOOST_CHECK_EQUAL(lsdbStatus.hasCoordinateLsas(), false);
+
+  // NameLsa
+  NameLsa nameLsa;
+  nameLsa.setLsaInfo(lsaInfo);
+  nameLsa.addName("name1");
+
+  lsdbStatus.addNameLsa(nameLsa);
+  BOOST_CHECK_EQUAL(lsdbStatus.hasNameLsas(), true);
+  lsdbStatus.clearNameLsas();
+  BOOST_CHECK_EQUAL(lsdbStatus.hasNameLsas(), false);
+}
+
+BOOST_AUTO_TEST_CASE(LsdbStatusOutputStream)
+{
+  LsdbStatus lsdbStatus;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+
+  // AdjacencyLsa
+  AdjacencyLsa adjacencyLsa;
+  adjacencyLsa.setLsaInfo(lsaInfo);
+
+  Adjacency adjacency1;
+  adjacency1.setName("adjacency1");
+  adjacency1.setUri("adjacency1");
+  adjacency1.setCost(128);
+  adjacencyLsa.addAdjacency(adjacency1);
+
+  lsdbStatus.addAdjacencyLsa(adjacencyLsa);
+
+  // CoordinateLsa
+  CoordinateLsa coordinateLsa;
+  coordinateLsa.setLsaInfo(lsaInfo);
+
+  coordinateLsa.setHyperbolicRadius(1.65);
+  coordinateLsa.setHyperbolicAngle(1.78);
+
+  lsdbStatus.addCoordinateLsa(coordinateLsa);
+
+  // NameLsa
+  NameLsa nameLsa;
+  nameLsa.setLsaInfo(lsaInfo);
+  nameLsa.addName("name1");
+
+  lsdbStatus.addNameLsa(nameLsa);
+
+  std::ostringstream os;
+  os << lsdbStatus;
+
+  BOOST_CHECK_EQUAL(os.str(), "LsdbStatus("
+                                "AdjacencyLsa("
+                                  "LsaInfo("
+                                    "OriginRouter: /test, "
+                                    "SequenceNumber: 128, "
+                                    "ExpirationPeriod: 10000 milliseconds), "
+                                  "Adjacency(Name: /adjacency1, Uri: adjacency1, Cost: 128)), "
+                                "CoordinateLsa("
+                                  "LsaInfo("
+                                    "OriginRouter: /test, "
+                                    "SequenceNumber: 128, "
+                                    "ExpirationPeriod: 10000 milliseconds), "
+                                  "HyperbolicRadius: 1.65, "
+                                  "HyperbolicAngle: 1.78), "
+                                "NameLsa("
+                                  "LsaInfo("
+                                    "OriginRouter: /test, "
+                                    "SequenceNumber: 128, "
+                                    "ExpirationPeriod: 10000 milliseconds), "
+                                  "Name: /name1))");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace tlv
+} // namespace nlsr
diff --git a/tests/tlv/test-name-lsa.cpp b/tests/tlv/test-name-lsa.cpp
new file mode 100644
index 0000000..318d282
--- /dev/null
+++ b/tests/tlv/test-name-lsa.cpp
@@ -0,0 +1,182 @@
+/* -*- 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 "tlv/name-lsa.hpp"
+
+#include "../boost-test.hpp"
+
+namespace nlsr {
+namespace tlv  {
+namespace test {
+
+BOOST_AUTO_TEST_SUITE(TlvTestNameLsa)
+
+const uint8_t NameLsaWithNamesData[] =
+{
+  // Header
+  0x89, 0x25,
+  // LsaInfo
+  0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+  0x80, 0x8b, 0x02, 0x27, 0x10,
+  // Name
+  0x07, 0x07, 0x08, 0x05, 0x74, 0x65, 0x73, 0x74, 0x31,
+  // Name
+  0x07, 0x07, 0x08, 0x05, 0x74, 0x65, 0x73, 0x74, 0x32
+};
+
+const uint8_t NameLsaWithoutNamesData[] =
+{
+  // Header
+  0x89, 0x13,
+  // LsaInfo
+  0x80, 0x11, 0x81, 0x08, 0x07, 0x06, 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, 0x82, 0x01,
+  0x80, 0x8b, 0x02, 0x27, 0x10,
+};
+
+BOOST_AUTO_TEST_CASE(NameLsaEncodeWithNames)
+{
+  NameLsa nameLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  nameLsa.setLsaInfo(lsaInfo);
+
+  nameLsa.addName("test1");
+  nameLsa.addName("test2");
+
+  const ndn::Block& wire = nameLsa.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(NameLsaWithNamesData,
+                                  NameLsaWithNamesData + sizeof(NameLsaWithNamesData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(NameLsaDecodeWithNames)
+{
+  NameLsa nameLsa;
+
+  nameLsa.wireDecode(ndn::Block(NameLsaWithNamesData, sizeof(NameLsaWithNamesData)));
+
+  LsaInfo lsaInfo = nameLsa.getLsaInfo();
+  BOOST_CHECK_EQUAL(lsaInfo.getOriginRouter(), "test");
+  BOOST_CHECK_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_CHECK_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+
+  BOOST_CHECK_EQUAL(nameLsa.hasNames(), true);
+  std::list<ndn::Name> names = nameLsa.getNames();
+  std::list<ndn::Name>::const_iterator it = names.begin();
+  BOOST_CHECK_EQUAL(*it, "test1");
+
+  it++;
+  BOOST_CHECK_EQUAL(*it, "test2");
+}
+
+BOOST_AUTO_TEST_CASE(NameLsaEncodeWithoutNames)
+{
+  NameLsa nameLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  nameLsa.setLsaInfo(lsaInfo);
+
+  const ndn::Block& wire = nameLsa.wireEncode();
+
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(NameLsaWithoutNamesData,
+                                  NameLsaWithoutNamesData + sizeof(NameLsaWithoutNamesData),
+                                  wire.begin(), wire.end());
+}
+
+BOOST_AUTO_TEST_CASE(NameLsaDecodeWithoutNames)
+{
+  NameLsa nameLsa;
+
+  nameLsa.wireDecode(ndn::Block(NameLsaWithoutNamesData, sizeof(NameLsaWithoutNamesData)));
+
+  LsaInfo lsaInfo = nameLsa.getLsaInfo();
+  BOOST_CHECK_EQUAL(lsaInfo.getOriginRouter(), "test");
+  BOOST_CHECK_EQUAL(lsaInfo.getSequenceNumber(), 128);
+  BOOST_CHECK_EQUAL(lsaInfo.getExpirationPeriod(), ndn::time::milliseconds(10000));
+
+  BOOST_CHECK_EQUAL(nameLsa.hasNames(), false);
+}
+
+BOOST_AUTO_TEST_CASE(NameLsaClear)
+{
+  NameLsa nameLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  nameLsa.setLsaInfo(lsaInfo);
+
+  nameLsa.addName("test1");
+  BOOST_CHECK_EQUAL(nameLsa.getNames().size(), 1);
+
+  std::list<ndn::Name> names = nameLsa.getNames();
+  std::list<ndn::Name>::const_iterator it = names.begin();
+  BOOST_CHECK_EQUAL(*it, "test1");
+
+  nameLsa.clearNames();
+  BOOST_CHECK_EQUAL(nameLsa.getNames().size(), 0);
+
+  nameLsa.addName("test2");
+  BOOST_CHECK_EQUAL(nameLsa.getNames().size(), 1);
+
+  names = nameLsa.getNames();
+  it = names.begin();
+  BOOST_CHECK_EQUAL(*it, "test2");
+}
+
+BOOST_AUTO_TEST_CASE(AdjacencyLsaOutputStream)
+{
+  NameLsa nameLsa;
+
+  LsaInfo lsaInfo;
+  lsaInfo.setOriginRouter("test");
+  lsaInfo.setSequenceNumber(128);
+  lsaInfo.setExpirationPeriod(ndn::time::milliseconds(10000));
+  nameLsa.setLsaInfo(lsaInfo);
+
+  nameLsa.addName("test1");
+  nameLsa.addName("test2");
+
+  std::ostringstream os;
+  os << nameLsa;
+
+  BOOST_CHECK_EQUAL(os.str(), "NameLsa("
+                                "LsaInfo("
+                                  "OriginRouter: /test, "
+                                  "SequenceNumber: 128, "
+                                  "ExpirationPeriod: 10000 milliseconds), "
+                                "Name: /test1, "
+                                "Name: /test2)");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace tlv
+} // namespace nlsr
diff --git a/tests/wscript b/tests/wscript
index e7ce752..4ef346f 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -28,7 +28,7 @@
             target='unit-tests-main',
             name='unit-tests-main',
             features='cxx',
-            source=bld.path.ant_glob(['*.cpp', 'utility/*.cpp']),
+            source=bld.path.ant_glob(['*.cpp', 'utility/*.cpp', 'tlv/*.cpp']),
             use='nlsr-objects',
           )
 
