/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "E2SM-KPM-RC"
 * 	found in "e2sm-kpm-rc.asn"
 * 	`asn1c -fcompound-names -fno-include-deps -findirect-choice -pdu=auto -gen-PER -gen-OER -no-gen-example -D .`
 */

#include "MeasResultEUTRA.h"

asn_TYPE_member_t asn_MBR_MeasResultEUTRA_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct MeasResultEUTRA, eutra_PhysCellId),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_PhysCellId,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"eutra-PhysCellId"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct MeasResultEUTRA, measResult),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_MeasQuantityResultsEUTRA,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"measResult"
		},
};
static const ber_tlv_tag_t asn_DEF_MeasResultEUTRA_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_MeasResultEUTRA_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* eutra-PhysCellId */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* measResult */
};
asn_SEQUENCE_specifics_t asn_SPC_MeasResultEUTRA_specs_1 = {
	sizeof(struct MeasResultEUTRA),
	offsetof(struct MeasResultEUTRA, _asn_ctx),
	asn_MAP_MeasResultEUTRA_tag2el_1,
	2,	/* Count of tags in the map */
	0, 0, 0,	/* Optional elements (not needed) */
	2,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_MeasResultEUTRA = {
	"MeasResultEUTRA",
	"MeasResultEUTRA",
	&asn_OP_SEQUENCE,
	asn_DEF_MeasResultEUTRA_tags_1,
	sizeof(asn_DEF_MeasResultEUTRA_tags_1)
		/sizeof(asn_DEF_MeasResultEUTRA_tags_1[0]), /* 1 */
	asn_DEF_MeasResultEUTRA_tags_1,	/* Same as above */
	sizeof(asn_DEF_MeasResultEUTRA_tags_1)
		/sizeof(asn_DEF_MeasResultEUTRA_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_MeasResultEUTRA_1,
	2,	/* Elements count */
	&asn_SPC_MeasResultEUTRA_specs_1	/* Additional specs */
};

