UNPKG

@wildboar/acse

Version:
194 lines (193 loc) 7.24 kB
/* eslint-disable */ import { ASN1TagClass as _TagClass, } from '@wildboar/asn1'; import * as $ from '@wildboar/asn1/functional'; import { _decode_Release_request_reason, _encode_Release_request_reason, } from '../ACSE-1/Release-request-reason.ta.mjs'; import { _decode_Association_data, _encode_Association_data, } from '../ACSE-1/Association-data.ta.mjs'; import { _decode_ASO_qualifier, _encode_ASO_qualifier, } from '../ACSE-1/ASO-qualifier.ta.mjs'; import { _decode_ASOI_identifier, _encode_ASOI_identifier, } from '../ACSE-1/ASOI-identifier.ta.mjs'; /** * @summary RLRQ_apdu * @description * * ### ASN.1 Definition: * * ```asn1 * RLRQ-apdu ::= [APPLICATION 2] IMPLICIT SEQUENCE { * reason [0] IMPLICIT Release-request-reason OPTIONAL, * ..., * -- Extensions for higher level association FU * aso-qualifier [13] ASO-qualifier OPTIONAL, * asoi-identifier [14] IMPLICIT ASOI-identifier OPTIONAL, * -- End of extensions for higher level association FU * ..., * user-information [30] IMPLICIT Association-data OPTIONAL * } * ``` * */ export class RLRQ_apdu { reason; aso_qualifier; asoi_identifier; _unrecognizedExtensionsList; user_information; constructor( /** * @summary `reason`. * @public * @readonly */ reason, /** * @summary `aso_qualifier`. * @public * @readonly */ aso_qualifier, /** * @summary `asoi_identifier`. * @public * @readonly */ asoi_identifier, /** * @summary Extensions that are not recognized. * @public * @readonly */ _unrecognizedExtensionsList = [], /** * @summary `user_information`. * @public * @readonly */ user_information) { this.reason = reason; this.aso_qualifier = aso_qualifier; this.asoi_identifier = asoi_identifier; this._unrecognizedExtensionsList = _unrecognizedExtensionsList; this.user_information = user_information; } /** * @summary Restructures an object into a RLRQ_apdu * @description * * This takes an `object` and converts it to a `RLRQ_apdu`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `RLRQ_apdu`. * @returns {RLRQ_apdu} */ static _from_object(_o) { return new RLRQ_apdu(_o.reason, _o.aso_qualifier, _o.asoi_identifier, _o._unrecognizedExtensionsList, _o.user_information); } } /** * @summary The Leading Root Component Types of RLRQ_apdu * @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_RLRQ_apdu = [ new $.ComponentSpec('reason', true, $.hasTag(_TagClass.context, 0)), ]; /** * @summary The Trailing Root Component Types of RLRQ_apdu * @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_RLRQ_apdu = [ new $.ComponentSpec('user-information', true, $.hasTag(_TagClass.context, 30)), ]; /** * @summary The Extension Addition Component Types of RLRQ_apdu * @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_RLRQ_apdu = [ new $.ComponentSpec('aso-qualifier', true, $.hasTag(_TagClass.context, 13)), new $.ComponentSpec('asoi-identifier', true, $.hasTag(_TagClass.context, 14)), ]; let _cached_decoder_for_RLRQ_apdu = null; /** * @summary Decodes an ASN.1 element into a(n) RLRQ_apdu * @function * @param {_Element} el The element being decoded. * @returns {RLRQ_apdu} The decoded data structure. */ export function _decode_RLRQ_apdu(el) { if (!_cached_decoder_for_RLRQ_apdu) { _cached_decoder_for_RLRQ_apdu = $._decode_implicit(() => function (el) { let reason; let aso_qualifier; let asoi_identifier; let _unrecognizedExtensionsList = []; let user_information; const callbacks = { reason: (_el) => { reason = $._decode_implicit(() => _decode_Release_request_reason)(_el); }, 'user-information': (_el) => { user_information = $._decode_implicit(() => _decode_Association_data)(_el); }, 'aso-qualifier': (_el) => { aso_qualifier = $._decode_explicit(() => _decode_ASO_qualifier)(_el); }, 'asoi-identifier': (_el) => { asoi_identifier = $._decode_implicit(() => _decode_ASOI_identifier)(_el); }, }; $._parse_sequence(el, callbacks, _root_component_type_list_1_spec_for_RLRQ_apdu, _extension_additions_list_spec_for_RLRQ_apdu, _root_component_type_list_2_spec_for_RLRQ_apdu, (ext) => { _unrecognizedExtensionsList.push(ext); }); return new RLRQ_apdu(reason, aso_qualifier, asoi_identifier, _unrecognizedExtensionsList, user_information); }); } return _cached_decoder_for_RLRQ_apdu(el); } let _cached_encoder_for_RLRQ_apdu = null; /** * @summary Encodes a(n) RLRQ_apdu 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 RLRQ_apdu, encoded as an ASN.1 Element. */ export function _encode_RLRQ_apdu(value, elGetter) { if (!_cached_encoder_for_RLRQ_apdu) { _cached_encoder_for_RLRQ_apdu = $._encode_implicit(_TagClass.application, 2, () => function (value) { return $._encodeSequence([] .concat([ /* IF_ABSENT */ value.reason === undefined ? undefined : $._encode_implicit(_TagClass.context, 0, () => _encode_Release_request_reason, $.BER)(value.reason, $.BER), ], [ /* IF_ABSENT */ value.aso_qualifier === undefined ? undefined : $._encode_explicit(_TagClass.context, 13, () => _encode_ASO_qualifier, $.BER)(value.aso_qualifier, $.BER), /* IF_ABSENT */ value.asoi_identifier === undefined ? undefined : $._encode_implicit(_TagClass.context, 14, () => _encode_ASOI_identifier, $.BER)(value.asoi_identifier, $.BER), ], value._unrecognizedExtensionsList ? value._unrecognizedExtensionsList : [], [ /* IF_ABSENT */ value.user_information === undefined ? undefined : $._encode_implicit(_TagClass.context, 30, () => _encode_Association_data, $.BER)(value.user_information, $.BER), ]) .filter((c) => !!c), $.BER); }, $.BER); } return _cached_encoder_for_RLRQ_apdu(value, elGetter); } /* eslint-enable */