akmhoque | fd1dd0a | 2014-02-01 01:11:35 -0600 | [diff] [blame^] | 1 | #ifndef NLSR_LSA_HPP |
| 2 | #define NLSR_LSA_HPP |
| 3 | |
| 4 | #include "nlsr_adjacent.hpp" |
| 5 | #include "nlsr_npl.hpp" |
| 6 | #include "nlsr_adl.hpp" |
| 7 | |
| 8 | using namespace std; |
| 9 | |
| 10 | class Lsa{ |
| 11 | public: |
| 12 | Lsa() |
| 13 | : origRouter() |
| 14 | , lsSeqNo() |
| 15 | , lifeTime() |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | |
| 20 | void setLsType(uint8_t lst) |
| 21 | { |
| 22 | lsType=lst; |
| 23 | } |
| 24 | |
| 25 | uint8_t getLsType() |
| 26 | { |
| 27 | return lsType; |
| 28 | } |
| 29 | |
| 30 | void setLsSeqNo(uint32_t lsn) |
| 31 | { |
| 32 | lsSeqNo=lsn; |
| 33 | } |
| 34 | |
| 35 | uint32_t getLsSeqNo() |
| 36 | { |
| 37 | return lsSeqNo; |
| 38 | } |
| 39 | |
| 40 | string& getOrigRouter() |
| 41 | { |
| 42 | return origRouter; |
| 43 | } |
| 44 | |
| 45 | void setOrigRouter(string& org) |
| 46 | { |
| 47 | origRouter=org; |
| 48 | } |
| 49 | |
| 50 | uint32_t getLifeTime() |
| 51 | { |
| 52 | return lifeTime; |
| 53 | } |
| 54 | |
| 55 | void setLifeTime(uint32_t lt) |
| 56 | { |
| 57 | lifeTime=lt; |
| 58 | } |
| 59 | string getLsaKey(); |
| 60 | protected: |
| 61 | string origRouter; |
| 62 | uint8_t lsType; |
| 63 | uint32_t lsSeqNo; |
| 64 | uint32_t lifeTime; |
| 65 | }; |
| 66 | |
| 67 | class NameLsa:Lsa{ |
| 68 | public: |
| 69 | NameLsa() |
| 70 | : Lsa() |
| 71 | , npl() |
| 72 | { |
| 73 | setLsType(1); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | Npl& getNpl(){ |
| 78 | return npl; |
| 79 | } |
| 80 | |
| 81 | void addNameToLsa(string& name) |
| 82 | { |
| 83 | npl.insertIntoNpl(name); |
| 84 | } |
| 85 | |
| 86 | string getNameLsaData(); |
| 87 | |
| 88 | private: |
| 89 | Npl npl; |
| 90 | |
| 91 | }; |
| 92 | |
| 93 | class AdjLsa:Lsa{ |
| 94 | public: |
| 95 | AdjLsa() |
| 96 | : Lsa() |
| 97 | , adl() |
| 98 | { |
| 99 | } |
| 100 | |
| 101 | private: |
| 102 | uint32_t noLink; |
| 103 | Adl adl; |
| 104 | }; |
| 105 | |
| 106 | class CorLsa:Lsa{ |
| 107 | public: |
| 108 | CorLsa() |
| 109 | :Lsa() |
| 110 | { |
| 111 | } |
| 112 | private: |
| 113 | double corRad; |
| 114 | double corTheta; |
| 115 | |
| 116 | }; |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | #endif |