akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 1 | #ifndef NLSR_ADJACENCY_LIST_HPP |
2 | #define NLSR_ADJACENCY_LIST_HPP | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 3 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 4 | #include <list> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 5 | #include <boost/cstdint.hpp> |
6 | #include <ndn-cxx/common.hpp> | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 7 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 8 | #include "adjacent.hpp" |
9 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 10 | namespace nlsr { |
11 | class Nlsr; | ||||
12 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 13 | class AdjacencyList |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 14 | { |
15 | |||||
16 | public: | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 17 | AdjacencyList(); |
18 | ~AdjacencyList(); | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 19 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 20 | int32_t |
21 | insert(Adjacent& adjacent); | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 22 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 23 | int32_t |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 24 | updateAdjacentStatus(const ndn::Name& adjName, int32_t s); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 25 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 26 | int32_t |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 27 | updateAdjacentLinkCost(const ndn::Name& adjName, double lc); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 28 | |
29 | std::list<Adjacent>& | ||||
30 | getAdjList(); | ||||
31 | |||||
32 | bool | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 33 | isNeighbor(const ndn::Name& adjName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | |
35 | void | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 36 | incrementTimedOutInterestCount(const ndn::Name& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 37 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 38 | int32_t |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 39 | getTimedOutInterestCount(const ndn::Name& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 40 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 41 | uint32_t |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 42 | getStatusOfNeighbor(const ndn::Name& neighbor); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 43 | |
44 | void | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 45 | setStatusOfNeighbor(const ndn::Name& neighbor, int32_t status); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 46 | |
47 | void | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 48 | setTimedOutInterestCount(const ndn::Name& neighbor, uint32_t count); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 49 | |
50 | void | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 51 | addAdjacents(AdjacencyList& adl); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 52 | |
53 | bool | ||||
54 | isAdjLsaBuildable(Nlsr& pnlsr); | ||||
55 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 56 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 57 | getNumOfActiveNeighbor(); |
58 | |||||
59 | Adjacent | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 60 | getAdjacent(const ndn::Name& adjName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 61 | |
62 | bool | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 63 | operator==(AdjacencyList& adl); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 64 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 65 | size_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 66 | getSize() |
67 | { | ||||
68 | return m_adjList.size(); | ||||
69 | } | ||||
70 | |||||
71 | void | ||||
72 | reset() | ||||
73 | { | ||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 74 | if (m_adjList.size() > 0) { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 | |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame^] | 82 | void |
83 | writeLog(); | ||||
84 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 85 | private: |
86 | std::list<Adjacent>::iterator | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 87 | find(const ndn::Name& adjName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 88 | |
89 | private: | ||||
90 | std::list<Adjacent> m_adjList; | ||||
91 | }; | ||||
92 | |||||
93 | } //namespace nlsr | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 94 | #endif //NLSR_ADJACENCY_LIST_HPP |