NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
h
i
k
l
n
o
p
q
r
s
t
u
v
+
Enumerations
a
b
c
d
f
i
k
l
n
p
q
r
s
t
u
+
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
+
Enumerator
a
c
d
e
i
k
l
m
n
p
r
s
u
w
+
Related Functions
b
c
d
e
f
g
i
k
l
m
n
o
p
s
v
+
Files
File List
+
File Members
+
All
a
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
w
+
Functions
c
f
h
m
r
s
u
w
+
Variables
a
c
d
f
g
i
k
l
n
p
r
s
t
u
Typedefs
+
Macros
d
e
f
i
l
m
n
p
r
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
validation-policy-simple-hierarchy.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
validation-policy-simple-hierarchy.hpp
"
23
24
namespace
ndn
{
25
namespace
security {
26
namespace
v2 {
27
28
void
29
ValidationPolicySimpleHierarchy::checkPolicy
(
const
Data
& data,
const
shared_ptr<ValidationState>& state,
30
const
ValidationContinuation
& continueValidation)
31
{
32
Name
klName =
getKeyLocatorName
(data, *state);
33
if
(!state->getOutcome()) {
// already failed
34
return
;
35
}
36
37
if
(klName.
getPrefix
(-2).
isPrefixOf
(data.
getName
())) {
38
continueValidation(make_shared<CertificateRequest>(
Interest
(klName)), state);
39
}
40
else
{
41
state->fail({ValidationError::Code::INVALID_KEY_LOCATOR,
"Data signing policy violation for "
+
42
data.
getName
().
toUri
() +
" by "
+ klName.
toUri
()});
43
}
44
}
45
46
void
47
ValidationPolicySimpleHierarchy::checkPolicy
(
const
Interest
& interest,
const
shared_ptr<ValidationState>& state,
48
const
ValidationContinuation
& continueValidation)
49
{
50
Name
klName =
getKeyLocatorName
(interest, *state);
51
if
(!state->getOutcome()) {
// already failed
52
return
;
53
}
54
55
if
(klName.
getPrefix
(-2).
isPrefixOf
(interest.
getName
())) {
56
continueValidation(make_shared<CertificateRequest>(
Interest
(klName)), state);
57
}
58
else
{
59
state->fail({ValidationError::Code::INVALID_KEY_LOCATOR,
"Interest signing policy violation for "
+
60
interest.
getName
().
toUri
() +
" by "
+ klName.
toUri
()});
61
}
62
}
63
64
}
// namespace v2
65
}
// namespace security
66
}
// namespace ndn
ndn::Name::getPrefix
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix of the name.
Definition:
name.hpp:210
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::Name::toUri
std::string toUri() const
Get URI representation of the name.
Definition:
name.cpp:122
ndn::Data::getName
const Name & getName() const
Get name.
Definition:
data.hpp:121
validation-policy-simple-hierarchy.hpp
ndn::Name::isPrefixOf
bool isPrefixOf(const Name &other) const
Check if this name is a prefix of another name.
Definition:
name.cpp:260
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:42
ndn::security::v2::ValidationPolicySimpleHierarchy::checkPolicy
void checkPolicy(const Data &data, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Check data against the policy.
Definition:
validation-policy-simple-hierarchy.cpp:29
ndn::security::v2::ValidationPolicy::ValidationContinuation
std::function< void(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state)> ValidationContinuation
Definition:
validation-policy.hpp:41
ndn::security::v2::getKeyLocatorName
static Name getKeyLocatorName(const SignatureInfo &si, ValidationState &state)
Definition:
validation-policy.cpp:63
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
ndn::tlv::Interest
Definition:
tlv.hpp:64
ndn::Data
Represents a Data packet.
Definition:
data.hpp:35
ndn::Interest::getName
const Name & getName() const
Definition:
interest.hpp:139
ndnSIM
ndn-cxx
src
security
v2
validation-policy-simple-hierarchy.cpp
Generated on Sun Feb 25 2018 13:27:05 for ndnSIM by
1.8.14