/*
 * 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 "BandwidthReducedSI.h"

/*
 * This type is implemented using NativeEnumerated,
 * so here we adjust the DEF accordingly.
 */
static asn_per_constraints_t asn_PER_type_BandwidthReducedSI_constr_1 CC_NOTUSED = {
	{ APC_CONSTRAINED | APC_EXTENSIBLE,  0,  0,  0,  0 }	/* (0..0,...) */,
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	0, 0	/* No PER value map */
};
static const asn_INTEGER_enum_map_t asn_MAP_BandwidthReducedSI_value2enum_1[] = {
	{ 0,	9,	"scheduled" }
	/* This list is extensible */
};
static const unsigned int asn_MAP_BandwidthReducedSI_enum2value_1[] = {
	0	/* scheduled(0) */
	/* This list is extensible */
};
static const asn_INTEGER_specifics_t asn_SPC_BandwidthReducedSI_specs_1 = {
	asn_MAP_BandwidthReducedSI_value2enum_1,	/* "tag" => N; sorted by tag */
	asn_MAP_BandwidthReducedSI_enum2value_1,	/* N => "tag"; sorted by N */
	1,	/* Number of elements in the maps */
	2,	/* Extensions before this member */
	1,	/* Strict enumeration */
	0,	/* Native long size */
	0
};
static const ber_tlv_tag_t asn_DEF_BandwidthReducedSI_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_BandwidthReducedSI = {
	"BandwidthReducedSI",
	"BandwidthReducedSI",
	&asn_OP_NativeEnumerated,
	asn_DEF_BandwidthReducedSI_tags_1,
	sizeof(asn_DEF_BandwidthReducedSI_tags_1)
		/sizeof(asn_DEF_BandwidthReducedSI_tags_1[0]), /* 1 */
	asn_DEF_BandwidthReducedSI_tags_1,	/* Same as above */
	sizeof(asn_DEF_BandwidthReducedSI_tags_1)
		/sizeof(asn_DEF_BandwidthReducedSI_tags_1[0]), /* 1 */
	{ 0, &asn_PER_type_BandwidthReducedSI_constr_1, NativeEnumerated_constraint },
	0, 0,	/* Defined elsewhere */
	&asn_SPC_BandwidthReducedSI_specs_1	/* Additional specs */
};

