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

#include "ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_CompositeAvailableCapacity_1[] = {
	{ ATF_POINTER, 1, offsetof(struct CompositeAvailableCapacity, cellCapacityClassValue),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_CellCapacityClassValue,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"cellCapacityClassValue"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct CompositeAvailableCapacity, capacityValue),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_CapacityValue,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"capacityValue"
		},
	{ ATF_POINTER, 1, offsetof(struct CompositeAvailableCapacity, iE_Extensions),
		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ProtocolExtensionContainer_8858P31,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"iE-Extensions"
		},
};
static const int asn_MAP_CompositeAvailableCapacity_oms_1[] = { 0, 2 };
static const ber_tlv_tag_t asn_DEF_CompositeAvailableCapacity_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_CompositeAvailableCapacity_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellCapacityClassValue */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* capacityValue */
    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_CompositeAvailableCapacity_specs_1 = {
	sizeof(struct CompositeAvailableCapacity),
	offsetof(struct CompositeAvailableCapacity, _asn_ctx),
	asn_MAP_CompositeAvailableCapacity_tag2el_1,
	3,	/* Count of tags in the map */
	asn_MAP_CompositeAvailableCapacity_oms_1,	/* Optional members */
	2, 0,	/* Root/Additions */
	3,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_CompositeAvailableCapacity = {
	"CompositeAvailableCapacity",
	"CompositeAvailableCapacity",
	&asn_OP_SEQUENCE,
	asn_DEF_CompositeAvailableCapacity_tags_1,
	sizeof(asn_DEF_CompositeAvailableCapacity_tags_1)
		/sizeof(asn_DEF_CompositeAvailableCapacity_tags_1[0]), /* 1 */
	asn_DEF_CompositeAvailableCapacity_tags_1,	/* Same as above */
	sizeof(asn_DEF_CompositeAvailableCapacity_tags_1)
		/sizeof(asn_DEF_CompositeAvailableCapacity_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_CompositeAvailableCapacity_1,
	3,	/* Elements count */
	&asn_SPC_CompositeAvailableCapacity_specs_1	/* Additional specs */
};

