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() <<
", ";
uint64_t getFlags() const
void wireDecode(const Block &wire) final
Copyright (c) 2011-2015 Regents of the University of California.
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
time::nanoseconds getBaseCongestionMarkingInterval() const
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.
void parse() const
Parse TLV-VALUE into sub-elements.
ControlParameters & setFlags(uint64_t flags)
ControlParameters & unsetMask()
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
Represents a TLV element of the NDN packet format.
size_t prependStringBlock(EncodingImpl< TAG > &encoder, uint32_t type, const std::string &value)
Prepend a TLV element containing a string.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
std::string readString(const Block &block)
Read TLV-VALUE of a TLV element as a string.
ControlParameters & unsetFlags()
bool hasBaseCongestionMarkingInterval() const
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
uint64_t getCapacity() const
FacePersistency getFacePersistency() const
const Name & getName() const
uint64_t getMtu() const
get MTU (measured in bytes)
element_const_iterator elements_end() const
Equivalent to elements().end()
uint64_t getCount() const
Block wireEncode() const final
Copyright (c) 2011-2015 Regents of the University of California.
element_const_iterator find(uint32_t type) const
Find the first sub-element of the specified TLV-TYPE.
const std::string & getLocalUri() const
uint64_t getDefaultCongestionThreshold() const
get default congestion threshold (measured in bytes)
bool hasExpirationPeriod() const
RouteOrigin getOrigin() const
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
bool hasFlagBit(size_t bit) const
uint64_t getFaceId() const
const std::string & getUri() const
bool hasFacePersistency() const
uint32_t type() const noexcept
Return the TLV-TYPE of the Block.
const time::milliseconds & getExpirationPeriod() const
bool hasDefaultCongestionThreshold() const
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
bool getFlagBit(size_t bit) const
void wireDecode(const Block &wire)
Decode name from wire encoding.
a concept check for TLV abstraction with .wireEncode method
const Name & getStrategy() const
ControlParameters & setMask(uint64_t mask)
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
ControlParameters & setFlagBit(size_t bit, bool value, bool wantMask=true)
set a bit in Flags
EncodingImpl< EncoderTag > EncodingBuffer
boost::chrono::nanoseconds nanoseconds
EncodingImpl< EstimatorTag > EncodingEstimator
boost::chrono::milliseconds milliseconds