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-2017 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_MGMT_NFD_FORWARDER_STATUS_HPP
23 #define NDN_MGMT_NFD_FORWARDER_STATUS_HPP
24 
25 #include "../../encoding/block.hpp"
26 #include "../../util/time.hpp"
27 
28 namespace ndn {
29 namespace nfd {
30 
37 {
38 public:
39  class Error : public tlv::Error
40  {
41  public:
42  explicit
43  Error(const std::string& what)
44  : tlv::Error(what)
45  {
46  }
47  };
48 
50 
51  explicit
52  ForwarderStatus(const Block& payload);
53 
58  template<encoding::Tag TAG>
59  size_t
60  wireEncode(EncodingImpl<TAG>& encoder) const;
61 
66  const Block&
67  wireEncode() const;
68 
73  void
74  wireDecode(const Block& wire);
75 
76 public: // getters & setters
77  const std::string&
78  getNfdVersion() const
79  {
80  return m_nfdVersion;
81  }
82 
84  setNfdVersion(const std::string& nfdVersion);
85 
88  {
89  return m_startTimestamp;
90  }
91 
93  setStartTimestamp(const time::system_clock::TimePoint& startTimestamp);
94 
97  {
98  return m_currentTimestamp;
99  }
100 
102  setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp);
103 
104  size_t
106  {
107  return m_nNameTreeEntries;
108  }
109 
111  setNNameTreeEntries(size_t nNameTreeEntries);
112 
113  size_t
115  {
116  return m_nFibEntries;
117  }
118 
120  setNFibEntries(size_t nFibEntries);
121 
122  size_t
124  {
125  return m_nPitEntries;
126  }
127 
129  setNPitEntries(size_t nPitEntries);
130 
131  size_t
133  {
134  return m_nMeasurementsEntries;
135  }
136 
138  setNMeasurementsEntries(size_t nMeasurementsEntries);
139 
140  size_t
142  {
143  return m_nCsEntries;
144  }
145 
147  setNCsEntries(size_t nCsEntries);
148 
149  uint64_t
151  {
152  return m_nInInterests;
153  }
154 
156  setNInInterests(uint64_t nInInterests);
157 
158  uint64_t
159  getNInData() const
160  {
161  return m_nInData;
162  }
163 
165  setNInData(uint64_t nInData);
166 
167  uint64_t
168  getNInNacks() const
169  {
170  return m_nInNacks;
171  }
172 
174  setNInNacks(uint64_t nInNacks);
175 
176  uint64_t
178  {
179  return m_nOutInterests;
180  }
181 
183  setNOutInterests(uint64_t nOutInterests);
184 
185  uint64_t
186  getNOutData() const
187  {
188  return m_nOutData;
189  }
190 
192  setNOutData(uint64_t nOutData);
193 
194  uint64_t
195  getNOutNacks() const
196  {
197  return m_nOutNacks;
198  }
199 
201  setNOutNacks(uint64_t nOutNacks);
202 
203 private:
204  std::string m_nfdVersion;
205  time::system_clock::TimePoint m_startTimestamp;
206  time::system_clock::TimePoint m_currentTimestamp;
207  size_t m_nNameTreeEntries;
208  size_t m_nFibEntries;
209  size_t m_nPitEntries;
210  size_t m_nMeasurementsEntries;
211  size_t m_nCsEntries;
212  uint64_t m_nInInterests;
213  uint64_t m_nInData;
214  uint64_t m_nInNacks;
215  uint64_t m_nOutInterests;
216  uint64_t m_nOutData;
217  uint64_t m_nOutNacks;
218 
219  mutable Block m_wire;
220 };
221 
223 
224 bool
225 operator==(const ForwarderStatus& a, const ForwarderStatus& b);
226 
227 inline bool
229 {
230  return !(a == b);
231 }
232 
233 std::ostream&
234 operator<<(std::ostream& os, const ForwarderStatus& status);
235 
236 } // namespace nfd
237 } // namespace ndn
238 
239 #endif // NDN_MGMT_NFD_FORWARDER_STATUS_HPP
represents NFD General Status dataset
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
size_t getNMeasurementsEntries() const
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
ForwarderStatus & setNFibEntries(size_t nFibEntries)
ForwarderStatus & setNOutNacks(uint64_t nOutNacks)
Error(const std::string &what)
const time::system_clock::TimePoint & getStartTimestamp() const
const std::string & getNfdVersion() const
ForwarderStatus & setNInData(uint64_t nInData)
ForwarderStatus & setNOutData(uint64_t nOutData)
ForwarderStatus & setNInNacks(uint64_t nInNacks)
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
ForwarderStatus & setNCsEntries(size_t nCsEntries)
uint64_t getNInInterests() const
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
uint64_t getNOutNacks() const
ForwarderStatus & setNNameTreeEntries(size_t nNameTreeEntries)
ForwarderStatus & setNInInterests(uint64_t nInInterests)
ForwarderStatus & setStartTimestamp(const time::system_clock::TimePoint &startTimestamp)
uint64_t getNOutInterests() const
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
ForwarderStatus & setNfdVersion(const std::string &nfdVersion)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
ForwarderStatus & setNOutInterests(uint64_t nOutInterests)
ForwarderStatus & setNPitEntries(size_t nPitEntries)
const Block & wireEncode() const
encode ForwarderStatus as a Content block
time_point TimePoint
Definition: time.hpp:196
void wireDecode(const Block &wire)
decode ForwarderStatus from a Content block
size_t getNNameTreeEntries() const
const time::system_clock::TimePoint & getCurrentTimestamp() const
ForwarderStatus & setNMeasurementsEntries(size_t nMeasurementsEntries)
ForwarderStatus & setCurrentTimestamp(const time::system_clock::TimePoint &currentTimestamp)
represents an error in TLV encoding or decoding