@wildboar/copp
Version:
Connection-oriented presentation protocol (COPP) data structures and business logic in TypeScript
49 lines (48 loc) • 2.18 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass, } from '@wildboar/asn1';
import * as $ from '@wildboar/asn1/functional';
let _cached_decoder_for_PDV_list_presentation_data_values = null;
/**
* @summary Decodes an ASN.1 element into a(n) PDV_list_presentation_data_values
* @function
* @param {_Element} el The element being decoded.
* @returns {PDV_list_presentation_data_values} The decoded data structure.
*/
export function _decode_PDV_list_presentation_data_values(el) {
if (!_cached_decoder_for_PDV_list_presentation_data_values) {
_cached_decoder_for_PDV_list_presentation_data_values = $._decode_inextensible_choice({
'CONTEXT 0': [
'single_ASN1_type',
$._decode_explicit(() => $._decodeAny),
],
'CONTEXT 1': [
'octet_aligned',
$._decode_implicit(() => $._decodeOctetString),
],
'CONTEXT 2': [
'arbitrary',
$._decode_implicit(() => $._decodeBitString),
],
});
}
return _cached_decoder_for_PDV_list_presentation_data_values(el);
}
let _cached_encoder_for_PDV_list_presentation_data_values = null;
/**
* @summary Encodes a(n) PDV_list_presentation_data_values into an ASN.1 Element.
* @function
* @param value The element being encoded.
* @param elGetter A function that can be used to get new ASN.1 elements.
* @returns {_Element} The PDV_list_presentation_data_values, encoded as an ASN.1 Element.
*/
export function _encode_PDV_list_presentation_data_values(value, elGetter) {
if (!_cached_encoder_for_PDV_list_presentation_data_values) {
_cached_encoder_for_PDV_list_presentation_data_values = $._encode_choice({
single_ASN1_type: $._encode_explicit(_TagClass.context, 0, () => $._encodeAny, $.BER),
octet_aligned: $._encode_implicit(_TagClass.context, 1, () => $._encodeOctetString, $.BER),
arbitrary: $._encode_implicit(_TagClass.context, 2, () => $._encodeBitString, $.BER),
}, $.BER);
}
return _cached_encoder_for_PDV_list_presentation_data_values(value, elGetter);
}
/* eslint-enable */