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);
93 FaceStatus::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block)
const;
96 FaceStatus::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block)
const;
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";
void wireDecode(const Block &wire)
decode FaceStatus
LinkType getLinkType() const
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.
FaceStatus & setNInDatas(uint64_t nInDatas)
EncodingImpl< EstimatorTag > EncodingEstimator
bool hasExpirationPeriod() const
FaceScope getFaceScope() const
uint64_t getNInDatas() const
FaceStatus & setNOutDatas(uint64_t nOutDatas)
FacePersistency m_facePersistency
Class representing a wire element of NDN-TLV packet format.
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.
element_const_iterator elements_end() const
FaceStatus & setNInInterests(uint64_t nInInterests)
element_const_iterator elements_begin() const
FaceStatus & setNInBytes(uint64_t nInBytes)
uint64_t getNInInterests() const
EncodingImpl< EncoderTag > EncodingBuffer
Copyright (c) 2011-2015 Regents of the University of California.
FaceStatus & setExpirationPeriod(const time::milliseconds &expirationPeriod)
uint64_t getFaceId() const
element_container::const_iterator element_const_iterator
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
void reset()
Reset wire buffer of the element.
const std::string & getLocalUri() const
uint64_t getNOutBytes() const
void parse() const
Parse wire buffer into subblocks.
const std::string & getRemoteUri() const
uint64_t getNOutInterests() const
FacePersistency getFacePersistency() const
const time::milliseconds & getExpirationPeriod() const
uint64_t getNInBytes() const
bool hasWire() const
Check if the Block has fully encoded wire.
uint64_t getNOutDatas() const
a concept check for TLV abstraction with .wireEncode method
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
const Block & wireEncode() const
encode FaceStatus