forwarder-status.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2022 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_CXX_MGMT_NFD_FORWARDER_STATUS_HPP
23 #define NDN_CXX_MGMT_NFD_FORWARDER_STATUS_HPP
24 
26 #include "ndn-cxx/util/time.hpp"
27 
28 namespace ndn {
29 namespace nfd {
30 
37 {
38 public:
39  class Error : public tlv::Error
40  {
41  public:
42  using tlv::Error::Error;
43  };
44 
46 
47  explicit
48  ForwarderStatus(const Block& payload);
49 
54  template<encoding::Tag TAG>
55  size_t
56  wireEncode(EncodingImpl<TAG>& encoder) const;
57 
62  const Block&
63  wireEncode() const;
64 
69  void
70  wireDecode(const Block& wire);
71 
72 public: // getters & setters
73  const std::string&
74  getNfdVersion() const
75  {
76  return m_nfdVersion;
77  }
78 
80  setNfdVersion(const std::string& nfdVersion);
81 
84  {
85  return m_startTimestamp;
86  }
87 
89  setStartTimestamp(const time::system_clock::TimePoint& startTimestamp);
90 
93  {
94  return m_currentTimestamp;
95  }
96 
98  setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp);
99 
100  uint64_t
102  {
103  return m_nNameTreeEntries;
104  }
105 
107  setNNameTreeEntries(uint64_t nNameTreeEntries);
108 
109  uint64_t
111  {
112  return m_nFibEntries;
113  }
114 
116  setNFibEntries(uint64_t nFibEntries);
117 
118  uint64_t
120  {
121  return m_nPitEntries;
122  }
123 
125  setNPitEntries(uint64_t nPitEntries);
126 
127  uint64_t
129  {
130  return m_nMeasurementsEntries;
131  }
132 
134  setNMeasurementsEntries(uint64_t nMeasurementsEntries);
135 
136  uint64_t
138  {
139  return m_nCsEntries;
140  }
141 
143  setNCsEntries(uint64_t nCsEntries);
144 
145  uint64_t
147  {
148  return m_nInInterests;
149  }
150 
152  setNInInterests(uint64_t nInInterests);
153 
154  uint64_t
155  getNInData() const
156  {
157  return m_nInData;
158  }
159 
161  setNInData(uint64_t nInData);
162 
163  uint64_t
164  getNInNacks() const
165  {
166  return m_nInNacks;
167  }
168 
170  setNInNacks(uint64_t nInNacks);
171 
172  uint64_t
174  {
175  return m_nOutInterests;
176  }
177 
179  setNOutInterests(uint64_t nOutInterests);
180 
181  uint64_t
182  getNOutData() const
183  {
184  return m_nOutData;
185  }
186 
188  setNOutData(uint64_t nOutData);
189 
190  uint64_t
191  getNOutNacks() const
192  {
193  return m_nOutNacks;
194  }
195 
197  setNOutNacks(uint64_t nOutNacks);
198 
199  uint64_t
201  {
202  return m_nSatisfiedInterests;
203  }
204 
206  setNSatisfiedInterests(uint64_t nSatisfiedInterests);
207 
208  uint64_t
210  {
211  return m_nUnsatisfiedInterests;
212  }
213 
215  setNUnsatisfiedInterests(uint64_t nUnsatisfiedInterests);
216 
217 private:
218  std::string m_nfdVersion;
219  time::system_clock::TimePoint m_startTimestamp;
220  time::system_clock::TimePoint m_currentTimestamp;
221  uint64_t m_nNameTreeEntries;
222  uint64_t m_nFibEntries;
223  uint64_t m_nPitEntries;
224  uint64_t m_nMeasurementsEntries;
225  uint64_t m_nCsEntries;
226  uint64_t m_nInInterests;
227  uint64_t m_nInData;
228  uint64_t m_nInNacks;
229  uint64_t m_nOutInterests;
230  uint64_t m_nOutData;
231  uint64_t m_nOutNacks;
232  uint64_t m_nSatisfiedInterests;
233  uint64_t m_nUnsatisfiedInterests;
234 
235  mutable Block m_wire;
236 };
237 
239 
240 bool
241 operator==(const ForwarderStatus& a, const ForwarderStatus& b);
242 
243 inline bool
245 {
246  return !(a == b);
247 }
248 
249 std::ostream&
250 operator<<(std::ostream& os, const ForwarderStatus& status);
251 
252 } // namespace nfd
253 } // namespace ndn
254 
255 #endif // NDN_CXX_MGMT_NFD_FORWARDER_STATUS_HPP
Represents a TLV element of the NDN packet format.
Definition: block.hpp:45
Represents NFD General Status dataset.
ForwarderStatus & setNCsEntries(uint64_t nCsEntries)
ForwarderStatus & setNInData(uint64_t nInData)
const std::string & getNfdVersion() const
ForwarderStatus & setNMeasurementsEntries(uint64_t nMeasurementsEntries)
ForwarderStatus & setCurrentTimestamp(const time::system_clock::TimePoint &currentTimestamp)
ForwarderStatus & setNSatisfiedInterests(uint64_t nSatisfiedInterests)
ForwarderStatus & setNInNacks(uint64_t nInNacks)
uint64_t getNMeasurementsEntries() const
const time::system_clock::TimePoint & getStartTimestamp() const
uint64_t getNNameTreeEntries() const
ForwarderStatus & setNfdVersion(const std::string &nfdVersion)
uint64_t getNOutInterests() const
ForwarderStatus & setNPitEntries(uint64_t nPitEntries)
uint64_t getNUnsatisfiedInterests() const
ForwarderStatus & setNOutInterests(uint64_t nOutInterests)
const Block & wireEncode() const
Encode ForwarderStatus as a Content block.
ForwarderStatus & setNInInterests(uint64_t nInInterests)
ForwarderStatus & setNFibEntries(uint64_t nFibEntries)
ForwarderStatus & setStartTimestamp(const time::system_clock::TimePoint &startTimestamp)
uint64_t getNSatisfiedInterests() const
ForwarderStatus & setNUnsatisfiedInterests(uint64_t nUnsatisfiedInterests)
void wireDecode(const Block &wire)
Decode ForwarderStatus from a Content block.
ForwarderStatus & setNOutNacks(uint64_t nOutNacks)
uint64_t getNInInterests() const
const time::system_clock::TimePoint & getCurrentTimestamp() const
ForwarderStatus & setNOutData(uint64_t nOutData)
ForwarderStatus & setNNameTreeEntries(uint64_t nNameTreeEntries)
time_point TimePoint
Definition: time.hpp:203
Represents an error in TLV encoding or decoding.
Definition: tlv.hpp:54
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:27
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
Definition: data.cpp:25