blob: a88a6baac2c4925c6045525dfb31ea5e1a715c23 [file] [log] [blame]
akmhoquefdbddb12014-05-02 18:35:19 -05001#ifndef NLSR_ADJACENCY_LIST_HPP
2#define NLSR_ADJACENCY_LIST_HPP
akmhoque53353462014-04-22 08:43:45 -05003
akmhoque53353462014-04-22 08:43:45 -05004#include <list>
akmhoquefdbddb12014-05-02 18:35:19 -05005#include <boost/cstdint.hpp>
6#include <ndn-cxx/common.hpp>
akmhoque53353462014-04-22 08:43:45 -05007
akmhoquec8a10f72014-04-25 18:42:55 -05008#include "adjacent.hpp"
9
akmhoque53353462014-04-22 08:43:45 -050010namespace nlsr {
11class Nlsr;
12
akmhoquec8a10f72014-04-25 18:42:55 -050013class AdjacencyList
akmhoque53353462014-04-22 08:43:45 -050014{
15
16public:
akmhoquec8a10f72014-04-25 18:42:55 -050017 AdjacencyList();
18 ~AdjacencyList();
akmhoque53353462014-04-22 08:43:45 -050019
akmhoquefdbddb12014-05-02 18:35:19 -050020 int32_t
21 insert(Adjacent& adjacent);
akmhoque53353462014-04-22 08:43:45 -050022
akmhoquefdbddb12014-05-02 18:35:19 -050023 int32_t
24 updateAdjacentStatus(const std::string& adjName, int32_t s);
akmhoque53353462014-04-22 08:43:45 -050025
akmhoquefdbddb12014-05-02 18:35:19 -050026 int32_t
akmhoqueb6450b12014-04-24 00:01:03 -050027 updateAdjacentLinkCost(const std::string& adjName, double lc);
akmhoque53353462014-04-22 08:43:45 -050028
29 std::list<Adjacent>&
30 getAdjList();
31
32 bool
akmhoqueb6450b12014-04-24 00:01:03 -050033 isNeighbor(const std::string& adjName);
akmhoque53353462014-04-22 08:43:45 -050034
35 void
akmhoqueb6450b12014-04-24 00:01:03 -050036 incrementTimedOutInterestCount(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050037
akmhoquefdbddb12014-05-02 18:35:19 -050038 int32_t
akmhoqueb6450b12014-04-24 00:01:03 -050039 getTimedOutInterestCount(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050040
akmhoquefdbddb12014-05-02 18:35:19 -050041 uint32_t
akmhoqueb6450b12014-04-24 00:01:03 -050042 getStatusOfNeighbor(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050043
44 void
akmhoquefdbddb12014-05-02 18:35:19 -050045 setStatusOfNeighbor(const std::string& neighbor, int32_t status);
akmhoque53353462014-04-22 08:43:45 -050046
47 void
akmhoquefdbddb12014-05-02 18:35:19 -050048 setTimedOutInterestCount(const std::string& neighbor, uint32_t count);
akmhoque53353462014-04-22 08:43:45 -050049
50 void
akmhoquefdbddb12014-05-02 18:35:19 -050051 addAdjacents(AdjacencyList& adl);
akmhoque53353462014-04-22 08:43:45 -050052
53 bool
54 isAdjLsaBuildable(Nlsr& pnlsr);
55
akmhoquefdbddb12014-05-02 18:35:19 -050056 int32_t
akmhoque53353462014-04-22 08:43:45 -050057 getNumOfActiveNeighbor();
58
59 Adjacent
akmhoqueb6450b12014-04-24 00:01:03 -050060 getAdjacent(const std::string& adjName);
akmhoque53353462014-04-22 08:43:45 -050061
62 bool
akmhoquefdbddb12014-05-02 18:35:19 -050063 operator==(AdjacencyList& adl);
akmhoque53353462014-04-22 08:43:45 -050064
akmhoquefdbddb12014-05-02 18:35:19 -050065 size_t
akmhoque53353462014-04-22 08:43:45 -050066 getSize()
67 {
68 return m_adjList.size();
69 }
70
71 void
72 reset()
73 {
74 if (m_adjList.size() > 0)
75 {
76 m_adjList.clear();
77 }
78 }
79
80 void
akmhoquec8a10f72014-04-25 18:42:55 -050081 print();
akmhoque53353462014-04-22 08:43:45 -050082
83private:
84 std::list<Adjacent>::iterator
85 find(std::string adjName);
86
87private:
88 std::list<Adjacent> m_adjList;
89};
90
91} //namespace nlsr
akmhoquefdbddb12014-05-02 18:35:19 -050092#endif //NLSR_ADJACENCY_LIST_HPP