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;
82 if (m_hasExpirationPeriod) {
93 totalLength += encoder.prependVarNumber(totalLength);
116 m_wire = buffer.block();
124 BOOST_THROW_EXCEPTION(Error(
"expecting FaceStatus block"));
135 BOOST_THROW_EXCEPTION(Error(
"missing required FaceId field"));
139 m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
143 BOOST_THROW_EXCEPTION(Error(
"missing required Uri field"));
147 m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
151 BOOST_THROW_EXCEPTION(Error(
"missing required LocalUri field"));
156 m_hasExpirationPeriod =
true;
160 m_hasExpirationPeriod =
false;
169 BOOST_THROW_EXCEPTION(Error(
"missing required FaceScope field"));
177 BOOST_THROW_EXCEPTION(Error(
"missing required FacePersistency field"));
185 BOOST_THROW_EXCEPTION(Error(
"missing required LinkType field"));
193 BOOST_THROW_EXCEPTION(Error(
"missing required NInInterests field"));
201 BOOST_THROW_EXCEPTION(Error(
"missing required NInDatas field"));
209 BOOST_THROW_EXCEPTION(Error(
"missing required NInNacks field"));
217 BOOST_THROW_EXCEPTION(Error(
"missing required NOutInterests field"));
225 BOOST_THROW_EXCEPTION(Error(
"missing required NOutDatas field"));
233 BOOST_THROW_EXCEPTION(Error(
"missing required NOutNacks field"));
241 BOOST_THROW_EXCEPTION(Error(
"missing required NInBytes field"));
249 BOOST_THROW_EXCEPTION(Error(
"missing required NOutBytes field"));
257 m_expirationPeriod = expirationPeriod;
258 m_hasExpirationPeriod =
true;
266 m_nInInterests = nInInterests;
274 m_nInDatas = nInDatas;
282 m_nInNacks = nInNacks;
290 m_nOutInterests = nOutInterests;
298 m_nOutDatas = nOutDatas;
306 m_nOutNacks = nOutNacks;
314 m_nInBytes = nInBytes;
322 m_nOutBytes = nOutBytes;
336 <<
"FaceID: " << status.
getFaceId() <<
",\n" 344 os <<
"ExpirationPeriod: infinite,\n";
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
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