tools: rename autoconfig Base to Stage

Also, turn BaseDns into non-member functions.

refs #4158

Change-Id: Id3ab862497a07cc261ed34b2ab116f4014a4c6fa
diff --git a/tools/ndn-autoconfig/base-dns.hpp b/tools/ndn-autoconfig/base-dns.hpp
deleted file mode 100644
index 1b881ba..0000000
--- a/tools/ndn-autoconfig/base-dns.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  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 NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD 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.
- *
- * NFD 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
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_TOOLS_NDN_AUTOCONFIG_BASE_DNS_HPP
-#define NFD_TOOLS_NDN_AUTOCONFIG_BASE_DNS_HPP
-
-#include "base.hpp"
-
-namespace ndn {
-namespace tools {
-namespace autoconfig {
-
-/**
- * @brief Base class for stages that use DNS-based guessing
- */
-class BaseDns : public Base
-{
-protected:
-  class Error : public std::runtime_error
-  {
-  public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
-  };
-
-  BaseDns(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure);
-
-  /**
-   * @brief Send DNS SRV request for a @p fqdn fully qualified domain name
-   * @return FaceUri of the hub from the requested SRV record
-   * @throw Error if query returns nothing or SRV record cannot be parsed
-   */
-  std::string
-  querySrvRr(const std::string& fqdn);
-
-  /**
-   * @brief Send DNS SRV request using search domain list
-   * @return FaceUri of the hub from the requested SRV record
-   * @throw Error if query returns nothing or SRV record cannot be parsed
-   */
-  std::string
-  querySrvRrSearch();
-
-private:
-  union QueryAnswer;
-
-  /**
-   * @brief Parse SRV record
-   * @return FaceUri of the hub from the SRV record
-   * @throw Error if SRV record cannot be parsed
-   */
-  std::string
-  parseSrvRr(const QueryAnswer& queryAnswer, int answerSize);
-};
-
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
-
-#endif // NFD_TOOLS_NDN_AUTOCONFIG_BASE_DNS_HPP
diff --git a/tools/ndn-autoconfig/base-dns.cpp b/tools/ndn-autoconfig/dns-srv.cpp
similarity index 83%
rename from tools/ndn-autoconfig/base-dns.cpp
rename to tools/ndn-autoconfig/dns-srv.cpp
index c4f27b3..5bfa3d5 100644
--- a/tools/ndn-autoconfig/base-dns.cpp
+++ b/tools/ndn-autoconfig/dns-srv.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  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,
@@ -23,7 +23,7 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "base-dns.hpp"
+#include "dns-srv.hpp"
 
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -38,72 +38,18 @@
 namespace tools {
 namespace autoconfig {
 
-union BaseDns::QueryAnswer
+union QueryAnswer
 {
   HEADER header;
   uint8_t buf[NS_PACKETSZ];
 };
 
-BaseDns::BaseDns(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure)
-  : Base(face, keyChain, nextStageOnFailure)
-{
-}
-
-std::string
-BaseDns::querySrvRr(const std::string& fqdn)
-{
-  std::string srvDomain = "_ndn._udp." + fqdn;
-  std::cerr << "Sending DNS query for SRV record for " << srvDomain << std::endl;
-
-  res_init();
-
-  _res.retrans = 1;
-  _res.retry = 2;
-  _res.ndots = 10;
-
-  QueryAnswer queryAnswer;
-  int answerSize = res_query(srvDomain.c_str(),
-                             ns_c_in,
-                             ns_t_srv,
-                             queryAnswer.buf,
-                             sizeof(queryAnswer));
-  if (answerSize == 0) {
-    BOOST_THROW_EXCEPTION(Error("No DNS SRV records found for " + srvDomain));
-  }
-  return parseSrvRr(queryAnswer, answerSize);
-}
-
-/**
- * @brief Send DNS SRV request using search domain list
+/** \brief Parse SRV record
+ *  \return FaceUri of the hub from the SRV record
+ *  \throw DnsSrvError if SRV record cannot be parsed
  */
-std::string
-BaseDns::querySrvRrSearch()
-{
-  std::cerr << "Sending DNS query for SRV record for _ndn._udp" << std::endl;
-
-  QueryAnswer queryAnswer;
-
-  res_init();
-
-  _res.retrans = 1;
-  _res.retry = 2;
-  _res.ndots = 10;
-
-  int answerSize = res_search("_ndn._udp",
-                              ns_c_in,
-                              ns_t_srv,
-                              queryAnswer.buf,
-                              sizeof(queryAnswer));
-
-  if (answerSize == 0) {
-    BOOST_THROW_EXCEPTION(Error("No DNS SRV records found for _ndn._udp"));
-  }
-
-  return parseSrvRr(queryAnswer, answerSize);
-}
-
-std::string
-BaseDns::parseSrvRr(const QueryAnswer& queryAnswer, int answerSize)
+static std::string
+parseSrvRr(const QueryAnswer& queryAnswer, int answerSize)
 {
   // The references of the next classes are:
   // http://www.diablotin.com/librairie/networking/dnsbind/ch14_02.htm
@@ -125,7 +71,7 @@
   };
 
   if (ntohs(queryAnswer.header.ancount) == 0) {
-    BOOST_THROW_EXCEPTION(Error("SRV record cannot be parsed"));
+    BOOST_THROW_EXCEPTION(DnsSrvError("SRV record cannot be parsed"));
   }
 
   const uint8_t* blob = queryAnswer.buf + NS_HFIXEDSZ;
@@ -139,7 +85,7 @@
                                  srvName,                       // expanded server name
                                  NS_MAXDNAME);
   if (serverNameSize <= 0) {
-    BOOST_THROW_EXCEPTION(Error("SRV record cannot be parsed (error decoding domain name)"));
+    BOOST_THROW_EXCEPTION(DnsSrvError("SRV record cannot be parsed (error decoding domain name)"));
   }
 
   const srv_t* server = reinterpret_cast<const srv_t*>(&blob[sizeof(rechdr)]);
@@ -154,7 +100,7 @@
                                hostName,                      // expanded host name
                                NS_MAXDNAME);
   if (hostNameSize <= 0) {
-    BOOST_THROW_EXCEPTION(Error("SRV record cannot be parsed (error decoding host name)"));
+    BOOST_THROW_EXCEPTION(DnsSrvError("SRV record cannot be parsed (error decoding host name)"));
   }
 
   std::string uri = "udp://";
@@ -165,6 +111,59 @@
   return uri;
 }
 
+std::string
+querySrvRr(const std::string& fqdn)
+{
+  std::string srvDomain = "_ndn._udp." + fqdn;
+  std::cerr << "Sending DNS query for SRV record for " << srvDomain << std::endl;
+
+  res_init();
+
+  _res.retrans = 1;
+  _res.retry = 2;
+  _res.ndots = 10;
+
+  QueryAnswer queryAnswer;
+  int answerSize = res_query(srvDomain.data(),
+                             ns_c_in,
+                             ns_t_srv,
+                             queryAnswer.buf,
+                             sizeof(queryAnswer));
+  if (answerSize == 0) {
+    BOOST_THROW_EXCEPTION(DnsSrvError("No DNS SRV records found for " + srvDomain));
+  }
+  return parseSrvRr(queryAnswer, answerSize);
+}
+
+/**
+ * @brief Send DNS SRV request using search domain list
+ */
+std::string
+querySrvRrSearch()
+{
+  std::cerr << "Sending DNS query for SRV record for _ndn._udp" << std::endl;
+
+  QueryAnswer queryAnswer;
+
+  res_init();
+
+  _res.retrans = 1;
+  _res.retry = 2;
+  _res.ndots = 10;
+
+  int answerSize = res_search("_ndn._udp",
+                              ns_c_in,
+                              ns_t_srv,
+                              queryAnswer.buf,
+                              sizeof(queryAnswer));
+
+  if (answerSize == 0) {
+    BOOST_THROW_EXCEPTION(DnsSrvError("No DNS SRV records found for _ndn._udp"));
+  }
+
+  return parseSrvRr(queryAnswer, answerSize);
+}
+
 } // namespace autoconfig
 } // namespace tools
 } // namespace ndn
diff --git a/tools/ndn-autoconfig/dns-srv.hpp b/tools/ndn-autoconfig/dns-srv.hpp
new file mode 100644
index 0000000..41563e9
--- /dev/null
+++ b/tools/ndn-autoconfig/dns-srv.hpp
@@ -0,0 +1,69 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * 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 NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD 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.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TOOLS_NDN_AUTOCONFIG_DNS_SRV_HPP
+#define NFD_TOOLS_NDN_AUTOCONFIG_DNS_SRV_HPP
+
+#include "core/common.hpp"
+
+namespace ndn {
+namespace tools {
+namespace autoconfig {
+
+/** \file
+ *  \brief provide synchronous DNS SRV record querying
+ */
+
+class DnsSrvError : public std::runtime_error
+{
+public:
+  explicit
+  DnsSrvError(const std::string& what)
+    : std::runtime_error(what)
+  {
+  }
+};
+
+
+/** \brief Send DNS SRV request for \p fqdn
+ *  \param fqdn a fully qualified domain name
+ *  \return FaceUri of the hub from the requested SRV record
+ *  \throw DnsSrvError query returns nothing or SRV record cannot be parsed
+ */
+std::string
+querySrvRr(const std::string& fqdn);
+
+/** \brief Send DNS SRV request using search domain list
+ *  \return FaceUri of the hub from the requested SRV record
+ *  \throw DnsSrvError if query returns nothing or SRV record cannot be parsed
+ */
+std::string
+querySrvRrSearch();
+
+} // namespace autoconfig
+} // namespace tools
+} // namespace ndn
+
+#endif // NFD_TOOLS_NDN_AUTOCONFIG_DNS_SRV_HPP
diff --git a/tools/ndn-autoconfig/guess-from-identity-name.cpp b/tools/ndn-autoconfig/guess-from-identity-name.cpp
index 8b0c392..c26ec81 100644
--- a/tools/ndn-autoconfig/guess-from-identity-name.cpp
+++ b/tools/ndn-autoconfig/guess-from-identity-name.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -24,6 +24,7 @@
  */
 
 #include "guess-from-identity-name.hpp"
+#include "dns-srv.hpp"
 #include <ndn-cxx/security/pib/identity.hpp>
 #include <ndn-cxx/security/pib/pib.hpp>
 
@@ -33,7 +34,7 @@
 
 GuessFromIdentityName::GuessFromIdentityName(Face& face, KeyChain& keyChain,
                                              const NextStageCallback& nextStageOnFailure)
-  : BaseDns(face, keyChain, nextStageOnFailure)
+  : Stage(face, keyChain, nextStageOnFailure)
 {
 }
 
@@ -51,10 +52,10 @@
   serverName << "_homehub._autoconf.named-data.net";
 
   try {
-    std::string hubUri = BaseDns::querySrvRr(serverName.str());
+    std::string hubUri = querySrvRr(serverName.str());
     this->connectToHub(hubUri);
   }
-  catch (const BaseDns::Error& e) {
+  catch (const DnsSrvError& e) {
     m_nextStageOnFailure(std::string("Failed to find a home router based on the default identity "
                                      "name (") + e.what() + ")");
   }
diff --git a/tools/ndn-autoconfig/guess-from-identity-name.hpp b/tools/ndn-autoconfig/guess-from-identity-name.hpp
index e2a0bf0..315e856 100644
--- a/tools/ndn-autoconfig/guess-from-identity-name.hpp
+++ b/tools/ndn-autoconfig/guess-from-identity-name.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,
@@ -26,7 +26,7 @@
 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_IDENTITY_NAME_HPP
 #define NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_IDENTITY_NAME_HPP
 
-#include "base-dns.hpp"
+#include "stage.hpp"
 
 namespace ndn {
 namespace tools {
@@ -53,17 +53,16 @@
  *     The DNS server should answer with an SRV record that contains the hostname and UDP port
  *     number of the home NDN router of this user's site.
  */
-class GuessFromIdentityName : public BaseDns
+class GuessFromIdentityName : public Stage
 {
 public:
   /**
    * @brief Create stage to guess home router based on the default identity name
-   * @sa Base::Base
    */
   GuessFromIdentityName(Face& face, KeyChain& keyChain,
                         const NextStageCallback& nextStageOnFailure);
 
-  virtual void
+  void
   start() override;
 };
 
@@ -71,4 +70,4 @@
 } // namespace tools
 } // namespace ndn
 
-#endif // NFD_TOOLS_NDN_AUTOCONFIG_GUESSING_FROM_IDENTITY_NAME_HPP
+#endif // NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_IDENTITY_NAME_HPP
diff --git a/tools/ndn-autoconfig/guess-from-search-domains.cpp b/tools/ndn-autoconfig/guess-from-search-domains.cpp
index ae38cad..f53c4fc 100644
--- a/tools/ndn-autoconfig/guess-from-search-domains.cpp
+++ b/tools/ndn-autoconfig/guess-from-search-domains.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -24,6 +24,7 @@
  */
 
 #include "guess-from-search-domains.hpp"
+#include "dns-srv.hpp"
 
 namespace ndn {
 namespace tools {
@@ -31,7 +32,7 @@
 
 GuessFromSearchDomains::GuessFromSearchDomains(Face& face, KeyChain& keyChain,
                                                const NextStageCallback& nextStageOnFailure)
-  : BaseDns(face, keyChain, nextStageOnFailure)
+  : Stage(face, keyChain, nextStageOnFailure)
 {
 }
 
@@ -41,10 +42,10 @@
   std::cerr << "Trying default suffix DNS query..." << std::endl;
 
   try {
-    std::string hubUri = BaseDns::querySrvRrSearch();
+    std::string hubUri = querySrvRrSearch();
     this->connectToHub(hubUri);
   }
-  catch (const BaseDns::Error& e) {
+  catch (const DnsSrvError& e) {
     m_nextStageOnFailure(std::string("Failed to find NDN router using default suffix DNS query (") +
                          e.what() + ")");
   }
diff --git a/tools/ndn-autoconfig/guess-from-search-domains.hpp b/tools/ndn-autoconfig/guess-from-search-domains.hpp
index bcfd4c8..a2670ec 100644
--- a/tools/ndn-autoconfig/guess-from-search-domains.hpp
+++ b/tools/ndn-autoconfig/guess-from-search-domains.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,
@@ -26,7 +26,7 @@
 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_SEARCH_DOMAINS_HPP
 #define NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_SEARCH_DOMAINS_HPP
 
-#include "base-dns.hpp"
+#include "stage.hpp"
 
 namespace ndn {
 namespace tools {
@@ -46,17 +46,16 @@
  *     The DNS server should answer with an SRV record that contains the hostname and UDP port
  *     number of the NDN router.
  */
-class GuessFromSearchDomains : public BaseDns
+class GuessFromSearchDomains : public Stage
 {
 public:
   /**
    * @brief Create stage to guess home router based on DNS query with default suffix
-   * @sa Base::Base
    */
   GuessFromSearchDomains(Face& face, KeyChain& keyChain,
                          const NextStageCallback& nextStageOnFailure);
 
-  virtual void
+  void
   start() override;
 };
 
@@ -64,4 +63,4 @@
 } // namespace tools
 } // namespace ndn
 
-#endif // NFD_TOOLS_NDN_AUTOCONFIG_GUESSING_FROM_SEARCH_DOMAINS_HPP
+#endif // NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_SEARCH_DOMAINS_HPP
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index 8c594c7..6692bc2 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -35,7 +35,7 @@
 
 MulticastDiscovery::MulticastDiscovery(Face& face, KeyChain& keyChain,
                                        const NextStageCallback& nextStageOnFailure)
-  : Base(face, keyChain, nextStageOnFailure)
+  : Stage(face, keyChain, nextStageOnFailure)
   , m_nRequestedRegs(0)
   , m_nFinishedRegs(0)
 {
diff --git a/tools/ndn-autoconfig/multicast-discovery.hpp b/tools/ndn-autoconfig/multicast-discovery.hpp
index 13d8c36..1a10d89 100644
--- a/tools/ndn-autoconfig/multicast-discovery.hpp
+++ b/tools/ndn-autoconfig/multicast-discovery.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,
@@ -26,7 +26,7 @@
 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
 #define NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
 
-#include "base.hpp"
+#include "stage.hpp"
 
 namespace ndn {
 namespace tools {
@@ -47,12 +47,11 @@
  *     TLV-encoded Uri block.  The value of this block is the URI for the HUB, preferably a
  *     UDP tunnel.
  */
-class MulticastDiscovery : public Base
+class MulticastDiscovery : public Stage
 {
 public:
   /**
    * @brief Create multicast discovery stage
-   * @sa Base::Base
    */
   MulticastDiscovery(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure);
 
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
index 13dd3ab..6f043a3 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -135,7 +135,7 @@
 NdnFchDiscovery::NdnFchDiscovery(Face& face, KeyChain& keyChain,
                                  const std::string& url,
                                  const NextStageCallback& nextStageOnFailure)
-  : Base(face, keyChain, nextStageOnFailure)
+  : Stage(face, keyChain, nextStageOnFailure)
   , m_url(url)
 {
 }
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.hpp b/tools/ndn-autoconfig/ndn-fch-discovery.hpp
index 2e587c6..2b8de07 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.hpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.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,
@@ -26,7 +26,7 @@
 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_NDN_FCH_DISCOVERY_HPP
 #define NFD_TOOLS_NDN_AUTOCONFIG_NDN_FCH_DISCOVERY_HPP
 
-#include "base-dns.hpp"
+#include "stage.hpp"
 
 namespace ndn {
 namespace tools {
@@ -37,12 +37,11 @@
  *
  * @see https://github.com/cawka/ndn-fch/blob/master/README.md
  */
-class NdnFchDiscovery : public Base
+class NdnFchDiscovery : public Stage
 {
 public:
   /**
    * @brief Create stage to discover NDN hub using NDN-FCH protocol
-   * @sa Base::Base
    */
   NdnFchDiscovery(Face& face, KeyChain& keyChain,
                   const std::string& url,
diff --git a/tools/ndn-autoconfig/base.cpp b/tools/ndn-autoconfig/stage.cpp
similarity index 77%
rename from tools/ndn-autoconfig/base.cpp
rename to tools/ndn-autoconfig/stage.cpp
index 9a1f387..dbad283 100644
--- a/tools/ndn-autoconfig/base.cpp
+++ b/tools/ndn-autoconfig/stage.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -23,13 +23,13 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "base.hpp"
+#include "stage.hpp"
 
 namespace ndn {
 namespace tools {
 namespace autoconfig {
 
-Base::Base(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure)
+Stage::Stage(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure)
   : m_face(face)
   , m_keyChain(keyChain)
   , m_controller(face, keyChain)
@@ -38,35 +38,35 @@
 }
 
 void
-Base::connectToHub(const std::string& uri)
+Stage::connectToHub(const std::string& uri)
 {
   FaceUri faceUri(uri);
   std::cerr << "About to connect to: " << uri << std::endl;
 
-  faceUri.canonize(bind(&Base::onCanonizeSuccess, this, _1),
-                   bind(&Base::onCanonizeFailure, this, _1),
+  faceUri.canonize(bind(&Stage::onCanonizeSuccess, this, _1),
+                   bind(&Stage::onCanonizeFailure, this, _1),
                    m_face.getIoService(), time::seconds(4));
 
 }
 
 
 void
-Base::onCanonizeSuccess(const FaceUri& canonicalUri)
+Stage::onCanonizeSuccess(const FaceUri& canonicalUri)
 {
   m_controller.start<ndn::nfd::FaceCreateCommand>(
     ControlParameters().setUri(canonicalUri.toString()),
-    bind(&Base::onHubConnectSuccess, this, _1),
-    bind(&Base::onHubConnectError, this, _1));
+    bind(&Stage::onHubConnectSuccess, this, _1),
+    bind(&Stage::onHubConnectError, this, _1));
 }
 
 void
-Base::onCanonizeFailure(const std::string& reason)
+Stage::onCanonizeFailure(const std::string& reason)
 {
   BOOST_THROW_EXCEPTION(Error("FaceUri canonization failed: " + reason));
 }
 
 void
-Base::onHubConnectSuccess(const ControlParameters& resp)
+Stage::onHubConnectSuccess(const ControlParameters& resp)
 {
   std::cerr << "Successfully created face: " << resp << std::endl;
 
@@ -74,7 +74,7 @@
 }
 
 void
-Base::onHubConnectError(const ControlResponse& response)
+Stage::onHubConnectError(const ControlResponse& response)
 {
   // If face exists, continue proceeding with the existing face
   if (response.getCode() == 409) {
@@ -91,7 +91,7 @@
 }
 
 void
-Base::registerAutoConfigNames(uint64_t faceId)
+Stage::registerAutoConfigNames(uint64_t faceId)
 {
   static const Name TESTBED_PREFIX = "/ndn";
   registerPrefix(TESTBED_PREFIX, faceId);
@@ -101,7 +101,7 @@
 }
 
 void
-Base::registerPrefix(const Name& prefix, uint64_t faceId)
+Stage::registerPrefix(const Name& prefix, uint64_t faceId)
 {
   // Register a prefix in RIB
   m_controller.start<ndn::nfd::RibRegisterCommand>(
@@ -111,18 +111,18 @@
       .setOrigin(ndn::nfd::ROUTE_ORIGIN_AUTOCONF)
       .setCost(100)
       .setExpirationPeriod(time::milliseconds::max()),
-    bind(&Base::onPrefixRegistrationSuccess, this, _1),
-    bind(&Base::onPrefixRegistrationError, this, _1));
+    bind(&Stage::onPrefixRegistrationSuccess, this, _1),
+    bind(&Stage::onPrefixRegistrationError, this, _1));
 }
 
 void
-Base::onPrefixRegistrationSuccess(const ControlParameters& commandSuccessResult)
+Stage::onPrefixRegistrationSuccess(const ControlParameters& commandSuccessResult)
 {
   std::cerr << "Successful in name registration: " << commandSuccessResult << std::endl;
 }
 
 void
-Base::onPrefixRegistrationError(const ControlResponse& response)
+Stage::onPrefixRegistrationError(const ControlResponse& response)
 {
   BOOST_THROW_EXCEPTION(Error("Failed in name registration, " + response.getText() +
                               " (code: " + to_string(response.getCode()) + ")"));
diff --git a/tools/ndn-autoconfig/base.hpp b/tools/ndn-autoconfig/stage.hpp
similarity index 91%
rename from tools/ndn-autoconfig/base.hpp
rename to tools/ndn-autoconfig/stage.hpp
index 5c9d4cf..2c63280 100644
--- a/tools/ndn-autoconfig/base.hpp
+++ b/tools/ndn-autoconfig/stage.hpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -23,8 +23,8 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_TOOLS_NDN_AUTOCONFIG_BASE_HPP
-#define NFD_TOOLS_NDN_AUTOCONFIG_BASE_HPP
+#ifndef NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP
+#define NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP
 
 #include "core/common.hpp"
 
@@ -44,7 +44,7 @@
 /**
  * @brief Base class for discovery stages
  */
-class Base : boost::noncopyable
+class Stage : boost::noncopyable
 {
 public:
   class Error : public std::runtime_error
@@ -75,11 +75,11 @@
    * @param keyChain KeyChain object
    * @param nextStageOnFailure Callback to be called after the stage failed
    */
-  Base(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure);
+  Stage(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure);
 
   /**
    * @brief Attempt to connect to local hub using the \p uri FaceUri
-   * @throw Base::Error when failed to establish the tunnel
+   * @throw Error when failed to establish the tunnel
    */
   void
   connectToHub(const std::string& uri);
@@ -120,4 +120,4 @@
 } // namespace tools
 } // namespace ndn
 
-#endif // NFD_TOOLS_NDN_AUTOCONFIG_BASE_HPP
+#endif // NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP