blob: 3103f3b75269fe5c8070d52477105999eadb525a [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_SPECIFIC_H
9#define NDN_SECURITY_SEC_RULE_SPECIFIC_H
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 "sec-rule.hpp"
13#include "../util/regex.hpp"
14
Yingdi Yufc40d872014-02-18 12:56:04 -080015namespace ndn {
Yingdi Yu3715f8d2014-01-30 00:32:20 -080016
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070017class SecRuleSpecific : public SecRule
Yingdi Yu3715f8d2014-01-30 00:32:20 -080018{
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070019
Yingdi Yu3715f8d2014-01-30 00:32:20 -080020public:
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070021 SecRuleSpecific(shared_ptr<Regex> dataRegex,
22 shared_ptr<Regex> signerRegex);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080023
24 SecRuleSpecific(const SecRuleSpecific& rule);
25
26 virtual
27 ~SecRuleSpecific() {};
28
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070029 bool
30 matchDataName(const Data& data);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080031
32 bool
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070033 matchSignerName(const Data& data);
Yingdi Yu3715f8d2014-01-30 00:32:20 -080034
35 bool
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070036 satisfy(const Data& data);
37
38 bool
39 satisfy(const Name& dataName, const Name& signerName);
40
Yingdi Yu3715f8d2014-01-30 00:32:20 -080041private:
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070042 shared_ptr<Regex> m_dataRegex;
43 shared_ptr<Regex> m_signerRegex;
Yingdi Yu3715f8d2014-01-30 00:32:20 -080044};
45
Yingdi Yufc40d872014-02-18 12:56:04 -080046} // namespace ndn
Yingdi Yu3715f8d2014-01-30 00:32:20 -080047
Yingdi Yufc40d872014-02-18 12:56:04 -080048#endif //NDN_SECURITY_SEC_RULE_SPECIFIC_H