Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 3 | * Copyright (c) 2013-2017 Regents of the University of California. |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -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 "forwarder-status.hpp" |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 23 | #include "encoding/block-helpers.hpp" |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 24 | #include "encoding/encoding-buffer.hpp" |
| 25 | #include "encoding/tlv-nfd.hpp" |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 26 | #include "util/concepts.hpp" |
| 27 | |
| 28 | namespace ndn { |
| 29 | namespace nfd { |
| 30 | |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 31 | BOOST_CONCEPT_ASSERT((StatusDatasetItem<ForwarderStatus>)); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 32 | |
| 33 | ForwarderStatus::ForwarderStatus() |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 34 | : m_nNameTreeEntries(0) |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 35 | , m_nFibEntries(0) |
| 36 | , m_nPitEntries(0) |
| 37 | , m_nMeasurementsEntries(0) |
| 38 | , m_nCsEntries(0) |
| 39 | , m_nInInterests(0) |
| 40 | , m_nInDatas(0) |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 41 | , m_nInNacks(0) |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 42 | , m_nOutInterests(0) |
| 43 | , m_nOutDatas(0) |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 44 | , m_nOutNacks(0) |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 45 | { |
| 46 | } |
| 47 | |
| 48 | ForwarderStatus::ForwarderStatus(const Block& payload) |
| 49 | { |
| 50 | this->wireDecode(payload); |
| 51 | } |
| 52 | |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 53 | template<encoding::Tag TAG> |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 54 | size_t |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 55 | ForwarderStatus::wireEncode(EncodingImpl<TAG>& encoder) const |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 56 | { |
| 57 | size_t totalLength = 0; |
| 58 | |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 59 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NOutNacks, |
| 60 | m_nOutNacks); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 61 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NOutDatas, |
| 62 | m_nOutDatas); |
| 63 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NOutInterests, |
| 64 | m_nOutInterests); |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 65 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NInNacks, |
| 66 | m_nInNacks); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 67 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NInDatas, |
| 68 | m_nInDatas); |
| 69 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NInInterests, |
| 70 | m_nInInterests); |
| 71 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NCsEntries, |
| 72 | m_nCsEntries); |
| 73 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NMeasurementsEntries, |
| 74 | m_nMeasurementsEntries); |
| 75 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NPitEntries, |
| 76 | m_nPitEntries); |
| 77 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NFibEntries, |
| 78 | m_nFibEntries); |
| 79 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NNameTreeEntries, |
| 80 | m_nNameTreeEntries); |
| 81 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::CurrentTimestamp, |
| 82 | time::toUnixTimestamp(m_currentTimestamp).count()); |
| 83 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::StartTimestamp, |
| 84 | time::toUnixTimestamp(m_startTimestamp).count()); |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 85 | totalLength += encoder.prependByteArrayBlock(tlv::nfd::NfdVersion, |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 86 | reinterpret_cast<const uint8_t*>(m_nfdVersion.data()), |
| 87 | m_nfdVersion.size()); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 88 | |
| 89 | totalLength += encoder.prependVarNumber(totalLength); |
| 90 | totalLength += encoder.prependVarNumber(tlv::Content); |
| 91 | return totalLength; |
| 92 | } |
| 93 | |
| 94 | template size_t |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 95 | ForwarderStatus::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const; |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 96 | |
| 97 | template size_t |
Alexander Afanasyev | 7463389 | 2015-02-08 18:08:46 -0800 | [diff] [blame] | 98 | ForwarderStatus::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const; |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 99 | |
| 100 | const Block& |
| 101 | ForwarderStatus::wireEncode() const |
| 102 | { |
| 103 | if (m_wire.hasWire()) |
| 104 | return m_wire; |
| 105 | |
| 106 | EncodingEstimator estimator; |
| 107 | size_t estimatedSize = wireEncode(estimator); |
| 108 | |
| 109 | EncodingBuffer buffer(estimatedSize, 0); |
| 110 | wireEncode(buffer); |
| 111 | |
| 112 | m_wire = buffer.block(); |
| 113 | return m_wire; |
| 114 | } |
| 115 | |
| 116 | void |
| 117 | ForwarderStatus::wireDecode(const Block& block) |
| 118 | { |
| 119 | if (block.type() != tlv::Content) { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 120 | BOOST_THROW_EXCEPTION(Error("expecting Content block for Status payload")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 121 | } |
| 122 | m_wire = block; |
| 123 | m_wire.parse(); |
| 124 | Block::element_const_iterator val = m_wire.elements_begin(); |
| 125 | |
| 126 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NfdVersion) { |
Hila Ben Abraham | 23f9e78 | 2014-12-02 02:21:34 -0600 | [diff] [blame] | 127 | m_nfdVersion.assign(reinterpret_cast<const char*>(val->value()), val->value_size()); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 128 | ++val; |
| 129 | } |
| 130 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 131 | BOOST_THROW_EXCEPTION(Error("missing required NfdVersion field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::StartTimestamp) { |
| 135 | m_startTimestamp = time::fromUnixTimestamp(time::milliseconds(readNonNegativeInteger(*val))); |
| 136 | ++val; |
| 137 | } |
| 138 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 139 | BOOST_THROW_EXCEPTION(Error("missing required StartTimestamp field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::CurrentTimestamp) { |
| 143 | m_currentTimestamp = time::fromUnixTimestamp(time::milliseconds(readNonNegativeInteger(*val))); |
| 144 | ++val; |
| 145 | } |
| 146 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 147 | BOOST_THROW_EXCEPTION(Error("missing required CurrentTimestamp field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NNameTreeEntries) { |
| 151 | m_nNameTreeEntries = static_cast<size_t>(readNonNegativeInteger(*val)); |
| 152 | ++val; |
| 153 | } |
| 154 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 155 | BOOST_THROW_EXCEPTION(Error("missing required NNameTreeEntries field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NFibEntries) { |
| 159 | m_nFibEntries = static_cast<size_t>(readNonNegativeInteger(*val)); |
| 160 | ++val; |
| 161 | } |
| 162 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 163 | BOOST_THROW_EXCEPTION(Error("missing required NFibEntries field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NPitEntries) { |
| 167 | m_nPitEntries = static_cast<size_t>(readNonNegativeInteger(*val)); |
| 168 | ++val; |
| 169 | } |
| 170 | else { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 171 | BOOST_THROW_EXCEPTION(Error("missing required NPitEntries field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NMeasurementsEntries) { |
| 175 | m_nMeasurementsEntries = static_cast<size_t>(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 NMeasurementsEntries field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NCsEntries) { |
| 183 | m_nCsEntries = static_cast<size_t>(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 NCsEntries field")); |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) { |
| 191 | m_nInInterests = static_cast<uint64_t>(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 | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) { |
| 199 | m_nInDatas = static_cast<uint64_t>(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 | 65f1a71 | 2014-11-20 14:59:36 -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 = static_cast<uint64_t>(readNonNegativeInteger(*val)); |
| 208 | ++val; |
| 209 | } |
| 210 | else { |
| 211 | BOOST_THROW_EXCEPTION(Error("missing required NInNacks field")); |
| 212 | } |
| 213 | |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 214 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) { |
| 215 | m_nOutInterests = static_cast<uint64_t>(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 | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) { |
| 223 | m_nOutDatas = static_cast<uint64_t>(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 | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 228 | } |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 229 | |
| 230 | if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutNacks) { |
| 231 | m_nOutNacks = static_cast<uint64_t>(readNonNegativeInteger(*val)); |
| 232 | ++val; |
| 233 | } |
| 234 | else { |
| 235 | BOOST_THROW_EXCEPTION(Error("missing required NInNacks field")); |
| 236 | } |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | ForwarderStatus& |
Hila Ben Abraham | 23f9e78 | 2014-12-02 02:21:34 -0600 | [diff] [blame] | 240 | ForwarderStatus::setNfdVersion(const std::string& nfdVersion) |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 241 | { |
| 242 | m_wire.reset(); |
| 243 | m_nfdVersion = nfdVersion; |
| 244 | return *this; |
| 245 | } |
| 246 | |
| 247 | ForwarderStatus& |
| 248 | ForwarderStatus::setStartTimestamp(const time::system_clock::TimePoint& startTimestamp) |
| 249 | { |
| 250 | m_wire.reset(); |
| 251 | m_startTimestamp = startTimestamp; |
| 252 | return *this; |
| 253 | } |
| 254 | |
| 255 | ForwarderStatus& |
| 256 | ForwarderStatus::setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp) |
| 257 | { |
| 258 | m_wire.reset(); |
| 259 | m_currentTimestamp = currentTimestamp; |
| 260 | return *this; |
| 261 | } |
| 262 | |
| 263 | ForwarderStatus& |
| 264 | ForwarderStatus::setNNameTreeEntries(size_t nNameTreeEntries) |
| 265 | { |
| 266 | m_wire.reset(); |
| 267 | m_nNameTreeEntries = nNameTreeEntries; |
| 268 | return *this; |
| 269 | } |
| 270 | |
| 271 | ForwarderStatus& |
| 272 | ForwarderStatus::setNFibEntries(size_t nFibEntries) |
| 273 | { |
| 274 | m_wire.reset(); |
| 275 | m_nFibEntries = nFibEntries; |
| 276 | return *this; |
| 277 | } |
| 278 | |
| 279 | ForwarderStatus& |
| 280 | ForwarderStatus::setNPitEntries(size_t nPitEntries) |
| 281 | { |
| 282 | m_wire.reset(); |
| 283 | m_nPitEntries = nPitEntries; |
| 284 | return *this; |
| 285 | } |
| 286 | |
| 287 | ForwarderStatus& |
| 288 | ForwarderStatus::setNMeasurementsEntries(size_t nMeasurementsEntries) |
| 289 | { |
| 290 | m_wire.reset(); |
| 291 | m_nMeasurementsEntries = nMeasurementsEntries; |
| 292 | return *this; |
| 293 | } |
| 294 | |
| 295 | ForwarderStatus& |
| 296 | ForwarderStatus::setNCsEntries(size_t nCsEntries) |
| 297 | { |
| 298 | m_wire.reset(); |
| 299 | m_nCsEntries = nCsEntries; |
| 300 | return *this; |
| 301 | } |
| 302 | |
| 303 | ForwarderStatus& |
| 304 | ForwarderStatus::setNInInterests(uint64_t nInInterests) |
| 305 | { |
| 306 | m_wire.reset(); |
| 307 | m_nInInterests = nInInterests; |
| 308 | return *this; |
| 309 | } |
| 310 | |
| 311 | ForwarderStatus& |
| 312 | ForwarderStatus::setNInDatas(uint64_t nInDatas) |
| 313 | { |
| 314 | m_wire.reset(); |
| 315 | m_nInDatas = nInDatas; |
| 316 | return *this; |
| 317 | } |
| 318 | |
| 319 | ForwarderStatus& |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 320 | ForwarderStatus::setNInNacks(uint64_t nInNacks) |
| 321 | { |
| 322 | m_wire.reset(); |
| 323 | m_nInNacks = nInNacks; |
| 324 | return *this; |
| 325 | } |
| 326 | |
| 327 | ForwarderStatus& |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 328 | ForwarderStatus::setNOutInterests(uint64_t nOutInterests) |
| 329 | { |
| 330 | m_wire.reset(); |
| 331 | m_nOutInterests = nOutInterests; |
| 332 | return *this; |
| 333 | } |
| 334 | |
| 335 | ForwarderStatus& |
| 336 | ForwarderStatus::setNOutDatas(uint64_t nOutDatas) |
| 337 | { |
| 338 | m_wire.reset(); |
| 339 | m_nOutDatas = nOutDatas; |
| 340 | return *this; |
| 341 | } |
| 342 | |
Eric Newberry | 95bd96a | 2015-09-04 23:34:22 -0700 | [diff] [blame] | 343 | ForwarderStatus& |
| 344 | ForwarderStatus::setNOutNacks(uint64_t nOutNacks) |
| 345 | { |
| 346 | m_wire.reset(); |
| 347 | m_nOutNacks = nOutNacks; |
| 348 | return *this; |
| 349 | } |
| 350 | |
Davide Pesavento | 25e3d8c | 2017-02-08 22:17:46 -0500 | [diff] [blame] | 351 | bool |
| 352 | operator==(const ForwarderStatus& a, const ForwarderStatus& b) |
| 353 | { |
| 354 | return a.getNfdVersion() == b.getNfdVersion() && |
| 355 | a.getStartTimestamp() == b.getStartTimestamp() && |
| 356 | a.getCurrentTimestamp() == b.getCurrentTimestamp() && |
| 357 | a.getNNameTreeEntries() == b.getNNameTreeEntries() && |
| 358 | a.getNFibEntries() == b.getNFibEntries() && |
| 359 | a.getNPitEntries() == b.getNPitEntries() && |
| 360 | a.getNMeasurementsEntries() == b.getNMeasurementsEntries() && |
| 361 | a.getNCsEntries() == b.getNCsEntries() && |
| 362 | a.getNInInterests() == b.getNInInterests() && |
| 363 | a.getNInDatas() == b.getNInDatas() && |
| 364 | a.getNInNacks() == b.getNInNacks() && |
| 365 | a.getNOutInterests() == b.getNOutInterests() && |
| 366 | a.getNOutDatas() == b.getNOutDatas() && |
| 367 | a.getNOutNacks() == b.getNOutNacks(); |
| 368 | } |
| 369 | |
| 370 | std::ostream& |
| 371 | operator<<(std::ostream& os, const ForwarderStatus& status) |
| 372 | { |
| 373 | os << "GeneralStatus(NfdVersion: " << status.getNfdVersion() << ",\n" |
| 374 | << " StartTimestamp: " << status.getStartTimestamp() << ",\n" |
| 375 | << " CurrentTimestamp: " << status.getCurrentTimestamp() << ",\n" |
| 376 | << " Counters: {NameTreeEntries: " << status.getNNameTreeEntries() << ",\n" |
| 377 | << " FibEntries: " << status.getNFibEntries() << ",\n" |
| 378 | << " PitEntries: " << status.getNPitEntries() << ",\n" |
| 379 | << " MeasurementsEntries: " << status.getNMeasurementsEntries() << ",\n" |
| 380 | << " CsEntries: " << status.getNCsEntries() << ",\n" |
| 381 | << " Interests: {in: " << status.getNInInterests() << ", " |
| 382 | << "out: " << status.getNOutInterests() << "},\n" |
| 383 | << " Data: {in: " << status.getNInDatas() << ", " |
| 384 | << "out: " << status.getNOutDatas() << "},\n" |
| 385 | << " Nacks: {in: " << status.getNInNacks() << ", " |
| 386 | << "out: " << status.getNOutNacks() << "}}\n" |
| 387 | << " )"; |
| 388 | |
| 389 | return os; |
| 390 | } |
| 391 | |
Junxiao Shi | 65f1a71 | 2014-11-20 14:59:36 -0700 | [diff] [blame] | 392 | } // namespace nfd |
| 393 | } // namespace ndn |