clients: add response

Change-Id: Ia906b23b52f29483aacb30dae989db1b1e98a85d
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index 2f545a4..eaf4a88 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -9,6 +9,21 @@
 -  Install the `ndn-cxx library <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`_
    and its requirements
 
+Another additional libraries include:
+-  ``log4cxx``
+
+   On OS X 10.8, 10.9 and 10.10 with MacPorts:
+
+   ::
+
+       sudo port install log4cxx
+
+   On Ubuntu >= 12.04:
+
+   ::
+
+       sudo apt-get install liblog4cxx10-dev
+
 To build manpages and API documentation:
 
 -  ``doxygen``
diff --git a/src/clients/response.cpp b/src/clients/response.cpp
new file mode 100644
index 0000000..8aba4ba
--- /dev/null
+++ b/src/clients/response.cpp
@@ -0,0 +1,237 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014, Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS 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.
+ *
+ * NDNS 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
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "response.hpp"
+#include "logger.hpp"
+
+namespace ndn {
+namespace ndns {
+
+Response::Response()
+  : m_ndnsType(NDNS_RAW)
+  , m_freshnessPeriod(DEFAULT_RR_FRESHNESS_PERIOD)
+  , m_appContent(dataBlock(ndn::tlv::Content, reinterpret_cast<const uint8_t*>(0), 0))
+{
+}
+
+Response::Response(const Name& zone, const name::Component& queryType)
+  : m_zone(zone)
+  , m_queryType(queryType)
+  , m_ndnsType(NDNS_RAW)
+  , m_freshnessPeriod(DEFAULT_RR_FRESHNESS_PERIOD)
+  , m_appContent(dataBlock(ndn::tlv::Content, reinterpret_cast<const uint8_t*>(0), 0))
+{
+}
+
+template<bool T>
+inline size_t
+Response::wireEncode(EncodingImpl<T>& block) const
+{
+  if (m_ndnsType == NDNS_RAW) {
+    // Raw application content
+    return prependBlock(block, m_appContent);
+  }
+
+  // Content :: = CONTENT-TYPE TLV-LENGTH
+  //              Block*
+
+  size_t totalLength = 0;
+  for (std::vector<Block>::const_reverse_iterator iter = m_rrs.rbegin();
+       iter != m_rrs.rend(); ++iter) {
+    totalLength += prependBlock(block, *iter);
+  }
+
+  totalLength += block.prependVarNumber(totalLength);
+  totalLength += block.prependVarNumber(::ndn::tlv::Content);
+
+  return totalLength;
+}
+
+const Block
+Response::wireEncode() const
+{
+  if (m_ndnsType == NDNS_RAW) {
+    return m_appContent;
+  }
+
+  EncodingEstimator estimator;
+  size_t estimatedSize = wireEncode(estimator);
+  EncodingBuffer buffer(estimatedSize, 0);
+  wireEncode(buffer);
+  return buffer.block();
+}
+
+void
+Response::wireDecode(const Block& wire)
+{
+  if (m_ndnsType == NDNS_RAW) {
+    m_appContent = wire;
+    return;
+  }
+
+  wire.parse();
+
+  Block::element_const_iterator iter = wire.elements().begin();
+  for (; iter != wire.elements().end(); ++iter) {
+    m_rrs.push_back(*iter);
+  }
+}
+
+bool
+Response::fromData(const Name& hint, const Name& zone, const Data& data)
+{
+  label::MatchResult re;
+  if (!matchName(data, hint, zone, re))
+    return false;
+
+  m_rrLabel = re.rrLabel;
+  m_rrType = re.rrType;
+  m_version = re.version;
+
+  m_zone = zone;
+  size_t len = zone.size();
+  if (!hint.empty())
+    len += hint.size() + 1;
+  m_queryType = data.getName().get(len);
+
+  MetaInfo info = data.getMetaInfo();
+
+  m_freshnessPeriod = time::duration_cast<time::seconds>(info.getFreshnessPeriod());
+  const Block* block = info.findAppMetaInfo(tlv::NdnsType);
+  if (block != 0)
+    m_ndnsType = static_cast<NdnsType>(readNonNegativeInteger(*block));
+
+  wireDecode(data.getContent());
+  return true;
+}
+
+
+shared_ptr<Data>
+Response::toData()
+{
+  Name name;
+  name.append(m_zone)
+      .append(m_queryType)
+      .append(m_rrLabel)
+      .append(m_rrType);
+
+  if (m_version.empty()) {
+    name.appendVersion();
+    m_version = name.get(-1);
+  }
+  else {
+    name.append(m_version);
+  }
+
+  shared_ptr<Data> data = make_shared<Data>(name);
+
+  MetaInfo info;
+  info.setFreshnessPeriod(m_freshnessPeriod);
+
+  if (m_ndnsType != NDNS_RAW) {
+    info.addAppMetaInfo(nonNegativeIntegerBlock(ndns::tlv::NdnsType, m_ndnsType));
+    data->setContent(this->wireEncode());
+  }
+  else {
+    data->setContent(m_appContent);
+  }
+  data->setMetaInfo(info);
+
+  return data;
+}
+
+
+Response&
+Response::addRr(const Block& rr)
+{
+  this->m_rrs.push_back(rr);
+  return *this;
+}
+
+Response&
+Response::addRr(const std::string& rr)
+{
+  return this->addRr(dataBlock(ndns::tlv::RrData, rr.c_str(), rr.size()));
+}
+
+bool
+Response::removeRr(const Block& rr)
+{
+  for (std::vector<Block>::iterator iter = m_rrs.begin(); iter != m_rrs.end(); ++iter) {
+    if (*iter == rr) {
+      m_rrs.erase(iter);
+      return true;
+    }
+  }
+  return false;
+}
+
+void
+Response::setAppContent(const Block& block)
+{
+  if (block.type() != ndn::tlv::Content) {
+    m_appContent = Block(ndn::tlv::Content, block);
+  } else
+    m_appContent = block;
+
+  m_appContent.encode(); // this is a must
+}
+
+
+bool
+Response::operator==(const Response& other) const
+{
+  bool tmp = (getZone() == other.getZone() &&
+              getQueryType() == other.getQueryType() && getRrLabel() == other.getRrLabel() &&
+              getRrType() == other.getRrType() && getVersion() == other.getVersion() &&
+              getNdnsType() == other.getNdnsType());
+
+  if (tmp == false)
+    return tmp;
+
+  if (m_ndnsType == NDNS_RAW) {
+    return tmp && (getAppContent() == other.getAppContent());
+  }
+  else
+    return tmp && getRrs() == other.getRrs();
+}
+
+std::ostream&
+operator<<(std::ostream& os, const Response& response)
+{
+  os << "Response: zone=" << response.getZone()
+     << " queryType=" << response.getQueryType()
+     << " rrLabel=" << response.getRrLabel()
+     << " rrType=" << response.getRrType()
+     << " version=" << response.getVersion()
+     << " freshnessPeriod=" << response.getFreshnessPeriod()
+     << " ndnsType=" << response.getNdnsType();
+  if (response.getNdnsType() == NDNS_RAW) {
+    if (response.getAppContent().empty())
+      os << " appContent=NULL";
+    else
+      os << " appContentSize=" << response.getAppContent().size();
+  }
+  else {
+    os << " rrs.size=" << response.getRrs().size();
+  }
+  return os;
+}
+} // namespace ndns
+} // namespace ndn
diff --git a/src/clients/response.hpp b/src/clients/response.hpp
new file mode 100644
index 0000000..fc49846
--- /dev/null
+++ b/src/clients/response.hpp
@@ -0,0 +1,264 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014, Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS 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.
+ *
+ * NDNS 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
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDNS_CLIENTS_RESPONSE_HPP
+#define NDNS_CLIENTS_RESPONSE_HPP
+
+#include "ndns-tlv.hpp"
+#include "ndns-enum.hpp"
+#include "ndns-label.hpp"
+
+
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/data.hpp>
+#include <ndn-cxx/encoding/block-helpers.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/meta-info.hpp>
+
+#include <vector>
+
+namespace ndn {
+namespace ndns {
+
+/**
+ * @brief content when update succeeds
+ */
+const Block UPDATE_OK = dataBlock(ndn::tlv::Content, "Update OK", 9);
+
+/**
+ * @brief content when update fails because of the out-dated update message
+ */
+const Block UPDATE_FAIL_OLD_VERSION = dataBlock(ndn::tlv::Content,
+                                                "Update Fails. Error: old version update", 39);
+
+/**
+ * @brief string prefix to judge Update fails or not
+ */
+const std::string UPDATE_FAIL("Update Fails. Error: ");
+
+/**
+ *@brief Default life time of resource record
+ */
+const time::seconds DEFAULT_RR_FRESHNESS_PERIOD(3600);
+
+
+/**
+ * @brief NDNS Response abstraction. Response is used on client side,
+ * while Rrset is used on server side, and Data packet is used during transmission in network.
+ */
+class Response
+{
+public:
+  Response();
+
+  Response(const Name& zone, const name::Component& queryType);
+
+  /**
+   * @brief fill the attributes from Data packet.
+   * @param[in] data Data.getName() must the same hint (if has) and zone as its prefix,
+   * otherwise it's undefined behavior
+   * @return false if Data.getName() does not follow the structure of NDNS Response without
+   * changing any attributes, otherwise return true and fill the attributes
+   */
+  bool
+  fromData(const Name& hint, const Name& zone, const Data& data);
+
+  shared_ptr<Data>
+  toData();
+
+  Response&
+  addRr(const Block& rr);
+
+  /**
+   * @brief add Block which contains string information and its tlv type is ndns::tlv::RrData
+   * Response is service level information, the encoding level abstraction,
+   * i.e., Block is not very convenient.
+   */
+  Response&
+  addRr(const std::string& rr);
+
+  bool
+  removeRr(const Block& rr);
+
+  bool
+  operator==(const Response& other) const;
+
+  bool
+  operator!=(const Response& other) const
+  {
+    return !(*this == other);
+  }
+
+  /**
+   * @brief encode the app-level data
+   */
+  const Block
+  wireEncode() const;
+
+  /**
+   * @brief decode the app-level data
+   */
+  void
+  wireDecode(const Block& wire);
+
+  /**
+   * @brief encode app-level data
+   */
+  template<bool T>
+  size_t
+  wireEncode(EncodingImpl<T> & block) const;
+
+public:
+  ///////////////////////////////////////////////
+  // getter and setter
+
+  const Name&
+  getZone() const
+  {
+    return m_zone;
+  }
+
+  void
+  setZone(const Name& zone)
+  {
+    m_zone = zone;
+  }
+
+  const name::Component&
+  getQueryType() const
+  {
+    return m_queryType;
+  }
+
+  void
+  setQueryType(const name::Component& queryType)
+  {
+    m_queryType = queryType;
+  }
+
+  const Name&
+  getRrLabel() const
+  {
+    return m_rrLabel;
+  }
+
+  void
+  setRrLabel(const Name& rrLabel)
+  {
+    m_rrLabel = rrLabel;
+  }
+
+  void
+  setRrType(const name::Component& rrType)
+  {
+    m_rrType = rrType;
+  }
+
+  const name::Component&
+  getRrType() const
+  {
+    return m_rrType;
+  }
+
+  void
+  setVersion(const name::Component& version)
+  {
+    m_version = version;
+  }
+
+  const name::Component&
+  getVersion() const
+  {
+    return m_version;
+  }
+
+  void
+  setNdnsType(NdnsType ndnsType)
+  {
+    m_ndnsType = ndnsType;
+  }
+
+  const NdnsType
+  getNdnsType() const
+  {
+    return m_ndnsType;
+  }
+
+  const Block&
+  getAppContent() const
+  {
+    return m_appContent;
+  }
+
+  void
+  setAppContent(const Block& block);
+
+  const std::vector<Block>&
+  getRrs() const
+  {
+    return m_rrs;
+  }
+
+  void
+  setRrs(const std::vector<Block>& rrs)
+  {
+    m_rrs = rrs;
+  }
+
+  time::seconds
+  getFreshnessPeriod() const
+  {
+    return m_freshnessPeriod;
+  }
+
+  void
+  setFreshnessPeriod(time::seconds freshnessPeriod)
+  {
+    m_freshnessPeriod = freshnessPeriod;
+  }
+
+private:
+  Name m_zone;
+  name::Component m_queryType;
+  Name m_rrLabel;
+  name::Component m_rrType;
+  name::Component m_version;
+
+  NdnsType m_ndnsType;
+  time::seconds m_freshnessPeriod;
+
+  /**
+   * @brief App content. Be valid only for NDNS-NULL Response
+   */
+  Block m_appContent;
+
+  /**
+   * @brief Content of Resource Record. Be valid only when this is not a NDNS-NULL Response
+   */
+  std::vector<Block> m_rrs;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const Response& response);
+
+} // namespace ndns
+} // namespace ndn
+
+#endif // NDNS_CLIENTS_RESPONSE_HPP
diff --git a/src/ndns-enum.cpp b/src/ndns-enum.cpp
index 2631e38..45504fb 100644
--- a/src/ndns-enum.cpp
+++ b/src/ndns-enum.cpp
@@ -22,21 +22,27 @@
 namespace ndn {
 namespace ndns {
 
-std::string
-toString(NdnsType ndnsType)
+std::ostream&
+operator<<(std::ostream& os, const NdnsType ndnsType)
 {
   switch (ndnsType) {
   case NDNS_RESP:
-    return "NDNS-Resp";
+    os << "NDNS-Resp";
+    break;
   case NDNS_NACK:
-    return "NDNS-Nack";
+    os << "NDNS-Nack";
+    break;
   case NDNS_AUTH:
-    return "NDNS-Auth";
+    os << "NDNS-Auth";
+    break;
   case NDNS_RAW:
-    return "NDNS-Raw";
+    os << "NDNS-Raw";
+    break;
   default:
-    return "UNKNOWN";
+    os << "UNKNOWN";
+    break;
   }
+  return os;
 }
 
 } // namespace ndns
diff --git a/src/ndns-enum.hpp b/src/ndns-enum.hpp
index 617be9c..be48bd1 100644
--- a/src/ndns-enum.hpp
+++ b/src/ndns-enum.hpp
@@ -20,7 +20,7 @@
 #ifndef NDNS_NDNS_ENUM_HPP
 #define NDNS_NDNS_ENUM_HPP
 
-#include <string>
+#include <ostream>
 
 namespace ndn {
 namespace ndns {
@@ -37,11 +37,8 @@
   NDNS_UNKNOWN = 255
 };
 
-/*
- * @brief convert the ResponseType to String
- */
-std::string
-toString(NdnsType ndnsType);
+std::ostream&
+operator<<(std::ostream& os, const NdnsType ndnsType);
 
 } // namespace ndns
 } // namespace ndn
diff --git a/src/ndns-label.cpp b/src/ndns-label.cpp
index 6d0d1ae..585509c 100644
--- a/src/ndns-label.cpp
+++ b/src/ndns-label.cpp
@@ -37,7 +37,7 @@
     BOOST_ASSERT(name.size() > skip);
 
     BOOST_ASSERT(name.getPrefix(hint.size()) == hint);
-    BOOST_ASSERT(name.get(hint.size()) == ForwardingHintLabel);
+    BOOST_ASSERT(name.get(hint.size()) == FORWARDING_HINT_LABEL);
     BOOST_ASSERT(name.getSubName(hint.size() + 1, zone.size()) == zone);
 
   }
@@ -47,8 +47,8 @@
     BOOST_ASSERT(name.getPrefix(zone.size()) == zone);
   }
 
-  BOOST_ASSERT(name.get(skip) == NdnsIterativeQuery ||
-               name.get(skip) == NdnsCertQuery);
+  BOOST_ASSERT(name.get(skip) == NDNS_ITERATIVE_QUERY ||
+               name.get(skip) == NDNS_CERT_QUERY);
 
   ++skip;
   return skip;
diff --git a/src/ndns-label.hpp b/src/ndns-label.hpp
index accab00..6641eca 100644
--- a/src/ndns-label.hpp
+++ b/src/ndns-label.hpp
@@ -31,21 +31,22 @@
 namespace ndns {
 namespace label {
 
+
 /**
  * @brief NDNS iterative query type
  */
 
-const name::Component NdnsIterativeQuery("NDNS");
+const name::Component NDNS_ITERATIVE_QUERY("NDNS");
 
 /**
  * @brief NDNS recursive query type
  */
-const name::Component NdnsRecursiveQuery("NDNS-R");
+const name::Component NDNS_RECURSIVE_QUERY("NDNS-R");
 
 /**
  * @brief NDNS ID-CERT query type
  */
-const name::Component NdnsCertQuery("KEY");
+const name::Component NDNS_CERT_QUERY("KEY");
 
 /////////////////////////////////////////////
 
@@ -53,24 +54,31 @@
  * @brief label of forwarding hint
  * @todo not support forwarding hint yet, for future use
  */
-const name::Component ForwardingHintLabel("\xF0.");
+const name::Component FORWARDING_HINT_LABEL("\xF0.");
 
 /**
  * @brief label of update message, located at the last component in Interest name
  */
-const name::Component NdnsUpdateLabel("UPDATE");
+const name::Component NDNS_UPDATE_LABEL("UPDATE");
+
 
 //////////////////////////////////////////////
 
 /**
  * @brief NS resource record type
  */
-const name::Component NsRrType("NS");
+const name::Component NS_RR_TYPE("NS");
 
 /**
  * @brief ID-CERT resource record type
  */
-const name::Component CertRrType("ID-CERT");
+const name::Component CERT_RR_TYPE("ID-CERT");
+
+/**
+ * @brief TXT resource record type
+ */
+const name::Component TXT_RR_TYPE("TXT");
+
 
 //////////////////////////////////////////
 
@@ -97,8 +105,8 @@
  */
 bool
 matchName(const Interest& interest,
-           const Name& hint, const Name& zone,
-           MatchResult& result);
+          const Name& hint, const Name& zone,
+          MatchResult& result);
 
 /**
  * @brief match the Data (NDNS query response, NDNS update response) name
@@ -116,6 +124,7 @@
           const Name& hint, const Name& zone,
           MatchResult& result);
 
+
 } // namespace label
 } // namespace ndns
 } // namespace ndn
diff --git a/src/ndns-tlv.hpp b/src/ndns-tlv.hpp
index 7c48920..3575ab0 100644
--- a/src/ndns-tlv.hpp
+++ b/src/ndns-tlv.hpp
@@ -31,8 +31,8 @@
  */
 enum {
   NdnsType = 180, ///< Detailed Types are defined in NdnsType in ndns-enum.hpp
-  RrType = 190,
-  RrDataType = 191
+  Rr = 190,
+  RrData = 191
 };
 
 } // namespace tlv
diff --git a/tests/unit/clients/response.cpp b/tests/unit/clients/response.cpp
new file mode 100644
index 0000000..b1a82be
--- /dev/null
+++ b/tests/unit/clients/response.cpp
@@ -0,0 +1,90 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014, Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS 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.
+ *
+ * NDNS 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
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "clients/response.hpp"
+#include <ndn-cxx/security/key-chain.hpp>
+#include "../../boost-test.hpp"
+
+namespace ndn {
+namespace ndns {
+namespace tests {
+
+
+
+BOOST_AUTO_TEST_SUITE(Response)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  KeyChain keyChain;
+  Name hint;
+  Name zone("/net");
+  name::Component qType = ndns::label::NDNS_ITERATIVE_QUERY;
+
+
+  ndns::Response r(zone, qType);
+  r.setRrLabel(Name("/ndnsim/www"));
+  r.setRrType(label::CERT_RR_TYPE);
+  r.setNdnsType(NDNS_RAW);
+  r.setFreshnessPeriod(time::seconds(4000));
+
+  BOOST_CHECK_EQUAL(r.getFreshnessPeriod(), time::seconds(4000));
+  BOOST_CHECK_EQUAL(r.getRrType(), label::CERT_RR_TYPE);
+  BOOST_CHECK_EQUAL(r.getNdnsType(), NDNS_RAW);
+  BOOST_CHECK_EQUAL(r.getZone(), zone);
+  BOOST_CHECK_EQUAL(r.getQueryType(), qType);
+
+  const std::string DATA1("some fake content");
+  r.setAppContent(dataBlock(ndn::tlv::Content, DATA1.c_str(), DATA1.size()));
+
+  //const Block& block = r.wireEncode();
+  shared_ptr<Data> data = r.toData();
+  // keyChain.sign(*data);
+
+  ndns::Response r2;
+  BOOST_CHECK_EQUAL(r2.fromData(hint, zone, *data), true);
+  BOOST_CHECK_EQUAL(r, r2);
+
+  ndns::Response r4(zone, qType);
+  r4.setRrLabel(Name("/ndnsim/www"));
+  r4.setRrType(label::TXT_RR_TYPE);
+  r4.setNdnsType(NDNS_RESP);
+
+  std::string str = "Just try it";
+  Block s = dataBlock(ndns::tlv::RrData, str.c_str(), str.size());
+  r4.addRr(s);
+  str = "Go to Hell";
+  // Block s2 = dataBlock(ndns::tlv::RrData, str.c_str(), str.size());
+  r4.addRr(str);
+
+  BOOST_CHECK_NE(r2, r4);
+
+  data = r4.toData();
+  // keyChain.sign(*data);
+
+  ndns::Response r5(zone, qType);
+
+  BOOST_CHECK_EQUAL(r5.fromData(hint, zone, *data), true);
+  BOOST_CHECK_EQUAL(r4, r5);
+ }
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace ndns
+} // namespace ndn
diff --git a/tests/unit/ndns-enum.cpp b/tests/unit/ndns-enum.cpp
deleted file mode 100644
index 7559448..0000000
--- a/tests/unit/ndns-enum.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014, Regents of the University of California.
- *
- * This file is part of NDNS (Named Data Networking Domain Name Service).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
- *
- * NDNS 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.
- *
- * NDNS 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
- * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ndns-enum.hpp"
-#include "../boost-test.hpp"
-
-namespace ndn {
-namespace ndns {
-namespace tests {
-
-BOOST_AUTO_TEST_SUITE(NdnsEnum)
-
-BOOST_AUTO_TEST_CASE(NdnsTypeToString)
-{
-  BOOST_CHECK_EQUAL(toString(NDNS_RESP), "NDNS-Resp");
-  BOOST_CHECK_EQUAL(toString(NDNS_AUTH), "NDNS-Auth");
-  BOOST_CHECK_EQUAL(toString(NDNS_NACK), "NDNS-Nack");
-  BOOST_CHECK_EQUAL(toString(NDNS_RAW), "NDNS-Raw");
-
-  BOOST_CHECK_EQUAL(toString(static_cast<NdnsType>(254)), "UNKNOWN");
-  BOOST_CHECK_EQUAL(toString(static_cast<NdnsType>(255)), "UNKNOWN");
-  BOOST_CHECK_EQUAL(toString(static_cast<NdnsType>(256)), "UNKNOWN");
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace ndns
-} // namespace ndn