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_HPP |
| 9 | #define NDN_SECURITY_SEC_RULE_HPP |
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 "../data.hpp" |
| 13 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame] | 14 | namespace ndn { |
Yingdi Yu | 3715f8d | 2014-01-30 00:32:20 -0800 | [diff] [blame] | 15 | |
| 16 | class SecRule |
| 17 | { |
| 18 | public: |
| 19 | struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} }; |
| 20 | |
| 21 | SecRule(bool isPositive) |
| 22 | : m_isPositive(isPositive) |
| 23 | {} |
| 24 | |
| 25 | virtual |
| 26 | ~SecRule() |
| 27 | {} |
| 28 | |
| 29 | virtual bool |
| 30 | matchDataName(const Data& data) = 0; |
| 31 | |
| 32 | virtual bool |
| 33 | matchSignerName(const Data& data) = 0; |
| 34 | |
| 35 | virtual bool |
| 36 | satisfy(const Data& data) = 0; |
| 37 | |
| 38 | virtual bool |
| 39 | satisfy(const Name& dataName, const Name& signerName) = 0; |
| 40 | |
| 41 | inline bool |
| 42 | isPositive(); |
| 43 | |
| 44 | protected: |
| 45 | bool m_isPositive; |
| 46 | }; |
| 47 | |
| 48 | bool |
| 49 | SecRule::isPositive() |
| 50 | { |
| 51 | return m_isPositive; |
| 52 | } |
| 53 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame] | 54 | } // namespace ndn |
Yingdi Yu | 3715f8d | 2014-01-30 00:32:20 -0800 | [diff] [blame] | 55 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame] | 56 | #endif //NDN_SECURITY_SEC_RULE_HPP |