blob: c175863e5ff72faaff67eedaeefe69843a1e204a [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
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080011#include "../common.hpp"
Yingdi Yu3715f8d2014-01-30 00:32:20 -080012#include "../data.hpp"
13
14namespace ndn
15{
16
17class SecRule
18{
19public:
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
45protected:
46 bool m_isPositive;
47};
48
49bool
50SecRule::isPositive()
51{
52 return m_isPositive;
53}
54
55}
56
57#endif