33 static_assert(std::is_base_of<tlv::Error, ForwarderStatus::Error>::value,
34 "ForwarderStatus::Error must inherit from tlv::Error");
37 : m_startTimestamp(
time::system_clock::TimePoint::min())
38 , m_currentTimestamp(
time::system_clock::TimePoint::min())
39 , m_nNameTreeEntries(0)
42 , m_nMeasurementsEntries(0)
58 template<encoding::Tag TAG>
62 size_t totalLength = 0;
79 m_nMeasurementsEntries);
91 reinterpret_cast<const uint8_t*>(m_nfdVersion.c_str()),
94 totalLength += encoder.prependVarNumber(totalLength);
117 m_wire = buffer.block();
125 BOOST_THROW_EXCEPTION(
Error(
"expecting Content block for Status payload"));
132 m_nfdVersion.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
136 BOOST_THROW_EXCEPTION(
Error(
"missing required NfdVersion field"));
144 BOOST_THROW_EXCEPTION(
Error(
"missing required StartTimestamp field"));
152 BOOST_THROW_EXCEPTION(
Error(
"missing required CurrentTimestamp field"));
160 BOOST_THROW_EXCEPTION(
Error(
"missing required NNameTreeEntries field"));
168 BOOST_THROW_EXCEPTION(
Error(
"missing required NFibEntries field"));
176 BOOST_THROW_EXCEPTION(
Error(
"missing required NPitEntries field"));
184 BOOST_THROW_EXCEPTION(
Error(
"missing required NMeasurementsEntries field"));
192 BOOST_THROW_EXCEPTION(
Error(
"missing required NCsEntries field"));
200 BOOST_THROW_EXCEPTION(
Error(
"missing required NInInterests field"));
208 BOOST_THROW_EXCEPTION(
Error(
"missing required NInDatas field"));
216 BOOST_THROW_EXCEPTION(
Error(
"missing required NInNacks field"));
224 BOOST_THROW_EXCEPTION(
Error(
"missing required NOutInterests field"));
232 BOOST_THROW_EXCEPTION(
Error(
"missing required NOutDatas field"));
240 BOOST_THROW_EXCEPTION(
Error(
"missing required NInNacks field"));
248 m_nfdVersion = nfdVersion;
256 m_startTimestamp = startTimestamp;
264 m_currentTimestamp = currentTimestamp;
272 m_nNameTreeEntries = nNameTreeEntries;
280 m_nFibEntries = nFibEntries;
288 m_nPitEntries = nPitEntries;
296 m_nMeasurementsEntries = nMeasurementsEntries;
304 m_nCsEntries = nCsEntries;
312 m_nInInterests = nInInterests;
320 m_nInDatas = nInDatas;
328 m_nInNacks = nInNacks;
336 m_nOutInterests = nOutInterests;
344 m_nOutDatas = nOutDatas;
352 m_nOutNacks = nOutNacks;
ForwarderStatus & setNOutDatas(uint64_t nOutDatas)
element_const_iterator elements_begin() const
bool hasWire() const
Check if the Block has fully encoded wire.
represents NFD Forwarder Status
Copyright (c) 2011-2015 Regents of the University of California.
ForwarderStatus & setNFibEntries(size_t nFibEntries)
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Helper to prepend TLV block type type containing non-negative integer value.
ForwarderStatus & setNOutNacks(uint64_t nOutNacks)
EncodingImpl< EstimatorTag > EncodingEstimator
element_const_iterator elements_end() const
ForwarderStatus & setNInNacks(uint64_t nInNacks)
void parse() const
Parse wire buffer into subblocks.
Class representing a wire element of NDN-TLV packet format.
ForwarderStatus & setNCsEntries(size_t nCsEntries)
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
ForwarderStatus & setNNameTreeEntries(size_t nNameTreeEntries)
ForwarderStatus & setNInInterests(uint64_t nInInterests)
EncodingImpl< EncoderTag > EncodingBuffer
ForwarderStatus & setStartTimestamp(const time::system_clock::TimePoint &startTimestamp)
Copyright (c) 2011-2015 Regents of the University of California.
element_container::const_iterator element_const_iterator
ForwarderStatus & setNfdVersion(const std::string &nfdVersion)
ForwarderStatus & setNOutInterests(uint64_t nOutInterests)
void reset()
Reset wire buffer of the element.
ForwarderStatus & setNPitEntries(size_t nPitEntries)
system_clock::TimePoint fromUnixTimestamp(const milliseconds &duration)
Convert UNIX timestamp to system_clock::TimePoint.
milliseconds toUnixTimestamp(const system_clock::TimePoint &point)
Convert system_clock::TimePoint to UNIX timestamp.
ForwarderStatus & setNInDatas(uint64_t nInDatas)
void wireDecode(const Block &wire)
decode ForwarderStatus from a Content block
a concept check for TLV abstraction with .wireEncode method
ForwarderStatus & setNMeasurementsEntries(size_t nMeasurementsEntries)
ForwarderStatus & setCurrentTimestamp(const time::system_clock::TimePoint ¤tTimestamp)
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
const Block & wireEncode() const
encode ForwarderStatus as a Content block