NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::encoding Namespace Reference

Classes

class  DataBlockFast
 Helper class template to create a data block when RandomAccessIterator is used. More...
 
class  DataBlockSlow
 Helper class template to create a data block when generic InputIterator is used. More...
 
class  Encoder
 Helper class to perform TLV encoding Interface of this class (mostly) matches interface of Estimator class. More...
 
class  EncodingImpl
 
class  EncodingImpl< EncoderTag >
 EncodingImpl specialization for real TLV encoding. More...
 
class  EncodingImpl< EstimatorTag >
 EncodingImpl specialization TLV size estimation. More...
 
class  Estimator
 Helper class to estimate size of TLV encoding Interface of this class (mostly) matches interface of Encoder class. More...
 

Typedefs

typedef bool Tag
 
typedef EncodingImpl< EncoderTagEncodingBuffer
 
typedef EncodingImpl< EstimatorTagEncodingEstimator
 

Functions

template<Tag TAG>
size_t prependNonNegativeIntegerBlock (EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
 Helper to prepend TLV block type type containing non-negative integer value. More...
 
template size_t prependNonNegativeIntegerBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &encoder, uint32_t type, uint64_t value)
 
template size_t prependNonNegativeIntegerBlock< EncoderTag > (EncodingImpl< EncoderTag > &encoder, uint32_t type, uint64_t value)
 
Block makeNonNegativeIntegerBlock (uint32_t type, uint64_t value)
 Create a TLV block type type containing non-negative integer value. More...
 
uint64_t readNonNegativeInteger (const Block &block)
 Helper to read a non-negative integer from a block. More...
 
template<Tag TAG>
size_t prependEmptyBlock (EncodingImpl< TAG > &encoder, uint32_t type)
 Helper to prepend TLV block type type containing no value (i.e., a boolean block) More...
 
template size_t prependEmptyBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &encoder, uint32_t type)
 
template size_t prependEmptyBlock< EncoderTag > (EncodingImpl< EncoderTag > &encoder, uint32_t type)
 
Block makeEmptyBlock (uint32_t type)
 Create a TLV block type type containing no value (i.e., a boolean block) More...
 
template<Tag TAG>
size_t prependStringBlock (EncodingImpl< TAG > &encoder, uint32_t type, const std::string &value)
 Helper to prepend TLV block type type with value from a string value. More...
 
template size_t prependStringBlock< EstimatorTag > (EncodingImpl< EstimatorTag > &encoder, uint32_t type, const std::string &value)
 
template size_t prependStringBlock< EncoderTag > (EncodingImpl< EncoderTag > &encoder, uint32_t type, const std::string &value)
 
Block makeStringBlock (uint32_t type, const std::string &value)
 Create a TLV block type type with value from a string value. More...
 
std::string readString (const Block &block)
 Helper to read a string value from a block. More...
 
Block makeBinaryBlock (uint32_t type, const uint8_t *value, size_t length)
 Create a TLV block type type with value from a buffer value of size length. More...
 
Block makeBinaryBlock (uint32_t type, const char *value, size_t length)
 Create a TLV block type type with value from a buffer value of size length. More...
 
template<class Iterator >
Block makeBinaryBlock (uint32_t type, Iterator first, Iterator last)
 Free function to create a block given type and range [first, last) of bytes. More...
 
template<Tag TAG, class U >
size_t prependNestedBlock (EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
 Prepend a TLV block of type type with WireEncodable value as a value. More...
 
template<class U >
Block makeNestedBlock (uint32_t type, const U &value)
 Create a TLV block of type type with WireEncodable value as a value. More...
 

Variables

static const Tag EncoderTag = true
 Tag for EncodingImpl to indicate that Encoder is requested Implementation of the tag may change to class. More...
 
static const Tag EstimatorTag = false
 Tag for EncodingImpl to indicate that Estimator is requested Implementation of the tag may change to class. More...
 

Typedef Documentation

◆ Tag

typedef bool ndn::encoding::Tag

Definition at line 28 of file encoding-buffer-fwd.hpp.

◆ EncodingBuffer

◆ EncodingEstimator

Function Documentation

◆ prependNonNegativeIntegerBlock()

◆ prependNonNegativeIntegerBlock< EstimatorTag >()

template size_t ndn::encoding::prependNonNegativeIntegerBlock< EstimatorTag > ( EncodingImpl< EstimatorTag > &  encoder,
uint32_t  type,
uint64_t  value 
)

◆ prependNonNegativeIntegerBlock< EncoderTag >()

template size_t ndn::encoding::prependNonNegativeIntegerBlock< EncoderTag > ( EncodingImpl< EncoderTag > &  encoder,
uint32_t  type,
uint64_t  value 
)

◆ makeNonNegativeIntegerBlock()

Block ndn::encoding::makeNonNegativeIntegerBlock ( uint32_t  type,
uint64_t  value 
)

◆ readNonNegativeInteger()

◆ prependEmptyBlock()

template<Tag TAG>
size_t ndn::encoding::prependEmptyBlock ( EncodingImpl< TAG > &  encoder,
uint32_t  type 
)

Helper to prepend TLV block type type containing no value (i.e., a boolean block)

See also
makeEmptyBlock

Definition at line 71 of file block-helpers.cpp.

References prependEmptyBlock< EncoderTag >(), and prependEmptyBlock< EstimatorTag >().

Referenced by makeEmptyBlock(), ndn::Selectors::wireEncode(), and ndn::Exclude::wireEncode().

◆ prependEmptyBlock< EstimatorTag >()

template size_t ndn::encoding::prependEmptyBlock< EstimatorTag > ( EncodingImpl< EstimatorTag > &  encoder,
uint32_t  type 
)

Referenced by prependEmptyBlock().

◆ prependEmptyBlock< EncoderTag >()

template size_t ndn::encoding::prependEmptyBlock< EncoderTag > ( EncodingImpl< EncoderTag > &  encoder,
uint32_t  type 
)

Referenced by prependEmptyBlock().

◆ makeEmptyBlock()

Block ndn::encoding::makeEmptyBlock ( uint32_t  type)

Create a TLV block type type containing no value (i.e., a boolean block)

See also
prependEmptyBlock

Definition at line 87 of file block-helpers.cpp.

References ndn::encoding::Encoder::block(), and prependEmptyBlock().

Referenced by ndn::Block::fromStream(), ndn::Data::getContent(), and makeNestedBlock().

◆ prependStringBlock()

template<Tag TAG>
size_t ndn::encoding::prependStringBlock ( EncodingImpl< TAG > &  encoder,
uint32_t  type,
const std::string &  value 
)

Helper to prepend TLV block type type with value from a string value.

See also
makeStringBlock, readString

Definition at line 102 of file block-helpers.cpp.

References prependStringBlock< EncoderTag >(), and prependStringBlock< EstimatorTag >().

Referenced by makeStringBlock(), ndn::security::v2::AdditionalDescription::wireEncode(), and ndn::security::ValidityPeriod::wireEncode().

◆ prependStringBlock< EstimatorTag >()

template size_t ndn::encoding::prependStringBlock< EstimatorTag > ( EncodingImpl< EstimatorTag > &  encoder,
uint32_t  type,
const std::string &  value 
)

Referenced by prependStringBlock().

◆ prependStringBlock< EncoderTag >()

template size_t ndn::encoding::prependStringBlock< EncoderTag > ( EncodingImpl< EncoderTag > &  encoder,
uint32_t  type,
const std::string &  value 
)

Referenced by prependStringBlock().

◆ makeStringBlock()

Block ndn::encoding::makeStringBlock ( uint32_t  type,
const std::string &  value 
)

Create a TLV block type type with value from a string value.

See also
prependStringBlock, readString

Definition at line 123 of file block-helpers.cpp.

References ndn::encoding::Encoder::block(), and prependStringBlock().

Referenced by makeNestedBlock().

◆ readString()

std::string ndn::encoding::readString ( const Block block)

◆ makeBinaryBlock() [1/3]

◆ makeBinaryBlock() [2/3]

Block ndn::encoding::makeBinaryBlock ( uint32_t  type,
const char *  value,
size_t  length 
)

Create a TLV block type type with value from a buffer value of size length.

Definition at line 155 of file block-helpers.cpp.

References makeBinaryBlock().

◆ makeBinaryBlock() [3/3]

template<class Iterator >
Block ndn::encoding::makeBinaryBlock ( uint32_t  type,
Iterator  first,
Iterator  last 
)
inline

Free function to create a block given type and range [first, last) of bytes.

Template Parameters
Iteratoriterator type satisfying at least InputIterator concept. Implementation is more optimal when the iterator type satisfies RandomAccessIterator concept It is required that sizeof(std::iterator_traits<Iterator>::value_type) == 1.

Definition at line 170 of file block-helpers.hpp.

◆ prependNestedBlock()

template<Tag TAG, class U >
size_t ndn::encoding::prependNestedBlock ( EncodingImpl< TAG > &  encoder,
uint32_t  type,
const U &  value 
)
inline

Prepend a TLV block of type type with WireEncodable value as a value.

Template Parameters
Utype that satisfies WireEncodableWithEncodingBuffer concept
See also
makeNestedBlock

Definition at line 193 of file block-helpers.hpp.

Referenced by makeNestedBlock(), ndn::nfd::StrategyChoice::wireEncode(), ndn::MetaInfo::wireEncode(), and ndn::nfd::ControlParameters::wireEncode().

◆ makeNestedBlock()

template<class U >
Block ndn::encoding::makeNestedBlock ( uint32_t  type,
const U &  value 
)
inline

Create a TLV block of type type with WireEncodable value as a value.

Template Parameters
Utype that satisfies WireEncodableWithEncodingBuffer concept
See also
prependNestedBlock

Definition at line 212 of file block-helpers.hpp.

References ndn::encoding::Encoder::block(), makeBinaryBlock(), makeEmptyBlock(), makeNonNegativeIntegerBlock(), makeStringBlock(), prependNestedBlock(), readNonNegativeInteger(), and readString().

Variable Documentation

◆ EncoderTag

const Tag ndn::encoding::EncoderTag = true
static

Tag for EncodingImpl to indicate that Encoder is requested Implementation of the tag may change to class.

Use of true directly as a template parameter is discouraged.

Definition at line 35 of file encoding-buffer-fwd.hpp.

◆ EstimatorTag

const Tag ndn::encoding::EstimatorTag = false
static

Tag for EncodingImpl to indicate that Estimator is requested Implementation of the tag may change to class.

Use of false directly as a template parameter is discouraged.

Definition at line 42 of file encoding-buffer-fwd.hpp.