diff --git a/ChangeLog b/ChangeLog index 11cfe205..35c09afe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,12 @@ -0.9.18: 2005-Aug-13 +0.9.18: 2005-Aug-14 * The obsolete X.208 syntax is handled gracefully now (compound types' member names are invented on the fly). (Test case 87). * Generating enumeration tables for INTEGER types (Test case 88). * Generating enumeration tables for BIT STRING types (Test case 89). * Conditional INTEGER/ENUMERATED representation: long vs. INTEGER_t - type is chosen based on PER visible constraints (Test case 90). + type is chosen based on PER visible constraints (Test cases 90, 91). 0.9.17: 2005-Aug-07 diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index bcf062f3..35de213e 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -285,12 +285,33 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) { return FL_NOTFIT; } + if(!expr->combined_constraints) + return (arg->flags & A1C_USE_NATIVE_TYPES) + ? FL_FORCED : FL_NOTFIT; + /* - * Second, pull up the PER visible range of the INTEGER. + * Second, if -fbless-SIZE is given, the (SIZE()) constraint may be + * applied (non-standard! but we can deal with this) to the type. + * Check the range. */ - if(expr->combined_constraints) - range = asn1constraint_compute_PER_range(expr->expr_type, - expr->combined_constraints, ACT_EL_RANGE, 0, 0, 0); + range = asn1constraint_compute_PER_range(expr->expr_type, + expr->combined_constraints, ACT_CT_SIZE, 0, 0, + CPR_simulate_fbless_SIZE); + if(range) { + if(!range->incompatible) { + right = range->right; + /* Use 4 instead of sizeof(long) is justified! */ + if(right.type == ARE_VALUE && right.value <= 4) + return FL_FITSOK; + } + asn1constraint_range_free(range); + } + + /* + * Third, pull up the PER visible range of the INTEGER. + */ + range = asn1constraint_compute_PER_range(expr->expr_type, + expr->combined_constraints, ACT_EL_RANGE, 0, 0, 0); if(!range || range->empty_constraint || range->extensible diff --git a/libasn1fix/asn1fix.c b/libasn1fix/asn1fix.c index 1d06dbab..aa7a2334 100644 --- a/libasn1fix/asn1fix.c +++ b/libasn1fix/asn1fix.c @@ -414,7 +414,8 @@ asn1f_check_constraints(arg_t *arg) { range = asn1constraint_compute_PER_range( etype, arg->expr->combined_constraints, - test_types[i], 0, 0, 0); + test_types[i], 0, 0, + CPR_noflags /* ignore -fbless-SIZE */); if(!range && errno == EPERM) { FATAL("This error happened for \"%s\" (meta %d) " "at line %d", diff --git a/libasn1fix/asn1fix_constraint.c b/libasn1fix/asn1fix_constraint.c index 0faee51d..4afca5aa 100644 --- a/libasn1fix/asn1fix_constraint.c +++ b/libasn1fix/asn1fix_constraint.c @@ -168,15 +168,13 @@ asn1constraint_resolve(arg_t *arg, asn1p_constraint_t *ct, asn1p_expr_type_e ety if(etype != A1TC_INVALID) { - ret = asn1constraint_compatible(etype, real_constraint_type); + ret = asn1constraint_compatible(etype, real_constraint_type, + arg->flags & A1F_EXTENDED_SizeConstraint); switch(ret) { case -1: /* If unknown, assume OK. */ case 1: break; case 0: - if(effective_type == ACT_CT_SIZE - && (arg->flags & A1F_EXTENDED_SizeConstraint)) - break; default: FATAL("%s at line %d: " "Constraint type %s is not applicable to %s", diff --git a/libasn1fix/asn1fix_constraint_compat.c b/libasn1fix/asn1fix_constraint_compat.c index 676717e1..844045f6 100644 --- a/libasn1fix/asn1fix_constraint_compat.c +++ b/libasn1fix/asn1fix_constraint_compat.c @@ -7,7 +7,7 @@ */ int asn1constraint_compatible(asn1p_expr_type_e expr_type, - enum asn1p_constraint_type_e constr_type) { + enum asn1p_constraint_type_e constr_type, int fbless_SIZE) { /* * X.680-0207, Table 9. @@ -49,6 +49,11 @@ asn1constraint_compatible(asn1p_expr_type_e expr_type, return 0; case ACT_CT_SIZE: switch(expr_type) { + case ASN_BASIC_INTEGER: + case ASN_BASIC_ENUMERATED: + if(fbless_SIZE) + return 1; + break; case ASN_BASIC_BIT_STRING: case ASN_BASIC_OCTET_STRING: case ASN_BASIC_CHARACTER_STRING: diff --git a/libasn1fix/asn1fix_crange.c b/libasn1fix/asn1fix_crange.c index 5975bc1a..86b629cb 100644 --- a/libasn1fix/asn1fix_crange.c +++ b/libasn1fix/asn1fix_crange.c @@ -711,7 +711,7 @@ _range_canonicalize(asn1cnst_range_t *range) { } asn1cnst_range_t * -asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, const asn1cnst_range_t *minmax, int *exmet, int strict_PV) { +asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) { asn1cnst_range_t *range; asn1cnst_range_t *tmp; asn1p_value_t *vmin; @@ -729,7 +729,8 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr * Check if the requested constraint is theoretically compatible * with the given expression type. */ - if(asn1constraint_compatible(expr_type, type) != 1) { + if(asn1constraint_compatible(expr_type, type, + cpr_flags & CPR_simulate_fbless_SIZE) != 1) { errno = EINVAL; return 0; } @@ -776,7 +777,8 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr if((expr_type & ASN_STRING_NKM_MASK)) range->not_PER_visible = 1; - if(!ct || (strict_PV && range->not_PER_visible)) + if(!ct + || (range->not_PER_visible && (cpr_flags & CPR_strict_PER_visibility))) return range; switch(ct->type) { @@ -809,7 +811,7 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr } assert(ct->el_count == 1); tmp = asn1constraint_compute_PER_range(expr_type, - ct->elements[0], type, minmax, exmet, strict_PV); + ct->elements[0], type, minmax, exmet, cpr_flags); if(tmp) { _range_free(range); } else { @@ -830,7 +832,7 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr tmp = asn1constraint_compute_PER_range(expr_type, ct->elements[i], type, ct->type==ACT_CA_SET?range:minmax, exmet, - strict_PV); + cpr_flags); if(!tmp) { if(errno == ERANGE) { continue; @@ -851,7 +853,8 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr continue; } - if(strict_PV && tmp->not_PER_visible) { + if(tmp->not_PER_visible + && (cpr_flags & CPR_strict_PER_visibility)) { if(ct->type == ACT_CA_SET) { /* * X.691, #9.3.18: @@ -889,7 +892,7 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr for(i = 0; i < ct->el_count; i++) { tmp = asn1constraint_compute_PER_range(expr_type, ct->elements[i], type, minmax, exmet, - strict_PV); + cpr_flags); if(!tmp) { if(errno == ERANGE) { range->extensible = 1; @@ -922,7 +925,7 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr for(; i < ct->el_count; i++) { tmp = asn1constraint_compute_PER_range(expr_type, ct->elements[i], type, minmax, exmet, - strict_PV); + cpr_flags); if(!tmp) { if(errno == ERANGE) { range->extensible = 1; @@ -963,7 +966,8 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr range->not_PER_visible = 1; } - if(strict_PV && range->not_PER_visible) { + if(range->not_PER_visible + && (cpr_flags & CPR_strict_PER_visibility)) { /* * X.691, #9.3.19: * If not PER-visible constraint is part of UNION, @@ -987,7 +991,7 @@ asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constr assert(ct->el_count >= 1); _range_free(range); range = asn1constraint_compute_PER_range(expr_type, - ct->elements[0], type, minmax, exmet, strict_PV); + ct->elements[0], type, minmax, exmet, cpr_flags); return range; default: range->incompatible = 1; diff --git a/libasn1fix/asn1fix_crange.h b/libasn1fix/asn1fix_crange.h index 06817796..b5ae3a39 100644 --- a/libasn1fix/asn1fix_crange.h +++ b/libasn1fix/asn1fix_crange.h @@ -38,12 +38,17 @@ typedef struct asn1cnst_range_s { * ENOMEM: Memory allocation failure. * EPERM: Invalid constraint reference. */ +enum cpr_flags { + CPR_noflags = 0x00, + CPR_strict_PER_visibility = 0x01, + CPR_simulate_fbless_SIZE = 0x02, +}; asn1cnst_range_t *asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e required_type, const asn1cnst_range_t *minmax, int *expectation_met, - int strict_PER_visibility); + enum cpr_flags); void asn1constraint_range_free(asn1cnst_range_t *); /* @@ -51,7 +56,7 @@ void asn1constraint_range_free(asn1cnst_range_t *); * with the given expression type. */ int asn1constraint_compatible(asn1p_expr_type_e expr_type, - enum asn1p_constraint_type_e constr_type); + enum asn1p_constraint_type_e constr_type, int fbless_SIZE); /* * Fetch a default alphabet for this type. diff --git a/libasn1fix/asn1fix_value.c b/libasn1fix/asn1fix_value.c index 50d8da20..0e60ef7b 100644 --- a/libasn1fix/asn1fix_value.c +++ b/libasn1fix/asn1fix_value.c @@ -80,7 +80,7 @@ asn1f_value_resolve(arg_t *arg, asn1p_expr_t *expr, const enum asn1p_constraint_ */ if(opt_constr_type) ret = asn1constraint_compatible(val_type_expr->expr_type, - *opt_constr_type); + *opt_constr_type, 0 /* must not matter here */); else ret = asn1f_check_type_compatibility(arg, type_expr, val_type_expr); diff --git a/libasn1fix/check_fixer.c b/libasn1fix/check_fixer.c index 320eebbc..6a13fda1 100644 --- a/libasn1fix/check_fixer.c +++ b/libasn1fix/check_fixer.c @@ -76,15 +76,15 @@ main(int ac, char **av) { filename = dp->d_name; #endif /* WIN32 */ len = strlen(filename); - if(len && strcmp(filename + len - 5, ".asn1") == 0) { - ret = check(filename, parser_flags,fixer_flags); - if(ret) { - fprintf(stderr, "FAILED: %s\n", - filename); - failed++; - } - completed++; + if(len <= 5 || strcmp(filename + len - 5, ".asn1")) + continue; + ret = check(filename, parser_flags, fixer_flags); + if(ret) { + fprintf(stderr, "FAILED: %s\n", + filename); + failed++; } + completed++; #ifdef WIN32 } while(_findnext(dir, &c_file) == 0); _findclose(dir); @@ -152,6 +152,10 @@ check(const char *fname, return -1; } + /* Flag modifiers */ + if(strstr(fname, "-blessSize-")) + fixer_flags |= A1F_EXTENDED_SizeConstraint; + fprintf(stderr, "[=> %s]\n", fname); /* diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c index f9a01e17..1dee0f60 100644 --- a/libasn1print/asn1print.c +++ b/libasn1print/asn1print.c @@ -445,8 +445,8 @@ asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_ int as_char = (type==ACT_CT_FROM); int i; - range = asn1constraint_compute_PER_range(expr_type, ct, type, - 0, 0, strict_PER_visible); + range = asn1constraint_compute_PER_range(expr_type, ct, type, 0, 0, + strict_PER_visible ? CPR_strict_PER_visibility : 0); if(!range) return -1; if(range->incompatible diff --git a/tests/91-cond-int-blessSize-OK.asn1 b/tests/91-cond-int-blessSize-OK.asn1 new file mode 100644 index 00000000..0a8e5437 --- /dev/null +++ b/tests/91-cond-int-blessSize-OK.asn1 @@ -0,0 +1,20 @@ + +-- OK: Everything is fine + +-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) +-- .spelio.software.asn1c.test (9363.1.5.1) +-- .91 + +ModuleConditionalIntegerType-with-fblessSIZE + { iso org(3) dod(6) internet (1) private(4) enterprise(1) + spelio(9363) software(1) asn1c(5) test(1) 91 } +DEFINITIONS ::= +BEGIN + + OK-Integer1 ::= INTEGER (SIZE(1)) + OK-Integer2 ::= INTEGER (SIZE(2)) + OK-Integer3 ::= INTEGER (SIZE(3)) + OK-Integer4 ::= INTEGER (SIZE(4)) + NO-Integer5 ::= INTEGER (SIZE(5)) + +END diff --git a/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE new file mode 100644 index 00000000..09780ecf --- /dev/null +++ b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE @@ -0,0 +1,660 @@ + +/*** <<< INCLUDES [OK-Integer1] >>> ***/ + +#include + +/*** <<< TYPE-DECLS [OK-Integer1] >>> ***/ + +typedef INTEGER_t OK_Integer1_t; + +/*** <<< FUNC-DECLS [OK-Integer1] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_OK_Integer1; +asn_struct_free_f OK_Integer1_free; +asn_struct_print_f OK_Integer1_print; +asn_constr_check_f OK_Integer1_constraint; +ber_type_decoder_f OK_Integer1_decode_ber; +der_type_encoder_f OK_Integer1_encode_der; +xer_type_decoder_f OK_Integer1_decode_xer; +xer_type_encoder_f OK_Integer1_encode_xer; + +/*** <<< CODE [OK-Integer1] >>> ***/ + +int +OK_Integer1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_consume_bytes_f *app_errlog, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + + if(!sptr) { + _ASN_ERRLOG(app_errlog, app_key, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + + if(1 /* No applicable constraints whatsoever */) { + /* Nothing is here. See below */ + } + + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +OK_Integer1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +OK_Integer1_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + OK_Integer1_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +OK_Integer1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer1_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +OK_Integer1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + OK_Integer1_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +OK_Integer1_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer1_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +OK_Integer1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + OK_Integer1_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +OK_Integer1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer1_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [OK-Integer1] >>> ***/ + +static ber_tlv_tag_t asn_DEF_OK_Integer1_1_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_OK_Integer1 = { + "OK-Integer1", + "OK-Integer1", + OK_Integer1_free, + OK_Integer1_print, + OK_Integer1_constraint, + OK_Integer1_decode_ber, + OK_Integer1_encode_der, + OK_Integer1_decode_xer, + OK_Integer1_encode_xer, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OK_Integer1_1_tags, + sizeof(asn_DEF_OK_Integer1_1_tags) + /sizeof(asn_DEF_OK_Integer1_1_tags[0]), /* 1 */ + asn_DEF_OK_Integer1_1_tags, /* Same as above */ + sizeof(asn_DEF_OK_Integer1_1_tags) + /sizeof(asn_DEF_OK_Integer1_1_tags[0]), /* 1 */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + + +/*** <<< INCLUDES [OK-Integer2] >>> ***/ + +#include + +/*** <<< TYPE-DECLS [OK-Integer2] >>> ***/ + +typedef INTEGER_t OK_Integer2_t; + +/*** <<< FUNC-DECLS [OK-Integer2] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_OK_Integer2; +asn_struct_free_f OK_Integer2_free; +asn_struct_print_f OK_Integer2_print; +asn_constr_check_f OK_Integer2_constraint; +ber_type_decoder_f OK_Integer2_decode_ber; +der_type_encoder_f OK_Integer2_encode_der; +xer_type_decoder_f OK_Integer2_decode_xer; +xer_type_encoder_f OK_Integer2_encode_xer; + +/*** <<< CODE [OK-Integer2] >>> ***/ + +int +OK_Integer2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_consume_bytes_f *app_errlog, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + + if(!sptr) { + _ASN_ERRLOG(app_errlog, app_key, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + + if(1 /* No applicable constraints whatsoever */) { + /* Nothing is here. See below */ + } + + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +OK_Integer2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +OK_Integer2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + OK_Integer2_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +OK_Integer2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer2_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +OK_Integer2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + OK_Integer2_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +OK_Integer2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer2_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +OK_Integer2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + OK_Integer2_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +OK_Integer2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer2_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [OK-Integer2] >>> ***/ + +static ber_tlv_tag_t asn_DEF_OK_Integer2_1_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_OK_Integer2 = { + "OK-Integer2", + "OK-Integer2", + OK_Integer2_free, + OK_Integer2_print, + OK_Integer2_constraint, + OK_Integer2_decode_ber, + OK_Integer2_encode_der, + OK_Integer2_decode_xer, + OK_Integer2_encode_xer, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OK_Integer2_1_tags, + sizeof(asn_DEF_OK_Integer2_1_tags) + /sizeof(asn_DEF_OK_Integer2_1_tags[0]), /* 1 */ + asn_DEF_OK_Integer2_1_tags, /* Same as above */ + sizeof(asn_DEF_OK_Integer2_1_tags) + /sizeof(asn_DEF_OK_Integer2_1_tags[0]), /* 1 */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + + +/*** <<< INCLUDES [OK-Integer3] >>> ***/ + +#include + +/*** <<< TYPE-DECLS [OK-Integer3] >>> ***/ + +typedef INTEGER_t OK_Integer3_t; + +/*** <<< FUNC-DECLS [OK-Integer3] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_OK_Integer3; +asn_struct_free_f OK_Integer3_free; +asn_struct_print_f OK_Integer3_print; +asn_constr_check_f OK_Integer3_constraint; +ber_type_decoder_f OK_Integer3_decode_ber; +der_type_encoder_f OK_Integer3_encode_der; +xer_type_decoder_f OK_Integer3_decode_xer; +xer_type_encoder_f OK_Integer3_encode_xer; + +/*** <<< CODE [OK-Integer3] >>> ***/ + +int +OK_Integer3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_consume_bytes_f *app_errlog, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + + if(!sptr) { + _ASN_ERRLOG(app_errlog, app_key, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + + if(1 /* No applicable constraints whatsoever */) { + /* Nothing is here. See below */ + } + + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +OK_Integer3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +OK_Integer3_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + OK_Integer3_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +OK_Integer3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer3_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +OK_Integer3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + OK_Integer3_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +OK_Integer3_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer3_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +OK_Integer3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + OK_Integer3_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +OK_Integer3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer3_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [OK-Integer3] >>> ***/ + +static ber_tlv_tag_t asn_DEF_OK_Integer3_1_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_OK_Integer3 = { + "OK-Integer3", + "OK-Integer3", + OK_Integer3_free, + OK_Integer3_print, + OK_Integer3_constraint, + OK_Integer3_decode_ber, + OK_Integer3_encode_der, + OK_Integer3_decode_xer, + OK_Integer3_encode_xer, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OK_Integer3_1_tags, + sizeof(asn_DEF_OK_Integer3_1_tags) + /sizeof(asn_DEF_OK_Integer3_1_tags[0]), /* 1 */ + asn_DEF_OK_Integer3_1_tags, /* Same as above */ + sizeof(asn_DEF_OK_Integer3_1_tags) + /sizeof(asn_DEF_OK_Integer3_1_tags[0]), /* 1 */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + + +/*** <<< INCLUDES [OK-Integer4] >>> ***/ + +#include + +/*** <<< TYPE-DECLS [OK-Integer4] >>> ***/ + +typedef INTEGER_t OK_Integer4_t; + +/*** <<< FUNC-DECLS [OK-Integer4] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_OK_Integer4; +asn_struct_free_f OK_Integer4_free; +asn_struct_print_f OK_Integer4_print; +asn_constr_check_f OK_Integer4_constraint; +ber_type_decoder_f OK_Integer4_decode_ber; +der_type_encoder_f OK_Integer4_encode_der; +xer_type_decoder_f OK_Integer4_decode_xer; +xer_type_encoder_f OK_Integer4_encode_xer; + +/*** <<< CODE [OK-Integer4] >>> ***/ + +int +OK_Integer4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_consume_bytes_f *app_errlog, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + + if(!sptr) { + _ASN_ERRLOG(app_errlog, app_key, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + + if(1 /* No applicable constraints whatsoever */) { + /* Nothing is here. See below */ + } + + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +OK_Integer4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +OK_Integer4_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + OK_Integer4_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +OK_Integer4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer4_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +OK_Integer4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + OK_Integer4_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +OK_Integer4_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer4_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +OK_Integer4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + OK_Integer4_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +OK_Integer4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + OK_Integer4_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [OK-Integer4] >>> ***/ + +static ber_tlv_tag_t asn_DEF_OK_Integer4_1_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_OK_Integer4 = { + "OK-Integer4", + "OK-Integer4", + OK_Integer4_free, + OK_Integer4_print, + OK_Integer4_constraint, + OK_Integer4_decode_ber, + OK_Integer4_encode_der, + OK_Integer4_decode_xer, + OK_Integer4_encode_xer, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OK_Integer4_1_tags, + sizeof(asn_DEF_OK_Integer4_1_tags) + /sizeof(asn_DEF_OK_Integer4_1_tags[0]), /* 1 */ + asn_DEF_OK_Integer4_1_tags, /* Same as above */ + sizeof(asn_DEF_OK_Integer4_1_tags) + /sizeof(asn_DEF_OK_Integer4_1_tags[0]), /* 1 */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + + +/*** <<< INCLUDES [NO-Integer5] >>> ***/ + +#include + +/*** <<< TYPE-DECLS [NO-Integer5] >>> ***/ + +typedef INTEGER_t NO_Integer5_t; + +/*** <<< FUNC-DECLS [NO-Integer5] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_NO_Integer5; +asn_struct_free_f NO_Integer5_free; +asn_struct_print_f NO_Integer5_print; +asn_constr_check_f NO_Integer5_constraint; +ber_type_decoder_f NO_Integer5_decode_ber; +der_type_encoder_f NO_Integer5_encode_der; +xer_type_decoder_f NO_Integer5_decode_xer; +xer_type_encoder_f NO_Integer5_encode_xer; + +/*** <<< CODE [NO-Integer5] >>> ***/ + +int +NO_Integer5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_consume_bytes_f *app_errlog, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + + if(!sptr) { + _ASN_ERRLOG(app_errlog, app_key, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + + if(1 /* No applicable constraints whatsoever */) { + /* Nothing is here. See below */ + } + + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +NO_Integer5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +NO_Integer5_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + NO_Integer5_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +NO_Integer5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + NO_Integer5_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +NO_Integer5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + NO_Integer5_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +NO_Integer5_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + NO_Integer5_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +NO_Integer5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + NO_Integer5_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +NO_Integer5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + NO_Integer5_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [NO-Integer5] >>> ***/ + +static ber_tlv_tag_t asn_DEF_NO_Integer5_1_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NO_Integer5 = { + "NO-Integer5", + "NO-Integer5", + NO_Integer5_free, + NO_Integer5_print, + NO_Integer5_constraint, + NO_Integer5_decode_ber, + NO_Integer5_encode_der, + NO_Integer5_decode_xer, + NO_Integer5_encode_xer, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NO_Integer5_1_tags, + sizeof(asn_DEF_NO_Integer5_1_tags) + /sizeof(asn_DEF_NO_Integer5_1_tags[0]), /* 1 */ + asn_DEF_NO_Integer5_1_tags, /* Same as above */ + sizeof(asn_DEF_NO_Integer5_1_tags) + /sizeof(asn_DEF_NO_Integer5_1_tags[0]), /* 1 */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; +