blob: d320c9a9882ce9a676d1a981260231d631ea8130 [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#ifndef NLSR_FE_HPP
2#define NLSR_FE_HPP
3
4#include <list>
5#include <iostream>
akmhoquec8a10f72014-04-25 18:42:55 -05006#include <ndn-cxx/util/scheduler.hpp>
akmhoque53353462014-04-22 08:43:45 -05007
8#include "nexthop.hpp"
akmhoquec8a10f72014-04-25 18:42:55 -05009#include "nexthop-list.hpp"
akmhoque53353462014-04-22 08:43:45 -050010
11namespace nlsr {
12
13using namespace std;
14
15class FibEntry
16{
17public:
18 FibEntry()
19 : m_name()
20 , m_timeToRefresh(0)
21 , m_seqNo(0)
22 , m_nhl()
23 {
24 }
25
26 FibEntry(string n)
27 : m_timeToRefresh(0)
28 , m_seqNo(0)
29 , m_nhl()
30 {
31 m_name = n;
32 }
33
34 std::string
35 getName() const
36 {
37 return m_name;
38 }
39
akmhoquec8a10f72014-04-25 18:42:55 -050040 NexthopList&
akmhoque53353462014-04-22 08:43:45 -050041 getNhl()
42 {
43 return m_nhl;
44 }
45
46 int
47 getTimeToRefresh() const
48 {
49 return m_timeToRefresh;
50 }
51
52 void
53 setTimeToRefresh(int ttr)
54 {
55 m_timeToRefresh = ttr;
56 }
57
58 void
59 setExpiringEventId(ndn::EventId feid)
60 {
61 m_expiringEventId = feid;
62 }
63
64 ndn::EventId
65 getExpiringEventId() const
66 {
67 return m_expiringEventId;
68 }
69
70 void
71 setSeqNo(int fsn)
72 {
73 m_seqNo = fsn;
74 }
75
76 int
77 getSeqNo()
78 {
79 return m_seqNo;
80 }
81
82 bool
akmhoquec8a10f72014-04-25 18:42:55 -050083 isEqualNextHops(NexthopList& nhlOther);
akmhoque53353462014-04-22 08:43:45 -050084
85private:
86 std::string m_name;
87 int m_timeToRefresh;
88 ndn::EventId m_expiringEventId;
89 int m_seqNo;
akmhoquec8a10f72014-04-25 18:42:55 -050090 NexthopList m_nhl;
akmhoque53353462014-04-22 08:43:45 -050091};
92
93std::ostream&
94operator<<(std::ostream& os, FibEntry fe);
95
96} //namespace nlsr
97
98#endif //NLSR_FE_HPP