new Interest(nameOrInterest)
Create a new Interest with the optional values.
Parameters:
Name | Type | Description |
---|---|---|
nameOrInterest |
Name | Interest | (optional) If this is an Interest, copy values from the Interest. If this is a Name, create an Interest with the Name. |
- Source:
Methods
clone()
Return a new Interest with the same fields as this Interest.
- Source:
getCanBePrefix() → {boolean}
Get the CanBePrefix flag. If not specified, the default is true.
- Source:
Returns:
The CanBePrefix flag.
- Type
- boolean
getChangeCount() → {number}
Get the change count, which is incremented each time this object (or a child
object) is changed.
- Source:
Returns:
The change count.
- Type
- number
getChildSelector() → {number}
Get the child selector.
- Source:
Returns:
The child selector, or null if not specified.
- Type
- number
getDefaultWireEncoding() → {SignedBlob}
Return the default wire encoding, which was encoded with
getDefaultWireEncodingFormat().
- Source:
Returns:
The default wire encoding, whose isNull() may be true
if there is no default wire encoding.
- Type
- SignedBlob
getDefaultWireEncodingFormat() → {WireFormat}
Get the WireFormat which is used by getDefaultWireEncoding().
- Source:
Returns:
The WireFormat, which is only meaningful if the
getDefaultWireEncoding() is not isNull().
- Type
- WireFormat
getExclude() → {Exclude}
Get the exclude object.
- Source:
Returns:
The exclude object. If the exclude size() is zero, then
the exclude is not specified.
- Type
- Exclude
getForwardingHint() → {DelegationSet}
Get the forwarding hint object which you can modify to add or remove
forwarding hints.
- Source:
Returns:
The forwarding hint as a DelegationSet.
- Type
- DelegationSet
getIncomingFaceId() → {number}
Get the incoming face ID according to the incoming packet header.
- Source:
Returns:
The incoming face ID. If not specified, return null.
- Type
- number
getInterestLifetimeMilliseconds() → {number}
Get the interest lifetime.
- Source:
Returns:
The interest lifetime in milliseconds, or null if not
specified.
- Type
- number
getKeyLocator() → {KeyLocator}
Get the interest key locator.
- Source:
Returns:
The key locator. If its getType() is null,
then the key locator is not specified.
- Type
- KeyLocator
getLink() → {Link}
Get the link object. If necessary, decode it from the link wire encoding.
- Deprecated:
- Use getForwardingHint.
- Source:
Throws:
DecodingException For error decoding the link wire encoding (if
necessary).
Returns:
The link object, or null if not specified.
- Type
- Link
getLinkWireEncoding(wireFormat) → {Blob}
Get the wire encoding of the link object. If there is already a wire
encoding then return it. Otherwise encode from the link object (if
available).
Parameters:
Name | Type | Description |
---|---|---|
wireFormat |
WireFormat | (optional) A WireFormat object used to encode the Link. If omitted, use WireFormat.getDefaultWireFormat(). |
- Deprecated:
- Use getForwardingHint.
- Source:
Returns:
The wire encoding, or an isNull Blob if the link is not
specified.
- Type
- Blob
getMaxSuffixComponents() → {number}
Get the max suffix components.
- Source:
Returns:
The max suffix components, or null if not specified.
- Type
- number
getMinSuffixComponents() → {number}
Get the min suffix components.
- Source:
Returns:
The min suffix components, or null if not specified.
- Type
- number
getMustBeFresh() → {boolean}
Get the must be fresh flag. If not specified, the default is true.
- Source:
Returns:
The must be fresh flag.
- Type
- boolean
getName() → {Name}
Get the interest Name.
- Source:
Returns:
The name. The name size() may be 0 if not specified.
- Type
- Name
getNonce() → {Blob}
Return the nonce value from the incoming interest. If you change any of the
fields in this Interest object, then the nonce value is cleared.
- Source:
Returns:
The nonce. If not specified, the value isNull().
- Type
- Blob
getNonceAsBuffer()
- Deprecated:
- Use getNonce. This method returns a Buffer which is the former behavior of getNonce, and should only be used while updating your code.
- Source:
getSelectedDelegationIndex() → {number}
Get the selected delegation index.
- Deprecated:
- Use getForwardingHint.
- Source:
Returns:
The selected delegation index. If not specified, return null.
- Type
- number
hasLink() → {boolean}
Check if this interest has a link object (or a link wire encoding which
can be decoded to make the link object).
- Deprecated:
- Use getForwardingHint.
- Source:
Returns:
True if this interest has a link object, false if not.
- Type
- boolean
matches_name(name)
Parameters:
Name | Type | Description |
---|---|---|
name |
- Deprecated:
- Use matchesName.
- Source:
matchesData(data, wireFormat) → {boolean}
Check if the given Data packet can satisfy this Interest. This method
considers the Name, MinSuffixComponents, MaxSuffixComponents,
PublisherPublicKeyLocator, and Exclude. It does not consider the
ChildSelector or MustBeFresh. This uses the given wireFormat to get the
Data packet encoding for the full Name.
Parameters:
Name | Type | Description |
---|---|---|
data |
Data | The Data packet to check. |
wireFormat |
WireFormat | (optional) A WireFormat object used to encode the Data packet to get its full Name. If omitted, use WireFormat.getDefaultWireFormat(). |
- Source:
Returns:
True if the given Data packet can satisfy this Interest.
- Type
- boolean
matchesName(name) → {boolean}
Check if this interest's name matches the given name (using Name.match) and
the given name also conforms to the interest selectors.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The name to check. |
- Source:
Returns:
True if the name and interest selectors match, False otherwise.
- Type
- boolean
refreshNonce()
Update the bytes of the nonce with new random values. This ensures that the
new nonce value is different than the current one. If the current nonce is
not specified, this does nothing.
- Source:
setCanBePrefix(canBePrefix) → {Interest}
Set the CanBePrefix flag.
Parameters:
Name | Type | Description |
---|---|---|
canBePrefix |
boolean | True if the Interest name can be a prefix. If you do not set this flag, the default value is true. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setChildSelector(childSelector) → {Interest}
Set the child selector.
Parameters:
Name | Type | Description |
---|---|---|
childSelector |
number | The child selector. If not specified, set to undefined. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setExclude(exclude) → {Interest}
Set this interest to use a copy of the given exclude object. Note: You can
also call getExclude and change the exclude entries directly.
Parameters:
Name | Type | Description |
---|---|---|
exclude |
Exclude | The Exclude object. This makes a copy of the object. If no exclude is specified, set to a new default Exclude(), or to an Exclude with size() 0. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setForwardingHint(forwardingHint) → {Interest}
Set this interest to use a copy of the given DelegationSet object as the
forwarding hint.
Note: You can also call getForwardingHint and change the forwarding hint
directly.
Parameters:
Name | Type | Description |
---|---|---|
forwardingHint |
DelegationSet | The DelegationSet object to use as the forwarding hint. This makes a copy of the object. If no forwarding hint is specified, set to a new default DelegationSet() with no entries. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setInterestLifetimeMilliseconds(interestLifetimeMilliseconds) → {Interest}
Set the interest lifetime.
Parameters:
Name | Type | Description |
---|---|---|
interestLifetimeMilliseconds |
number | The interest lifetime in milliseconds. If not specified, set to undefined. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setKeyLocator(keyLocator) → {Interest}
Set this interest to use a copy of the given KeyLocator object.
Note: You can also call getKeyLocator and change the key locator directly.
Parameters:
Name | Type | Description |
---|---|---|
keyLocator |
KeyLocator | The KeyLocator object. This makes a copy of the object. If no key locator is specified, set to a new default KeyLocator(), or to a KeyLocator with an unspecified type. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setLinkWireEncoding(encoding, wireFormat) → {Interest}
Set the link wire encoding bytes, without decoding them. If there is
a link object, set it to null. If you later call getLink(), it will
decode the wireEncoding to create the link object.
Parameters:
Name | Type | Description |
---|---|---|
encoding |
Blob | The Blob with the bytes of the link wire encoding. If no link is specified, set to an empty Blob() or call unsetLink(). |
wireFormat |
WireFormat | The wire format of the encoding, to be used later if necessary to decode. If omitted, use WireFormat.getDefaultWireFormat(). |
- Deprecated:
- Use setForwardingHint.
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setLpPacket(lpPacket) → {Interest}
An internal library method to set the LpPacket for an incoming packet. The
application should not call this.
Parameters:
Name | Type | Description |
---|---|---|
lpPacket |
LpPacket | The LpPacket. This does not make a copy. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setMaxSuffixComponents(maxSuffixComponents) → {Interest}
Set the max suffix components count.
Parameters:
Name | Type | Description |
---|---|---|
maxSuffixComponents |
number | The max suffix components count. If not specified, set to undefined. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setMinSuffixComponents(minSuffixComponents) → {Interest}
Set the min suffix components count.
Parameters:
Name | Type | Description |
---|---|---|
minSuffixComponents |
number | The min suffix components count. If not specified, set to undefined. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setMustBeFresh(mustBeFresh) → {Interest}
Set the MustBeFresh flag.
Parameters:
Name | Type | Description |
---|---|---|
mustBeFresh |
boolean | True if the content must be fresh, otherwise false. If you do not set this flag, the default value is true. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setName(name) → {Interest}
Set the interest name.
Note: You can also call getName and change the name values directly.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The interest name. This makes a copy of the name. |
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
setNonce()
- Deprecated:
- You should let the wire encoder generate a random nonce internally before sending the interest.
- Source:
setSelectedDelegationIndex(selectedDelegationIndex) → {Interest}
Set the selected delegation index.
Parameters:
Name | Type | Description |
---|---|---|
selectedDelegationIndex |
number | The selected delegation index. If not specified, set to null. |
- Deprecated:
- Use setForwardingHint.
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
toUri() → {string}
Encode the name according to the "NDN URI Scheme". If there are interest selectors, append "?" and
added the selectors as a query string. For example "/test/name?ndn.ChildSelector=1".
Note: This is an experimental feature. See the API docs for more detail at
http://named-data.net/doc/ndn-ccl-api/interest.html#interest-touri-method .
- Source:
Returns:
The URI string.
- Type
- string
unsetLink() → {Interest}
Clear the link wire encoding and link object so that getLink() returns null.
- Deprecated:
- Use setForwardingHint.
- Source:
Returns:
This Interest so that you can chain calls to update values.
- Type
- Interest
wireDecode(input, wireFormat)
Decode the input using a particular wire format and update this Interest. If
wireFormat is the default wire format, also set the defaultWireEncoding to
another pointer to the input.
Parameters:
Name | Type | Description |
---|---|---|
input |
Blob | Buffer | The buffer with the bytes to decode. |
wireFormat |
WireFormat | (optional) A WireFormat object used to decode this object. If omitted, use WireFormat.getDefaultWireFormat(). |
- Source:
wireEncode(wireFormat) → {SignedBlob}
Encode this Interest for a particular wire format. If wireFormat is the
default wire format, also set the defaultWireEncoding field to the encoded
result.
Parameters:
Name | Type | Description |
---|---|---|
wireFormat |
WireFormat | (optional) A WireFormat object used to encode this object. If omitted, use WireFormat.getDefaultWireFormat(). |
- Source:
Returns:
The encoded buffer in a SignedBlob object.
- Type
- SignedBlob