|
ndn-embeds 0.1.0
Lightweight NDN protocol stack for embedded systems
|
TLV encoder. More...
#include <ndn/tlv.hpp>
Public Member Functions | |
| TlvEncoder (uint8_t *buf, size_t capacity) | |
| Constructor. | |
| Error | writeVarNumber (uint64_t value) |
| Write a value in VAR-NUMBER format. | |
| Error | writeNonNegativeInteger (uint64_t value) |
| Write a non-negative integer (big-endian, minimum bytes) | |
| Error | writeType (uint32_t type) |
| Write a TLV Type. | |
| Error | writeLength (size_t length) |
| Write a TLV Length. | |
| Error | writeBytes (const uint8_t *data, size_t len) |
| Write a byte sequence. | |
| Error | writeTlv (uint32_t type, const uint8_t *value, size_t valueLen) |
| Write a complete TLV structure. | |
| Error | writeTlvNonNegativeInteger (uint32_t type, uint64_t value) |
| Write a non-negative integer as a TLV. | |
| size_t | size () const |
| Current write position (= number of bytes written) | |
| size_t | remaining () const |
| Remaining writable bytes. | |
| uint8_t * | current () |
| Pointer to current position. | |
| size_t | position () const |
| Get current position. | |
| void | setPosition (size_t pos) |
| Set current position. | |
TLV encoder.
A class for writing data to a buffer in TLV format.
|
inline |
Pointer to current position.
Definition at line 201 of file tlv.hpp.
Referenced by ndn::Data::encode(), ndn::Interest::encode(), and ndn::Link::toData().
|
inline |
Get current position.
Definition at line 207 of file tlv.hpp.
Referenced by ndn::Data::encode(), ndn::Interest::encode(), and ndn::Link::toData().
|
inline |
Remaining writable bytes.
Definition at line 195 of file tlv.hpp.
Referenced by ndn::Data::encode(), ndn::Interest::encode(), ndn::Link::toData(), writeBytes(), writeNonNegativeInteger(), and writeVarNumber().
Set current position.
| pos | New position |
Definition at line 213 of file tlv.hpp.
Referenced by ndn::Data::encode(), ndn::Interest::encode(), and ndn::Link::toData().
|
inline |
Current write position (= number of bytes written)
Definition at line 189 of file tlv.hpp.
Referenced by ndn::ValidityPeriod::encode(), ndn::Certificate::encode(), ndn::Data::encode(), ndn::Interest::encode(), ndn::Name::encode(), and ndn::Link::toData().
Write a byte sequence.
| data | Pointer to data |
| len | Data length |
Definition at line 95 of file tlv.cpp.
References remaining().
Referenced by ndn::Certificate::encode(), ndn::Data::encode(), ndn::Interest::encode(), ndn::Name::encode(), and writeTlv().
Write a TLV Length.
| length | Length value |
Definition at line 91 of file tlv.cpp.
References writeVarNumber().
Referenced by ndn::Certificate::encode(), ndn::Data::encode(), ndn::Interest::encode(), ndn::Name::encode(), writeTlv(), and writeTlvNonNegativeInteger().
Write a non-negative integer (big-endian, minimum bytes)
| value | Value to write |
Definition at line 51 of file tlv.cpp.
References remaining().
Referenced by writeTlvNonNegativeInteger().
Write a complete TLV structure.
| type | Type number |
| value | Pointer to the Value data |
| valueLen | Length of the Value |
Definition at line 104 of file tlv.cpp.
References writeBytes(), writeLength(), and writeType().
Referenced by ndn::ValidityPeriod::encode(), ndn::Certificate::encode(), ndn::Data::encode(), and ndn::Interest::encode().
Write a non-negative integer as a TLV.
| type | Type number |
| value | Value |
Definition at line 125 of file tlv.cpp.
References ndn::nonNegativeIntegerSize(), writeLength(), writeNonNegativeInteger(), and writeType().
Referenced by ndn::Interest::encode().
Write a TLV Type.
| type | Type number |
Definition at line 87 of file tlv.cpp.
References writeVarNumber().
Referenced by ndn::Certificate::encode(), ndn::Data::encode(), ndn::Interest::encode(), ndn::Name::encode(), writeTlv(), and writeTlvNonNegativeInteger().
Write a value in VAR-NUMBER format.
Encodes in NDN specification VAR-NUMBER format:
| value | Value to write |
Definition at line 12 of file tlv.cpp.
References remaining().
Referenced by writeLength(), and writeType().