blob: 76f9280dfebd3f8d63fce07adaca1828afc7430b [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#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
8namespace nlsr {
9class Nlsr;
10
11class Adl
12{
13
14public:
15 Adl();
16 ~Adl();
17
18 int
19 insert(Adjacent& adj);
20
21 int
akmhoqueb6450b12014-04-24 00:01:03 -050022 updateAdjacentStatus(const std::string& adjName, int s);
akmhoque53353462014-04-22 08:43:45 -050023
24 int
akmhoqueb6450b12014-04-24 00:01:03 -050025 updateAdjacentLinkCost(const std::string& adjName, double lc);
akmhoque53353462014-04-22 08:43:45 -050026
27 std::list<Adjacent>&
28 getAdjList();
29
30 bool
akmhoqueb6450b12014-04-24 00:01:03 -050031 isNeighbor(const std::string& adjName);
akmhoque53353462014-04-22 08:43:45 -050032
33 void
akmhoqueb6450b12014-04-24 00:01:03 -050034 incrementTimedOutInterestCount(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050035
36 int
akmhoqueb6450b12014-04-24 00:01:03 -050037 getTimedOutInterestCount(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050038
39 int
akmhoqueb6450b12014-04-24 00:01:03 -050040 getStatusOfNeighbor(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050041
42 void
akmhoqueb6450b12014-04-24 00:01:03 -050043 setStatusOfNeighbor(const std::string& neighbor, int status);
akmhoque53353462014-04-22 08:43:45 -050044
45 void
akmhoqueb6450b12014-04-24 00:01:03 -050046 setTimedOutInterestCount(const std::string& neighbor, int count);
akmhoque53353462014-04-22 08:43:45 -050047
48 void
49 addAdjacentsFromAdl(Adl& adl);
50
51 bool
52 isAdjLsaBuildable(Nlsr& pnlsr);
53
54 int
55 getNumOfActiveNeighbor();
56
57 Adjacent
akmhoqueb6450b12014-04-24 00:01:03 -050058 getAdjacent(const std::string& adjName);
akmhoque53353462014-04-22 08:43:45 -050059
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
81private:
82 std::list<Adjacent>::iterator
83 find(std::string adjName);
84
85private:
86 std::list<Adjacent> m_adjList;
87};
88
89} //namespace nlsr
90#endif //NLSR_ADL_HPP