@wildboar/acse
Version:
Association Control Service Element PDUs in TypeScript
38 lines (37 loc) • 1.49 kB
JavaScript
import * as $ from '@wildboar/asn1/functional';
import { _decode_AE_title_form1, _encode_AE_title_form1, } from '../ACSE-1/AE-title-form1.ta.mjs';
import { _decode_AE_title_form2, _encode_AE_title_form2, } from '../ACSE-1/AE-title-form2.ta.mjs';
let _cached_decoder_for_AE_title = null;
/**
* @summary Decodes an ASN.1 element into a(n) AE_title
* @function
* @param {_Element} el The element being decoded.
* @returns {AE_title} The decoded data structure.
*/
export function _decode_AE_title(el) {
if (!_cached_decoder_for_AE_title) {
_cached_decoder_for_AE_title = $._decode_extensible_choice({
'UNIVERSAL 16': ['ae_title_form1', _decode_AE_title_form1],
'UNIVERSAL 6': ['ae_title_form2', _decode_AE_title_form2],
});
}
return _cached_decoder_for_AE_title(el);
}
let _cached_encoder_for_AE_title = null;
/**
* @summary Encodes a(n) AE_title 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 AE_title, encoded as an ASN.1 Element.
*/
export function _encode_AE_title(value, elGetter) {
if (!_cached_encoder_for_AE_title) {
_cached_encoder_for_AE_title = $._encode_choice({
ae_title_form1: _encode_AE_title_form1,
ae_title_form2: _encode_AE_title_form2,
}, $.BER);
}
return _cached_encoder_for_AE_title(value, elGetter);
}
/* eslint-enable */