use FaceUri and NetworkMonitor from ndn-cxx/net

This commit also contains a quick fix in LpReliability to avoid
ndn::lp::Packet::wireEncode(EncodingEstimator&).

refs #3940, #4156

Change-Id: Ice8e3649be21dd023ed1f6562c185f9e6721e45e
diff --git a/core/common.hpp b/core/common.hpp
index 437d355..b19a19c 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -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,
@@ -56,13 +56,15 @@
 #include <utility>
 #include <vector>
 
-#include <ndn-cxx/interest.hpp>
 #include <ndn-cxx/data.hpp>
+#include <ndn-cxx/exclude.hpp>
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/link.hpp>
 #include <ndn-cxx/name.hpp>
 #include <ndn-cxx/encoding/block.hpp>
 #include <ndn-cxx/lp/nack.hpp>
+#include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/util/backports.hpp>
-#include <ndn-cxx/util/face-uri.hpp>
 #include <ndn-cxx/util/signal.hpp>
 
 #include <boost/asio.hpp>
@@ -96,14 +98,14 @@
 
 using ndn::to_string;
 
-using ndn::Interest;
+using ndn::Block;
 using ndn::Data;
+using ndn::Exclude;
+using ndn::FaceUri;
+using ndn::Interest;
 using ndn::Name;
 using ndn::PartialName;
-using ndn::Exclude;
 using ndn::Link;
-using ndn::Block;
-using ndn::util::FaceUri;
 
 namespace tlv {
 // Don't write "namespace tlv = ndn::tlv", because NFD can add other members into this namespace.
diff --git a/core/network-interface.hpp b/core/network-interface.hpp
index 32caaed..4fb76d1 100644
--- a/core/network-interface.hpp
+++ b/core/network-interface.hpp
@@ -28,14 +28,14 @@
 
 #include "common.hpp"
 
-#include <ndn-cxx/util/ethernet.hpp>
+#include <ndn-cxx/net/ethernet.hpp>
 
 #include <net/if.h>
 
 namespace nfd {
 
 namespace ethernet {
-using namespace ndn::util::ethernet;
+using namespace ndn::ethernet;
 } // namespace ethernet
 
 /** \brief contains information about a network interface
diff --git a/daemon/face/lp-reliability.cpp b/daemon/face/lp-reliability.cpp
index aee7357..584e6bd 100644
--- a/daemon/face/lp-reliability.cpp
+++ b/daemon/face/lp-reliability.cpp
@@ -141,8 +141,7 @@
   if (mtu > 0) {
     // Ack Type (3 octets) + Ack Length (1 octet) + sizeof(lp::Sequence)
     size_t ackSize = 3 + 1 + sizeof(lp::Sequence);
-    ndn::EncodingEstimator estimator;
-    maxAcks = (mtu - pkt.wireEncode(estimator)) / ackSize;
+    maxAcks = (mtu - pkt.wireEncode().size()) / ackSize;
   }
 
   ssize_t nAcksInPkt = 0;
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index 2f2861d..8c58034 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -46,13 +46,13 @@
 
 static const std::string INTERNAL_CONFIG = "internal://nfd.conf";
 
-static inline ndn::util::NetworkMonitor*
+static inline ndn::net::NetworkMonitor*
 makeNetworkMonitor()
 {
   try {
-    return new ndn::util::NetworkMonitor(getGlobalIoService());
+    return new ndn::net::NetworkMonitor(getGlobalIoService());
   }
-  catch (const ndn::util::NetworkMonitor::Error& e) {
+  catch (const ndn::net::NetworkMonitor::Error& e) {
     NFD_LOG_WARN(e.what());
     return nullptr;
   }
diff --git a/daemon/nfd.hpp b/daemon/nfd.hpp
index 8082bf3..8f83644 100644
--- a/daemon/nfd.hpp
+++ b/daemon/nfd.hpp
@@ -29,8 +29,8 @@
 #include "core/config-file.hpp"
 #include "core/scheduler.hpp"
 
+#include <ndn-cxx/net/network-monitor.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/util/network-monitor.hpp>
 
 namespace ndn {
 class Face;
@@ -119,7 +119,7 @@
   unique_ptr<FibManager> m_fibManager;
   unique_ptr<StrategyChoiceManager> m_strategyChoiceManager;
 
-  unique_ptr<ndn::util::NetworkMonitor> m_networkMonitor;
+  unique_ptr<ndn::net::NetworkMonitor> m_networkMonitor;
   scheduler::ScopedEventId m_reloadConfigEvent;
 };
 
diff --git a/tools/ndn-autoconfig/base.hpp b/tools/ndn-autoconfig/base.hpp
index a293d0b..5c9d4cf 100644
--- a/tools/ndn-autoconfig/base.hpp
+++ b/tools/ndn-autoconfig/base.hpp
@@ -31,8 +31,8 @@
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
+#include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/util/face-uri.hpp>
 
 namespace ndn {
 namespace tools {
@@ -40,7 +40,6 @@
 
 using ndn::nfd::ControlParameters;
 using ndn::nfd::ControlResponse;
-using ndn::util::FaceUri;
 
 /**
  * @brief Base class for discovery stages
diff --git a/tools/ndn-autoconfig/main.cpp b/tools/ndn-autoconfig/main.cpp
index fc3a6fc..db45610 100644
--- a/tools/ndn-autoconfig/main.cpp
+++ b/tools/ndn-autoconfig/main.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,
@@ -30,7 +30,7 @@
 #include "ndn-fch-discovery.hpp"
 #include "guess-from-identity-name.hpp"
 
-#include <ndn-cxx/util/network-monitor.hpp>
+#include <ndn-cxx/net/network-monitor.hpp>
 #include <ndn-cxx/util/scheduler.hpp>
 #include <ndn-cxx/util/scheduler-scoped-event-id.hpp>
 
@@ -93,7 +93,7 @@
                })
   {
     if (m_isDaemonMode) {
-      m_networkMonitor.reset(new ndn::util::NetworkMonitor(m_io));
+      m_networkMonitor.reset(new net::NetworkMonitor(m_io));
       m_networkMonitor->onNetworkStateChanged.connect([this] {
           // delay stages, so if multiple events are triggered in short sequence,
           // only one auto-detection procedure is triggered
@@ -154,7 +154,7 @@
   boost::asio::io_service m_io;
   Face m_face;
   KeyChain m_keyChain;
-  unique_ptr<util::NetworkMonitor> m_networkMonitor;
+  unique_ptr<net::NetworkMonitor> m_networkMonitor;
   util::Scheduler m_scheduler;
   util::scheduler::ScopedEventId m_startStagesEvent;
   bool m_isDaemonMode;
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index 6323196..042248a 100644
--- a/tools/nfd-autoreg.cpp
+++ b/tools/nfd-autoreg.cpp
@@ -30,8 +30,8 @@
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 #include <ndn-cxx/mgmt/nfd/face-monitor.hpp>
 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
+#include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/util/face-uri.hpp>
 
 #include <boost/program_options/options_description.hpp>
 #include <boost/program_options/variables_map.hpp>
@@ -43,7 +43,6 @@
 namespace ndn {
 namespace nfd_autoreg {
 
-using util::FaceUri;
 using ::nfd::Network;
 
 class AutoregServer : boost::noncopyable
diff --git a/tools/nfdc/command-arguments.hpp b/tools/nfdc/command-arguments.hpp
index 010c1c2..49e7419 100644
--- a/tools/nfdc/command-arguments.hpp
+++ b/tools/nfdc/command-arguments.hpp
@@ -29,7 +29,6 @@
 #include "core/common.hpp"
 #include "status-report.hpp"
 #include <ndn-cxx/encoding/nfd-constants.hpp>
-#include <ndn-cxx/util/face-uri.hpp>
 #include <boost/any.hpp>
 
 namespace nfd {
@@ -38,7 +37,6 @@
 
 using ndn::nfd::FacePersistency;
 using ndn::nfd::RouteOrigin;
-using ndn::util::FaceUri;
 
 /** \brief contains named command arguments
  */
diff --git a/tools/nfdc/command-definition.hpp b/tools/nfdc/command-definition.hpp
index 813e744..7d8c8f0 100644
--- a/tools/nfdc/command-definition.hpp
+++ b/tools/nfdc/command-definition.hpp
@@ -76,13 +76,13 @@
 
   /** \brief FaceUri
    *
-   *  The argument appears in CommandArguments as ndn::util::FaceUri.
+   *  The argument appears in CommandArguments as ndn::FaceUri.
    */
   FACE_URI,
 
   /** \brief FaceId or FaceUri
    *
-   *  The argument appears in CommandArguments as either uint64_t or ndn::util::FaceUri.
+   *  The argument appears in CommandArguments as either uint64_t or ndn::FaceUri.
    */
   FACE_ID_OR_URI,
 
diff --git a/tools/nfdc/face-id-fetcher.hpp b/tools/nfdc/face-id-fetcher.hpp
index 1afeaf5..7c9a40f 100644
--- a/tools/nfdc/face-id-fetcher.hpp
+++ b/tools/nfdc/face-id-fetcher.hpp
@@ -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,
@@ -29,15 +29,12 @@
 #include "core/common.hpp"
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
-#include <ndn-cxx/util/face-uri.hpp>
 #include <ndn-cxx/security/validator-null.hpp>
 
 namespace nfd {
 namespace tools {
 namespace nfdc {
 
-using ndn::util::FaceUri;
-
 class FaceIdFetcher
 {
 public:
diff --git a/tools/nfdc/legacy-nfdc.hpp b/tools/nfdc/legacy-nfdc.hpp
index ada0a7d..782c255 100644
--- a/tools/nfdc/legacy-nfdc.hpp
+++ b/tools/nfdc/legacy-nfdc.hpp
@@ -152,7 +152,7 @@
   onCanonizeFailure(const std::string& reason);
 
   void
-  startFaceCreate(const ndn::util::FaceUri& canonicalUri);
+  startFaceCreate(const FaceUri& canonicalUri);
 
   void
   onObtainFaceIdFailure(const std::string& message);