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 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame^] | 8 | #ifndef NDN_SECURITY_SEC_RULE_SPECIFIC_H |
| 9 | #define NDN_SECURITY_SEC_RULE_SPECIFIC_H |
Yingdi Yu | 3715f8d | 2014-01-30 00:32:20 -0800 | [diff] [blame] | 10 | |
Alexander Afanasyev | e2dcdfd | 2014-02-07 15:53:28 -0800 | [diff] [blame] | 11 | #include "../common.hpp" |
Yingdi Yu | 3715f8d | 2014-01-30 00:32:20 -0800 | [diff] [blame] | 12 | #include "sec-rule.hpp" |
| 13 | #include "../util/regex.hpp" |
| 14 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame^] | 15 | namespace ndn { |
Yingdi Yu | 3715f8d | 2014-01-30 00:32:20 -0800 | [diff] [blame] | 16 | |
| 17 | class SecRuleSpecific : public ndn::SecRule |
| 18 | { |
| 19 | |
| 20 | public: |
| 21 | SecRuleSpecific(ndn::shared_ptr<ndn::Regex> dataRegex, |
| 22 | ndn::shared_ptr<ndn::Regex> signerRegex); |
| 23 | |
| 24 | SecRuleSpecific(const SecRuleSpecific& rule); |
| 25 | |
| 26 | virtual |
| 27 | ~SecRuleSpecific() {}; |
| 28 | |
| 29 | bool |
| 30 | matchDataName(const ndn::Data& data); |
| 31 | |
| 32 | bool |
| 33 | matchSignerName(const ndn::Data& data); |
| 34 | |
| 35 | bool |
| 36 | satisfy(const ndn::Data& data); |
| 37 | |
| 38 | bool |
| 39 | satisfy(const ndn::Name& dataName, const ndn::Name& signerName); |
| 40 | |
| 41 | private: |
| 42 | ndn::shared_ptr<ndn::Regex> m_dataRegex; |
| 43 | ndn::shared_ptr<ndn::Regex> m_signerRegex; |
| 44 | }; |
| 45 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame^] | 46 | } // namespace ndn |
Yingdi Yu | 3715f8d | 2014-01-30 00:32:20 -0800 | [diff] [blame] | 47 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame^] | 48 | #endif //NDN_SECURITY_SEC_RULE_SPECIFIC_H |