akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #include <string> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 2 | #include <boost/cstdint.hpp> |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 3 | #include <ndn-cxx/face.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 4 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 5 | #ifndef NLSR_ADJACENT_HPP |
| 6 | #define NLSR_ADJACENT_HPP |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 7 | |
| 8 | namespace nlsr { |
| 9 | class Adjacent |
| 10 | { |
| 11 | |
| 12 | public: |
| 13 | Adjacent() |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 14 | : m_name() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 15 | , m_connectingFace(0) |
| 16 | , m_linkCost(10.0) |
| 17 | , m_status(0) |
| 18 | , m_interestTimedOutNo(0) |
| 19 | { |
| 20 | } |
| 21 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 22 | Adjacent(const ndn::Name& an) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 23 | : m_connectingFace(0) |
| 24 | , m_linkCost(0.0) |
| 25 | , m_status(0) |
| 26 | , m_interestTimedOutNo(0) |
| 27 | { |
| 28 | m_name = an; |
| 29 | } |
| 30 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 31 | Adjacent(const ndn::Name& an, uint32_t cf, double lc, uint32_t s, |
| 32 | uint32_t iton); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 33 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 34 | const ndn::Name& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 35 | getName() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 36 | { |
| 37 | return m_name; |
| 38 | } |
| 39 | |
| 40 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 41 | setName(const ndn::Name& an) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 42 | { |
| 43 | m_name = an; |
| 44 | } |
| 45 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 46 | uint32_t |
| 47 | getConnectingFace() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 48 | { |
| 49 | return m_connectingFace; |
| 50 | } |
| 51 | |
| 52 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 53 | setConnectingFace(uint32_t cf) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 54 | { |
| 55 | m_connectingFace = cf; |
| 56 | } |
| 57 | |
| 58 | double |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 59 | getLinkCost() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 60 | { |
| 61 | return m_linkCost; |
| 62 | } |
| 63 | |
| 64 | void |
| 65 | setLinkCost(double lc) |
| 66 | { |
| 67 | m_linkCost = lc; |
| 68 | } |
| 69 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 70 | uint32_t |
| 71 | getStatus() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 72 | { |
| 73 | return m_status; |
| 74 | } |
| 75 | |
| 76 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 77 | setStatus(uint32_t s) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 78 | { |
| 79 | m_status = s; |
| 80 | } |
| 81 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 82 | uint32_t |
| 83 | getInterestTimedOutNo() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 84 | { |
| 85 | return m_interestTimedOutNo; |
| 86 | } |
| 87 | |
| 88 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 89 | setInterestTimedOutNo(uint32_t iton) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 90 | { |
| 91 | m_interestTimedOutNo = iton; |
| 92 | } |
| 93 | |
| 94 | bool |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 95 | operator==(const Adjacent& adjacent) const; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 96 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 97 | bool |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 98 | compare(const ndn::Name& adjacencyName); |
| 99 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 100 | private: |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 101 | ndn::Name m_name; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 102 | uint32_t m_connectingFace; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 103 | double m_linkCost; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 104 | uint32_t m_status; |
| 105 | uint32_t m_interestTimedOutNo; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 106 | }; |
| 107 | |
| 108 | std::ostream& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 109 | operator<<(std::ostream& os, const Adjacent& adj); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 110 | |
| 111 | } // namespace nlsr |
| 112 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 113 | #endif //NLSR_ADJACENT_HPP |