40 template<encoding::Tag TAG>
44 size_t totalLength = 0;
51 m_defaultCongestionThreshold);
55 m_baseCongestionMarkingInterval.count());
62 m_expirationPeriod.count());
98 totalLength += encoder.prependVarNumber(totalLength);
117 m_wire = buffer.block();
159 m_origin = readNonNegativeIntegerAs<RouteOrigin>(*val);
196 if (val->elements().empty()) {
200 m_strategy.
wireDecode(*val->elements_begin());
213 m_facePersistency = readNonNegativeIntegerAs<FacePersistency>(*val);
239 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
253 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
267 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
275 flags &= ~(1 << bit);
292 NDN_THROW(std::out_of_range(
"bit must be within range [0, 64)"));
311 os <<
"ControlParameters(";
314 os <<
"Name: " << parameters.
getName() <<
", ";
318 os <<
"FaceId: " << parameters.
getFaceId() <<
", ";
321 if (parameters.
hasUri()) {
322 os <<
"Uri: " << parameters.
getUri() <<
", ";
326 os <<
"LocalUri: " << parameters.
getLocalUri() <<
", ";
330 os <<
"Origin: " << parameters.
getOrigin() <<
", ";
334 os <<
"Cost: " << parameters.
getCost() <<
", ";
338 os <<
"Capacity: " << parameters.
getCapacity() <<
", ";
342 os <<
"Count: " << parameters.
getCount() <<
", ";
354 os <<
"Strategy: " << parameters.
getStrategy() <<
", ";
373 if (parameters.
hasMtu()) {
374 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
Prepend wire encoding to encoder.
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, std::string_view value)
Prepend a TLV element containing a string.
std::string readString(const Block &block)
Read the TLV-VALUE of a TLV element as a string.
EncodingImpl< EncoderTag > EncodingBuffer
Contains classes and functions related to the NFD Management protocol.
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
::boost::chrono::milliseconds milliseconds
::boost::chrono::nanoseconds nanoseconds
@ BaseCongestionMarkingInterval
@ DefaultCongestionThreshold