new ValidationPolicyCommandInterest(innerPolicy, options)
ValidationPolicyCommandInterest extends ValidationPolicy as a policy for
stop-and-wait command Interests. See:
https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest
This policy checks the timestamp field of a stop-and-wait command Interest.
Signed Interest validation and Data validation requests are delegated to an
inner policy.
Create a ValidationPolicyCommandInterest.
Parameters:
Name | Type | Description |
---|---|---|
innerPolicy |
ValidationPolicy | a ValidationPolicy for signed Interest signature validation and Data validation. This must not be null. |
options |
ValidationPolicyCommandInterest.Options | (optional) The stop-and-wait command Interest validation options. If omitted, use a default Options(). |
Throws:
Error if innerPolicy is null.
Classes
Methods
(static) parseCommandInterest_(interest, state, keyLocatorName, timestamp) → {boolean}
Get the keyLocatorName and timestamp from the command interest.
Parameters:
Name | Type | Description |
---|---|---|
interest |
Interest | The Interest to parse. |
state |
ValidationState | On error, this calls state.fail and returns false. |
keyLocatorName |
Array.<Name> | Set keyLocatorName[0] to the KeyLocator name. |
timestamp |
Array.<number> | Set timestamp[0] to the timestamp as milliseconds since Jan 1, 1970 UTC. |
Returns:
On success, return true. On error, call state.fail and
return false.
- Type
- boolean
checkPolicy(dataOrInterest, state, continueValidation)
Parameters:
Name | Type | Description |
---|---|---|
dataOrInterest |
Data | Interest | |
state |
ValidationState | |
continueValidation |
function |
checkTimestamp_(state, keyName, timestamp) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
state |
ValidationState | On error, this calls state.fail and returns false. |
keyName |
Name | The key name. |
timestamp |
number | The timestamp as milliseconds since Jan 1, 1970 UTC. |
Returns:
On success, return true. On error, call state.fail and
return false.
- Type
- boolean
findByKeyName_(keyName) → {number}
Find the record in container_ which has the keyName.
Parameters:
Name | Type | Description |
---|---|---|
keyName |
Name | The key name to search for. |
Returns:
The index in container_ of the record, or -1 if not found.
- Type
- number
insertNewRecord_(interest, keyName, timestamp)
Parameters:
Name | Type | Description |
---|---|---|
interest |
Interest | |
keyName |
Name | |
timestamp |
number |
setNowOffsetMilliseconds_(nowOffsetMilliseconds)
Set the offset when insertNewRecord_() and cleanUp_() get the current time,
which should only be used for testing.
Parameters:
Name | Type | Description |
---|---|---|
nowOffsetMilliseconds |
number | The offset in milliseconds. |