/*
 * 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-SgNBModReqd-Item-SgNBPDCPnotpresent.h"

#include "GTPtunnelEndpoint.h"
#include "ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_1[] = {
	{ ATF_POINTER, 3, offsetof(struct E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent, sgNB_DL_GTP_TEIDatSCG),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_GTPtunnelEndpoint,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"sgNB-DL-GTP-TEIDatSCG"
		},
	{ ATF_POINTER, 2, offsetof(struct E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent, secondary_sgNB_DL_GTP_TEIDatSCG),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_GTPtunnelEndpoint,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"secondary-sgNB-DL-GTP-TEIDatSCG"
		},
	{ ATF_POINTER, 1, offsetof(struct E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent, iE_Extensions),
		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ProtocolExtensionContainer_7683P74,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"iE-Extensions"
		},
};
static const int asn_MAP_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_oms_1[] = { 0, 1, 2 };
static const ber_tlv_tag_t asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sgNB-DL-GTP-TEIDatSCG */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* secondary-sgNB-DL-GTP-TEIDatSCG */
    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_specs_1 = {
	sizeof(struct E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent),
	offsetof(struct E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent, _asn_ctx),
	asn_MAP_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tag2el_1,
	3,	/* Count of tags in the map */
	asn_MAP_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_oms_1,	/* Optional members */
	3, 0,	/* Root/Additions */
	3,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent = {
	"E-RABs-ToBeModified-SgNBModReqd-Item-SgNBPDCPnotpresent",
	"E-RABs-ToBeModified-SgNBModReqd-Item-SgNBPDCPnotpresent",
	&asn_OP_SEQUENCE,
	asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tags_1,
	sizeof(asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tags_1)
		/sizeof(asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tags_1[0]), /* 1 */
	asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tags_1,	/* Same as above */
	sizeof(asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tags_1)
		/sizeof(asn_DEF_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_1,
	3,	/* Elements count */
	&asn_SPC_E_RABs_ToBeModified_SgNBModReqd_Item_SgNBPDCPnotpresent_specs_1	/* Additional specs */
};

