esp8266ndn
NDN Arduino library for ESP8266 and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Static Public Member Functions | List of all members
ndnph::EvDecoder Class Reference

TLV decoder that understands Packet Format v0.3 evolvability guidelines. More...

#include <ev-decoder.hpp>

Classes

class  DefaultIsCritical
 
class  DefaultUnknownCb
 

Static Public Member Functions

template<typename... E>
static bool decode (const Decoder::Tlv &input, std::initializer_list< uint32_t > topTypes, const E &... defs)
 Decode input TLV with a sequence of element definitions. More...
 
template<typename... E>
static bool decodeValue (const Decoder &input, const E &... defs)
 Decode input TLV-VALUE with a sequence of element definitions. More...
 
template<typename UnknownCallback , typename IsCritical , typename... E>
static bool decodeEx (const Decoder::Tlv &input, std::initializer_list< uint32_t > topTypes, const UnknownCallback &unknownCb, const IsCritical &isCritical, const E &... defs)
 Decode input TLV with a sequence of element definitions. More...
 
template<typename UnknownCallback , typename IsCritical , typename... E>
static bool decodeValueEx (const Decoder &input, const UnknownCallback &unknownCb, const IsCritical &isCritical, const E &... defs)
 Decode input TLV-VALUE with a sequence of element definitions. More...
 
template<int type, bool repeatable = false, int order = 0, typename Fn = void, typename R = detail::EvdElementDefFn<type, repeatable, order, Fn>>
static R def (const Fn &f, decltype(&Fn::operator())=nullptr)
 Create an element definition. More...
 
template<int type, bool repeatable = false, int order = 0, typename Decodable = void, typename R = detail::EvdElementDefDecodable<type, repeatable, order, Decodable>>
static R def (Decodable *decodable, decltype(&Decodable::decodeFrom)=nullptr)
 Create an element definition. More...
 
template<int type, bool repeatable = false, int order = 0, typename R = detail::EvdElementDefIgnore<type, repeatable, order>>
static R defIgnore ()
 Create an element definition to ignore a field. More...
 
template<int type, typename NniClass = tlv::NNI, int order = 0, typename ValueType = void, typename R = detail::EvdElementDefNni<type, order, NniClass, ValueType>>
static R defNni (ValueType *value)
 Create an element definition for Non-Negative Integer field. More...
 

Detailed Description

TLV decoder that understands Packet Format v0.3 evolvability guidelines.

Member Function Documentation

◆ decode()

template<typename... E>
static bool ndnph::EvDecoder::decode ( const Decoder::Tlv input,
std::initializer_list< uint32_t >  topTypes,
const E &...  defs 
)
inlinestatic

Decode input TLV with a sequence of element definitions.

Compare to decodeEx(), decode() does not allow customizing unknownCb and isCritical.

◆ decodeEx()

template<typename UnknownCallback , typename IsCritical , typename... E>
static bool ndnph::EvDecoder::decodeEx ( const Decoder::Tlv input,
std::initializer_list< uint32_t >  topTypes,
const UnknownCallback &  unknownCb,
const IsCritical &  isCritical,
const E &...  defs 
)
inlinestatic

Decode input TLV with a sequence of element definitions.

Template Parameters
UnknownCallback`bool (*)(const Decoder::Tlv& d, int& currentOrder)`, return true to indicate TLV has been accepted.
IsCritical`bool (*)(uint32_t type)`
EElementDef
Parameters
inputTLV element from Decoder.
topTypesa list of acceptable top-level TLV-TYPE numbers; if empty, top-level TLV-TYPE is not checked.
unknownCbcallback to handle TLV with TLV-TYPE number not in defs.
isCriticalcallback to determine whether an unrecognized TLV-TYPE number is 'critical' and should cause a decode error.
defsa sequence of ElementDef to recognize each sub TLV element.

◆ decodeValue()

template<typename... E>
static bool ndnph::EvDecoder::decodeValue ( const Decoder input,
const E &...  defs 
)
inlinestatic

Decode input TLV-VALUE with a sequence of element definitions.

Compare to decodeValueEx(), decodeValue() does not allow customizing unknownCb and isCritical.

◆ decodeValueEx()

template<typename UnknownCallback , typename IsCritical , typename... E>
static bool ndnph::EvDecoder::decodeValueEx ( const Decoder input,
const UnknownCallback &  unknownCb,
const IsCritical &  isCritical,
const E &...  defs 
)
inlinestatic

Decode input TLV-VALUE with a sequence of element definitions.

◆ def() [1/2]

template<int type, bool repeatable = false, int order = 0, typename Fn = void, typename R = detail::EvdElementDefFn<type, repeatable, order, Fn>>
static R ndnph::EvDecoder::def ( const Fn &  f,
decltype(&::operator   
)
inlinestatic

Create an element definition.

Template Parameters
typeTLV-TYPE number.
repeatablewhether the TLV can be repeated.
ordercustomized order number. Elements must appear in the TLV-VALUE in a certain order. By default, the order of defs passed to decode() determines the expected order. This parameter allows overriding the default order.
Fn`bool (*)(const Decoder::Tlv&)` or `void (*)(const Decoder::Tlv&)`
Parameters
ffunction to process TLV element.

◆ def() [2/2]

template<int type, bool repeatable = false, int order = 0, typename Decodable = void, typename R = detail::EvdElementDefDecodable<type, repeatable, order, Decodable>>
static R ndnph::EvDecoder::def ( Decodable *  decodable,
decltype &::decodeFrom  = nullptr 
)
inlinestatic

Create an element definition.

Template Parameters
Decodableclass with `bool decodeFrom(const Decoder::Tlv&)` method.

◆ defIgnore()

template<int type, bool repeatable = false, int order = 0, typename R = detail::EvdElementDefIgnore<type, repeatable, order>>
static R ndnph::EvDecoder::defIgnore ( )
inlinestatic

Create an element definition to ignore a field.

◆ defNni()

template<int type, typename NniClass = tlv::NNI, int order = 0, typename ValueType = void, typename R = detail::EvdElementDefNni<type, order, NniClass, ValueType>>
static R ndnph::EvDecoder::defNni ( ValueType *  value)
inlinestatic

Create an element definition for Non-Negative Integer field.

Template Parameters
NniClasseither tlv::NNI or a fixed-length variant.

The documentation for this class was generated from the following file: