33 static_assert(std::is_base_of<tlv::Error, FaceStatus::Error>::value,
34 "FaceStatus::Error must inherit from tlv::Error");
37 : m_hasExpirationPeriod(false)
52 template<encoding::Tag TAG>
56 size_t totalLength = 0;
76 if (m_hasExpirationPeriod) {
87 totalLength += encoder.prependVarNumber(totalLength);
110 m_wire = buffer.block();
118 BOOST_THROW_EXCEPTION(Error(
"expecting FaceStatus block"));
129 BOOST_THROW_EXCEPTION(Error(
"missing required FaceId field"));
133 m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
137 BOOST_THROW_EXCEPTION(Error(
"missing required Uri field"));
141 m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
145 BOOST_THROW_EXCEPTION(Error(
"missing required LocalUri field"));
150 m_hasExpirationPeriod =
true;
154 m_hasExpirationPeriod =
false;
163 BOOST_THROW_EXCEPTION(Error(
"missing required FaceScope field"));
171 BOOST_THROW_EXCEPTION(Error(
"missing required FacePersistency field"));
179 BOOST_THROW_EXCEPTION(Error(
"missing required LinkType field"));
187 BOOST_THROW_EXCEPTION(Error(
"missing required NInInterests field"));
195 BOOST_THROW_EXCEPTION(Error(
"missing required NInDatas field"));
203 BOOST_THROW_EXCEPTION(Error(
"missing required NOutInterests field"));
211 BOOST_THROW_EXCEPTION(Error(
"missing required NOutDatas field"));
219 BOOST_THROW_EXCEPTION(Error(
"missing required NInBytes field"));
227 BOOST_THROW_EXCEPTION(Error(
"missing required NOutBytes field"));
235 m_expirationPeriod = expirationPeriod;
236 m_hasExpirationPeriod =
true;
244 m_nInInterests = nInInterests;
252 m_nInDatas = nInDatas;
260 m_nOutInterests = nOutInterests;
268 m_nOutDatas = nOutDatas;
276 m_nInBytes = nInBytes;
284 m_nOutBytes = nOutBytes;
298 <<
"FaceID: " << status.
getFaceId() <<
",\n" 306 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 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)
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
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