certificate-store.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2020, The University of Memphis,
4  * Regents of the University of California,
5  * Arizona Board of Regents.
6  *
7  * This file is part of NLSR (Named-data Link State Routing).
8  * See AUTHORS.md for complete list of NLSR authors and contributors.
9  *
10  * NLSR is free software: you can redistribute it and/or modify it under the terms
11  * of the GNU General Public License as published by the Free Software Foundation,
12  * either version 3 of the License, or (at your option) any later version.
13  *
14  * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  * PURPOSE. See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along with
19  * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef NLSR_CERTIFICATE_STORE_HPP
23 #define NLSR_CERTIFICATE_STORE_HPP
24 
25 #include "common.hpp"
26 #include "test-access-control.hpp"
27 #include "lsdb.hpp"
28 
29 #include <ndn-cxx/interest.hpp>
30 #include <ndn-cxx/mgmt/nfd/controller.hpp>
31 #include <ndn-cxx/security/certificate.hpp>
32 #include <ndn-cxx/security/validator-config.hpp>
33 
34 namespace nlsr {
35 class ConfParameter;
36 namespace security {
37 
46 {
47 
48 public:
49  CertificateStore(ndn::Face& face, ConfParameter& confParam, Lsdb& lsdb);
50 
51  void
52  insert(const ndn::security::Certificate& certificate);
53 
62  const ndn::security::Certificate*
63  find(const ndn::Name& keyName) const;
64 
69  void
70  publishCertFromCache(const ndn::Name& keyName);
71 
72  void
73  afterFetcherSignalEmitted(const ndn::Data& lsaSegment);
74 
76  void
77  clear();
78 
79  void
80  setInterestFilter(const ndn::Name& prefix, const bool loopback = false);
81 
82  void
83  registerKeyPrefixes();
84 
85  void
86  onKeyInterest(const ndn::Name& name, const ndn::Interest& interest);
87 
88  void
89  onKeyPrefixRegSuccess(const ndn::Name& name);
90 
91  void
92  registrationFailed(const ndn::Name& name);
93 
94 private:
95  typedef std::map<ndn::Name, ndn::security::Certificate> CertMap;
96  CertMap m_certificates;
97  ndn::Face& m_face;
98  ConfParameter& m_confParam;
99  Lsdb& m_lsdb;
100  ndn::security::ValidatorConfig& m_validator;
101  ndn::util::signal::ScopedConnection m_afterSegmentValidatedConnection;
102 };
103 
104 } // namespace security
105 } // namespace nlsr
106 
107 #endif // NLSR_CERTIFICATE_STORE_HPP
A class to house all the configuration parameters for NLSR.
Store certificates for names.
void insert(const ndn::security::Certificate &certificate)
const ndn::security::Certificate * find(const ndn::Name &keyName) const
Find a certificate.
void afterFetcherSignalEmitted(const ndn::Data &lsaSegment)
CertificateStore(ndn::Face &face, ConfParameter &confParam, Lsdb &lsdb)
void publishCertFromCache(const ndn::Name &keyName)
Retrieves the chain of certificates from Validator's cache and store them in Nlsr's own CertificateSt...
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California,...
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE