blob: 14d37728d8a4264f571a978ba2cd31fa24d128d5 [file] [log] [blame]
akmhoquefdbddb12014-05-02 18:35:19 -05001#ifndef NLSR_FIB_ENTRY_HPP
2#define NLSR_FIB_ENTRY_HPP
akmhoque53353462014-04-22 08:43:45 -05003
4#include <list>
5#include <iostream>
akmhoquefdbddb12014-05-02 18:35:19 -05006#include <boost/cstdint.hpp>
7
akmhoquec8a10f72014-04-25 18:42:55 -05008#include <ndn-cxx/util/scheduler.hpp>
akmhoque53353462014-04-22 08:43:45 -05009
10#include "nexthop.hpp"
akmhoquec8a10f72014-04-25 18:42:55 -050011#include "nexthop-list.hpp"
akmhoque53353462014-04-22 08:43:45 -050012
13namespace nlsr {
14
akmhoque53353462014-04-22 08:43:45 -050015class FibEntry
16{
17public:
18 FibEntry()
19 : m_name()
20 , m_timeToRefresh(0)
21 , m_seqNo(0)
akmhoquefdbddb12014-05-02 18:35:19 -050022 , m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050023 {
24 }
25
akmhoque31d1d4b2014-05-05 22:08:14 -050026 FibEntry(const ndn::Name& name)
akmhoque53353462014-04-22 08:43:45 -050027 : m_timeToRefresh(0)
28 , m_seqNo(0)
akmhoquefdbddb12014-05-02 18:35:19 -050029 , m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050030 {
akmhoquefdbddb12014-05-02 18:35:19 -050031 m_name = name;
akmhoque53353462014-04-22 08:43:45 -050032 }
33
akmhoque31d1d4b2014-05-05 22:08:14 -050034 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050035 getName() const
36 {
37 return m_name;
38 }
39
akmhoquec8a10f72014-04-25 18:42:55 -050040 NexthopList&
akmhoquefdbddb12014-05-02 18:35:19 -050041 getNexthopList()
akmhoque53353462014-04-22 08:43:45 -050042 {
akmhoquefdbddb12014-05-02 18:35:19 -050043 return m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050044 }
45
akmhoquefdbddb12014-05-02 18:35:19 -050046 int32_t
akmhoque53353462014-04-22 08:43:45 -050047 getTimeToRefresh() const
48 {
49 return m_timeToRefresh;
50 }
51
52 void
akmhoquefdbddb12014-05-02 18:35:19 -050053 setTimeToRefresh(int32_t ttr)
akmhoque53353462014-04-22 08:43:45 -050054 {
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
akmhoquefdbddb12014-05-02 18:35:19 -050071 setSeqNo(int32_t fsn)
akmhoque53353462014-04-22 08:43:45 -050072 {
73 m_seqNo = fsn;
74 }
75
akmhoquefdbddb12014-05-02 18:35:19 -050076 int32_t
akmhoque53353462014-04-22 08:43:45 -050077 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
akmhoque674b0b12014-05-20 14:33:28 -050085 void
86 writeLog();
87
akmhoque53353462014-04-22 08:43:45 -050088private:
akmhoque31d1d4b2014-05-05 22:08:14 -050089 ndn::Name m_name;
akmhoquefdbddb12014-05-02 18:35:19 -050090 int32_t m_timeToRefresh;
akmhoque53353462014-04-22 08:43:45 -050091 ndn::EventId m_expiringEventId;
akmhoquefdbddb12014-05-02 18:35:19 -050092 int32_t m_seqNo;
93 NexthopList m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050094};
95
96std::ostream&
97operator<<(std::ostream& os, FibEntry fe);
98
99} //namespace nlsr
100
akmhoquefdbddb12014-05-02 18:35:19 -0500101#endif //NLSR_FIB_ENTRY_HPP