A ConfigRule represents a rule configuration section, used by ConfigValidator.
More...
#include <config-rule.hpp>
A ConfigRule represents a rule configuration section, used by ConfigValidator.
| ndn::ConfigRule::ConfigRule |
( |
const std::string & |
id, |
|
|
bool |
isForInterest |
|
) |
| |
|
inline |
Create a ConfigRule with empty filters and checkers.
- Parameters
-
| id | The rule ID from the configuration section. |
| isForInterest | True if the rule is for an Interest packet, false if it is for a Data packet. |
| void ndn::ConfigRule::addChecker |
( |
const ptr_lib::shared_ptr< ConfigChecker > & |
checker | ) |
|
|
inline |
| void ndn::ConfigRule::addFilter |
( |
const ptr_lib::shared_ptr< ConfigFilter > & |
filter | ) |
|
|
inline |
| bool ndn::ConfigRule::check |
( |
bool |
isForInterest, |
|
|
const Name & |
packetName, |
|
|
const Name & |
keyLocatorName, |
|
|
const ptr_lib::shared_ptr< ValidationState > & |
state |
|
) |
| |
Check if the packet satisfies the rule's condition.
- Parameters
-
| isForInterest | True if packetName is for an Interest, false if for a Data packet. |
| packetName | The packet name. For a signed interest, the last two components are skipped but not removed. |
| keyLocatorName | The KeyLocator's name. |
| state | This calls state.fail() if the packet is invalid. |
- Returns
- True if further signature verification is needed, or false if the packet is immediately determined to be invalid in which case this calls state.fail() with the proper code and message.
- Exceptions
-
| ValidatorConfigError | if the supplied isForInterest doesn't match the one for which the rule is designed. |
Create a rule from configuration section.
- Parameters
-
| configSection | The section containing the definition of the rule, e.g. one of <validator.rule>. |
- Returns
- A new ConfigRule created from the configuration
| const std::string& ndn::ConfigRule::getId |
( |
| ) |
const |
|
inline |
Get the rule ID.
- Returns
- The rule ID.
| bool ndn::ConfigRule::getIsForInterest |
( |
| ) |
const |
|
inline |
Get the isForInterest flag.
- Returns
- True if the rule is for an Interest packet, false if it is for a Data packet.
| bool ndn::ConfigRule::match |
( |
bool |
isForInterest, |
|
|
const Name & |
packetName |
|
) |
| |
Check if the packet name matches the rule's filter.
If no filters were added, the rule matches everything.
- Parameters
-
| isForInterest | True if packetName is for an Interest, false if for a Data packet. |
| packetName | The packet name. For a signed interest, the last two components are skipped but not removed. True if at least one filter matches the packet name, false if none of the filters match the packet name. |
- Exceptions
-
| ValidatorConfigError | if the supplied isForInterest doesn't match the one for which the rule is designed. |
The documentation for this class was generated from the following file: