UNPKG

@wildboar/copp

Version:

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

174 lines 9.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_Context_list_Item = exports._decode_Context_list_Item = exports._extension_additions_list_spec_for_Context_list_Item = exports._root_component_type_list_2_spec_for_Context_list_Item = exports._root_component_type_list_1_spec_for_Context_list_Item = exports.Context_list_Item = exports._encode_Transfer_syntax_name = exports._decode_Transfer_syntax_name = exports._encode_Abstract_syntax_name = exports._decode_Abstract_syntax_name = exports._encode_Presentation_context_identifier = exports._decode_Presentation_context_identifier = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); 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 Abstract_syntax_name_ta_1 = require("../ISO8823-PRESENTATION/Abstract-syntax-name.ta"); var Abstract_syntax_name_ta_2 = require("../ISO8823-PRESENTATION/Abstract-syntax-name.ta"); Object.defineProperty(exports, "_decode_Abstract_syntax_name", { enumerable: true, get: function () { return Abstract_syntax_name_ta_2._decode_Abstract_syntax_name; } }); Object.defineProperty(exports, "_encode_Abstract_syntax_name", { enumerable: true, get: function () { return Abstract_syntax_name_ta_2._encode_Abstract_syntax_name; } }); 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; } }); /* START_OF_SYMBOL_DEFINITION Context_list_Item */ /** * @summary Context_list_Item * @description * * ### ASN.1 Definition: * * ```asn1 * Context-list-Item ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- } * ``` * * @class */ class Context_list_Item { constructor( /** * @summary `presentation_context_identifier`. * @public * @readonly */ presentation_context_identifier, /** * @summary `abstract_syntax_name`. * @public * @readonly */ abstract_syntax_name, /** * @summary `transfer_syntax_name_list`. * @public * @readonly */ transfer_syntax_name_list) { this.presentation_context_identifier = presentation_context_identifier; this.abstract_syntax_name = abstract_syntax_name; this.transfer_syntax_name_list = transfer_syntax_name_list; } /** * @summary Restructures an object into a Context_list_Item * @description * * This takes an `object` and converts it to a `Context_list_Item`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `Context_list_Item`. * @returns {Context_list_Item} */ static _from_object(_o) { return new Context_list_Item(_o.presentation_context_identifier, _o.abstract_syntax_name, _o.transfer_syntax_name_list); } } exports.Context_list_Item = Context_list_Item; /* END_OF_SYMBOL_DEFINITION Context_list_Item */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Context_list_Item */ /** * @summary The Leading Root Component Types of Context_list_Item * @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_Context_list_Item = [ new $.ComponentSpec('presentation-context-identifier', false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined), new $.ComponentSpec('abstract-syntax-name', false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined), new $.ComponentSpec('transfer-syntax-name-list', false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Context_list_Item */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Context_list_Item */ /** * @summary The Trailing Root Component Types of Context_list_Item * @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_Context_list_Item = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Context_list_Item */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Context_list_Item */ /** * @summary The Extension Addition Component Types of Context_list_Item * @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_Context_list_Item = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Context_list_Item */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_Context_list_Item */ let _cached_decoder_for_Context_list_Item = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_Context_list_Item */ /* START_OF_SYMBOL_DEFINITION _decode_Context_list_Item */ /** * @summary Decodes an ASN.1 element into a(n) Context_list_Item * @function * @param {_Element} el The element being decoded. * @returns {Context_list_Item} The decoded data structure. */ function _decode_Context_list_Item(el) { if (!_cached_decoder_for_Context_list_Item) { _cached_decoder_for_Context_list_Item = function (el) { const sequence = el.sequence; if (sequence.length < 3) { throw new asn1_ts_1.ASN1ConstructionError('Context-list-Item contained only ' + sequence.length.toString() + ' elements.'); } sequence[0].name = 'presentation-context-identifier'; sequence[1].name = 'abstract-syntax-name'; sequence[2].name = 'transfer-syntax-name-list'; let presentation_context_identifier; let abstract_syntax_name; let transfer_syntax_name_list; presentation_context_identifier = Presentation_context_identifier_ta_1._decode_Presentation_context_identifier(sequence[0]); abstract_syntax_name = Abstract_syntax_name_ta_1._decode_Abstract_syntax_name(sequence[1]); transfer_syntax_name_list = $._decodeSequenceOf(() => Transfer_syntax_name_ta_1._decode_Transfer_syntax_name)(sequence[2]); return new Context_list_Item(presentation_context_identifier, abstract_syntax_name, transfer_syntax_name_list); }; } return _cached_decoder_for_Context_list_Item(el); } exports._decode_Context_list_Item = _decode_Context_list_Item; /* END_OF_SYMBOL_DEFINITION _decode_Context_list_Item */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_Context_list_Item */ let _cached_encoder_for_Context_list_Item = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_Context_list_Item */ /* START_OF_SYMBOL_DEFINITION _encode_Context_list_Item */ /** * @summary Encodes a(n) Context_list_Item 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 Context_list_Item, encoded as an ASN.1 Element. */ function _encode_Context_list_Item(value, elGetter) { if (!_cached_encoder_for_Context_list_Item) { _cached_encoder_for_Context_list_Item = function (value, elGetter) { return $._encodeSequence([] .concat([ /* REQUIRED */ Presentation_context_identifier_ta_1._encode_Presentation_context_identifier(value.presentation_context_identifier, $.BER), /* REQUIRED */ Abstract_syntax_name_ta_1._encode_Abstract_syntax_name(value.abstract_syntax_name, $.BER), /* REQUIRED */ $._encodeSequenceOf(() => Transfer_syntax_name_ta_1._encode_Transfer_syntax_name, $.BER)(value.transfer_syntax_name_list, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_Context_list_Item(value, elGetter); } exports._encode_Context_list_Item = _encode_Context_list_Item; /* END_OF_SYMBOL_DEFINITION _encode_Context_list_Item */ /* eslint-enable */ //# sourceMappingURL=Context-list-Item.ta.js.map