Class: WireFormat

WireFormat

new WireFormat()

Create a WireFormat base class where the encode and decode methods throw an error. You should use a derived class like TlvWireFormat.
Source:

Methods

(static) getDefaultWireFormat() → {WireFormat}

Return the default WireFormat used by default encoding and decoding methods which was set with setDefaultWireFormat.
Source:
Returns:
An object of a subclass of WireFormat.
Type
WireFormat

(static) setDefaultWireFormat(wireFormat)

Set the static default WireFormat used by default encoding and decoding methods.
Parameters:
Name Type Description
wireFormat WireFormat An object of a subclass of WireFormat.
Source:

decodeControlParameters(controlParameters, input)

Decode input as a controlParameters and set the fields of the controlParameters object. Your derived class should override.
Parameters:
Name Type Description
controlParameters ControlParameters The ControlParameters object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.

decodeControlResponse(controlResponse, input)

Decode input as a controlResponse and set the fields of the controlResponse object. Your derived class should override.
Parameters:
Name Type Description
controlResponse ControlResponse The ControlResponse object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.

decodeData(data, input) → {object}

Decode input as a data packet, set the fields in the data object, and return the signed offsets. Your derived class should override.
Parameters:
Name Type Description
data Data The Data object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
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)

Decode input as an DelegationSet and set the fields of the delegationSet object. Your derived class should override.
Parameters:
Name Type Description
delegationSet DelegationSet The DelegationSet object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.

decodeEncryptedContent(encryptedContent, input)

Decode input as an EncryptedContent and set the fields of the encryptedContent object. Your derived class should override.
Parameters:
Name Type Description
encryptedContent EncryptedContent The EncryptedContent object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.

decodeInterest(interest, input) → {object}

Decode input as an interest and set the fields of the interest object. Your derived class should override.
Parameters:
Name Type Description
interest Interest The Interest object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
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

decodeLpPacket(lpPacket, input)

Decode input as an NDN-TLV LpPacket and set the fields of the lpPacket object. Your derived class should override.
Parameters:
Name Type Description
lpPacket LpPacket The LpPacket object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.

decodeName(name, input)

Decode input as a name and set the fields of the Name object. Your derived class should override.
Parameters:
Name Type Description
name Name The Name object whose fields are updated.
input Buffer The buffer with the bytes to decode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.

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. Your derived class should override.
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.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
Returns:
A new object which is a subclass of Signature.
Type
Signature

encodeControlParameters(controlParameters) → {Blob}

Encode controlParameters and return the encoding. Your derived class should override.
Parameters:
Name Type Description
controlParameters ControlParameters The ControlParameters object to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
Returns:
A Blob containing the encoding.
Type
Blob

encodeControlResponse(controlResponse) → {Blob}

Encode controlResponse and return the encoding. Your derived class should override.
Parameters:
Name Type Description
controlResponse ControlResponse The ControlResponse object to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
Returns:
A Blob containing the encoding.
Type
Blob

encodeData(data) → {object}

Encode data and return the encoding and signed offsets. Your derived class should override.
Parameters:
Name Type Description
data Data The Data object to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
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 the DelegationSet and return the encoding. Your derived class should override.
Parameters:
Name Type Description
delegationSet DelegationSet The DelegationSet object to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
Returns:
A Blob containing the encoding.
Type
Blob

encodeEncryptedContent(encryptedContent) → {Blob}

Encode the EncryptedContent and return the encoding. Your derived class should override.
Parameters:
Name Type Description
encryptedContent EncryptedContent The EncryptedContent object to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
Returns:
A Blob containing the encoding.
Type
Blob

encodeInterest(interest) → {object}

Encode interest and return the encoding. Your derived class should override.
Parameters:
Name Type Description
interest Interest The Interest to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
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) → {Blob}

Encode name and return the encoding. Your derived class should override.
Parameters:
Name Type Description
name Name The Name to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
Returns:
A Blob containing the encoding.
Type
Blob

encodeSignatureInfo(signature) → {Blob}

Encode signature as a SignatureInfo and return the encoding. Your derived class should override.
Parameters:
Name Type Description
signature Signature An object of a subclass of Signature to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
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. Your derived class should override.
Parameters:
Name Type Description
signature Signature An object of a subclass of Signature with the signature value to encode.
Source:
Throws:
Error This always throws an "unimplemented" error. The derived class should override.
Returns:
A Blob containing the encoding.
Type
Blob