33 static_assert(std::is_base_of<tlv::Error, FaceStatus::Error>::value,
34 "FaceStatus::Error must inherit from tlv::Error");
37 : m_hasExpirationPeriod(false)
54 template<encoding::Tag TAG>
58 size_t totalLength = 0;
84 if (m_hasExpirationPeriod) {
95 totalLength += encoder.prependVarNumber(totalLength);
118 m_wire = buffer.block();
126 BOOST_THROW_EXCEPTION(Error(
"expecting FaceStatus block"));
137 BOOST_THROW_EXCEPTION(Error(
"missing required FaceId field"));
141 m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
145 BOOST_THROW_EXCEPTION(Error(
"missing required Uri field"));
149 m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
153 BOOST_THROW_EXCEPTION(Error(
"missing required LocalUri field"));
158 m_hasExpirationPeriod =
true;
162 m_hasExpirationPeriod =
false;
171 BOOST_THROW_EXCEPTION(Error(
"missing required FaceScope field"));
179 BOOST_THROW_EXCEPTION(Error(
"missing required FacePersistency field"));
187 BOOST_THROW_EXCEPTION(Error(
"missing required LinkType field"));
195 BOOST_THROW_EXCEPTION(Error(
"missing required NInInterests field"));
203 BOOST_THROW_EXCEPTION(Error(
"missing required NInDatas field"));
211 BOOST_THROW_EXCEPTION(Error(
"missing required NInNacks field"));
219 BOOST_THROW_EXCEPTION(Error(
"missing required NOutInterests field"));
227 BOOST_THROW_EXCEPTION(Error(
"missing required NOutDatas field"));
235 BOOST_THROW_EXCEPTION(Error(
"missing required NOutNacks field"));
243 BOOST_THROW_EXCEPTION(Error(
"missing required NInBytes field"));
251 BOOST_THROW_EXCEPTION(Error(
"missing required NOutBytes field"));
259 BOOST_THROW_EXCEPTION(Error(
"missing required Flags field"));
267 m_expirationPeriod = expirationPeriod;
268 m_hasExpirationPeriod =
true;
276 m_nInInterests = nInInterests;
284 m_nInDatas = nInDatas;
292 m_nInNacks = nInNacks;
300 m_nOutInterests = nOutInterests;
308 m_nOutDatas = nOutDatas;
316 m_nOutNacks = nOutNacks;
324 m_nInBytes = nInBytes;
332 m_nOutBytes = nOutBytes;
346 <<
"FaceID: " << status.
getFaceId() <<
",\n" 354 os <<
"ExpirationPeriod: infinite,\n";
361 auto osFlags = os.flags();
362 os <<
"Flags: " << std::showbase << std::hex << status.
getFlags() <<
",\n";
365 os <<
"Counters: { Interests: {in: " << status.
getNInInterests() <<
", " const std::string & getLocalUri() const
void wireDecode(const Block &wire)
decode FaceStatus
uint64_t getNOutInterests() const
element_const_iterator elements_begin() const
bool hasWire() const
Check if the Block has fully encoded wire.
Copyright (c) 2011-2015 Regents of the University of California.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Helper to prepend TLV block type type containing non-negative integer value.
FacePersistency getFacePersistency() const
const time::milliseconds & getExpirationPeriod() const
FaceStatus & setNInDatas(uint64_t nInDatas)
EncodingImpl< EstimatorTag > EncodingEstimator
bool hasExpirationPeriod() const
uint64_t getNOutNacks() const
uint64_t getNOutBytes() const
uint64_t getNInInterests() const
element_const_iterator elements_end() const
FaceStatus & setNOutDatas(uint64_t nOutDatas)
void parse() const
Parse wire buffer into subblocks.
FacePersistency m_facePersistency
Class representing a wire element of NDN-TLV packet format.
FaceScope getFaceScope() const
FaceStatus & setNOutBytes(uint64_t nOutBytes)
FaceStatus & setNOutInterests(uint64_t nOutInterests)
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
const std::string & getRemoteUri() const
FaceStatus & setNInInterests(uint64_t nInInterests)
uint64_t getNInBytes() const
FaceStatus & setNInBytes(uint64_t nInBytes)
FaceStatus & setNInNacks(uint64_t nInNacks)
EncodingImpl< EncoderTag > EncodingBuffer
Copyright (c) 2011-2015 Regents of the University of California.
FaceStatus & setExpirationPeriod(const time::milliseconds &expirationPeriod)
element_container::const_iterator element_const_iterator
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
void reset()
Reset wire buffer of the element.
uint64_t getNOutDatas() const
uint64_t getNInDatas() const
uint64_t getFlags() const
FaceStatus & setNOutNacks(uint64_t nOutNacks)
const Block & wireEncode() const
encode FaceStatus
uint64_t getFaceId() const
a concept check for TLV abstraction with .wireEncode method
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
LinkType getLinkType() const
uint64_t getNInNacks() const