blob: 50369d45dba60aef00d5d0f75c20dbde1ef4a4b2 [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -06001#ifndef NLSR_FIB_HPP
2#define NLSR_FIB_HPP
3
4#include <list>
5#include "nlsr_fe.hpp"
6
7namespace nlsr
8{
9
akmhoque5a44dd42014-03-12 18:11:32 -050010 class Nlsr;
akmhoqueba094742014-02-28 11:47:21 -060011
akmhoque5a44dd42014-03-12 18:11:32 -050012 using namespace std;
13 using namespace ndn;
akmhoqueba094742014-02-28 11:47:21 -060014
akmhoque5a44dd42014-03-12 18:11:32 -050015 class Fib
16 {
17 public:
18 Fib()
19 : fibTable()
20 , fibEntryRefreshTime(0)
akmhoqueba094742014-02-28 11:47:21 -060021 {
akmhoque5a44dd42014-03-12 18:11:32 -050022 }
akmhoqueba094742014-02-28 11:47:21 -060023
akmhoque5a44dd42014-03-12 18:11:32 -050024 void removeFromFib(Nlsr& pnlsr, string name);
25 void updateFib(Nlsr& pnlsr, string name, Nhl& nextHopList);
26 void cleanFib(Nlsr& pnlsr);
27 void setFibEntryRefreshTime(int fert)
28 {
29 fibEntryRefreshTime=fert;
30 }
akmhoqueba094742014-02-28 11:47:21 -060031
akmhoque5a44dd42014-03-12 18:11:32 -050032 void printFib();
akmhoqueba094742014-02-28 11:47:21 -060033
akmhoque5a44dd42014-03-12 18:11:32 -050034 private:
35 void removeFibEntryHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
36 int getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
37 ndn::EventId
38 scheduleFibEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
39 int refreshTime);
40 void cancelScheduledFeExpiringEvent(Nlsr& pnlsr, EventId eid);
41 void refreshFibEntry(string name, int feSeqNum);
akmhoqueba094742014-02-28 11:47:21 -060042
akmhoque5a44dd42014-03-12 18:11:32 -050043 private:
44 std::list<FibEntry> fibTable;
45 int fibEntryRefreshTime;
46 };
akmhoqueba094742014-02-28 11:47:21 -060047
48}//namespace nlsr
49#endif