/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "X2AP-PDU-Contents"
 * 	found in "Spec/e2ap-v031ex.asn"
 * 	`asn1c -fcompound-names -fno-include-deps -findirect-choice -gen-PER`
 */

#include "E-RABs-ToBeReleased-RelConfItem.h"

#include "E-RABs-ToBeReleased-RelConfItem-SCG-Bearer.h"
#include "E-RABs-ToBeReleased-RelConfItem-Split-Bearer.h"
static asn_oer_constraints_t asn_OER_type_E_RABs_ToBeReleased_RelConfItem_constr_1 CC_NOTUSED = {
	{ 0, 0 },
	-1};
static asn_per_constraints_t asn_PER_type_E_RABs_ToBeReleased_RelConfItem_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_ToBeReleased_RelConfItem_1[] = {
	{ ATF_POINTER, 0, offsetof(struct E_RABs_ToBeReleased_RelConfItem, choice.sCG_Bearer),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_E_RABs_ToBeReleased_RelConfItem_SCG_Bearer,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"sCG-Bearer"
		},
	{ ATF_POINTER, 0, offsetof(struct E_RABs_ToBeReleased_RelConfItem, choice.split_Bearer),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_E_RABs_ToBeReleased_RelConfItem_Split_Bearer,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"split-Bearer"
		},
};
static const asn_TYPE_tag2member_t asn_MAP_E_RABs_ToBeReleased_RelConfItem_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_ToBeReleased_RelConfItem_specs_1 = {
	sizeof(struct E_RABs_ToBeReleased_RelConfItem),
	offsetof(struct E_RABs_ToBeReleased_RelConfItem, _asn_ctx),
	offsetof(struct E_RABs_ToBeReleased_RelConfItem, present),
	sizeof(((struct E_RABs_ToBeReleased_RelConfItem *)0)->present),
	asn_MAP_E_RABs_ToBeReleased_RelConfItem_tag2el_1,
	2,	/* Count of tags in the map */
	0, 0,
	2	/* Extensions start */
};
asn_TYPE_descriptor_t asn_DEF_E_RABs_ToBeReleased_RelConfItem = {
	"E-RABs-ToBeReleased-RelConfItem",
	"E-RABs-ToBeReleased-RelConfItem",
	&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_ToBeReleased_RelConfItem_constr_1, &asn_PER_type_E_RABs_ToBeReleased_RelConfItem_constr_1, CHOICE_constraint },
	asn_MBR_E_RABs_ToBeReleased_RelConfItem_1,
	2,	/* Elements count */
	&asn_SPC_E_RABs_ToBeReleased_RelConfItem_specs_1	/* Additional specs */
};

