tools: ndn-autoconfig code style corrections
refs #2426
Change-Id: Ied8de3b3f839e07090fc71f41cd01f4e5b4987f3
diff --git a/tools/ndn-autoconfig/main.cpp b/tools/ndn-autoconfig/main.cpp
index 666cca1..61ae22a 100644
--- a/tools/ndn-autoconfig/main.cpp
+++ b/tools/ndn-autoconfig/main.cpp
@@ -35,13 +35,16 @@
#include <boost/noncopyable.hpp>
#include <boost/program_options/options_description.hpp>
-#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
+#include <boost/program_options/variables_map.hpp>
namespace po = boost::program_options;
namespace ndn {
namespace tools {
+namespace autoconfig {
+// ndn-autoconfig is an NDN tool not an NFD tool, so it uses ndn::tools::autoconfig namespace.
+// It lives in NFD repository because nfd-start can automatically start ndn-autoconfig in daemon mode.
class NdnAutoconfig : boost::noncopyable
{
@@ -83,7 +86,7 @@
})
{
if (m_isDaemonMode) {
- m_networkMonitor.reset(new util::NetworkMonitor(m_io));
+ m_networkMonitor.reset(new ndn::util::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
@@ -118,7 +121,6 @@
m_io.stop();
}
-
static void
usage(std::ostream& os,
const po::options_description& optionDescription,
@@ -151,15 +153,12 @@
bool m_isDaemonMode;
boost::asio::signal_set m_terminationSignalSet;
- autoconfig::MulticastDiscovery m_stage1;
- autoconfig::GuessFromSearchDomains m_stage2;
- autoconfig::GuessFromIdentityName m_stage3;
+ MulticastDiscovery m_stage1;
+ GuessFromSearchDomains m_stage2;
+ GuessFromIdentityName m_stage3;
};
-} // namespace tools
-} // namespace ndn
-
-int
+static int
main(int argc, char** argv)
{
bool isDaemonMode = false;
@@ -185,12 +184,12 @@
}
catch (const std::exception& e) {
std::cerr << "ERROR: " << e.what() << "\n" << std::endl;
- ndn::tools::NdnAutoconfig::usage(std::cerr, optionDescription, argv[0]);
+ NdnAutoconfig::usage(std::cerr, optionDescription, argv[0]);
return 1;
}
if (options.count("help")) {
- ndn::tools::NdnAutoconfig::usage(std::cout, optionDescription, argv[0]);
+ NdnAutoconfig::usage(std::cout, optionDescription, argv[0]);
return 0;
}
@@ -224,7 +223,7 @@
}
try {
- ndn::tools::NdnAutoconfig autoConfigInstance(isDaemonMode);
+ NdnAutoconfig autoConfigInstance(isDaemonMode);
autoConfigInstance.run();
}
catch (const std::exception& error) {
@@ -233,3 +232,13 @@
}
return 0;
}
+
+} // namespace autoconfig
+} // namespace tools
+} // namespace ndn
+
+int
+main(int argc, char** argv)
+{
+ return ndn::tools::autoconfig::main(argc, argv);
+}