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
ndn::security::v2::CertificateBundleFetcher::CertificateBundleFetcher
CertificateBundleFetcher(unique_ptr< CertificateFetcher > inner, Face &face)
Definition: certificate-bundle-fetcher.cpp:35
ndn::security::v2::CertificateBundleFetcher::getBundleInterestLifetime
time::milliseconds getBundleInterestLifetime() const
Definition: certificate-bundle-fetcher.cpp:51
ndn::SimpleTag
provides a tag type for simple types
Definition: tag.hpp:59
ndn::security::v2::CertificateBundleFetcher
Fetch certificate bundle from the network.
Definition: certificate-bundle-fetcher.hpp:42
ndn::Face
Provide a communication channel with local or remote NDN forwarder.
Definition: face.hpp:90
ndn::security::v2::CertificateBundleFetcher::setCertificateStorage
void setCertificateStorage(CertificateStorage &certStorage) override
Set the storage for this and inner certificate fetcher.
Definition: certificate-bundle-fetcher.cpp:57
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
ndn::security::v2::CertificateFetcher
Interface used by the validator to fetch missing certificates.
Definition: certificate-fetcher.hpp:40
ndn::security::v2::CertificateBundleFetcher::doFetch
void doFetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Asynchronous certificate fetching implementation.
Definition: certificate-bundle-fetcher.cpp:64
ndn::security::v2::CertificateStorage
Storage for trusted anchors, verified certificate cache, and unverified certificate cache.
Definition: certificate-storage.hpp:37
ndn::security::v2::CertificateBundleFetcher::setBundleInterestLifetime
void setBundleInterestLifetime(time::milliseconds time)
Set the lifetime of certificate bundle interest.
Definition: certificate-bundle-fetcher.cpp:45
ndn::time
Definition: time-custom-clock.hpp:28
ndn::Data
Represents a Data packet.
Definition: data.hpp:36
ndn::security::v2::CertificateFetcher::ValidationContinuation
std::function< void(const Certificate &cert, const shared_ptr< ValidationState > &state)> ValidationContinuation
Definition: certificate-fetcher.hpp:43
ndn::name::Component
Represents a name component.
Definition: name-component.hpp:94
ndn::lp::Nack
represents a Network Nack
Definition: nack.hpp:39
ndn::name
Definition: name-component-types.hpp:33
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
certificate-fetcher-from-network.hpp