All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
validator-config.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_VALIDATOR_CONFIG_HPP
24 #define NDN_VALIDATOR_CONFIG_HPP
25 
26 #include "v2/validation-policy-config.hpp"
27 #include "v2/certificate-fetcher-from-network.hpp"
28 #include "v2/validator.hpp"
29 
30 namespace ndn {
31 
36 class ValidatorConfig : public Validator {
37 public:
38  // TODO: Add Options.
39  // TODO: Add ValidationPolicyCommandInterest.
44  ValidatorConfig(const ptr_lib::shared_ptr<CertificateFetcher>& fetcher)
45  : Validator(ptr_lib::make_shared<ValidationPolicyConfig>(), fetcher),
46  // TODO: Use getInnerPolicy().
47  policyConfig_(dynamic_cast<ValidationPolicyConfig&>(getPolicy()))
48  {
49  }
50 
51  // TODO: Add Options.
52  // TODO: Add ValidationPolicyCommandInterest.
59  : Validator
60  (ptr_lib::make_shared<ValidationPolicyConfig>(),
61  ptr_lib::make_shared<CertificateFetcherFromNetwork>(face)),
62  // TODO: Use getInnerPolicy().
63  policyConfig_(dynamic_cast<ValidationPolicyConfig&>(getPolicy()))
64  {
65  }
66 
72  void
73  load(const std::string& filePath)
74  {
75  policyConfig_.load(filePath);
76  }
77 
85  void
86  load(const std::string& input, const std::string& inputName)
87  {
88  policyConfig_.load(input, inputName);
89  }
90 
98  void
99  load(const BoostInfoTree& configSection, const std::string& inputName)
100  {
101  policyConfig_.load(configSection, inputName);
102  }
103 
104 private:
105  ValidationPolicyConfig& policyConfig_;
106 };
107 
108 }
109 
110 #endif
ValidatorConfig extends Validator to implements a validator which can be set up via a configuration f...
Definition: validator-config.hpp:36
ValidatorConfig(const ptr_lib::shared_ptr< CertificateFetcher > &fetcher)
Create a ValidatorConfig to use the given certificate fetcher.
Definition: validator-config.hpp:44
The Face class provides the main methods for NDN communication.
Definition: face.hpp:86
BoostInfoTree is provided for compatibility with the Boost INFO property list format used in ndn-cxx...
Definition: boost-info-parser.hpp:46
void load(const BoostInfoTree &configSection, const std::string &inputName)
Load the configuration from the given configSection.
Definition: validator-config.hpp:99
The Validator class provides an interface for validating data and interest packets.
Definition: validator.hpp:55
void load(const std::string &filePath)
Load the configuration from the given config file.
CertificateFetcherFromNetwork extends CertificateFetcher to fetch missing certificates from the netwo...
Definition: certificate-fetcher-from-network.hpp:35
ValidationPolicy & getPolicy()
Get the ValidationPolicy given to the constructor.
Definition: validator.hpp:74
ValidatorConfig(Face &face)
Create a ValidatorConfig that uses a CertificateFetcherFromNetwork for the given Face.
Definition: validator-config.hpp:58
void load(const std::string &input, const std::string &inputName)
Load the configuration from the given input string.
Definition: validator-config.hpp:86
ValidationPolicyConfig implements a validator which can be set up via a configuration file...
Definition: validation-policy-config.hpp:42
void load(const std::string &filePath)
Load the configuration from the given config file.
Definition: validator-config.hpp:73