All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sec-rule-relative.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
9 #ifndef NDN_SECURITY_SEC_RULE_RELATIVE_HPP
10 #define NDN_SECURITY_SEC_RULE_RELATIVE_HPP
11 
12 #include "sec-rule.hpp"
13 #include "../util/regex.hpp"
14 
15 namespace ndn {
16 
17 class SecRuleRelative : public SecRule
18 {
19 public:
20  class Error : public SecRule::Error
21  {
22  public:
23  explicit
24  Error(const std::string& what)
25  : SecRule::Error(what)
26  {
27  }
28  };
29 
30  SecRuleRelative(const std::string& dataRegex, const std::string& signerRegex,
31  const std::string& op,
32  const std::string& dataExpand, const std::string& signerExpand,
33  bool isPositive);
34 
35  virtual
37 
38  virtual bool
39  matchDataName(const Data& data);
40 
41  virtual bool
42  matchSignerName(const Data& data);
43 
44  virtual bool
45  satisfy(const Data& data);
46 
47  virtual bool
48  satisfy(const Name& dataName, const Name& signerName);
49 
50 private:
51  bool
52  compare(const Name& dataName, const Name& signerName);
53 
54 private:
55  const std::string m_dataRegex;
56  const std::string m_signerRegex;
57  const std::string m_op;
58  const std::string m_dataExpand;
59  const std::string m_signerExpand;
60 
61  Regex m_dataNameRegex;
62  Regex m_signerNameRegex;
63 };
64 
65 } // namespace ndn
66 
67 #endif //NDN_SECURITY_SEC_RULE_RELATIVE_HPP
Error(const std::string &what)
bool isPositive()
Definition: sec-rule.hpp:59
virtual bool matchSignerName(const Data &data)
SecRuleRelative(const std::string &dataRegex, const std::string &signerRegex, const std::string &op, const std::string &dataExpand, const std::string &signerExpand, bool isPositive)
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:26
virtual bool matchDataName(const Data &data)
virtual bool satisfy(const Data &data)