31   , m_index(m_container.get<0>())
 
   32   , m_queue(m_container.get<1>())
 
   34   if (inner == 
nullptr) {
 
   35     NDN_THROW(std::invalid_argument(
"inner policy is missing"));
 
   56   std::tie(isOk, keyName, timestamp) = parseCommandInterest(interest, state);
 
   61   if (!checkTimestamp(state, keyName, timestamp)) {
 
   68 ValidationPolicyCommandInterest::cleanup()
 
   72   while ((!m_queue.empty() && m_queue.front().lastRefreshed <= expiring) ||
 
   74           m_queue.size() > 
static_cast<size_t>(m_options.
maxRecords))) {
 
   79 std::tuple<bool, Name, time::system_clock::TimePoint>
 
   80 ValidationPolicyCommandInterest::parseCommandInterest(
const Interest& interest,
 
   81                                                       const shared_ptr<ValidationState>& state)
 const 
   94     if (!optionalTimestamp) {
 
   96                    interest.
getName().toUri() + 
"` doesn't include required SignatureTime element"});
 
   99     timestamp = *optionalTimestamp;
 
  105                    interest.
getName().toUri() + 
"` is too short"});
 
  110     if (!timestampComp.isNumber()) {
 
  112                    interest.
getName().toUri() + 
"` doesn't include timestamp component"});
 
  119   if (!state->getOutcome()) { 
 
  123   return std::make_tuple(
true, klName, timestamp);
 
  127 ValidationPolicyCommandInterest::checkTimestamp(
const shared_ptr<ValidationState>& state,
 
  134   if (timestamp < now - m_options.gracePeriod || timestamp > now + m_options.
gracePeriod) {
 
  136                  "Timestamp is outside the grace period for key " + keyName.toUri()});
 
  140   auto it = m_index.find(keyName);
 
  141   if (it != m_index.end()) {
 
  142     if (timestamp <= it->timestamp) {
 
  144                    "Timestamp is reordered for key " + keyName.toUri()});
 
  149   auto interestState = dynamic_pointer_cast<InterestValidationState>(state);
 
  150   BOOST_ASSERT(interestState != 
nullptr);
 
  151   interestState->afterSuccess.connect([=] (
const Interest&) { insertNewRecord(keyName, timestamp); });
 
  160   auto i = m_queue.end();
 
  162   LastTimestampRecord newRecord{keyName, timestamp, now};
 
  163   std::tie(i, isNew) = m_queue.push_back(newRecord);
 
  166     BOOST_ASSERT(i->keyName == keyName);
 
  170     isNew = m_queue.push_back(newRecord).second;
 
Represents a Data packet.
 
Represents an Interest packet.
 
const Name & getName() const noexcept
 
optional< SignatureInfo > getSignatureInfo() const
Get the InterestSignatureInfo.
 
Represents an absolute name.
 
const Component & at(ssize_t i) const
Returns an immutable reference to the component at the specified index, with bounds checking.
 
time::nanoseconds recordLifetime
max lifetime of a last timestamp record
 
ssize_t maxRecords
max number of distinct public keys of which to record the last timestamp
 
time::nanoseconds gracePeriod
tolerance of initial timestamp
 
void checkPolicy(const Data &data, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
Check data against the policy.
 
ValidationPolicyCommandInterest(unique_ptr< ValidationPolicy > inner, const Options &options={})
constructor
 
ValidationPolicy & getInnerPolicy()
Return the inner policy.
 
std::function< void(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state)> ValidationContinuation
 
virtual void checkPolicy(const Data &data, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)=0
Check data against the policy.
 
void setInnerPolicy(unique_ptr< ValidationPolicy > innerPolicy)
Set inner policy.
 
static time_point now() noexcept
 
static time_point now() noexcept
 
const size_t MIN_SIZE
minimal number of components for Command Interest
 
const ssize_t POS_TIMESTAMP
 
SimpleTag< SignedInterestFormat, 1002 > SignedInterestFormatTag
 
Name getKeyLocatorName(const Data &data, ValidationState &state)
extract KeyLocator.Name from a Data packet
 
@ V03
Sign Interest using Packet Specification v0.3 semantics.
 
boost::chrono::milliseconds milliseconds
 
system_clock::time_point fromUnixTimestamp(milliseconds duration)
Convert UNIX timestamp to system_clock::time_point.