blob: cbfb0fa216ca5619bda73040c09a249cbf56bd8c [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#include <string>
akmhoquefdbddb12014-05-02 18:35:19 -05002#include <boost/cstdint.hpp>
akmhoque31d1d4b2014-05-05 22:08:14 -05003#include <ndn-cxx/face.hpp>
akmhoque53353462014-04-22 08:43:45 -05004
akmhoquefdbddb12014-05-02 18:35:19 -05005#ifndef NLSR_ADJACENT_HPP
6#define NLSR_ADJACENT_HPP
akmhoque53353462014-04-22 08:43:45 -05007
8namespace nlsr {
akmhoque157b0a42014-05-13 00:26:37 -05009
10enum {
11 ADJACENT_STATUS_INACTIVE = 0,
12 ADJACENT_STATUS_ACTIVE = 1
13};
14
akmhoque53353462014-04-22 08:43:45 -050015class Adjacent
16{
17
18public:
akmhoque157b0a42014-05-13 00:26:37 -050019 Adjacent();
akmhoque53353462014-04-22 08:43:45 -050020
akmhoque157b0a42014-05-13 00:26:37 -050021 Adjacent(const ndn::Name& an);
akmhoque53353462014-04-22 08:43:45 -050022
akmhoque157b0a42014-05-13 00:26:37 -050023 Adjacent(const ndn::Name& an, const std::string& cfu, double lc,
24 uint32_t s, uint32_t iton);
akmhoque53353462014-04-22 08:43:45 -050025
akmhoque31d1d4b2014-05-05 22:08:14 -050026 const ndn::Name&
akmhoquefdbddb12014-05-02 18:35:19 -050027 getName() const
akmhoque53353462014-04-22 08:43:45 -050028 {
29 return m_name;
30 }
31
32 void
akmhoque31d1d4b2014-05-05 22:08:14 -050033 setName(const ndn::Name& an)
akmhoque53353462014-04-22 08:43:45 -050034 {
35 m_name = an;
36 }
37
akmhoque157b0a42014-05-13 00:26:37 -050038 const std::string&
39 getConnectingFaceUri() const
akmhoque53353462014-04-22 08:43:45 -050040 {
akmhoque157b0a42014-05-13 00:26:37 -050041 return m_connectingFaceUri;
akmhoque53353462014-04-22 08:43:45 -050042 }
43
44 void
akmhoque157b0a42014-05-13 00:26:37 -050045 setConnectingFaceUri(const std::string& cfu)
akmhoque53353462014-04-22 08:43:45 -050046 {
akmhoque157b0a42014-05-13 00:26:37 -050047 m_connectingFaceUri = cfu;
akmhoque53353462014-04-22 08:43:45 -050048 }
49
50 double
akmhoquefdbddb12014-05-02 18:35:19 -050051 getLinkCost() const
akmhoque53353462014-04-22 08:43:45 -050052 {
53 return m_linkCost;
54 }
55
56 void
57 setLinkCost(double lc)
58 {
59 m_linkCost = lc;
60 }
61
akmhoquefdbddb12014-05-02 18:35:19 -050062 uint32_t
63 getStatus() const
akmhoque53353462014-04-22 08:43:45 -050064 {
65 return m_status;
66 }
67
68 void
akmhoquefdbddb12014-05-02 18:35:19 -050069 setStatus(uint32_t s)
akmhoque53353462014-04-22 08:43:45 -050070 {
71 m_status = s;
72 }
73
akmhoquefdbddb12014-05-02 18:35:19 -050074 uint32_t
75 getInterestTimedOutNo() const
akmhoque53353462014-04-22 08:43:45 -050076 {
77 return m_interestTimedOutNo;
78 }
79
80 void
akmhoquefdbddb12014-05-02 18:35:19 -050081 setInterestTimedOutNo(uint32_t iton)
akmhoque53353462014-04-22 08:43:45 -050082 {
83 m_interestTimedOutNo = iton;
84 }
85
86 bool
akmhoquefdbddb12014-05-02 18:35:19 -050087 operator==(const Adjacent& adjacent) const;
akmhoque53353462014-04-22 08:43:45 -050088
akmhoquefdbddb12014-05-02 18:35:19 -050089 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050090 compare(const ndn::Name& adjacencyName);
91
akmhoque157b0a42014-05-13 00:26:37 -050092public:
93 static const float DEFAULT_LINK_COST;
94
akmhoque53353462014-04-22 08:43:45 -050095private:
akmhoque31d1d4b2014-05-05 22:08:14 -050096 ndn::Name m_name;
akmhoque157b0a42014-05-13 00:26:37 -050097 std::string m_connectingFaceUri;
akmhoque53353462014-04-22 08:43:45 -050098 double m_linkCost;
akmhoquefdbddb12014-05-02 18:35:19 -050099 uint32_t m_status;
100 uint32_t m_interestTimedOutNo;
akmhoque53353462014-04-22 08:43:45 -0500101};
102
103std::ostream&
akmhoquefdbddb12014-05-02 18:35:19 -0500104operator<<(std::ostream& os, const Adjacent& adj);
akmhoque53353462014-04-22 08:43:45 -0500105
106} // namespace nlsr
107
akmhoquefdbddb12014-05-02 18:35:19 -0500108#endif //NLSR_ADJACENT_HPP