NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 . 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...
 
template<Tag TAG>
size_t prependBlock (EncodingImpl< TAG > &encoder, const Block &block)
 
template<Tag TAG>
size_t prependByteArrayBlock (EncodingImpl< TAG > &encoder, uint32_t type, const uint8_t *array, size_t arraySize)
 
Block nonNegativeIntegerBlock (uint32_t type, uint64_t value)
 
template<Tag TAG>
size_t prependBooleanBlock (EncodingImpl< TAG > &encoder, uint32_t type)
 
Block booleanBlock (uint32_t type)
 
Block dataBlock (uint32_t type, const uint8_t *data, size_t dataSize)
 
Block dataBlock (uint32_t type, const char *data, size_t dataSize)
 
template<class Iterator >
Block dataBlock (uint32_t type, Iterator first, Iterator last)
 
template<class U >
Block nestedBlock (uint32_t type, const U &value)
 

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

typedef bool ndn::encoding::Tag

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

Function Documentation

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

Create a TLV block type type containing non-negative integer value.

See also
prependNonNegativeIntegerBlock, readNonNegativeInteger

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

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

Referenced by ndn::name::Component::fromNumber(), nestedBlock(), and nonNegativeIntegerBlock().

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(), prependBooleanBlock(), ndn::Selectors::wireEncode(), and ndn::Exclude::wireEncode().

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

Referenced by prependEmptyBlock().

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

Referenced by prependEmptyBlock().

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 booleanBlock(), ndn::Block::fromStream(), ndn::Data::getContent(), and nestedBlock().

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::AdditionalDescription::wireEncode(), and ndn::security::ValidityPeriod::wireEncode().

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

Referenced by prependStringBlock().

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

Referenced by prependStringBlock().

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

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

See also
prependStringBlock, readString

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

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

Referenced by nestedBlock().

std::string ndn::encoding::readString ( const Block block)
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().

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.

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().

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(), and prependNestedBlock().

Referenced by nestedBlock().

template<Tag TAG>
size_t ndn::encoding::prependBlock ( EncodingImpl< TAG > &  encoder,
const Block block 
)
inline
template<Tag TAG>
size_t ndn::encoding::prependByteArrayBlock ( EncodingImpl< TAG > &  encoder,
uint32_t  type,
const uint8_t *  array,
size_t  arraySize 
)
inline
Block ndn::encoding::nonNegativeIntegerBlock ( uint32_t  type,
uint64_t  value 
)
inline
Deprecated:
Use makeNonNegativeIntegerBlock instead

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

References makeNonNegativeIntegerBlock().

Referenced by nestedBlock(), ns3::ndn::Producer::OnInterest(), and ndn::mgmt::ControlResponse::wireEncode().

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

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

References prependEmptyBlock().

Block ndn::encoding::booleanBlock ( uint32_t  type)
inline
Deprecated:
Use makeEmptyBlock instead

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

References makeEmptyBlock().

Referenced by nestedBlock().

Block ndn::encoding::dataBlock ( uint32_t  type,
const uint8_t *  data,
size_t  dataSize 
)
inline
Deprecated:
Use makeBinaryBlock instead

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

References makeBinaryBlock().

Referenced by nestedBlock(), and ndn::mgmt::ControlResponse::wireEncode().

Block ndn::encoding::dataBlock ( uint32_t  type,
const char *  data,
size_t  dataSize 
)
inline
Deprecated:
Use makeBinaryBlock instead

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

References makeBinaryBlock().

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

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

References makeBinaryBlock().

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

Variable Documentation

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.

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.