Class: ConfigRule

ConfigRule(id, isForInterest)

new ConfigRule(id, isForInterest)

A ConfigRule represents a rule configuration section, used by ConfigValidator. Create a ConfigRule with empty filters and checkers.
Parameters:
Name Type Description
id String The rule ID from the configuration section.
isForInterest boolean True if the rule is for an Interest packet, false if it is for a Data packet.
Source:

Methods

(static) create(configSection) → {ConfigRule}

Create a rule from configuration section.
Parameters:
Name Type Description
configSection BoostInfoTree The section containing the definition of the checker, e.g. one of "validator.rule".
Source:
Returns:
A new ConfigRule created from the configuration
Type
ConfigRule

addChecker(checker)

Add the ConfigChecker to the list of checkers.
Parameters:
Name Type Description
checker ConfigChecker The ConfigChecker.
Source:

addFilter(filter)

Add the ConfigFilter to the list of filters.
Parameters:
Name Type Description
filter ConfigFilter The ConfigFilter.
Source:

check(isForInterest, packetName, keyLocatorName, state) → {boolean}

Check if the packet satisfies the rule's condition.
Parameters:
Name Type Description
isForInterest boolean True if packetName is for an Interest, false if for a Data packet.
packetName Name The packet name. For a signed interest, the last two components are skipped but not removed.
keyLocatorName Name The KeyLocator's name.
state ValidationState This calls state.fail() if the packet is invalid.
Source:
Throws:
ValidatorConfigError if the supplied isForInterest doesn't match the one for which the rule is designed.
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.
Type
boolean

getId() → {String}

Get the rule ID.
Source:
Returns:
The rule ID.
Type
String

getIsForInterest() → {boolean}

Get the isForInterest flag.
Source:
Returns:
True if the rule is for an Interest packet, false if it is for a Data packet.
Type
boolean

match(isForInterest, packetName) → {boolean}

Check if the packet name matches the rule's filter. If no filters were added, the rule matches everything.
Parameters:
Name Type Description
isForInterest boolean True if packetName is for an Interest, false if for a Data packet.
packetName Name The packet name. For a signed interest, the last two components are skipped but not removed.
Source:
Throws:
ValidatorConfigError if the supplied isForInterest doesn't match the one for which the rule is designed.
Returns:
True if at least one filter matches the packet name, false if none of the filters match the packet name.
Type
boolean