ndn::security::v2::CertificateFetcherFromNetwork Class Reference

Fetch missing keys from the network. More...

#include <ndn-cxx/security/certificate-fetcher-from-network.hpp>

+ Inheritance diagram for ndn::security::v2::CertificateFetcherFromNetwork:
+ Collaboration diagram for ndn::security::v2::CertificateFetcherFromNetwork:

Public Types

using ValidationContinuation = std::function< void(const Certificate &cert, const shared_ptr< ValidationState > &state)>
 

Public Member Functions

 CertificateFetcherFromNetwork (Face &face)
 
void fetch (const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
 Asynchronously fetch certificate. More...
 
virtual void setCertificateStorage (CertificateStorage &certStorage)
 Assign certificate storage to check known certificate and to cache unverified ones. More...
 

Protected Member Functions

void dataCallback (const Data &data, const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
 Callback invoked when certificate is retrieved. More...
 
void doFetch (const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
 Asynchronous certificate fetching implementation. More...
 
void nackCallback (const lp::Nack &nack, const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
 Callback invoked when interest for fetching certificate gets NACKed. More...
 
void timeoutCallback (const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
 Callback invoked when interest for fetching certificate times out. More...
 

Protected Attributes

CertificateStoragem_certStorage
 
Facem_face
 
Scheduler m_scheduler
 

Detailed Description

Fetch missing keys from the network.

Definition at line 43 of file certificate-fetcher-from-network.hpp.

Member Typedef Documentation

◆ ValidationContinuation

using ndn::security::v2::CertificateFetcher::ValidationContinuation = std::function<void(const Certificate& cert, const shared_ptr<ValidationState>& state)>
inherited

Definition at line 42 of file certificate-fetcher.hpp.

Constructor & Destructor Documentation

◆ CertificateFetcherFromNetwork()

ndn::security::v2::CertificateFetcherFromNetwork::CertificateFetcherFromNetwork ( Face face)
explicit

Definition at line 38 of file certificate-fetcher-from-network.cpp.

Member Function Documentation

◆ dataCallback()

void ndn::security::v2::CertificateFetcherFromNetwork::dataCallback ( const Data data,
const shared_ptr< CertificateRequest > &  certRequest,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
protected

Callback invoked when certificate is retrieved.

Definition at line 62 of file certificate-fetcher-from-network.cpp.

◆ doFetch()

void ndn::security::v2::CertificateFetcherFromNetwork::doFetch ( const shared_ptr< CertificateRequest > &  certRequest,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
overrideprotectedvirtual

Asynchronous certificate fetching implementation.

Implements ndn::security::v2::CertificateFetcher.

Definition at line 45 of file certificate-fetcher-from-network.cpp.

◆ fetch()

void ndn::security::v2::CertificateFetcher::fetch ( const shared_ptr< CertificateRequest > &  certRequest,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
inherited

Asynchronously fetch certificate.

Precondition
m_certStorage != nullptr

If the requested certificate exists in the storage, then this method will immediately call continueValidation with the certification. If certificate is not available, the implementation-specific doFetch will be called to asynchronously fetch certificate. The successfully retrieved certificate will be automatically added to the unverified cache of the certificate storage.

When the requested certificate is retrieved, continueValidation is called. Otherwise, the fetcher implementation call state->failed() with the appropriate error code and diagnostic message.

Definition at line 50 of file certificate-fetcher.cpp.

◆ nackCallback()

void ndn::security::v2::CertificateFetcherFromNetwork::nackCallback ( const lp::Nack nack,
const shared_ptr< CertificateRequest > &  certRequest,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
protected

Callback invoked when interest for fetching certificate gets NACKed.

Retries with exponential backoff while certRequest->nRetriesLeft > 0

Definition at line 80 of file certificate-fetcher-from-network.cpp.

◆ setCertificateStorage()

void ndn::security::v2::CertificateFetcher::setCertificateStorage ( CertificateStorage certStorage)
virtualinherited

Assign certificate storage to check known certificate and to cache unverified ones.

Note
The supplied certStorage should be valid for the lifetime of CertificateFetcher

Reimplemented in ndn::security::v2::CertificateBundleFetcher.

Definition at line 44 of file certificate-fetcher.cpp.

◆ timeoutCallback()

void ndn::security::v2::CertificateFetcherFromNetwork::timeoutCallback ( const shared_ptr< CertificateRequest > &  certRequest,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
protected

Callback invoked when interest for fetching certificate times out.

It will retry if certRequest->nRetriesLeft > 0

Definition at line 101 of file certificate-fetcher-from-network.cpp.

Member Data Documentation

◆ m_certStorage

CertificateStorage* ndn::security::v2::CertificateFetcher::m_certStorage
protectedinherited

Definition at line 84 of file certificate-fetcher.hpp.

◆ m_face

Face& ndn::security::v2::CertificateFetcherFromNetwork::m_face
protected

Definition at line 82 of file certificate-fetcher-from-network.hpp.

◆ m_scheduler

Scheduler ndn::security::v2::CertificateFetcherFromNetwork::m_scheduler
protected

Definition at line 83 of file certificate-fetcher-from-network.hpp.