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 | #ifndef NDN_SEC_RULE_HPP |
| 9 | #define NDN_SEC_RULE_HPP |
| 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 | |
| 14 | namespace ndn |
| 15 | { |
| 16 | |
| 17 | class SecRule |
| 18 | { |
| 19 | public: |
| 20 | struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} }; |
| 21 | |
| 22 | SecRule(bool isPositive) |
| 23 | : m_isPositive(isPositive) |
| 24 | {} |
| 25 | |
| 26 | virtual |
| 27 | ~SecRule() |
| 28 | {} |
| 29 | |
| 30 | virtual bool |
| 31 | matchDataName(const Data& data) = 0; |
| 32 | |
| 33 | virtual bool |
| 34 | matchSignerName(const Data& data) = 0; |
| 35 | |
| 36 | virtual bool |
| 37 | satisfy(const Data& data) = 0; |
| 38 | |
| 39 | virtual bool |
| 40 | satisfy(const Name& dataName, const Name& signerName) = 0; |
| 41 | |
| 42 | inline bool |
| 43 | isPositive(); |
| 44 | |
| 45 | protected: |
| 46 | bool m_isPositive; |
| 47 | }; |
| 48 | |
| 49 | bool |
| 50 | SecRule::isPositive() |
| 51 | { |
| 52 | return m_isPositive; |
| 53 | } |
| 54 | |
| 55 | } |
| 56 | |
| 57 | #endif |