/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "X2AP-IEs"
 * 	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 "CellBasedQMC.h"

#include "ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_CellBasedQMC_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct CellBasedQMC, cellIdListforQMC),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_CellIdListforQMC,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"cellIdListforQMC"
		},
	{ ATF_POINTER, 1, offsetof(struct CellBasedQMC, iE_Extensions),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ProtocolExtensionContainer_8858P25,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"iE-Extensions"
		},
};
static const int asn_MAP_CellBasedQMC_oms_1[] = { 1 };
static const ber_tlv_tag_t asn_DEF_CellBasedQMC_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_CellBasedQMC_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellIdListforQMC */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_CellBasedQMC_specs_1 = {
	sizeof(struct CellBasedQMC),
	offsetof(struct CellBasedQMC, _asn_ctx),
	asn_MAP_CellBasedQMC_tag2el_1,
	2,	/* Count of tags in the map */
	asn_MAP_CellBasedQMC_oms_1,	/* Optional members */
	1, 0,	/* Root/Additions */
	2,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_CellBasedQMC = {
	"CellBasedQMC",
	"CellBasedQMC",
	&asn_OP_SEQUENCE,
	asn_DEF_CellBasedQMC_tags_1,
	sizeof(asn_DEF_CellBasedQMC_tags_1)
		/sizeof(asn_DEF_CellBasedQMC_tags_1[0]), /* 1 */
	asn_DEF_CellBasedQMC_tags_1,	/* Same as above */
	sizeof(asn_DEF_CellBasedQMC_tags_1)
		/sizeof(asn_DEF_CellBasedQMC_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_CellBasedQMC_1,
	2,	/* Elements count */
	&asn_SPC_CellBasedQMC_specs_1	/* Additional specs */
};

