34 static_assert(std::is_base_of<tlv::Error, ControlParameters::Error>::value,
35 "ControlParameters::Error must inherit from tlv::Error");
48 template<encoding::Tag TAG>
52 size_t totalLength = 0;
90 totalLength += encoder.prependVarNumber(totalLength);
109 m_wire = buffer.block();
117 BOOST_THROW_EXCEPTION(
Error(
"Expecting TLV-TYPE ControlParameters"));
150 m_origin = readNonNegativeIntegerAs<RouteOrigin>(*val);
175 if (val->elements().empty()) {
176 BOOST_THROW_EXCEPTION(
Error(
"Expecting Strategy/Name"));
179 m_strategy.
wireDecode(*val->elements_begin());
192 m_facePersistency = readNonNegativeIntegerAs<FacePersistency>(*val);
200 BOOST_THROW_EXCEPTION(std::out_of_range(
"bit must be within range [0, 64)"));
214 BOOST_THROW_EXCEPTION(std::out_of_range(
"bit must be within range [0, 64)"));
228 BOOST_THROW_EXCEPTION(std::out_of_range(
"bit must be within range [0, 64)"));
236 flags &= ~(1 << bit);
253 BOOST_THROW_EXCEPTION(std::out_of_range(
"bit must be within range [0, 64)"));
272 os <<
"ControlParameters(";
275 os <<
"Name: " << parameters.
getName() <<
", ";
279 os <<
"FaceId: " << parameters.
getFaceId() <<
", ";
282 if (parameters.
hasUri()) {
283 os <<
"Uri: " << parameters.
getUri() <<
", ";
287 os <<
"LocalUri: " << parameters.
getLocalUri() <<
", ";
291 os <<
"Origin: " << parameters.
getOrigin() <<
", ";
295 os <<
"Cost: " << parameters.
getCost() <<
", ";
307 os <<
"Strategy: " << parameters.
getStrategy() <<
", ";
uint64_t getFlags() const
void wireDecode(const Block &wire) final
Copyright (c) 2013-2017 Regents of the University of California.
const std::string & getLocalUri() const
const Name & getStrategy() const
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
represents parameters in a ControlCommand request or response
element_const_iterator find(uint32_t type) const
Find the first sub element of specified TLV-TYPE.
element_container::const_iterator element_const_iterator
Helper class to convert a number to hexadecimal format, for use with stream insertion operators...
size_t prependNestedBlock(EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
Prepend a TLV element containing a nested TLV element.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
ControlParameters & setFlags(uint64_t flags)
bool hasExpirationPeriod() const
ControlParameters & unsetMask()
Represents a TLV element of NDN packet format.
size_t prependStringBlock(EncodingImpl< TAG > &encoder, uint32_t type, const std::string &value)
Prepend a TLV element containing a string.
std::string readString(const Block &block)
Read TLV-VALUE of a TLV element as a string.
ControlParameters & unsetFlags()
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
ControlParameters & unsetFlagBit(size_t bit)
disable a bit in Mask
BOOST_CONCEPT_ASSERT((StatusDatasetItem< ChannelStatus >))
RouteOrigin getOrigin() const
Block wireEncode() const final
bool hasFacePersistency() const
const Name & getName() const
bool getFlagBit(size_t bit) const
#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
FacePersistency getFacePersistency() const
void parse() const
Parse TLV-VALUE into sub elements.
uint32_t type() const
Get TLV-TYPE.
uint64_t getFaceId() const
const time::milliseconds & getExpirationPeriod() const
bool hasWire() const
Check if the Block has fully encoded wire.
bool hasFlagBit(size_t bit) const
element_const_iterator elements_end() const
Equivalent to elements().end()
void wireDecode(const Block &wire)
Decode name from wire encoding.
ControlParameters & setMask(uint64_t mask)
ControlParameters & setFlagBit(size_t bit, bool value, bool wantMask=true)
set a bit in Flags
EncodingImpl< EncoderTag > EncodingBuffer
const std::string & getUri() const
EncodingImpl< EstimatorTag > EncodingEstimator