akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame^] | 1 | #ifndef NLSR_ADL_HPP |
| 2 | #define NLSR_ADL_HPP |
| 3 | |
| 4 | #include <ndn-cpp-dev/face.hpp> |
| 5 | #include "adjacent.hpp" |
| 6 | #include <list> |
| 7 | |
| 8 | namespace nlsr { |
| 9 | class Nlsr; |
| 10 | |
| 11 | class Adl |
| 12 | { |
| 13 | |
| 14 | public: |
| 15 | Adl(); |
| 16 | ~Adl(); |
| 17 | |
| 18 | int |
| 19 | insert(Adjacent& adj); |
| 20 | |
| 21 | int |
| 22 | updateAdjacentStatus(std::string adjName, int s); |
| 23 | |
| 24 | int |
| 25 | updateAdjacentLinkCost(std::string adjName, double lc); |
| 26 | |
| 27 | std::list<Adjacent>& |
| 28 | getAdjList(); |
| 29 | |
| 30 | bool |
| 31 | isNeighbor(std::string adjName); |
| 32 | |
| 33 | void |
| 34 | incrementTimedOutInterestCount(std::string& neighbor); |
| 35 | |
| 36 | int |
| 37 | getTimedOutInterestCount(std::string& neighbor); |
| 38 | |
| 39 | int |
| 40 | getStatusOfNeighbor(std::string& neighbor); |
| 41 | |
| 42 | void |
| 43 | setStatusOfNeighbor(std::string& neighbor, int status); |
| 44 | |
| 45 | void |
| 46 | setTimedOutInterestCount(std::string& neighbor, int count); |
| 47 | |
| 48 | void |
| 49 | addAdjacentsFromAdl(Adl& adl); |
| 50 | |
| 51 | bool |
| 52 | isAdjLsaBuildable(Nlsr& pnlsr); |
| 53 | |
| 54 | int |
| 55 | getNumOfActiveNeighbor(); |
| 56 | |
| 57 | Adjacent |
| 58 | getAdjacent(std::string adjName); |
| 59 | |
| 60 | bool |
| 61 | isEqual(Adl& adl); |
| 62 | |
| 63 | int |
| 64 | getSize() |
| 65 | { |
| 66 | return m_adjList.size(); |
| 67 | } |
| 68 | |
| 69 | void |
| 70 | reset() |
| 71 | { |
| 72 | if (m_adjList.size() > 0) |
| 73 | { |
| 74 | m_adjList.clear(); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void |
| 79 | printAdl(); |
| 80 | |
| 81 | private: |
| 82 | std::list<Adjacent>::iterator |
| 83 | find(std::string adjName); |
| 84 | |
| 85 | private: |
| 86 | std::list<Adjacent> m_adjList; |
| 87 | }; |
| 88 | |
| 89 | } //namespace nlsr |
| 90 | #endif //NLSR_ADL_HPP |