33 #define NDN_LOG_DEBUG_DEPTH(x) NDN_LOG_DEBUG(std::string(state->getDepth() + 1, '>') << " " << x)
34 #define NDN_LOG_TRACE_DEPTH(x) NDN_LOG_TRACE(std::string(state->getDepth() + 1, '>') << " " << x)
38 , m_scheduler(face.getIoContext())
44 const shared_ptr<ValidationState>& state,
49 dataCallback(data, certRequest, state, continueValidation);
52 nackCallback(nack, certRequest, state, continueValidation);
55 timeoutCallback(certRequest, state, continueValidation);
61 const shared_ptr<CertificateRequest>&,
62 const shared_ptr<ValidationState>& state,
74 continueValidation(cert, state);
79 const shared_ptr<CertificateRequest>& certRequest,
80 const shared_ptr<ValidationState>& state,
84 << certRequest->interest.getName());
86 --certRequest->nRetriesLeft;
87 if (certRequest->nRetriesLeft >= 0) {
89 [=] { fetch(certRequest, state, continueValidation); });
90 certRequest->waitAfterNack *= 2;
94 "`" + certRequest->interest.getName().toUri() +
"`"});
100 const shared_ptr<ValidationState>& state,
103 NDN_LOG_DEBUG_DEPTH(
"Timeout while fetching certificate " << certRequest->interest.getName());
105 --certRequest->nRetriesLeft;
106 if (certRequest->nRetriesLeft >= 0) {
107 fetch(certRequest, state, continueValidation);
111 "`" + 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.
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.
CertificateFetcherFromNetwork(Face &face)
void timeoutCallback(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Callback invoked when interest for fetching certificate times out.
void doFetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Asynchronous certificate fetching implementation.
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.
@ CANNOT_RETRIEVE_CERT
The certificate cannot be retrieved.
@ MALFORMED_CERT
The certificate is malformed.
Represents an error in TLV encoding or decoding.
#define NDN_LOG_INIT(name)
Define a non-member log module.
Contains the ndn-cxx security framework.