35 #define NDN_LOG_DEBUG_DEPTH(x) NDN_LOG_DEBUG(std::string(state->getDepth() + 1, '>') << " " << x)
36 #define NDN_LOG_TRACE_DEPTH(x) NDN_LOG_TRACE(std::string(state->getDepth() + 1, '>') << " " << x)
40 , m_scheduler(face.getIoService())
46 const shared_ptr<ValidationState>& state,
51 dataCallback(data, certRequest, state, continueValidation);
54 nackCallback(nack, certRequest, state, continueValidation);
57 timeoutCallback(certRequest, state, continueValidation);
63 const shared_ptr<CertificateRequest>&,
64 const shared_ptr<ValidationState>& state,
76 continueValidation(cert, state);
81 const shared_ptr<CertificateRequest>& certRequest,
82 const shared_ptr<ValidationState>& state,
86 << certRequest->interest.getName());
88 --certRequest->nRetriesLeft;
89 if (certRequest->nRetriesLeft >= 0) {
91 [=] { fetch(certRequest, state, continueValidation); });
92 certRequest->waitAfterNack *= 2;
96 "`" + certRequest->interest.getName().toUri() +
"`"});
102 const shared_ptr<ValidationState>& state,
105 NDN_LOG_DEBUG_DEPTH(
"Timeout while fetching certificate " << certRequest->interest.getName());
107 --certRequest->nRetriesLeft;
108 if (certRequest->nRetriesLeft >= 0) {
109 fetch(certRequest, state, continueValidation);
113 "`" + certRequest->interest.getName().toUri() +
"`"});
#define NDN_LOG_DEBUG_DEPTH(x)
Represents a Data packet.
const Name & getName() const noexcept
Get the data name.
Provide a communication channel with local or remote NDN forwarder.
PendingInterestHandle expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express an Interest.
Represents an Interest packet.
Represents a Network Nack.
NackReason getReason() const
EventId schedule(time::nanoseconds after, EventCallback callback)
Schedule a one-time event after the specified delay.
CertificateFetcherFromNetwork(Face &face)
void doFetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Asynchronous certificate fetching implementation.
void dataCallback(const Data &data, const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Callback invoked when certificate is retrieved.
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.
void timeoutCallback(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Callback invoked when interest for fetching certificate times out.
Interface used by the validator to fetch missing certificates.
void fetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Asynchronously fetch certificate.
std::function< void(const Certificate &cert, const shared_ptr< ValidationState > &state)> ValidationContinuation
Represents an NDN certificate.
@ MALFORMED_CERT
The certificate is malformed.
@ CANNOT_RETRIEVE_CERT
The certificate cannot be retrieved.
Represents an error in TLV encoding or decoding.
#define NDN_LOG_INIT(name)
Define a non-member log module.