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-search-domains.cpp b/tools/ndn-autoconfig/guess-from-search-domains.cpp
index f53c4fc..2f92cc3 100644
--- a/tools/ndn-autoconfig/guess-from-search-domains.cpp
+++ b/tools/ndn-autoconfig/guess-from-search-domains.cpp
@@ -30,24 +30,15 @@
namespace tools {
namespace autoconfig {
-GuessFromSearchDomains::GuessFromSearchDomains(Face& face, KeyChain& keyChain,
- const NextStageCallback& nextStageOnFailure)
- : Stage(face, keyChain, nextStageOnFailure)
-{
-}
-
void
-GuessFromSearchDomains::start()
+GuessFromSearchDomains::doStart()
{
- std::cerr << "Trying default suffix DNS query..." << std::endl;
-
try {
std::string hubUri = querySrvRrSearch();
- this->connectToHub(hubUri);
+ this->provideHubFaceUri(hubUri);
}
catch (const DnsSrvError& e) {
- m_nextStageOnFailure(std::string("Failed to find NDN router using default suffix DNS query (") +
- e.what() + ")");
+ this->fail(e.what());
}
}