|
ndn-embeds 0.1.0
Lightweight NDN protocol stack for embedded systems
|
TLV decoder. More...
#include <ndn/tlv.hpp>
Classes | |
| struct | TlvHeader |
| TLV header information. More... | |
Public Member Functions | |
| TlvDecoder (const uint8_t *buf, size_t len) | |
| Constructor. | |
| Result< uint64_t > | readVarNumber () |
| Read a value in VAR-NUMBER format. | |
| Result< uint64_t > | readNonNegativeInteger (size_t numBytes) |
| Read a non-negative integer of specified byte count. | |
| Result< uint32_t > | readType () |
| Read a TLV Type. | |
| Result< size_t > | readLength () |
| Read a TLV Length. | |
| Result< TlvHeader > | readTlvHeader () |
| Read a TLV header (Type and Length) at once. | |
| Error | readBytes (uint8_t *out, size_t len) |
| Read a specified number of bytes. | |
| Error | skip (size_t len) |
| Skip a specified number of bytes. | |
| size_t | remaining () const |
| Remaining readable bytes. | |
| const uint8_t * | current () const |
| Pointer to current position. | |
| bool | hasMore () const |
| Check if there is more data. | |
| size_t | position () const |
| Get current position. | |
| void | setPosition (size_t pos) |
| Set current position. | |
TLV decoder.
A class for reading TLV-formatted data from a buffer.
Pointer to current position.
Definition at line 308 of file tlv.hpp.
Referenced by ndn::Link::fromData(), ndn::Data::fromWire(), ndn::Interest::fromWire(), and ndn::Name::fromWire().
|
inline |
Check if there is more data.
Definition at line 314 of file tlv.hpp.
Referenced by ndn::Link::fromData().
|
inline |
Get current position.
Definition at line 320 of file tlv.hpp.
Referenced by ndn::Data::fromWire(), ndn::Interest::fromWire(), ndn::ValidityPeriod::fromWire(), and ndn::Name::fromWire().
Read a specified number of bytes.
| out | Output buffer |
| len | Number of bytes to read |
Definition at line 239 of file tlv.cpp.
References remaining().
Referenced by ndn::Data::fromWire(), ndn::Interest::fromWire(), and ndn::ValidityPeriod::fromWire().
Read a TLV Length.
Definition at line 216 of file tlv.cpp.
References readVarNumber().
Referenced by readTlvHeader().
Read a non-negative integer of specified byte count.
| numBytes | Number of bytes to read (1, 2, 4, or 8) |
Definition at line 191 of file tlv.cpp.
References remaining(), and ndn::Result< T >::value.
Referenced by ndn::Data::fromWire(), and ndn::Interest::fromWire().
| Result< TlvDecoder::TlvHeader > ndn::TlvDecoder::readTlvHeader | ( | ) |
Read a TLV header (Type and Length) at once.
Definition at line 224 of file tlv.cpp.
References readLength(), and readType().
Referenced by ndn::Data::fromWire(), ndn::Interest::fromWire(), ndn::ValidityPeriod::fromWire(), and ndn::Name::fromWire().
Read a TLV Type.
Definition at line 204 of file tlv.cpp.
References readVarNumber().
Referenced by readTlvHeader().
Read a value in VAR-NUMBER format.
Definition at line 147 of file tlv.cpp.
References remaining(), and ndn::Result< T >::value.
Referenced by readLength(), and readType().
|
inline |
Remaining readable bytes.
Definition at line 302 of file tlv.hpp.
Referenced by ndn::Link::fromData(), ndn::Data::fromWire(), ndn::Interest::fromWire(), ndn::Name::fromWire(), readBytes(), readNonNegativeInteger(), readVarNumber(), and skip().
Set current position.
| pos | New position |
Definition at line 326 of file tlv.hpp.
Referenced by ndn::Data::fromWire(), and ndn::Interest::fromWire().
Skip a specified number of bytes.
| len | Number of bytes to skip |
Definition at line 248 of file tlv.cpp.
References remaining().
Referenced by ndn::Link::fromData(), ndn::Data::fromWire(), ndn::Interest::fromWire(), and ndn::Name::fromWire().