NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
face-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-2018 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_FACE_STATUS_HPP
23 #define NDN_MGMT_NFD_FACE_STATUS_HPP
24 
26 #include "ndn-cxx/util/time.hpp"
27 
28 namespace ndn {
29 namespace nfd {
30 
36 class FaceStatus : public FaceTraits<FaceStatus>
37 {
38 public:
39  FaceStatus();
40 
41  explicit
42  FaceStatus(const Block& block);
43 
46  template<encoding::Tag TAG>
47  size_t
48  wireEncode(EncodingImpl<TAG>& encoder) const;
49 
52  const Block&
53  wireEncode() const;
54 
57  void
58  wireDecode(const Block& wire);
59 
60 public: // getters & setters
61  bool
63  {
64  return !!m_expirationPeriod;
65  }
66 
67  time::milliseconds
69  {
70  BOOST_ASSERT(hasExpirationPeriod());
71  return *m_expirationPeriod;
72  }
73 
74  FaceStatus&
75  setExpirationPeriod(time::milliseconds expirationPeriod);
76 
77  FaceStatus&
79 
80  bool
82  {
83  return !!m_baseCongestionMarkingInterval;
84  }
85 
86  time::nanoseconds
88  {
89  BOOST_ASSERT(hasBaseCongestionMarkingInterval());
90  return *m_baseCongestionMarkingInterval;
91  }
92 
93  FaceStatus&
94  setBaseCongestionMarkingInterval(time::nanoseconds interval);
95 
96  FaceStatus&
98 
99  bool
101  {
102  return !!m_defaultCongestionThreshold;
103  }
104 
107  uint64_t
109  {
110  BOOST_ASSERT(hasDefaultCongestionThreshold());
111  return *m_defaultCongestionThreshold;
112  }
113 
116  FaceStatus&
117  setDefaultCongestionThreshold(uint64_t threshold);
118 
119  FaceStatus&
121 
122  bool
123  hasMtu() const
124  {
125  return !!m_mtu;
126  }
127 
132  uint64_t
133  getMtu() const
134  {
135  BOOST_ASSERT(hasMtu());
136  return *m_mtu;
137  }
138 
143  FaceStatus&
144  setMtu(uint64_t mtu);
145 
146  FaceStatus&
147  unsetMtu();
148 
149  uint64_t
151  {
152  return m_nInInterests;
153  }
154 
155  FaceStatus&
156  setNInInterests(uint64_t nInInterests);
157 
158  uint64_t
159  getNInData() const
160  {
161  return m_nInData;
162  }
163 
164  FaceStatus&
165  setNInData(uint64_t nInData);
166 
167  uint64_t
168  getNInNacks() const
169  {
170  return m_nInNacks;
171  }
172 
173  FaceStatus&
174  setNInNacks(uint64_t nInNacks);
175 
176  uint64_t
178  {
179  return m_nOutInterests;
180  }
181 
182  FaceStatus&
183  setNOutInterests(uint64_t nOutInterests);
184 
185  uint64_t
186  getNOutData() const
187  {
188  return m_nOutData;
189  }
190 
191  FaceStatus&
192  setNOutData(uint64_t nOutData);
193 
194  uint64_t
195  getNOutNacks() const
196  {
197  return m_nOutNacks;
198  }
199 
200  FaceStatus&
201  setNOutNacks(uint64_t nOutNacks);
202 
203  uint64_t
204  getNInBytes() const
205  {
206  return m_nInBytes;
207  }
208 
209  FaceStatus&
210  setNInBytes(uint64_t nInBytes);
211 
212  uint64_t
213  getNOutBytes() const
214  {
215  return m_nOutBytes;
216  }
217 
218  FaceStatus&
219  setNOutBytes(uint64_t nOutBytes);
220 
221 private:
222  optional<time::milliseconds> m_expirationPeriod;
223  optional<time::nanoseconds> m_baseCongestionMarkingInterval;
224  optional<uint64_t> m_defaultCongestionThreshold;
225  optional<uint64_t> m_mtu;
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_nInBytes;
233  uint64_t m_nOutBytes;
234 };
235 
237 
238 bool
239 operator==(const FaceStatus& a, const FaceStatus& b);
240 
241 inline bool
242 operator!=(const FaceStatus& a, const FaceStatus& b)
243 {
244  return !(a == b);
245 }
246 
247 std::ostream&
248 operator<<(std::ostream& os, const FaceStatus& status);
249 
250 } // namespace nfd
251 } // namespace ndn
252 
253 #endif // NDN_MGMT_NFD_FACE_STATUS_HPP
ndn::nfd::FaceStatus::getNInData
uint64_t getNInData() const
Definition: face-status.hpp:159
ndn::nfd::FaceStatus::setNInNacks
FaceStatus & setNInNacks(uint64_t nInNacks)
Definition: face-status.cpp:356
ndn::tlv::nfd::FaceStatus
@ FaceStatus
Definition: tlv-nfd.hpp:63
ndn::nfd::FaceStatus::hasExpirationPeriod
bool hasExpirationPeriod() const
Definition: face-status.hpp:62
ndn::nfd::FaceStatus::setNOutData
FaceStatus & setNOutData(uint64_t nOutData)
Definition: face-status.cpp:372
ndn::nfd::FaceStatus::getNInNacks
uint64_t getNInNacks() const
Definition: face-status.hpp:168
ndn::nfd::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
ndn::nfd::FaceTraits
provides getters and setters for face information fields
Definition: face-traits.hpp:38
ndn::nfd::FaceStatus::getNInBytes
uint64_t getNInBytes() const
Definition: face-status.hpp:204
ndn::nfd::operator<<
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Definition: nfd-constants.cpp:36
ndn::nfd::FaceStatus::getNOutInterests
uint64_t getNOutInterests() const
Definition: face-status.hpp:177
ndn::nfd::FaceStatus::getNOutBytes
uint64_t getNOutBytes() const
Definition: face-status.hpp:213
ndn::nfd::FaceStatus::setNInBytes
FaceStatus & setNInBytes(uint64_t nInBytes)
Definition: face-status.cpp:388
ndn::nfd::FaceStatus::setDefaultCongestionThreshold
FaceStatus & setDefaultCongestionThreshold(uint64_t threshold)
set default congestion threshold (measured in bytes)
Definition: face-status.cpp:308
ndn::nfd::FaceStatus::unsetDefaultCongestionThreshold
FaceStatus & unsetDefaultCongestionThreshold()
Definition: face-status.cpp:316
ndn::nfd::FaceStatus::hasDefaultCongestionThreshold
bool hasDefaultCongestionThreshold() const
Definition: face-status.hpp:100
face-traits.hpp
ndn::nfd::FaceStatus::setExpirationPeriod
FaceStatus & setExpirationPeriod(time::milliseconds expirationPeriod)
Definition: face-status.cpp:276
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
ndn::nfd::FaceStatus::getDefaultCongestionThreshold
uint64_t getDefaultCongestionThreshold() const
get default congestion threshold (measured in bytes)
Definition: face-status.hpp:108
ndn::nfd::FaceStatus::wireDecode
void wireDecode(const Block &wire)
decode FaceStatus
Definition: face-status.cpp:112
ndn::nfd::FaceStatus::getMtu
uint64_t getMtu() const
get MTU (measured in bytes)
Definition: face-status.hpp:133
ndn::nfd::FaceStatus::setNInInterests
FaceStatus & setNInInterests(uint64_t nInInterests)
Definition: face-status.cpp:340
ndn::nfd::FaceStatus::setBaseCongestionMarkingInterval
FaceStatus & setBaseCongestionMarkingInterval(time::nanoseconds interval)
Definition: face-status.cpp:292
ndn::nfd::FaceStatus::getExpirationPeriod
time::milliseconds getExpirationPeriod() const
Definition: face-status.hpp:68
ndn::nfd::FaceStatus::hasBaseCongestionMarkingInterval
bool hasBaseCongestionMarkingInterval() const
Definition: face-status.hpp:81
ndn::nfd::FaceStatus::getNOutNacks
uint64_t getNOutNacks() const
Definition: face-status.hpp:195
ndn::nfd::FaceStatus::unsetMtu
FaceStatus & unsetMtu()
Definition: face-status.cpp:332
ndn::nfd::FaceStatus::getNOutData
uint64_t getNOutData() const
Definition: face-status.hpp:186
ndn::nfd::FaceStatus::setNOutInterests
FaceStatus & setNOutInterests(uint64_t nOutInterests)
Definition: face-status.cpp:364
ndn::nfd::FaceStatus
represents an item in NFD Face dataset
Definition: face-status.hpp:37
ndn::nfd::FaceStatus::getBaseCongestionMarkingInterval
time::nanoseconds getBaseCongestionMarkingInterval() const
Definition: face-status.hpp:87
ndn::encoding::EncodingImpl
Definition: encoding-buffer-fwd.hpp:36
ndn::nfd::FaceStatus::getNInInterests
uint64_t getNInInterests() const
Definition: face-status.hpp:150
ndn::nfd::FaceStatus::wireEncode
const Block & wireEncode() const
encode FaceStatus
Definition: face-status.cpp:96
ndn::Block
Represents a TLV element of NDN packet format.
Definition: block.hpp:43
ndn::nfd::FaceStatus::unsetBaseCongestionMarkingInterval
FaceStatus & unsetBaseCongestionMarkingInterval()
Definition: face-status.cpp:300
ndn::nfd::FaceStatus::unsetExpirationPeriod
FaceStatus & unsetExpirationPeriod()
Definition: face-status.cpp:284
ndn::nfd::FaceStatus::setMtu
FaceStatus & setMtu(uint64_t mtu)
set MTU (measured in bytes)
Definition: face-status.cpp:324
ndn::nfd::operator!=
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
Definition: channel-status.hpp:81
ndn::nfd::operator==
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
Definition: channel-status.cpp:97
time.hpp
ndn::nfd::FaceStatus::setNInData
FaceStatus & setNInData(uint64_t nInData)
Definition: face-status.cpp:348
ndn::nfd::FaceStatus::hasMtu
bool hasMtu() const
Definition: face-status.hpp:123
ndn::nfd::FaceStatus::FaceStatus
FaceStatus()
Definition: face-status.cpp:34
ndn::nfd::FaceStatus::setNOutBytes
FaceStatus & setNOutBytes(uint64_t nOutBytes)
Definition: face-status.cpp:396
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ndn::nfd::FaceStatus::setNOutNacks
FaceStatus & setNOutNacks(uint64_t nOutNacks)
Definition: face-status.cpp:380