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

Interest packet. More...

#include <interest.hpp>

Inherits ndnph::Printable, and ndnph::detail::InterestRefBase.

Classes

class  Parameterized
 Result of Interest::parameterize operation. More...
 

Public Types

using Signed = detail::SignedInterestRef
 Result of Interest::sign operation. More...
 
- Public Types inherited from ndnph::RefRegion< InterestObj >
using ObjType = InterestObj
 

Public Member Functions

void setName (const Name &v)
 
void setCanBePrefix (bool v)
 
void setMustBeFresh (bool v)
 
void setFwHint (const Name &v)
 
void setNonce (uint32_t v)
 
void setLifetime (uint16_t v)
 
void setHopLimit (uint8_t v)
 
tlv::Value getAppParameters () const
 Retrieve AppParameters. More...
 
const ISigInfogetSigInfo () const
 Retrieve SignatureInfo. More...
 
void encodeTo (Encoder &encoder) const
 Encode the Interest without AppParameters. More...
 
Parameterized parameterize (tlv::Value appParameters) const
 Add AppParameters to the packet. More...
 
template<typename... Arg>
Signed sign (Arg &&... arg) const
 Sign the packet with a private key. More...
 
bool decodeFrom (const Decoder::Tlv &input)
 Decode packet. More...
 
template<typename Encodable >
bool decodeFrom (Encodable &&encodable)
 Encode then decode as Interest packet. More...
 
bool checkDigest () const
 Check ParametersSha256DigestComponent. More...
 
bool verify (const PublicKey &key) const
 Verify the packet with a public key. More...
 
template<typename DataT >
bool match (const DataT &data) const
 
size_t printTo (::Print &p) const final
 
- Public Member Functions inherited from ndnph::Printable
 operator Esp32Printable () const
 
- Public Member Functions inherited from ndnph::detail::InterestRefBase
const NamegetName () const
 
bool getCanBePrefix () const
 
bool getMustBeFresh () const
 
const NamegetFwHint () const
 
uint32_t getNonce () const
 
uint16_t getLifetime () const
 
uint8_t getHopLimit () const
 
 RefRegion (ObjType *obj=nullptr)
 
- Public Member Functions inherited from ndnph::RefRegion< InterestObj >
 RefRegion (ObjType *obj=nullptr)
 
 operator bool () const
 

Additional Inherited Members

- Protected Member Functions inherited from ndnph::detail::InterestRefBase
 ~InterestRefBase ()=default
 
void encodeMiddle (Encoder &encoder) const
 
- Protected Member Functions inherited from ndnph::RefRegion< InterestObj >
 ~RefRegion ()=default
 
- Static Protected Member Functions inherited from ndnph::detail::InterestRefBase
static int findParamsDigest (const Name &name)
 
- Protected Attributes inherited from ndnph::RefRegion< InterestObj >
ObjTypeobj
 

Detailed Description

Interest packet.

Member Typedef Documentation

◆ Signed

Result of Interest::sign operation.

Member Function Documentation

◆ checkDigest()

bool ndnph::Interest::checkDigest ( ) const
inline

Check ParametersSha256DigestComponent.

Returns
whether the digest is correct.

This method only works on decoded packet. It's unnecessary to call this method if you are going to use verify().

◆ decodeFrom() [1/2]

bool ndnph::Interest::decodeFrom ( const Decoder::Tlv input)
inline

Decode packet.

◆ decodeFrom() [2/2]

template<typename Encodable >
bool ndnph::Interest::decodeFrom ( Encodable &&  encodable)
inline

Encode then decode as Interest packet.

This is useful for obtaining an Interest packet in decoded state from the result of signing.

◆ encodeTo()

void ndnph::Interest::encodeTo ( Encoder encoder) const
inline

Encode the Interest without AppParameters.

◆ getAppParameters()

tlv::Value ndnph::Interest::getAppParameters ( ) const
inline

Retrieve AppParameters.

Precondition
only available on decoded packet.
Note
To create Interest packet with AppParameters, use parameterize().

◆ getSigInfo()

const ISigInfo* ndnph::Interest::getSigInfo ( ) const
inline

Retrieve SignatureInfo.

Precondition
only available on decoded packet.

◆ match()

template<typename DataT >
bool ndnph::Interest::match ( const DataT &  data) const
inline

◆ parameterize()

Parameterized ndnph::Interest::parameterize ( tlv::Value  appParameters) const
inline

Add AppParameters to the packet.

Precondition
Name contains zero or one ParametersSha256DigestComponent.
Returns
an Encodable object, with an additional `sign(const PrivateKey&)` method to create a signed Interest. This object is valid only if Interest and appParameters are kept alive. It's recommended to pass it to Encoder immediately without saving as variable.
Note
Unrecognized fields found during decoding are not preserved in encoding output.
This method does not set sigValue. Packet is not verifiable after this operation.

◆ printTo()

size_t ndnph::Interest::printTo ( ::Print &  p) const
inlinefinalvirtual

Implements ndnph::Printable.

◆ setCanBePrefix()

void ndnph::Interest::setCanBePrefix ( bool  v)
inline

◆ setFwHint()

void ndnph::Interest::setFwHint ( const Name v)
inline

◆ setHopLimit()

void ndnph::Interest::setHopLimit ( uint8_t  v)
inline

◆ setLifetime()

void ndnph::Interest::setLifetime ( uint16_t  v)
inline

◆ setMustBeFresh()

void ndnph::Interest::setMustBeFresh ( bool  v)
inline

◆ setName()

void ndnph::Interest::setName ( const Name v)
inline

◆ setNonce()

void ndnph::Interest::setNonce ( uint32_t  v)
inline

◆ sign()

template<typename... Arg>
Signed ndnph::Interest::sign ( Arg &&...  arg) const
inline

Sign the packet with a private key.

Precondition
If Name contains ParametersSha256DigestComponent, it is the last component.
Returns
an Encodable object. This object is valid only if Interest and PrivateKey are kept alive. It's recommended to pass it to Encoder immediately without saving as variable.
Note
Unrecognized fields found during decoding are not preserved in encoding output.
This method does not set sigValue. Packet is not verifiable after this operation.

To create a signed Interest with AppParameters, call parameterize() first, then call sign() on its return value.

◆ verify()

bool ndnph::Interest::verify ( const PublicKey key) const
inline

Verify the packet with a public key.

Returns
verification result.

This method only works on decoded packet. It does not work on packet that has been modified or (re-)signed.


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