Adding LSAs
diff --git a/nlsr_lsa.cpp b/nlsr_lsa.cpp
new file mode 100644
index 0000000..b6ba605
--- /dev/null
+++ b/nlsr_lsa.cpp
@@ -0,0 +1,37 @@
+#include<string>
+#include<iostream>
+#include<algorithm>
+
+#include "nlsr_lsa.hpp"
+
+using namespace std;
+
+string
+Lsa::getLsaKey()
+{
+ string key;
+ key=origRouter + "/" + boost::lexical_cast<std::string>(lsType) + "/"
+ + boost::lexical_cast<std::string>(lsSeqNo);
+ return key;
+}
+
+string
+NameLsa::getNameLsaData()
+{
+ string nameLsaData;
+ nameLsaData=origRouter + "|" + boost::lexical_cast<std::string>(lsType) + "|"
+ + boost::lexical_cast<std::string>(lsSeqNo) + "|"
+ + boost::lexical_cast<std::string>(lifeTime);
+ nameLsaData+="|";
+ nameLsaData+=boost::lexical_cast<std::string>(npl.getNplSize());
+
+ std::list<string> nl=npl.getNameList();
+ for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
+ {
+ nameLsaData+="|";
+ nameLsaData+=(*it);
+ }
+
+ return nameLsaData;
+}
+
diff --git a/nlsr_lsa.hpp b/nlsr_lsa.hpp
new file mode 100644
index 0000000..4c252e6
--- /dev/null
+++ b/nlsr_lsa.hpp
@@ -0,0 +1,121 @@
+#ifndef NLSR_LSA_HPP
+#define NLSR_LSA_HPP
+
+#include "nlsr_adjacent.hpp"
+#include "nlsr_npl.hpp"
+#include "nlsr_adl.hpp"
+
+using namespace std;
+
+class Lsa{
+public:
+ Lsa()
+ : origRouter()
+ , lsSeqNo()
+ , lifeTime()
+ {
+ }
+
+
+ void setLsType(uint8_t lst)
+ {
+ lsType=lst;
+ }
+
+ uint8_t getLsType()
+ {
+ return lsType;
+ }
+
+ void setLsSeqNo(uint32_t lsn)
+ {
+ lsSeqNo=lsn;
+ }
+
+ uint32_t getLsSeqNo()
+ {
+ return lsSeqNo;
+ }
+
+ string& getOrigRouter()
+ {
+ return origRouter;
+ }
+
+ void setOrigRouter(string& org)
+ {
+ origRouter=org;
+ }
+
+ uint32_t getLifeTime()
+ {
+ return lifeTime;
+ }
+
+ void setLifeTime(uint32_t lt)
+ {
+ lifeTime=lt;
+ }
+ string getLsaKey();
+protected:
+ string origRouter;
+ uint8_t lsType;
+ uint32_t lsSeqNo;
+ uint32_t lifeTime;
+};
+
+class NameLsa:Lsa{
+public:
+ NameLsa()
+ : Lsa()
+ , npl()
+ {
+ setLsType(1);
+ }
+
+
+ Npl& getNpl(){
+ return npl;
+ }
+
+ void addNameToLsa(string& name)
+ {
+ npl.insertIntoNpl(name);
+ }
+
+ string getNameLsaData();
+
+private:
+ Npl npl;
+
+};
+
+class AdjLsa:Lsa{
+public:
+ AdjLsa()
+ : Lsa()
+ , adl()
+ {
+ }
+
+private:
+ uint32_t noLink;
+ Adl adl;
+};
+
+class CorLsa:Lsa{
+public:
+ CorLsa()
+ :Lsa()
+ {
+ }
+private:
+ double corRad;
+ double corTheta;
+
+};
+
+
+
+
+#endif
diff --git a/nlsr_npl.hpp b/nlsr_npl.hpp
index da4bda7..878e4cc 100644
--- a/nlsr_npl.hpp
+++ b/nlsr_npl.hpp
@@ -14,6 +14,14 @@
~Npl();
int insertIntoNpl(string& name);
+ int getNplSize()
+ {
+ return nameList.size();
+ }
+ std::list<string>& getNameList()
+ {
+ return nameList;
+ }
void printNpl();
private: