31 size_t valueLength = encoder.prependNonNegativeInteger(value);
32 size_t totalLength = valueLength;
33 totalLength += encoder.prependVarNumber(valueLength);
34 totalLength += encoder.prependVarNumber(type);
41 uint32_t type, uint64_t value);
45 uint32_t type, uint64_t value);
57 return encoder.
block();
73 size_t totalLength = encoder.prependVarNumber(0);
74 totalLength += encoder.prependVarNumber(type);
95 return encoder.
block();
104 size_t valueLength = encoder.prependByteArray(reinterpret_cast<const uint8_t*>(value.data()),
106 size_t totalLength = valueLength;
107 totalLength += encoder.prependVarNumber(valueLength);
108 totalLength += encoder.prependVarNumber(type);
115 uint32_t type,
const std::string& value);
119 uint32_t type,
const std::string& value);
131 return encoder.
block();
137 return std::string(reinterpret_cast<const char*>(block.
value()), block.
value_size());
151 return encoder.
block();
157 return makeBinaryBlock(type, reinterpret_cast<const uint8_t*>(value), length);
Copyright (c) 2011-2015 Regents of the University of California.
EncodingImpl specialization for real TLV encoding.
template size_t prependStringBlock< EncoderTag >(EncodingImpl< EncoderTag > &encoder, uint32_t type, const std::string &value)
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Helper to prepend TLV block type type containing non-negative integer value.
Block makeEmptyBlock(uint32_t type)
Create a TLV block type type containing no value (i.e., a boolean block)
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.
Class representing a wire element of NDN-TLV packet format.
size_t prependStringBlock(EncodingImpl< TAG > &encoder, uint32_t type, const std::string &value)
Helper to prepend TLV block type type with value from a string value.
std::string readString(const Block &block)
Helper to read a string value from a block.
Block makeNonNegativeIntegerBlock(uint32_t type, uint64_t value)
Create a TLV block type type containing non-negative integer value.
Buffer::const_iterator value_begin() const
Buffer::const_iterator value_end() const
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
EncodingImpl specialization TLV size estimation.
template size_t prependStringBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &encoder, uint32_t type, const std::string &value)
size_t prependEmptyBlock(EncodingImpl< TAG > &encoder, uint32_t type)
Helper to prepend TLV block type type containing no value (i.e., a boolean block) ...
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block type type with value from a buffer value of size length.
template size_t prependEmptyBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &encoder, uint32_t type)
Block makeStringBlock(uint32_t type, const std::string &value)
Create a TLV block type type with value from a string .
template size_t prependNonNegativeIntegerBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &encoder, uint32_t type, uint64_t value)
Block block(bool verifyLength=true) const
Create Block from the underlying buffer.
uint64_t readNonNegativeInteger(size_t size, InputIterator &begin, const InputIterator &end)
Read nonNegativeInteger in NDN-TLV encoding.
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.
size_t value_size() const
template size_t prependNonNegativeIntegerBlock< EncoderTag >(EncodingImpl< EncoderTag > &encoder, uint32_t type, uint64_t value)
template size_t prependEmptyBlock< EncoderTag >(EncodingImpl< EncoderTag > &encoder, uint32_t type)
const uint8_t * value() const