All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
validation-policy-config.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_VALIDATION_POLICY_CONFIG_HPP
24 #define NDN_VALIDATION_POLICY_CONFIG_HPP
25 
26 #include "validation-policy.hpp"
27 #include "validator-config/config-rule.hpp"
28 
29 namespace ndn {
30 
31 class BoostInfoTree;
32 
43 public:
48  : shouldBypass_(false),
49  isConfigured_(false)
50  {
51  }
52 
58  void
59  load(const std::string& filePath);
60 
68  void
69  load(const std::string& input, const std::string& inputName);
70 
78  void
79  load(const BoostInfoTree& configSection, const std::string& inputName);
80 
81  virtual void
83  (const Data& data, const ptr_lib::shared_ptr<ValidationState>& state,
84  const ValidationContinuation& continueValidation);
85 
86  virtual void
88  (const Interest& interest, const ptr_lib::shared_ptr<ValidationState>& state,
89  const ValidationContinuation& continueValidation);
90 
91 private:
99  void
100  processConfigTrustAnchor
101  (const BoostInfoTree& configSection, const std::string& inputName);
102 
110  static Milliseconds
111  getRefreshPeriod(const BoostInfoTree& configSection);
112 
116  bool shouldBypass_;
117  bool isConfigured_;
118  std::vector<ptr_lib::shared_ptr<ConfigRule>> dataRules_;
119  std::vector<ptr_lib::shared_ptr<ConfigRule>> interestRules_;
120 };
121 
122 }
123 
124 #endif
double Milliseconds
A time interval represented as the number of milliseconds.
Definition: common.hpp:114
Definition: data.hpp:37
ValidationPolicy is an abstract base class that implements a validation policy for Data and Interest ...
Definition: validation-policy.hpp:41
BoostInfoTree is provided for compatibility with the Boost INFO property list format used in ndn-cxx...
Definition: boost-info-parser.hpp:46
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:43
void load(const std::string &filePath)
Load the configuration from the given config file.
ValidationPolicyConfig()
Create a default ValidationPolicyConfig.
Definition: validation-policy-config.hpp:47
ValidationPolicyConfig implements a validator which can be set up via a configuration file...
Definition: validation-policy-config.hpp:42
virtual void checkPolicy(const Data &data, const ptr_lib::shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Check the Data packet against the policy.