Namespaces | |
detail | |
Classes | |
class | Encoder |
Helper class to perform TLV encoding. More... | |
class | EncodingImpl |
class | EncodingImpl< EncoderTag > |
EncodingImpl specialization for actual TLV encoding. More... | |
class | EncodingImpl< EstimatorTag > |
EncodingImpl specialization for TLV size estimation. More... | |
class | Estimator |
Helper class to estimate size of TLV encoding. More... | |
Typedefs | |
using | EncodingBuffer = EncodingImpl< EncoderTag > |
using | EncodingEstimator = EncodingImpl< EstimatorTag > |
Enumerations | |
enum | Tag { EncoderTag = true, EstimatorTag = false } |
Functions | |
template<Tag TAG> | |
size_t | prependNonNegativeIntegerBlock (EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value) |
Prepend a TLV element containing a non-negative integer. More... | |
template size_t | prependNonNegativeIntegerBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &, uint32_t, uint64_t) |
template size_t | prependNonNegativeIntegerBlock< EncoderTag > (EncodingImpl< EncoderTag > &, uint32_t, uint64_t) |
Block | makeNonNegativeIntegerBlock (uint32_t type, uint64_t value) |
Create a TLV block containing a non-negative integer. More... | |
uint64_t | readNonNegativeInteger (const Block &block) |
Read a non-negative integer from a TLV element. More... | |
template<Tag TAG> | |
size_t | prependEmptyBlock (EncodingImpl< TAG > &encoder, uint32_t type) |
Prepend an empty TLV element. More... | |
template size_t | prependEmptyBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &, uint32_t) |
template size_t | prependEmptyBlock< EncoderTag > (EncodingImpl< EncoderTag > &, uint32_t) |
Block | makeEmptyBlock (uint32_t type) |
Create an empty TLV block. More... | |
template<Tag TAG> | |
size_t | prependStringBlock (EncodingImpl< TAG > &encoder, uint32_t type, const std::string &value) |
Prepend a TLV element containing a string. More... | |
template size_t | prependStringBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &, uint32_t, const std::string &) |
template size_t | prependStringBlock< EncoderTag > (EncodingImpl< EncoderTag > &, uint32_t, const std::string &) |
Block | makeStringBlock (uint32_t type, const std::string &value) |
Create a TLV block containing a string. More... | |
std::string | readString (const Block &block) |
Read TLV-VALUE of a TLV element as a string. More... | |
template<Tag TAG> | |
size_t | prependDoubleBlock (EncodingImpl< TAG > &encoder, uint32_t type, double value) |
Prepend a TLV element containing an IEEE 754 double-precision floating-point number. More... | |
template size_t | prependDoubleBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &, uint32_t, double) |
template size_t | prependDoubleBlock< EncoderTag > (EncodingImpl< EncoderTag > &, uint32_t, double) |
Block | makeDoubleBlock (uint32_t type, double value) |
Create a TLV element containing an IEEE 754 double-precision floating-point number. More... | |
double | readDouble (const Block &block) |
Read TLV-VALUE of a TLV element as an IEEE 754 double-precision floating-point number. More... | |
template<Tag TAG> | |
size_t | prependBinaryBlock (EncodingImpl< TAG > &encoder, uint32_t type, span< const uint8_t > value) |
Prepend a TLV element containing a sequence of raw bytes. More... | |
template size_t | prependBinaryBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &, uint32_t, span< const uint8_t >) |
template size_t | prependBinaryBlock< EncoderTag > (EncodingImpl< EncoderTag > &, uint32_t, span< const uint8_t >) |
Block | makeBinaryBlock (uint32_t type, span< const uint8_t > value) |
Create a TLV block copying the TLV-VALUE from a byte range. More... | |
template<Tag TAG> | |
size_t | prependBlock (EncodingImpl< TAG > &encoder, const Block &block) |
Prepend a TLV element. More... | |
template size_t | prependBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &, const Block &) |
template size_t | prependBlock< EncoderTag > (EncodingImpl< EncoderTag > &, const Block &) |
template<typename R > | |
std::enable_if_t< std::is_integral< R >::value, R > | readNonNegativeIntegerAs (const Block &block) |
Read a non-negative integer from a TLV element and cast to the specified type. More... | |
template<typename R > | |
std::enable_if_t< std::is_enum< R >::value, R > | readNonNegativeIntegerAs (const Block &block) |
Read a non-negative integer from a TLV element and cast to the specified type. More... | |
Block | makeBinaryBlock (uint32_t type, const char *value, size_t length) |
Create a TLV block copying the TLV-VALUE from a raw buffer. More... | |
template<class Iterator > | |
Block | makeBinaryBlock (uint32_t type, Iterator first, Iterator last) |
Create a TLV block copying TLV-VALUE from iterators. More... | |
template<Tag TAG, class U > | |
size_t | prependNestedBlock (EncodingImpl< TAG > &encoder, uint32_t type, const U &value) |
Prepend a TLV element containing a nested TLV element. More... | |
template<class U > | |
Block | makeNestedBlock (uint32_t type, const U &value) |
Create a TLV block containing a nested TLV element. More... | |
template<Tag TAG, class I > | |
size_t | prependNestedBlock (EncodingImpl< TAG > &encoder, uint32_t type, I first, I last) |
Prepend a TLV element containing a sequence of nested TLV elements. More... | |
template<class I > | |
Block | makeNestedBlock (uint32_t type, I first, I last) |
Create a TLV block containing a sequence of nested TLV elements. More... | |
using ndn::encoding::EncodingBuffer = typedef EncodingImpl<EncoderTag> |
Definition at line 38 of file encoding-buffer-fwd.hpp.
using ndn::encoding::EncodingEstimator = typedef EncodingImpl<EstimatorTag> |
Definition at line 39 of file encoding-buffer-fwd.hpp.
enum ndn::encoding::Tag |
Enumerator | |
---|---|
EncoderTag | Tag for EncodingImpl to indicate that Encoder is requested. |
EstimatorTag | Tag for EncodingImpl to indicate that Estimator is requested. |
Definition at line 30 of file encoding-buffer-fwd.hpp.
size_t ndn::encoding::prependNonNegativeIntegerBlock | ( | EncodingImpl< TAG > & | encoder, |
uint32_t | type, | ||
uint64_t | value | ||
) |
Prepend a TLV element containing a non-negative integer.
encoder | an EncodingBuffer or EncodingEstimator |
type | TLV-TYPE number |
value | non-negative integer value |
Definition at line 35 of file block-helpers.cpp.
References prependNonNegativeIntegerBlock< EncoderTag >(), and prependNonNegativeIntegerBlock< EstimatorTag >().
Referenced by ndn::lp::EncodeHelper< TAG, TlvType, NonNegativeIntegerTag >::encode(), makeNonNegativeIntegerBlock(), ndn::nfd::FaceEventNotification::wireEncode(), ndn::nfd::FaceStatus::wireEncode(), ndn::nfd::CsInfo::wireEncode(), ndn::nfd::FaceQueryFilter::wireEncode(), ndn::nfd::ForwarderStatus::wireEncode(), ndn::lp::NackHeader::wireEncode(), ndn::lp::CachePolicy::wireEncode(), ndn::nfd::NextHopRecord::wireEncode(), ndn::MetaInfo::wireEncode(), ndn::SignatureInfo::wireEncode(), ndn::nfd::ControlParameters::wireEncode(), ndn::nfd::Route::wireEncode(), and ndn::Interest::wireEncode().
template size_t ndn::encoding::prependNonNegativeIntegerBlock< EstimatorTag > | ( | EncodingImpl< EstimatorTag > & | , |
uint32_t | , | ||
uint64_t | |||
) |
Referenced by prependNonNegativeIntegerBlock().
template size_t ndn::encoding::prependNonNegativeIntegerBlock< EncoderTag > | ( | EncodingImpl< EncoderTag > & | , |
uint32_t | , | ||
uint64_t | |||
) |
Referenced by prependNonNegativeIntegerBlock().
Block ndn::encoding::makeNonNegativeIntegerBlock | ( | uint32_t | type, |
uint64_t | value | ||
) |
Create a TLV block containing a non-negative integer.
type | TLV-TYPE number |
value | non-negative integer value |
Definition at line 51 of file block-helpers.cpp.
References ndn::encoding::Encoder::block(), and prependNonNegativeIntegerBlock().
Referenced by ndn::name::Component::fromNumber(), makeNestedBlock(), ndn::SignatureInfo::setSeqNum(), ndn::SignatureInfo::setTime(), ndn::PrefixAnnouncement::toData(), and ndn::mgmt::ControlResponse::wireEncode().
uint64_t ndn::encoding::readNonNegativeInteger | ( | const Block & | block | ) |
Read a non-negative integer from a TLV element.
block | the TLV element |
tlv::Error | block does not contain a non-negative integer |
Definition at line 63 of file block-helpers.cpp.
References ndn::tlv::readNonNegativeInteger(), ndn::Block::value_begin(), ndn::Block::value_end(), and ndn::Block::value_size().
Referenced by ndn::lp::DecodeHelper< TlvType, NonNegativeIntegerTag >::decode(), ndn::SignatureInfo::getSeqNum(), ndn::SignatureInfo::getTime(), makeNestedBlock(), ndn::PrefixAnnouncement::PrefixAnnouncement(), readNonNegativeIntegerAs(), ndn::name::Component::toNumber(), ndn::nfd::FaceEventNotification::wireDecode(), ndn::nfd::FaceStatus::wireDecode(), ndn::nfd::CsInfo::wireDecode(), ndn::nfd::FaceQueryFilter::wireDecode(), ndn::nfd::ForwarderStatus::wireDecode(), ndn::nfd::NextHopRecord::wireDecode(), ndn::MetaInfo::wireDecode(), ndn::nfd::ControlParameters::wireDecode(), ndn::nfd::Route::wireDecode(), and ndn::Interest::wireDecode().
size_t ndn::encoding::prependEmptyBlock | ( | EncodingImpl< TAG > & | encoder, |
uint32_t | type | ||
) |
Prepend an empty TLV element.
encoder | an EncodingBuffer or EncodingEstimator |
type | TLV-TYPE number |
The TLV element has zero-length TLV-VALUE.
Definition at line 73 of file block-helpers.cpp.
References prependEmptyBlock< EncoderTag >(), and prependEmptyBlock< EstimatorTag >().
Referenced by ndn::lp::EncodeHelper< TAG, TlvType, EmptyValue >::encode(), makeEmptyBlock(), readNonNegativeIntegerAs(), and ndn::Interest::wireEncode().
template size_t ndn::encoding::prependEmptyBlock< EstimatorTag > | ( | EncodingImpl< EstimatorTag > & | , |
uint32_t | |||
) |
Referenced by prependEmptyBlock(), and readNonNegativeIntegerAs().
template size_t ndn::encoding::prependEmptyBlock< EncoderTag > | ( | EncodingImpl< EncoderTag > & | , |
uint32_t | |||
) |
Referenced by prependEmptyBlock(), and readNonNegativeIntegerAs().
Block ndn::encoding::makeEmptyBlock | ( | uint32_t | type | ) |
Create an empty TLV block.
type | TLV-TYPE number |
Definition at line 88 of file block-helpers.cpp.
References ndn::encoding::Encoder::block(), and prependEmptyBlock().
Referenced by makeNestedBlock(), readNonNegativeIntegerAs(), and ndn::Interest::setSignatureInfo().
size_t ndn::encoding::prependStringBlock | ( | EncodingImpl< TAG > & | encoder, |
uint32_t | type, | ||
const std::string & | value | ||
) |
Prepend a TLV element containing a string.
encoder | an EncodingBuffer or EncodingEstimator |
type | TLV-TYPE number |
value | string value, may contain NUL octets |
Definition at line 103 of file block-helpers.cpp.
References prependBinaryBlock(), prependStringBlock< EncoderTag >(), and prependStringBlock< EstimatorTag >().
Referenced by readNonNegativeIntegerAs(), ndn::nfd::FaceEventNotification::wireEncode(), ndn::nfd::FaceStatus::wireEncode(), ndn::nfd::ChannelStatus::wireEncode(), ndn::nfd::FaceQueryFilter::wireEncode(), ndn::nfd::ForwarderStatus::wireEncode(), ndn::nfd::ControlParameters::wireEncode(), ndn::security::v2::AdditionalDescription::wireEncode(), and ndn::security::ValidityPeriod::wireEncode().
template size_t ndn::encoding::prependStringBlock< EstimatorTag > | ( | EncodingImpl< EstimatorTag > & | , |
uint32_t | , | ||
const std::string & | |||
) |
Referenced by prependStringBlock(), and readNonNegativeIntegerAs().
template size_t ndn::encoding::prependStringBlock< EncoderTag > | ( | EncodingImpl< EncoderTag > & | , |
uint32_t | , | ||
const std::string & | |||
) |
Referenced by prependStringBlock(), and readNonNegativeIntegerAs().
Block ndn::encoding::makeStringBlock | ( | uint32_t | type, |
const std::string & | value | ||
) |
Create a TLV block containing a string.
type | TLV-TYPE number |
value | string value, may contain NUL octets |
Definition at line 115 of file block-helpers.cpp.
References makeBinaryBlock().
Referenced by makeNestedBlock(), readNonNegativeIntegerAs(), and ndn::mgmt::ControlResponse::wireEncode().
std::string ndn::encoding::readString | ( | const Block & | block | ) |
Read TLV-VALUE of a TLV element as a string.
block | the TLV element |
Definition at line 121 of file block-helpers.cpp.
References ndn::Block::value(), and ndn::Block::value_size().
Referenced by makeNestedBlock(), readNonNegativeIntegerAs(), ndn::nfd::ChannelStatus::wireDecode(), ndn::nfd::FaceEventNotification::wireDecode(), ndn::nfd::FaceStatus::wireDecode(), ndn::nfd::FaceQueryFilter::wireDecode(), ndn::nfd::ForwarderStatus::wireDecode(), ndn::mgmt::ControlResponse::wireDecode(), ndn::nfd::ControlParameters::wireDecode(), ndn::security::v2::AdditionalDescription::wireDecode(), and ndn::security::ValidityPeriod::wireDecode().
size_t ndn::encoding::prependDoubleBlock | ( | EncodingImpl< TAG > & | encoder, |
uint32_t | type, | ||
double | value | ||
) |
Prepend a TLV element containing an IEEE 754 double-precision floating-point number.
encoder | an EncodingBuffer or EncodingEstimator |
type | TLV-TYPE number |
value | a floating point number value |
Definition at line 132 of file block-helpers.cpp.
References prependBinaryBlock(), prependDoubleBlock< EncoderTag >(), and prependDoubleBlock< EstimatorTag >().
Referenced by makeDoubleBlock(), readNonNegativeIntegerAs(), and ndn::lp::GeoTag::wireEncode().
template size_t ndn::encoding::prependDoubleBlock< EstimatorTag > | ( | EncodingImpl< EstimatorTag > & | , |
uint32_t | , | ||
double | |||
) |
Referenced by prependDoubleBlock(), and readNonNegativeIntegerAs().
template size_t ndn::encoding::prependDoubleBlock< EncoderTag > | ( | EncodingImpl< EncoderTag > & | , |
uint32_t | , | ||
double | |||
) |
Referenced by prependDoubleBlock(), and readNonNegativeIntegerAs().
Block ndn::encoding::makeDoubleBlock | ( | uint32_t | type, |
double | value | ||
) |
Create a TLV element containing an IEEE 754 double-precision floating-point number.
type | TLV-TYPE number |
value | floating point number value |
Definition at line 147 of file block-helpers.cpp.
References ndn::encoding::Encoder::block(), and prependDoubleBlock().
Referenced by readNonNegativeIntegerAs().
double ndn::encoding::readDouble | ( | const Block & | block | ) |
Read TLV-VALUE of a TLV element as an IEEE 754 double-precision floating-point number.
block | the TLV element |
Definition at line 159 of file block-helpers.cpp.
References NDN_THROW, ndn::Block::value(), and ndn::Block::value_size().
Referenced by readNonNegativeIntegerAs(), and ndn::lp::GeoTag::wireDecode().
size_t ndn::encoding::prependBinaryBlock | ( | EncodingImpl< TAG > & | encoder, |
uint32_t | type, | ||
span< const uint8_t > | value | ||
) |
Prepend a TLV element containing a sequence of raw bytes.
encoder | an EncodingBuffer or EncodingEstimator |
type | TLV-TYPE number |
value | range of bytes to use as TLV-VALUE |
Definition at line 181 of file block-helpers.cpp.
References prependBinaryBlock< EncoderTag >(), and prependBinaryBlock< EstimatorTag >().
Referenced by ndn::lp::EncodeHelper< TAG, TlvType, uint64_t >::encode(), makeBinaryBlock(), prependBlock(), prependDoubleBlock(), prependStringBlock(), readNonNegativeIntegerAs(), ndn::security::SafeBag::wireEncode(), and ndn::Interest::wireEncode().
template size_t ndn::encoding::prependBinaryBlock< EstimatorTag > | ( | EncodingImpl< EstimatorTag > & | , |
uint32_t | , | ||
span< const uint8_t > | |||
) |
Referenced by prependBinaryBlock(), and readNonNegativeIntegerAs().
template size_t ndn::encoding::prependBinaryBlock< EncoderTag > | ( | EncodingImpl< EncoderTag > & | , |
uint32_t | , | ||
span< const uint8_t > | |||
) |
Referenced by prependBinaryBlock(), and readNonNegativeIntegerAs().
Block ndn::encoding::makeBinaryBlock | ( | uint32_t | type, |
span< const uint8_t > | value | ||
) |
Create a TLV block copying the TLV-VALUE from a byte range.
type | TLV-TYPE number |
value | range of bytes to use as TLV-VALUE |
Definition at line 197 of file block-helpers.cpp.
References ndn::encoding::Encoder::block(), and prependBinaryBlock().
Referenced by ndn::mgmt::StatusDatasetContext::append(), ndn::mgmt::StatusDatasetContext::end(), makeBinaryBlock(), makeNestedBlock(), makeStringBlock(), readNonNegativeIntegerAs(), ndn::Interest::setApplicationParameters(), ndn::Data::setContent(), ndn::KeyLocator::setKeyDigest(), and ndn::SignatureInfo::setNonce().
size_t ndn::encoding::prependBlock | ( | EncodingImpl< TAG > & | encoder, |
const Block & | block | ||
) |
Prepend a TLV element.
encoder | an EncodingBuffer or EncodingEstimator |
block | the TLV element |
Definition at line 212 of file block-helpers.cpp.
References ndn::Block::hasWire(), prependBinaryBlock(), prependBlock< EncoderTag >(), prependBlock< EstimatorTag >(), ndn::Block::type(), and ndn::Block::value_bytes().
Referenced by makeBinaryBlock(), ndn::KeyLocator::wireEncode(), ndn::Data::wireEncode(), ndn::MetaInfo::wireEncode(), ndn::SignatureInfo::wireEncode(), and ndn::Interest::wireEncode().
template size_t ndn::encoding::prependBlock< EstimatorTag > | ( | EncodingImpl< EstimatorTag > & | , |
const Block & | |||
) |
Referenced by makeBinaryBlock(), and prependBlock().
template size_t ndn::encoding::prependBlock< EncoderTag > | ( | EncodingImpl< EncoderTag > & | , |
const Block & | |||
) |
Referenced by makeBinaryBlock(), and prependBlock().
std::enable_if_t<std::is_integral<R>::value, R> ndn::encoding::readNonNegativeIntegerAs | ( | const Block & | block | ) |
Read a non-negative integer from a TLV element and cast to the specified type.
R | result type, must be an integral type |
block | the TLV element |
tlv::Error | block does not contain a valid non-negative integer or the number cannot be represented in R |
Definition at line 72 of file block-helpers.hpp.
References NDN_THROW, readNonNegativeInteger(), ndn::to_string(), and ndn::Block::type().
Referenced by makeNestedBlock().
std::enable_if_t<std::is_enum<R>::value, R> ndn::encoding::readNonNegativeIntegerAs | ( | const Block & | block | ) |
Read a non-negative integer from a TLV element and cast to the specified type.
R | result type, must be an enumeration type |
block | the TLV element |
tlv::Error | block does not contain a valid non-negative integer or the number cannot be represented in R |
Definition at line 91 of file block-helpers.hpp.
References makeBinaryBlock(), makeDoubleBlock(), makeEmptyBlock(), makeStringBlock(), prependBinaryBlock(), prependBinaryBlock< EncoderTag >(), prependBinaryBlock< EstimatorTag >(), prependDoubleBlock(), prependDoubleBlock< EncoderTag >(), prependDoubleBlock< EstimatorTag >(), prependEmptyBlock(), prependEmptyBlock< EncoderTag >(), prependEmptyBlock< EstimatorTag >(), prependStringBlock(), prependStringBlock< EncoderTag >(), prependStringBlock< EstimatorTag >(), readDouble(), and readString().
|
inline |
Create a TLV block copying the TLV-VALUE from a raw buffer.
type | TLV-TYPE number |
value | raw buffer as TLV-VALUE |
length | length of value buffer |
Definition at line 217 of file block-helpers.hpp.
References makeBinaryBlock().
Block ndn::encoding::makeBinaryBlock | ( | uint32_t | type, |
Iterator | first, | ||
Iterator | last | ||
) |
Create a TLV block copying TLV-VALUE from iterators.
Iterator | an InputIterator dereferenceable to a 1-octet type; a faster implementation is automatically selected for RandomAccessIterator |
type | TLV-TYPE number |
first | begin iterator |
last | past-the-end iterator |
Definition at line 286 of file block-helpers.hpp.
References prependBlock(), prependBlock< EncoderTag >(), and prependBlock< EstimatorTag >().
size_t ndn::encoding::prependNestedBlock | ( | EncodingImpl< TAG > & | encoder, |
uint32_t | type, | ||
const U & | value | ||
) |
Prepend a TLV element containing a nested TLV element.
U | type that satisfies WireEncodableWithEncodingBuffer concept |
encoder | an EncodingBuffer or EncodingEstimator |
type | TLV-TYPE number for outer TLV element |
value | an object to be encoded as inner TLV element |
Definition at line 321 of file block-helpers.hpp.
Referenced by makeNestedBlock(), ndn::nfd::StrategyChoice::wireEncode(), ndn::MetaInfo::wireEncode(), ndn::nfd::ControlParameters::wireEncode(), and ndn::Interest::wireEncode().
Block ndn::encoding::makeNestedBlock | ( | uint32_t | type, |
const U & | value | ||
) |
Create a TLV block containing a nested TLV element.
U | type that satisfies WireEncodableWithEncodingBuffer concept |
type | TLV-TYPE number for outer TLV element |
value | an object to be encoded as inner TLV element |
Definition at line 339 of file block-helpers.hpp.
References ndn::encoding::Encoder::block(), and prependNestedBlock().
Referenced by ndn::Link::Link(), and makeNestedBlock().
size_t ndn::encoding::prependNestedBlock | ( | EncodingImpl< TAG > & | encoder, |
uint32_t | type, | ||
I | first, | ||
I | last | ||
) |
Prepend a TLV element containing a sequence of nested TLV elements.
I | bidirectional iterator to a type that satisfies WireEncodableWithEncodingBuffer concept |
encoder | an EncodingBuffer or EncodingEstimator |
type | TLV-TYPE number for outer TLV element |
first | begin iterator to inner TLV elements |
last | past-end iterator to inner TLV elements |
Definition at line 359 of file block-helpers.hpp.
Block ndn::encoding::makeNestedBlock | ( | uint32_t | type, |
I | first, | ||
I | last | ||
) |
Create a TLV block containing a sequence of nested TLV elements.
I | bidirectional iterator to a type that satisfies WireEncodableWithEncodingBuffer concept |
type | TLV-TYPE number for outer TLV element |
first | begin iterator to inner TLV elements |
last | past-end iterator to inner TLV elements |
Definition at line 385 of file block-helpers.hpp.
References ndn::encoding::Encoder::block(), makeBinaryBlock(), makeEmptyBlock(), makeNestedBlock(), makeNonNegativeIntegerBlock(), makeStringBlock(), prependNestedBlock(), readNonNegativeInteger(), readNonNegativeIntegerAs(), and readString().