blob: a7bf83361c66834b970a4f9541eec1e3572ea223 [file] [log] [blame]
Yingdi Yu3715f8d2014-01-30 00:32:20 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07003 * Copyright (c) 2013-2014, Regents of the University of California.
4 * All rights reserved.
5 *
6 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
7 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
8 *
9 * This file licensed under New BSD License. See COPYING for detailed information about
10 * ndn-cxx library copyright, permissions, and redistribution restrictions.
11 *
12 * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
Yingdi Yu3715f8d2014-01-30 00:32:20 -080013 */
14
Yingdi Yufc40d872014-02-18 12:56:04 -080015#ifndef NDN_SECURITY_SEC_RULE_SPECIFIC_H
16#define NDN_SECURITY_SEC_RULE_SPECIFIC_H
Yingdi Yu3715f8d2014-01-30 00:32:20 -080017
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080018#include "../common.hpp"
Yingdi Yu3715f8d2014-01-30 00:32:20 -080019#include "sec-rule.hpp"
20#include "../util/regex.hpp"
21
Yingdi Yufc40d872014-02-18 12:56:04 -080022namespace ndn {
Yingdi Yu3715f8d2014-01-30 00:32:20 -080023
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070024class SecRuleSpecific : public SecRule
Yingdi Yu3715f8d2014-01-30 00:32:20 -080025{
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070026
Yingdi Yu3715f8d2014-01-30 00:32:20 -080027public:
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070028 SecRuleSpecific(shared_ptr<Regex> dataRegex,
29 shared_ptr<Regex> signerRegex);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080030
Yingdi Yu0fc447c2014-04-29 19:38:32 -070031 SecRuleSpecific(shared_ptr<Regex> dataRegex);
32
Yingdi Yu3715f8d2014-01-30 00:32:20 -080033 SecRuleSpecific(const SecRuleSpecific& rule);
34
35 virtual
36 ~SecRuleSpecific() {};
37
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070038 bool
39 matchDataName(const Data& data);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080040
41 bool
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070042 matchSignerName(const Data& data);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080043
44 bool
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070045 satisfy(const Data& data);
46
47 bool
48 satisfy(const Name& dataName, const Name& signerName);
49
Yingdi Yu0fc447c2014-04-29 19:38:32 -070050 bool
51 isExempted() const
52 {
53 return m_isExempted;
54 }
55
Yingdi Yu3715f8d2014-01-30 00:32:20 -080056private:
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070057 shared_ptr<Regex> m_dataRegex;
58 shared_ptr<Regex> m_signerRegex;
Yingdi Yu0fc447c2014-04-29 19:38:32 -070059 bool m_isExempted;
Yingdi Yu3715f8d2014-01-30 00:32:20 -080060};
61
Yingdi Yufc40d872014-02-18 12:56:04 -080062} // namespace ndn
Yingdi Yu3715f8d2014-01-30 00:32:20 -080063
Yingdi Yufc40d872014-02-18 12:56:04 -080064#endif //NDN_SECURITY_SEC_RULE_SPECIFIC_H