src: decouple classes from Nlsr object
refs: #1952, #2803, #3960, #4288
Change-Id: Ibe3ac3820f11e8107ee4b13e510d53c27467a6cb
diff --git a/src/main.cpp b/src/main.cpp
index a2b9924..b271298 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,6 +19,7 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
+#include "conf-file-processor.hpp"
#include "nlsr-runner.hpp"
#include "version.hpp"
@@ -82,15 +83,25 @@
}
}
- nlsr::NlsrRunner runner(configFileName);
+ boost::asio::io_service ioService;
+ ndn::Face face(ioService);
+
+ nlsr::ConfParameter confParam(face, configFileName);
+ nlsr::ConfFileProcessor configProcessor(confParam);
+
+ if (!configProcessor.processConfFile()) {
+ std::cerr << "Error in configuration file processing" << std::endl;
+ return 2;
+ }
+
+ confParam.buildRouterPrefix();
+ confParam.writeLog();
+
+ nlsr::NlsrRunner runner(face, confParam);
try {
runner.run();
}
- catch (const nlsr::NlsrRunner::ConfFileError& e) {
- std::cerr << e.what() << std::endl;
- return 2;
- }
catch (const std::exception& e) {
std::cerr << "FATAL: " << getExtendedErrorMessage(e) << std::endl;
return 1;