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-2018 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_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) 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:93
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:43
Fetch certificate bundle from the network.
Represents a name component.
Represents a Data packet.
Definition: data.hpp:35
void setCertificateStorage(CertificateStorage &certStorage) override
Set the storage for this and inner certificate fetcher.