blob: 1e2dbd0ef28d872647ee8c8a80bd5dedf766bb86 [file] [log] [blame]
Yingdi Yu3715f8d2014-01-30 00:32:20 -08001/* -*- 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
11#include "../data.hpp"
12
13namespace ndn
14{
15
16class SecRule
17{
18public:
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
44protected:
45 bool m_isPositive;
46};
47
48bool
49SecRule::isPositive()
50{
51 return m_isPositive;
52}
53
54}
55
56#endif