blob: 88de53e333cf5ff3cea33d0fcc406e035af0fad8 [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
akmhoquefdbddb12014-05-02 18:35:19 -050026 FibEntry(const std::string& 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
akmhoquefdbddb12014-05-02 18:35:19 -050034 const std::string&
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
85private:
86 std::string m_name;
akmhoquefdbddb12014-05-02 18:35:19 -050087 int32_t m_timeToRefresh;
akmhoque53353462014-04-22 08:43:45 -050088 ndn::EventId m_expiringEventId;
akmhoquefdbddb12014-05-02 18:35:19 -050089 int32_t m_seqNo;
90 NexthopList m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050091};
92
93std::ostream&
94operator<<(std::ostream& os, FibEntry fe);
95
96} //namespace nlsr
97
akmhoquefdbddb12014-05-02 18:35:19 -050098#endif //NLSR_FIB_ENTRY_HPP