blob: 35da960ff33fec49d27e1bba122c75bb64688659 [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>
akmhoquec7a79b22014-05-26 08:06:19 -05009#include <ndn-cxx/util/time.hpp>
akmhoque53353462014-04-22 08:43:45 -050010
11#include "nexthop.hpp"
akmhoquec8a10f72014-04-25 18:42:55 -050012#include "nexthop-list.hpp"
akmhoque53353462014-04-22 08:43:45 -050013
14namespace nlsr {
15
akmhoque53353462014-04-22 08:43:45 -050016class FibEntry
17{
18public:
19 FibEntry()
20 : m_name()
akmhoquec7a79b22014-05-26 08:06:19 -050021 , m_expirationTimePoint()
akmhoque53353462014-04-22 08:43:45 -050022 , m_seqNo(0)
akmhoquefdbddb12014-05-02 18:35:19 -050023 , m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050024 {
25 }
26
akmhoque31d1d4b2014-05-05 22:08:14 -050027 FibEntry(const ndn::Name& name)
akmhoquec7a79b22014-05-26 08:06:19 -050028 : m_expirationTimePoint()
akmhoque53353462014-04-22 08:43:45 -050029 , m_seqNo(0)
akmhoquefdbddb12014-05-02 18:35:19 -050030 , m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050031 {
akmhoquefdbddb12014-05-02 18:35:19 -050032 m_name = name;
akmhoque53353462014-04-22 08:43:45 -050033 }
34
akmhoque31d1d4b2014-05-05 22:08:14 -050035 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050036 getName() const
37 {
38 return m_name;
39 }
40
akmhoquec8a10f72014-04-25 18:42:55 -050041 NexthopList&
akmhoquefdbddb12014-05-02 18:35:19 -050042 getNexthopList()
akmhoque53353462014-04-22 08:43:45 -050043 {
akmhoquefdbddb12014-05-02 18:35:19 -050044 return m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050045 }
46
akmhoquec7a79b22014-05-26 08:06:19 -050047 const ndn::time::system_clock::TimePoint&
48 getExpirationTimePoint() const
akmhoque53353462014-04-22 08:43:45 -050049 {
akmhoquec7a79b22014-05-26 08:06:19 -050050 return m_expirationTimePoint;
akmhoque53353462014-04-22 08:43:45 -050051 }
52
53 void
akmhoquec7a79b22014-05-26 08:06:19 -050054 setExpirationTimePoint(const ndn::time::system_clock::TimePoint& ttr)
akmhoque53353462014-04-22 08:43:45 -050055 {
akmhoquec7a79b22014-05-26 08:06:19 -050056 m_expirationTimePoint = ttr;
akmhoque53353462014-04-22 08:43:45 -050057 }
58
59 void
60 setExpiringEventId(ndn::EventId feid)
61 {
62 m_expiringEventId = feid;
63 }
64
65 ndn::EventId
66 getExpiringEventId() const
67 {
68 return m_expiringEventId;
69 }
70
71 void
akmhoquefdbddb12014-05-02 18:35:19 -050072 setSeqNo(int32_t fsn)
akmhoque53353462014-04-22 08:43:45 -050073 {
74 m_seqNo = fsn;
75 }
76
akmhoquefdbddb12014-05-02 18:35:19 -050077 int32_t
akmhoque53353462014-04-22 08:43:45 -050078 getSeqNo()
79 {
80 return m_seqNo;
81 }
82
83 bool
akmhoquec8a10f72014-04-25 18:42:55 -050084 isEqualNextHops(NexthopList& nhlOther);
akmhoque53353462014-04-22 08:43:45 -050085
akmhoque674b0b12014-05-20 14:33:28 -050086 void
87 writeLog();
88
akmhoque53353462014-04-22 08:43:45 -050089private:
akmhoque31d1d4b2014-05-05 22:08:14 -050090 ndn::Name m_name;
akmhoquec7a79b22014-05-26 08:06:19 -050091 ndn::time::system_clock::TimePoint m_expirationTimePoint;
akmhoque53353462014-04-22 08:43:45 -050092 ndn::EventId m_expiringEventId;
akmhoquefdbddb12014-05-02 18:35:19 -050093 int32_t m_seqNo;
94 NexthopList m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050095};
96
97std::ostream&
98operator<<(std::ostream& os, FibEntry fe);
99
100} //namespace nlsr
101
akmhoquefdbddb12014-05-02 18:35:19 -0500102#endif //NLSR_FIB_ENTRY_HPP