public class ConfigRule extends Object
| Constructor and Description |
|---|
ConfigRule(String id,
boolean isForInterest)
Create a ConfigRule with empty filters and checkers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChecker(ConfigChecker checker)
Add the ConfigChecker to the list of checkers.
|
void |
addFilter(ConfigFilter filter)
Add the ConfigFilter to the list of filters.
|
boolean |
check(boolean isForInterest,
Name packetName,
Name keyLocatorName,
ValidationState state)
Check if the packet satisfies the rule's condition.
|
static ConfigRule |
create(BoostInfoTree configSection)
Create a rule from configuration section.
|
String |
getId()
Get the rule ID.
|
boolean |
getIsForInterest()
Get the isForInterest flag.
|
boolean |
match(boolean isForInterest,
Name packetName)
Check if the packet name matches the rule's filter.
|
public ConfigRule(String id, boolean isForInterest)
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.public final String getId()
public final boolean getIsForInterest()
public final void addFilter(ConfigFilter filter)
filter - The ConfigFilter.public final void addChecker(ConfigChecker checker)
checker - The ConfigChecker.public final boolean match(boolean isForInterest,
Name packetName)
throws ValidatorConfigError
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.ValidatorConfigError - if the supplied isForInterest doesn't match the
one for which the rule is designed.public final boolean check(boolean isForInterest,
Name packetName,
Name keyLocatorName,
ValidationState state)
throws ValidatorConfigError
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.ValidatorConfigError - if the supplied isForInterest doesn't match the
one for which the rule is designed.public static ConfigRule create(BoostInfoTree configSection) throws ValidatorConfigError
configSection - The section containing the definition of the checker,
e.g. one of "validator.rule".ValidatorConfigErrorCopyright © 2019. All rights reserved.