certificate-bundle-fetcher.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_V2_CERTIFICATE_BUNDLE_FETCHER_HPP
23 #define NDN_SECURITY_V2_CERTIFICATE_BUNDLE_FETCHER_HPP
24 
26 
27 namespace ndn {
28 namespace security {
29 namespace v2 {
30 
42 {
43 public:
44  explicit
45  CertificateBundleFetcher(unique_ptr<CertificateFetcher> inner,
46  Face& face);
47 
51  void
52  setBundleInterestLifetime(time::milliseconds time);
53 
57  time::milliseconds
59 
63  void
64  setCertificateStorage(CertificateStorage& certStorage) override;
65 
66 protected:
67  void
68  doFetch(const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
69  const ValidationContinuation& continueValidation) override;
70 
71 private:
80  void
81  fetchFirstBundleSegment(const Name& bundleNamePrefix,
82  const shared_ptr<CertificateRequest>& certRequest,
83  const shared_ptr<ValidationState>& state,
84  const ValidationContinuation& continueValidation);
85 
89  void
90  fetchNextBundleSegment(const Name& fullBundleName, const name::Component& segmentNo,
91  const shared_ptr<CertificateRequest>& certRequest,
92  const shared_ptr<ValidationState>& state,
93  const ValidationContinuation& continueValidation);
94 
111  static Name
112  deriveBundleName(const Name& name);
113 
117  void
118  dataCallback(const Data& data, bool isSegmentZeroExpected,
119  const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
120  const ValidationContinuation& continueValidation);
121 
125  void
126  nackCallback(const lp::Nack& nack,
127  const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
128  const ValidationContinuation& continueValidation, const Name& bundleName);
129 
133  void
134  timeoutCallback(const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
135  const ValidationContinuation& continueValidation, const Name& bundleName);
136 
137 private:
138  unique_ptr<CertificateFetcher> m_inner;
139  Face& m_face;
142  time::milliseconds m_bundleInterestLifetime;
143 };
144 
145 } // namespace v2
146 } // namespace security
147 } // namespace ndn
148 
149 #endif // NDN_SECURITY_V2_CERTIFICATE_BUNDLE_FETCHER_HPP
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
Interface used by the validator to fetch missing certificates.
void setBundleInterestLifetime(time::milliseconds time)
Set the lifetime of certificate bundle interest.
std::function< void(const Certificate &cert, const shared_ptr< ValidationState > &state)> ValidationContinuation
CertificateBundleFetcher(unique_ptr< CertificateFetcher > inner, Face &face)
represents a Network Nack
Definition: nack.hpp:40
provides a tag type for simple types
Definition: tag.hpp:58
Storage for trusted anchors, verified certificate cache, and unverified certificate cache...
Provide a communication channel with local or remote NDN forwarder.
Definition: face.hpp:95
void doFetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Asynchronous certificate fetching implementation.
Represents an absolute name.
Definition: name.hpp:42
Fetch certificate bundle from the network.
Component holds a read-only name component value.
Represents a Data packet.
Definition: data.hpp:35
void setCertificateStorage(CertificateStorage &certStorage) override
Set the storage for this and inner certificate fetcher.