33 static_assert(std::is_base_of<tlv::Error, FaceEventNotification::Error>::value,
34 "FaceEventNotification::Error must inherit from tlv::Error");
46 template<encoding::Tag TAG>
50 size_t totalLength = 0;
69 totalLength += encoder.prependVarNumber(totalLength);
86 m_wire = buffer.block();
94 BOOST_THROW_EXCEPTION(Error(
"expecting FaceEventNotification block"));
105 BOOST_THROW_EXCEPTION(Error(
"missing required FaceEventKind field"));
113 BOOST_THROW_EXCEPTION(Error(
"missing required FaceId field"));
117 m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
121 BOOST_THROW_EXCEPTION(Error(
"missing required Uri field"));
125 m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
129 BOOST_THROW_EXCEPTION(Error(
"missing required LocalUri field"));
137 BOOST_THROW_EXCEPTION(Error(
"missing required FaceScope field"));
145 BOOST_THROW_EXCEPTION(Error(
"missing required FacePersistency field"));
153 BOOST_THROW_EXCEPTION(Error(
"missing required LinkType field"));
160 BOOST_THROW_EXCEPTION(Error(
"missing required Flags field"));
181 os <<
"FaceEventNotification(";
183 switch (notification.
getKind())
186 os <<
"Kind: created, ";
189 os <<
"Kind: destroyed, ";
195 os <<
"Kind: down, ";
199 os <<
"FaceID: " << notification.
getFaceId() <<
", " 201 <<
"LocalUri: " << notification.
getLocalUri() <<
", " 204 <<
"LinkType: " << notification.
getLinkType() <<
", ";
206 auto osFlags = os.flags();
207 os <<
"Flags: " << std::showbase << std::hex << notification.
getFlags();
const std::string & getLocalUri() 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.
face went UP (from DOWN state)
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
EncodingImpl< EstimatorTag > EncodingEstimator
element_const_iterator elements_end() const
void parse() const
Parse wire buffer into subblocks.
represents a Face status change notification
FacePersistency m_facePersistency
Class representing a wire element of NDN-TLV packet format.
FaceEventNotification & setKind(FaceEventKind kind)
FaceScope getFaceScope() const
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
const std::string & getRemoteUri() const
EncodingImpl< EncoderTag > EncodingBuffer
Copyright (c) 2011-2015 Regents of the University of California.
FaceEventKind getKind() const
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 getFlags() const
const Block & wireEncode() const
encode FaceEventNotification
void wireDecode(const Block &wire)
decode FaceEventNotification
face went DOWN (from UP state)
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