@wildboar/rose
Version:
Remote Operation Service Element PDUs in TypeScript
36 lines (35 loc) • 1.23 kB
JavaScript
import * as $ from '@wildboar/asn1/functional';
let _cached_decoder_for_InvokeId = null;
/**
* @summary Decodes an ASN.1 element into a(n) InvokeId
* @function
* @param {_Element} el The element being decoded.
* @returns {InvokeId} The decoded data structure.
*/
export function _decode_InvokeId(el) {
if (!_cached_decoder_for_InvokeId) {
_cached_decoder_for_InvokeId = $._decode_inextensible_choice({
'UNIVERSAL 2': ['present', $._decodeInteger],
'UNIVERSAL 5': ['absent', $._decodeNull],
});
}
return _cached_decoder_for_InvokeId(el);
}
let _cached_encoder_for_InvokeId = null;
/**
* @summary Encodes a(n) InvokeId 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 InvokeId, encoded as an ASN.1 Element.
*/
export function _encode_InvokeId(value, elGetter) {
if (!_cached_encoder_for_InvokeId) {
_cached_encoder_for_InvokeId = $._encode_choice({
present: $._encodeInteger,
absent: $._encodeNull,
}, $.BER);
}
return _cached_encoder_for_InvokeId(value, elGetter);
}
/* eslint-enable */