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