UNPKG

@wildboar/copp

Version:

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

246 lines 13.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_CP_type_x410_mode_parameters = exports._decode_CP_type_x410_mode_parameters = exports._extension_additions_list_spec_for_CP_type_x410_mode_parameters = exports._root_component_type_list_2_spec_for_CP_type_x410_mode_parameters = exports._root_component_type_list_1_spec_for_CP_type_x410_mode_parameters = exports.CP_type_x410_mode_parameters = exports._encode_ConnectionData = exports._decode_ConnectionData = exports._encode_RTORQapdu_dialogueMode = exports._decode_RTORQapdu_dialogueMode = exports.twa = exports.RTORQapdu_dialogueMode_twa = exports.monologue = exports.RTORQapdu_dialogueMode_monologue = exports._encode_RTORQapdu = exports._decode_RTORQapdu = exports.RTORQapdu = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); var RTORQapdu_ta_1 = require("@wildboar/rtse/src/lib/modules/Reliable-Transfer-APDU/RTORQapdu.ta"); Object.defineProperty(exports, "RTORQapdu", { enumerable: true, get: function () { return RTORQapdu_ta_1.RTORQapdu; } }); Object.defineProperty(exports, "_decode_RTORQapdu", { enumerable: true, get: function () { return RTORQapdu_ta_1._decode_RTORQapdu; } }); Object.defineProperty(exports, "_encode_RTORQapdu", { enumerable: true, get: function () { return RTORQapdu_ta_1._encode_RTORQapdu; } }); const RTORQapdu_dialogueMode_ta_1 = require("@wildboar/rtse/src/lib/modules/Reliable-Transfer-APDU/RTORQapdu-dialogueMode.ta"); var RTORQapdu_dialogueMode_ta_2 = require("@wildboar/rtse/src/lib/modules/Reliable-Transfer-APDU/RTORQapdu-dialogueMode.ta"); Object.defineProperty(exports, "RTORQapdu_dialogueMode_monologue", { enumerable: true, get: function () { return RTORQapdu_dialogueMode_ta_2.RTORQapdu_dialogueMode_monologue; } }); /* IMPORTED_LONG_NAMED_INTEGER */ Object.defineProperty(exports, "monologue", { enumerable: true, get: function () { return RTORQapdu_dialogueMode_ta_2.monologue; } }); /* IMPORTED_SHORT_NAMED_INTEGER */ Object.defineProperty(exports, "RTORQapdu_dialogueMode_twa", { enumerable: true, get: function () { return RTORQapdu_dialogueMode_ta_2.RTORQapdu_dialogueMode_twa; } }); /* IMPORTED_LONG_NAMED_INTEGER */ Object.defineProperty(exports, "twa", { enumerable: true, get: function () { return RTORQapdu_dialogueMode_ta_2.twa; } }); /* IMPORTED_SHORT_NAMED_INTEGER */ Object.defineProperty(exports, "_decode_RTORQapdu_dialogueMode", { enumerable: true, get: function () { return RTORQapdu_dialogueMode_ta_2._decode_RTORQapdu_dialogueMode; } }); Object.defineProperty(exports, "_encode_RTORQapdu_dialogueMode", { enumerable: true, get: function () { return RTORQapdu_dialogueMode_ta_2._encode_RTORQapdu_dialogueMode; } }); const ConnectionData_ta_1 = require("@wildboar/rtse/src/lib/modules/Reliable-Transfer-APDU/ConnectionData.ta"); var ConnectionData_ta_2 = require("@wildboar/rtse/src/lib/modules/Reliable-Transfer-APDU/ConnectionData.ta"); Object.defineProperty(exports, "_decode_ConnectionData", { enumerable: true, get: function () { return ConnectionData_ta_2._decode_ConnectionData; } }); Object.defineProperty(exports, "_encode_ConnectionData", { enumerable: true, get: function () { return ConnectionData_ta_2._encode_ConnectionData; } }); /* START_OF_SYMBOL_DEFINITION CP_type_x410_mode_parameters */ /** * @summary CP_type_x410_mode_parameters * @description * * ### ASN.1 Definition: * * ```asn1 * CP-type-x410-mode-parameters ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- } * ``` * * @class */ class CP_type_x410_mode_parameters { constructor( /** * @summary `checkpointSize`. * @public * @readonly */ checkpointSize /* REPLICATED_COMPONENT */, /** * @summary `windowSize`. * @public * @readonly */ windowSize /* REPLICATED_COMPONENT */, /** * @summary `dialogueMode`. * @public * @readonly */ dialogueMode /* REPLICATED_COMPONENT */, /** * @summary `connectionDataRQ`. * @public * @readonly */ connectionDataRQ /* REPLICATED_COMPONENT */, /** * @summary `applicationProtocol`. * @public * @readonly */ applicationProtocol /* REPLICATED_COMPONENT */) { this.checkpointSize = checkpointSize; this.windowSize = windowSize; this.dialogueMode = dialogueMode; this.connectionDataRQ = connectionDataRQ; this.applicationProtocol = applicationProtocol; } /** * @summary Restructures an object into a CP_type_x410_mode_parameters * @description * * This takes an `object` and converts it to a `CP_type_x410_mode_parameters`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `CP_type_x410_mode_parameters`. * @returns {CP_type_x410_mode_parameters} */ static _from_object(_o) { return new CP_type_x410_mode_parameters(_o.checkpointSize, _o.windowSize, _o.dialogueMode, _o.connectionDataRQ, _o.applicationProtocol); } /** * @summary Getter that returns the default value for `checkpointSize`. * @public * @static * @method */ static get _default_value_for_checkpointSize() { return 0; } /** * @summary Getter that returns the default value for `windowSize`. * @public * @static * @method */ static get _default_value_for_windowSize() { return 3; } /** * @summary Getter that returns the default value for `dialogueMode`. * @public * @static * @method */ static get _default_value_for_dialogueMode() { return RTORQapdu_dialogueMode_ta_1.monologue; } } exports.CP_type_x410_mode_parameters = CP_type_x410_mode_parameters; /* END_OF_SYMBOL_DEFINITION CP_type_x410_mode_parameters */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CP_type_x410_mode_parameters */ /** * @summary The Leading Root Component Types of CP_type_x410_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 */ exports._root_component_type_list_1_spec_for_CP_type_x410_mode_parameters = [ new $.ComponentSpec('checkpointSize', true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec('windowSize', true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined), new $.ComponentSpec('dialogueMode', true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 2), undefined, undefined), new $.ComponentSpec('connectionDataRQ', false, $.hasTag(asn1_ts_1.ASN1TagClass.context, 3), undefined, undefined), new $.ComponentSpec('applicationProtocol', true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 4), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CP_type_x410_mode_parameters */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CP_type_x410_mode_parameters */ /** * @summary The Trailing Root Component Types of CP_type_x410_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 */ exports._root_component_type_list_2_spec_for_CP_type_x410_mode_parameters = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CP_type_x410_mode_parameters */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CP_type_x410_mode_parameters */ /** * @summary The Extension Addition Component Types of CP_type_x410_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 */ exports._extension_additions_list_spec_for_CP_type_x410_mode_parameters = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CP_type_x410_mode_parameters */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_CP_type_x410_mode_parameters */ let _cached_decoder_for_CP_type_x410_mode_parameters = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_CP_type_x410_mode_parameters */ /* START_OF_SYMBOL_DEFINITION _decode_CP_type_x410_mode_parameters */ /** * @summary Decodes an ASN.1 element into a(n) CP_type_x410_mode_parameters * @function * @param {_Element} el The element being decoded. * @returns {CP_type_x410_mode_parameters} The decoded data structure. */ function _decode_CP_type_x410_mode_parameters(el) { if (!_cached_decoder_for_CP_type_x410_mode_parameters) { _cached_decoder_for_CP_type_x410_mode_parameters = function (el) { /* START_OF_SET_COMPONENT_DECLARATIONS */ let checkpointSize = CP_type_x410_mode_parameters._default_value_for_checkpointSize; let windowSize = CP_type_x410_mode_parameters._default_value_for_windowSize; let dialogueMode = CP_type_x410_mode_parameters._default_value_for_dialogueMode; let connectionDataRQ; let applicationProtocol; /* END_OF_SET_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { checkpointSize: (_el) => { checkpointSize = $._decode_implicit(() => $._decodeInteger)(_el); }, windowSize: (_el) => { windowSize = $._decode_implicit(() => $._decodeInteger)(_el); }, dialogueMode: (_el) => { dialogueMode = $._decode_implicit(() => RTORQapdu_dialogueMode_ta_1._decode_RTORQapdu_dialogueMode)(_el); }, connectionDataRQ: (_el) => { connectionDataRQ = $._decode_explicit(() => ConnectionData_ta_1._decode_ConnectionData)(_el); }, applicationProtocol: (_el) => { applicationProtocol = $._decode_implicit(() => $._decodeInteger)(_el); }, }; /* END_OF_CALLBACKS_MAP */ $._parse_set(el, callbacks, exports._root_component_type_list_1_spec_for_CP_type_x410_mode_parameters, exports._extension_additions_list_spec_for_CP_type_x410_mode_parameters, exports._root_component_type_list_2_spec_for_CP_type_x410_mode_parameters, undefined); return new CP_type_x410_mode_parameters /* SET_CONSTRUCTOR_CALL */(checkpointSize, windowSize, dialogueMode, connectionDataRQ, applicationProtocol); }; } return _cached_decoder_for_CP_type_x410_mode_parameters(el); } exports._decode_CP_type_x410_mode_parameters = _decode_CP_type_x410_mode_parameters; /* END_OF_SYMBOL_DEFINITION _decode_CP_type_x410_mode_parameters */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_CP_type_x410_mode_parameters */ let _cached_encoder_for_CP_type_x410_mode_parameters = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_CP_type_x410_mode_parameters */ /* START_OF_SYMBOL_DEFINITION _encode_CP_type_x410_mode_parameters */ /** * @summary Encodes a(n) CP_type_x410_mode_parameters 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 CP_type_x410_mode_parameters, encoded as an ASN.1 Element. */ function _encode_CP_type_x410_mode_parameters(value, elGetter) { if (!_cached_encoder_for_CP_type_x410_mode_parameters) { _cached_encoder_for_CP_type_x410_mode_parameters = function (value, elGetter) { return $._encodeSet([] .concat([ /* IF_DEFAULT */ value.checkpointSize === undefined || $.deepEq(value.checkpointSize, CP_type_x410_mode_parameters._default_value_for_checkpointSize) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => $._encodeInteger, $.BER)(value.checkpointSize, $.BER), /* IF_DEFAULT */ value.windowSize === undefined || $.deepEq(value.windowSize, CP_type_x410_mode_parameters._default_value_for_windowSize) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => $._encodeInteger, $.BER)(value.windowSize, $.BER), /* IF_DEFAULT */ value.dialogueMode === undefined || $.deepEq(value.dialogueMode, CP_type_x410_mode_parameters._default_value_for_dialogueMode) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => RTORQapdu_dialogueMode_ta_1._encode_RTORQapdu_dialogueMode, $.BER)(value.dialogueMode, $.BER), /* REQUIRED */ $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 3, () => ConnectionData_ta_1._encode_ConnectionData, $.BER)(value.connectionDataRQ, $.BER), /* IF_ABSENT */ value.applicationProtocol === undefined ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 4, () => $._encodeInteger, $.BER)(value.applicationProtocol, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_CP_type_x410_mode_parameters(value, elGetter); } exports._encode_CP_type_x410_mode_parameters = _encode_CP_type_x410_mode_parameters; /* END_OF_SYMBOL_DEFINITION _encode_CP_type_x410_mode_parameters */ /* eslint-enable */ //# sourceMappingURL=CP-type-x410-mode-parameters.ta.js.map