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