/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "X2AP-IEs"
 * 	found in "X2AP-15-4-0.asn1"
 * 	`asn1c -D ./asn1_n1 -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
 */

#include "RadioResourceStatus.h"

#include "ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_RadioResourceStatus_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct RadioResourceStatus, dL_GBR_PRB_usage),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_DL_GBR_PRB_usage,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"dL-GBR-PRB-usage"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct RadioResourceStatus, uL_GBR_PRB_usage),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_UL_GBR_PRB_usage,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"uL-GBR-PRB-usage"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct RadioResourceStatus, dL_non_GBR_PRB_usage),
		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_DL_non_GBR_PRB_usage,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"dL-non-GBR-PRB-usage"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct RadioResourceStatus, uL_non_GBR_PRB_usage),
		(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_UL_non_GBR_PRB_usage,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"uL-non-GBR-PRB-usage"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct RadioResourceStatus, dL_Total_PRB_usage),
		(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_DL_Total_PRB_usage,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"dL-Total-PRB-usage"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct RadioResourceStatus, uL_Total_PRB_usage),
		(ASN_TAG_CLASS_CONTEXT | (5 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_UL_Total_PRB_usage,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"uL-Total-PRB-usage"
		},
	{ ATF_POINTER, 1, offsetof(struct RadioResourceStatus, iE_Extensions),
		(ASN_TAG_CLASS_CONTEXT | (6 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_ProtocolExtensionContainer_7683P183,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"iE-Extensions"
		},
};
static const int asn_MAP_RadioResourceStatus_oms_1[] = { 6 };
static const ber_tlv_tag_t asn_DEF_RadioResourceStatus_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_RadioResourceStatus_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dL-GBR-PRB-usage */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uL-GBR-PRB-usage */
    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* dL-non-GBR-PRB-usage */
    { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* uL-non-GBR-PRB-usage */
    { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* dL-Total-PRB-usage */
    { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* uL-Total-PRB-usage */
    { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_RadioResourceStatus_specs_1 = {
	sizeof(struct RadioResourceStatus),
	offsetof(struct RadioResourceStatus, _asn_ctx),
	asn_MAP_RadioResourceStatus_tag2el_1,
	7,	/* Count of tags in the map */
	asn_MAP_RadioResourceStatus_oms_1,	/* Optional members */
	1, 0,	/* Root/Additions */
	7,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_RadioResourceStatus = {
	"RadioResourceStatus",
	"RadioResourceStatus",
	&asn_OP_SEQUENCE,
	asn_DEF_RadioResourceStatus_tags_1,
	sizeof(asn_DEF_RadioResourceStatus_tags_1)
		/sizeof(asn_DEF_RadioResourceStatus_tags_1[0]), /* 1 */
	asn_DEF_RadioResourceStatus_tags_1,	/* Same as above */
	sizeof(asn_DEF_RadioResourceStatus_tags_1)
		/sizeof(asn_DEF_RadioResourceStatus_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_RadioResourceStatus_1,
	7,	/* Elements count */
	&asn_SPC_RadioResourceStatus_specs_1	/* Additional specs */
};

