ndn::security::ValidationPolicyCommandInterest Class Reference

Validation policy for stop-and-wait command Interests. More...

#include <ndn-cxx/security/validation-policy-command-interest.hpp>

+ Inheritance diagram for ndn::security::ValidationPolicyCommandInterest:
+ Collaboration diagram for ndn::security::ValidationPolicyCommandInterest:

Classes

class  Options
 

Public Types

using ValidationContinuation = std::function< void(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state)>
 

Public Member Functions

 ValidationPolicyCommandInterest (unique_ptr< ValidationPolicy > inner, const Options &options={})
 Constructor. More...
 
virtual void checkPolicy (const Certificate &certificate, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
 Check certificate against the policy. More...
 
ValidationPolicygetInnerPolicy ()
 Return the inner policy. More...
 
bool hasInnerPolicy () const
 Check if inner policy is set. More...
 
void setInnerPolicy (unique_ptr< ValidationPolicy > innerPolicy)
 Set inner policy. More...
 
void setValidator (Validator &validator)
 Set validator to which the policy is associated. More...
 

Protected Member Functions

void checkPolicy (const Data &data, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
 Check data against the policy. More...
 
void checkPolicy (const Interest &interest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override
 Check interest against the policy. More...
 

Protected Attributes

unique_ptr< ValidationPolicym_innerPolicy
 
Validatorm_validator = nullptr
 

Detailed Description

Validation policy for stop-and-wait command Interests.

This policy checks the timestamp field of a stop-and-wait command Interest. Signed Interest validation and Data validation requests are delegated to an inner policy.

See also
https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest

Definition at line 42 of file validation-policy-command-interest.hpp.

Member Typedef Documentation

◆ ValidationContinuation

using ndn::security::ValidationPolicy::ValidationContinuation = std::function<void(const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state)>
inherited

Definition at line 38 of file validation-policy.hpp.

Constructor & Destructor Documentation

◆ ValidationPolicyCommandInterest()

ndn::security::ValidationPolicyCommandInterest::ValidationPolicyCommandInterest ( unique_ptr< ValidationPolicy inner,
const Options options = {} 
)
explicit

Constructor.

Parameters
innera Validator for signed Interest signature validation and Data validation; this must not be nullptr
optionsstop-and-wait command Interest validation options
Exceptions
std::invalid_argumentinner policy is nullptr

Definition at line 26 of file validation-policy-command-interest.cpp.

Member Function Documentation

◆ checkPolicy() [1/3]

virtual void ndn::security::ValidationPolicy::checkPolicy ( const Certificate certificate,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
inlinevirtualinherited

Check certificate against the policy.

Unless overridden by the policy, this check defaults to checkPolicy(const Data&, ...).

Depending on implementation of the policy, this check can be done synchronously or asynchronously.

Semantics of checkPolicy has changed from v1::Validator

  • If packet violates policy, the policy should call state->fail with appropriate error code and error description.
  • If packet conforms to the policy and no further certificate retrievals are necessary, the policy should call continueValidation(nullptr, state)
  • If packet conforms to the policy and a certificate needs to be fetched, the policy should call continueValidation(<appropriate-cert-request-instance>, state)

Definition at line 137 of file validation-policy.hpp.

◆ checkPolicy() [2/3]

void ndn::security::ValidationPolicyCommandInterest::checkPolicy ( const Data data,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
overrideprotectedvirtual

Check data against the policy.

Depending on implementation of the policy, this check can be done synchronously or asynchronously.

Semantics of checkPolicy has changed from v1::Validator

  • If packet violates policy, the policy should call state->fail with appropriate error code and error description.
  • If packet conforms to the policy and no further certificate retrievals are necessary, the policy should call continueValidation(nullptr, state)
  • If packet conforms to the policy and a certificate needs to be fetched, the policy should call continueValidation(<appropriate-cert-request-instance>, state)

Implements ndn::security::ValidationPolicy.

Definition at line 41 of file validation-policy-command-interest.cpp.

◆ checkPolicy() [3/3]

void ndn::security::ValidationPolicyCommandInterest::checkPolicy ( const Interest interest,
const shared_ptr< ValidationState > &  state,
const ValidationContinuation continueValidation 
)
overrideprotectedvirtual

Check interest against the policy.

Depending on implementation of the policy, this check can be done synchronously or asynchronously.

Semantics of checkPolicy has changed from v1::Validator

  • If packet violates policy, the policy should call state->fail with appropriate error code and error description.
  • If packet conforms to the policy and no further certificate retrievals are necessary, the policy should call continueValidation(nullptr, state)
  • If packet conforms to the policy and a certificate needs to be fetched, the policy should call continueValidation(<appropriate-cert-request-instance>, state)

Implements ndn::security::ValidationPolicy.

Definition at line 48 of file validation-policy-command-interest.cpp.

◆ getInnerPolicy()

ValidationPolicy & ndn::security::ValidationPolicy::getInnerPolicy ( )
inherited

Return the inner policy.

If the inner policy was not set, behavior is undefined.

Definition at line 47 of file validation-policy.cpp.

◆ hasInnerPolicy()

bool ndn::security::ValidationPolicy::hasInnerPolicy ( ) const
inlineinherited

Check if inner policy is set.

Definition at line 65 of file validation-policy.hpp.

◆ setInnerPolicy()

void ndn::security::ValidationPolicy::setInnerPolicy ( unique_ptr< ValidationPolicy innerPolicy)
inherited

Set inner policy.

Multiple assignments of the inner policy will create a "chain" of linked policies. The inner policy from the latest invocation of setInnerPolicy will be at the bottom of the policy list.

For example, sequence of this->setInnerPolicy(policy1) and this->setInnerPolicy(policy2), will result in this->m_innerPolicy == policy1, this->m_innerPolicy->m_innerPolicy == policy2', and this->m_innerPolicy->m_innerPolicy->m_innerPolicy == nullptr.

Exceptions
std::invalid_argumentexception, if innerPolicy is nullptr.

Definition at line 28 of file validation-policy.cpp.

◆ setValidator()

void ndn::security::ValidationPolicy::setValidator ( Validator validator)
inherited

Set validator to which the policy is associated.

Definition at line 53 of file validation-policy.cpp.

Member Data Documentation

◆ m_innerPolicy

unique_ptr<ValidationPolicy> ndn::security::ValidationPolicy::m_innerPolicy
protectedinherited

Definition at line 145 of file validation-policy.hpp.

◆ m_validator

Validator* ndn::security::ValidationPolicy::m_validator = nullptr
protectedinherited

Definition at line 144 of file validation-policy.hpp.