new Tlv0_2WireFormat()
A Tlv0_2WireFormat implements the WireFormat interface for encoding and
decoding with the NDN-TLV wire format, version 0.2.
- Source:
Methods
(static) decodeDelegationSet_(delegationSet, endOffset, decoder, copy)
Decode input as a sequence of NDN-TLV Delegation and set the fields of the
delegationSet object. Note that the sequence of Delegation does not have an
outer TLV type and length because (when used in a Link object) it is intended
to use the type and length of a Data packet's Content.
Parameters:
Name | Type | Description |
---|---|---|
delegationSet |
DelegationSet | The DelegationSet object whose fields are updated. |
endOffset |
number | Decode elements up to endOffset in the input. This does not call finishNestedTlvs. |
decoder |
TlvDecoder | The decoder with the input to decode. |
copy |
boolean | If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. |
- Source:
(static) decodeInterestV03_(interest, input, copy) → {object}
Decode input as an Interest in NDN-TLV format v0.3 and set the fields of
the Interest object. This private method is called if the main decodeInterest
fails to decode as v0.2. This ignores HopLimit and Parameters, and interprets
CanBePrefix using MaxSuffixComponents.
Parameters:
Name | Type | Description |
---|---|---|
interest |
Interest | The Interest object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
Returns:
An associative array with fields
(signedPortionBeginOffset, signedPortionEndOffset) where
signedPortionBeginOffset is the offset in the encoding of the beginning of
the signed portion, and signedPortionEndOffset is the offset in the encoding
of the end of the signed portion. The signed portion starts from the first
name component and ends just before the final name component (which is
assumed to be a signature for a signed interest).
- Type
- object
(static) decodeName(name, decoder) → {object}
Clear the name, decode a Name from the decoder and set the fields of the name
object.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The name object whose fields are updated. |
decoder |
TlvDecoder | The decoder with the input. |
- Source:
Returns:
An associative array with fields
(signedPortionBeginOffset, signedPortionEndOffset) where
signedPortionBeginOffset is the offset in the encoding of the beginning of
the signed portion, and signedPortionEndOffset is the offset in the encoding
of the end of the signed portion. The signed portion starts from the first
name component and ends just before the final name component (which is
assumed to be a signature for a signed interest).
- Type
- object
(static) decodeNameComponent(decoder, copy) → {Name.Component}
Decode the name component as NDN-TLV and return the component. This handles
different component types such as ImplicitSha256DigestComponent.
Parameters:
Name | Type | Description |
---|---|---|
decoder |
TlvDecoder | The decoder with the input. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
Returns:
A new Name.Component.
- Type
- Name.Component
(static) encodeDelegationSet_(delegationSet, encoder)
Encode delegationSet to the encoder as a sequence of NDN-TLV Delegation.
Note that the sequence of Delegation does not have an outer TLV type and
length because (when used in a Link object) it is intended to use the type
and length of a Data packet's Content.
Parameters:
Name | Type | Description |
---|---|---|
delegationSet |
DelegationSet | The DelegationSet object to encode. |
encoder |
TlvEncoder | The TlvEncoder to receive the encoding. |
- Source:
(static) encodeName(name, encoder) → {object}
Encode the name to the encoder.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The name to encode. |
encoder |
TlvEncoder | The encoder to receive the encoding. |
- Source:
Returns:
An associative array with fields
(signedPortionBeginOffset, signedPortionEndOffset) where
signedPortionBeginOffset is the offset in the encoding of the beginning of
the signed portion, and signedPortionEndOffset is the offset in the encoding
of the end of the signed portion. The signed portion starts from the first
name component and ends just before the final name component (which is
assumed to be a signature for a signed interest).
- Type
- object
(static) encodeNameComponent(component, encoder)
Encode the name component to the encoder as NDN-TLV. This handles different
component types such as ImplicitSha256DigestComponent.
Parameters:
Name | Type | Description |
---|---|---|
component |
Name.Component | The name component to encode. |
encoder |
TlvEncoder | The encoder to receive the encoding. |
- Source:
(static) encodeSelectors()
Encode the interest selectors. If no selectors are written, do not output a
Selectors TLV.
- Source:
(static) encodeSignatureInfo_(signature, encoder)
An internal method to encode signature as the appropriate form of
SignatureInfo in NDN-TLV.
Parameters:
Name | Type | Description |
---|---|---|
signature |
Signature | An object of a subclass of Signature to encode. |
encoder |
TlvEncoder | The encoder. |
- Source:
(static) get() → {Tlv0_2WireFormat}
Get a singleton instance of a Tlv0_2WireFormat. To always use the
preferred version NDN-TLV, you should use TlvWireFormat.get().
- Source:
Returns:
The singleton instance.
- Type
- Tlv0_2WireFormat
decodeControlParameters(controlParameters, input, copy)
Decode controlParameters in NDN-TLV and set the fields of the
controlParameters object.
Parameters:
Name | Type | Description |
---|---|---|
controlParameters |
ControlParameters | The ControlParameters object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
Throws:
DecodingException For invalid encoding
decodeControlResponse(controlResponse, input, copy)
Decode controlResponse in NDN-TLV and set the fields of the controlResponse
object
Parameters:
Name | Type | Description |
---|---|---|
controlResponse |
ControlResponse | The ControlResponse object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
Throws:
DecodingException For invalid encoding
decodeData(data, input, copy) → {object}
Decode input as an NDN-TLV data packet, set the fields in the data object,
and return the signed offsets.
Parameters:
Name | Type | Description |
---|---|---|
data |
Data | The Data object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
Returns:
An associative array with fields
(signedPortionBeginOffset, signedPortionEndOffset) where
signedPortionBeginOffset is the offset in the encoding of the beginning of
the signed portion, and signedPortionEndOffset is the offset in the encoding
of the end of the signed portion.
- Type
- object
decodeDelegationSet(delegationSet, input, copy)
Decode input as a sequence of NDN-TLV Delegation and set the fields of the
delegationSet object. Note that the sequence of Delegation does not have an
outer TLV type and length because it is intended to use the type and length
of a Data packet's Content. This ignores any elements after the sequence
of Delegation.
Parameters:
Name | Type | Description |
---|---|---|
delegationSet |
DelegationSet | The DelegationSet object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
decodeEncryptedContent(encryptedContent, input, copy)
Decode input as an EncryptedContent in NDN-TLV and set the fields of the
encryptedContent object.
Parameters:
Name | Type | Description |
---|---|---|
encryptedContent |
EncryptedContent | The EncryptedContent object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
decodeInterest(interest, input, copy) → {object}
Decode input as an NDN-TLV interest and set the fields of the interest
object.
Parameters:
Name | Type | Description |
---|---|---|
interest |
Interest | The Interest object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
Returns:
An associative array with fields
(signedPortionBeginOffset, signedPortionEndOffset) where
signedPortionBeginOffset is the offset in the encoding of the beginning of
the signed portion, and signedPortionEndOffset is the offset in the encoding
of the end of the signed portion. The signed portion starts from the first
name component and ends just before the final name component (which is
assumed to be a signature for a signed interest).
- Type
- object
decodeInterestV02_()
Do the work of decodeInterest to decode strictly as format v0.2.
- Source:
decodeLpPacket(lpPacket, input, copy)
Decode input as an NDN-TLV LpPacket and set the fields of the lpPacket object.
Parameters:
Name | Type | Description |
---|---|---|
lpPacket |
LpPacket | The LpPacket object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
decodeName(name, input, copy)
Decode input as a NDN-TLV name and set the fields of the Name object.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The Name object whose fields are updated. |
input |
Buffer | The buffer with the bytes to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
decodeSignatureInfoAndValue(signatureInfo, signatureValue, copy) → {Signature}
Decode signatureInfo as an NDN-TLV SignatureInfo and signatureValue as the
related SignatureValue, and return a new object which is a subclass of Signature.
Parameters:
Name | Type | Description |
---|---|---|
signatureInfo |
Buffer | The buffer with the signature info bytes to decode. |
signatureValue |
Buffer | The buffer with the signature value to decode. |
copy |
boolean | (optional) If true, copy from the input when making new Blob values. If false, then Blob values share memory with the input, which must remain unchanged while the Blob values are used. If omitted, use true. |
- Source:
Returns:
A new object which is a subclass of Signature.
- Type
- Signature
encodeControlParameters(controlParameters) → {Blob}
Encode controlParameters as NDN-TLV and return the encoding.
Parameters:
Name | Type | Description |
---|---|---|
controlParameters |
ControlParameters | The ControlParameters object to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blob
encodeControlResponse(controlResponse) → {Blob}
Encode controlResponse as NDN-TLV and return the encoding.
Parameters:
Name | Type | Description |
---|---|---|
controlResponse |
ControlResponse | The ControlResponse object to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blob
encodeData(data) → {object}
Encode data as NDN-TLV and return the encoding and signed offsets.
Parameters:
Name | Type | Description |
---|---|---|
data |
Data | The Data object to encode. |
- Source:
Returns:
An associative array with fields
(encoding, signedPortionBeginOffset, signedPortionEndOffset) where encoding
is a Blob containing the encoding, signedPortionBeginOffset is the offset in
the encoding of the beginning of the signed portion, and
signedPortionEndOffset is the offset in the encoding of the end of the
signed portion.
- Type
- object
encodeDelegationSet(delegationSet) → {Blob}
Encode delegationSet as a sequence of NDN-TLV Delegation, and return the
encoding. Note that the sequence of Delegation does not have an outer TLV
type and length because it is intended to use the type and length of a Data
packet's Content.
Parameters:
Name | Type | Description |
---|---|---|
delegationSet |
DelegationSet | The DelegationSet object to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blob
encodeEncryptedContent(encryptedContent) → {Blob}
Encode the EncryptedContent in NDN-TLV and return the encoding.
Parameters:
Name | Type | Description |
---|---|---|
encryptedContent |
EncryptedContent | The EncryptedContent object to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blob
encodeInterest(interest) → {object}
Encode the interest using NDN-TLV and return a Buffer.
Parameters:
Name | Type | Description |
---|---|---|
interest |
Interest | The Interest object to encode. |
- Source:
Returns:
An associative array with fields
(encoding, signedPortionBeginOffset, signedPortionEndOffset) where encoding
is a Blob containing the encoding, signedPortionBeginOffset is the offset in
the encoding of the beginning of the signed portion, and
signedPortionEndOffset is the offset in the encoding of the end of the signed
portion. The signed portion starts from the first name component and ends
just before the final name component (which is assumed to be a signature for
a signed interest).
- Type
- object
encodeName(name) → {Blobl}
Encode name as an NDN-TLV Name and return the encoding.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The Name to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blobl
encodeSignatureInfo(signature) → {Blob}
Encode signature as an NDN-TLV SignatureInfo and return the encoding.
Parameters:
Name | Type | Description |
---|---|---|
signature |
Signature | An object of a subclass of Signature to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blob
encodeSignatureValue(signature) → {Blob}
Encode the signatureValue in the Signature object as an NDN-TLV
SignatureValue (the signature bits) and return the encoding.
Parameters:
Name | Type | Description |
---|---|---|
signature |
Signature | An object of a subclass of Signature with the signature value to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blob