blob: f0423626d475d37f5ca461214d4d0ff667dd10e3 [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#ifndef NLSR_FIB_HPP
2#define NLSR_FIB_HPP
3
4#include <list>
5#include "fib-entry.hpp"
6
7namespace nlsr {
8
9class Nlsr;
10
11using namespace std;
12using namespace ndn;
13
14class Fib
15{
16public:
17 Fib()
18 : m_table()
19 , m_refreshTime(0)
20 {
21 }
22
23 void
24 remove(Nlsr& pnlsr, string name);
25
26 void
27 update(Nlsr& pnlsr, string name, Nhl& nextHopList);
28
29 void
30 clean(Nlsr& pnlsr);
31
32 void
33 setEntryRefreshTime(int fert)
34 {
35 m_refreshTime = fert;
36 }
37
38 void
39 print();
40
41private:
42 void
43 removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
44
45 int
46 getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
47
48 ndn::EventId
49 scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
50 int refreshTime);
51 void
52 cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid);
53
54 void
55 refreshEntry(string name, int feSeqNum);
56
57private:
58 std::list<FibEntry> m_table;
59 int m_refreshTime;
60};
61
62}//namespace nlsr
63#endif //NLSR_FIB_HPP