ValidationPolicy is an abstract base class that implements a validation policy for Data and Interest packets. More...
#include <validation-policy.hpp>
Public Types | |
|
typedef func_lib::function < void(const ptr_lib::shared_ptr < CertificateRequest > &certificateRequest, const ptr_lib::shared_ptr < ValidationState > &state)> | ValidationContinuation |
Public Member Functions | |
| void | setInnerPolicy (const ptr_lib::shared_ptr< ValidationPolicy > &innerPolicy) |
| Set the inner policy. More... | |
| bool | hasInnerPolicy () const |
| Check if the inner policy is set. More... | |
| ValidationPolicy & | getInnerPolicy () |
| Get the inner policy. More... | |
| void | setValidator (Validator &validator) |
| Set the validator to which this policy is associated. More... | |
| virtual void | checkPolicy (const Data &data, const ptr_lib::shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)=0 |
| Check the Data packet against the policy. More... | |
| virtual void | checkPolicy (const Interest &interest, const ptr_lib::shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)=0 |
| Check the Interest against the policy. More... | |
| virtual void | checkCertificatePolicy (const CertificateV2 &certificate, const ptr_lib::shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) |
| Check the certificate against the policy. More... | |
Static Public Member Functions | |
| static Name | getKeyLocatorName (const Data &data, ValidationState &state) |
| Extract the KeyLocator Name from a Data packet. More... | |
| static Name | getKeyLocatorName (const Interest &interest, ValidationState &state) |
| Extract the KeyLocator Name from a signed Interest. More... | |
Protected Attributes | |
| friend | TestValidator_ConstructorSetValidator_Test |
| Validator * | validator_ |
|
ptr_lib::shared_ptr < ValidationPolicy > | innerPolicy_ |
ValidationPolicy is an abstract base class that implements a validation policy for Data and Interest packets.
|
virtual |
Check the certificate against the policy.
This base class implementation just calls checkPolicy(Data, ...). Your derived class may override. Depending on implementation of the policy, this check can be done synchronously or asynchronously. See the checkPolicy(Data) documentation for the semantics.
| certificate | The certificate to check. |
| state | The ValidationState of this validation. |
| continueValidation | The policy should call continueValidation() as described above. |
|
pure virtual |
Check the Data packet against the policy.
Your derived class must implement this. Depending on the implementation of the policy, this check can be done synchronously or asynchronously. The semantics of checkPolicy are as follows: If the packet violates the policy, then the policy should call state.fail() with an appropriate error code and error description. If the packet conforms to the policy and no further key retrievals are necessary, then the policy should call continueValidation(null, state). If the packet conforms to the policy and a key needs to be fetched, then the policy should call continueValidation(<appropriate-key-request-instance>, state).
| data | The Data packet to check. |
| state | The ValidationState of this validation. |
| continueValidation | The policy should call continueValidation() as described above. |
Implemented in ValidationPolicySimpleHierarchyForInterestOnly, ndn::ValidationPolicyCommandInterest, ndn::ValidationPolicyConfig, ndn::ValidationPolicyFromPib, ndn::ValidationPolicyAcceptAll, and ndn::ValidationPolicySimpleHierarchy.
|
pure virtual |
Check the Interest against the policy.
Your derived class must implement this. Depending on implementation of the policy, this check can be done synchronously or asynchronously. See the checkPolicy(Data) documentation for the semantics.
| interest | The Interest packet to check. |
| state | The ValidationState of this validation. |
| continueValidation | The policy should call continueValidation() as described above. |
Implemented in ndn::ValidationPolicyCommandInterest, ndn::ValidationPolicyConfig, ndn::ValidationPolicyFromPib, ndn::ValidationPolicyAcceptAll, and ndn::ValidationPolicySimpleHierarchy.
|
inline |
Get the inner policy.
If the inner policy was not set, the behavior is undefined.
|
inlinestatic |
Extract the KeyLocator Name from a Data packet.
The Data packet must contain a KeyLocator of type KEYNAME. Otherwise, state.fail is invoked with INVALID_KEY_LOCATOR.
| data | The Data packet with the KeyLocator. |
| state | On error, this calls state.fail and returns an empty Name. |
|
static |
Extract the KeyLocator Name from a signed Interest.
The Interest must have SignatureInfo and contain a KeyLocator of type KEYNAME. Otherwise, state.fail is invoked with INVALID_KEY_LOCATOR.
| interest | The signed Interest with the KeyLocator. |
| state | On error, this calls state.fail and returns an empty Name. |
|
inline |
Check if the inner policy is set.
| void ndn::ValidationPolicy::setInnerPolicy | ( | const ptr_lib::shared_ptr< ValidationPolicy > & | innerPolicy | ) |
Set the 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, the sequence this->setInnerPolicy(policy1) and this->setInnerPolicy(policy2), will result in this->innerPolicy_ == policy1, this->innerPolicy_->innerPolicy_ == policy2', and this->innerPolicy_->innerPolicy_->innerPolicy_ == null.
| invalid_argument | if the innerPolicy is null. |
|
inline |
Set the validator to which this policy is associated.
This replaces any previous validator.
| validator | The validator. |
1.8.6