blob: b36d0d8f8883b2d3eedb0041d04346dc75a1d1a7 [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()
akmhoque05d5fcf2014-04-15 14:58:45 -050019 : m_table()
20 , m_refreshTime(0)
akmhoqueba094742014-02-28 11:47:21 -060021 {
akmhoque5a44dd42014-03-12 18:11:32 -050022 }
akmhoqueba094742014-02-28 11:47:21 -060023
akmhoque05d5fcf2014-04-15 14:58:45 -050024 void remove(Nlsr& pnlsr, string name);
25 void update(Nlsr& pnlsr, string name, Nhl& nextHopList);
26 void clean(Nlsr& pnlsr);
27 void setEntryRefreshTime(int fert)
akmhoque5a44dd42014-03-12 18:11:32 -050028 {
akmhoque05d5fcf2014-04-15 14:58:45 -050029 m_refreshTime=fert;
akmhoque5a44dd42014-03-12 18:11:32 -050030 }
akmhoqueba094742014-02-28 11:47:21 -060031
akmhoque05d5fcf2014-04-15 14:58:45 -050032 void print();
akmhoqueba094742014-02-28 11:47:21 -060033
akmhoque5a44dd42014-03-12 18:11:32 -050034 private:
akmhoque05d5fcf2014-04-15 14:58:45 -050035 void removeHop(Nlsr& pnlsr, Nhl& nl, int doNotRemoveHopFaceId);
akmhoque5a44dd42014-03-12 18:11:32 -050036 int getNumberOfFacesForName(Nhl& nextHopList, int maxFacesPerPrefix);
37 ndn::EventId
akmhoque05d5fcf2014-04-15 14:58:45 -050038 scheduleEntryRefreshing(Nlsr& pnlsr, string name, int feSeqNum,
akmhoque5a44dd42014-03-12 18:11:32 -050039 int refreshTime);
akmhoque05d5fcf2014-04-15 14:58:45 -050040 void cancelScheduledExpiringEvent(Nlsr& pnlsr, EventId eid);
41 void refreshEntry(string name, int feSeqNum);
akmhoqueba094742014-02-28 11:47:21 -060042
akmhoque5a44dd42014-03-12 18:11:32 -050043 private:
akmhoque05d5fcf2014-04-15 14:58:45 -050044 std::list<FibEntry> m_table;
45 int m_refreshTime;
akmhoque5a44dd42014-03-12 18:11:32 -050046 };
akmhoqueba094742014-02-28 11:47:21 -060047
48}//namespace nlsr
49#endif