NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
validation-policy-command-interest.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_VALIDATION_POLICY_COMMAND_INTEREST_HPP
23
#define NDN_SECURITY_V2_VALIDATION_POLICY_COMMAND_INTEREST_HPP
24
25
#include "
ndn-cxx/security/v2/validation-policy.hpp
"
26
27
#include <boost/multi_index_container.hpp>
28
#include <boost/multi_index/ordered_index.hpp>
29
#include <boost/multi_index/sequenced_index.hpp>
30
#include <boost/multi_index/key_extractors.hpp>
31
32
namespace
ndn
{
33
namespace
security {
34
namespace
v2 {
35
42
class
ValidationPolicyCommandInterest
:
public
ValidationPolicy
43
{
44
public
:
45
class
Options
46
{
47
public
:
48
Options
()
49
{
50
}
51
52
public
:
66
time::nanoseconds
gracePeriod
= 2_min;
67
83
ssize_t
maxRecords
= 1000;
84
92
time::nanoseconds
recordLifetime
= 1_h;
93
};
94
101
explicit
102
ValidationPolicyCommandInterest
(unique_ptr<ValidationPolicy> inner,
103
const
Options
& options = {});
104
105
protected
:
106
void
107
checkPolicy
(
const
Data
& data,
const
shared_ptr<ValidationState>& state,
108
const
ValidationContinuation
& continueValidation)
override
;
109
110
void
111
checkPolicy
(
const
Interest
& interest,
const
shared_ptr<ValidationState>& state,
112
const
ValidationContinuation
& continueValidation)
override
;
113
114
private
:
115
void
116
cleanup();
117
118
std::tuple<bool, Name, uint64_t>
119
parseCommandInterest(
const
Interest
& interest,
const
shared_ptr<ValidationState>& state)
const
;
120
121
bool
122
checkTimestamp(
const
shared_ptr<ValidationState>& state,
123
const
Name
& keyName, uint64_t timestamp);
124
125
void
126
insertNewRecord(
const
Name
& keyName, uint64_t timestamp);
127
128
private
:
129
Options m_options;
130
131
struct
LastTimestampRecord
132
{
133
Name
keyName;
134
uint64_t timestamp;
135
time::steady_clock::TimePoint
lastRefreshed;
136
};
137
138
using
Container = boost::multi_index_container<
139
LastTimestampRecord,
140
boost::multi_index::indexed_by<
141
boost::multi_index::ordered_unique<
142
boost::multi_index::member<LastTimestampRecord, Name, &LastTimestampRecord::keyName>
143
>,
144
boost::multi_index::sequenced<>
145
>
146
>;
147
using
Index = Container::nth_index<0>::type;
148
using
Queue = Container::nth_index<1>::type;
149
150
Container m_container;
151
Index& m_index;
152
Queue& m_queue;
153
};
154
155
}
// namespace v2
156
}
// namespace security
157
}
// namespace ndn
158
159
#endif // NDN_SECURITY_V2_VALIDATION_POLICY_COMMAND_INTEREST_HPP
ndn::security::v2::ValidationPolicyCommandInterest::Options::recordLifetime
time::nanoseconds recordLifetime
max lifetime of a last timestamp record
Definition:
validation-policy-command-interest.hpp:92
ndn::security::v2::ValidationPolicyCommandInterest::ValidationPolicyCommandInterest
ValidationPolicyCommandInterest(unique_ptr< ValidationPolicy > inner, const Options &options={})
constructor
Definition:
validation-policy-command-interest.cpp:28
ndn::security::v2::ValidationPolicyCommandInterest::checkPolicy
void checkPolicy(const Data &data, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Check data against the policy.
Definition:
validation-policy-command-interest.cpp:43
ndn::security::v2::ValidationPolicy::ValidationContinuation
std::function< void(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state)> ValidationContinuation
Definition:
validation-policy.hpp:41
validation-policy.hpp
ndn::security::v2::ValidationPolicyCommandInterest::Options::Options
Options()
Definition:
validation-policy-command-interest.hpp:48
ndn::security::v2::ValidationPolicy
Abstraction that implements validation policy for Data and Interest packets.
Definition:
validation-policy.hpp:38
ndn::security::v2::ValidationPolicyCommandInterest::Options::maxRecords
ssize_t maxRecords
max number of distinct public keys of which to record the last timestamp
Definition:
validation-policy-command-interest.hpp:83
ndn::Name
Represents an absolute name.
Definition:
name.hpp:44
ndn::security::v2::ValidationPolicyCommandInterest::Options::gracePeriod
time::nanoseconds gracePeriod
tolerance of initial timestamp
Definition:
validation-policy-command-interest.hpp:66
ndn::Interest
Represents an Interest packet.
Definition:
interest.hpp:44
ndn::Data
Represents a Data packet.
Definition:
data.hpp:36
ndn::time::steady_clock::TimePoint
time_point TimePoint
Definition:
time.hpp:225
ndn::security::v2::ValidationPolicyCommandInterest
Validation policy for stop-and-wait command Interests.
Definition:
validation-policy-command-interest.hpp:43
ndn::security::v2::ValidationPolicyCommandInterest::Options
Definition:
validation-policy-command-interest.hpp:46
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
validation-policy-command-interest.hpp
Generated on Mon Jun 1 2020 22:32:15 for ndnSIM by
1.8.18