UNPKG

@wildboar/copp

Version:

Connection-oriented presentation protocol (COPP) data structures and business logic in TypeScript

135 lines (134 loc) 5.21 kB
/* eslint-disable */ import { ASN1TagClass as _TagClass, } from '@wildboar/asn1'; import * as $ from '@wildboar/asn1/functional'; import { _decode_RefuseReason, _encode_RefuseReason, } from '@wildboar/rtse'; /** * @summary CPR_PPDU_x400_mode_parameters * @description * * ### ASN.1 Definition: * * ```asn1 * CPR-PPDU-x400-mode-parameters ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- } * ``` * */ export class CPR_PPDU_x400_mode_parameters { refuseReason; userDataRJ; constructor( /** * @summary `refuseReason`. * @public * @readonly */ refuseReason /* REPLICATED_COMPONENT */, /** * @summary `userDataRJ`. * @public * @readonly */ userDataRJ /* REPLICATED_COMPONENT */) { this.refuseReason = refuseReason; this.userDataRJ = userDataRJ; } /** * @summary Restructures an object into a CPR_PPDU_x400_mode_parameters * @description * * This takes an `object` and converts it to a `CPR_PPDU_x400_mode_parameters`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `CPR_PPDU_x400_mode_parameters`. * @returns {CPR_PPDU_x400_mode_parameters} */ static _from_object(_o) { return new CPR_PPDU_x400_mode_parameters(_o.refuseReason, _o.userDataRJ); } } /** * @summary The Leading Root Component Types of CPR_PPDU_x400_mode_parameters * @description * * This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE. * * @constant */ export const _root_component_type_list_1_spec_for_CPR_PPDU_x400_mode_parameters = [ new $.ComponentSpec('refuseReason', true, $.hasTag(_TagClass.context, 0)), new $.ComponentSpec('userDataRJ', true, $.hasTag(_TagClass.context, 1)), ]; /** * @summary The Trailing Root Component Types of CPR_PPDU_x400_mode_parameters * @description * * This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE. * * @constant */ export const _root_component_type_list_2_spec_for_CPR_PPDU_x400_mode_parameters = []; /** * @summary The Extension Addition Component Types of CPR_PPDU_x400_mode_parameters * @description * * This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE. * * @constant */ export const _extension_additions_list_spec_for_CPR_PPDU_x400_mode_parameters = []; let _cached_decoder_for_CPR_PPDU_x400_mode_parameters = null; /** * @summary Decodes an ASN.1 element into a(n) CPR_PPDU_x400_mode_parameters * @function * @param {_Element} el The element being decoded. * @returns {CPR_PPDU_x400_mode_parameters} The decoded data structure. */ export function _decode_CPR_PPDU_x400_mode_parameters(el) { if (!_cached_decoder_for_CPR_PPDU_x400_mode_parameters) { _cached_decoder_for_CPR_PPDU_x400_mode_parameters = function (el) { /* START_OF_SET_COMPONENT_DECLARATIONS */ let refuseReason; let userDataRJ; /* END_OF_SET_COMPONENT_DECLARATIONS */ const callbacks = { refuseReason: (_el) => { refuseReason = $._decode_implicit(() => _decode_RefuseReason)(_el); }, userDataRJ: (_el) => { userDataRJ = $._decode_explicit(() => $._decodeAny)(_el); }, }; $._parse_set(el, callbacks, _root_component_type_list_1_spec_for_CPR_PPDU_x400_mode_parameters, _extension_additions_list_spec_for_CPR_PPDU_x400_mode_parameters, _root_component_type_list_2_spec_for_CPR_PPDU_x400_mode_parameters, undefined); return new CPR_PPDU_x400_mode_parameters /* SET_CONSTRUCTOR_CALL */(refuseReason, userDataRJ); }; } return _cached_decoder_for_CPR_PPDU_x400_mode_parameters(el); } let _cached_encoder_for_CPR_PPDU_x400_mode_parameters = null; /** * @summary Encodes a(n) CPR_PPDU_x400_mode_parameters 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 CPR_PPDU_x400_mode_parameters, encoded as an ASN.1 Element. */ export function _encode_CPR_PPDU_x400_mode_parameters(value, elGetter) { if (!_cached_encoder_for_CPR_PPDU_x400_mode_parameters) { _cached_encoder_for_CPR_PPDU_x400_mode_parameters = function (value) { return $._encodeSet([] .concat([ /* IF_ABSENT */ value.refuseReason === undefined ? undefined : $._encode_implicit(_TagClass.context, 0, () => _encode_RefuseReason, $.BER)(value.refuseReason, $.BER), /* IF_ABSENT */ value.userDataRJ === undefined ? undefined : $._encode_explicit(_TagClass.context, 1, () => $._encodeAny, $.BER)(value.userDataRJ, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_CPR_PPDU_x400_mode_parameters(value, elGetter); } /* eslint-enable */