Own Name LSA installation
diff --git a/nlsr_lsa.cpp b/nlsr_lsa.cpp
index b6ba605..dfc25e4 100644
--- a/nlsr_lsa.cpp
+++ b/nlsr_lsa.cpp
@@ -3,6 +3,7 @@
#include<algorithm>
#include "nlsr_lsa.hpp"
+#include "nlsr_npl.hpp"
using namespace std;
@@ -10,11 +11,26 @@
Lsa::getLsaKey()
{
string key;
- key=origRouter + "/" + boost::lexical_cast<std::string>(lsType) + "/"
- + boost::lexical_cast<std::string>(lsSeqNo);
+ key=origRouter + "/" + boost::lexical_cast<std::string>(lsType);
return key;
}
+NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl& npl)
+{
+ origRouter=origR;
+ lsType=lst;
+ lsSeqNo=lsn;
+ lifeTime=lt;
+
+ std::list<string> nl=npl.getNameList();
+ for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
+ {
+ addNameToLsa((*it));
+ }
+
+
+}
+
string
NameLsa::getNameLsaData()
{
@@ -35,3 +51,21 @@
return nameLsaData;
}
+std::ostream&
+operator<<(std::ostream& os, NameLsa& nLsa)
+{
+ os<<"Name Lsa: "<<endl;
+ os<<" Origination Router: "<<nLsa.getOrigRouter()<<endl;
+ os<<" Ls Type: "<<(unsigned short)nLsa.getLsType()<<endl;
+ os<<" Ls Seq No: "<<(unsigned int)nLsa.getLsSeqNo()<<endl;
+ os<<" Ls Lifetime: "<<(unsigned int)nLsa.getLifeTime()<<endl;
+ os<<" Names: "<<endl;
+ int i=1;
+ std::list<string> nl=nLsa.getNpl().getNameList();
+ for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++)
+ {
+ os<<" Name "<<i<<": "<<(*it)<<endl;
+ }
+
+ return os;
+}