NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
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-2021 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
ForwarderStatus & setNFibEntries(uint64_t nFibEntries)
uint64_t getNInInterests() const
uint64_t getNOutInterests() const
represents NFD General Status dataset
Copyright (c) 2011-2015 Regents of the University of California.
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
ForwarderStatus & setNOutNacks(uint64_t nOutNacks)
uint64_t getNUnsatisfiedInterests() const
ForwarderStatus & setNInData(uint64_t nInData)
ForwarderStatus & setNOutData(uint64_t nOutData)
ForwarderStatus & setNInNacks(uint64_t nInNacks)
Represents a TLV element of the NDN packet format.
Definition: block.hpp:44
ForwarderStatus & setNSatisfiedInterests(uint64_t nSatisfiedInterests)
const time::system_clock::TimePoint & getStartTimestamp() const
ForwarderStatus & setNInInterests(uint64_t nInInterests)
ForwarderStatus & setStartTimestamp(const time::system_clock::TimePoint &startTimestamp)
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:39
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
uint64_t getNMeasurementsEntries() const
ForwarderStatus & setNfdVersion(const std::string &nfdVersion)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
ForwarderStatus & setNOutInterests(uint64_t nOutInterests)
ForwarderStatus & setNUnsatisfiedInterests(uint64_t nUnsatisfiedInterests)
ForwarderStatus & setNMeasurementsEntries(uint64_t nMeasurementsEntries)
uint64_t getNNameTreeEntries() const
uint64_t getNSatisfiedInterests() const
ForwarderStatus & setNPitEntries(uint64_t nPitEntries)
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
ForwarderStatus & setNCsEntries(uint64_t nCsEntries)
void wireDecode(const Block &wire)
decode ForwarderStatus from a Content block
const time::system_clock::TimePoint & getCurrentTimestamp() const
ForwarderStatus & setNNameTreeEntries(uint64_t nNameTreeEntries)
ForwarderStatus & setCurrentTimestamp(const time::system_clock::TimePoint &currentTimestamp)
const std::string & getNfdVersion() const
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:27
represents an error in TLV encoding or decoding
Definition: tlv.hpp:52
time_point TimePoint
Definition: time.hpp:203
const Block & wireEncode() const
encode ForwarderStatus as a Content block