blob: 496b33d506d20c5ac38cc658989d65317a2844af [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
Yingdi Yufc40d872014-02-18 12:56:04 -08008#ifndef NDN_SECURITY_SEC_RULE_HPP
9#define NDN_SECURITY_SEC_RULE_HPP
Yingdi Yu3715f8d2014-01-30 00:32:20 -080010
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080011#include "../common.hpp"
Yingdi Yu3715f8d2014-01-30 00:32:20 -080012#include "../data.hpp"
13
Yingdi Yufc40d872014-02-18 12:56:04 -080014namespace ndn {
Yingdi Yu3715f8d2014-01-30 00:32:20 -080015
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
Yingdi Yufc40d872014-02-18 12:56:04 -080054} // namespace ndn
Yingdi Yu3715f8d2014-01-30 00:32:20 -080055
Yingdi Yufc40d872014-02-18 12:56:04 -080056#endif //NDN_SECURITY_SEC_RULE_HPP