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

#include <validator-config.hpp>

Inheritance diagram for ndn::ValidatorConfig:
Collaboration diagram for ndn::ValidatorConfig:

Classes

class  Error
 

Public Member Functions

 ValidatorConfig (Face *face=nullptr, const shared_ptr< CertificateCache > &certificateCache=DEFAULT_CERTIFICATE_CACHE, const time::milliseconds &graceInterval=DEFAULT_GRACE_INTERVAL, const size_t stepLimit=10, const size_t maxTrackedKeys=1000, const time::system_clock::Duration &keyTimestampTtl=DEFAULT_KEY_TIMESTAMP_TTL)
 
 ValidatorConfig (Face &face, const shared_ptr< CertificateCache > &certificateCache=DEFAULT_CERTIFICATE_CACHE, const time::milliseconds &graceInterval=DEFAULT_GRACE_INTERVAL, const size_t stepLimit=10, const size_t maxTrackedKeys=1000, const time::system_clock::Duration &keyTimestampTtl=DEFAULT_KEY_TIMESTAMP_TTL)
 
virtual ~ValidatorConfig ()
 
void load (const std::string &filename)
 
void load (const std::string &input, const std::string &filename)
 
void load (std::istream &input, const std::string &filename)
 
void load (const security::conf::ConfigSection &configSection, const std::string &filename)
 
void reset ()
 
bool isEmpty ()
 
- 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
 
static const time::milliseconds DEFAULT_GRACE_INTERVAL
 
static const time::system_clock::Duration DEFAULT_KEY_TIMESTAMP_TTL = time::hours(1)
 

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

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...
 
- Protected Types inherited from ndn::Validator
typedef function< void(const std::string &)> OnFailure
 
- Protected Attributes inherited from ndn::Validator
Facem_face
 

Detailed Description

Definition at line 34 of file validator-config.hpp.

Constructor & Destructor Documentation

§ ValidatorConfig() [1/2]

ndn::ValidatorConfig::ValidatorConfig ( Face face = nullptr,
const shared_ptr< CertificateCache > &  certificateCache = DEFAULT_CERTIFICATE_CACHE,
const time::milliseconds &  graceInterval = DEFAULT_GRACE_INTERVAL,
const size_t  stepLimit = 10,
const size_t  maxTrackedKeys = 1000,
const time::system_clock::Duration keyTimestampTtl = DEFAULT_KEY_TIMESTAMP_TTL 
)
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 38 of file validator-config.cpp.

References ndn::Face::getIoService().

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

§ ValidatorConfig() [2/2]

ndn::ValidatorConfig::ValidatorConfig ( Face face,
const shared_ptr< CertificateCache > &  certificateCache = DEFAULT_CERTIFICATE_CACHE,
const time::milliseconds &  graceInterval = DEFAULT_GRACE_INTERVAL,
const size_t  stepLimit = 10,
const size_t  maxTrackedKeys = 1000,
const time::system_clock::Duration keyTimestampTtl = DEFAULT_KEY_TIMESTAMP_TTL 
)
explicit
Deprecated:
Use the constructor taking Face* as parameter.

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

References ndn::Face::getIoService().

§ ~ValidatorConfig()

virtual ndn::ValidatorConfig::~ValidatorConfig ( )
inlinevirtual

Definition at line 69 of file validator-config.hpp.

References checkPolicy(), isEmpty(), load(), and reset().

Member Function Documentation

§ load() [1/4]

void ndn::ValidatorConfig::load ( const std::string &  filename)

§ load() [2/4]

void ndn::ValidatorConfig::load ( const std::string &  input,
const std::string &  filename 
)

Definition at line 92 of file validator-config.cpp.

References load().

§ load() [3/4]

void ndn::ValidatorConfig::load ( std::istream &  input,
const std::string &  filename 
)

Definition at line 100 of file validator-config.cpp.

References load().

§ load() [4/4]

void ndn::ValidatorConfig::load ( const security::conf::ConfigSection configSection,
const std::string &  filename 
)

§ reset()

void ndn::ValidatorConfig::reset ( )

Definition at line 378 of file validator-config.cpp.

Referenced by load(), and ~ValidatorConfig().

§ isEmpty()

bool ndn::ValidatorConfig::isEmpty ( )

Definition at line 393 of file validator-config.cpp.

References ndn::time::system_clock::now().

Referenced by ~ValidatorConfig().

§ checkPolicy() [1/2]

void ndn::ValidatorConfig::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 488 of file validator-config.cpp.

References ndn::Data::getSignature().

Referenced by ~ValidatorConfig().

§ checkPolicy() [2/2]

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

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 523 of file validator-config.cpp.

References ndn::IdentityCertificate::certificateNameToPublicKeyName(), ndn::tlv::ContentType_Key, ndn::tlv::DigestSha256, ndn::time::fromUnixTimestamp(), ndn::Name::get(), ndn::Signature::getKeyLocator(), ndn::KeyLocator::getName(), ndn::Interest::getName(), ndn::KeyLocator::getType(), ndn::Signature::getType(), ndn::Signature::hasKeyLocator(), ndn::KeyLocator::KeyLocator_Name, ndn::signed_interest::MIN_LENGTH, ndn::time::system_clock::now(), ndn::signed_interest::POS_SIG_INFO, ndn::signed_interest::POS_SIG_VALUE, ndn::tlv::SignatureSha256WithEcdsa, ndn::tlv::SignatureSha256WithRsa, ndn::Name::size(), ndn::name::Component::toNumber(), ndn::Name::toUri(), and ndn::Validator::verifySignature().

Member Data Documentation

§ DEFAULT_CERTIFICATE_CACHE

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

Definition at line 236 of file validator-config.hpp.

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

§ DEFAULT_GRACE_INTERVAL

const time::milliseconds ndn::ValidatorConfig::DEFAULT_GRACE_INTERVAL
static

Definition at line 237 of file validator-config.hpp.

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

§ DEFAULT_KEY_TIMESTAMP_TTL

const time::system_clock::Duration ndn::ValidatorConfig::DEFAULT_KEY_TIMESTAMP_TTL = time::hours(1)
static

Definition at line 238 of file validator-config.hpp.

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


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