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 | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 22 | updateAdjacentStatus(const std::string& adjName, int s); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 23 | |
24 | int | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 25 | updateAdjacentLinkCost(const std::string& adjName, double lc); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 26 | |
27 | std::list<Adjacent>& | ||||
28 | getAdjList(); | ||||
29 | |||||
30 | bool | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 31 | isNeighbor(const std::string& adjName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 32 | |
33 | void | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 34 | incrementTimedOutInterestCount(const std::string& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 35 | |
36 | int | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 37 | getTimedOutInterestCount(const std::string& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 38 | |
39 | int | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 40 | getStatusOfNeighbor(const std::string& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 41 | |
42 | void | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 43 | setStatusOfNeighbor(const std::string& neighbor, int status); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 44 | |
45 | void | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 46 | setTimedOutInterestCount(const std::string& neighbor, int count); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 47 | |
48 | void | ||||
49 | addAdjacentsFromAdl(Adl& adl); | ||||
50 | |||||
51 | bool | ||||
52 | isAdjLsaBuildable(Nlsr& pnlsr); | ||||
53 | |||||
54 | int | ||||
55 | getNumOfActiveNeighbor(); | ||||
56 | |||||
57 | Adjacent | ||||
akmhoque | b6450b1 | 2014-04-24 00:01:03 -0500 | [diff] [blame^] | 58 | getAdjacent(const std::string& adjName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 |