Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 3 | * Copyright (c) 2013-2016 Regents of the University of California. |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 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 | |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 22 | #include "face-status.hpp" |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 23 | #include "encoding/tlv-nfd.hpp" |
| 24 | #include "encoding/block-helpers.hpp" |
| 25 | #include "util/concepts.hpp" |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 26 | |
| 27 | namespace ndn { |
| 28 | namespace nfd { |
| 29 | |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 30 | //BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceStatus>)); |
| 31 | BOOST_CONCEPT_ASSERT((WireEncodable<FaceStatus>)); |
| 32 | BOOST_CONCEPT_ASSERT((WireDecodable<FaceStatus>)); |
| 33 | static_assert(std::is_base_of<tlv::Error, FaceStatus::Error>::value, |
| 34 | "FaceStatus::Error must inherit from tlv::Error"); |
| 35 | |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 36 | FaceStatus::FaceStatus() |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 37 | : m_hasExpirationPeriod(false) |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 38 | , m_nInInterests(0) |
| 39 | , m_nInDatas(0) |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 40 | , m_nInNacks(0) |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 41 | , m_nOutInterests(0) |
| 42 | , m_nOutDatas(0) |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 43 | , m_nOutNacks(0) |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 44 | , m_nInBytes(0) |
| 45 | , m_nOutBytes(0) |
| 46 | { |
| 47 | } |
| 48 | |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 49 | FaceStatus::FaceStatus(const Block& block) |
| 50 | { |
| 51 | this->wireDecode(block); |
| 52 | } |
| 53 | |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 54 | template<encoding::Tag TAG> |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 55 | size_t |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 56 | FaceStatus::wireEncode(EncodingImpl<TAG>& encoder) const |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 57 | { |
| 58 | size_t totalLength = 0; |
| 59 | |
| 60 | totalLength += prependNonNegativeIntegerBlock(encoder, |
Eric Newberry | 1ce8ab2 | 2016-09-24 11:57:21 -0700 | [diff] [blame] | 61 | tlv::nfd::Flags, m_flags); |
| 62 | totalLength += prependNonNegativeIntegerBlock(encoder, |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 63 | tlv::nfd::NOutBytes, m_nOutBytes); |
| 64 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 65 | tlv::nfd::NInBytes, m_nInBytes); |
| 66 | totalLength += prependNonNegativeIntegerBlock(encoder, |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 67 | tlv::nfd::NOutNacks, m_nOutNacks); |
| 68 | totalLength += prependNonNegativeIntegerBlock(encoder, |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 69 | tlv::nfd::NOutDatas, m_nOutDatas); |
| 70 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 71 | tlv::nfd::NOutInterests, m_nOutInterests); |
| 72 | totalLength += prependNonNegativeIntegerBlock(encoder, |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 73 | tlv::nfd::NInNacks, m_nInNacks); |
| 74 | totalLength += prependNonNegativeIntegerBlock(encoder, |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 75 | tlv::nfd::NInDatas, m_nInDatas); |
| 76 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 77 | tlv::nfd::NInInterests, m_nInInterests); |
| 78 | totalLength += prependNonNegativeIntegerBlock(encoder, |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 79 | tlv::nfd::LinkType, m_linkType); |
| 80 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 81 | tlv::nfd::FacePersistency, m_facePersistency); |
| 82 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 83 | tlv::nfd::FaceScope, m_faceScope); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 84 | if (m_hasExpirationPeriod) { |
| 85 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 86 | tlv::nfd::ExpirationPeriod, m_expirationPeriod.count()); |
| 87 | } |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 88 | totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri, |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 89 | reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size()); |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 90 | totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri, |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 91 | reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size()); |
| 92 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 93 | tlv::nfd::FaceId, m_faceId); |
| 94 | |
| 95 | totalLength += encoder.prependVarNumber(totalLength); |
| 96 | totalLength += encoder.prependVarNumber(tlv::nfd::FaceStatus); |
| 97 | return totalLength; |
| 98 | } |
| 99 | |
| 100 | template size_t |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 101 | FaceStatus::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const; |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 102 | |
| 103 | template size_t |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 104 | FaceStatus::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const; |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 105 | |
| 106 | const Block& |
| 107 | FaceStatus::wireEncode() const |
| 108 | { |
| 109 | if (m_wire.hasWire()) |
| 110 | return m_wire; |
| 111 | |
| 112 | EncodingEstimator estimator; |
| 113 | size_t estimatedSize = wireEncode(estimator); |
| 114 | |
| 115 | EncodingBuffer buffer(estimatedSize, 0); |
| 116 | wireEncode(buffer); |
| 117 | |
| 118 | m_wire = buffer.block(); |
| 119 | return m_wire; |
| 120 | } |
| 121 | |
| 122 | void |
| 123 | FaceStatus::wireDecode(const Block& block) |
| 124 | { |
| 125 | if (block.type() != tlv::nfd::FaceStatus) { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 126 | BOOST_THROW_EXCEPTION(Error("expecting FaceStatus block")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 127 | } |
| 128 | m_wire = block; |
| 129 | m_wire.parse(); |
| 130 | Block::element_const_iterator val = m_wire.elements_begin(); |
| 131 | |
| 132 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceId) { |
| 133 | m_faceId = readNonNegativeInteger(*val); |
| 134 | ++val; |
| 135 | } |
| 136 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 137 | BOOST_THROW_EXCEPTION(Error("missing required FaceId field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) { |
| 141 | m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size()); |
| 142 | ++val; |
| 143 | } |
| 144 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 145 | BOOST_THROW_EXCEPTION(Error("missing required Uri field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) { |
| 149 | m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size()); |
| 150 | ++val; |
| 151 | } |
| 152 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 153 | BOOST_THROW_EXCEPTION(Error("missing required LocalUri field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::ExpirationPeriod) { |
| 157 | m_expirationPeriod = time::milliseconds(readNonNegativeInteger(*val)); |
| 158 | m_hasExpirationPeriod = true; |
| 159 | ++val; |
| 160 | } |
| 161 | else { |
| 162 | m_hasExpirationPeriod = false; |
| 163 | // ExpirationPeriod is optional |
| 164 | } |
| 165 | |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 166 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceScope) { |
| 167 | m_faceScope = static_cast<FaceScope>(readNonNegativeInteger(*val)); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 168 | ++val; |
| 169 | } |
| 170 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 171 | BOOST_THROW_EXCEPTION(Error("missing required FaceScope field")); |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::FacePersistency) { |
| 175 | m_facePersistency = static_cast<FacePersistency>(readNonNegativeInteger(*val)); |
| 176 | ++val; |
| 177 | } |
| 178 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 179 | BOOST_THROW_EXCEPTION(Error("missing required FacePersistency field")); |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::LinkType) { |
| 183 | m_linkType = static_cast<LinkType>(readNonNegativeInteger(*val)); |
| 184 | ++val; |
| 185 | } |
| 186 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 187 | BOOST_THROW_EXCEPTION(Error("missing required LinkType field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) { |
| 191 | m_nInInterests = readNonNegativeInteger(*val); |
| 192 | ++val; |
| 193 | } |
| 194 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 195 | BOOST_THROW_EXCEPTION(Error("missing required NInInterests field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) { |
| 199 | m_nInDatas = readNonNegativeInteger(*val); |
| 200 | ++val; |
| 201 | } |
| 202 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 203 | BOOST_THROW_EXCEPTION(Error("missing required NInDatas field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 204 | } |
| 205 | |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 206 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInNacks) { |
| 207 | m_nInNacks = readNonNegativeInteger(*val); |
| 208 | ++val; |
| 209 | } |
| 210 | else { |
| 211 | BOOST_THROW_EXCEPTION(Error("missing required NInNacks field")); |
| 212 | } |
| 213 | |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 214 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) { |
| 215 | m_nOutInterests = readNonNegativeInteger(*val); |
| 216 | ++val; |
| 217 | } |
| 218 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 219 | BOOST_THROW_EXCEPTION(Error("missing required NOutInterests field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) { |
| 223 | m_nOutDatas = readNonNegativeInteger(*val); |
| 224 | ++val; |
| 225 | } |
| 226 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 227 | BOOST_THROW_EXCEPTION(Error("missing required NOutDatas field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 228 | } |
| 229 | |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 230 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutNacks) { |
| 231 | m_nOutNacks = readNonNegativeInteger(*val); |
| 232 | ++val; |
| 233 | } |
| 234 | else { |
| 235 | BOOST_THROW_EXCEPTION(Error("missing required NOutNacks field")); |
| 236 | } |
| 237 | |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 238 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInBytes) { |
| 239 | m_nInBytes = readNonNegativeInteger(*val); |
| 240 | ++val; |
| 241 | } |
| 242 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 243 | BOOST_THROW_EXCEPTION(Error("missing required NInBytes field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutBytes) { |
| 247 | m_nOutBytes = readNonNegativeInteger(*val); |
| 248 | ++val; |
| 249 | } |
| 250 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 251 | BOOST_THROW_EXCEPTION(Error("missing required NOutBytes field")); |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 252 | } |
Eric Newberry | 1ce8ab2 | 2016-09-24 11:57:21 -0700 | [diff] [blame] | 253 | |
| 254 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::Flags) { |
| 255 | m_flags = readNonNegativeInteger(*val); |
| 256 | ++val; |
| 257 | } |
| 258 | else { |
| 259 | BOOST_THROW_EXCEPTION(Error("missing required Flags field")); |
| 260 | } |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 261 | } |
| 262 | |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 263 | FaceStatus& |
| 264 | FaceStatus::setExpirationPeriod(const time::milliseconds& expirationPeriod) |
| 265 | { |
| 266 | m_wire.reset(); |
| 267 | m_expirationPeriod = expirationPeriod; |
| 268 | m_hasExpirationPeriod = true; |
| 269 | return *this; |
| 270 | } |
| 271 | |
| 272 | FaceStatus& |
| 273 | FaceStatus::setNInInterests(uint64_t nInInterests) |
| 274 | { |
| 275 | m_wire.reset(); |
| 276 | m_nInInterests = nInInterests; |
| 277 | return *this; |
| 278 | } |
| 279 | |
| 280 | FaceStatus& |
| 281 | FaceStatus::setNInDatas(uint64_t nInDatas) |
| 282 | { |
| 283 | m_wire.reset(); |
| 284 | m_nInDatas = nInDatas; |
| 285 | return *this; |
| 286 | } |
| 287 | |
| 288 | FaceStatus& |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 289 | FaceStatus::setNInNacks(uint64_t nInNacks) |
| 290 | { |
| 291 | m_wire.reset(); |
| 292 | m_nInNacks = nInNacks; |
| 293 | return *this; |
| 294 | } |
| 295 | |
| 296 | FaceStatus& |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 297 | FaceStatus::setNOutInterests(uint64_t nOutInterests) |
| 298 | { |
| 299 | m_wire.reset(); |
| 300 | m_nOutInterests = nOutInterests; |
| 301 | return *this; |
| 302 | } |
| 303 | |
| 304 | FaceStatus& |
| 305 | FaceStatus::setNOutDatas(uint64_t nOutDatas) |
| 306 | { |
| 307 | m_wire.reset(); |
| 308 | m_nOutDatas = nOutDatas; |
| 309 | return *this; |
| 310 | } |
| 311 | |
| 312 | FaceStatus& |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 313 | FaceStatus::setNOutNacks(uint64_t nOutNacks) |
| 314 | { |
| 315 | m_wire.reset(); |
| 316 | m_nOutNacks = nOutNacks; |
| 317 | return *this; |
| 318 | } |
| 319 | |
| 320 | FaceStatus& |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 321 | FaceStatus::setNInBytes(uint64_t nInBytes) |
| 322 | { |
| 323 | m_wire.reset(); |
| 324 | m_nInBytes = nInBytes; |
| 325 | return *this; |
| 326 | } |
| 327 | |
| 328 | FaceStatus& |
| 329 | FaceStatus::setNOutBytes(uint64_t nOutBytes) |
| 330 | { |
| 331 | m_wire.reset(); |
| 332 | m_nOutBytes = nOutBytes; |
| 333 | return *this; |
| 334 | } |
| 335 | |
| 336 | void |
| 337 | FaceStatus::wireReset() const |
| 338 | { |
| 339 | m_wire.reset(); |
| 340 | } |
| 341 | |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 342 | std::ostream& |
| 343 | operator<<(std::ostream& os, const FaceStatus& status) |
| 344 | { |
| 345 | os << "FaceStatus(" |
| 346 | << "FaceID: " << status.getFaceId() << ",\n" |
| 347 | << "RemoteUri: " << status.getRemoteUri() << ",\n" |
| 348 | << "LocalUri: " << status.getLocalUri() << ",\n"; |
| 349 | |
| 350 | if (status.hasExpirationPeriod()) { |
| 351 | os << "ExpirationPeriod: " << status.getExpirationPeriod() << ",\n"; |
| 352 | } |
| 353 | else { |
| 354 | os << "ExpirationPeriod: infinite,\n"; |
| 355 | } |
| 356 | |
Chengyu Fan | 36dca99 | 2014-09-25 13:42:03 -0600 | [diff] [blame] | 357 | os << "FaceScope: " << status.getFaceScope() << ",\n" |
| 358 | << "FacePersistency: " << status.getFacePersistency() << ",\n" |
Eric Newberry | 1ce8ab2 | 2016-09-24 11:57:21 -0700 | [diff] [blame] | 359 | << "LinkType: " << status.getLinkType() << ",\n"; |
| 360 | |
| 361 | auto osFlags = os.flags(); |
| 362 | os << "Flags: " << std::showbase << std::hex << status.getFlags() << ",\n"; |
| 363 | os.flags(osFlags); |
| 364 | |
| 365 | os << "Counters: { Interests: {in: " << status.getNInInterests() << ", " |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 366 | << "out: " << status.getNOutInterests() << "},\n" |
| 367 | << " Data: {in: " << status.getNInDatas() << ", " |
| 368 | << "out: " << status.getNOutDatas() << "},\n" |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 369 | << " Nack: {in: " << status.getNInNacks() << ", " |
| 370 | << "out: " << status.getNOutNacks() << "},\n" |
Junxiao Shi | 13e637f | 2014-07-16 19:20:40 -0700 | [diff] [blame] | 371 | << " bytes: {in: " << status.getNInBytes() << ", " |
| 372 | << "out: " << status.getNOutBytes() << "} }\n" |
| 373 | << ")"; |
| 374 | return os; |
| 375 | } |
| 376 | |
| 377 | } // namespace nfd |
| 378 | } // namespace ndn |