33 static_assert(std::is_base_of<tlv::Error, ControlParameters::Error>::value,
34 "ControlParameters::Error must inherit from tlv::Error");
47 template<encoding::Tag TAG>
51 size_t totalLength = 0;
74 size_t valLength = encoder.prependByteArray(
75 reinterpret_cast<const uint8_t*>(m_uri.c_str()), m_uri.size());
76 totalLength += valLength;
77 totalLength += encoder.prependVarNumber(valLength);
87 totalLength += encoder.prependVarNumber(totalLength);
93 ControlParameters::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&)
const;
96 ControlParameters::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&)
const;
110 m_wire = buffer.block();
118 BOOST_THROW_EXCEPTION(
Error(
"Expecting TLV-TYPE ControlParameters"));
139 m_uri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
170 if (val->elements().empty()) {
171 BOOST_THROW_EXCEPTION(
Error(
"Expecting Strategy/Name"));
174 m_strategy.
wireDecode(*val->elements_begin());
188 os <<
"ControlParameters(";
191 os <<
"Name: " << parameters.
getName() <<
", ";
195 os <<
"FaceId: " << parameters.
getFaceId() <<
", ";
198 if (parameters.
hasUri()) {
199 os <<
"Uri: " << parameters.
getUri() <<
", ";
207 os <<
"Origin: " << parameters.
getOrigin() <<
", ";
211 os <<
"Cost: " << parameters.
getCost() <<
", ";
215 os <<
"Flags: " << parameters.
getFlags() <<
", ";
219 os <<
"Strategy: " << parameters.
getStrategy() <<
", ";
uint64_t getFlags() const
virtual void wireDecode(const Block &wire) final
Copyright (c) 2011-2015 Regents of the University of California.
const Name & getStrategy() const
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Helper to prepend TLV block type type containing non-negative integer value.
represents parameters in a ControlCommand request or response
virtual Block wireEncode() const final
EncodingImpl< EstimatorTag > EncodingEstimator
element_const_iterator find(uint32_t type) const
size_t prependNestedBlock(EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
Prepend a TLV block of type type with WireEncodable value as a value.
uint64_t getOrigin() const
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
bool hasExpirationPeriod() const
Class representing a wire element of NDN-TLV packet format.
bool hasLocalControlFeature() const
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
element_const_iterator elements_end() const
EncodingImpl< EncoderTag > EncodingBuffer
Copyright (c) 2011-2015 Regents of the University of California.
const Name & getName() const
element_container::const_iterator element_const_iterator
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
void parse() const
Parse wire buffer into subblocks.
LocalControlFeature getLocalControlFeature() const
uint64_t getFaceId() const
const time::milliseconds & getExpirationPeriod() const
bool hasWire() const
Check if the Block has fully encoded wire.
void wireDecode(const Block &wire)
a concept check for TLV abstraction with .wireEncode method
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
const std::string & getUri() const