blob: 278bbcde498a08a981f0301104574436439a918a [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
31 SecRuleSpecific(const SecRuleSpecific& rule);
32
33 virtual
34 ~SecRuleSpecific() {};
35
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070036 bool
37 matchDataName(const Data& data);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080038
39 bool
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070040 matchSignerName(const Data& data);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080041
42 bool
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070043 satisfy(const Data& data);
44
45 bool
46 satisfy(const Name& dataName, const Name& signerName);
47
Yingdi Yu3715f8d2014-01-30 00:32:20 -080048private:
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070049 shared_ptr<Regex> m_dataRegex;
50 shared_ptr<Regex> m_signerRegex;
Yingdi Yu3715f8d2014-01-30 00:32:20 -080051};
52
Yingdi Yufc40d872014-02-18 12:56:04 -080053} // namespace ndn
Yingdi Yu3715f8d2014-01-30 00:32:20 -080054
Yingdi Yufc40d872014-02-18 12:56:04 -080055#endif //NDN_SECURITY_SEC_RULE_SPECIFIC_H