Schedule Adj LSA build and installation
diff --git a/nlsr_lsa.cpp b/nlsr_lsa.cpp
index a92687e..5495859 100644
--- a/nlsr_lsa.cpp
+++ b/nlsr_lsa.cpp
@@ -4,6 +4,7 @@
#include "nlsr_lsa.hpp"
#include "nlsr_npl.hpp"
+#include "nlsr_adjacent.hpp"
using namespace std;
@@ -15,7 +16,7 @@
return key;
}
-NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl& npl)
+NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl)
{
origRouter=origR;
lsType=lst;
@@ -110,3 +111,68 @@
return os;
}
+
+AdjLsa::AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt,
+ uint32_t nl ,Adl padl)
+{
+ origRouter=origR;
+ lsType=lst;
+ lsSeqNo=lsn;
+ lifeTime=lt;
+ noLink=nl;
+
+ std::list<Adjacent> al=padl.getAdjList();
+ for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
+ {
+ if((*it).getStatus()==1)
+ {
+ addAdjacentToLsa((*it));
+ }
+ }
+}
+
+string
+AdjLsa::getAdjLsaData(){
+ string adjLsaData;
+ adjLsaData=origRouter + "|" + boost::lexical_cast<std::string>(lsType) + "|"
+ + boost::lexical_cast<std::string>(lsSeqNo) + "|"
+ + boost::lexical_cast<std::string>(lifeTime);
+ adjLsaData+="|";
+ adjLsaData+=boost::lexical_cast<std::string>(adl.getAdlSize());
+
+ std::list<Adjacent> al=adl.getAdjList();
+ for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
+ {
+ adjLsaData+="|";
+ adjLsaData+=(*it).getAdjacentName();
+ adjLsaData+="|";
+ adjLsaData+=boost::lexical_cast<std::string>((*it).getConnectingFace());
+ adjLsaData+="|";
+ adjLsaData+=boost::lexical_cast<std::string>((*it).getLinkCost());
+
+ }
+ return adjLsaData;
+}
+
+std::ostream&
+operator<<(std::ostream& os, AdjLsa& aLsa)
+{
+ os<<"Adj Lsa: "<<endl;
+ os<<" Origination Router: "<<aLsa.getOrigRouter()<<endl;
+ os<<" Ls Type: "<<(unsigned short)aLsa.getLsType()<<endl;
+ os<<" Ls Seq No: "<<(unsigned int)aLsa.getLsSeqNo()<<endl;
+ os<<" Ls Lifetime: "<<(unsigned int)aLsa.getLifeTime()<<endl;
+ os<<" No Link: "<<(unsigned int)aLsa.getNoLink()<<endl;
+ os<<" Adjacents: "<<endl;
+ int i=1;
+ std::list<Adjacent> al=aLsa.getAdl().getAdjList();
+ for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++)
+ {
+ os<<" Adjacent "<<i<<": "<<endl;
+ os<<" Adjacent Name: "<<(*it).getAdjacentName()<<endl;
+ os<<" Connecting Face: "<<(*it).getConnectingFace()<<endl;
+ os<<" Link Cost: "<<(*it).getLinkCost()<<endl;
+ }
+
+ return os;
+}