Yingdi Yu | 3715f8d | 2014-01-30 00:32:20 -0800 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | #ifndef NDN_SEC_RULE_RELATIVE_HPP |
| 10 | #define NDN_SEC_RULE_RELATIVE_HPP |
| 11 | |
| 12 | #include "sec-rule.hpp" |
| 13 | #include "../util/regex.hpp" |
| 14 | |
| 15 | namespace ndn |
| 16 | { |
| 17 | |
| 18 | class SecRuleRelative : public SecRule |
| 19 | { |
| 20 | public: |
| 21 | struct Error : public SecRule::Error { Error(const std::string &what) : SecRule::Error(what) {} }; |
| 22 | |
| 23 | SecRuleRelative(const std::string& dataRegex, const std::string& signerRegex, const std::string& op, |
| 24 | const std::string& dataExpand, const std::string& signerExpand, bool isPositive); |
| 25 | |
| 26 | virtual |
| 27 | ~SecRuleRelative(); |
| 28 | |
| 29 | virtual bool |
| 30 | matchDataName(const Data& data); |
| 31 | |
| 32 | virtual bool |
| 33 | matchSignerName(const Data& data); |
| 34 | |
| 35 | virtual bool |
| 36 | satisfy(const Data& data); |
| 37 | |
| 38 | virtual bool |
| 39 | satisfy(const Name& dataName, const Name& signerName); |
| 40 | |
| 41 | private: |
| 42 | bool |
| 43 | compare(const Name& dataName, const Name& signerName); |
| 44 | |
| 45 | private: |
| 46 | const std::string m_dataRegex; |
| 47 | const std::string m_signerRegex; |
| 48 | const std::string m_op; |
| 49 | const std::string m_dataExpand; |
| 50 | const std::string m_signerExpand; |
| 51 | |
| 52 | Regex m_dataNameRegex; |
| 53 | Regex m_signerNameRegex; |
| 54 | }; |
| 55 | |
| 56 | }//ndn |
| 57 | |
| 58 | #endif |