30 if (varNumber < 253) {
33 else if (varNumber <= std::numeric_limits<uint16_t>::max()) {
36 else if (varNumber <= std::numeric_limits<uint32_t>::max()) {
47 return prependVarNumber(varNumber);
53 if (varNumber <= std::numeric_limits<uint8_t>::max()) {
56 else if (varNumber <= std::numeric_limits<uint16_t>::max()) {
59 else if (varNumber <= std::numeric_limits<uint32_t>::max()) {
70 return prependNonNegativeInteger(varNumber);
76 size_t totalLength = arraySize;
77 totalLength += prependVarNumber(arraySize);
78 totalLength += prependVarNumber(type);
86 return prependByteArrayBlock(type, array, arraySize);
bool hasWire() const
Check if the Block has fully encoded wire.
Copyright (c) 2011-2015 Regents of the University of California.
size_t prependByteArrayBlock(uint32_t type, const uint8_t *array, size_t arraySize) const noexcept
Prepend TLV block of type type and value from buffer array of size arraySize.
size_t value_size() const
Get size of TLV-VALUE aka TLV-LENGTH.
Represents a TLV element of NDN packet format.
const uint8_t * value() const
Get pointer to TLV-VALUE.
size_t prependVarNumber(uint64_t varNumber) const noexcept
Prepend VarNumber varNumber of NDN TLV encoding.
size_t size() const
Get size of encoded wire, including Type-Length-Value.
size_t appendVarNumber(uint64_t varNumber) const noexcept
Prepend VarNumber varNumber of NDN TLV encoding.
size_t appendBlock(const Block &block) const
Append TLV block block.
size_t appendNonNegativeInteger(uint64_t integer) const noexcept
Append non-negative integer integer of NDN TLV encoding.
size_t appendByteArrayBlock(uint32_t type, const uint8_t *array, size_t arraySize) const noexcept
Append TLV block of type type and value from buffer array of size arraySize.
size_t prependBlock(const Block &block) const
Prepend TLV block block.
uint32_t type() const
Get TLV-TYPE.
size_t prependNonNegativeInteger(uint64_t integer) const noexcept
Prepend non-negative integer integer of NDN TLV encoding.