blob: 3cac2fc197b2c700a6dddb0099a5c20f642ea3a0 [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -06001#ifndef NLSR_FE_HPP
2#define NLSR_FE_HPP
3
4#include<list>
5#include <iostream>
6#include <ndn-cpp-dev/util/scheduler.hpp>
7
8#include "nlsr_nexthop.hpp"
9#include "nlsr_nhl.hpp"
10
11namespace nlsr
12{
13
akmhoque5a44dd42014-03-12 18:11:32 -050014 using namespace std;
akmhoqueba094742014-02-28 11:47:21 -060015
akmhoque5a44dd42014-03-12 18:11:32 -050016 class FibEntry
17 {
18 public:
19 FibEntry()
akmhoque05d5fcf2014-04-15 14:58:45 -050020 : m_name()
21 , m_timeToRefresh(0)
22 , m_seqNo(0)
23 , m_nhl()
akmhoqueba094742014-02-28 11:47:21 -060024 {
akmhoque5a44dd42014-03-12 18:11:32 -050025 }
akmhoqueba094742014-02-28 11:47:21 -060026
akmhoque5a44dd42014-03-12 18:11:32 -050027 FibEntry(string n)
akmhoque05d5fcf2014-04-15 14:58:45 -050028 : m_timeToRefresh(0)
29 , m_seqNo(0)
30 , m_nhl()
akmhoque5a44dd42014-03-12 18:11:32 -050031 {
akmhoque05d5fcf2014-04-15 14:58:45 -050032 m_name=n;
akmhoque5a44dd42014-03-12 18:11:32 -050033 }
akmhoqueba094742014-02-28 11:47:21 -060034
akmhoque5a44dd42014-03-12 18:11:32 -050035 string getName()
36 {
akmhoque05d5fcf2014-04-15 14:58:45 -050037 return m_name;
akmhoque5a44dd42014-03-12 18:11:32 -050038 }
akmhoqueba094742014-02-28 11:47:21 -060039
akmhoque5a44dd42014-03-12 18:11:32 -050040 Nhl& getNhl()
41 {
akmhoque05d5fcf2014-04-15 14:58:45 -050042 return m_nhl;
akmhoque5a44dd42014-03-12 18:11:32 -050043 }
akmhoqueba094742014-02-28 11:47:21 -060044
akmhoque5a44dd42014-03-12 18:11:32 -050045 int getTimeToRefresh()
46 {
akmhoque05d5fcf2014-04-15 14:58:45 -050047 return m_timeToRefresh;
akmhoque5a44dd42014-03-12 18:11:32 -050048 }
akmhoqueba094742014-02-28 11:47:21 -060049
akmhoque5a44dd42014-03-12 18:11:32 -050050 void setTimeToRefresh(int ttr)
51 {
akmhoque05d5fcf2014-04-15 14:58:45 -050052 m_timeToRefresh=ttr;
akmhoque5a44dd42014-03-12 18:11:32 -050053 }
akmhoqueba094742014-02-28 11:47:21 -060054
akmhoque05d5fcf2014-04-15 14:58:45 -050055 void setExpiringEventId(ndn::EventId feid)
akmhoque5a44dd42014-03-12 18:11:32 -050056 {
akmhoque05d5fcf2014-04-15 14:58:45 -050057 m_expiringEventId=feid;
akmhoque5a44dd42014-03-12 18:11:32 -050058 }
akmhoqueba094742014-02-28 11:47:21 -060059
akmhoque05d5fcf2014-04-15 14:58:45 -050060 ndn::EventId getExpiringEventId()
akmhoque5a44dd42014-03-12 18:11:32 -050061 {
akmhoque05d5fcf2014-04-15 14:58:45 -050062 return m_expiringEventId;
akmhoque5a44dd42014-03-12 18:11:32 -050063 }
akmhoqueba094742014-02-28 11:47:21 -060064
akmhoque05d5fcf2014-04-15 14:58:45 -050065 void setSeqNo(int fsn)
akmhoque5a44dd42014-03-12 18:11:32 -050066 {
akmhoque05d5fcf2014-04-15 14:58:45 -050067 m_seqNo=fsn;
akmhoque5a44dd42014-03-12 18:11:32 -050068 }
akmhoqueba094742014-02-28 11:47:21 -060069
akmhoque05d5fcf2014-04-15 14:58:45 -050070 int getSeqNo()
akmhoque5a44dd42014-03-12 18:11:32 -050071 {
akmhoque05d5fcf2014-04-15 14:58:45 -050072 return m_seqNo;
akmhoque5a44dd42014-03-12 18:11:32 -050073 }
akmhoqueba094742014-02-28 11:47:21 -060074
akmhoque05d5fcf2014-04-15 14:58:45 -050075 bool isEqualNextHops(Nhl& nhlOther);
akmhoqueba094742014-02-28 11:47:21 -060076
akmhoque5a44dd42014-03-12 18:11:32 -050077 private:
akmhoque05d5fcf2014-04-15 14:58:45 -050078 string m_name;
79 int m_timeToRefresh;
80 ndn::EventId m_expiringEventId;
81 int m_seqNo;
82 Nhl m_nhl;
akmhoque5a44dd42014-03-12 18:11:32 -050083 };
akmhoqueba094742014-02-28 11:47:21 -060084
akmhoque5a44dd42014-03-12 18:11:32 -050085 ostream& operator<<(ostream& os,FibEntry fe);
akmhoqueba094742014-02-28 11:47:21 -060086
87} //namespace nlsr
88
89#endif