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

#include <rule.hpp>

Inheritance diagram for ndn::security::v2::validator_config::Rule:
Collaboration diagram for ndn::security::v2::validator_config::Rule:

Public Member Functions

 Rule (const std::string &id, uint32_t pktType)
 
const std::string & getId () const
 
uint32_t getPktType () const
 
void addFilter (unique_ptr< Filter > filter)
 
void addChecker (unique_ptr< Checker > checker)
 
bool match (uint32_t pktType, const Name &pktName) const
 check if the packet name matches rule's filter More...
 
bool check (uint32_t pktType, const Name &pktName, const Name &klName, const shared_ptr< ValidationState > &state) const
 check if packet satisfies rule's condition More...
 

Static Public Member Functions

static unique_ptr< Rulecreate (const ConfigSection &configSection, const std::string &configFilename)
 create a rule from configuration section More...
 

Public Attributes

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad0__: std::string m_id
 
uint32_t m_pktType
 
std::vector< unique_ptr< Filter > > m_filters
 
std::vector< unique_ptr< Checker > > m_checkers
 

Detailed Description

Definition at line 36 of file rule.hpp.

Constructor & Destructor Documentation

◆ Rule()

ndn::security::v2::validator_config::Rule::Rule ( const std::string &  id,
uint32_t  pktType 
)

Definition at line 34 of file rule.cpp.

Member Function Documentation

◆ getId()

const std::string& ndn::security::v2::validator_config::Rule::getId ( ) const
inline

Definition at line 42 of file rule.hpp.

◆ getPktType()

uint32_t ndn::security::v2::validator_config::Rule::getPktType ( ) const
inline

Definition at line 48 of file rule.hpp.

References m_pktType.

◆ addFilter()

void ndn::security::v2::validator_config::Rule::addFilter ( unique_ptr< Filter filter)

Definition at line 41 of file rule.cpp.

References m_filters.

◆ addChecker()

void ndn::security::v2::validator_config::Rule::addChecker ( unique_ptr< Checker checker)

Definition at line 47 of file rule.cpp.

References m_checkers.

◆ match()

bool ndn::security::v2::validator_config::Rule::match ( uint32_t  pktType,
const Name pktName 
) const

check if the packet name matches rule's filter

If no filters were added, the rule matches everything.

Parameters
pktTypetlv::Interest or tlv::Data
pktNamepacket name, for signed Interests the last two components are not removed
Return values
trueIf at least one filter matches pktName
falseIf none of the filters match pktName
Exceptions
Errorthe supplied pktType doesn't match one for which the rule is designed

Definition at line 53 of file rule.cpp.

References m_filters, m_pktType, NDN_LOG_TRACE, and ndn::to_string().

◆ check()

bool ndn::security::v2::validator_config::Rule::check ( uint32_t  pktType,
const Name pktName,
const Name klName,
const shared_ptr< ValidationState > &  state 
) const

check if packet satisfies rule's condition

Parameters
pktTypetlv::Interest or tlv::Data
pktNamepacket name, for signed Interests the last two components are not removed
klNameKeyLocator name
stateValidation state
Return values
falsepacket violates at least one checker. Will call state::fail() with proper code and message.
truepacket satisfies all checkers, further validation is needed
Exceptions
Errorthe supplied pktType doesn't match one for which the rule is designed

Definition at line 76 of file rule.cpp.

References m_checkers, m_pktType, NDN_LOG_TRACE, and ndn::to_string().

◆ create()

unique_ptr< Rule > ndn::security::v2::validator_config::Rule::create ( const ConfigSection configSection,
const std::string &  configFilename 
)
static

create a rule from configuration section

Parameters
configSectionThe section containing the definition of checker.
configFilenameThe configuration file name.
Returns
a rule created from configuration

Definition at line 98 of file rule.cpp.

References ndn::security::v2::validator_config::Filter::create(), ndn::security::v2::validator_config::Checker::create(), ndn::tlv::Data, and ndn::tlv::Interest.

Referenced by ndn::security::v2::validator_config::ValidationPolicyConfig::load().

Member Data Documentation

◆ __pad0__

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::security::v2::validator_config::Rule::__pad0__

Definition at line 102 of file rule.hpp.

◆ m_pktType

uint32_t ndn::security::v2::validator_config::Rule::m_pktType

Definition at line 103 of file rule.hpp.

Referenced by check(), getPktType(), and match().

◆ m_filters

std::vector<unique_ptr<Filter> > ndn::security::v2::validator_config::Rule::m_filters

Definition at line 104 of file rule.hpp.

Referenced by addFilter(), and match().

◆ m_checkers

std::vector<unique_ptr<Checker> > ndn::security::v2::validator_config::Rule::m_checkers

Definition at line 105 of file rule.hpp.

Referenced by addChecker(), and check().


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