akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 1 | #ifndef NLSR_FIB_ENTRY_HPP |
2 | #define NLSR_FIB_ENTRY_HPP | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 3 | |
4 | #include <list> | ||||
5 | #include <iostream> | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 6 | #include <boost/cstdint.hpp> |
7 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 8 | #include <ndn-cxx/util/scheduler.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 9 | |
10 | #include "nexthop.hpp" | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 11 | #include "nexthop-list.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 12 | |
13 | namespace nlsr { | ||||
14 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 15 | class FibEntry |
16 | { | ||||
17 | public: | ||||
18 | FibEntry() | ||||
19 | : m_name() | ||||
20 | , m_timeToRefresh(0) | ||||
21 | , m_seqNo(0) | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 22 | , m_nexthopList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 23 | { |
24 | } | ||||
25 | |||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 26 | FibEntry(const ndn::Name& name) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 27 | : m_timeToRefresh(0) |
28 | , m_seqNo(0) | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 29 | , m_nexthopList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 30 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 31 | m_name = name; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 32 | } |
33 | |||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 34 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 35 | getName() const |
36 | { | ||||
37 | return m_name; | ||||
38 | } | ||||
39 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 40 | NexthopList& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 41 | getNexthopList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 42 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 43 | return m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 44 | } |
45 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 46 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 47 | getTimeToRefresh() const |
48 | { | ||||
49 | return m_timeToRefresh; | ||||
50 | } | ||||
51 | |||||
52 | void | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 53 | setTimeToRefresh(int32_t ttr) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 71 | setSeqNo(int32_t fsn) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 72 | { |
73 | m_seqNo = fsn; | ||||
74 | } | ||||
75 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 76 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 77 | getSeqNo() |
78 | { | ||||
79 | return m_seqNo; | ||||
80 | } | ||||
81 | |||||
82 | bool | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 83 | isEqualNextHops(NexthopList& nhlOther); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 84 | |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame^] | 85 | void |
86 | writeLog(); | ||||
87 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 88 | private: |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 89 | ndn::Name m_name; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 90 | int32_t m_timeToRefresh; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 91 | ndn::EventId m_expiringEventId; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 92 | int32_t m_seqNo; |
93 | NexthopList m_nexthopList; | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 94 | }; |
95 | |||||
96 | std::ostream& | ||||
97 | operator<<(std::ostream& os, FibEntry fe); | ||||
98 | |||||
99 | } //namespace nlsr | ||||
100 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 101 | #endif //NLSR_FIB_ENTRY_HPP |