blob: 45123df3cf4d5b3a0bfa308007b477a28993e76c [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#ifndef NLSR_ADL_HPP
2#define NLSR_ADL_HPP
3
akmhoquec8a10f72014-04-25 18:42:55 -05004#include <ndn-cxx/common.hpp>
akmhoque53353462014-04-22 08:43:45 -05005#include <list>
6
akmhoquec8a10f72014-04-25 18:42:55 -05007#include "adjacent.hpp"
8
akmhoque53353462014-04-22 08:43:45 -05009namespace nlsr {
10class Nlsr;
11
akmhoquec8a10f72014-04-25 18:42:55 -050012class AdjacencyList
akmhoque53353462014-04-22 08:43:45 -050013{
14
15public:
akmhoquec8a10f72014-04-25 18:42:55 -050016 AdjacencyList();
17 ~AdjacencyList();
akmhoque53353462014-04-22 08:43:45 -050018
19 int
20 insert(Adjacent& adj);
21
22 int
akmhoqueb6450b12014-04-24 00:01:03 -050023 updateAdjacentStatus(const std::string& adjName, int s);
akmhoque53353462014-04-22 08:43:45 -050024
25 int
akmhoqueb6450b12014-04-24 00:01:03 -050026 updateAdjacentLinkCost(const std::string& adjName, double lc);
akmhoque53353462014-04-22 08:43:45 -050027
28 std::list<Adjacent>&
29 getAdjList();
30
31 bool
akmhoqueb6450b12014-04-24 00:01:03 -050032 isNeighbor(const std::string& adjName);
akmhoque53353462014-04-22 08:43:45 -050033
34 void
akmhoqueb6450b12014-04-24 00:01:03 -050035 incrementTimedOutInterestCount(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050036
37 int
akmhoqueb6450b12014-04-24 00:01:03 -050038 getTimedOutInterestCount(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050039
40 int
akmhoqueb6450b12014-04-24 00:01:03 -050041 getStatusOfNeighbor(const std::string& neighbor);
akmhoque53353462014-04-22 08:43:45 -050042
43 void
akmhoqueb6450b12014-04-24 00:01:03 -050044 setStatusOfNeighbor(const std::string& neighbor, int status);
akmhoque53353462014-04-22 08:43:45 -050045
46 void
akmhoqueb6450b12014-04-24 00:01:03 -050047 setTimedOutInterestCount(const std::string& neighbor, int count);
akmhoque53353462014-04-22 08:43:45 -050048
49 void
akmhoquec8a10f72014-04-25 18:42:55 -050050 addAdjacentsFromAdl(AdjacencyList& adl);
akmhoque53353462014-04-22 08:43:45 -050051
52 bool
53 isAdjLsaBuildable(Nlsr& pnlsr);
54
55 int
56 getNumOfActiveNeighbor();
57
58 Adjacent
akmhoqueb6450b12014-04-24 00:01:03 -050059 getAdjacent(const std::string& adjName);
akmhoque53353462014-04-22 08:43:45 -050060
61 bool
akmhoquec8a10f72014-04-25 18:42:55 -050062 isEqual(AdjacencyList& adl);
akmhoque53353462014-04-22 08:43:45 -050063
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
akmhoquec8a10f72014-04-25 18:42:55 -050080 print();
akmhoque53353462014-04-22 08:43:45 -050081
82private:
83 std::list<Adjacent>::iterator
84 find(std::string adjName);
85
86private:
87 std::list<Adjacent> m_adjList;
88};
89
90} //namespace nlsr
91#endif //NLSR_ADL_HPP