@wildboar/acse
Version:
Association Control Service Element PDUs in TypeScript
129 lines (128 loc) • 4.74 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass, ASN1ConstructionError as _ConstructionError, } from '@wildboar/asn1';
import * as $ from '@wildboar/asn1/functional';
/**
* @summary Authentication_value_other
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* Authentication-value-other ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- }
* ```
*
*/
export class Authentication_value_other {
other_mechanism_name;
other_mechanism_value;
constructor(
/**
* @summary `other_mechanism_name`.
* @public
* @readonly
*/
other_mechanism_name,
/**
* @summary `other_mechanism_value`.
* @public
* @readonly
*/
other_mechanism_value) {
this.other_mechanism_name = other_mechanism_name;
this.other_mechanism_value = other_mechanism_value;
}
/**
* @summary Restructures an object into a Authentication_value_other
* @description
*
* This takes an `object` and converts it to a `Authentication_value_other`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `Authentication_value_other`.
* @returns {Authentication_value_other}
*/
static _from_object(_o) {
return new Authentication_value_other(_o.other_mechanism_name, _o.other_mechanism_value);
}
}
/**
* @summary The Leading Root Component Types of Authentication_value_other
* @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_Authentication_value_other = [
new $.ComponentSpec('other-mechanism-name', false, $.hasTag(_TagClass.universal, 6)),
new $.ComponentSpec('other-mechanism-value', false, $.hasAnyTag),
];
/**
* @summary The Trailing Root Component Types of Authentication_value_other
* @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_Authentication_value_other = [];
/**
* @summary The Extension Addition Component Types of Authentication_value_other
* @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_Authentication_value_other = [];
let _cached_decoder_for_Authentication_value_other = null;
/**
* @summary Decodes an ASN.1 element into a(n) Authentication_value_other
* @function
* @param {_Element} el The element being decoded.
* @returns {Authentication_value_other} The decoded data structure.
*/
export function _decode_Authentication_value_other(el) {
if (!_cached_decoder_for_Authentication_value_other) {
_cached_decoder_for_Authentication_value_other = function (el) {
const sequence = el.sequence;
if (sequence.length < 2) {
throw new _ConstructionError('Authentication-value-other contained only ' +
sequence.length.toString() +
' elements.');
}
sequence[0].name = 'other-mechanism-name';
sequence[1].name = 'other-mechanism-value';
let other_mechanism_name;
let other_mechanism_value;
other_mechanism_name = $._decodeObjectIdentifier(sequence[0]);
other_mechanism_value = $._decodeAny(sequence[1]);
return new Authentication_value_other(other_mechanism_name, other_mechanism_value);
};
}
return _cached_decoder_for_Authentication_value_other(el);
}
let _cached_encoder_for_Authentication_value_other = null;
/**
* @summary Encodes a(n) Authentication_value_other 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 Authentication_value_other, encoded as an ASN.1 Element.
*/
export function _encode_Authentication_value_other(value, elGetter) {
if (!_cached_encoder_for_Authentication_value_other) {
_cached_encoder_for_Authentication_value_other = function (value) {
return $._encodeSequence([]
.concat([
/* REQUIRED */ $._encodeObjectIdentifier(value.other_mechanism_name, $.BER),
/* REQUIRED */ $._encodeAny(value.other_mechanism_value, $.BER),
])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_Authentication_value_other(value, elGetter);
}
/* eslint-enable */