NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
checker.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2018 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_SECURITY_V2_VALIDATOR_CONFIG_CHECKER_HPP
23
#define NDN_SECURITY_V2_VALIDATOR_CONFIG_CHECKER_HPP
24
25
#include "
ndn-cxx/name.hpp
"
26
#include "
ndn-cxx/security/v2/validator-config/common.hpp
"
27
#include "
ndn-cxx/security/v2/validator-config/name-relation.hpp
"
28
#include "
ndn-cxx/util/regex.hpp
"
29
30
namespace
ndn
{
31
namespace
security {
32
namespace
v2 {
33
34
class
ValidationState
;
35
36
namespace
validator_config {
37
38
class
Checker
: noncopyable
39
{
40
public
:
41
virtual
42
~Checker
() =
default
;
43
55
bool
56
check
(uint32_t pktType,
const
Name
& pktName,
const
Name
& klName,
const
shared_ptr<ValidationState>& state);
57
65
static
unique_ptr<Checker>
66
create
(
const
ConfigSection
& configSection,
const
std::string& configFilename);
67
68
private
:
69
static
unique_ptr<Checker>
70
createCustomizedChecker(
const
ConfigSection
& configSection,
const
std::string& configFilename);
71
72
static
unique_ptr<Checker>
73
createHierarchicalChecker(
const
ConfigSection
& configSection,
const
std::string& configFilename);
74
75
static
unique_ptr<Checker>
76
createKeyLocatorChecker(
const
ConfigSection
& configSection,
const
std::string& configFilename);
77
78
static
unique_ptr<Checker>
79
createKeyLocatorNameChecker(
const
ConfigSection
& configSection,
const
std::string& configFilename);
80
81
protected
:
82
virtual
bool
83
checkNames
(
const
Name
& pktName,
const
Name
& klName,
const
shared_ptr<ValidationState>& state) = 0;
84
};
85
86
class
NameRelationChecker
:
public
Checker
87
{
88
public
:
89
NameRelationChecker
(
const
Name
&
name
,
const
NameRelation
& relation);
90
91
protected
:
92
bool
93
checkNames
(
const
Name
& pktName,
const
Name
& klName,
const
shared_ptr<ValidationState>& state)
override
;
94
95
private
:
96
Name
m_name;
97
NameRelation
m_relation;
98
};
99
100
class
RegexChecker
:
public
Checker
101
{
102
public
:
103
explicit
104
RegexChecker
(
const
Regex
& regex);
105
106
protected
:
107
bool
108
checkNames
(
const
Name
& pktName,
const
Name
& klName,
const
shared_ptr<ValidationState>& state)
override
;
109
110
private
:
111
Regex
m_regex;
112
};
113
114
class
HyperRelationChecker
:
public
Checker
115
{
116
public
:
117
HyperRelationChecker
(
const
std::string& pktNameExpr,
const
std::string pktNameExpand,
118
const
std::string& klNameExpr,
const
std::string klNameExpand,
119
const
NameRelation
& hyperRelation);
120
121
protected
:
122
bool
123
checkNames
(
const
Name
& pktName,
const
Name
& klName,
const
shared_ptr<ValidationState>& state)
override
;
124
125
private
:
126
Regex
m_hyperPRegex;
127
Regex
m_hyperKRegex;
128
NameRelation
m_hyperRelation;
129
};
130
131
}
// namespace validator_config
132
}
// namespace v2
133
}
// namespace security
134
}
// namespace ndn
135
136
#endif // NDN_SECURITY_V2_VALIDATOR_CONFIG_CHECKER_HPP
ndn::security::v2::validator_config::Checker::checkNames
virtual bool checkNames(const Name &pktName, const Name &klName, const shared_ptr< ValidationState > &state)=0
ndn::security::v2::validator_config::HyperRelationChecker::HyperRelationChecker
HyperRelationChecker(const std::string &pktNameExpr, const std::string pktNameExpand, const std::string &klNameExpr, const std::string klNameExpand, const NameRelation &hyperRelation)
Definition:
checker.cpp:92
ndn::RegexTopMatcher
Definition:
regex-top-matcher.hpp:35
name.hpp
ndn::security::v2::validator_config::RegexChecker::RegexChecker
RegexChecker(const Regex ®ex)
Definition:
checker.cpp:74
ndn::security::v2::validator_config::Checker
Definition:
checker.hpp:39
ndn::Name
Represents an absolute name.
Definition:
name.hpp:44
common.hpp
ndn::security::v2::validator_config::Checker::~Checker
virtual ~Checker()=default
ndn::security::v2::ValidationState
ndn security v2 ValidationState
Definition:
validation-state.cpp:31
name-relation.hpp
regex.hpp
ndn::security::v2::validator_config::NameRelation
NameRelation
Definition:
name-relation.hpp:33
ndn::security::v2::validator_config::RegexChecker
Definition:
checker.hpp:101
ndn::security::v2::validator_config::Checker::check
bool check(uint32_t pktType, const Name &pktName, const Name &klName, const shared_ptr< ValidationState > &state)
Check if packet name ane KeyLocator satisfy the checker's conditions.
Definition:
checker.cpp:35
ndn::security::v2::validator_config::NameRelationChecker::NameRelationChecker
NameRelationChecker(const Name &name, const NameRelation &relation)
Definition:
checker.cpp:51
ndn::security::v2::validator_config::Checker::create
static unique_ptr< Checker > create(const ConfigSection &configSection, const std::string &configFilename)
create a checker from configuration section
Definition:
checker.cpp:125
ndn::name
Definition:
name-component-types.hpp:33
ndn::security::v2::validator_config::HyperRelationChecker
Definition:
checker.hpp:115
ndn::security::v2::validator_config::NameRelationChecker
Definition:
checker.hpp:87
ndn::security::v2::validator_config::NameRelationChecker::checkNames
bool checkNames(const Name &pktName, const Name &klName, const shared_ptr< ValidationState > &state) override
Definition:
checker.cpp:58
ndn::security::v2::validator_config::RegexChecker::checkNames
bool checkNames(const Name &pktName, const Name &klName, const shared_ptr< ValidationState > &state) override
Definition:
checker.cpp:80
ndn::security::v2::validator_config::HyperRelationChecker::checkNames
bool checkNames(const Name &pktName, const Name &klName, const shared_ptr< ValidationState > &state) override
Definition:
checker.cpp:102
ndn::security::v2::validator_config::ConfigSection
boost::property_tree::ptree ConfigSection
Definition:
common.hpp:36
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndnSIM
ndn-cxx
ndn-cxx
security
v2
validator-config
checker.hpp
Generated on Mon Jun 1 2020 22:32:15 for ndnSIM by
1.8.18