ndn_Error ndn_Tlv0_2WireFormat_encodeEncryptedContent (const struct ndn_EncryptedContent *encryptedContent, struct ndn_DynamicUInt8Array *output, size_t *encodingLength) { ndn_Error error; struct ndn_TlvEncoder encoder; ndn_TlvEncoder_initialize(&encoder, output); error = ndn_encodeTlvEncryptedContent(encryptedContent, &encoder); *encodingLength = encoder.offset; return error; }
ndn_Error ndn_Tlv0_2WireFormat_encodeSignatureInfo (const struct ndn_Signature *signature, struct ndn_DynamicUInt8Array *output, size_t *encodingLength) { ndn_Error error; struct ndn_TlvEncoder encoder; ndn_TlvEncoder_initialize(&encoder, output); error = ndn_encodeTlvSignatureInfo(signature, &encoder); *encodingLength = encoder.offset; return error; }
ndn_Error ndn_Tlv0_2WireFormat_encodeControlResponse (const struct ndn_ControlResponse *controlResponse, struct ndn_DynamicUInt8Array *output, size_t *encodingLength) { ndn_Error error; struct ndn_TlvEncoder encoder; ndn_TlvEncoder_initialize(&encoder, output); error = ndn_encodeTlvControlResponse(controlResponse, &encoder); *encodingLength = encoder.offset; return error; }
ndn_Error ndn_Tlv0_2WireFormat_encodeSignatureValue (const struct ndn_Signature *signature, struct ndn_DynamicUInt8Array *output, size_t *encodingLength) { ndn_Error error; struct ndn_TlvEncoder encoder; ndn_TlvEncoder_initialize(&encoder, output); error = ndn_TlvEncoder_writeBlobTlv (&encoder, ndn_Tlv_SignatureValue, &signature->signature); *encodingLength = encoder.offset; return error; }
ndn_Error ndn_Tlv0_2WireFormat_encodeData (const struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_DynamicUInt8Array *output, size_t *encodingLength) { ndn_Error error; struct ndn_TlvEncoder encoder; ndn_TlvEncoder_initialize(&encoder, output); error = ndn_encodeTlvData (data, signedPortionBeginOffset, signedPortionEndOffset, &encoder); *encodingLength = encoder.offset; return error; }
ndn_Error ndn_Tlv0_2WireFormat_encodeDelegationSet_Delegation (const struct ndn_DelegationSet_Delegation *delegation, struct ndn_DynamicUInt8Array *output, size_t offset, size_t *encodingLength) { ndn_Error error; struct ndn_TlvEncoder encoder; ndn_TlvEncoder_initialize(&encoder, output); if ((error = ndn_TlvEncoder_seek(&encoder, offset))) return error; error = ndn_encodeTlvDelegationSet_Delegation(delegation, &encoder); *encodingLength = encoder.offset - offset; return error; }
/** * Initialize the base ndn_TlvEncoder struct with the initialLength. Use simpleRealloc. * @param initialLength The initial size of the output. If omitted, use 16. */ TlvEncoder(size_t initialLength = 16) : output_(16) { ndn_TlvEncoder_initialize(this, &output_); }