NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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

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

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

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

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

Constructor & Destructor Documentation

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.

Referenced by ndn::ValidatorRegex::Error::Error().

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.

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

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

References addDataVerificationRule(), addTrustAnchor(), and checkPolicy().

Member Function Documentation

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.

Referenced by ~ValidatorRegex().

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.

Referenced by ~ValidatorRegex().

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().

Referenced by ~ValidatorRegex().

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.

References onCertificateValidated(), and onCertificateValidationFailed().

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().

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

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

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

Referenced by ndn::ValidatorRegex::Error::Error().

int ndn::ValidatorRegex::m_stepLimit
protected

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

Referenced by checkPolicy().

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

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

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

RuleList ndn::ValidatorRegex::m_mustFailVerify
protected

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

Referenced by addDataVerificationRule(), and checkPolicy().

RuleList ndn::ValidatorRegex::m_verifyPolicies
protected

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

Referenced by addDataVerificationRule(), and checkPolicy().

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: