/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "X2AP-PDU-Contents"
 * 	found in "X2AP-15-4-0.asn1"
 * 	`asn1c -D ./asn1_n1 -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
 */

#include "E-RABs-ToBeModified-ModReqItem.h"

#include "E-RABs-ToBeModified-ModReqItem-SCG-Bearer.h"
#include "E-RABs-ToBeModified-ModReqItem-Split-Bearer.h"
static asn_oer_constraints_t asn_OER_type_E_RABs_ToBeModified_ModReqItem_constr_1 CC_NOTUSED = {
	{ 0, 0 },
	-1};
static asn_per_constraints_t asn_PER_type_E_RABs_ToBeModified_ModReqItem_constr_1 CC_NOTUSED = {
	{ APC_CONSTRAINED | APC_EXTENSIBLE,  1,  1,  0,  1 }	/* (0..1,...) */,
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	0, 0	/* No PER value map */
};
static asn_TYPE_member_t asn_MBR_E_RABs_ToBeModified_ModReqItem_1[] = {
	{ ATF_POINTER, 0, offsetof(struct E_RABs_ToBeModified_ModReqItem, choice.sCG_Bearer),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_E_RABs_ToBeModified_ModReqItem_SCG_Bearer,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"sCG-Bearer"
		},
	{ ATF_POINTER, 0, offsetof(struct E_RABs_ToBeModified_ModReqItem, choice.split_Bearer),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_E_RABs_ToBeModified_ModReqItem_Split_Bearer,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"split-Bearer"
		},
};
static const asn_TYPE_tag2member_t asn_MAP_E_RABs_ToBeModified_ModReqItem_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sCG-Bearer */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* split-Bearer */
};
static asn_CHOICE_specifics_t asn_SPC_E_RABs_ToBeModified_ModReqItem_specs_1 = {
	sizeof(struct E_RABs_ToBeModified_ModReqItem),
	offsetof(struct E_RABs_ToBeModified_ModReqItem, _asn_ctx),
	offsetof(struct E_RABs_ToBeModified_ModReqItem, present),
	sizeof(((struct E_RABs_ToBeModified_ModReqItem *)0)->present),
	asn_MAP_E_RABs_ToBeModified_ModReqItem_tag2el_1,
	2,	/* Count of tags in the map */
	0, 0,
	2	/* Extensions start */
};
asn_TYPE_descriptor_t asn_DEF_E_RABs_ToBeModified_ModReqItem = {
	"E-RABs-ToBeModified-ModReqItem",
	"E-RABs-ToBeModified-ModReqItem",
	&asn_OP_CHOICE,
	0,	/* No effective tags (pointer) */
	0,	/* No effective tags (count) */
	0,	/* No tags (pointer) */
	0,	/* No tags (count) */
	{ &asn_OER_type_E_RABs_ToBeModified_ModReqItem_constr_1, &asn_PER_type_E_RABs_ToBeModified_ModReqItem_constr_1, CHOICE_constraint },
	asn_MBR_E_RABs_ToBeModified_ModReqItem_1,
	2,	/* Elements count */
	&asn_SPC_E_RABs_ToBeModified_ModReqItem_specs_1	/* Additional specs */
};

