22 #ifndef NDN_CXX_LP_FIELD_DECL_HPP 
   23 #define NDN_CXX_LP_FIELD_DECL_HPP 
   32 #include <boost/concept/requires.hpp> 
   33 #include <boost/endian/conversion.hpp> 
   40 struct NonNegativeIntegerTag;
 
   42 template<
typename TlvType, 
typename T>
 
   50     type.wireDecode(wire);
 
   55 template<
typename TlvType>
 
   69 template<
typename TlvType>
 
   79 template<
typename TlvType>
 
   87                                 " must contain a 64-bit integer"));
 
   90     std::memcpy(&n, wire.
value(), 
sizeof(n));
 
   91     return boost::endian::big_to_native(n);
 
   95 template<
typename TlvType>
 
   96 struct DecodeHelper<TlvType, std::pair<Buffer::const_iterator, Buffer::const_iterator>>
 
   98   static std::pair<Buffer::const_iterator, Buffer::const_iterator>
 
  103                                 " cannot be empty"));
 
  109 template<
typename encoding::Tag TAG, 
typename TlvType, 
typename T>
 
  116     return value.wireEncode(encoder);
 
  120 template<
typename encoding::Tag TAG, 
typename TlvType>
 
  130 template<
typename encoding::Tag TAG, 
typename TlvType>
 
  140 template<
typename encoding::Tag TAG, 
typename TlvType>
 
  146     boost::endian::native_to_big_inplace(value);
 
  148                               {
reinterpret_cast<const uint8_t*
>(&value), 
sizeof(value)});
 
  152 template<
typename encoding::Tag TAG, 
typename TlvType>
 
  153 struct EncodeHelper<TAG, TlvType, std::pair<Buffer::const_iterator, Buffer::const_iterator>>
 
  159     length += encoder.prependRange(value.first, value.second);
 
  160     length += encoder.prependVarNumber(length);
 
  161     length += encoder.prependVarNumber(TlvType::value);
 
  174 template<
typename LOCATION, 
typename VALUE, uint64_t TYPE, 
bool REPEATABLE = 
false,
 
  175          typename DECODER_TAG = VALUE, 
typename ENCODER_TAG = VALUE>
 
  181   typedef std::integral_constant<uint64_t, TYPE> 
TlvType;
 
  192     if (wire.
type() != TlvType::value) {
 
  203   template<
typename encoding::Tag TAG>
 
Represents a TLV element of the NDN packet format.
 
uint32_t type() const
Return the TLV-TYPE of the Block.
 
Buffer::const_iterator value_end() const
Get end iterator of TLV-VALUE.
 
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
 
size_t value_size() const noexcept
Return the size of TLV-VALUE, aka TLV-LENGTH.
 
const uint8_t * value() const noexcept
Return a raw pointer to the beginning of TLV-VALUE.
 
a concept check for TLV abstraction with .wireDecode method and constructible from Block
 
a concept check for TLV abstraction with .wireEncode method
 
std::integral_constant< uint64_t, TYPE > TlvType
 
static size_t encode(EncodingImpl< TAG > &encoder, const ValueType &value)
Encode a field and prepend to encoder.
 
std::integral_constant< bool, REPEATABLE > IsRepeatable
 
static ValueType decode(const Block &wire)
Decode a field.
 
represents an error in TLV encoding or decoding
 
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
 
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
 
size_t prependEmptyBlock(EncodingImpl< TAG > &encoder, uint32_t type)
Prepend an empty TLV element.
 
size_t prependBinaryBlock(EncodingImpl< TAG > &encoder, uint32_t type, span< const uint8_t > value)
Prepend a TLV element containing a sequence of raw bytes.
 
std::string to_string(const errinfo_stacktrace &x)
 
static EmptyValue decode(const Block &wire)
 
static uint64_t decode(const Block &wire)
 
static std::pair< Buffer::const_iterator, Buffer::const_iterator > decode(const Block &wire)
 
static uint64_t decode(const Block &wire)
 
static T decode(const Block &wire)
 
represents a zero-length TLV-VALUE
 
static size_t encode(EncodingImpl< TAG > &encoder, EmptyValue)
 
static size_t encode(EncodingImpl< TAG > &encoder, uint64_t value)
 
static size_t encode(EncodingImpl< TAG > &encoder, const std::pair< Buffer::const_iterator, Buffer::const_iterator > &value)
 
static size_t encode(EncodingImpl< TAG > &encoder, uint64_t value)
 
static size_t encode(EncodingImpl< TAG > &encoder, const T &value)