net: move network-related files to src/net

Some namespaces are changed:

* ndn::util::FaceUri is now ndn::FaceUri
* ndn::util::ethernet is now ndn::ethernet
* ndn::util::NetworkMonitor and related classes are now in ndn::net

refs #3940

Change-Id: Ia4754caef9726efc73f5a303cec46fc95c744d70
diff --git a/src/face.cpp b/src/face.cpp
index c77d3e0..1521788 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -23,10 +23,10 @@
 #include "detail/face-impl.hpp"
 
 #include "encoding/tlv.hpp"
+#include "net/face-uri.hpp"
 #include "security/signing-helpers.hpp"
 #include "util/time.hpp"
 #include "util/random.hpp"
-#include "util/face-uri.hpp"
 
 // A callback scheduled through io.post and io.dispatch may be invoked after the face
 // is destructed. To prevent this situation, these macros captures Face::m_impl as weak_ptr,
@@ -117,7 +117,7 @@
 
   std::string protocol;
   try {
-    util::FaceUri uri(transportUri);
+    FaceUri uri(transportUri);
     protocol = uri.getScheme();
 
     if (protocol == "unix") {
@@ -133,7 +133,7 @@
   catch (const Transport::Error& error) {
     BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
   }
-  catch (const util::FaceUri::Error& error) {
+  catch (const FaceUri::Error& error) {
     BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
   }
 }
diff --git a/src/util/detail/link-type-helper-osx.mm b/src/net/detail/link-type-helper-osx.mm
similarity index 97%
rename from src/util/detail/link-type-helper-osx.mm
rename to src/net/detail/link-type-helper-osx.mm
index 200adff..c45fa04 100644
--- a/src/util/detail/link-type-helper-osx.mm
+++ b/src/net/detail/link-type-helper-osx.mm
@@ -31,7 +31,7 @@
 #import <CoreWLAN/CWWiFiClient.h>
 
 namespace ndn {
-namespace util {
+namespace net {
 namespace detail {
 
 ndn::nfd::LinkType
@@ -61,5 +61,5 @@
 }
 
 } // namespace detail
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/src/util/detail/link-type-helper.cpp b/src/net/detail/link-type-helper.cpp
similarity index 97%
rename from src/util/detail/link-type-helper.cpp
rename to src/net/detail/link-type-helper.cpp
index a25fd27..36d51de 100644
--- a/src/util/detail/link-type-helper.cpp
+++ b/src/net/detail/link-type-helper.cpp
@@ -27,7 +27,7 @@
 #else
 
 namespace ndn {
-namespace util {
+namespace net {
 namespace detail {
 
 ndn::nfd::LinkType
@@ -37,7 +37,7 @@
 }
 
 } // namespace detail
-} // namespace util
+} // namespace net
 } // namespace ndn
 
 #endif // NDN_CXX_HAVE_OSX_FRAMEWORKS
diff --git a/src/util/detail/link-type-helper.hpp b/src/net/detail/link-type-helper.hpp
similarity index 87%
rename from src/util/detail/link-type-helper.hpp
rename to src/net/detail/link-type-helper.hpp
index c6e402f..9512f31 100644
--- a/src/util/detail/link-type-helper.hpp
+++ b/src/net/detail/link-type-helper.hpp
@@ -19,13 +19,13 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_DETAIL_LINK_TYPE_HELPER_HPP
-#define NDN_UTIL_DETAIL_LINK_TYPE_HELPER_HPP
+#ifndef NDN_NET_DETAIL_LINK_TYPE_HELPER_HPP
+#define NDN_NET_DETAIL_LINK_TYPE_HELPER_HPP
 
 #include "../../encoding/nfd-constants.hpp"
 
 namespace ndn {
-namespace util {
+namespace net {
 namespace detail {
 
 /**
@@ -35,7 +35,7 @@
 getLinkType(const std::string& ifName);
 
 } // namespace detail
-} // namespace util
+} // namespace net
 } // namespace ndn
 
-#endif // NDN_UTIL_DETAIL_LINK_TYPE_HELPER_HPP
+#endif // NDN_NET_DETAIL_LINK_TYPE_HELPER_HPP
diff --git a/src/util/detail/linux-if-constants.cpp b/src/net/detail/linux-if-constants.cpp
similarity index 97%
rename from src/util/detail/linux-if-constants.cpp
rename to src/net/detail/linux-if-constants.cpp
index c50fa50..dbcf54b 100644
--- a/src/util/detail/linux-if-constants.cpp
+++ b/src/net/detail/linux-if-constants.cpp
@@ -29,7 +29,7 @@
 #include <linux/if.h>
 
 namespace ndn {
-namespace util {
+namespace net {
 namespace linux_if {
 
 const uint32_t FLAG_LOWER_UP = IFF_LOWER_UP;
@@ -45,7 +45,7 @@
 const uint8_t OPER_STATE_UP             = IF_OPER_UP;
 
 } // namespace linux_if
-} // namespace util
+} // namespace net
 } // namespace ndn
 
 #endif // __linux__
diff --git a/src/util/detail/linux-if-constants.hpp b/src/net/detail/linux-if-constants.hpp
similarity index 92%
rename from src/util/detail/linux-if-constants.hpp
rename to src/net/detail/linux-if-constants.hpp
index 29e7115..0670e70 100644
--- a/src/util/detail/linux-if-constants.hpp
+++ b/src/net/detail/linux-if-constants.hpp
@@ -21,14 +21,14 @@
  * @author Davide Pesavento <davide.pesavento@lip6.fr>
  */
 
-#ifndef NDN_UTIL_LINUX_IF_CONSTANTS_HPP
-#define NDN_UTIL_LINUX_IF_CONSTANTS_HPP
+#ifndef NDN_NET_LINUX_IF_CONSTANTS_HPP
+#define NDN_NET_LINUX_IF_CONSTANTS_HPP
 #ifdef __linux__
 
 #include <cstdint>
 
 namespace ndn {
-namespace util {
+namespace net {
 namespace linux_if {
 
 // linux/if.h and net/if.h cannot be (directly or indirectly) included in the
@@ -51,8 +51,8 @@
 extern const uint8_t OPER_STATE_UP;
 
 } // namespace linux_if
-} // namespace util
+} // namespace net
 } // namespace ndn
 
 #endif // __linux__
-#endif // NDN_UTIL_LINUX_IF_CONSTANTS_HPP
+#endif // NDN_NET_LINUX_IF_CONSTANTS_HPP
diff --git a/src/util/detail/network-monitor-impl-noop.hpp b/src/net/detail/network-monitor-impl-noop.hpp
similarity index 89%
rename from src/util/detail/network-monitor-impl-noop.hpp
rename to src/net/detail/network-monitor-impl-noop.hpp
index 944e219..f0c5fb0 100644
--- a/src/util/detail/network-monitor-impl-noop.hpp
+++ b/src/net/detail/network-monitor-impl-noop.hpp
@@ -21,13 +21,13 @@
  * @author Davide Pesavento <davide.pesavento@lip6.fr>
  */
 
-#ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_NOOP_HPP
-#define NDN_UTIL_NETWORK_MONITOR_IMPL_NOOP_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_IMPL_NOOP_HPP
+#define NDN_NET_NETWORK_MONITOR_IMPL_NOOP_HPP
 
 #include "../network-monitor.hpp"
 
 namespace ndn {
-namespace util {
+namespace net {
 
 class NetworkMonitor::Impl
 {
@@ -55,7 +55,7 @@
   }
 };
 
-} // namespace util
+} // namespace net
 } // namespace ndn
 
-#endif // NDN_UTIL_NETWORK_MONITOR_IMPL_NOOP_HPP
+#endif // NDN_NET_NETWORK_MONITOR_IMPL_NOOP_HPP
diff --git a/src/util/detail/network-monitor-impl-osx.cpp b/src/net/detail/network-monitor-impl-osx.cpp
similarity index 99%
rename from src/util/detail/network-monitor-impl-osx.cpp
rename to src/net/detail/network-monitor-impl-osx.cpp
index 4824bab..97f3e7c 100644
--- a/src/util/detail/network-monitor-impl-osx.cpp
+++ b/src/net/detail/network-monitor-impl-osx.cpp
@@ -54,7 +54,7 @@
 
 #include "network-monitor-impl-osx.hpp"
 #include "../../name.hpp"
-#include "../logger.hpp"
+#include "../../util/logger.hpp"
 #include "../network-address.hpp"
 
 #include <ifaddrs.h>       // for getifaddrs()
@@ -66,7 +66,7 @@
 #include <boost/asio.hpp>
 
 namespace ndn {
-namespace util {
+namespace net {
 
 NDN_LOG_INIT(ndn.NetworkMonitor);
 
@@ -449,5 +449,5 @@
   }
 }
 
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/src/util/detail/network-monitor-impl-osx.hpp b/src/net/detail/network-monitor-impl-osx.hpp
similarity index 89%
rename from src/util/detail/network-monitor-impl-osx.hpp
rename to src/net/detail/network-monitor-impl-osx.hpp
index 52c3468..3aac23f 100644
--- a/src/util/detail/network-monitor-impl-osx.hpp
+++ b/src/net/detail/network-monitor-impl-osx.hpp
@@ -19,8 +19,8 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
-#define NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
+#define NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
 
 #include "ndn-cxx-config.hpp"
 #include "../network-monitor.hpp"
@@ -30,9 +30,9 @@
 #endif
 
 #include "../network-interface.hpp"
-#include "../scheduler.hpp"
-#include "../scheduler-scoped-event-id.hpp"
 #include "../../security/tpm/helper-osx.hpp"
+#include "../../util/scheduler.hpp"
+#include "../../util/scheduler-scoped-event-id.hpp"
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <SystemConfiguration/SystemConfiguration.h>
@@ -40,7 +40,7 @@
 #include <boost/asio/ip/udp.hpp>
 
 namespace ndn {
-namespace util {
+namespace net {
 
 class NetworkMonitor::Impl
 {
@@ -104,8 +104,8 @@
   NetworkMonitor& m_nm;
   std::map<std::string /*ifname*/, shared_ptr<NetworkInterface>> m_interfaces; ///< interface map
 
-  Scheduler m_scheduler;
-  scheduler::ScopedEventId m_cfLoopEvent;
+  util::Scheduler m_scheduler;
+  util::scheduler::ScopedEventId m_cfLoopEvent;
 
   SCDynamicStoreContext m_context;
   CFReleaser<SCDynamicStoreRef> m_scStore;
@@ -114,7 +114,7 @@
   boost::asio::ip::udp::socket m_nullUdpSocket;
 };
 
-} // namespace util
+} // namespace net
 } // namespace ndn
 
-#endif // NDN_UTIL_NETWORK_MONITOR_IMPL_OSX_HPP
+#endif // NDN_NET_NETWORK_MONITOR_IMPL_OSX_HPP
diff --git a/src/util/detail/network-monitor-impl-rtnl.cpp b/src/net/detail/network-monitor-impl-rtnl.cpp
similarity index 99%
rename from src/util/detail/network-monitor-impl-rtnl.cpp
rename to src/net/detail/network-monitor-impl-rtnl.cpp
index 587bc90..1a05986 100644
--- a/src/util/detail/network-monitor-impl-rtnl.cpp
+++ b/src/net/detail/network-monitor-impl-rtnl.cpp
@@ -23,10 +23,10 @@
 
 #include "network-monitor-impl-rtnl.hpp"
 #include "linux-if-constants.hpp"
-#include "../logger.hpp"
 #include "../network-address.hpp"
 #include "../network-interface.hpp"
-#include "../time.hpp"
+#include "../../util/logger.hpp"
+#include "../../util/time.hpp"
 
 #include <boost/asio/write.hpp>
 
@@ -38,7 +38,7 @@
 NDN_LOG_INIT(ndn.NetworkMonitor);
 
 namespace ndn {
-namespace util {
+namespace net {
 
 NetworkMonitor::Impl::Impl(NetworkMonitor& nm, boost::asio::io_service& io)
   : m_nm(nm)
@@ -506,5 +506,5 @@
   }
 }
 
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/src/util/detail/network-monitor-impl-rtnl.hpp b/src/net/detail/network-monitor-impl-rtnl.hpp
similarity index 94%
rename from src/util/detail/network-monitor-impl-rtnl.hpp
rename to src/net/detail/network-monitor-impl-rtnl.hpp
index db31f61..d43abce 100644
--- a/src/util/detail/network-monitor-impl-rtnl.hpp
+++ b/src/net/detail/network-monitor-impl-rtnl.hpp
@@ -21,8 +21,8 @@
  * @author Davide Pesavento <davide.pesavento@lip6.fr>
  */
 
-#ifndef NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
-#define NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_IMPL_RTNL_HPP
+#define NDN_NET_NETWORK_MONITOR_IMPL_RTNL_HPP
 
 #include "ndn-cxx-config.hpp"
 #include "../network-monitor.hpp"
@@ -42,7 +42,7 @@
 #include <linux/if_link.h>
 
 namespace ndn {
-namespace util {
+namespace net {
 
 class NetworkMonitor::Impl
 {
@@ -120,7 +120,7 @@
   bool m_isEnumeratingAddresses; ///< true if a dump of all addresses is in progress
 };
 
-} // namespace util
+} // namespace net
 } // namespace ndn
 
-#endif // NDN_UTIL_NETWORK_MONITOR_IMPL_RTNL_HPP
+#endif // NDN_NET_NETWORK_MONITOR_IMPL_RTNL_HPP
diff --git a/src/util/dns.cpp b/src/net/dns.cpp
similarity index 97%
rename from src/util/dns.cpp
rename to src/net/dns.cpp
index 73fd8b1..0043ec9 100644
--- a/src/util/dns.cpp
+++ b/src/net/dns.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -20,7 +20,7 @@
  */
 
 #include "dns.hpp"
-#include "scheduler.hpp"
+#include "../util/scheduler.hpp"
 
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/ip/udp.hpp>
diff --git a/src/util/dns.hpp b/src/net/dns.hpp
similarity index 95%
rename from src/util/dns.hpp
rename to src/net/dns.hpp
index fec923b..79d9a10 100644
--- a/src/util/dns.hpp
+++ b/src/net/dns.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,8 +19,8 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_DNS_HPP
-#define NDN_UTIL_DNS_HPP
+#ifndef NDN_NET_DNS_HPP
+#define NDN_NET_DNS_HPP
 
 #include "../util/time.hpp"
 
@@ -121,4 +121,4 @@
 } // namespace dns
 } // namespace ndn
 
-#endif // NDN_UTIL_DNS_HPP
+#endif // NDN_NET_DNS_HPP
diff --git a/src/util/ethernet.cpp b/src/net/ethernet.cpp
similarity index 96%
rename from src/util/ethernet.cpp
rename to src/net/ethernet.cpp
index e9160d9..0efdd58 100644
--- a/src/util/ethernet.cpp
+++ b/src/net/ethernet.cpp
@@ -33,7 +33,6 @@
 #include <ostream>
 
 namespace ndn {
-namespace util {
 namespace ethernet {
 
 Address::Address()
@@ -139,11 +138,10 @@
 }
 
 } // namespace ethernet
-} // namespace util
 } // namespace ndn
 
 std::size_t
-std::hash<ndn::util::ethernet::Address>::operator()(const ndn::util::ethernet::Address& a) const noexcept
+std::hash<ndn::ethernet::Address>::operator()(const ndn::ethernet::Address& a) const noexcept
 {
   return boost::hash_range(a.cbegin(), a.cend());
 }
diff --git a/src/util/ethernet.hpp b/src/net/ethernet.hpp
similarity index 84%
rename from src/util/ethernet.hpp
rename to src/net/ethernet.hpp
index 30a2b8d..d4b8f47 100644
--- a/src/util/ethernet.hpp
+++ b/src/net/ethernet.hpp
@@ -1,12 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014 Regents of the University of California,
- *                    Arizona Board of Regents,
- *                    Colorado State University,
- *                    University Pierre & Marie Curie, Sorbonne University,
- *                    Washington University in St. Louis,
- *                    Beijing Institute of Technology,
- *                    The University of Memphis.
+ * Copyright (c) 2014-2017 Regents of the University of California,
+ *                         Arizona Board of Regents,
+ *                         Colorado State University,
+ *                         University Pierre & Marie Curie, Sorbonne University,
+ *                         Washington University in St. Louis,
+ *                         Beijing Institute of Technology,
+ *                         The University of Memphis.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -25,8 +25,8 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_ETHERNET_HPP
-#define NDN_UTIL_ETHERNET_HPP
+#ifndef NDN_NET_ETHERNET_HPP
+#define NDN_NET_ETHERNET_HPP
 
 #include <array>
 #include <cstdint>
@@ -34,7 +34,6 @@
 #include <string>
 
 namespace ndn {
-namespace util {
 namespace ethernet {
 
 const uint16_t ETHERTYPE_NDN = 0x8624;
@@ -109,19 +108,18 @@
 operator<<(std::ostream& o, const Address& a);
 
 } // namespace ethernet
-} // namespace util
 } // namespace ndn
 
 namespace std {
 
 // specialize std::hash<> for ethernet::Address
 template<>
-struct hash<ndn::util::ethernet::Address>
+struct hash<ndn::ethernet::Address>
 {
   size_t
-  operator()(const ndn::util::ethernet::Address& a) const noexcept;
+  operator()(const ndn::ethernet::Address& a) const noexcept;
 };
 
 } // namespace std
 
-#endif // NDN_UTIL_ETHERNET_HPP
+#endif // NDN_NET_ETHERNET_HPP
diff --git a/src/util/face-uri.cpp b/src/net/face-uri.cpp
similarity index 99%
rename from src/util/face-uri.cpp
rename to src/net/face-uri.cpp
index d1a26df..d550fd5 100644
--- a/src/util/face-uri.cpp
+++ b/src/net/face-uri.cpp
@@ -27,7 +27,6 @@
 
 #include "face-uri.hpp"
 #include "dns.hpp"
-#include "ethernet.hpp"
 
 #include <boost/lexical_cast.hpp>
 #include <boost/mpl/vector.hpp>
@@ -36,7 +35,6 @@
 #include <set>
 
 namespace ndn {
-namespace util {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
 
@@ -621,5 +619,4 @@
                io, timeout);
 }
 
-} // namespace util
 } // namespace ndn
diff --git a/src/util/face-uri.hpp b/src/net/face-uri.hpp
similarity index 95%
rename from src/util/face-uri.hpp
rename to src/net/face-uri.hpp
index 09c8aaf..12276cd 100644
--- a/src/util/face-uri.hpp
+++ b/src/net/face-uri.hpp
@@ -25,22 +25,17 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_UTIL_FACE_URI_HPP
-#define NDN_UTIL_FACE_URI_HPP
+#ifndef NDN_NET_FACE_URI_HPP
+#define NDN_NET_FACE_URI_HPP
 
-#include "../common.hpp"
-#include "time.hpp"
+#include "ethernet.hpp"
+#include "../util/time.hpp"
 
 #include <boost/asio/ip/tcp.hpp>
 #include <boost/asio/ip/udp.hpp>
 #include <boost/asio/local/stream_protocol.hpp>
 
 namespace ndn {
-namespace util {
-
-namespace ethernet {
-class Address;
-} // namespace ethernet
 
 /** \brief represents the underlying protocol and address used by a Face
  *  \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#FaceUri
@@ -197,7 +192,6 @@
 std::ostream&
 operator<<(std::ostream& os, const FaceUri& uri);
 
-} // namespace util
 } // namespace ndn
 
-#endif // NDN_UTIL_FACE_URI_HPP
+#endif // NDN_NET_FACE_URI_HPP
diff --git a/src/util/network-address.cpp b/src/net/network-address.cpp
similarity index 97%
rename from src/util/network-address.cpp
rename to src/net/network-address.cpp
index 5744aba..148c3ec 100644
--- a/src/util/network-address.cpp
+++ b/src/net/network-address.cpp
@@ -24,7 +24,7 @@
 #include "network-address.hpp"
 
 namespace ndn {
-namespace util {
+namespace net {
 
 std::ostream&
 operator<<(std::ostream& os, AddressScope scope)
@@ -56,5 +56,5 @@
   return os << addr.getIp() << '/' << static_cast<unsigned int>(addr.getPrefixLength());
 }
 
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/src/util/network-address.hpp b/src/net/network-address.hpp
similarity index 94%
rename from src/util/network-address.hpp
rename to src/net/network-address.hpp
index fd39782..632a30f 100644
--- a/src/util/network-address.hpp
+++ b/src/net/network-address.hpp
@@ -21,15 +21,15 @@
  * @author Davide Pesavento <davide.pesavento@lip6.fr>
  */
 
-#ifndef NDN_UTIL_NETWORK_ADDRESS_HPP
-#define NDN_UTIL_NETWORK_ADDRESS_HPP
+#ifndef NDN_NET_NETWORK_ADDRESS_HPP
+#define NDN_NET_NETWORK_ADDRESS_HPP
 
 #include "network-monitor.hpp"
 
 #include <boost/asio/ip/address.hpp>
 
 namespace ndn {
-namespace util {
+namespace net {
 
 enum class AddressFamily {
   UNSPECIFIED,
@@ -124,7 +124,7 @@
 std::ostream&
 operator<<(std::ostream& os, const NetworkAddress& address);
 
-} // namespace util
+} // namespace net
 } // namespace ndn
 
-#endif // NDN_UTIL_NETWORK_ADDRESS_HPP
+#endif // NDN_NET_NETWORK_ADDRESS_HPP
diff --git a/src/util/network-interface.cpp b/src/net/network-interface.cpp
similarity index 97%
rename from src/util/network-interface.cpp
rename to src/net/network-interface.cpp
index e192947..a03d850 100644
--- a/src/util/network-interface.cpp
+++ b/src/net/network-interface.cpp
@@ -23,15 +23,15 @@
 
 #include "network-interface.hpp"
 #include "detail/linux-if-constants.hpp"
-#include "logger.hpp"
-#include "string-helper.hpp"
+#include "../util/logger.hpp"
+#include "../util/string-helper.hpp"
 
 #include <net/if.h>
 
 NDN_LOG_INIT(ndn.NetworkMonitor);
 
 namespace ndn {
-namespace util {
+namespace net {
 
 NetworkInterface::NetworkInterface()
   : m_index(0)
@@ -236,5 +236,5 @@
   return os;
 }
 
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/src/util/network-interface.hpp b/src/net/network-interface.hpp
similarity index 91%
rename from src/util/network-interface.hpp
rename to src/net/network-interface.hpp
index 4b53a1d..f5fff7e 100644
--- a/src/util/network-interface.hpp
+++ b/src/net/network-interface.hpp
@@ -21,18 +21,18 @@
  * @author Davide Pesavento <davide.pesavento@lip6.fr>
  */
 
-#ifndef NDN_UTIL_NETWORK_INTERFACE_HPP
-#define NDN_UTIL_NETWORK_INTERFACE_HPP
+#ifndef NDN_NET_NETWORK_INTERFACE_HPP
+#define NDN_NET_NETWORK_INTERFACE_HPP
 
 #include "ethernet.hpp"
 #include "network-address.hpp"
 #include "network-monitor.hpp"
-#include "signal.hpp"
+#include "../util/signal.hpp"
 
 #include <set>
 
 namespace ndn {
-namespace util {
+namespace net {
 
 /** @brief Indicates the hardware type of a network interface
  */
@@ -72,19 +72,19 @@
 public: // signals
   /** @brief Fires when interface state changes
    */
-  Signal<NetworkInterface, InterfaceState /*old*/, InterfaceState /*new*/> onStateChanged;
+  util::Signal<NetworkInterface, InterfaceState /*old*/, InterfaceState /*new*/> onStateChanged;
 
   /** @brief Fires when interface mtu changes
    */
-  Signal<NetworkInterface, uint32_t /*old*/, uint32_t /*new*/> onMtuChanged;
+  util::Signal<NetworkInterface, uint32_t /*old*/, uint32_t /*new*/> onMtuChanged;
 
   /** @brief Fires when a network-layer address is added to the interface
    */
-  Signal<NetworkInterface, NetworkAddress> onAddressAdded;
+  util::Signal<NetworkInterface, NetworkAddress> onAddressAdded;
 
   /** @brief Fires when a network-layer address is removed from the interface
    */
-  Signal<NetworkInterface, NetworkAddress> onAddressRemoved;
+  util::Signal<NetworkInterface, NetworkAddress> onAddressRemoved;
 
 public: // getters
   /** @brief Returns an opaque ID that uniquely identifies the interface on the system
@@ -250,7 +250,7 @@
 std::ostream&
 operator<<(std::ostream& os, const NetworkInterface& interface);
 
-} // namespace util
+} // namespace net
 } // namespace ndn
 
-#endif // NDN_UTIL_NETWORK_INTERFACE_HPP
+#endif // NDN_NET_NETWORK_INTERFACE_HPP
diff --git a/src/util/network-monitor.cpp b/src/net/network-monitor.cpp
similarity index 97%
rename from src/util/network-monitor.cpp
rename to src/net/network-monitor.cpp
index 0cbc8c4..c4a2e2e 100644
--- a/src/util/network-monitor.cpp
+++ b/src/net/network-monitor.cpp
@@ -34,7 +34,7 @@
 #endif
 
 namespace ndn {
-namespace util {
+namespace net {
 
 NetworkMonitor::NetworkMonitor(boost::asio::io_service& io)
   : m_impl(make_unique<Impl>(*this, io))
@@ -61,5 +61,5 @@
   return m_impl->listNetworkInterfaces();
 }
 
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/src/util/network-monitor.hpp b/src/net/network-monitor.hpp
similarity index 89%
rename from src/util/network-monitor.hpp
rename to src/net/network-monitor.hpp
index 629a80e..f3326b7 100644
--- a/src/util/network-monitor.hpp
+++ b/src/net/network-monitor.hpp
@@ -22,10 +22,10 @@
  * @author Davide Pesavento <davide.pesavento@lip6.fr>
  */
 
-#ifndef NDN_UTIL_NETWORK_MONITOR_HPP
-#define NDN_UTIL_NETWORK_MONITOR_HPP
+#ifndef NDN_NET_NETWORK_MONITOR_HPP
+#define NDN_NET_NETWORK_MONITOR_HPP
 
-#include "signal.hpp"
+#include "../util/signal.hpp"
 
 #include <vector>
 
@@ -37,7 +37,7 @@
 } // namespace boost
 
 namespace ndn {
-namespace util {
+namespace net {
 
 class NetworkInterface;
 
@@ -109,27 +109,27 @@
 public: // signals
   /** @brief Fires when network interfaces enumeration is complete
    */
-  Signal<NetworkMonitor> onEnumerationCompleted;
+  util::Signal<NetworkMonitor> onEnumerationCompleted;
 
   /** @brief Fires when a new interface is added
    */
-  Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceAdded;
+  util::Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceAdded;
 
   /**
    * @brief Fires when an interface is removed
    * @note The NetworkInterface object is no longer present in the network
    *       interfaces map when the signal is emitted
    */
-  Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceRemoved;
+  util::Signal<NetworkMonitor, shared_ptr<NetworkInterface>> onInterfaceRemoved;
 
   // only for backward compatibility
-  Signal<NetworkMonitor> onNetworkStateChanged;
+  util::Signal<NetworkMonitor> onNetworkStateChanged;
 
 private:
   const unique_ptr<Impl> m_impl;
 };
 
-} // namespace util
+} // namespace net
 } // namespace ndn
 
-#endif // NDN_UTIL_NETWORK_MONITOR_HPP
+#endif // NDN_NET_NETWORK_MONITOR_HPP
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
index 343ddd2..7fb6341 100644
--- a/src/transport/tcp-transport.cpp
+++ b/src/transport/tcp-transport.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,7 +21,7 @@
 
 #include "tcp-transport.hpp"
 #include "stream-transport-with-resolver-impl.hpp"
-#include "util/face-uri.hpp"
+#include "net/face-uri.hpp"
 
 namespace ndn {
 
@@ -51,7 +51,7 @@
   }
 
   try {
-    const util::FaceUri uri(uriString);
+    const FaceUri uri(uriString);
 
     const std::string scheme = uri.getScheme();
     if (scheme != "tcp" && scheme != "tcp4" && scheme != "tcp6") {
@@ -66,7 +66,7 @@
       port = uri.getPort();
     }
   }
-  catch (const util::FaceUri::Error& error) {
+  catch (const FaceUri::Error& error) {
     BOOST_THROW_EXCEPTION(Error(error.what()));
   }
 
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index f2e44aa..be5536e 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,7 +23,7 @@
 #include "stream-transport-impl.hpp"
 
 #include "../face.hpp"
-#include "util/face-uri.hpp"
+#include "net/face-uri.hpp"
 
 namespace ndn {
 
@@ -47,7 +47,7 @@
   }
 
   try {
-    const util::FaceUri uri(uriString);
+    const FaceUri uri(uriString);
 
     if (uri.getScheme() != "unix") {
       BOOST_THROW_EXCEPTION(Error("Cannot create UnixTransport from \"" +
@@ -58,7 +58,7 @@
       path = uri.getPath();
     }
   }
-  catch (const util::FaceUri::Error& error) {
+  catch (const FaceUri::Error& error) {
     BOOST_THROW_EXCEPTION(Error(error.what()));
   }
 
diff --git a/tests/integrated/network-monitor.cpp b/tests/integrated/network-monitor.cpp
index 498b970..917dcae 100644
--- a/tests/integrated/network-monitor.cpp
+++ b/tests/integrated/network-monitor.cpp
@@ -23,13 +23,13 @@
 #define BOOST_TEST_DYN_LINK 1
 #define BOOST_TEST_MODULE ndn-cxx Integrated Tests (Network Monitor)
 
-#include "util/network-monitor.hpp"
+#include "net/network-monitor.hpp"
 
-#include "util/network-address.hpp"
-#include "util/network-interface.hpp"
+#include "net/network-address.hpp"
+#include "net/network-interface.hpp"
 #include "util/time.hpp"
 
-#include "util/detail/link-type-helper.hpp"
+#include "net/detail/link-type-helper.hpp"
 
 #include "boost-test.hpp"
 
@@ -37,10 +37,9 @@
 #include <iostream>
 
 namespace ndn {
-namespace util {
+namespace net {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(Util)
 BOOST_AUTO_TEST_SUITE(TestNetworkMonitor)
 
 static std::ostream&
@@ -100,8 +99,7 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestNetworkMonitor
-BOOST_AUTO_TEST_SUITE_END() // Util
 
 } // namespace tests
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/tests/unit-tests/net/dns.t.cpp b/tests/unit-tests/net/dns.t.cpp
new file mode 100644
index 0000000..0e1aada
--- /dev/null
+++ b/tests/unit-tests/net/dns.t.cpp
@@ -0,0 +1,185 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2017 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "net/dns.hpp"
+
+#include "boost-test.hpp"
+#include "network-configuration-detector.hpp"
+
+#include <boost/asio/io_service.hpp>
+
+namespace ndn {
+namespace dns {
+namespace tests {
+
+using boost::asio::ip::address_v4;
+using boost::asio::ip::address_v6;
+
+class DnsFixture
+{
+public:
+  DnsFixture()
+    : m_nFailures(0)
+    , m_nSuccesses(0)
+  {
+  }
+
+  void
+  onSuccess(const IpAddress& resolvedAddress,
+            const IpAddress& expectedAddress,
+            bool isValid,
+            bool shouldCheckAddress = false)
+  {
+    ++m_nSuccesses;
+
+    if (!isValid) {
+      BOOST_FAIL("Resolved to " + resolvedAddress.to_string() + ", but should have failed");
+    }
+
+    BOOST_CHECK_EQUAL(resolvedAddress.is_v4(), expectedAddress.is_v4());
+
+    // checking address is not deterministic and should be enabled only
+    // if only one IP address will be returned by resolution
+    if (shouldCheckAddress) {
+      BOOST_CHECK_EQUAL(resolvedAddress, expectedAddress);
+    }
+  }
+
+  void
+  onFailure(bool isValid)
+  {
+    ++m_nFailures;
+
+    if (!isValid) {
+      BOOST_FAIL("Resolution should not have failed");
+    }
+
+    BOOST_CHECK_MESSAGE(true, "Resolution failed as expected");
+  }
+
+protected:
+  uint32_t m_nFailures;
+  uint32_t m_nSuccesses;
+  boost::asio::io_service m_ioService;
+};
+
+BOOST_AUTO_TEST_SUITE(Net)
+BOOST_FIXTURE_TEST_SUITE(TestDns, DnsFixture)
+
+BOOST_AUTO_TEST_CASE(Asynchronous)
+{
+  SKIP_IF_IP_UNAVAILABLE();
+
+  asyncResolve("nothost.nothost.nothost.arpa",
+               bind(&DnsFixture::onSuccess, this, _1, IpAddress(address_v4()), false, false),
+               bind(&DnsFixture::onFailure, this, true),
+               m_ioService); // should fail
+
+  m_ioService.run();
+  BOOST_CHECK_EQUAL(m_nFailures, 1);
+  BOOST_CHECK_EQUAL(m_nSuccesses, 0);
+}
+
+BOOST_AUTO_TEST_CASE(AsynchronousV4)
+{
+  SKIP_IF_IPV4_UNAVAILABLE();
+
+  asyncResolve("192.0.2.1",
+               bind(&DnsFixture::onSuccess, this, _1,
+                    IpAddress(address_v4::from_string("192.0.2.1")), true, true),
+               bind(&DnsFixture::onFailure, this, false),
+               m_ioService);
+
+  m_ioService.run();
+  BOOST_CHECK_EQUAL(m_nFailures, 0);
+  BOOST_CHECK_EQUAL(m_nSuccesses, 1);
+}
+
+BOOST_AUTO_TEST_CASE(AsynchronousV6)
+{
+  SKIP_IF_IPV6_UNAVAILABLE();
+
+  asyncResolve("ipv6.google.com", // only IPv6 address should be available
+               bind(&DnsFixture::onSuccess, this, _1, IpAddress(address_v6()), true, false),
+               bind(&DnsFixture::onFailure, this, false),
+               m_ioService);
+
+  asyncResolve("2001:db8:3f9:0:3025:ccc5:eeeb:86d3",
+               bind(&DnsFixture::onSuccess, this, _1,
+                    IpAddress(address_v6::from_string("2001:db8:3f9:0:3025:ccc5:eeeb:86d3")),
+                    true, true),
+               bind(&DnsFixture::onFailure, this, false),
+               m_ioService);
+
+  m_ioService.run();
+  BOOST_CHECK_EQUAL(m_nFailures, 0);
+  BOOST_CHECK_EQUAL(m_nSuccesses, 2);
+}
+
+BOOST_AUTO_TEST_CASE(AsynchronousV4AndV6)
+{
+  SKIP_IF_IPV4_UNAVAILABLE();
+  SKIP_IF_IPV6_UNAVAILABLE();
+
+  asyncResolve("www.named-data.net",
+               bind(&DnsFixture::onSuccess, this, _1, IpAddress(address_v4()), true, false),
+               bind(&DnsFixture::onFailure, this, false),
+               m_ioService, Ipv4Only());
+
+  asyncResolve("a.root-servers.net",
+               bind(&DnsFixture::onSuccess, this, _1, IpAddress(address_v4()), true, false),
+               bind(&DnsFixture::onFailure, this, false),
+               m_ioService, Ipv4Only()); // request IPv4 address
+
+  asyncResolve("a.root-servers.net",
+               bind(&DnsFixture::onSuccess, this, _1, IpAddress(address_v6()), true, false),
+               bind(&DnsFixture::onFailure, this, false),
+               m_ioService, Ipv6Only()); // request IPv6 address
+
+  asyncResolve("ipv6.google.com", // only IPv6 address should be available
+               bind(&DnsFixture::onSuccess, this, _1, IpAddress(address_v6()), true, false),
+               bind(&DnsFixture::onFailure, this, false),
+               m_ioService, Ipv6Only());
+
+  asyncResolve("ipv6.google.com", // only IPv6 address should be available
+               bind(&DnsFixture::onSuccess, this, _1, IpAddress(address_v6()), false, false),
+               bind(&DnsFixture::onFailure, this, true),
+               m_ioService, Ipv4Only()); // should fail
+
+  m_ioService.run();
+  BOOST_CHECK_EQUAL(m_nFailures, 1);
+  BOOST_CHECK_EQUAL(m_nSuccesses, 4);
+}
+
+BOOST_AUTO_TEST_CASE(Synchronous)
+{
+  SKIP_IF_IP_UNAVAILABLE();
+
+  IpAddress address = syncResolve("www.named-data.net", m_ioService);
+  BOOST_CHECK(address.is_v4() || address.is_v6());
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestDns
+BOOST_AUTO_TEST_SUITE_END() // Net
+
+} // namespace tests
+} // namespace dns
+} // namespace ndn
diff --git a/tests/unit-tests/util/ethernet.t.cpp b/tests/unit-tests/net/ethernet.t.cpp
similarity index 95%
rename from tests/unit-tests/util/ethernet.t.cpp
rename to tests/unit-tests/net/ethernet.t.cpp
index 38e05aa..cfcd6cb 100644
--- a/tests/unit-tests/util/ethernet.t.cpp
+++ b/tests/unit-tests/net/ethernet.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016 Regents of the University of California,
+ * Copyright (c) 2014-2017 Regents of the University of California,
  *                         Arizona Board of Regents,
  *                         Colorado State University,
  *                         University Pierre & Marie Curie, Sorbonne University,
@@ -25,15 +25,14 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "util/ethernet.hpp"
+#include "net/ethernet.hpp"
 
 #include "boost-test.hpp"
 
 namespace ndn {
-namespace util {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(Net)
 BOOST_AUTO_TEST_SUITE(TestEthernet)
 
 BOOST_AUTO_TEST_CASE(Basic)
@@ -112,8 +111,7 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestEthernet
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // Net
 
 } // namespace tests
-} // namespace util
 } // namespace ndn
diff --git a/tests/unit-tests/util/face-uri.t.cpp b/tests/unit-tests/net/face-uri.t.cpp
similarity index 98%
rename from tests/unit-tests/util/face-uri.t.cpp
rename to tests/unit-tests/net/face-uri.t.cpp
index 559a5b0..27313f7 100644
--- a/tests/unit-tests/util/face-uri.t.cpp
+++ b/tests/unit-tests/net/face-uri.t.cpp
@@ -25,19 +25,15 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "util/face-uri.hpp"
-#include "util/ethernet.hpp"
+#include "net/face-uri.hpp"
 
 #include "boost-test.hpp"
-#include "../network-configuration-detector.hpp"
+#include "network-configuration-detector.hpp"
 
 namespace ndn {
-namespace util {
 namespace tests {
 
-using ndn::tests::NetworkConfigurationDetector;
-
-BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(Net)
 BOOST_AUTO_TEST_SUITE(TestFaceUri)
 
 class CanonizeFixture : noncopyable
@@ -566,8 +562,7 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // Net
 
 } // namespace tests
-} // namespace util
 } // namespace ndn
diff --git a/tests/unit-tests/network-configuration-detector.cpp b/tests/unit-tests/net/network-configuration-detector.cpp
similarity index 97%
rename from tests/unit-tests/network-configuration-detector.cpp
rename to tests/unit-tests/net/network-configuration-detector.cpp
index f00b3e8..9aa196b 100644
--- a/tests/unit-tests/network-configuration-detector.cpp
+++ b/tests/unit-tests/net/network-configuration-detector.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
diff --git a/tests/unit-tests/network-configuration-detector.hpp b/tests/unit-tests/net/network-configuration-detector.hpp
similarity index 70%
rename from tests/unit-tests/network-configuration-detector.hpp
rename to tests/unit-tests/net/network-configuration-detector.hpp
index 95d2aa8..c039c52 100644
--- a/tests/unit-tests/network-configuration-detector.hpp
+++ b/tests/unit-tests/net/network-configuration-detector.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,12 +19,12 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_TESTS_NETWORK_CONFIGURATION_DETECTOR_HPP
-#define NDN_TESTS_NETWORK_CONFIGURATION_DETECTOR_HPP
+#ifndef NDN_TESTS_NET_NETWORK_CONFIGURATION_DETECTOR_HPP
+#define NDN_TESTS_NET_NETWORK_CONFIGURATION_DETECTOR_HPP
 
 #define SKIP_IF_IPV4_UNAVAILABLE() \
   do { \
-    if (!NetworkConfigurationDetector::hasIpv4()) { \
+    if (!::ndn::tests::NetworkConfigurationDetector::hasIpv4()) { \
       BOOST_WARN_MESSAGE(false, "skipping assertions that require IPv4 support"); \
       return; \
     } \
@@ -32,12 +32,21 @@
 
 #define SKIP_IF_IPV6_UNAVAILABLE() \
   do { \
-    if (!NetworkConfigurationDetector::hasIpv6()) { \
+    if (!::ndn::tests::NetworkConfigurationDetector::hasIpv6()) { \
       BOOST_WARN_MESSAGE(false, "skipping assertions that require IPv6 support"); \
       return; \
     } \
   } while (false)
 
+#define SKIP_IF_IP_UNAVAILABLE() \
+  do { \
+    if (!::ndn::tests::NetworkConfigurationDetector::hasIpv4() && \
+        !::ndn::tests::NetworkConfigurationDetector::hasIpv6()) { \
+      BOOST_WARN_MESSAGE(false, "skipping assertions that require either IPv4 or IPv6 support"); \
+      return; \
+    } \
+  } while (false)
+
 namespace ndn {
 namespace tests {
 
@@ -63,4 +72,4 @@
 } // namespace tests
 } // namespace ndn
 
-#endif // NDN_TESTS_NETWORK_CONFIGURATION_DETECTOR_HPP
+#endif // NDN_TESTS_NET_NETWORK_CONFIGURATION_DETECTOR_HPP
diff --git a/tests/unit-tests/util/network-monitor.t.cpp b/tests/unit-tests/net/network-monitor.t.cpp
similarity index 93%
rename from tests/unit-tests/util/network-monitor.t.cpp
rename to tests/unit-tests/net/network-monitor.t.cpp
index 8e82086..d23cb38 100644
--- a/tests/unit-tests/util/network-monitor.t.cpp
+++ b/tests/unit-tests/net/network-monitor.t.cpp
@@ -19,16 +19,16 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "util/network-monitor.hpp"
+#include "net/network-monitor.hpp"
 
 #include "boost-test.hpp"
 #include <boost/asio/io_service.hpp>
 
 namespace ndn {
-namespace util {
+namespace net {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(Util)
+BOOST_AUTO_TEST_SUITE(Net)
 BOOST_AUTO_TEST_SUITE(TestNetworkMonitor)
 
 #define NM_REQUIRE_CAP(capability) \
@@ -66,8 +66,8 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestNetworkMonitor
-BOOST_AUTO_TEST_SUITE_END() // Util
+BOOST_AUTO_TEST_SUITE_END() // Net
 
 } // namespace tests
-} // namespace util
+} // namespace net
 } // namespace ndn
diff --git a/tests/unit-tests/util/dns.t.cpp b/tests/unit-tests/util/dns.t.cpp
deleted file mode 100644
index e76d593..0000000
--- a/tests/unit-tests/util/dns.t.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library 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 Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "util/dns.hpp"
-
-#include "boost-test.hpp"
-#include "../network-configuration-detector.hpp"
-
-#include <boost/asio/io_service.hpp>
-
-namespace ndn {
-namespace util {
-namespace tests {
-
-using boost::asio::ip::address_v4;
-using boost::asio::ip::address_v6;
-
-using ndn::tests::NetworkConfigurationDetector;
-
-class DnsFixture
-{
-public:
-  DnsFixture()
-    : m_nFailures(0)
-    , m_nSuccesses(0)
-  {
-  }
-
-  void
-  onSuccess(const dns::IpAddress& resolvedAddress,
-            const dns::IpAddress& expectedAddress,
-            bool isValid,
-            bool shouldCheckAddress = false)
-  {
-    ++m_nSuccesses;
-
-    if (!isValid) {
-      BOOST_FAIL("Resolved to " + resolvedAddress.to_string() + ", but should have failed");
-    }
-
-    BOOST_CHECK_EQUAL(resolvedAddress.is_v4(), expectedAddress.is_v4());
-
-    // checking address is not deterministic and should be enabled only
-    // if only one IP address will be returned by resolution
-    if (shouldCheckAddress) {
-      BOOST_CHECK_EQUAL(resolvedAddress, expectedAddress);
-    }
-  }
-
-  void
-  onFailure(bool isValid)
-  {
-    ++m_nFailures;
-
-    if (!isValid) {
-      BOOST_FAIL("Resolution should not have failed");
-    }
-
-    BOOST_CHECK_MESSAGE(true, "Resolution failed as expected");
-  }
-
-protected:
-  uint32_t m_nFailures;
-  uint32_t m_nSuccesses;
-  boost::asio::io_service m_ioService;
-};
-
-BOOST_AUTO_TEST_SUITE(Util)
-BOOST_FIXTURE_TEST_SUITE(TestDns, DnsFixture)
-
-BOOST_AUTO_TEST_CASE(Asynchronous)
-{
-  if (!NetworkConfigurationDetector::hasIpv4() && !NetworkConfigurationDetector::hasIpv6()) {
-    BOOST_WARN_MESSAGE(false, "skipping assertions that require either IPv4 or IPv6 support");
-    return;
-  }
-
-  dns::asyncResolve("nothost.nothost.nothost.arpa",
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v4()), false, false),
-                    bind(&DnsFixture::onFailure, this, true),
-                    m_ioService); // should fail
-  m_ioService.run();
-
-  BOOST_CHECK_EQUAL(m_nFailures, 1);
-  BOOST_CHECK_EQUAL(m_nSuccesses, 0);
-}
-
-BOOST_AUTO_TEST_CASE(AsynchronousV4)
-{
-  SKIP_IF_IPV4_UNAVAILABLE();
-
-  dns::asyncResolve("192.0.2.1",
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v4::from_string("192.0.2.1")),
-                         true, true),
-                    bind(&DnsFixture::onFailure, this, false),
-                    m_ioService);
-  m_ioService.run();
-
-  BOOST_CHECK_EQUAL(m_nFailures, 0);
-  BOOST_CHECK_EQUAL(m_nSuccesses, 1);
-}
-
-BOOST_AUTO_TEST_CASE(AsynchronousV6)
-{
-  SKIP_IF_IPV6_UNAVAILABLE();
-
-  dns::asyncResolve("ipv6.google.com", // only IPv6 address should be available
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v6()), true, false),
-                    bind(&DnsFixture::onFailure, this, false),
-                    m_ioService);
-
-  dns::asyncResolve("2001:db8:3f9:0:3025:ccc5:eeeb:86d3",
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v6::
-                                      from_string("2001:db8:3f9:0:3025:ccc5:eeeb:86d3")),
-                         true, true),
-                    bind(&DnsFixture::onFailure, this, false),
-                    m_ioService);
-  m_ioService.run();
-
-  BOOST_CHECK_EQUAL(m_nFailures, 0);
-  BOOST_CHECK_EQUAL(m_nSuccesses, 2);
-}
-
-BOOST_AUTO_TEST_CASE(AsynchronousV4AndV6)
-{
-  SKIP_IF_IPV4_UNAVAILABLE();
-  SKIP_IF_IPV6_UNAVAILABLE();
-
-  dns::asyncResolve("www.named-data.net",
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v4()), true, false),
-                    bind(&DnsFixture::onFailure, this, false),
-                    m_ioService,
-                    dns::Ipv4Only());
-
-  dns::asyncResolve("a.root-servers.net",
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v4()), true, false),
-                    bind(&DnsFixture::onFailure, this, false),
-                    m_ioService,
-                    dns::Ipv4Only()); // request IPv4 address
-
-  dns::asyncResolve("a.root-servers.net",
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v6()), true, false),
-                    bind(&DnsFixture::onFailure, this, false),
-                    m_ioService,
-                    dns::Ipv6Only()); // request IPv6 address
-
-  dns::asyncResolve("ipv6.google.com", // only IPv6 address should be available
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v6()), true, false),
-                    bind(&DnsFixture::onFailure, this, false),
-                    m_ioService,
-                    dns::Ipv6Only());
-
-  dns::asyncResolve("ipv6.google.com", // only IPv6 address should be available
-                    bind(&DnsFixture::onSuccess, this, _1,
-                         dns::IpAddress(address_v6()), false, false),
-                    bind(&DnsFixture::onFailure, this, true), // should fail
-                    m_ioService,
-                    dns::Ipv4Only());
-  m_ioService.run();
-
-  BOOST_CHECK_EQUAL(m_nFailures, 1);
-  BOOST_CHECK_EQUAL(m_nSuccesses, 4);
-}
-
-BOOST_AUTO_TEST_CASE(Synchronous)
-{
-  if (!NetworkConfigurationDetector::hasIpv4() && !NetworkConfigurationDetector::hasIpv6()) {
-    BOOST_WARN_MESSAGE(false, "skipping assertions that require either IPv4 or IPv6 support");
-    return;
-  }
-  dns::IpAddress address;
-  BOOST_CHECK_NO_THROW(address = dns::syncResolve("www.named-data.net", m_ioService));
-
-  BOOST_CHECK(address.is_v4() || address.is_v6());
-}
-
-BOOST_AUTO_TEST_SUITE_END() // TestDns
-BOOST_AUTO_TEST_SUITE_END() // Util
-
-} // namespace tests
-} // namespace util
-} // namespace ndn