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