akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 1 | #ifndef NLSR_LSDB_HPP |
| 2 | #define NLSR_LSDB_HPP |
| 3 | |
| 4 | #include "nlsr_lsa.hpp" |
| 5 | |
| 6 | using namespace std; |
| 7 | |
| 8 | class nlsr; |
| 9 | |
| 10 | class Lsdb{ |
| 11 | public: |
| 12 | Lsdb() |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | |
| 17 | bool doesLsaExist(string key, int lsType); |
| 18 | // function related to Name LSDB |
akmhoque | 3c6bd92 | 2014-02-01 17:10:17 -0600 | [diff] [blame] | 19 | bool buildAndInstallOwnNameLsa(nlsr& pnlsr); |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 20 | 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 |
akmhoque | 3c6bd92 | 2014-02-01 17:10:17 -0600 | [diff] [blame] | 26 | bool buildAndInstallOwnCorLsa(nlsr& pnlsr); |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 27 | CorLsa& getCorLsa(string key); |
akmhoque | 3c6bd92 | 2014-02-01 17:10:17 -0600 | [diff] [blame] | 28 | bool installCorLsa(CorLsa &clsa); |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 29 | bool removeCorLsa(string& key); |
| 30 | void printCorLsdb(); //debugging |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 31 | |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 32 | //function related to Adj LSDB |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 33 | void scheduledAdjLsaBuild(nlsr& pnlsr); |
| 34 | bool buildAndInstallOwnAdjLsa(nlsr& pnlsr); |
| 35 | bool removeAdjLsa(string& key); |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 36 | bool installAdjLsa(nlsr& pnlsr, AdjLsa &alsa); |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 37 | AdjLsa& getAdjLsa(string key); |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 38 | std::list<AdjLsa>& getAdjLsdb(); |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 39 | void printAdjLsdb(); |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 40 | |
| 41 | private: |
| 42 | bool addNameLsa(NameLsa &nlsa); |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 43 | bool doesNameLsaExist(string key); |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 44 | |
| 45 | bool addCorLsa(CorLsa& clsa); |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 46 | bool doesCorLsaExist(string key); |
| 47 | |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 48 | bool addAdjLsa(AdjLsa &alsa); |
| 49 | bool doesAdjLsaExist(string key); |
| 50 | |
| 51 | |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 52 | private: |
| 53 | std::list<NameLsa> nameLsdb; |
| 54 | std::list<AdjLsa> adjLsdb; |
| 55 | std::list<CorLsa> corLsdb; |
| 56 | |
| 57 | }; |
| 58 | |
| 59 | #endif |