blob: 9ba0729c45ed258819018e0dd5cb7a2af26173d4 [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);
akmhoque4768f892014-02-08 23:58:07 -060023 bool removeNameLsa(nlsr& pnlsr, string& key);
akmhoquebd7c8e62014-02-01 14:57:40 -060024 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);
akmhoque4768f892014-02-08 23:58:07 -060030 bool removeCorLsa(nlsr& pnlsr, string& key);
akmhoquebd7c8e62014-02-01 14:57:40 -060031 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);
akmhoque4768f892014-02-08 23:58:07 -060036 bool removeAdjLsa(nlsr& pnlsr, 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
akmhoque4768f892014-02-08 23:58:07 -060046
akmhoquecd552472014-02-01 21:22:16 -060047 bool addCorLsa(CorLsa& clsa);
akmhoquebd7c8e62014-02-01 14:57:40 -060048 bool doesCorLsaExist(string key);
49
akmhoquecd552472014-02-01 21:22:16 -060050 bool addAdjLsa(AdjLsa &alsa);
51 bool doesAdjLsaExist(string key);
52
53
akmhoquebd7c8e62014-02-01 14:57:40 -060054private:
55 std::list<NameLsa> nameLsdb;
56 std::list<AdjLsa> adjLsdb;
57 std::list<CorLsa> corLsdb;
58
59};
60
61#endif