33 size_t valueLength = encoder.prependNonNegativeInteger(value);
34 size_t totalLength = valueLength;
35 totalLength += encoder.prependVarNumber(valueLength);
36 totalLength += encoder.prependVarNumber(type);
56 return encoder.
block();
72 size_t totalLength = encoder.prependVarNumber(0);
73 totalLength += encoder.prependVarNumber(type);
93 return encoder.
block();
102 return encoder.prependByteArrayBlock(type, reinterpret_cast<const uint8_t*>(value.data()), value.size());
120 return std::string(reinterpret_cast<const char*>(block.
value()), block.
value_size());
134 return encoder.
block();
140 return makeBinaryBlock(type, reinterpret_cast<const uint8_t*>(value), length);
Copyright (c) 2011-2015 Regents of the University of California.
EncodingImpl specialization for actual TLV encoding.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
Block makeEmptyBlock(uint32_t type)
Create an empty TLV block.
template size_t prependEmptyBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &, uint32_t)
template size_t prependNonNegativeIntegerBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &, uint32_t, uint64_t)
size_t value_size() const
Get size of TLV-VALUE aka TLV-LENGTH.
template size_t prependNonNegativeIntegerBlock< EncoderTag >(EncodingImpl< EncoderTag > &, uint32_t, uint64_t)
size_t prependByteArrayBlock(uint32_t type, const uint8_t *array, size_t arraySize)
Prepend TLV block of type type and value from buffer array of size arraySize.
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.
const uint8_t * value() const
Get pointer to TLV-VALUE.
Block makeNonNegativeIntegerBlock(uint32_t type, uint64_t value)
Create a TLV block containing a non-negative integer.
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
EncodingImpl specialization for TLV size estimation.
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
template size_t prependEmptyBlock< EncoderTag >(EncodingImpl< EncoderTag > &, uint32_t)
template size_t prependStringBlock< EncoderTag >(EncodingImpl< EncoderTag > &, uint32_t, const std::string &)
Block block(bool verifyLength=true) const
Create Block from the underlying buffer.
uint64_t readNonNegativeInteger(size_t size, Iterator &begin, const Iterator &end)
Read nonNegativeInteger in NDN-TLV encoding.
size_t prependEmptyBlock(EncodingImpl< TAG > &encoder, uint32_t type)
Prepend an empty TLV element.
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block copying TLV-VALUE from raw buffer.
Block makeStringBlock(uint32_t type, const std::string &value)
Create a TLV block containing a string.
Buffer::const_iterator value_end() const
Get end iterator of TLV-VALUE.
size_t prependByteArrayBlock(uint32_t type, const uint8_t *array, size_t arraySize)
Prepend TLV block of type type and value from buffer array of size arraySize.
template size_t prependStringBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &, uint32_t, const std::string &)