|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
22 #ifndef NDN_ENCODING_BLOCK_HELPERS_HPP
23 #define NDN_ENCODING_BLOCK_HELPERS_HPP
42 extern template size_t
45 extern template size_t
71 std::enable_if_t<std::is_integral<R>::value, R>
75 if (value > std::numeric_limits<R>::max()) {
78 return static_cast<R
>(value);
90 std::enable_if_t<std::is_enum<R>::value, R>
93 return static_cast<R
>(readNonNegativeIntegerAs<std::underlying_type_t<R>>(block));
106 extern template size_t
109 extern template size_t
130 extern template size_t
133 extern template size_t
162 extern template size_t
165 extern template size_t
206 template<
class Iterator>
210 BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Iterator>));
216 size_t valueLength = last - first;
217 size_t totalLength = valueLength;
226 return encoder.
block();
232 template<
class Iterator>
236 BOOST_CONCEPT_ASSERT((boost::InputIterator<Iterator>));
244 size_t valueLength = encoder.
appendRange(first, last);
248 return encoder.
block();
261 template<
class Iterator>
265 using BinaryBlockHelper = std::conditional_t<
266 std::is_base_of<std::random_access_iterator_tag,
267 typename std::iterator_traits<Iterator>::iterator_category>::value,
271 return BinaryBlockHelper::makeBlock(type, first, last);
281 template<Tag TAG,
class U>
287 size_t valueLength = value.wireEncode(encoder);
288 size_t totalLength = valueLength;
289 totalLength += encoder.prependVarNumber(valueLength);
290 totalLength += encoder.prependVarNumber(type);
311 return encoder.
block();
327 #endif // NDN_ENCODING_BLOCK_HELPERS_HPP
Create a binary block copying from RandomAccessIterator.
size_t appendRange(Iterator first, Iterator last)
Append range of bytes from the range [first, last)
template size_t prependDoubleBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &, uint32_t, double)
Create a binary block copying from generic InputIterator.
EncodingImpl specialization for TLV size estimation.
std::string readString(const Block &block)
Read TLV-VALUE of a TLV element as a string.
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
size_t prependVarNumber(uint64_t varNumber)
Prepend VarNumber varNumber of NDN TLV encoding.
EncodingImpl specialization for actual TLV encoding.
size_t prependNestedBlock(EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
Prepend a TLV element containing a nested TLV element.
template size_t prependNonNegativeIntegerBlock< EncoderTag >(EncodingImpl< EncoderTag > &, uint32_t, uint64_t)
uint32_t type() const
Return the TLV-TYPE of the Block.
Block block(bool verifyLength=true) const
Create Block from the underlying buffer.
size_t prependRange(Iterator first, Iterator last)
Prepend range of bytes from the range [first, last)
Block makeNonNegativeIntegerBlock(uint32_t type, uint64_t value)
Create a TLV block containing a non-negative integer.
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.
template size_t prependStringBlock< EncoderTag >(EncodingImpl< EncoderTag > &, uint32_t, const std::string &)
Block makeNestedBlock(uint32_t type, const U &value)
Create a TLV block containing a nested TLV element.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
Represents a TLV element of NDN packet format.
std::string to_string(const T &val)
size_t prependDoubleBlock(EncodingImpl< TAG > &encoder, uint32_t type, double value)
Prepend a TLV element containing an IEEE 754 double-precision floating-point number.
static Block makeBlock(uint32_t type, Iterator first, Iterator last)
static Block makeBlock(uint32_t type, Iterator first, Iterator last)
template size_t prependStringBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &, uint32_t, const std::string &)
template size_t prependEmptyBlock< EncoderTag >(EncodingImpl< EncoderTag > &, uint32_t)
size_t prependEmptyBlock(EncodingImpl< TAG > &encoder, uint32_t type)
Prepend an empty TLV element.
double readDouble(const Block &block)
Read TLV-VALUE of a TLV element as an IEEE 754 double-precision floating-point number.
template size_t prependDoubleBlock< EncoderTag >(EncodingImpl< EncoderTag > &, uint32_t, double)
size_t prependStringBlock(EncodingImpl< TAG > &encoder, uint32_t type, const std::string &value)
Prepend a TLV element containing a string.
represents an error in TLV encoding or decoding
Block makeEmptyBlock(uint32_t type)
Create an empty TLV block.
size_t prependVarNumber(uint64_t varNumber) const noexcept
Prepend VarNumber varNumber of NDN TLV encoding.
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block copying TLV-VALUE from raw buffer.
a concept check for TLV abstraction with .wireEncode method
template size_t prependEmptyBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &, uint32_t)
Block makeDoubleBlock(uint32_t type, double value)
Create a TLV element containing an IEEE 754 double-precision floating-point number.
Block makeStringBlock(uint32_t type, const std::string &value)
Create a TLV block containing a string.
Copyright (c) 2011-2015 Regents of the University of California.
template size_t prependNonNegativeIntegerBlock< EstimatorTag >(EncodingImpl< EstimatorTag > &, uint32_t, uint64_t)