/*
 * 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 "SubbandCQI.h"

#include "SubbandCQICodeword1.h"
#include "ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_SubbandCQI_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct SubbandCQI, subbandCQICodeword0),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		+1,	/* EXPLICIT tag at current level */
		&asn_DEF_SubbandCQICodeword0,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"subbandCQICodeword0"
		},
	{ ATF_POINTER, 2, offsetof(struct SubbandCQI, subbandCQICodeword1),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		+1,	/* EXPLICIT tag at current level */
		&asn_DEF_SubbandCQICodeword1,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"subbandCQICodeword1"
		},
	{ ATF_POINTER, 1, offsetof(struct SubbandCQI, iE_Extensions),
		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ProtocolExtensionContainer_8858P67,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"iE-Extensions"
		},
};
static const int asn_MAP_SubbandCQI_oms_1[] = { 1, 2 };
static const ber_tlv_tag_t asn_DEF_SubbandCQI_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_SubbandCQI_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* subbandCQICodeword0 */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* subbandCQICodeword1 */
    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_SubbandCQI_specs_1 = {
	sizeof(struct SubbandCQI),
	offsetof(struct SubbandCQI, _asn_ctx),
	asn_MAP_SubbandCQI_tag2el_1,
	3,	/* Count of tags in the map */
	asn_MAP_SubbandCQI_oms_1,	/* Optional members */
	2, 0,	/* Root/Additions */
	3,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_SubbandCQI = {
	"SubbandCQI",
	"SubbandCQI",
	&asn_OP_SEQUENCE,
	asn_DEF_SubbandCQI_tags_1,
	sizeof(asn_DEF_SubbandCQI_tags_1)
		/sizeof(asn_DEF_SubbandCQI_tags_1[0]), /* 1 */
	asn_DEF_SubbandCQI_tags_1,	/* Same as above */
	sizeof(asn_DEF_SubbandCQI_tags_1)
		/sizeof(asn_DEF_SubbandCQI_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_SubbandCQI_1,
	3,	/* Elements count */
	&asn_SPC_SubbandCQI_specs_1	/* Additional specs */
};

