@wildboar/acse
Version:
Association Control Service Element PDUs in TypeScript
55 lines (54 loc) • 2.38 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass, } from '@wildboar/asn1';
import * as $ from '@wildboar/asn1/functional';
import { _decode_Authentication_value_other, _encode_Authentication_value_other, } from '../ACSE-1/Authentication-value-other.ta.mjs';
let _cached_decoder_for_Authentication_value = null;
/**
* @summary Decodes an ASN.1 element into a(n) Authentication_value
* @function
* @param {_Element} el The element being decoded.
* @returns {Authentication_value} The decoded data structure.
*/
export function _decode_Authentication_value(el) {
if (!_cached_decoder_for_Authentication_value) {
_cached_decoder_for_Authentication_value = $._decode_inextensible_choice({
'CONTEXT 0': [
'charstring',
$._decode_implicit(() => $._decodeGraphicString),
],
'CONTEXT 1': [
'bitstring',
$._decode_implicit(() => $._decodeBitString),
],
'CONTEXT 2': [
'external',
$._decode_implicit(() => $._decodeExternal),
],
'CONTEXT 3': [
'other',
$._decode_implicit(() => _decode_Authentication_value_other),
],
});
}
return _cached_decoder_for_Authentication_value(el);
}
let _cached_encoder_for_Authentication_value = null;
/**
* @summary Encodes a(n) Authentication_value 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 Authentication_value, encoded as an ASN.1 Element.
*/
export function _encode_Authentication_value(value, elGetter) {
if (!_cached_encoder_for_Authentication_value) {
_cached_encoder_for_Authentication_value = $._encode_choice({
charstring: $._encode_implicit(_TagClass.context, 0, () => $._encodeGraphicString, $.BER),
bitstring: $._encode_implicit(_TagClass.context, 1, () => $._encodeBitString, $.BER),
external: $._encode_implicit(_TagClass.context, 2, () => $._encodeExternal, $.BER),
other: $._encode_implicit(_TagClass.context, 3, () => _encode_Authentication_value_other, $.BER),
}, $.BER);
}
return _cached_encoder_for_Authentication_value(value, elGetter);
}
/* eslint-enable */