32 #define NDN_LOG_DEBUG_DEPTH(x) NDN_LOG_DEBUG(std::string(state->getDepth() + 1, '>') << " " << x) 33 #define NDN_LOG_TRACE_DEPTH(x) NDN_LOG_TRACE(std::string(state->getDepth() + 1, '>') << " " << x) 37 , m_scheduler(face.getIoService())
43 const shared_ptr<ValidationState>& state,
48 dataCallback(data, certRequest, state, continueValidation);
51 nackCallback(nack, certRequest, state, continueValidation);
54 timeoutCallback(certRequest, state, continueValidation);
60 const shared_ptr<CertificateRequest>& certRequest,
61 const shared_ptr<ValidationState>& state,
71 return state->fail({ValidationError::Code::MALFORMED_CERT,
"Fetched a malformed certificate " 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;
93 state->fail({ValidationError::Code::CANNOT_RETRIEVE_CERT,
"Cannot fetch certificate after all " 94 "retries `" + certRequest->interest.getName().toUri() +
"`"});
100 const shared_ptr<ValidationState>& state,
103 NDN_LOG_DEBUG_DEPTH(
"Timeout while fetching certificate " << certRequest->interest.getName()
106 --certRequest->nRetriesLeft;
107 if (certRequest->nRetriesLeft >= 0) {
108 fetch(certRequest, state, continueValidation);
111 state->fail({ValidationError::Code::CANNOT_RETRIEVE_CERT,
"Cannot fetch certificate after all " 112 "retries `" + certRequest->interest.getName().toUri() +
"`"});
The certificate following the certificate format naming convention.
Interface used by the validator to fetch missing certificates.
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.
Represents an Interest packet.
std::function< void(const Certificate &cert, const shared_ptr< ValidationState > &state)> ValidationContinuation
#define NDN_LOG_INIT(name)
Define a non-member log module.
represents a Network Nack
NackReason getReason() const
std::string toUri() const
Get URI representation of the name.
#define NDN_LOG_DEBUG_DEPTH(x)
void fetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Asynchronously fetch certificate.
CertificateFetcherFromNetwork(Face &face)
Provide a communication channel with local or remote NDN forwarder.
void dataCallback(const Data &data, const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Callback invoked when certificate is retrieved.
PendingInterestHandle expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express Interest.
const Name & getName() const
Get name.
void timeoutCallback(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Callback invoked when interest for fetching certificate times out.
Represents a Data packet.
represents an error in TLV encoding or decoding
void doFetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Asynchronous certificate fetching implementation.