32 BOOST_CONCEPT_ASSERT((WireEncodable<ControlParameters>));
33 BOOST_CONCEPT_ASSERT((WireDecodable<ControlParameters>));
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;
59 m_defaultCongestionThreshold);
63 m_baseCongestionMarkingInterval.count());
70 m_expirationPeriod.count());
106 totalLength += encoder.prependVarNumber(totalLength);
125 m_wire = buffer.block();
167 m_origin = readNonNegativeIntegerAs<RouteOrigin>(*val);
204 if (val->elements().empty()) {
208 m_strategy.
wireDecode(*val->elements_begin());
221 m_facePersistency = readNonNegativeIntegerAs<FacePersistency>(*val);
247 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
261 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
275 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
283 flags &= ~(1 << bit);
300 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
319 os <<
"ControlParameters(";
322 os <<
"Name: " << parameters.
getName() <<
", ";
326 os <<
"FaceId: " << parameters.
getFaceId() <<
", ";
329 if (parameters.
hasUri()) {
330 os <<
"Uri: " << parameters.
getUri() <<
", ";
334 os <<
"LocalUri: " << parameters.
getLocalUri() <<
", ";
338 os <<
"Origin: " << parameters.
getOrigin() <<
", ";
342 os <<
"Cost: " << parameters.
getCost() <<
", ";
346 os <<
"Capacity: " << parameters.
getCapacity() <<
", ";
350 os <<
"Count: " << parameters.
getCount() <<
", ";
362 os <<
"Strategy: " << parameters.
getStrategy() <<
", ";
381 if (parameters.
hasMtu()) {
382 os <<
"Mtu: " << parameters.
getMtu() <<
", ";
Helper class to convert a number to hexadecimal format, for use with stream insertion operators.
Represents a TLV element of the NDN packet format.
element_container::const_iterator element_const_iterator
element_const_iterator find(uint32_t type) const
Find the first sub-element of the specified TLV-TYPE.
element_const_iterator elements_end() const noexcept
Equivalent to elements().end().
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
uint32_t type() const noexcept
Return the TLV-TYPE of the Block.
void parse() const
Parse TLV-VALUE into sub-elements.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
void wireDecode(const Block &wire)
Decode name from wire encoding.
Represents parameters in a ControlCommand request or response.
uint64_t getFlags() const
void wireDecode(const Block &wire) final
uint64_t getFaceId() const
ControlParameters & unsetFlags()
ControlParameters & unsetMask()
uint64_t getCapacity() const
Block wireEncode() const final
ControlParameters & unsetFlagBit(size_t bit)
Disable a bit in Mask.
uint64_t getDefaultCongestionThreshold() const
Get default congestion threshold (measured in bytes).
bool hasExpirationPeriod() const
bool hasBaseCongestionMarkingInterval() const
bool hasFacePersistency() const
FacePersistency getFacePersistency() const
bool hasDefaultCongestionThreshold() const
const std::string & getUri() const
ControlParameters & setFlagBit(size_t bit, bool value, bool wantMask=true)
Set a bit in Flags.
ControlParameters & setFlags(uint64_t flags)
uint64_t getCount() const
bool hasFlagBit(size_t bit) const
const std::string & getLocalUri() const
const Name & getName() const
const Name & getStrategy() const
const time::milliseconds & getExpirationPeriod() const
ControlParameters & setMask(uint64_t mask)
bool getFlagBit(size_t bit) const
RouteOrigin getOrigin() const
time::nanoseconds getBaseCongestionMarkingInterval() const
uint64_t getMtu() const
Get MTU (measured in bytes).
#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
@ CONTROL_PARAMETER_STRATEGY
@ CONTROL_PARAMETER_FACE_PERSISTENCY
@ CONTROL_PARAMETER_UBOUND
@ CONTROL_PARAMETER_DEFAULT_CONGESTION_THRESHOLD
@ CONTROL_PARAMETER_LOCAL_URI
@ CONTROL_PARAMETER_CAPACITY
@ CONTROL_PARAMETER_EXPIRATION_PERIOD
@ CONTROL_PARAMETER_FLAGS
@ CONTROL_PARAMETER_FACE_ID
@ CONTROL_PARAMETER_COUNT
@ CONTROL_PARAMETER_ORIGIN
@ CONTROL_PARAMETER_BASE_CONGESTION_MARKING_INTERVAL
EncodingImpl< EstimatorTag > EncodingEstimator
size_t prependNestedBlock(EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
Prepend a TLV element containing a nested TLV element.
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
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.
EncodingImpl< EncoderTag > EncodingBuffer
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
boost::chrono::milliseconds milliseconds
boost::chrono::nanoseconds nanoseconds
@ BaseCongestionMarkingInterval
@ DefaultCongestionThreshold