tlv.hpp File Reference
#include "ndn-cxx/detail/common.hpp"
#include <cstring>
#include <iterator>
#include <ostream>
#include <vector>
#include <boost/endian/conversion.hpp>
+ Include dependency graph for tlv.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ndn::tlv::Error
 Represents an error in TLV encoding or decoding. More...
 
class  ndn::tlv::detail::ReadNumber< Iterator >
 
class  ndn::tlv::detail::ReadNumberFast< Iterator >
 Function object to read a number from ContiguousIterator. More...
 
class  ndn::tlv::detail::ReadNumberSlow< Iterator >
 Function object to read a number from InputIterator. More...
 

Namespaces

 ndn
 
 ndn::tlv
 Contains constants and low-level functions related to the NDN packet format.
 
 ndn::tlv::detail
 

Enumerations

enum  : uint32_t {
  ndn::tlv::Invalid = 0 ,
  ndn::tlv::Interest = 5 ,
  ndn::tlv::Data = 6 ,
  ndn::tlv::Name = 7 ,
  ndn::tlv::GenericNameComponent = 8 ,
  ndn::tlv::ImplicitSha256DigestComponent = 1 ,
  ndn::tlv::ParametersSha256DigestComponent = 2 ,
  ndn::tlv::KeywordNameComponent = 32 ,
  ndn::tlv::SegmentNameComponent = 50 ,
  ndn::tlv::ByteOffsetNameComponent = 52 ,
  ndn::tlv::VersionNameComponent = 54 ,
  ndn::tlv::TimestampNameComponent = 56 ,
  ndn::tlv::SequenceNumNameComponent = 58 ,
  ndn::tlv::CanBePrefix = 33 ,
  ndn::tlv::MustBeFresh = 18 ,
  ndn::tlv::ForwardingHint = 30 ,
  ndn::tlv::Nonce = 10 ,
  ndn::tlv::InterestLifetime = 12 ,
  ndn::tlv::HopLimit = 34 ,
  ndn::tlv::ApplicationParameters = 36 ,
  ndn::tlv::InterestSignatureInfo = 44 ,
  ndn::tlv::InterestSignatureValue = 46 ,
  ndn::tlv::MetaInfo = 20 ,
  ndn::tlv::Content = 21 ,
  ndn::tlv::SignatureInfo = 22 ,
  ndn::tlv::SignatureValue = 23 ,
  ndn::tlv::ContentType = 24 ,
  ndn::tlv::FreshnessPeriod = 25 ,
  ndn::tlv::FinalBlockId = 26 ,
  ndn::tlv::SignatureType = 27 ,
  ndn::tlv::KeyLocator = 28 ,
  ndn::tlv::KeyDigest = 29 ,
  ndn::tlv::SignatureNonce = 38 ,
  ndn::tlv::SignatureTime = 40 ,
  ndn::tlv::SignatureSeqNum = 42 ,
  ndn::tlv::ValidityPeriod = 253 ,
  ndn::tlv::NotBefore = 254 ,
  ndn::tlv::NotAfter = 255 ,
  ndn::tlv::AdditionalDescription = 258 ,
  ndn::tlv::DescriptionEntry = 512 ,
  ndn::tlv::DescriptionKey = 513 ,
  ndn::tlv::DescriptionValue = 514 ,
  ndn::tlv::NameComponentMin = 1 ,
  ndn::tlv::NameComponentMax = 65535 ,
  ndn::tlv::AppPrivateBlock1 = 128 ,
  ndn::tlv::AppPrivateBlock2 = 32768
}
 TLV-TYPE numbers defined in NDN Packet Format v0.3. More...
 
enum  ndn::tlv::ContentTypeValue : uint32_t {
  ndn::tlv::ContentType_Blob = 0 ,
  ndn::tlv::ContentType_Link = 1 ,
  ndn::tlv::ContentType_Key = 2 ,
  ndn::tlv::ContentType_Nack = 3 ,
  ndn::tlv::ContentType_Manifest = 4 ,
  ndn::tlv::ContentType_PrefixAnn = 5 ,
  ndn::tlv::ContentType_Flic = 1024
}
 ContentType values. More...
 
enum  ndn::tlv::SignatureTypeValue : uint16_t {
  ndn::tlv::DigestSha256 = 0 ,
  ndn::tlv::SignatureSha256WithRsa = 1 ,
  ndn::tlv::SignatureSha256WithEcdsa = 3 ,
  ndn::tlv::SignatureHmacWithSha256 = 4 ,
  ndn::tlv::SignatureEd25519 = 5 ,
  ndn::tlv::NullSignature = 200
}
 SignatureType values. More...
 

Functions

constexpr bool ndn::tlv::isCriticalType (uint32_t type) noexcept
 Determine whether a TLV-TYPE is "critical" for evolvability purpose. More...
 
std::ostream & ndn::tlv::operator<< (std::ostream &os, ContentTypeValue ct)
 
std::ostream & ndn::tlv::operator<< (std::ostream &os, SignatureTypeValue st)
 
template<typename Iterator >
uint64_t ndn::tlv::readNonNegativeInteger (size_t size, Iterator &begin, Iterator end)
 Read a NonNegativeInteger in NDN-TLV encoding. More...
 
template<typename Iterator >
uint32_t ndn::tlv::readType (Iterator &begin, Iterator end)
 Read TLV-TYPE. More...
 
template<typename Iterator >
bool ndn::tlv::readType (Iterator &begin, Iterator end, uint32_t &type) noexcept
 Read TLV-TYPE. More...
 
template<typename Iterator >
uint64_t ndn::tlv::readVarNumber (Iterator &begin, Iterator end)
 Read VAR-NUMBER in NDN-TLV encoding. More...
 
template<typename Iterator >
bool ndn::tlv::readVarNumber (Iterator &begin, Iterator end, uint64_t &number) noexcept
 Read VAR-NUMBER in NDN-TLV encoding. More...
 
template<typename Iterator , typename DecayedIterator = std::decay_t<Iterator>, typename ValueType = typename std::iterator_traits<DecayedIterator>::value_type>
constexpr bool ndn::tlv::detail::shouldSelectContiguousReadNumber ()
 Determine whether to select ReadNumber implementation for ContiguousIterator. More...
 
constexpr size_t ndn::tlv::sizeOfNonNegativeInteger (uint64_t integer) noexcept
 Get the number of bytes necessary to hold the value of integer encoded as NonNegativeInteger. More...
 
constexpr size_t ndn::tlv::sizeOfVarNumber (uint64_t number) noexcept
 Get the number of bytes necessary to hold the value of number encoded as VAR-NUMBER. More...
 
size_t ndn::tlv::writeNonNegativeInteger (std::ostream &os, uint64_t integer)
 Write a NonNegativeInteger to the specified stream. More...
 
size_t ndn::tlv::writeVarNumber (std::ostream &os, uint64_t number)
 Write VAR-NUMBER to the specified stream. More...
 

Variables

const size_t ndn::MAX_NDN_PACKET_SIZE = 8800
 Practical size limit of a network-layer packet. More...