ndn-embeds 0.1.0
Lightweight NDN protocol stack for embedded systems
Loading...
Searching...
No Matches
tlv.hpp File Reference

NDN TLV (Type-Length-Value) encoding. More...

#include "ndn/common.hpp"

Go to the source code of this file.

Classes

class  ndn::TlvEncoder
 TLV encoder. More...
 
class  ndn::TlvDecoder
 TLV decoder. More...
 
struct  ndn::TlvDecoder::TlvHeader
 TLV header information. More...
 

Namespaces

namespace  ndn::tlv
 TLV Type number definitions.
 

Functions

constexpr size_t ndn::varNumberSize (uint64_t value)
 Calculate the encoded size of a VAR-NUMBER.
 
constexpr size_t ndn::nonNegativeIntegerSize (uint64_t value)
 Calculate the encoded size of a non-negative integer (minimum bytes)
 

Variables

Packet types
constexpr uint32_t ndn::tlv::Interest = 0x05
 Interest packet.
 
constexpr uint32_t ndn::tlv::Data = 0x06
 Data packet.
 
Common fields
constexpr uint32_t ndn::tlv::Name = 0x07
 Name.
 
Name components
constexpr uint32_t ndn::tlv::GenericNameComponent = 0x08
 Generic Name component.
 
constexpr uint32_t ndn::tlv::ImplicitSha256Digest = 0x01
 Implicit SHA-256 digest.
 
constexpr uint32_t ndn::tlv::ParametersSha256Digest = 0x02
 Parameters SHA-256 digest.
 
Interest packet fields
constexpr uint32_t ndn::tlv::CanBePrefix = 0x21
 CanBePrefix flag.
 
constexpr uint32_t ndn::tlv::MustBeFresh = 0x12
 MustBeFresh flag.
 
constexpr uint32_t ndn::tlv::ForwardingHint = 0x1e
 Forwarding hint.
 
constexpr uint32_t ndn::tlv::Nonce = 0x0a
 Nonce (for loop detection)
 
constexpr uint32_t ndn::tlv::InterestLifetime = 0x0c
 Interest lifetime.
 
constexpr uint32_t ndn::tlv::HopLimit = 0x22
 Hop limit.
 
constexpr uint32_t ndn::tlv::ApplicationParameters = 0x24
 Application parameters.
 
Data packet fields
constexpr uint32_t ndn::tlv::MetaInfo = 0x14
 Meta information.
 
constexpr uint32_t ndn::tlv::Content = 0x15
 Content.
 
constexpr uint32_t ndn::tlv::SignatureInfo = 0x16
 Signature info.
 
constexpr uint32_t ndn::tlv::SignatureValue = 0x17
 Signature value.
 
MetaInfo fields
constexpr uint32_t ndn::tlv::ContentType = 0x18
 Content type.
 
constexpr uint32_t ndn::tlv::FreshnessPeriod = 0x19
 Freshness period.
 
constexpr uint32_t ndn::tlv::FinalBlockId = 0x1a
 Final block ID.
 
SignatureInfo sub-fields
constexpr uint32_t ndn::tlv::SignatureType = 0x1b
 Signature type.
 
constexpr uint32_t ndn::tlv::KeyLocator = 0x1c
 Key locator.
 
constexpr uint32_t ndn::tlv::KeyDigest = 0x1d
 Key digest.
 
Interest signature fields (for future use)
constexpr uint32_t ndn::tlv::SignatureNonce = 0x26
 Signature nonce.
 
constexpr uint32_t ndn::tlv::SignatureTime = 0x28
 Signature timestamp.
 
constexpr uint32_t ndn::tlv::SignatureSeqNum = 0x2a
 Signature sequence number.
 
constexpr uint32_t ndn::tlv::InterestSignatureInfo = 0x2c
 Interest signature info.
 
constexpr uint32_t ndn::tlv::InterestSignatureValue = 0x2e
 Interest signature value.
 
Certificate-related fields
constexpr uint32_t ndn::tlv::ValidityPeriod = 0xfd
 Validity period (253)
 
constexpr uint32_t ndn::tlv::NotBefore = 0xfe
 Not before (254)
 
constexpr uint32_t ndn::tlv::NotAfter = 0xff
 Not after (255)
 

Detailed Description

NDN TLV (Type-Length-Value) encoding.

Provides classes and utility functions for encoding/decoding NDN packets in TLV format.

See also
https://docs.named-data.net/NDN-packet-spec/current/tlv.html

Definition in file tlv.hpp.

Function Documentation

◆ nonNegativeIntegerSize()

constexpr size_t ndn::nonNegativeIntegerSize ( uint64_t  value)
constexpr

Calculate the encoded size of a non-negative integer (minimum bytes)

Parameters
valueValue
Returns
Encoded size in bytes (1, 2, 4, or 8)

Definition at line 357 of file tlv.hpp.

References ndn::nonNegativeIntegerSize().

Referenced by ndn::nonNegativeIntegerSize(), and ndn::TlvEncoder::writeTlvNonNegativeInteger().

◆ varNumberSize()

constexpr size_t ndn::varNumberSize ( uint64_t  value)
constexpr

Calculate the encoded size of a VAR-NUMBER.

Parameters
valueValue
Returns
Encoded size in bytes

Definition at line 339 of file tlv.hpp.

References ndn::varNumberSize().

Referenced by ndn::Certificate::encode(), ndn::Data::encode(), ndn::Interest::encode(), ndn::Name::encode(), and ndn::varNumberSize().