UNPKG

@wildboar/copp

Version:

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

195 lines 9.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_PDV_list = exports._decode_PDV_list = exports._extension_additions_list_spec_for_PDV_list = exports._root_component_type_list_2_spec_for_PDV_list = exports._root_component_type_list_1_spec_for_PDV_list = exports.PDV_list = exports._encode_PDV_list_presentation_data_values = exports._decode_PDV_list_presentation_data_values = exports._encode_Presentation_context_identifier = exports._decode_Presentation_context_identifier = exports._encode_Transfer_syntax_name = exports._decode_Transfer_syntax_name = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const Transfer_syntax_name_ta_1 = require("../ISO8823-PRESENTATION/Transfer-syntax-name.ta"); var Transfer_syntax_name_ta_2 = require("../ISO8823-PRESENTATION/Transfer-syntax-name.ta"); Object.defineProperty(exports, "_decode_Transfer_syntax_name", { enumerable: true, get: function () { return Transfer_syntax_name_ta_2._decode_Transfer_syntax_name; } }); Object.defineProperty(exports, "_encode_Transfer_syntax_name", { enumerable: true, get: function () { return Transfer_syntax_name_ta_2._encode_Transfer_syntax_name; } }); const Presentation_context_identifier_ta_1 = require("../ISO8823-PRESENTATION/Presentation-context-identifier.ta"); var Presentation_context_identifier_ta_2 = require("../ISO8823-PRESENTATION/Presentation-context-identifier.ta"); Object.defineProperty(exports, "_decode_Presentation_context_identifier", { enumerable: true, get: function () { return Presentation_context_identifier_ta_2._decode_Presentation_context_identifier; } }); Object.defineProperty(exports, "_encode_Presentation_context_identifier", { enumerable: true, get: function () { return Presentation_context_identifier_ta_2._encode_Presentation_context_identifier; } }); const PDV_list_presentation_data_values_ta_1 = require("../ISO8823-PRESENTATION/PDV-list-presentation-data-values.ta"); var PDV_list_presentation_data_values_ta_2 = require("../ISO8823-PRESENTATION/PDV-list-presentation-data-values.ta"); Object.defineProperty(exports, "_decode_PDV_list_presentation_data_values", { enumerable: true, get: function () { return PDV_list_presentation_data_values_ta_2._decode_PDV_list_presentation_data_values; } }); Object.defineProperty(exports, "_encode_PDV_list_presentation_data_values", { enumerable: true, get: function () { return PDV_list_presentation_data_values_ta_2._encode_PDV_list_presentation_data_values; } }); /* START_OF_SYMBOL_DEFINITION PDV_list */ /** * @summary PDV_list * @description * * ### ASN.1 Definition: * * ```asn1 * PDV-list ::= SEQUENCE { * transfer-syntax-name Transfer-syntax-name OPTIONAL, * presentation-context-identifier Presentation-context-identifier, * presentation-data-values * CHOICE {single-ASN1-type * [0] ABSTRACT-SYNTAX.&Type * (CONSTRAINED BY { * * -- Type corresponding to presentation context identifier -- }), * octet-aligned [1] IMPLICIT OCTET STRING, * arbitrary [2] IMPLICIT BIT STRING} * -- Contains one or more presentation data values from the same * -- presentation context. * -- See 8.4.2. * } * ``` * * @class */ class PDV_list { constructor( /** * @summary `transfer_syntax_name`. * @public * @readonly */ transfer_syntax_name, /** * @summary `presentation_context_identifier`. * @public * @readonly */ presentation_context_identifier, /** * @summary `presentation_data_values`. * @public * @readonly */ presentation_data_values) { this.transfer_syntax_name = transfer_syntax_name; this.presentation_context_identifier = presentation_context_identifier; this.presentation_data_values = presentation_data_values; } /** * @summary Restructures an object into a PDV_list * @description * * This takes an `object` and converts it to a `PDV_list`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `PDV_list`. * @returns {PDV_list} */ static _from_object(_o) { return new PDV_list(_o.transfer_syntax_name, _o.presentation_context_identifier, _o.presentation_data_values); } } exports.PDV_list = PDV_list; /* END_OF_SYMBOL_DEFINITION PDV_list */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PDV_list */ /** * @summary The Leading Root Component Types of PDV_list * @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 */ exports._root_component_type_list_1_spec_for_PDV_list = [ new $.ComponentSpec('transfer-syntax-name', true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined), new $.ComponentSpec('presentation-context-identifier', false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined), new $.ComponentSpec('presentation-data-values', false, $.hasAnyTag, undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PDV_list */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PDV_list */ /** * @summary The Trailing Root Component Types of PDV_list * @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 */ exports._root_component_type_list_2_spec_for_PDV_list = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PDV_list */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PDV_list */ /** * @summary The Extension Addition Component Types of PDV_list * @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 */ exports._extension_additions_list_spec_for_PDV_list = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PDV_list */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_PDV_list */ let _cached_decoder_for_PDV_list = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_PDV_list */ /* START_OF_SYMBOL_DEFINITION _decode_PDV_list */ /** * @summary Decodes an ASN.1 element into a(n) PDV_list * @function * @param {_Element} el The element being decoded. * @returns {PDV_list} The decoded data structure. */ function _decode_PDV_list(el) { if (!_cached_decoder_for_PDV_list) { _cached_decoder_for_PDV_list = function (el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let transfer_syntax_name; let presentation_context_identifier; let presentation_data_values; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { 'transfer-syntax-name': (_el) => { transfer_syntax_name = Transfer_syntax_name_ta_1._decode_Transfer_syntax_name(_el); }, 'presentation-context-identifier': (_el) => { presentation_context_identifier = Presentation_context_identifier_ta_1._decode_Presentation_context_identifier(_el); }, 'presentation-data-values': (_el) => { presentation_data_values = PDV_list_presentation_data_values_ta_1._decode_PDV_list_presentation_data_values(_el); }, }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_PDV_list, exports._extension_additions_list_spec_for_PDV_list, exports._root_component_type_list_2_spec_for_PDV_list, undefined); return new PDV_list /* SEQUENCE_CONSTRUCTOR_CALL */(transfer_syntax_name, presentation_context_identifier, presentation_data_values); }; } return _cached_decoder_for_PDV_list(el); } exports._decode_PDV_list = _decode_PDV_list; /* END_OF_SYMBOL_DEFINITION _decode_PDV_list */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_PDV_list */ let _cached_encoder_for_PDV_list = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_PDV_list */ /* START_OF_SYMBOL_DEFINITION _encode_PDV_list */ /** * @summary Encodes a(n) PDV_list into an ASN.1 Element. * @function * @param {value} el The element being decoded. * @param elGetter A function that can be used to get new ASN.1 elements. * @returns {_Element} The PDV_list, encoded as an ASN.1 Element. */ function _encode_PDV_list(value, elGetter) { if (!_cached_encoder_for_PDV_list) { _cached_encoder_for_PDV_list = function (value, elGetter) { return $._encodeSequence([] .concat([ /* IF_ABSENT */ value.transfer_syntax_name === undefined ? undefined : Transfer_syntax_name_ta_1._encode_Transfer_syntax_name(value.transfer_syntax_name, $.BER), /* REQUIRED */ Presentation_context_identifier_ta_1._encode_Presentation_context_identifier(value.presentation_context_identifier, $.BER), /* REQUIRED */ PDV_list_presentation_data_values_ta_1._encode_PDV_list_presentation_data_values(value.presentation_data_values, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_PDV_list(value, elGetter); } exports._encode_PDV_list = _encode_PDV_list; /* END_OF_SYMBOL_DEFINITION _encode_PDV_list */ /* eslint-enable */ //# sourceMappingURL=PDV-list.ta.js.map