NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
certificate-bundle-fetcher.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2021 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_CXX_SECURITY_CERTIFICATE_BUNDLE_FETCHER_HPP
23 #define NDN_CXX_SECURITY_CERTIFICATE_BUNDLE_FETCHER_HPP
24 
25 #include "ndn-cxx/name.hpp"
26 #include "ndn-cxx/tag.hpp"
28 
29 namespace ndn {
30 namespace security {
31 inline namespace v2 {
32 
44 {
45 public:
46  explicit
47  CertificateBundleFetcher(unique_ptr<CertificateFetcher> inner,
48  Face& face);
49 
53  void
55 
61 
65  void
66  setCertificateStorage(CertificateStorage& certStorage) override;
67 
68 protected:
69  void
70  doFetch(const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
71  const ValidationContinuation& continueValidation) override;
72 
73 private:
82  void
83  fetchFirstBundleSegment(const Name& bundleNamePrefix,
84  const shared_ptr<CertificateRequest>& certRequest,
85  const shared_ptr<ValidationState>& state,
86  const ValidationContinuation& continueValidation);
87 
91  void
92  fetchNextBundleSegment(const Name& fullBundleName, const name::Component& segmentNo,
93  const shared_ptr<CertificateRequest>& certRequest,
94  const shared_ptr<ValidationState>& state,
95  const ValidationContinuation& continueValidation);
96 
113  static Name
114  deriveBundleName(const Name& name);
115 
119  void
120  dataCallback(const Data& data, bool isSegmentZeroExpected,
121  const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
122  const ValidationContinuation& continueValidation);
123 
127  void
128  nackCallback(const lp::Nack& nack,
129  const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
130  const ValidationContinuation& continueValidation, const Name& bundleName);
131 
135  void
136  timeoutCallback(const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state,
137  const ValidationContinuation& continueValidation, const Name& bundleName);
138 
139 private:
140  unique_ptr<CertificateFetcher> m_inner;
141  Face& m_face;
144  time::milliseconds m_bundleInterestLifetime;
145 };
146 
147 } // inline namespace v2
148 } // namespace security
149 } // namespace ndn
150 
151 #endif // NDN_CXX_SECURITY_CERTIFICATE_BUNDLE_FETCHER_HPP
Copyright (c) 2011-2015 Regents of the University of California.
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:38
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:90
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:41
Fetch certificate bundle from the network.
Represents a name component.
Represents a Data packet.
Definition: data.hpp:37
void setCertificateStorage(CertificateStorage &certStorage) override
Set the storage for this and inner certificate fetcher.
boost::chrono::milliseconds milliseconds
Definition: time.hpp:48