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

int
ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
	size_t size;
	
	if(!sptr) {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: value not given (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
	
	if(st->size > 0) {
		/* Size in bits */
		size = 8 * st->size - (st->bits_unused & 0x07);
	} else {
		size = 0;
	}
	
	if((size >= 1 && size <= 131072)) {
		/* Constraint check succeeded */
		return 0;
	} else {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: constraint failed (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
}

/*
 * This type is implemented using BIT_STRING,
 * so here we adjust the DEF accordingly.
 */
static asn_oer_constraints_t asn_OER_type_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_constr_1 CC_NOTUSED = {
	{ 0, 0 },
	-1	/* (SIZE(1..131072)) */};
static asn_per_constraints_t asn_PER_type_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_constr_1 CC_NOTUSED = {
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	{ APC_CONSTRAINED,	 17, -1,  1,  131072 }	/* (SIZE(1..131072)) */,
	0, 0	/* No PER value map */
};
static const ber_tlv_tag_t asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
};
asn_TYPE_descriptor_t asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18 = {
	"ReceiveStatusOfULPDCPSDUsPDCP-SNlength18",
	"ReceiveStatusOfULPDCPSDUsPDCP-SNlength18",
	&asn_OP_BIT_STRING,
	asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_tags_1,
	sizeof(asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_tags_1)
		/sizeof(asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_tags_1[0]), /* 1 */
	asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_tags_1,	/* Same as above */
	sizeof(asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_tags_1)
		/sizeof(asn_DEF_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_tags_1[0]), /* 1 */
	{ &asn_OER_type_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_constr_1, &asn_PER_type_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_constr_1, ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_constraint },
	0, 0,	/* No members */
	&asn_SPC_BIT_STRING_specs	/* Additional specs */
};

