Own Cor LSA installation
diff --git a/nlsr.cpp b/nlsr.cpp
index 194fbe9..145fa47 100644
--- a/nlsr.cpp
+++ b/nlsr.cpp
@@ -61,6 +61,7 @@
 	nlsr.getConfParameter().buildRouterPrefix();
 
 	nlsr.getLsdb().buildAndInstallOwnNameLsa(nlsr);
+	nlsr.getLsdb().buildAndInstallOwnCorLsa(nlsr);
 	
 	
 /* debugging purpose start */
@@ -68,6 +69,7 @@
 	nlsr.getAdl().printAdl();
 	nlsr.getNpl().printNpl();
 	nlsr.getLsdb().printNameLsdb();
+	nlsr.getLsdb().printCorLsdb();
 /* debugging purpose end */
 	nlsr.setInterestFilterNlsr(nlsr.getConfParameter().getRouterPrefix());
 	nlsr.getIm().scheduleInfoInterest(nlsr,1);
diff --git a/nlsr_lsa.cpp b/nlsr_lsa.cpp
index dfc25e4..a92687e 100644
--- a/nlsr_lsa.cpp
+++ b/nlsr_lsa.cpp
@@ -69,3 +69,44 @@
 
 	return os;  
 }
+
+
+CorLsa::CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
+	      																							, double r, double theta)
+{
+	origRouter=origR;
+	lsType=lst;
+	lsSeqNo=lsn;
+	lifeTime=lt;
+	corRad=r;
+	corTheta=theta;
+}
+
+string 
+CorLsa::getCorLsaData()
+{
+	string corLsaData;
+	corLsaData=origRouter + "|";
+	corLsaData+=(boost::lexical_cast<std::string>(lsType) + "|");
+	corLsaData+=(boost::lexical_cast<std::string>(lsSeqNo) + "|");
+	corLsaData+=(boost::lexical_cast<std::string>(lifeTime) + "|");
+	corLsaData+=(boost::lexical_cast<std::string>(corRad) + "|");
+	corLsaData+=(boost::lexical_cast<std::string>(corTheta) + "|");
+
+	return corLsaData;
+}
+
+std::ostream& 
+operator<<(std::ostream& os, CorLsa& cLsa)
+{
+	os<<"Cor Lsa: "<<endl;
+	os<<"  Origination Router: "<<cLsa.getOrigRouter()<<endl;
+	os<<"  Ls Type: "<<(unsigned short)cLsa.getLsType()<<endl;
+	os<<"  Ls Seq No: "<<(unsigned int)cLsa.getLsSeqNo()<<endl;
+	os<<"  Ls Lifetime: "<<(unsigned int)cLsa.getLifeTime()<<endl;
+	os<<"    Hyperbolic Radius: "<<cLsa.getCorRadius()<<endl;
+	os<<"    Hyperbolic Theta: "<<cLsa.getCorTheta()<<endl;
+
+	return os;
+}
+
diff --git a/nlsr_lsa.hpp b/nlsr_lsa.hpp
index 0dd00c6..18a09d3 100644
--- a/nlsr_lsa.hpp
+++ b/nlsr_lsa.hpp
@@ -113,12 +113,38 @@
 		:Lsa()
 	{
 	}
+
+	CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt
+	      																							, double r, double theta);
+	string getCorLsaData();
+	
+	double getCorRadius()
+	{
+		return corRad;
+	}
+	
+	void setCorRadius(double cr)
+	{
+		corRad=cr;
+	}
+
+	double getCorTheta()
+	{
+		return corTheta;
+	}
+
+	void setCorTheta(double ct){
+		corTheta=ct;
+	}
 private:
 	double corRad;
 	double corTheta;
 
 };
 
+std::ostream& 
+operator<<(std::ostream& os, CorLsa& cLsa);
+
 
 
 
diff --git a/nlsr_lsdb.cpp b/nlsr_lsdb.cpp
index a82c8a3..c6ae523 100644
--- a/nlsr_lsdb.cpp
+++ b/nlsr_lsdb.cpp
@@ -28,6 +28,8 @@
 	
 }
 
+//Name LSA and LSDB related functions start here
+
 static bool
 nameLsaCompare(NameLsa& nlsa1, NameLsa& nlsa2){
 	return nlsa1.getLsaKey()==nlsa1.getLsaKey();
@@ -48,7 +50,7 @@
 					, pnlsr.getConfParameter().getRouterDeadInterval()
 					, pnlsr.getNpl() );
 	pnlsr.setNameLsaSeq(pnlsr.getNameLsaSeq()+1);
-	cout<<nameLsa;
+	//cout<<nameLsa;
 	return installNameLsa(nameLsa);
 
 }
@@ -106,16 +108,6 @@
 {
 	return false;
 }
-	
-void 
-Lsdb::printNameLsdb()
-{
-	for( std::list<NameLsa>::iterator it=nameLsdb.begin(); 
-	                                                 it!= nameLsdb.end() ; it++)
-	{
-		cout<< (*it) <<endl;
-	}
-}
 
 bool 
 Lsdb::doesNameLsaExist(string key)
@@ -131,15 +123,145 @@
 	return true;
 }
 
+void 
+Lsdb::printNameLsdb()
+{
+	for( std::list<NameLsa>::iterator it=nameLsdb.begin(); 
+	                                                 it!= nameLsdb.end() ; it++)
+	{
+		cout<< (*it) <<endl;
+	}
+}
+
+// Cor LSA and LSDB related Functions start here
+
+static bool
+corLsaCompare(CorLsa& clsa1, CorLsa& clsa2){
+	return clsa1.getLsaKey()==clsa1.getLsaKey();
+}
+
+static bool
+corLsaCompareByKey(CorLsa& clsa, string& key){
+	return clsa.getLsaKey()==key;
+}
 
 bool 
-Lsdb::doesAdjLsaExist(string key)
+Lsdb::buildAndInstallOwnCorLsa(nlsr& pnlsr){
+	CorLsa corLsa(pnlsr.getConfParameter().getRouterPrefix()
+					, 1
+					, pnlsr.getCorLsaSeq()+1
+					, pnlsr.getConfParameter().getRouterDeadInterval()
+					, pnlsr.getConfParameter().getCorR()
+					, pnlsr.getConfParameter().getCorTheta() );
+	pnlsr.setCorLsaSeq(pnlsr.getCorLsaSeq()+1);
+	//cout<<corLsa;
+	installCorLsa(corLsa);
+
+}
+
+CorLsa& 
+Lsdb::getCorLsa(string key)
 {
+	std::list< CorLsa >::iterator it = std::find_if( corLsdb.begin(), 
+																		corLsdb.end(),	
+   																	bind(corLsaCompareByKey, _1, key));
+
+	if( it != corLsdb.end()){
+		return (*it);
+	}
+}
+
+bool 
+Lsdb::installCorLsa(CorLsa &clsa)
+{
+	bool doesLsaExist_ = doesCorLsaExist(clsa.getLsaKey());
+	if ( !doesLsaExist_ )
+	{
+		// add cor LSA
+		addCorLsa(clsa);
+	}
+	else
+	{
+		// check for newer cor LSA
+		CorLsa oldCorLsa=getCorLsa(clsa.getLsaKey());
+		
+	}
+	
+	return true;
+}
+
+bool 
+Lsdb::addCorLsa(CorLsa& clsa)
+{
+	std::list<CorLsa >::iterator it = std::find_if( corLsdb.begin(), 
+																		corLsdb.end(),	
+   																	bind(corLsaCompare, _1, clsa));
+
+	if( it == corLsdb.end()){
+		corLsdb.push_back(clsa);
+		return true;
+	}
 	return false;
 }
 
 bool 
+Lsdb::removeCorLsa(string& key)
+{
+
+}
+
+bool 
 Lsdb::doesCorLsaExist(string key)
 {
-	return false;
+	std::list<CorLsa >::iterator it = std::find_if( corLsdb.begin(), 
+																		corLsdb.end(),	
+   																	bind(corLsaCompareByKey, _1, key));
+
+	if( it == corLsdb.end()){
+		return false;
+	}
+
+	return true;
 }
+
+void 
+Lsdb::printCorLsdb() //debugging
+{
+	for( std::list<CorLsa>::iterator it=corLsdb.begin(); 
+	                                                 it!= corLsdb.end() ; it++)
+	{
+		cout<< (*it) <<endl;
+	}
+}
+
+
+// Adj LSA and LSDB related function starts here
+
+static bool
+adjLsaCompare(AdjLsa& alsa1, AdjLsa& alsa2){
+	return alsa1.getLsaKey()==alsa1.getLsaKey();
+}
+
+static bool
+adjLsaCompareByKey(AdjLsa& alsa, string& key){
+	return alsa.getLsaKey()==key;
+}
+
+
+
+
+bool 
+Lsdb::doesAdjLsaExist(string key)
+{
+	std::list< AdjLsa >::iterator it = std::find_if( adjLsdb.begin(), 
+																		adjLsdb.end(),	
+   																	bind(adjLsaCompareByKey, _1, key));
+
+	if( it == adjLsdb.end()){
+		return false;
+	}
+
+	return true;
+}
+
+
diff --git a/nlsr_lsdb.hpp b/nlsr_lsdb.hpp
index 4c37fb0..0b0e664 100644
--- a/nlsr_lsdb.hpp
+++ b/nlsr_lsdb.hpp
@@ -16,21 +16,22 @@
 	
 	bool doesLsaExist(string key, int lsType);
 	// function related to Name LSDB 
-	bool buildAndInstallOwnNameLsa(nlsr& nlsr);
+	bool buildAndInstallOwnNameLsa(nlsr& pnlsr);
 	NameLsa& getNameLsa(string key);
 	bool installNameLsa(NameLsa &nlsa);
 	bool removeNameLsa(string& key);
 	void printNameLsdb(); //debugging
 
 	//function related to Cor LSDB
-	bool buildAndInstallOwnCorLsa(nlsr& nlsr);
+	bool buildAndInstallOwnCorLsa(nlsr& pnlsr);
 	CorLsa& getCorLsa(string key);
-	bool installCorLsa(CorLsa &nlsa);
+	bool installCorLsa(CorLsa &clsa);
 	bool removeCorLsa(string& key);
 	void printCorLsdb(); //debugging
 	
 private:
 	bool addNameLsa(NameLsa &nlsa);
+	bool addCorLsa(CorLsa& clsa);
 	bool doesNameLsaExist(string key);
 	bool doesAdjLsaExist(string key);
 	bool doesCorLsaExist(string key);