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-2023 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::nfd {
29 
36 {
37 public:
38  class Error : public tlv::Error
39  {
40  public:
41  using tlv::Error::Error;
42  };
43 
45 
46  explicit
47  ForwarderStatus(const Block& payload);
48 
53  template<encoding::Tag TAG>
54  size_t
55  wireEncode(EncodingImpl<TAG>& encoder) const;
56 
61  const Block&
62  wireEncode() const;
63 
68  void
69  wireDecode(const Block& wire);
70 
71 public: // getters & setters
72  const std::string&
73  getNfdVersion() const
74  {
75  return m_nfdVersion;
76  }
77 
79  setNfdVersion(const std::string& nfdVersion);
80 
83  {
84  return m_startTimestamp;
85  }
86 
89 
92  {
93  return m_currentTimestamp;
94  }
95 
97  setCurrentTimestamp(const time::system_clock::time_point& currentTimestamp);
98 
99  uint64_t
101  {
102  return m_nNameTreeEntries;
103  }
104 
106  setNNameTreeEntries(uint64_t nNameTreeEntries);
107 
108  uint64_t
110  {
111  return m_nFibEntries;
112  }
113 
115  setNFibEntries(uint64_t nFibEntries);
116 
117  uint64_t
119  {
120  return m_nPitEntries;
121  }
122 
124  setNPitEntries(uint64_t nPitEntries);
125 
126  uint64_t
128  {
129  return m_nMeasurementsEntries;
130  }
131 
133  setNMeasurementsEntries(uint64_t nMeasurementsEntries);
134 
135  uint64_t
137  {
138  return m_nCsEntries;
139  }
140 
142  setNCsEntries(uint64_t nCsEntries);
143 
144  uint64_t
146  {
147  return m_nInInterests;
148  }
149 
151  setNInInterests(uint64_t nInInterests);
152 
153  uint64_t
154  getNInData() const
155  {
156  return m_nInData;
157  }
158 
160  setNInData(uint64_t nInData);
161 
162  uint64_t
163  getNInNacks() const
164  {
165  return m_nInNacks;
166  }
167 
169  setNInNacks(uint64_t nInNacks);
170 
171  uint64_t
173  {
174  return m_nOutInterests;
175  }
176 
178  setNOutInterests(uint64_t nOutInterests);
179 
180  uint64_t
181  getNOutData() const
182  {
183  return m_nOutData;
184  }
185 
187  setNOutData(uint64_t nOutData);
188 
189  uint64_t
190  getNOutNacks() const
191  {
192  return m_nOutNacks;
193  }
194 
196  setNOutNacks(uint64_t nOutNacks);
197 
198  uint64_t
200  {
201  return m_nSatisfiedInterests;
202  }
203 
205  setNSatisfiedInterests(uint64_t nSatisfiedInterests);
206 
207  uint64_t
209  {
210  return m_nUnsatisfiedInterests;
211  }
212 
214  setNUnsatisfiedInterests(uint64_t nUnsatisfiedInterests);
215 
216 private:
217  std::string m_nfdVersion;
218  time::system_clock::time_point m_startTimestamp;
219  time::system_clock::time_point m_currentTimestamp;
220  uint64_t m_nNameTreeEntries = 0;
221  uint64_t m_nFibEntries = 0;
222  uint64_t m_nPitEntries = 0;
223  uint64_t m_nMeasurementsEntries = 0;
224  uint64_t m_nCsEntries = 0;
225  uint64_t m_nInInterests = 0;
226  uint64_t m_nInData = 0;
227  uint64_t m_nInNacks = 0;
228  uint64_t m_nOutInterests = 0;
229  uint64_t m_nOutData = 0;
230  uint64_t m_nOutNacks = 0;
231  uint64_t m_nSatisfiedInterests = 0;
232  uint64_t m_nUnsatisfiedInterests = 0;
233 
234  mutable Block m_wire;
235 };
236 
238 
239 bool
240 operator==(const ForwarderStatus& a, const ForwarderStatus& b);
241 
242 inline bool
244 {
245  return !(a == b);
246 }
247 
248 std::ostream&
249 operator<<(std::ostream& os, const ForwarderStatus& status);
250 
251 } // namespace ndn::nfd
252 
253 #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 & setStartTimestamp(const time::system_clock::time_point &startTimestamp)
ForwarderStatus & setNInData(uint64_t nInData)
const std::string & getNfdVersion() const
ForwarderStatus & setNMeasurementsEntries(uint64_t nMeasurementsEntries)
ForwarderStatus & setNSatisfiedInterests(uint64_t nSatisfiedInterests)
ForwarderStatus & setNInNacks(uint64_t nInNacks)
uint64_t getNMeasurementsEntries() 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 & setCurrentTimestamp(const time::system_clock::time_point &currentTimestamp)
ForwarderStatus & setNInInterests(uint64_t nInInterests)
ForwarderStatus & setNFibEntries(uint64_t nFibEntries)
uint64_t getNSatisfiedInterests() const
ForwarderStatus & setNUnsatisfiedInterests(uint64_t nUnsatisfiedInterests)
void wireDecode(const Block &wire)
Decode ForwarderStatus from a Content block.
const time::system_clock::time_point & getStartTimestamp() const
const time::system_clock::time_point & getCurrentTimestamp() const
ForwarderStatus & setNOutNacks(uint64_t nOutNacks)
uint64_t getNInInterests() const
ForwarderStatus & setNOutData(uint64_t nOutData)
ForwarderStatus & setNNameTreeEntries(uint64_t nNameTreeEntries)
::boost::chrono::time_point< system_clock > time_point
Definition: time.hpp:205
Represents an error in TLV encoding or decoding.
Definition: tlv.hpp:54
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:28
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
Contains classes and functions related to the NFD Management protocol.
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
bool operator==(const ChannelStatus &a, const ChannelStatus &b)