UNPKG

@wildboar/copp

Version:

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

170 lines 7.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_RSA_PPDU = exports._decode_RSA_PPDU = exports._extension_additions_list_spec_for_RSA_PPDU = exports._root_component_type_list_2_spec_for_RSA_PPDU = exports._root_component_type_list_1_spec_for_RSA_PPDU = exports.RSA_PPDU = exports._encode_User_data = exports._decode_User_data = exports._encode_Presentation_context_identifier_list = exports._decode_Presentation_context_identifier_list = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const Presentation_context_identifier_list_ta_1 = require("../ISO8823-PRESENTATION/Presentation-context-identifier-list.ta"); var Presentation_context_identifier_list_ta_2 = require("../ISO8823-PRESENTATION/Presentation-context-identifier-list.ta"); Object.defineProperty(exports, "_decode_Presentation_context_identifier_list", { enumerable: true, get: function () { return Presentation_context_identifier_list_ta_2._decode_Presentation_context_identifier_list; } }); Object.defineProperty(exports, "_encode_Presentation_context_identifier_list", { enumerable: true, get: function () { return Presentation_context_identifier_list_ta_2._encode_Presentation_context_identifier_list; } }); const User_data_ta_1 = require("../ISO8823-PRESENTATION/User-data.ta"); var User_data_ta_2 = require("../ISO8823-PRESENTATION/User-data.ta"); Object.defineProperty(exports, "_decode_User_data", { enumerable: true, get: function () { return User_data_ta_2._decode_User_data; } }); Object.defineProperty(exports, "_encode_User_data", { enumerable: true, get: function () { return User_data_ta_2._encode_User_data; } }); /* START_OF_SYMBOL_DEFINITION RSA_PPDU */ /** * @summary RSA_PPDU * @description * * ### ASN.1 Definition: * * ```asn1 * RSA-PPDU ::= SEQUENCE { * presentation-context-identifier-list * [0] IMPLICIT Presentation-context-identifier-list OPTIONAL, * user-data User-data OPTIONAL * } * ``` * * @class */ class RSA_PPDU { constructor( /** * @summary `presentation_context_identifier_list`. * @public * @readonly */ presentation_context_identifier_list, /** * @summary `user_data`. * @public * @readonly */ user_data) { this.presentation_context_identifier_list = presentation_context_identifier_list; this.user_data = user_data; } /** * @summary Restructures an object into a RSA_PPDU * @description * * This takes an `object` and converts it to a `RSA_PPDU`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `RSA_PPDU`. * @returns {RSA_PPDU} */ static _from_object(_o) { return new RSA_PPDU(_o.presentation_context_identifier_list, _o.user_data); } } exports.RSA_PPDU = RSA_PPDU; /* END_OF_SYMBOL_DEFINITION RSA_PPDU */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_RSA_PPDU */ /** * @summary The Leading Root Component Types of RSA_PPDU * @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_RSA_PPDU = [ new $.ComponentSpec('presentation-context-identifier-list', true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec('user-data', true, $.hasAnyTag, undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_RSA_PPDU */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_RSA_PPDU */ /** * @summary The Trailing Root Component Types of RSA_PPDU * @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_RSA_PPDU = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_RSA_PPDU */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_RSA_PPDU */ /** * @summary The Extension Addition Component Types of RSA_PPDU * @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_RSA_PPDU = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_RSA_PPDU */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_RSA_PPDU */ let _cached_decoder_for_RSA_PPDU = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_RSA_PPDU */ /* START_OF_SYMBOL_DEFINITION _decode_RSA_PPDU */ /** * @summary Decodes an ASN.1 element into a(n) RSA_PPDU * @function * @param {_Element} el The element being decoded. * @returns {RSA_PPDU} The decoded data structure. */ function _decode_RSA_PPDU(el) { if (!_cached_decoder_for_RSA_PPDU) { _cached_decoder_for_RSA_PPDU = function (el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let presentation_context_identifier_list; let user_data; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { 'presentation-context-identifier-list': (_el) => { presentation_context_identifier_list = $._decode_implicit(() => Presentation_context_identifier_list_ta_1._decode_Presentation_context_identifier_list)(_el); }, 'user-data': (_el) => { user_data = User_data_ta_1._decode_User_data(_el); }, }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_RSA_PPDU, exports._extension_additions_list_spec_for_RSA_PPDU, exports._root_component_type_list_2_spec_for_RSA_PPDU, undefined); return new RSA_PPDU /* SEQUENCE_CONSTRUCTOR_CALL */(presentation_context_identifier_list, user_data); }; } return _cached_decoder_for_RSA_PPDU(el); } exports._decode_RSA_PPDU = _decode_RSA_PPDU; /* END_OF_SYMBOL_DEFINITION _decode_RSA_PPDU */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_RSA_PPDU */ let _cached_encoder_for_RSA_PPDU = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_RSA_PPDU */ /* START_OF_SYMBOL_DEFINITION _encode_RSA_PPDU */ /** * @summary Encodes a(n) RSA_PPDU 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 RSA_PPDU, encoded as an ASN.1 Element. */ function _encode_RSA_PPDU(value, elGetter) { if (!_cached_encoder_for_RSA_PPDU) { _cached_encoder_for_RSA_PPDU = function (value, elGetter) { return $._encodeSequence([] .concat([ /* IF_ABSENT */ value.presentation_context_identifier_list === undefined ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => Presentation_context_identifier_list_ta_1._encode_Presentation_context_identifier_list, $.BER)(value.presentation_context_identifier_list, $.BER), /* IF_ABSENT */ value.user_data === undefined ? undefined : User_data_ta_1._encode_User_data(value.user_data, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_RSA_PPDU(value, elGetter); } exports._encode_RSA_PPDU = _encode_RSA_PPDU; /* END_OF_SYMBOL_DEFINITION _encode_RSA_PPDU */ /* eslint-enable */ //# sourceMappingURL=RSA-PPDU.ta.js.map