NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
tlv.hpp File Reference
#include "ndn-cxx/detail/common.hpp"
#include <cstring>
#include <iterator>
#include <ostream>
#include <type_traits>
#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::ReadNumberSlow< Iterator >
 Function object to read a number from InputIterator. More...
 
class  ndn::tlv::detail::ReadNumberFast< Iterator >
 Function object to read a number from ContiguousIterator. More...
 
class  ndn::tlv::detail::ReadNumber< Iterator >
 

Namespaces

 ndn
 Copyright (c) 2011-2015 Regents of the University of California.
 
 ndn::tlv
 Namespace defining NDN Packet Format related constants and procedures.
 
 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::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::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::LinkDelegation = 31, ndn::tlv::LinkPreference = 30, ndn::tlv::NameComponentMin = 1, ndn::tlv::NameComponentMax = 65535,
  ndn::tlv::AppPrivateBlock1 = 128, ndn::tlv::AppPrivateBlock2 = 32767
}
 TLV-TYPE numbers defined in NDN Packet Format v0.3. More...
 
enum  : uint32_t {
  ndn::tlv::Selectors = 9, ndn::tlv::MinSuffixComponents = 13, ndn::tlv::MaxSuffixComponents = 14, ndn::tlv::PublisherPublicKeyLocator = 15,
  ndn::tlv::Exclude = 16, ndn::tlv::ChildSelector = 17, ndn::tlv::Any = 19
}
 TLV-TYPE numbers defined in NDN Packet Format v0.2 but not in v0.3. More...
 
enum  : uint32_t {
  ndn::tlv::KeywordNameComponent = 32, ndn::tlv::SegmentNameComponent = 33, ndn::tlv::ByteOffsetNameComponent = 34, ndn::tlv::VersionNameComponent = 35,
  ndn::tlv::TimestampNameComponent = 36, ndn::tlv::SequenceNumNameComponent = 37
}
 TLV-TYPE numbers for typed name components. More...
 
enum  ndn::tlv::SignatureTypeValue : uint16_t { ndn::tlv::DigestSha256 = 0, ndn::tlv::SignatureSha256WithRsa = 1, ndn::tlv::SignatureSha256WithEcdsa = 3, ndn::tlv::SignatureHmacWithSha256 = 4 }
 SignatureType values. More...
 
enum  {
  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
}
 TLV-TYPE numbers for SignatureInfo features. 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...
 

Functions

std::ostream & ndn::tlv::operator<< (std::ostream &os, SignatureTypeValue st)
 
std::ostream & ndn::tlv::operator<< (std::ostream &os, ContentTypeValue ct)
 
constexpr bool ndn::tlv::isCriticalType (uint32_t type)
 Determine whether a TLV-TYPE is "critical" for evolvability purpose. More...
 
template<typename Iterator >
NDN_CXX_NODISCARD bool ndn::tlv::readVarNumber (Iterator &begin, Iterator end, uint64_t &number) noexcept
 Read VAR-NUMBER in NDN-TLV encoding. More...
 
template<typename Iterator >
NDN_CXX_NODISCARD 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 >
uint32_t ndn::tlv::readType (Iterator &begin, Iterator end)
 Read TLV-TYPE. 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::writeVarNumber (std::ostream &os, uint64_t number)
 Write VAR-NUMBER to the specified stream. More...
 
template<typename Iterator >
uint64_t ndn::tlv::readNonNegativeInteger (size_t size, Iterator &begin, Iterator end)
 Read nonNegativeInteger in NDN-TLV encoding. 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...
 
size_t ndn::tlv::writeNonNegativeInteger (std::ostream &os, uint64_t integer)
 Write nonNegativeInteger to the specified stream. 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...
 
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 >
bool ndn::tlv::readType (Iterator &begin, Iterator end, uint32_t &type) noexcept
 Read TLV-TYPE. More...
 

Variables

const size_t ndn::MAX_NDN_PACKET_SIZE = 8800
 practical limit of network layer packet size More...
 
constexpr int ndn::tlv::NameComponent = GenericNameComponent