tools: refactor ndn-autoconfig

Hub face creation and prefix registrations are moved into a new
Procedure class. Main function is simplified.

refs #4158

Change-Id: I15b660e3b8a1bde89498a1cb549a87788de46c7a
diff --git a/tools/ndn-autoconfig/guess-from-identity-name.cpp b/tools/ndn-autoconfig/guess-from-identity-name.cpp
index c26ec81..8ef112d 100644
--- a/tools/ndn-autoconfig/guess-from-identity-name.cpp
+++ b/tools/ndn-autoconfig/guess-from-identity-name.cpp
@@ -32,14 +32,13 @@
 namespace tools {
 namespace autoconfig {
 
-GuessFromIdentityName::GuessFromIdentityName(Face& face, KeyChain& keyChain,
-                                             const NextStageCallback& nextStageOnFailure)
-  : Stage(face, keyChain, nextStageOnFailure)
+GuessFromIdentityName::GuessFromIdentityName(KeyChain& keyChain)
+  : m_keyChain(keyChain)
 {
 }
 
 void
-GuessFromIdentityName::start()
+GuessFromIdentityName::doStart()
 {
   std::cerr << "Trying default identity name..." << std::endl;
 
@@ -53,11 +52,10 @@
 
   try {
     std::string hubUri = querySrvRr(serverName.str());
-    this->connectToHub(hubUri);
+    this->provideHubFaceUri(hubUri);
   }
   catch (const DnsSrvError& e) {
-    m_nextStageOnFailure(std::string("Failed to find a home router based on the default identity "
-                                     "name (") + e.what() + ")");
+    this->fail(e.what());
   }
 }