new Tlv0_1_1WireFormat()
A Tlv0_1_1WireFormat implements the WireFormat interface for encoding and
decoding with the NDN-TLV wire format, version 0.1.1.
- Source:
Methods
(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. |
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) 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. |
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) encodeSelectors()
Encode the interest selectors. If no selectors are written, do not output a
Selectors TLV.
(static) encodeSignatureInfo_(signature, encoder, keyLocator)
An internal method to encode signature as the appropriate form of
SignatureInfo in NDN-TLV. Use the given keyLocator instead of the
locator in this object.
Parameters:
| Name | Type | Description |
|---|---|---|
signature |
Signature | An object of a subclass of Signature to encode. |
encoder |
TlvEncoder | The encoder. |
keyLocator |
KeyLocator | The key locator to use (from Data.getSignatureOrMetaInfoKeyLocator). This may be null if the signature does not support a KeyLocator. |
(static) get() → {Tlv0_1_1WireFormat}
Get a singleton instance of a Tlv0_1_1WireFormat. To always use the
preferred version NDN-TLV, you should use TlvWireFormat.get().
Returns:
The singleton instance.
- Type
- Tlv0_1_1WireFormat
decodeControlParameters(controlParameters, input)
Decode controlParameters in NDN-TLV and return the encoding.
Parameters:
| Name | Type | Description |
|---|---|---|
controlParameters |
The ControlParameters object to encode. | |
input |
Throws:
EncodingException For invalid encoding
decodeData(data, input) → {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. |
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
decodeInterest(interest, input) → {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. |
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
decodeName(name, input)
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. |
- Source:
decodeSignatureInfoAndValue(signatureInfo, signatureValue) → {Signature}
Decode signatureInfo as a signature info 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. |
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. |
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. |
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
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(interest) → {Blobl}
Encode interest as NDN-TLV and return the encoding.
Parameters:
| Name | Type | Description |
|---|---|---|
interest |
Name | The Name to encode. |
- Source:
Returns:
A Blob containing the encoding.
- Type
- Blobl
encodeSignatureInfo(signature) → {Blob}
Encode signature as a SignatureInfo and return the encoding.
Parameters:
| Name | Type | Description |
|---|---|---|
signature |
Signature | An object of a subclass of Signature to encode. |
Returns:
A Blob containing the encoding.
- Type
- Blob
encodeSignatureValue(signature) → {Blob}
Encode the signatureValue in the Signature object as a 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. |
Returns:
A Blob containing the encoding.
- Type
- Blob