/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "PEDefinitions"
 * 	found in "../../../asn1/PEDefinitions.asn"
 * 	`asn1c -fcompound-names -no-gen-example`
 */

#include "KeyObject.h"

static int
memb_keyUsageQualifier_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	const OCTET_STRING_t *st = (const OCTET_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;
	}
	
	size = st->size;
	
	if((size >= 1 && size <= 2)) {
		/* Constraint check succeeded */
		return 0;
	} else {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: constraint failed (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
}

static int
memb_keyAccess_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	const OCTET_STRING_t *st = (const OCTET_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;
	}
	
	size = st->size;
	
	if((size == 1)) {
		/* Constraint check succeeded */
		return 0;
	} else {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: constraint failed (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
}

static int
memb_keyIdentifier_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	const OCTET_STRING_t *st = (const OCTET_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;
	}
	
	size = st->size;
	
	if((size == 1)) {
		/* Constraint check succeeded */
		return 0;
	} else {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: constraint failed (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
}

static int
memb_keyVersionNumber_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	const OCTET_STRING_t *st = (const OCTET_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;
	}
	
	size = st->size;
	
	if((size == 1)) {
		/* Constraint check succeeded */
		return 0;
	} else {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: constraint failed (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
}

static int
memb_keyCompontents_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	size_t size;
	
	if(!sptr) {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: value not given (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
	
	/* Determine the number of elements */
	size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
	
	if((size >= 1)) {
		/* Perform validation of the inner elements */
		return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key);
	} else {
		ASN__CTFAIL(app_key, td, sptr,
			"%s: constraint failed (%s:%d)",
			td->name, __FILE__, __LINE__);
		return -1;
	}
}

static asn_oer_constraints_t asn_OER_type_keyCompontents_constr_7 CC_NOTUSED = {
	{ 0, 0 },
	-1	/* (SIZE(1..MAX)) */};
static asn_per_constraints_t asn_PER_type_keyCompontents_constr_7 CC_NOTUSED = {
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	{ APC_SEMI_CONSTRAINED,	-1, -1,  1,  0 }	/* (SIZE(1..MAX)) */,
	0, 0	/* No PER value map */
};
static asn_oer_constraints_t asn_OER_memb_keyUsageQualifier_constr_2 CC_NOTUSED = {
	{ 0, 0 },
	-1	/* (SIZE(1..2)) */};
static asn_per_constraints_t asn_PER_memb_keyUsageQualifier_constr_2 CC_NOTUSED = {
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	{ APC_CONSTRAINED,	 1,  1,  1,  2 }	/* (SIZE(1..2)) */,
	0, 0	/* No PER value map */
};
static asn_oer_constraints_t asn_OER_memb_keyAccess_constr_3 CC_NOTUSED = {
	{ 0, 0 },
	1	/* (SIZE(1..1)) */};
static asn_per_constraints_t asn_PER_memb_keyAccess_constr_3 CC_NOTUSED = {
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	{ APC_CONSTRAINED,	 0,  0,  1,  1 }	/* (SIZE(1..1)) */,
	0, 0	/* No PER value map */
};
static asn_oer_constraints_t asn_OER_memb_keyIdentifier_constr_4 CC_NOTUSED = {
	{ 0, 0 },
	1	/* (SIZE(1..1)) */};
static asn_per_constraints_t asn_PER_memb_keyIdentifier_constr_4 CC_NOTUSED = {
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	{ APC_CONSTRAINED,	 0,  0,  1,  1 }	/* (SIZE(1..1)) */,
	0, 0	/* No PER value map */
};
static asn_oer_constraints_t asn_OER_memb_keyVersionNumber_constr_5 CC_NOTUSED = {
	{ 0, 0 },
	1	/* (SIZE(1..1)) */};
static asn_per_constraints_t asn_PER_memb_keyVersionNumber_constr_5 CC_NOTUSED = {
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	{ APC_CONSTRAINED,	 0,  0,  1,  1 }	/* (SIZE(1..1)) */,
	0, 0	/* No PER value map */
};
static asn_oer_constraints_t asn_OER_memb_keyCompontents_constr_7 CC_NOTUSED = {
	{ 0, 0 },
	-1	/* (SIZE(1..MAX)) */};
static asn_per_constraints_t asn_PER_memb_keyCompontents_constr_7 CC_NOTUSED = {
	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
	{ APC_SEMI_CONSTRAINED,	-1, -1,  1,  0 }	/* (SIZE(1..MAX)) */,
	0, 0	/* No PER value map */
};
static int asn_DFL_11_cmp_8(const void *sptr) {
	const UInt8_t *st = sptr;
	
	if(!st) {
		return -1; /* No value is not a default value */
	}
	
	/* Test default value 8 */
	return (*st != 8);
}
static int asn_DFL_11_set_8(void **sptr) {
	UInt8_t *st = *sptr;
	
	if(!st) {
		st = (*sptr = CALLOC(1, sizeof(*st)));
		if(!st) return -1;
	}
	
	/* Install default value 8 */
	*st = 8;
	return 0;
}
static asn_TYPE_member_t asn_MBR_Member_8[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct KeyObject__keyCompontents__Member, keyType),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_OCTET_STRING,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"keyType"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct KeyObject__keyCompontents__Member, keyData),
		(ASN_TAG_CLASS_CONTEXT | (6 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_OCTET_STRING,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"keyData"
		},
	{ ATF_POINTER, 1, offsetof(struct KeyObject__keyCompontents__Member, macLength),
		(ASN_TAG_CLASS_CONTEXT | (7 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_UInt8,
		0,
		{ 0, 0, 0 },
		&asn_DFL_11_cmp_8,	/* Compare DEFAULT 8 */
		&asn_DFL_11_set_8,	/* Set DEFAULT 8 */
		"macLength"
		},
};
static const int asn_MAP_Member_oms_8[] = { 2 };
static const ber_tlv_tag_t asn_DEF_Member_tags_8[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_Member_tag2el_8[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* keyType */
    { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* keyData */
    { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 2, 0, 0 } /* macLength */
};
static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_8 = {
	sizeof(struct KeyObject__keyCompontents__Member),
	offsetof(struct KeyObject__keyCompontents__Member, _asn_ctx),
	asn_MAP_Member_tag2el_8,
	3,	/* Count of tags in the map */
	asn_MAP_Member_oms_8,	/* Optional members */
	1, 0,	/* Root/Additions */
	3,	/* First extension addition */
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_Member_8 = {
	"SEQUENCE",
	"SEQUENCE",
	&asn_OP_SEQUENCE,
	asn_DEF_Member_tags_8,
	sizeof(asn_DEF_Member_tags_8)
		/sizeof(asn_DEF_Member_tags_8[0]), /* 1 */
	asn_DEF_Member_tags_8,	/* Same as above */
	sizeof(asn_DEF_Member_tags_8)
		/sizeof(asn_DEF_Member_tags_8[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_Member_8,
	3,	/* Elements count */
	&asn_SPC_Member_specs_8	/* Additional specs */
};

static asn_TYPE_member_t asn_MBR_keyCompontents_7[] = {
	{ ATF_POINTER, 0, 0,
		(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
		0,
		&asn_DEF_Member_8,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		""
		},
};
static const ber_tlv_tag_t asn_DEF_keyCompontents_tags_7[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_SET_OF_specifics_t asn_SPC_keyCompontents_specs_7 = {
	sizeof(struct KeyObject__keyCompontents),
	offsetof(struct KeyObject__keyCompontents, _asn_ctx),
	0,	/* XER encoding is XMLDelimitedItemList */
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_keyCompontents_7 = {
	"keyCompontents",
	"keyCompontents",
	&asn_OP_SEQUENCE_OF,
	asn_DEF_keyCompontents_tags_7,
	sizeof(asn_DEF_keyCompontents_tags_7)
		/sizeof(asn_DEF_keyCompontents_tags_7[0]), /* 1 */
	asn_DEF_keyCompontents_tags_7,	/* Same as above */
	sizeof(asn_DEF_keyCompontents_tags_7)
		/sizeof(asn_DEF_keyCompontents_tags_7[0]), /* 1 */
	{ &asn_OER_type_keyCompontents_constr_7, &asn_PER_type_keyCompontents_constr_7, SEQUENCE_OF_constraint },
	asn_MBR_keyCompontents_7,
	1,	/* Single element */
	&asn_SPC_keyCompontents_specs_7	/* Additional specs */
};

asn_TYPE_member_t asn_MBR_KeyObject_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct KeyObject, keyUsageQualifier),
		(ASN_TAG_CLASS_CONTEXT | (21 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_OCTET_STRING,
		0,
		{ &asn_OER_memb_keyUsageQualifier_constr_2, &asn_PER_memb_keyUsageQualifier_constr_2,  memb_keyUsageQualifier_constraint_1 },
		0, 0, /* No default value */
		"keyUsageQualifier"
		},
	{ ATF_POINTER, 1, offsetof(struct KeyObject, keyAccess),
		(ASN_TAG_CLASS_CONTEXT | (22 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_OCTET_STRING,
		0,
		{ &asn_OER_memb_keyAccess_constr_3, &asn_PER_memb_keyAccess_constr_3,  memb_keyAccess_constraint_1 },
		0, 0, /* No default value */
		"keyAccess"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct KeyObject, keyIdentifier),
		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_OCTET_STRING,
		0,
		{ &asn_OER_memb_keyIdentifier_constr_4, &asn_PER_memb_keyIdentifier_constr_4,  memb_keyIdentifier_constraint_1 },
		0, 0, /* No default value */
		"keyIdentifier"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct KeyObject, keyVersionNumber),
		(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_OCTET_STRING,
		0,
		{ &asn_OER_memb_keyVersionNumber_constr_5, &asn_PER_memb_keyVersionNumber_constr_5,  memb_keyVersionNumber_constraint_1 },
		0, 0, /* No default value */
		"keyVersionNumber"
		},
	{ ATF_POINTER, 1, offsetof(struct KeyObject, keyCounterValue),
		(ASN_TAG_CLASS_CONTEXT | (5 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_OCTET_STRING,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"keyCounterValue"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct KeyObject, keyCompontents),
		(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
		0,
		&asn_DEF_keyCompontents_7,
		0,
		{ &asn_OER_memb_keyCompontents_constr_7, &asn_PER_memb_keyCompontents_constr_7,  memb_keyCompontents_constraint_1 },
		0, 0, /* No default value */
		"keyCompontents"
		},
};
static const int asn_MAP_KeyObject_oms_1[] = { 1, 4 };
static const ber_tlv_tag_t asn_DEF_KeyObject_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_KeyObject_tag2el_1[] = {
    { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, 0, 0 }, /* keyCompontents */
    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* keyIdentifier */
    { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* keyVersionNumber */
    { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 4, 0, 0 }, /* keyCounterValue */
    { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 0, 0, 0 }, /* keyUsageQualifier */
    { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 1, 0, 0 } /* keyAccess */
};
asn_SEQUENCE_specifics_t asn_SPC_KeyObject_specs_1 = {
	sizeof(struct KeyObject),
	offsetof(struct KeyObject, _asn_ctx),
	asn_MAP_KeyObject_tag2el_1,
	6,	/* Count of tags in the map */
	asn_MAP_KeyObject_oms_1,	/* Optional members */
	2, 0,	/* Root/Additions */
	6,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_KeyObject = {
	"KeyObject",
	"KeyObject",
	&asn_OP_SEQUENCE,
	asn_DEF_KeyObject_tags_1,
	sizeof(asn_DEF_KeyObject_tags_1)
		/sizeof(asn_DEF_KeyObject_tags_1[0]), /* 1 */
	asn_DEF_KeyObject_tags_1,	/* Same as above */
	sizeof(asn_DEF_KeyObject_tags_1)
		/sizeof(asn_DEF_KeyObject_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_KeyObject_1,
	6,	/* Elements count */
	&asn_SPC_KeyObject_specs_1	/* Additional specs */
};

