Adding namespace nlsr
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index a8b1cb8..761365d 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -14,6 +14,8 @@
//test purpose of NLSR
#include "nlsr_test.hpp"
+namespace nlsr {
+
using namespace ndn;
using namespace std;
@@ -55,9 +57,14 @@
exit(EXIT_FAILURE);
}
+
+} // namespace nlsr
+
+using namespace nlsr;
+
int
main(int argc, char **argv){
- Nlsr nlsr_;
+ nlsr::Nlsr nlsr_;
string programName(argv[0]);
nlsr_.setConfFileName("nlsr.conf");
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 5762916..8f569c4 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -19,7 +19,7 @@
//testing
#include "nlsr_test.hpp"
-
+namespace nlsr {
using namespace ndn;
using namespace std;
@@ -235,4 +235,6 @@
};
+} //namespace nlsr
+
#endif
diff --git a/src/nlsr_adjacent.cpp b/src/nlsr_adjacent.cpp
index 8a1c048..6b0b1c0 100644
--- a/src/nlsr_adjacent.cpp
+++ b/src/nlsr_adjacent.cpp
@@ -5,6 +5,8 @@
#include "nlsr_adjacent.hpp"
+namespace nlsr {
+
using namespace std;
Adjacent::Adjacent(const string& an, int cf, double lc, int s, int iton){
@@ -33,3 +35,5 @@
cout<<"Interest Timed out: "<<adj.getInterestTimedOutNo()<<endl;
return os;
}
+
+} //namespace nlsr
diff --git a/src/nlsr_adjacent.hpp b/src/nlsr_adjacent.hpp
index 910b8a9..86a6cf5 100644
--- a/src/nlsr_adjacent.hpp
+++ b/src/nlsr_adjacent.hpp
@@ -1,6 +1,8 @@
#ifndef ADJACENT_HPP
#define ADJACENT_HPP
+namespace nlsr {
+
using namespace std;
class Adjacent{
@@ -78,4 +80,6 @@
std::ostream&
operator << (std::ostream &os, Adjacent &adj);
+} // namespace nlsr
+
#endif
diff --git a/src/nlsr_adl.cpp b/src/nlsr_adl.cpp
index ff05695..49a77f2 100644
--- a/src/nlsr_adl.cpp
+++ b/src/nlsr_adl.cpp
@@ -5,6 +5,8 @@
#include "nlsr_adjacent.hpp"
#include "nlsr.hpp"
+namespace nlsr {
+
Adl::Adl(){
}
@@ -262,3 +264,5 @@
cout<< (*it) <<endl;
}
}
+
+} //namespace nlsr
diff --git a/src/nlsr_adl.hpp b/src/nlsr_adl.hpp
index a655013..0169a5f 100644
--- a/src/nlsr_adl.hpp
+++ b/src/nlsr_adl.hpp
@@ -5,6 +5,8 @@
#include "nlsr_adjacent.hpp"
#include<list>
+namespace nlsr {
+
class Nlsr;
using namespace std;
@@ -51,4 +53,5 @@
std::list< Adjacent > adjList;
};
+} //namespace nlsr
#endif
diff --git a/src/nlsr_conf_param.cpp b/src/nlsr_conf_param.cpp
index 8ae7647..1e2fc64 100644
--- a/src/nlsr_conf_param.cpp
+++ b/src/nlsr_conf_param.cpp
@@ -1,6 +1,8 @@
#include<iostream>
#include "nlsr_conf_param.hpp"
+namespace nlsr {
+
using namespace std;
ostream&
@@ -25,3 +27,5 @@
return os;
}
+
+} //namespace nlsr
diff --git a/src/nlsr_conf_param.hpp b/src/nlsr_conf_param.hpp
index 817bf2e..941dbe7 100644
--- a/src/nlsr_conf_param.hpp
+++ b/src/nlsr_conf_param.hpp
@@ -3,6 +3,8 @@
#include<iostream>
+namespace nlsr {
+
using namespace std;
class ConfParameter{
@@ -206,4 +208,6 @@
std::ostream&
operator << (std::ostream &os, ConfParameter &cfp);
+} // namespace nlsr
+
#endif
diff --git a/src/nlsr_conf_processor.cpp b/src/nlsr_conf_processor.cpp
index 86fadac..e25192e 100644
--- a/src/nlsr_conf_processor.cpp
+++ b/src/nlsr_conf_processor.cpp
@@ -10,6 +10,8 @@
#include "nlsr_adjacent.hpp"
+namespace nlsr {
+
using namespace std;
int
@@ -383,3 +385,5 @@
return 0;
}
+} //namespace nlsr
+
diff --git a/src/nlsr_conf_processor.hpp b/src/nlsr_conf_processor.hpp
index 32b1cfb..5568010 100644
--- a/src/nlsr_conf_processor.hpp
+++ b/src/nlsr_conf_processor.hpp
@@ -3,6 +3,8 @@
#include "nlsr.hpp"
+namespace nlsr {
+
using namespace std;
class ConfFileProcessor{
@@ -43,4 +45,5 @@
string confFileName;
};
+} //namespace nlsr
#endif
diff --git a/src/nlsr_dm.cpp b/src/nlsr_dm.cpp
index a076815..1f3beab 100644
--- a/src/nlsr_dm.cpp
+++ b/src/nlsr_dm.cpp
@@ -1,13 +1,13 @@
#include<iostream>
#include<cstdlib>
-
-
#include "nlsr.hpp"
#include "nlsr_dm.hpp"
#include "nlsr_tokenizer.hpp"
#include "nlsr_lsdb.hpp"
+namespace nlsr {
+
using namespace std;
using namespace ndn;
@@ -76,7 +76,6 @@
}
}
-
-
-
}
+
+}//namespace nlsr
diff --git a/src/nlsr_dm.hpp b/src/nlsr_dm.hpp
index c12c429..2a8958b 100644
--- a/src/nlsr_dm.hpp
+++ b/src/nlsr_dm.hpp
@@ -5,6 +5,7 @@
#include <ndn-cpp-dev/security/key-chain.hpp>
#include <ndn-cpp-dev/util/scheduler.hpp>
+namespace nlsr {
using namespace ndn;
using namespace std;
@@ -22,5 +23,5 @@
};
-
+}//namespace nlsr
#endif
diff --git a/src/nlsr_fe.cpp b/src/nlsr_fe.cpp
index 1b9621f..bbffd96 100644
--- a/src/nlsr_fe.cpp
+++ b/src/nlsr_fe.cpp
@@ -2,6 +2,8 @@
#include "nlsr_fe.hpp"
#include "nlsr_nexthop.hpp"
+namespace nlsr {
+
using namespace std;
bool
@@ -43,3 +45,5 @@
os<<fe.getNhl()<<endl;
return os;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_fe.hpp b/src/nlsr_fe.hpp
index 2297315..fde32c8 100644
--- a/src/nlsr_fe.hpp
+++ b/src/nlsr_fe.hpp
@@ -8,6 +8,8 @@
#include "nlsr_nexthop.hpp"
#include "nlsr_nhl.hpp"
+namespace nlsr {
+
using namespace std;
class FibEntry
@@ -77,4 +79,6 @@
ostream& operator<<(ostream& os, FibEntry& fe);
+} //namespace nlsr
+
#endif
diff --git a/src/nlsr_fib.cpp b/src/nlsr_fib.cpp
index 776e2d6..54b6834 100644
--- a/src/nlsr_fib.cpp
+++ b/src/nlsr_fib.cpp
@@ -4,6 +4,8 @@
#include "nlsr_nhl.hpp"
#include "nlsr.hpp"
+namespace nlsr {
+
using namespace std;
using namespace ndn;
@@ -166,3 +168,5 @@
cout<<(*it);
}
}
+
+} //namespace nlsr
diff --git a/src/nlsr_fib.hpp b/src/nlsr_fib.hpp
index 452e669..99fd845 100644
--- a/src/nlsr_fib.hpp
+++ b/src/nlsr_fib.hpp
@@ -4,6 +4,8 @@
#include <list>
#include "nlsr_fe.hpp"
+namespace nlsr {
+
class Nlsr;
using namespace std;
@@ -39,4 +41,5 @@
int fibEntryRefreshTime;
};
+}//namespace nlsr
#endif
diff --git a/src/nlsr_im.cpp b/src/nlsr_im.cpp
index 3609a0b..4e77f39 100644
--- a/src/nlsr_im.cpp
+++ b/src/nlsr_im.cpp
@@ -9,6 +9,8 @@
#include "nlsr_tokenizer.hpp"
#include "nlsr_lsdb.hpp"
+namespace nlsr {
+
using namespace std;
using namespace ndn;
@@ -152,3 +154,5 @@
boost::ref(pnlsr),seconds));
}
+
+} //namespace nlsr
diff --git a/src/nlsr_im.hpp b/src/nlsr_im.hpp
index 5e2f6c4..6c09eb0 100644
--- a/src/nlsr_im.hpp
+++ b/src/nlsr_im.hpp
@@ -5,6 +5,7 @@
#include <ndn-cpp-dev/security/key-chain.hpp>
#include <ndn-cpp-dev/util/scheduler.hpp>
+namespace nlsr {
using namespace ndn;
using namespace std;
@@ -33,5 +34,6 @@
};
+}//namespace nlsr
#endif
diff --git a/src/nlsr_logger.cpp b/src/nlsr_logger.cpp
index 055c00c..0f003a0 100644
--- a/src/nlsr_logger.cpp
+++ b/src/nlsr_logger.cpp
@@ -1,5 +1,6 @@
#include "nlsr_logger.hpp"
+namespace nlsr {
string
NlsrLogger::getEpochTime()
@@ -58,3 +59,5 @@
// Add it to the core
logging::core::get()->add_sink(sink);
}
+
+}//namespace nlsr
diff --git a/src/nlsr_logger.hpp b/src/nlsr_logger.hpp
index 78fba80..74470e5 100644
--- a/src/nlsr_logger.hpp
+++ b/src/nlsr_logger.hpp
@@ -22,6 +22,7 @@
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
+namespace nlsr {
namespace logging = boost::log;
namespace attrs = boost::log::attributes;
@@ -56,4 +57,5 @@
src::logger mLogger;
};
+}//namespace nlsr
#endif
diff --git a/src/nlsr_lsa.cpp b/src/nlsr_lsa.cpp
index 0a6e7e4..9900069 100644
--- a/src/nlsr_lsa.cpp
+++ b/src/nlsr_lsa.cpp
@@ -9,6 +9,8 @@
#include "nlsr_adjacent.hpp"
#include "nlsr.hpp"
+namespace nlsr {
+
using namespace std;
@@ -236,3 +238,5 @@
return os;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_lsa.hpp b/src/nlsr_lsa.hpp
index d06cc3c..e7ab561 100644
--- a/src/nlsr_lsa.hpp
+++ b/src/nlsr_lsa.hpp
@@ -6,6 +6,8 @@
#include "nlsr_npl.hpp"
#include "nlsr_adl.hpp"
+namespace nlsr {
+
using namespace std;
using namespace ndn;
@@ -204,6 +206,6 @@
operator<<(std::ostream& os, CorLsa& cLsa);
-
+}//namespace nlsr
#endif
diff --git a/src/nlsr_lsdb.cpp b/src/nlsr_lsdb.cpp
index 08d0a96..28301f4 100644
--- a/src/nlsr_lsdb.cpp
+++ b/src/nlsr_lsdb.cpp
@@ -3,6 +3,8 @@
#include "nlsr_lsdb.hpp"
#include "nlsr.hpp"
+namespace nlsr {
+
using namespace std;
void
@@ -695,4 +697,5 @@
return false;
}
+}//namespace nlsr
diff --git a/src/nlsr_lsdb.hpp b/src/nlsr_lsdb.hpp
index d04acd7..24b489d 100644
--- a/src/nlsr_lsdb.hpp
+++ b/src/nlsr_lsdb.hpp
@@ -4,6 +4,8 @@
#include <utility>
#include "nlsr_lsa.hpp"
+namespace nlsr {
+
using namespace std;
class Nlsr;
@@ -78,4 +80,6 @@
};
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_map.cpp b/src/nlsr_map.cpp
index e96653c..cf91f61 100644
--- a/src/nlsr_map.cpp
+++ b/src/nlsr_map.cpp
@@ -7,6 +7,7 @@
#include "nlsr_lsdb.hpp"
#include "nlsr_map.hpp"
+namespace nlsr {
using namespace std;
@@ -115,3 +116,5 @@
return os;
}
+
+} //namespace nlsr
diff --git a/src/nlsr_map.hpp b/src/nlsr_map.hpp
index 7f73cac..54edde6 100644
--- a/src/nlsr_map.hpp
+++ b/src/nlsr_map.hpp
@@ -6,6 +6,8 @@
#include <ndn-cpp-dev/face.hpp>
+namespace nlsr {
+
class Nlsr;
using namespace std;
@@ -81,4 +83,5 @@
ostream&
operator<<(ostream& os, Map& rMap);
+} // namespace nlsr
#endif
diff --git a/src/nlsr_nexthop.cpp b/src/nlsr_nexthop.cpp
index 7af0bd4..7906142 100644
--- a/src/nlsr_nexthop.cpp
+++ b/src/nlsr_nexthop.cpp
@@ -1,8 +1,12 @@
#include "nlsr_nexthop.hpp"
+namespace nlsr {
+
ostream&
operator<<(ostream& os, NextHop& nh)
{
os<<"Face: "<<nh.getConnectingFace()<<" Route Cost: "<<nh.getRouteCost();
return os;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_nexthop.hpp b/src/nlsr_nexthop.hpp
index 17393c6..b5d34f6 100644
--- a/src/nlsr_nexthop.hpp
+++ b/src/nlsr_nexthop.hpp
@@ -3,6 +3,8 @@
#include<iostream>
+namespace nlsr {
+
using namespace std;
class NextHop
@@ -48,4 +50,6 @@
ostream&
operator<<(ostream& os, NextHop& nh);
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_nhl.cpp b/src/nlsr_nhl.cpp
index 4fe50aa..c23cc04 100644
--- a/src/nlsr_nhl.cpp
+++ b/src/nlsr_nhl.cpp
@@ -3,6 +3,8 @@
#include "nlsr_nhl.hpp"
#include "nlsr_nexthop.hpp"
+namespace nlsr {
+
using namespace std;
static bool
@@ -79,3 +81,5 @@
}
return os;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_nhl.hpp b/src/nlsr_nhl.hpp
index 0d381f5..9055b50 100644
--- a/src/nlsr_nhl.hpp
+++ b/src/nlsr_nhl.hpp
@@ -8,6 +8,8 @@
#include "nlsr_nexthop.hpp"
+namespace nlsr {
+
using namespace std;
class Nhl
@@ -46,4 +48,6 @@
ostream&
operator<<(ostream& os, Nhl& nhl);
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_npl.cpp b/src/nlsr_npl.cpp
index b278699..0bc0001 100644
--- a/src/nlsr_npl.cpp
+++ b/src/nlsr_npl.cpp
@@ -3,6 +3,8 @@
#include "nlsr_npl.hpp"
+namespace nlsr {
+
using namespace std;
Npl::Npl(){
@@ -61,3 +63,5 @@
i++;
}
}
+
+}//namespace nlsr
diff --git a/src/nlsr_npl.hpp b/src/nlsr_npl.hpp
index 3a0393a..47bb8f5 100644
--- a/src/nlsr_npl.hpp
+++ b/src/nlsr_npl.hpp
@@ -5,6 +5,8 @@
#include<string>
#include <ndn-cpp-dev/face.hpp>
+namespace nlsr {
+
using namespace std;
class Npl{
@@ -31,4 +33,6 @@
};
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_npt.cpp b/src/nlsr_npt.cpp
index 01b98e5..498b2ca 100644
--- a/src/nlsr_npt.cpp
+++ b/src/nlsr_npt.cpp
@@ -6,6 +6,8 @@
#include "nlsr_npte.hpp"
#include "nlsr.hpp"
+namespace nlsr {
+
using namespace std;
static bool
@@ -138,3 +140,5 @@
cout <<(*it)<<endl;
}
}
+
+}
diff --git a/src/nlsr_npt.hpp b/src/nlsr_npt.hpp
index c8394dc..063f23b 100644
--- a/src/nlsr_npt.hpp
+++ b/src/nlsr_npt.hpp
@@ -5,6 +5,8 @@
#include "nlsr_npte.hpp"
#include "nlsr_rte.hpp"
+namespace nlsr{
+
using namespace std;
class Nlsr;
@@ -26,4 +28,6 @@
std::list<Npte> npteList;
};
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_npte.cpp b/src/nlsr_npte.cpp
index 65f2722..d9cb54f 100644
--- a/src/nlsr_npte.cpp
+++ b/src/nlsr_npte.cpp
@@ -4,6 +4,8 @@
#include "nlsr_rte.hpp"
#include "nlsr_nexthop.hpp"
+namespace nlsr {
+
using namespace std;
void
@@ -76,3 +78,5 @@
return os;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_npte.hpp b/src/nlsr_npte.hpp
index 49f763a..10ebb71 100644
--- a/src/nlsr_npte.hpp
+++ b/src/nlsr_npte.hpp
@@ -5,6 +5,8 @@
#include <utility>
#include "nlsr_rte.hpp"
+namespace nlsr {
+
using namespace std;
class Npte
@@ -53,4 +55,6 @@
ostream&
operator<<(ostream& os, Npte& npte);
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_rt.cpp b/src/nlsr_rt.cpp
index 1a3c091..5e15604 100644
--- a/src/nlsr_rt.cpp
+++ b/src/nlsr_rt.cpp
@@ -9,6 +9,8 @@
#include "nlsr_rte.hpp"
#include "nlsr_npt.hpp"
+namespace nlsr {
+
using namespace std;
void
@@ -227,3 +229,5 @@
}
}
+}//namespace nlsr
+
diff --git a/src/nlsr_rt.hpp b/src/nlsr_rt.hpp
index e65cf26..22e3cfe 100644
--- a/src/nlsr_rt.hpp
+++ b/src/nlsr_rt.hpp
@@ -7,6 +7,8 @@
#include "nlsr_rte.hpp"
+namespace nlsr {
+
class Nlsr;
class NextHop;
@@ -42,4 +44,6 @@
std::list< RoutingTableEntry > dryTable;
};
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_rtc.cpp b/src/nlsr_rtc.cpp
index 8b67f7b..089808a 100644
--- a/src/nlsr_rtc.cpp
+++ b/src/nlsr_rtc.cpp
@@ -7,6 +7,8 @@
#include "nlsr_nexthop.hpp"
#include "nlsr.hpp"
+namespace nlsr {
+
using namespace std;
void
@@ -130,6 +132,7 @@
linkCosts=new double[vNoLink];
}
+
void
RoutingTableCalculator::freeLinks()
{
@@ -523,3 +526,5 @@
{
delete [] distFromNbrToDest;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_rtc.hpp b/src/nlsr_rtc.hpp
index 4bbace7..0e391e6 100644
--- a/src/nlsr_rtc.hpp
+++ b/src/nlsr_rtc.hpp
@@ -4,7 +4,7 @@
#include <list>
#include <iostream>
-
+namespace nlsr {
class Map;
class RoutingTable;
@@ -139,4 +139,6 @@
};
+}//namespace nlsr
+
#endif
diff --git a/src/nlsr_rte.cpp b/src/nlsr_rte.cpp
index cc9feab..59325f0 100644
--- a/src/nlsr_rte.cpp
+++ b/src/nlsr_rte.cpp
@@ -3,6 +3,8 @@
#include "nlsr_rte.hpp"
+namespace nlsr{
+
using namespace std;
ostream&
@@ -19,3 +21,5 @@
}
return os;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_rte.hpp b/src/nlsr_rte.hpp
index 6f64836..9540b40 100644
--- a/src/nlsr_rte.hpp
+++ b/src/nlsr_rte.hpp
@@ -5,6 +5,8 @@
#include "nlsr_nhl.hpp"
+namespace nlsr {
+
using namespace std;
class RoutingTableEntry
@@ -45,4 +47,6 @@
ostream&
operator<<(ostream& os, RoutingTableEntry &rte);
+}
+
#endif
diff --git a/src/nlsr_sm.cpp b/src/nlsr_sm.cpp
index 1744897..9de1b1a 100644
--- a/src/nlsr_sm.cpp
+++ b/src/nlsr_sm.cpp
@@ -2,8 +2,12 @@
#include <iostream>
#include "nlsr_sm.hpp"
+namespace nlsr {
+
using namespace std;
class Nlsr;
+}//namespace nlsr
+
diff --git a/src/nlsr_sm.hpp b/src/nlsr_sm.hpp
index 542203b..52ccbbd 100644
--- a/src/nlsr_sm.hpp
+++ b/src/nlsr_sm.hpp
@@ -5,6 +5,7 @@
#include<string>
#include <ndn-cpp-dev/face.hpp>
+namespace nlsr {
using namespace std;
@@ -58,4 +59,6 @@
uint32_t corLsaSeq;
};
+
+}//namespace nlsr
#endif
diff --git a/src/nlsr_test.cpp b/src/nlsr_test.cpp
index 730befd..99b01f7 100644
--- a/src/nlsr_test.cpp
+++ b/src/nlsr_test.cpp
@@ -5,6 +5,8 @@
#include "nlsr.hpp"
#include "nlsr_test.hpp"
+namespace nlsr {
+
using namespace std;
using namespace ndn;
@@ -101,4 +103,6 @@
pnlsr.getLsdb().installAdjLsa(pnlsr, adjLsa);
}
+
+}//namespace nlsr
diff --git a/src/nlsr_test.hpp b/src/nlsr_test.hpp
index c08fd30..17381a8 100644
--- a/src/nlsr_test.hpp
+++ b/src/nlsr_test.hpp
@@ -10,6 +10,8 @@
#include "nlsr_npl.hpp"
#include "nlsr_adjacent.hpp"
+namespace nlsr {
+
using namespace std;
class Nlsr;
@@ -31,4 +33,5 @@
};
+} //namespace nlsr
#endif
diff --git a/src/nlsr_tokenizer.cpp b/src/nlsr_tokenizer.cpp
index e03d2d2..cf655ba 100644
--- a/src/nlsr_tokenizer.cpp
+++ b/src/nlsr_tokenizer.cpp
@@ -6,6 +6,8 @@
#include "nlsr_tokenizer.hpp"
+namespace nlsr {
+
using namespace std;
using namespace boost;
@@ -114,3 +116,5 @@
return false;
}
+
+}//namespace nlsr
diff --git a/src/nlsr_tokenizer.hpp b/src/nlsr_tokenizer.hpp
index 9363462..1f09cac 100644
--- a/src/nlsr_tokenizer.hpp
+++ b/src/nlsr_tokenizer.hpp
@@ -8,6 +8,8 @@
#include <list>
#include <ndn-cpp-dev/face.hpp>
+namespace nlsr {
+
using namespace std;
using namespace boost;
@@ -56,4 +58,5 @@
std::list<string> tokenList;
};
+}//namespace nlsr
#endif