blob: 5d278eaffc985ce80c5b29c55a9dc9ff07fdc131 [file] [log] [blame]
akmhoquebd7c8e62014-02-01 14:57:40 -06001#ifndef NLSR_LSDB_HPP
2#define NLSR_LSDB_HPP
3
akmhoque62a8e402014-02-08 12:00:27 -06004#include <utility>
akmhoquebd7c8e62014-02-01 14:57:40 -06005#include "nlsr_lsa.hpp"
6
7using namespace std;
8
9class nlsr;
10
11class Lsdb{
12public:
13 Lsdb()
14 {
15 }
16
17
18 bool doesLsaExist(string key, int lsType);
19 // function related to Name LSDB
akmhoque3c6bd922014-02-01 17:10:17 -060020 bool buildAndInstallOwnNameLsa(nlsr& pnlsr);
akmhoque62a8e402014-02-08 12:00:27 -060021 std::pair<NameLsa&, bool> getNameLsa(string key);
22 bool installNameLsa(nlsr& pnlsr, NameLsa &nlsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060023 bool removeNameLsa(string& key);
24 void printNameLsdb(); //debugging
25
26 //function related to Cor LSDB
akmhoque3c6bd922014-02-01 17:10:17 -060027 bool buildAndInstallOwnCorLsa(nlsr& pnlsr);
akmhoque62a8e402014-02-08 12:00:27 -060028 std::pair<CorLsa&, bool> getCorLsa(string key);
akmhoquef7c2c7c2014-02-06 11:32:43 -060029 bool installCorLsa(nlsr& pnlsr, CorLsa &clsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060030 bool removeCorLsa(string& key);
31 void printCorLsdb(); //debugging
akmhoquecd552472014-02-01 21:22:16 -060032
akmhoque79d355f2014-02-04 15:11:16 -060033 //function related to Adj LSDB
akmhoquecd552472014-02-01 21:22:16 -060034 void scheduledAdjLsaBuild(nlsr& pnlsr);
35 bool buildAndInstallOwnAdjLsa(nlsr& pnlsr);
36 bool removeAdjLsa(string& key);
akmhoquedfa4a5b2014-02-03 20:12:29 -060037 bool installAdjLsa(nlsr& pnlsr, AdjLsa &alsa);
akmhoque62a8e402014-02-08 12:00:27 -060038 std::pair<AdjLsa& , bool> getAdjLsa(string key);
akmhoque79d355f2014-02-04 15:11:16 -060039 std::list<AdjLsa>& getAdjLsdb();
akmhoquecd552472014-02-01 21:22:16 -060040 void printAdjLsdb();
akmhoquebd7c8e62014-02-01 14:57:40 -060041
42private:
43 bool addNameLsa(NameLsa &nlsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060044 bool doesNameLsaExist(string key);
akmhoquecd552472014-02-01 21:22:16 -060045
46 bool addCorLsa(CorLsa& clsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060047 bool doesCorLsaExist(string key);
48
akmhoquecd552472014-02-01 21:22:16 -060049 bool addAdjLsa(AdjLsa &alsa);
50 bool doesAdjLsaExist(string key);
51
52
akmhoquebd7c8e62014-02-01 14:57:40 -060053private:
54 std::list<NameLsa> nameLsdb;
55 std::list<AdjLsa> adjLsdb;
56 std::list<CorLsa> corLsdb;
57
58};
59
60#endif