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

#include "DuplicationActivation.h"

/*
 * This type is implemented using NativeEnumerated,
 * so here we adjust the DEF accordingly.
 */
static asn_oer_constraints_t asn_OER_type_DuplicationActivation_constr_1 CC_NOTUSED = {
	{ 0, 0 },
	-1};
static asn_per_constraints_t asn_PER_type_DuplicationActivation_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 const asn_INTEGER_enum_map_t asn_MAP_DuplicationActivation_value2enum_1[] = {
	{ 0,	6,	"active" },
	{ 1,	8,	"inactive" }
	/* This list is extensible */
};
static const unsigned int asn_MAP_DuplicationActivation_enum2value_1[] = {
	0,	/* active(0) */
	1	/* inactive(1) */
	/* This list is extensible */
};
static const asn_INTEGER_specifics_t asn_SPC_DuplicationActivation_specs_1 = {
	asn_MAP_DuplicationActivation_value2enum_1,	/* "tag" => N; sorted by tag */
	asn_MAP_DuplicationActivation_enum2value_1,	/* N => "tag"; sorted by N */
	2,	/* Number of elements in the maps */
	3,	/* Extensions before this member */
	1,	/* Strict enumeration */
	0,	/* Native long size */
	0
};
static const ber_tlv_tag_t asn_DEF_DuplicationActivation_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_DuplicationActivation = {
	"DuplicationActivation",
	"DuplicationActivation",
	&asn_OP_NativeEnumerated,
	asn_DEF_DuplicationActivation_tags_1,
	sizeof(asn_DEF_DuplicationActivation_tags_1)
		/sizeof(asn_DEF_DuplicationActivation_tags_1[0]), /* 1 */
	asn_DEF_DuplicationActivation_tags_1,	/* Same as above */
	sizeof(asn_DEF_DuplicationActivation_tags_1)
		/sizeof(asn_DEF_DuplicationActivation_tags_1[0]), /* 1 */
	{ &asn_OER_type_DuplicationActivation_constr_1, &asn_PER_type_DuplicationActivation_constr_1, NativeEnumerated_constraint },
	0, 0,	/* Defined elsewhere */
	&asn_SPC_DuplicationActivation_specs_1	/* Additional specs */
};

