blob: ad85f01ebf62e26377f8e3127c697958ce3159bb [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#ifndef NLSR_ADL_HPP
2#define NLSR_ADL_HPP
3
4#include <ndn-cpp-dev/face.hpp>
5#include "nlsr_adjacent.hpp"
6#include<list>
7
akmhoque1fd8c1e2014-02-19 19:41:49 -06008namespace nlsr
9{
akmhoqueb1710aa2014-02-19 17:13:36 -060010
akmhoque5a44dd42014-03-12 18:11:32 -050011 class Nlsr;
akmhoque298385a2014-02-13 14:13:09 -060012
akmhoque5a44dd42014-03-12 18:11:32 -050013 using namespace std;
akmhoque298385a2014-02-13 14:13:09 -060014
akmhoque5a44dd42014-03-12 18:11:32 -050015 class Adl
16 {
17
18 public:
19 Adl();
20 ~Adl();
21 int insert(Adjacent& adj);
22 int updateAdjacentStatus(string adjName, int s);
23 int updateAdjacentLinkCost(string adjName, double lc);
24 std::list<Adjacent>& getAdjList();
25 bool isNeighbor(string adjName);
26 void incrementTimedOutInterestCount(string& neighbor);
27 int getTimedOutInterestCount(string& neighbor);
28 int getStatusOfNeighbor(string& neighbor);
29 void setStatusOfNeighbor(string& neighbor, int status);
30 void setTimedOutInterestCount(string& neighbor, int count);
31 void addAdjacentsFromAdl(Adl& adl);
32
33 bool isAdjLsaBuildable(Nlsr& pnlsr);
34 int getNumOfActiveNeighbor();
35 Adjacent getAdjacent(string adjName);
36
akmhoque05d5fcf2014-04-15 14:58:45 -050037 bool isEqual(Adl& adl);
akmhoque5a44dd42014-03-12 18:11:32 -050038
akmhoque05d5fcf2014-04-15 14:58:45 -050039 int getSize()
akmhoque1fd8c1e2014-02-19 19:41:49 -060040 {
akmhoque05d5fcf2014-04-15 14:58:45 -050041 return m_adjList.size();
akmhoque5a44dd42014-03-12 18:11:32 -050042 }
akmhoque298385a2014-02-13 14:13:09 -060043
akmhoque05d5fcf2014-04-15 14:58:45 -050044 void reset()
akmhoque5a44dd42014-03-12 18:11:32 -050045 {
akmhoque05d5fcf2014-04-15 14:58:45 -050046 if( m_adjList.size() > 0 )
akmhoque5a44dd42014-03-12 18:11:32 -050047 {
akmhoque05d5fcf2014-04-15 14:58:45 -050048 m_adjList.clear();
akmhoque5a44dd42014-03-12 18:11:32 -050049 }
50 }
akmhoque298385a2014-02-13 14:13:09 -060051
akmhoque5a44dd42014-03-12 18:11:32 -050052 void printAdl();
akmhoque298385a2014-02-13 14:13:09 -060053
akmhoque5a44dd42014-03-12 18:11:32 -050054 private:
akmhoque05d5fcf2014-04-15 14:58:45 -050055 std::list< Adjacent > m_adjList;
akmhoque5a44dd42014-03-12 18:11:32 -050056 };
akmhoque298385a2014-02-13 14:13:09 -060057
akmhoqueb1710aa2014-02-19 17:13:36 -060058} //namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -060059#endif