@wildboar/copp
Version:
Connection-oriented presentation protocol (COPP) data structures and business logic in TypeScript
46 lines (45 loc) • 1.96 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass, } from '@wildboar/asn1';
import * as $ from '@wildboar/asn1/functional';
import { _decode_ARU_PPDU_x400_mode_parameters, _encode_ARU_PPDU_x400_mode_parameters, } from '../ISO8823-PRESENTATION/ARU-PPDU-x400-mode-parameters.ta.mjs';
import { _decode_ARU_PPDU_normal_mode_parameters, _encode_ARU_PPDU_normal_mode_parameters, } from '../ISO8823-PRESENTATION/ARU-PPDU-normal-mode-parameters.ta.mjs';
let _cached_decoder_for_ARU_PPDU = null;
/**
* @summary Decodes an ASN.1 element into a(n) ARU_PPDU
* @function
* @param {_Element} el The element being decoded.
* @returns {ARU_PPDU} The decoded data structure.
*/
export function _decode_ARU_PPDU(el) {
if (!_cached_decoder_for_ARU_PPDU) {
_cached_decoder_for_ARU_PPDU = $._decode_inextensible_choice({
'UNIVERSAL 17': [
'x400_mode_parameters',
_decode_ARU_PPDU_x400_mode_parameters,
],
'CONTEXT 0': [
'normal_mode_parameters',
$._decode_implicit(() => _decode_ARU_PPDU_normal_mode_parameters),
],
});
}
return _cached_decoder_for_ARU_PPDU(el);
}
let _cached_encoder_for_ARU_PPDU = null;
/**
* @summary Encodes a(n) ARU_PPDU 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 ARU_PPDU, encoded as an ASN.1 Element.
*/
export function _encode_ARU_PPDU(value, elGetter) {
if (!_cached_encoder_for_ARU_PPDU) {
_cached_encoder_for_ARU_PPDU = $._encode_choice({
x400_mode_parameters: _encode_ARU_PPDU_x400_mode_parameters,
normal_mode_parameters: $._encode_implicit(_TagClass.context, 0, () => _encode_ARU_PPDU_normal_mode_parameters, $.BER),
}, $.BER);
}
return _cached_encoder_for_ARU_PPDU(value, elGetter);
}
/* eslint-enable */