ndn-cxx: NDN C++ Library 0.9.0-33-g832ea91d
Loading...
Searching...
No Matches
validator-config.cpp
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013-2023 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
24
25namespace ndn::security {
26
27ValidatorConfig::ValidatorConfig(std::unique_ptr<CertificateFetcher> fetcher,
28 const CommandInterestOptions& ciOptions,
29 const SignedInterestOptions& siOptions)
32 make_unique<ValidationPolicyConfig>(),
33 ciOptions),
34 siOptions),
35 std::move(fetcher))
36 , m_policyConfig(static_cast<ValidationPolicyConfig&>(getPolicy().getInnerPolicy().getInnerPolicy()))
37{
38}
39
41 const CommandInterestOptions& ciOptions,
42 const SignedInterestOptions& siOptions)
43 : ValidatorConfig(make_unique<CertificateFetcherFromNetwork>(face), ciOptions, siOptions)
44{
45}
46
47void
48ValidatorConfig::load(const std::string& filename)
49{
50 m_policyConfig.load(filename);
51}
52
53void
54ValidatorConfig::load(const std::string& input, const std::string& filename)
55{
56 m_policyConfig.load(input, filename);
57}
58
59void
60ValidatorConfig::load(std::istream& input, const std::string& filename)
61{
62 m_policyConfig.load(input, filename);
63}
64
65void
67 const std::string& filename)
68{
69 m_policyConfig.load(configSection, filename);
70}
71
72} // namespace ndn::security
Provide a communication channel with local or remote NDN forwarder.
Definition face.hpp:91
Validation policy for stop-and-wait command Interests.
Helper for validator that uses SignedInterest + CommandInterest + Config policy and NetworkFetcher.
ValidatorConfig(std::unique_ptr< CertificateFetcher > fetcher, const CommandInterestOptions &ciOptions={}, const SignedInterestOptions &siOptions={})
void load(const std::string &filename)
Interface for validating data and interest packets.
Definition validator.hpp:61
A validator that can be set up via a configuration file.
void load(const std::string &filename)
Load policy from file filename.
boost::property_tree::ptree ConfigSection
Definition common.hpp:33
Contains the ndn-cxx security framework.
STL namespace.