Indentation
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 761365d..49886e0 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -12,40 +12,41 @@
#include "nlsr_lsdb.hpp"
#include "nlsr_logger.hpp"
//test purpose of NLSR
-#include "nlsr_test.hpp"
+#include "nlsr_test.hpp"
-namespace nlsr {
-
-using namespace ndn;
-using namespace std;
-
-void
-Nlsr::nlsrRegistrationFailed(const ndn::Name& name)
+namespace nlsr
{
- cerr << "ERROR: Failed to register prefix in local hub's daemon" << endl;
- getNlsrFace().shutdown();
-}
+
+ using namespace ndn;
+ using namespace std;
+
+ void
+ Nlsr::nlsrRegistrationFailed(const ndn::Name& name)
+ {
+ cerr << "ERROR: Failed to register prefix in local hub's daemon" << endl;
+ getNlsrFace().shutdown();
+ }
-void
-Nlsr::setInterestFilterNlsr(const string& name)
-{
- getNlsrFace().setInterestFilter(name,
- func_lib::bind(&interestManager::processInterest, &im,
- boost::ref(*this), _1, _2),
- func_lib::bind(&Nlsr::nlsrRegistrationFailed, this, _1));
-}
+ void
+ Nlsr::setInterestFilterNlsr(const string& name)
+ {
+ getNlsrFace().setInterestFilter(name,
+ func_lib::bind(&interestManager::processInterest, &im,
+ boost::ref(*this), _1, _2),
+ func_lib::bind(&Nlsr::nlsrRegistrationFailed, this, _1));
+ }
-void
-Nlsr::startEventLoop()
-{
- getNlsrFace().processEvents();
-}
+ void
+ Nlsr::startEventLoop()
+ {
+ getNlsrFace().processEvents();
+ }
-int
-Nlsr::usage(const string& progname)
-{
+ int
+ Nlsr::usage(const string& progname)
+ {
cout << "Usage: " << progname << " [OPTIONS...]"<<endl;
cout << " NDN routing...." << endl;
@@ -55,88 +56,95 @@
cout << " -h, --help Display this help message" << endl;
exit(EXIT_FAILURE);
-}
+ }
} // namespace nlsr
using namespace nlsr;
-int
-main(int argc, char **argv){
- nlsr::Nlsr nlsr_;
- string programName(argv[0]);
- nlsr_.setConfFileName("nlsr.conf");
+int
+main(int argc, char **argv)
+{
+ nlsr::Nlsr nlsr_;
+ string programName(argv[0]);
+ nlsr_.setConfFileName("nlsr.conf");
- int opt;
- while ((opt = getopt(argc, argv, "df:p:h")) != -1) {
- switch (opt) {
- case 'f':
- nlsr_.setConfFileName(optarg);
- break;
- case 'd':
- nlsr_.setIsDaemonProcess(optarg);
- break;
- case 'p':
- {
- stringstream sst(optarg);
- int ap;
- sst>>ap;
- nlsr_.setApiPort(ap);
- }
- break;
- case 'h':
- default:
- nlsr_.usage(programName);
- return EXIT_FAILURE;
+ int opt;
+ while ((opt = getopt(argc, argv, "df:p:h")) != -1)
+ {
+ switch (opt)
+ {
+ case 'f':
+ nlsr_.setConfFileName(optarg);
+ break;
+ case 'd':
+ nlsr_.setIsDaemonProcess(optarg);
+ break;
+ case 'p':
+ {
+ stringstream sst(optarg);
+ int ap;
+ sst>>ap;
+ nlsr_.setApiPort(ap);
+ }
+ break;
+ case 'h':
+ default:
+ nlsr_.usage(programName);
+ return EXIT_FAILURE;
+ }
}
- }
-
-
- ConfFileProcessor cfp(nlsr_.getConfFileName());
- int res=cfp.processConfFile(nlsr_);
- if ( res < 0 )
- {
- return EXIT_FAILURE;
- }
-
- nlsr_.getConfParameter().buildRouterPrefix();
- nlsr_.getNlsrLogger().initNlsrLogger(nlsr_.getConfParameter().getLogDir());
- //src::logger lg;
- //BOOST_LOG(lg) << "Some log record from nlsr.cpp";
- //for(int j=0; j< 1000; j++)
- //{
- // BOOST_LOG(lg) << "Some log record from nlsr.cpp "<<j;
- //}
- nlsr_.getLsdb().setLsaRefreshTime(nlsr_.getConfParameter().getLsaRefreshTime());
- nlsr_.getFib().setFibEntryRefreshTime(2*nlsr_.getConfParameter().getLsaRefreshTime());
- nlsr_.getLsdb().setThisRouterPrefix(nlsr_.getConfParameter().getRouterPrefix());
- /* debugging purpose start */
- cout << nlsr_.getConfParameter();
- nlsr_.getAdl().printAdl();
- nlsr_.getNpl().printNpl();
- /* debugging purpose end */
- nlsr_.getLsdb().buildAndInstallOwnNameLsa(nlsr_);
- nlsr_.getLsdb().buildAndInstallOwnCorLsa(nlsr_);
+ ConfFileProcessor cfp(nlsr_.getConfFileName());
+ int res=cfp.processConfFile(nlsr_);
+ if ( res < 0 )
+ {
+ return EXIT_FAILURE;
+ }
-
-
+ nlsr_.getConfParameter().buildRouterPrefix();
+ nlsr_.getNlsrLogger().initNlsrLogger(nlsr_.getConfParameter().getLogDir());
+ //src::logger lg;
+ //BOOST_LOG(lg) << "Some log record from nlsr.cpp";
+ //for(int j=0; j< 1000; j++)
+ //{
+ // BOOST_LOG(lg) << "Some log record from nlsr.cpp "<<j;
+ //}
+ nlsr_.getLsdb().setLsaRefreshTime(nlsr_.getConfParameter().getLsaRefreshTime());
+ nlsr_.getFib().setFibEntryRefreshTime(
+ 2*nlsr_.getConfParameter().getLsaRefreshTime());
+ nlsr_.getLsdb().setThisRouterPrefix(nlsr_.getConfParameter().getRouterPrefix());
- nlsr_.setInterestFilterNlsr(nlsr_.getConfParameter().getRouterPrefix());
- nlsr_.getIm().scheduleInfoInterest(nlsr_,1);
- //testing purpose
- nlsr_.getNlsrTesting().schedlueAddingLsas(nlsr_);
+ /* debugging purpose start */
+ cout << nlsr_.getConfParameter();
+ nlsr_.getAdl().printAdl();
+ nlsr_.getNpl().printNpl();
+ /* debugging purpose end */
-
-
+ nlsr_.getLsdb().buildAndInstallOwnNameLsa(nlsr_);
+ nlsr_.getLsdb().buildAndInstallOwnCorLsa(nlsr_);
- try{
- nlsr_.startEventLoop();
- }catch(std::exception &e) {
- std::cerr << "ERROR: " << e.what() << std::endl;
- }
- return EXIT_SUCCESS;
+
+
+ nlsr_.setInterestFilterNlsr(nlsr_.getConfParameter().getRouterPrefix());
+ nlsr_.getIm().scheduleInfoInterest(nlsr_,1);
+ //testing purpose
+ nlsr_.getNlsrTesting().schedlueAddingLsas(nlsr_);
+
+
+
+
+ try
+ {
+ nlsr_.startEventLoop();
+ }
+ catch(std::exception &e)
+ {
+ std::cerr << "ERROR: " << e.what() << std::endl;
+ }
+
+ return EXIT_SUCCESS;
}