/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "X2AP-PDU-Contents"
 * 	found in "Spec/e2_and_x2-combined-and-minimized.asn1"
 * 	`asn1c -pdu=auto -fincludes-quoted -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example`
 */

#include "MeasurementFailureCause-Item.h"

#include "ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_MeasurementFailureCause_Item_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct MeasurementFailureCause_Item, measurementFailedReportCharacteristics),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ReportCharacteristics,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"measurementFailedReportCharacteristics"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct MeasurementFailureCause_Item, cause),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		+1,	/* EXPLICIT tag at current level */
		&asn_DEF_Cause,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"cause"
		},
	{ ATF_POINTER, 1, offsetof(struct MeasurementFailureCause_Item, iE_Extensions),
		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ProtocolExtensionContainer_8858P4,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"iE-Extensions"
		},
};
static const int asn_MAP_MeasurementFailureCause_Item_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_MeasurementFailureCause_Item_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_MeasurementFailureCause_Item_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* measurementFailedReportCharacteristics */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cause */
    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_MeasurementFailureCause_Item_specs_1 = {
	sizeof(struct MeasurementFailureCause_Item),
	offsetof(struct MeasurementFailureCause_Item, _asn_ctx),
	asn_MAP_MeasurementFailureCause_Item_tag2el_1,
	3,	/* Count of tags in the map */
	asn_MAP_MeasurementFailureCause_Item_oms_1,	/* Optional members */
	1, 0,	/* Root/Additions */
	3,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_MeasurementFailureCause_Item = {
	"MeasurementFailureCause-Item",
	"MeasurementFailureCause-Item",
	&asn_OP_SEQUENCE,
	asn_DEF_MeasurementFailureCause_Item_tags_1,
	sizeof(asn_DEF_MeasurementFailureCause_Item_tags_1)
		/sizeof(asn_DEF_MeasurementFailureCause_Item_tags_1[0]), /* 1 */
	asn_DEF_MeasurementFailureCause_Item_tags_1,	/* Same as above */
	sizeof(asn_DEF_MeasurementFailureCause_Item_tags_1)
		/sizeof(asn_DEF_MeasurementFailureCause_Item_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_MeasurementFailureCause_Item_1,
	3,	/* Elements count */
	&asn_SPC_MeasurementFailureCause_Item_specs_1	/* Additional specs */
};

