NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::ValidatorRegex Class Reference

#include <validator-regex.hpp>

Inheritance diagram for ndn::ValidatorRegex:
Collaboration diagram for ndn::ValidatorRegex:

Classes

class  Error
 

Public Member Functions

 ValidatorRegex (Face *face=nullptr, shared_ptr< CertificateCache > certificateCache=DEFAULT_CERTIFICATE_CACHE, const int stepLimit=3)
 
 ValidatorRegex (Face &face, shared_ptr< CertificateCache > certificateCache=DEFAULT_CERTIFICATE_CACHE, const int stepLimit=3)
 
virtual ~ValidatorRegex ()
 
void addDataVerificationRule (shared_ptr< SecRuleRelative > rule)
 Add a rule for data verification. More...
 
void addTrustAnchor (shared_ptr< IdentityCertificate > certificate)
 Add a trust anchor. More...
 
- Public Member Functions inherited from ndn::Validator
 Validator (Face *face=nullptr)
 Validator constructor. More...
 
 Validator (Face &face)
 
void validate (const Data &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed)
 Validate Data and call either onValidated or onValidationFailed. More...
 
void validate (const Interest &interest, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed)
 Validate Interest and call either onValidated or onValidationFailed. More...
 

Static Public Attributes

static const shared_ptr< CertificateCacheDEFAULT_CERTIFICATE_CACHE
 

Protected Types

typedef std::vector< shared_ptr< SecRuleRelative > > RuleList
 
typedef std::vector< shared_ptr< Regex > > RegexList
 
- Protected Types inherited from ndn::Validator
typedef function< void(const std::string &)> OnFailure
 

Protected Member Functions

virtual void checkPolicy (const Data &data, int nSteps, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed, std::vector< shared_ptr< ValidationRequest > > &nextSteps)
 Check the Data against policy and return the next validation step if necessary. More...
 
virtual void checkPolicy (const Interest &interest, int nSteps, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed, std::vector< shared_ptr< ValidationRequest > > &nextSteps)
 Check the Interest against validation policy and return the next validation step if necessary. More...
 
void onCertificateValidated (const shared_ptr< const Data > &signCertificate, const shared_ptr< const Data > &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed)
 
void onCertificateValidationFailed (const shared_ptr< const Data > &signCertificate, const std::string &failureInfo, const shared_ptr< const Data > &data, const OnDataValidationFailed &onValidationFailed)
 
- Protected Member Functions inherited from ndn::Validator
void onData (const Interest &interest, const Data &data, const shared_ptr< ValidationRequest > &nextStep)
 Process the received certificate. More...
 
void validate (const Data &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed, int nSteps)
 
void validate (const Interest &interest, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed, int nSteps)
 
virtual shared_ptr< const DatapreCertificateValidation (const Data &data)
 Hooks. More...
 
virtual void onTimeout (const Interest &interest, int nRemainingRetries, const OnFailure &onFailure, const shared_ptr< ValidationRequest > &validationRequest)
 trigger when interest for certificate times out. More...
 
virtual void afterCheckPolicy (const std::vector< shared_ptr< ValidationRequest > > &nextSteps, const OnFailure &onFailure)
 trigger after checkPolicy is done. More...
 

Protected Attributes

int m_stepLimit
 
shared_ptr< CertificateCachem_certificateCache
 
RuleList m_mustFailVerify
 
RuleList m_verifyPolicies
 
std::map< Name, shared_ptr< IdentityCertificate > > m_trustAnchors
 
- Protected Attributes inherited from ndn::Validator
Facem_face
 

Additional Inherited Members

- Static Public Member Functions inherited from ndn::Validator
static bool verifySignature (const Data &data, const PublicKey &publicKey)
 Verify the data using the publicKey. More...
 
static bool verifySignature (const Interest &interest, const PublicKey &publicKey)
 Verify the signed Interest using the publicKey. More...
 
static bool verifySignature (const Buffer &blob, const Signature &sig, const PublicKey &publicKey)
 Verify the blob using the publicKey against the signature. More...
 
static bool verifySignature (const Data &data, const Signature &sig, const PublicKey &publicKey)
 Verify the data using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const Interest &interest, const Signature &sig, const PublicKey &publicKey)
 Verify the interest using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const uint8_t *buf, const size_t size, const Signature &sig, const PublicKey &publicKey)
 Verify the blob using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const Data &data, const DigestSha256 &sig)
 Verify the data against the SHA256 signature. More...
 
static bool verifySignature (const Interest &interest, const DigestSha256 &sig)
 Verify the interest against the SHA256 signature. More...
 
static bool verifySignature (const Buffer &blob, const DigestSha256 &sig)
 Verify the blob against the SHA256 signature. More...
 
static bool verifySignature (const uint8_t *buf, const size_t size, const DigestSha256 &sig)
 Verify the blob against the SHA256 signature. More...
 

Detailed Description

Definition at line 35 of file validator-regex.hpp.

Member Typedef Documentation

◆ RuleList

typedef std::vector< shared_ptr<SecRuleRelative> > ndn::ValidatorRegex::RuleList
protected

Definition at line 118 of file validator-regex.hpp.

◆ RegexList

typedef std::vector< shared_ptr<Regex> > ndn::ValidatorRegex::RegexList
protected

Definition at line 119 of file validator-regex.hpp.

Constructor & Destructor Documentation

◆ ValidatorRegex() [1/2]

ndn::ValidatorRegex::ValidatorRegex ( Face face = nullptr,
shared_ptr< CertificateCache certificateCache = DEFAULT_CERTIFICATE_CACHE,
const int  stepLimit = 3 
)
explicit
Note
When both certificate cache and face are not supplied, no cache will be used. However, if only face is supplied, a default cache will be created and used.

Definition at line 34 of file validator-regex.cpp.

References ndn::Face::getIoService(), and m_certificateCache.

◆ ValidatorRegex() [2/2]

ndn::ValidatorRegex::ValidatorRegex ( Face face,
shared_ptr< CertificateCache certificateCache = DEFAULT_CERTIFICATE_CACHE,
const int  stepLimit = 3 
)
explicit
Deprecated:
Use the constructor taking Face* as parameter.

Definition at line 45 of file validator-regex.cpp.

References ndn::Face::getIoService(), and m_certificateCache.

◆ ~ValidatorRegex()

virtual ndn::ValidatorRegex::~ValidatorRegex ( )
inlinevirtual

Definition at line 64 of file validator-regex.hpp.

Member Function Documentation

◆ addDataVerificationRule()

void ndn::ValidatorRegex::addDataVerificationRule ( shared_ptr< SecRuleRelative rule)

Add a rule for data verification.

Parameters
ruleThe verification rule

Definition at line 57 of file validator-regex.cpp.

References m_mustFailVerify, and m_verifyPolicies.

◆ addTrustAnchor()

void ndn::ValidatorRegex::addTrustAnchor ( shared_ptr< IdentityCertificate certificate)

Add a trust anchor.

Parameters
certificateThe trust anchor

Definition at line 63 of file validator-regex.cpp.

References m_trustAnchors.

◆ checkPolicy() [1/2]

void ndn::ValidatorRegex::checkPolicy ( const Data data,
int  nSteps,
const OnDataValidated onValidated,
const OnDataValidationFailed onValidationFailed,
std::vector< shared_ptr< ValidationRequest > > &  nextSteps 
)
protectedvirtual

Check the Data against policy and return the next validation step if necessary.

If there is no next validation step, that validation MUST have been done. i.e., either onValidated or onValidationFailed callback is invoked.

Parameters
dataThe Data to check.
nStepsThe number of validation steps that have been done.
onValidatedIf the Data is validated, this calls onValidated(data)
onValidationFailedIf validation fails, this calls onValidationFailed(data)
nextStepsOn return, contains the next validation step

Implements ndn::Validator.

Definition at line 108 of file validator-regex.cpp.

References ndn::Signature::getKeyLocator(), ndn::KeyLocator::getName(), ndn::Data::getName(), ndn::Data::getSignature(), ndn::KeyLocator::getType(), ndn::Signature::hasKeyLocator(), ndn::KeyLocator::KeyLocator_Name, m_certificateCache, m_mustFailVerify, m_stepLimit, m_trustAnchors, m_verifyPolicies, onCertificateValidated(), onCertificateValidationFailed(), ndn::Name::toUri(), and ndn::Validator::verifySignature().

◆ checkPolicy() [2/2]

virtual void ndn::ValidatorRegex::checkPolicy ( const Interest interest,
int  nSteps,
const OnInterestValidated onValidated,
const OnInterestValidationFailed onValidationFailed,
std::vector< shared_ptr< ValidationRequest > > &  nextSteps 
)
inlineprotectedvirtual

Check the Interest against validation policy and return the next validation step if necessary.

If there is no next validation step, that validation MUST have been done. i.e., either onValidated or onValidationFailed callback is invoked.

Parameters
interestThe Interest to check.
nStepsThe number of validation steps that have been done.
onValidatedIf the Interest is validated, this calls onValidated(data)
onValidationFailedIf validation fails, this calls onValidationFailed(data)
nextStepsOn return, contains the next validation step

Implements ndn::Validator.

Definition at line 93 of file validator-regex.hpp.

◆ onCertificateValidated()

void ndn::ValidatorRegex::onCertificateValidated ( const shared_ptr< const Data > &  signCertificate,
const shared_ptr< const Data > &  data,
const OnDataValidated onValidated,
const OnDataValidationFailed onValidationFailed 
)
protected

Definition at line 69 of file validator-regex.cpp.

References m_certificateCache, and ndn::Validator::verifySignature().

Referenced by checkPolicy().

◆ onCertificateValidationFailed()

void ndn::ValidatorRegex::onCertificateValidationFailed ( const shared_ptr< const Data > &  signCertificate,
const std::string &  failureInfo,
const shared_ptr< const Data > &  data,
const OnDataValidationFailed onValidationFailed 
)
protected

Definition at line 99 of file validator-regex.cpp.

Referenced by checkPolicy().

Member Data Documentation

◆ DEFAULT_CERTIFICATE_CACHE

const shared_ptr< CertificateCache > ndn::ValidatorRegex::DEFAULT_CERTIFICATE_CACHE
static

Definition at line 115 of file validator-regex.hpp.

◆ m_stepLimit

int ndn::ValidatorRegex::m_stepLimit
protected

Definition at line 121 of file validator-regex.hpp.

Referenced by checkPolicy().

◆ m_certificateCache

shared_ptr<CertificateCache> ndn::ValidatorRegex::m_certificateCache
protected

Definition at line 122 of file validator-regex.hpp.

Referenced by checkPolicy(), onCertificateValidated(), and ValidatorRegex().

◆ m_mustFailVerify

RuleList ndn::ValidatorRegex::m_mustFailVerify
protected

Definition at line 123 of file validator-regex.hpp.

Referenced by addDataVerificationRule(), and checkPolicy().

◆ m_verifyPolicies

RuleList ndn::ValidatorRegex::m_verifyPolicies
protected

Definition at line 124 of file validator-regex.hpp.

Referenced by addDataVerificationRule(), and checkPolicy().

◆ m_trustAnchors

std::map<Name, shared_ptr<IdentityCertificate> > ndn::ValidatorRegex::m_trustAnchors
protected

Definition at line 125 of file validator-regex.hpp.

Referenced by addTrustAnchor(), and checkPolicy().


The documentation for this class was generated from the following files: