NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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-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_FACE_STATUS_HPP
23 #define NDN_MGMT_NFD_FACE_STATUS_HPP
24 
25 #include "face-traits.hpp"
26 #include "../../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 
69  {
70  BOOST_ASSERT(hasExpirationPeriod());
71  return *m_expirationPeriod;
72  }
73 
74  FaceStatus&
75  setExpirationPeriod(time::milliseconds expirationPeriod);
76 
77  FaceStatus&
79 
80  uint64_t
82  {
83  return m_nInInterests;
84  }
85 
86  FaceStatus&
87  setNInInterests(uint64_t nInInterests);
88 
89  uint64_t
90  getNInData() const
91  {
92  return m_nInData;
93  }
94 
95  FaceStatus&
96  setNInData(uint64_t nInData);
97 
98  uint64_t
99  getNInNacks() const
100  {
101  return m_nInNacks;
102  }
103 
104  FaceStatus&
105  setNInNacks(uint64_t nInNacks);
106 
107  uint64_t
109  {
110  return m_nOutInterests;
111  }
112 
113  FaceStatus&
114  setNOutInterests(uint64_t nOutInterests);
115 
116  uint64_t
117  getNOutData() const
118  {
119  return m_nOutData;
120  }
121 
122  FaceStatus&
123  setNOutData(uint64_t nOutData);
124 
125  uint64_t
126  getNOutNacks() const
127  {
128  return m_nOutNacks;
129  }
130 
131  FaceStatus&
132  setNOutNacks(uint64_t nOutNacks);
133 
134  uint64_t
135  getNInBytes() const
136  {
137  return m_nInBytes;
138  }
139 
140  FaceStatus&
141  setNInBytes(uint64_t nInBytes);
142 
143  uint64_t
144  getNOutBytes() const
145  {
146  return m_nOutBytes;
147  }
148 
149  FaceStatus&
150  setNOutBytes(uint64_t nOutBytes);
151 
152 private:
153  optional<time::milliseconds> m_expirationPeriod;
154  uint64_t m_nInInterests;
155  uint64_t m_nInData;
156  uint64_t m_nInNacks;
157  uint64_t m_nOutInterests;
158  uint64_t m_nOutData;
159  uint64_t m_nOutNacks;
160  uint64_t m_nInBytes;
161  uint64_t m_nOutBytes;
162 };
163 
165 
166 bool
167 operator==(const FaceStatus& a, const FaceStatus& b);
168 
169 inline bool
170 operator!=(const FaceStatus& a, const FaceStatus& b)
171 {
172  return !(a == b);
173 }
174 
175 std::ostream&
176 operator<<(std::ostream& os, const FaceStatus& status);
177 
178 } // namespace nfd
179 } // namespace ndn
180 
181 #endif // NDN_MGMT_NFD_FACE_STATUS_HPP
uint64_t getNInNacks() const
Definition: face-status.hpp:99
void wireDecode(const Block &wire)
decode FaceStatus
Copyright (c) 2011-2015 Regents of the University of California.
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
bool hasExpirationPeriod() const
Definition: face-status.hpp:62
boost::posix_time::time_duration milliseconds(long duration)
Definition: asio.hpp:117
time::milliseconds getExpirationPeriod() const
Definition: face-status.hpp:68
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
FaceStatus & setNOutBytes(uint64_t nOutBytes)
FaceStatus & setNOutInterests(uint64_t nOutInterests)
FaceStatus & setExpirationPeriod(time::milliseconds expirationPeriod)
FaceStatus & setNInInterests(uint64_t nInInterests)
FaceStatus & setNInBytes(uint64_t nInBytes)
FaceStatus & unsetExpirationPeriod()
uint64_t getNInInterests() const
Definition: face-status.hpp:81
FaceStatus & setNInNacks(uint64_t nInNacks)
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
FaceStatus & setNOutData(uint64_t nOutData)
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
represents an item in NFD Face dataset
Definition: face-status.hpp:36
uint64_t getNOutData() const
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
uint64_t getNOutBytes() const
uint64_t getNOutInterests() const
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
FaceStatus & setNOutNacks(uint64_t nOutNacks)
uint64_t getNInBytes() const
provides getters and setters for face information fields
Definition: face-traits.hpp:37
uint64_t getNInData() const
Definition: face-status.hpp:90
FaceStatus & setNInData(uint64_t nInData)
const Block & wireEncode() const
encode FaceStatus
Definition: face-status.cpp:85
uint64_t getNOutNacks() const