22 #ifndef NDN_CXX_SECURITY_VALIDATION_POLICY_SIGNED_INTEREST_HPP 23 #define NDN_CXX_SECURITY_VALIDATION_POLICY_SIGNED_INTEREST_HPP 27 #include <boost/multi_index_container.hpp> 28 #include <boost/multi_index/hashed_index.hpp> 29 #include <boost/multi_index/key_extractors.hpp> 30 #include <boost/multi_index/ordered_index.hpp> 31 #include <boost/multi_index/sequenced_index.hpp> 44 using SigNonce = std::vector<uint8_t>;
65 bool shouldValidateTimestamps =
true;
87 bool shouldValidateSeqNums =
false;
97 bool shouldValidateNonces =
true;
110 ssize_t maxNonceRecordCount = 1000;
132 ssize_t maxRecordCount = 1000;
145 checkPolicy(
const Data& data,
const shared_ptr<ValidationState>& state,
154 checkIncomingInterest(
const shared_ptr<ValidationState>& state,
const Interest& interest);
157 insertRecord(
const Name& keyName,
158 optional<time::system_clock::TimePoint> timestamp,
159 optional<uint64_t> seqNum,
160 optional<SigNonce> nonce);
165 using NonceContainer = boost::multi_index_container<
167 boost::multi_index::indexed_by<
168 boost::multi_index::hashed_unique<
169 boost::multi_index::tag<NonceSet>,
170 boost::multi_index::identity<SigNonce>
172 boost::multi_index::sequenced<
173 boost::multi_index::tag<NonceList>
178 struct LastInterestRecord
180 LastInterestRecord(
const Name& keyName,
181 optional<time::system_clock::TimePoint> timestamp,
182 optional<uint64_t> seqNum)
184 , timestamp(timestamp)
191 optional<time::system_clock::TimePoint> timestamp;
192 optional<uint64_t> seqNum;
193 NonceContainer observedNonces;
197 using Container = boost::multi_index_container<
199 boost::multi_index::indexed_by<
200 boost::multi_index::ordered_unique<
201 boost::multi_index::member<LastInterestRecord, Name, &LastInterestRecord::keyName>
203 boost::multi_index::ordered_non_unique<
205 &LastInterestRecord::lastRefreshed>
210 Container m_container;
211 Container::nth_index<0>::type& m_byKeyName;
212 Container::nth_index<1>::type& m_byLastRefreshed;
219 #endif // NDN_CXX_SECURITY_VALIDATION_POLICY_SIGNED_INTEREST_HPP
Copyright (c) 2011-2015 Regents of the University of California.
static time_point now() noexcept
void checkPolicy(const Data &data, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Check data against the policy.
Represents an Interest packet.
Abstraction that implements validation policy for Data and Interest packets.
Validation policy for signed Interests.
std::function< void(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state)> ValidationContinuation
ValidationPolicySignedInterest(unique_ptr< ValidationPolicy > inner, const Options &options={})
Constructor.
Represents an absolute name.
Represents a Data packet.
boost::chrono::nanoseconds nanoseconds