/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "E2SM-gNB-X2-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 "InterfaceProtocolIE-Item.h"

asn_TYPE_member_t asn_MBR_InterfaceProtocolIE_Item_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct InterfaceProtocolIE_Item, interfaceProtocolIE_ID),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_InterfaceProtocolIE_ID,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"interfaceProtocolIE-ID"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct InterfaceProtocolIE_Item, interfaceProtocolIE_Test),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_InterfaceProtocolIE_Test,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"interfaceProtocolIE-Test"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct InterfaceProtocolIE_Item, interfaceProtocolIE_Value),
		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
		+1,	/* EXPLICIT tag at current level */
		&asn_DEF_InterfaceProtocolIE_Value,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"interfaceProtocolIE-Value"
		},
};
static const ber_tlv_tag_t asn_DEF_InterfaceProtocolIE_Item_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_InterfaceProtocolIE_Item_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* interfaceProtocolIE-ID */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* interfaceProtocolIE-Test */
    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* interfaceProtocolIE-Value */
};
asn_SEQUENCE_specifics_t asn_SPC_InterfaceProtocolIE_Item_specs_1 = {
	sizeof(struct InterfaceProtocolIE_Item),
	offsetof(struct InterfaceProtocolIE_Item, _asn_ctx),
	asn_MAP_InterfaceProtocolIE_Item_tag2el_1,
	3,	/* Count of tags in the map */
	0, 0, 0,	/* Optional elements (not needed) */
	3,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_InterfaceProtocolIE_Item = {
	"InterfaceProtocolIE-Item",
	"InterfaceProtocolIE-Item",
	&asn_OP_SEQUENCE,
	asn_DEF_InterfaceProtocolIE_Item_tags_1,
	sizeof(asn_DEF_InterfaceProtocolIE_Item_tags_1)
		/sizeof(asn_DEF_InterfaceProtocolIE_Item_tags_1[0]), /* 1 */
	asn_DEF_InterfaceProtocolIE_Item_tags_1,	/* Same as above */
	sizeof(asn_DEF_InterfaceProtocolIE_Item_tags_1)
		/sizeof(asn_DEF_InterfaceProtocolIE_Item_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_InterfaceProtocolIE_Item_1,
	3,	/* Elements count */
	&asn_SPC_InterfaceProtocolIE_Item_specs_1	/* Additional specs */
};

