/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "X2AP-PDU-Contents"
 * 	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 "SeNBReconfigurationComplete.h"

static asn_TYPE_member_t asn_MBR_SeNBReconfigurationComplete_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct SeNBReconfigurationComplete, protocolIEs),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ProtocolIE_Container_8807P28,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"protocolIEs"
		},
};
static const ber_tlv_tag_t asn_DEF_SeNBReconfigurationComplete_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_SeNBReconfigurationComplete_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* protocolIEs */
};
static asn_SEQUENCE_specifics_t asn_SPC_SeNBReconfigurationComplete_specs_1 = {
	sizeof(struct SeNBReconfigurationComplete),
	offsetof(struct SeNBReconfigurationComplete, _asn_ctx),
	asn_MAP_SeNBReconfigurationComplete_tag2el_1,
	1,	/* Count of tags in the map */
	0, 0, 0,	/* Optional elements (not needed) */
	1,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_SeNBReconfigurationComplete = {
	"SeNBReconfigurationComplete",
	"SeNBReconfigurationComplete",
	&asn_OP_SEQUENCE,
	asn_DEF_SeNBReconfigurationComplete_tags_1,
	sizeof(asn_DEF_SeNBReconfigurationComplete_tags_1)
		/sizeof(asn_DEF_SeNBReconfigurationComplete_tags_1[0]), /* 1 */
	asn_DEF_SeNBReconfigurationComplete_tags_1,	/* Same as above */
	sizeof(asn_DEF_SeNBReconfigurationComplete_tags_1)
		/sizeof(asn_DEF_SeNBReconfigurationComplete_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_SeNBReconfigurationComplete_1,
	1,	/* Elements count */
	&asn_SPC_SeNBReconfigurationComplete_specs_1	/* Additional specs */
};

