blob: 5961b98dd278dae8a063ede919d1d5651dcd47e5 [file] [log] [blame]
akmhoquebd7c8e62014-02-01 14:57:40 -06001#ifndef NLSR_LSDB_HPP
2#define NLSR_LSDB_HPP
3
4#include "nlsr_lsa.hpp"
5
6using namespace std;
7
8class nlsr;
9
10class Lsdb{
11public:
12 Lsdb()
13 {
14 }
15
16
17 bool doesLsaExist(string key, int lsType);
18 // function related to Name LSDB
akmhoque3c6bd922014-02-01 17:10:17 -060019 bool buildAndInstallOwnNameLsa(nlsr& pnlsr);
akmhoquebd7c8e62014-02-01 14:57:40 -060020 NameLsa& getNameLsa(string key);
21 bool installNameLsa(NameLsa &nlsa);
22 bool removeNameLsa(string& key);
23 void printNameLsdb(); //debugging
24
25 //function related to Cor LSDB
akmhoque3c6bd922014-02-01 17:10:17 -060026 bool buildAndInstallOwnCorLsa(nlsr& pnlsr);
akmhoquebd7c8e62014-02-01 14:57:40 -060027 CorLsa& getCorLsa(string key);
akmhoquef7c2c7c2014-02-06 11:32:43 -060028 bool installCorLsa(nlsr& pnlsr, CorLsa &clsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060029 bool removeCorLsa(string& key);
30 void printCorLsdb(); //debugging
akmhoquecd552472014-02-01 21:22:16 -060031
akmhoque79d355f2014-02-04 15:11:16 -060032 //function related to Adj LSDB
akmhoquecd552472014-02-01 21:22:16 -060033 void scheduledAdjLsaBuild(nlsr& pnlsr);
34 bool buildAndInstallOwnAdjLsa(nlsr& pnlsr);
35 bool removeAdjLsa(string& key);
akmhoquedfa4a5b2014-02-03 20:12:29 -060036 bool installAdjLsa(nlsr& pnlsr, AdjLsa &alsa);
akmhoquecd552472014-02-01 21:22:16 -060037 AdjLsa& getAdjLsa(string key);
akmhoque79d355f2014-02-04 15:11:16 -060038 std::list<AdjLsa>& getAdjLsdb();
akmhoquecd552472014-02-01 21:22:16 -060039 void printAdjLsdb();
akmhoquebd7c8e62014-02-01 14:57:40 -060040
41private:
42 bool addNameLsa(NameLsa &nlsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060043 bool doesNameLsaExist(string key);
akmhoquecd552472014-02-01 21:22:16 -060044
45 bool addCorLsa(CorLsa& clsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060046 bool doesCorLsaExist(string key);
47
akmhoquecd552472014-02-01 21:22:16 -060048 bool addAdjLsa(AdjLsa &alsa);
49 bool doesAdjLsaExist(string key);
50
51
akmhoquebd7c8e62014-02-01 14:57:40 -060052private:
53 std::list<NameLsa> nameLsdb;
54 std::list<AdjLsa> adjLsdb;
55 std::list<CorLsa> corLsdb;
56
57};
58
59#endif