blob: bb043f86d4353d9c9131ae667ccdb1bcb57aa5b5 [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 {
9class Adjacent
10{
11
12public:
13 Adjacent()
akmhoque31d1d4b2014-05-05 22:08:14 -050014 : m_name()
akmhoque53353462014-04-22 08:43:45 -050015 , m_connectingFace(0)
16 , m_linkCost(10.0)
17 , m_status(0)
18 , m_interestTimedOutNo(0)
19 {
20 }
21
akmhoque31d1d4b2014-05-05 22:08:14 -050022 Adjacent(const ndn::Name& an)
akmhoque53353462014-04-22 08:43:45 -050023 : m_connectingFace(0)
24 , m_linkCost(0.0)
25 , m_status(0)
26 , m_interestTimedOutNo(0)
27 {
28 m_name = an;
29 }
30
akmhoque31d1d4b2014-05-05 22:08:14 -050031 Adjacent(const ndn::Name& an, uint32_t cf, double lc, uint32_t s,
32 uint32_t iton);
akmhoque53353462014-04-22 08:43:45 -050033
akmhoque31d1d4b2014-05-05 22:08:14 -050034 const ndn::Name&
akmhoquefdbddb12014-05-02 18:35:19 -050035 getName() const
akmhoque53353462014-04-22 08:43:45 -050036 {
37 return m_name;
38 }
39
40 void
akmhoque31d1d4b2014-05-05 22:08:14 -050041 setName(const ndn::Name& an)
akmhoque53353462014-04-22 08:43:45 -050042 {
43 m_name = an;
44 }
45
akmhoquefdbddb12014-05-02 18:35:19 -050046 uint32_t
47 getConnectingFace() const
akmhoque53353462014-04-22 08:43:45 -050048 {
49 return m_connectingFace;
50 }
51
52 void
akmhoquefdbddb12014-05-02 18:35:19 -050053 setConnectingFace(uint32_t cf)
akmhoque53353462014-04-22 08:43:45 -050054 {
55 m_connectingFace = cf;
56 }
57
58 double
akmhoquefdbddb12014-05-02 18:35:19 -050059 getLinkCost() const
akmhoque53353462014-04-22 08:43:45 -050060 {
61 return m_linkCost;
62 }
63
64 void
65 setLinkCost(double lc)
66 {
67 m_linkCost = lc;
68 }
69
akmhoquefdbddb12014-05-02 18:35:19 -050070 uint32_t
71 getStatus() const
akmhoque53353462014-04-22 08:43:45 -050072 {
73 return m_status;
74 }
75
76 void
akmhoquefdbddb12014-05-02 18:35:19 -050077 setStatus(uint32_t s)
akmhoque53353462014-04-22 08:43:45 -050078 {
79 m_status = s;
80 }
81
akmhoquefdbddb12014-05-02 18:35:19 -050082 uint32_t
83 getInterestTimedOutNo() const
akmhoque53353462014-04-22 08:43:45 -050084 {
85 return m_interestTimedOutNo;
86 }
87
88 void
akmhoquefdbddb12014-05-02 18:35:19 -050089 setInterestTimedOutNo(uint32_t iton)
akmhoque53353462014-04-22 08:43:45 -050090 {
91 m_interestTimedOutNo = iton;
92 }
93
94 bool
akmhoquefdbddb12014-05-02 18:35:19 -050095 operator==(const Adjacent& adjacent) const;
akmhoque53353462014-04-22 08:43:45 -050096
akmhoquefdbddb12014-05-02 18:35:19 -050097 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050098 compare(const ndn::Name& adjacencyName);
99
akmhoque53353462014-04-22 08:43:45 -0500100private:
akmhoque31d1d4b2014-05-05 22:08:14 -0500101 ndn::Name m_name;
akmhoquefdbddb12014-05-02 18:35:19 -0500102 uint32_t m_connectingFace;
akmhoque53353462014-04-22 08:43:45 -0500103 double m_linkCost;
akmhoquefdbddb12014-05-02 18:35:19 -0500104 uint32_t m_status;
105 uint32_t m_interestTimedOutNo;
akmhoque53353462014-04-22 08:43:45 -0500106};
107
108std::ostream&
akmhoquefdbddb12014-05-02 18:35:19 -0500109operator<<(std::ostream& os, const Adjacent& adj);
akmhoque53353462014-04-22 08:43:45 -0500110
111} // namespace nlsr
112
akmhoquefdbddb12014-05-02 18:35:19 -0500113#endif //NLSR_ADJACENT_HPP