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);
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 noexcept
Return the size of TLV-VALUE, aka TLV-LENGTH.
Represents a TLV element of NDN packet format.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
size_t size() const
Return the size of the encoded wire, i.e.
size_t appendBlock(const Block &block) const
Append TLV block block.
size_t prependVarNumber(uint64_t varNumber) const noexcept
Prepend VarNumber varNumber of NDN TLV encoding.
size_t appendVarNumber(uint64_t varNumber) const noexcept
Prepend VarNumber varNumber of NDN TLV encoding.
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.
uint32_t type() const
Return the TLV-TYPE of the Block.
const uint8_t * value() const noexcept
Return a raw pointer to the beginning of TLV-VALUE.
size_t prependBlock(const Block &block) const
Prepend TLV block block.
size_t prependNonNegativeInteger(uint64_t integer) const noexcept
Prepend non-negative integer integer of NDN TLV encoding.