NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
certificate-fetcher-direct-fetch.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
23 #include "face.hpp"
24 #include "lp/tags.hpp"
25 
26 namespace ndn {
27 namespace security {
28 namespace v2 {
29 
32 {
33 }
34 
35 void
36 CertificateFetcherDirectFetch::doFetch(const shared_ptr<CertificateRequest>& keyRequest,
37  const shared_ptr<ValidationState>& state,
38  const ValidationContinuation& continueValidation)
39 {
40  auto interestState = dynamic_pointer_cast<InterestValidationState>(state);
41  if (interestState != nullptr) {
42  uint64_t incomingFaceId = 0;
43  auto incomingFaceIdTag = interestState->getOriginalInterest().getTag<lp::IncomingFaceIdTag>();
44  if (incomingFaceIdTag != nullptr) {
45  incomingFaceId = incomingFaceIdTag->get();
46  }
47 
48  if (incomingFaceId != 0) {
49  Interest directInterest(keyRequest->m_interest);
50  directInterest.refreshNonce();
51  directInterest.setTag(make_shared<lp::NextHopFaceIdTag>(incomingFaceId));
52  m_face.expressInterest(directInterest, nullptr, nullptr, nullptr);
53  }
54  }
55 
56  // send infrastructure Interest
57  CertificateFetcherFromNetwork::doFetch(keyRequest, state, continueValidation);
58 }
59 
60 } // namespace v2
61 } // namespace security
62 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
void refreshNonce()
Refresh nonce.
Definition: interest.cpp:318
represents an Interest packet
Definition: interest.hpp:42
std::function< void(const Certificate &cert, const shared_ptr< ValidationState > &state)> ValidationContinuation
void setTag(shared_ptr< T > tag) const
set a tag item
Definition: tag-host.hpp:80
Catch-all error for security policy errors that don&#39;t fit in other categories.
Definition: base.hpp:79
void doFetch(const shared_ptr< CertificateRequest > &keyRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Asynchronous certificate fetching implementation.
provides a tag type for simple types
Definition: tag.hpp:58
Validation state for an interest packet.
Provide a communication channel with local or remote NDN forwarder.
Definition: face.hpp:95
shared_ptr< T > getTag() const
get a tag item
Definition: tag-host.hpp:67
const PendingInterestId * expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express Interest.
Definition: face.cpp:144
const T & get() const
Definition: tag.hpp:86
void doFetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Asynchronous certificate fetching implementation.