@wildboar/rose
Version:
Remote Operation Service Element PDUs in TypeScript
49 lines (48 loc) • 1.78 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass, } from '@wildboar/asn1';
import * as $ from '@wildboar/asn1/functional';
let _cached_decoder_for_Unbind = null;
/**
* @summary Decodes an ASN.1 element into a(n) Unbind
* @function
* @param {_Element} el The element being decoded.
* @returns {Unbind} The decoded data structure.
*/
export function _decode_Unbind(el) {
if (!_cached_decoder_for_Unbind) {
_cached_decoder_for_Unbind = $._decode_inextensible_choice({
'CONTEXT 19': [
'unbind_invoke',
$._decode_explicit(() => $._decodeAny),
],
'CONTEXT 20': [
'unbind_result',
$._decode_explicit(() => $._decodeAny),
],
'CONTEXT 21': [
'unbind_error',
$._decode_explicit(() => $._decodeAny),
],
});
}
return _cached_decoder_for_Unbind(el);
}
let _cached_encoder_for_Unbind = null;
/**
* @summary Encodes a(n) Unbind 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 Unbind, encoded as an ASN.1 Element.
*/
export function _encode_Unbind(value, elGetter) {
if (!_cached_encoder_for_Unbind) {
_cached_encoder_for_Unbind = $._encode_choice({
unbind_invoke: $._encode_explicit(_TagClass.context, 19, () => $._encodeAny, $.BER),
unbind_result: $._encode_explicit(_TagClass.context, 20, () => $._encodeAny, $.BER),
unbind_error: $._encode_explicit(_TagClass.context, 21, () => $._encodeAny, $.BER),
}, $.BER);
}
return _cached_encoder_for_Unbind(value, elGetter);
}
/* eslint-enable */