asn1c/tests/125-bitstring-constraint-OK...

89 lines
2.0 KiB
Plaintext

/*** <<< INCLUDES [T] >>> ***/
#include <BIT_STRING.h>
/*** <<< DEPS [T] >>> ***/
typedef enum T {
T_flag1 = 0,
T_flag2 = 1,
T_flag3 = 2
} e_T;
/*** <<< TYPE-DECLS [T] >>> ***/
typedef BIT_STRING_t T_t;
/*** <<< FUNC-DECLS [T] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_T;
asn_struct_free_f T_free;
asn_struct_print_f T_print;
asn_constr_check_f T_constraint;
ber_type_decoder_f T_decode_ber;
der_type_encoder_f T_encode_der;
xer_type_decoder_f T_decode_xer;
xer_type_encoder_f T_encode_xer;
/*** <<< CODE [T] >>> ***/
int
T_constraint(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;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(1 /* No applicable constraints whatsoever */) {
(void)st; /* Unused variable */
/* Nothing is here. See below */
}
/* Replace with underlying type checker */
td->check_constraints = asn_DEF_BIT_STRING.check_constraints;
return td->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
* This type is implemented using BIT_STRING,
* so here we adjust the DEF accordingly.
*/
/*** <<< STAT-DEFS [T] >>> ***/
static const ber_tlv_tag_t asn_DEF_T_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
BIT_STRING_free,
BIT_STRING_print,
T_constraint,
BIT_STRING_decode_ber,
BIT_STRING_encode_der,
BIT_STRING_decode_xer,
BIT_STRING_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_T_tags_1,
sizeof(asn_DEF_T_tags_1)
/sizeof(asn_DEF_T_tags_1[0]), /* 1 */
asn_DEF_T_tags_1, /* Same as above */
sizeof(asn_DEF_T_tags_1)
/sizeof(asn_DEF_T_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
0, 0, /* Defined elsewhere */
&asn_SPC_BIT_STRING_specs /* Additional specs */
};