diff --git a/asn1c/tests/check-41.-fnative-types.c b/asn1c/tests/check-41.-fnative-types.c new file mode 100644 index 0000000000000000000000000000000000000000..3b735ccfc3fd76922c877cfc2599000a179c447d --- /dev/null +++ b/asn1c/tests/check-41.-fnative-types.c @@ -0,0 +1,219 @@ +#undef NDEBUG +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <string.h> +#include <assert.h> + +#include <T.h> + + +uint8_t buf1[] = { + 32 | (2 << 6), /* [0], constructed */ + 25, /* L */ + + /* string [0] IMPLICIT UTF8String, */ + (2 << 6), /* [0] */ + 16, /* L */ + 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', + + /* beta [2] IMPLICIT INTEGER OPTIONAL */ + (2 << 6) + 2, /* [2] */ + 5, /* L */ + 0, + 75, + 0x4b, + 75, + 75, +}; + +uint8_t buf1_reconstr[] = { + 32 | (2 << 6), /* [0], constructed */ + 24, /* L */ + + /* string [0] IMPLICIT UTF8String, */ + (2 << 6), /* [0] */ + 16, /* L */ + 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', + + /* beta [2] IMPLICIT INTEGER OPTIONAL */ + (2 << 6) + 2, /* [2] */ + 4, /* L */ + 75, + 75, + 75, + 0x4b, +}; + + +static void +check(T_t *tp, uint8_t *buf, int size, size_t consumed) { + asn_dec_rval_t rval; + + tp = memset(tp, 0, sizeof(*tp)); + + fprintf(stderr, "Buf %p (%d)\n", buf, size); + rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); + fprintf(stderr, "Returned code %d, consumed %d\n", + (int)rval.code, (int)rval.consumed); + + assert(rval.code == RC_OK); + assert(rval.consumed == consumed); + + assert(tp->choice.seq.string.size == 16); + assert(strcmp(tp->choice.seq.string.buf, "zzzzzzzzzzzzzzzz") == 0); + assert(tp->choice.seq.alpha == NULL); + assert(tp->choice.seq.beta); + assert(*tp->choice.seq.beta == 0x4b4b4b4b); +} + +size_t buf_pos; +size_t buf_size; +uint8_t *buf; + +static int +buf_fill(const void *buffer, size_t size, void *app_key) { + + (void)app_key; /* Unused argument */ + + if(buf_pos + size > buf_size) { + fprintf(stderr, "%d + %d > %d\n", + (int)buf_pos, (int)size, (int)buf_size); + return -1; + } + + memcpy(buf + buf_pos, buffer, size); + buf_pos += size; + fprintf(stderr, " written %d (%d)\n", (int)size, (int)buf_pos); + + return 0; +} + +static void +compare(T_t *tp, uint8_t *cmp_buf, int cmp_buf_size) { + asn_enc_rval_t erval; + int i; + + buf_size = cmp_buf_size + 100; + buf = alloca(buf_size); + buf_pos = 0; + + /* + * Try to re-create using DER encoding. + */ + erval = der_encode(&asn_DEF_T, tp, buf_fill, 0); + assert(erval.encoded != -1); + if(erval.encoded != cmp_buf_size) { + printf("%d != %d\n", erval.encoded, cmp_buf_size); + } + assert(erval.encoded == cmp_buf_size); + for(i = 0; i < cmp_buf_size; i++) { + if(buf[i] != cmp_buf[i]) { + fprintf(stderr, "Recreated buffer content mismatch:\n"); + fprintf(stderr, "Byte %d, %x != %x (%d != %d)\n", + i, + buf[i], cmp_buf[i], + buf[i], cmp_buf[i] + ); + } + assert(buf[i] == cmp_buf[i]); + } +} + +static void +partial_read(uint8_t *buf_0, size_t size) { + T_t t, *tp; + asn_dec_rval_t rval; + size_t i1, i2; + uint8_t *buf_1 = alloca(size); + uint8_t *buf_2 = alloca(size); + uint8_t *buf_3 = alloca(size); + + fprintf(stderr, "\nPartial read sequence...\n"); + + /* + * Divide the space (size) into three blocks in various combinations: + * |<----->i1<----->i2<----->| + * ^ buf_0 ^ buf_0+size + * Try to read block by block. + */ + for(i1 = 0; i1 < size; i1++) { + for(i2 = i1; i2 < size; i2++) { + uint8_t *chunk1 = buf_0; + size_t size1 = i1; + uint8_t *chunk2 = buf_0 + size1; + size_t size2 = i2 - i1; + uint8_t *chunk3 = buf_0 + size1 + size2; + size_t size3 = size - size1 - size2; + + fprintf(stderr, "\n%d:{%d, %d, %d}...\n", + (int)size, (int)size1, (int)size2, (int)size3); + + memset(buf_1, 0, size); + memset(buf_2, 0, size); + memset(buf_3, 0, size); + memcpy(buf_1, chunk1, size1); + memcpy(buf_2, chunk2, size2); + memcpy(buf_3, chunk3, size3); + + tp = memset(&t, 0, sizeof(t)); + + fprintf(stderr, "=> Chunk 1 (%d):\n", (int)size1); + rval = ber_decode(0, &asn_DEF_T, (void **)&tp, + buf_1, size1); + assert(rval.code == RC_WMORE); + assert(rval.consumed <= size1); + if(rval.consumed < size1) { + int leftover = size1 - rval.consumed; + memcpy(buf_2, buf_1 + rval.consumed, leftover); + memcpy(buf_2 + leftover, chunk2, size2); + size2 += leftover; + } + + fprintf(stderr, "=> Chunk 2 (%d):\n", (int)size2); + rval = ber_decode(0, &asn_DEF_T, (void **)&tp, + buf_2, size2); + assert(rval.code == RC_WMORE); + assert(rval.consumed <= size2); + if(rval.consumed < size2) { + int leftover = size2 - rval.consumed; + memcpy(buf_3, buf_2 + rval.consumed, leftover); + memcpy(buf_3 + leftover, chunk3, size3); + size3 += leftover; + } + + fprintf(stderr, "=> Chunk 3 (%d):\n", (int)size3); + rval = ber_decode(0, &asn_DEF_T, (void **)&tp, + buf_3, size3); + assert(rval.code == RC_OK); + assert(rval.consumed == size3); + + asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); + } + } +} + +int +main(int ac, char **av) { + T_t t; + + (void)ac; /* Unused argument */ + (void)av; /* Unused argument */ + + /* Check exact buf1 */ + check(&t, buf1, sizeof(buf1), sizeof(buf1)); + compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); + asn_fprint(stderr, &asn_DEF_T, &t); + asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); + + /* Check slightly more than buf1 */ + check(&t, buf1, sizeof(buf1) + 10, sizeof(buf1)); + compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); + asn_fprint(stderr, &asn_DEF_T, &t); + asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); + + /* Split the buffer in parts and check decoder restartability */ + partial_read(buf1, sizeof(buf1)); + + return 0; +} diff --git a/asn1c/tests/check-42.-fnative-types.c b/asn1c/tests/check-42.-fnative-types.c new file mode 100644 index 0000000000000000000000000000000000000000..9afa800ab0bc1634e76e70b72f4a3afd0f4be66c --- /dev/null +++ b/asn1c/tests/check-42.-fnative-types.c @@ -0,0 +1,142 @@ +#undef NDEBUG +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <string.h> +#include <assert.h> + +#include <LogLine.h> + +uint8_t buf0[] = { + 48, /* LogLine SEQUENCE */ + 24, /* L */ + 22, /* IA5String */ + 4, /* L */ + /* "zzz\007" */ + 122, 122, 122, 7, + 48, /* varsets SEQUENCE OF VariablePartSet */ + 16, /* L */ + 48, /* VariablePart */ + 14, /* L */ + 48, /* vparts SEQUENCE OF VariablePart */ + 7, /* L */ + 49, /* VariablePart */ + 5, + 26, /* VisibleString */ + 3, + 49, 50, 51, /* 1 2 3 */ + 48, /* ActionItem SEQUENCE */ + 3, /* L */ + 10, /* accept-as ENUMERATED */ + 1, /* L */ + 0, +}; + +uint8_t buf1[] = { + 48, /* LogLine SEQUENCE */ + 19, /* L */ + 22, /* IA5String */ + 6, /* L */ + /* "static" */ + 115, 116, 97, 116, 105, 99, + 48, /* varsets SEQUENCE OF VariablePartSet */ + 9, /* L */ + 48, /* VariablePart */ + 7, /* L */ + 48, /* vparts SEQUENCE OF VariablePart */ + 0, /* L */ + 48, /* ActionItem SEQUENCE */ + 3, /* L */ + 10, /* accept-as ENUMERATED */ + 1, /* L */ + 0, +}; + +static void +check(LogLine_t *tp, uint8_t *ptr, int size, size_t consumed) { + asn_dec_rval_t rval; + + tp = memset(tp, 0, sizeof(*tp)); + + fprintf(stderr, "Buf %p (%d)\n", ptr, size); + rval = ber_decode(0, &asn_DEF_LogLine, (void **)&tp, ptr, size); + fprintf(stderr, "Returned code %d, consumed %d\n", + (int)rval.code, (int)rval.consumed); + + assert(rval.code == RC_OK); + assert(rval.consumed == consumed); + asn_fprint(stderr, &asn_DEF_LogLine, tp); + asn_DEF_LogLine.free_struct(&asn_DEF_LogLine, tp, 1); +} + +uint8_t *buf; +uint8_t buf_size; +uint8_t buf_pos; + + +static int +buf_fill(const void *buffer, size_t size, void *app_key) { + + (void)app_key; /* Unused argument */ + + assert(buf_pos + size <= buf_size); + + memcpy(buf + buf_pos, buffer, size); + buf_pos += size; + + return 0; +} + +static void +check_serialize() { + LogLine_t ll; + VariablePartSet_t vps; + VariablePart_t vp; + VisibleString_t vpart; + asn_enc_rval_t erval; + int i; + + memset(&ll, 0, sizeof(ll)); + memset(&vps, 0, sizeof(vps)); + memset(&vp, 0, sizeof(vp)); + memset(&vpart, 0, sizeof(vpart)); + vpart.buf = "123"; + vpart.size = 3; + + vp.present = VariablePart_PR_vset; + ASN_SET_ADD(&vp.choice.vset, &vpart); + vps.resolution.accept_as = accept_as_unknown; + ASN_SEQUENCE_ADD(&vps.vparts, &vp); + ASN_SEQUENCE_ADD(&ll.varsets, &vps); + ll.line_digest.buf = "zzz\007"; + ll.line_digest.size = 4; + + asn_fprint(stderr, &asn_DEF_LogLine, &ll); + buf_size = 128; + buf = alloca(buf_size); + erval = der_encode(&asn_DEF_LogLine, &ll, buf_fill, 0); + assert(erval.encoded > 1); + fprintf(stderr, "Encoded in %d bytes\n", erval.encoded); + fprintf(stderr, "\n"); + for(i = 0; i < buf_pos; i++) { + fprintf(stderr, "%d ", buf[i]); + } + fprintf(stderr, "\n\n"); + assert(erval.encoded == sizeof(buf0)); + assert(memcmp(buf0, buf, sizeof(buf0)) == 0); +} + +int +main(int ac, char **av) { + LogLine_t t; + + (void)ac; /* Unused argument */ + (void)av; /* Unused argument */ + + check_serialize(); + + check(&t, buf0, sizeof(buf0), sizeof(buf0)); + check(&t, buf1, sizeof(buf1), sizeof(buf1)); + + return 0; +} diff --git a/asn1c/tests/check-60.-fnative-types.c b/asn1c/tests/check-60.-fnative-types.c new file mode 100644 index 0000000000000000000000000000000000000000..3dc8e539d3e96a076cc390a19a5760b51d8a01f3 --- /dev/null +++ b/asn1c/tests/check-60.-fnative-types.c @@ -0,0 +1,203 @@ +#undef NDEBUG +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <string.h> +#include <assert.h> +#include <errno.h> + +#include <T1.h> +#include <T2.h> + +static unsigned char buf[4096]; +static int buf_offset; + +static int +_buf_writer(const void *buffer, size_t size, void *app_key) { + unsigned char *b, *bend; + (void)app_key; + assert(buf_offset + size < sizeof(buf)); + memcpy(buf + buf_offset, buffer, size); + b = buf + buf_offset; + bend = b + size; + printf("=> ["); + for(; b < bend; b++) + printf(" %02X", *b); + printf("]:%ld\n", (long)size); + buf_offset += size; + return 0; +} + +static int +save_object(void *bs, asn_TYPE_descriptor_t *td) { + asn_enc_rval_t rval; /* Return value */ + int i; + + buf_offset = 0; + + rval = der_encode(td, bs, _buf_writer, 0); + if (rval.encoded == -1) { + fprintf(stderr, + "Cannot encode %s: %s\n", + rval.failed_type->name, strerror(errno)); + assert(rval.encoded != -1); + return -1; /* JIC */ + } + + buf[buf_offset++] = 0xab; /* Finalize with garbage */ + + asn_fprint(stderr, td, bs); + + printf("OUT: ["); + for(i = 0; i < buf_offset; i++) + printf(" %02x", buf[i]); + printf("]\n"); + + return 0; +} + +static int +load_object(void *bs, asn_TYPE_descriptor_t *td) { + asn_dec_rval_t rval; + + fprintf(stderr, "\nLOADING OBJECT OF SIZE %d\n", buf_offset); + + rval = ber_decode(0, td, (void **)&bs, buf, buf_offset); + assert(rval.code == RC_OK); + + asn_fprint(stderr, td, bs); + + return (rval.code == RC_OK)?0:-1; +} + +/* [3] IMPLICIT SEQUENCE { b BOOLEAN } */ +uint8_t test_any_buf1[] = { 0xa3, 0x80, /* [3], constructed, indefinite */ + 0x01, 0x01, 0xff, /* b BOOLEAN ::= TRUE */ + 0x00, 0x00 /* End of content octets */ }; + +/* b BOOLEAN */ +uint8_t test_any_buf2[] = { 0x01, 0x01, 0x13 }; + +int +main() { + asn_TYPE_descriptor_t *td1 = &asn_DEF_T1; + asn_TYPE_descriptor_t *td2 = &asn_DEF_T2; + T1_t t1, t1_new; + T2_t t2, t2_new; + int ret; + + /* + * Test the T1 with constructed indefinite length ANY encoding. + */ + memset(&t1, 0, sizeof(t1)); + memset(&t1_new, 0, sizeof(t1_new)); + + t1.i = 112233; + t1.any.buf = test_any_buf1; + t1.any.size = sizeof(test_any_buf1); + + /* Save->Load must succeed */ + save_object(&t1, td1); + ret = load_object(&t1_new, td1); + + assert(ret == 0); + assert(t1_new.i == 112233); + assert(t1_new.any.size == sizeof(test_any_buf1)); + assert(memcmp(t1_new.any.buf, test_any_buf1, sizeof(test_any_buf1)) == 0); + + /* + * Test the T1 with primitive encoding. + */ + memset(&t1, 0, sizeof(t1)); + memset(&t1_new, 0, sizeof(t1_new)); + + t1.i = -112233; + t1.any.buf = test_any_buf2; + t1.any.size = sizeof(test_any_buf2); + + /* Save->Load must succeed */ + save_object(&t1, td1); + ret = load_object(&t1_new, td1); + + assert(ret == 0); + assert(t1_new.i == -112233); + assert(t1_new.any.size == sizeof(test_any_buf2)); + assert(memcmp(t1_new.any.buf, test_any_buf2, sizeof(test_any_buf2)) == 0); + + /* + * Test the T2 empty sequence. + */ + memset(&t2, 0, sizeof(t2)); + memset(&t2_new, 0, sizeof(t2_new)); + + t2.i = 332211; + t2.any = calloc(1, sizeof(*t2.any)); + t2.any->buf = 0; + t2.any->size = 0; + + /* Save->Load must succeed */ + save_object(&t2, td2); + ret = load_object(&t2_new, td2); + + assert(ret == 0); + assert(t2_new.i == 332211); + assert(t2_new.any->size == 0); + + /* + * Test the T2 sequence. + */ + memset(&t2, 0, sizeof(t2)); + memset(&t2_new, 0, sizeof(t2_new)); + + t2.i = 332211; + t2.any = calloc(1, sizeof(*t2.any)); + t2.any->buf = test_any_buf1; + t2.any->size = sizeof(test_any_buf1); + + /* Save->Load must succeed */ + save_object(&t2, td2); + ret = load_object(&t2_new, td2); + + assert(ret == 0); + assert(t2_new.i == 332211); + assert(t2_new.any->size == sizeof(test_any_buf1)); + assert(memcmp(t2_new.any->buf, test_any_buf1, sizeof(test_any_buf1)) == 0); + + /* + * Test the T2 sequence with primitive encoding. + */ + memset(&t2, 0, sizeof(t2)); + memset(&t2_new, 0, sizeof(t2_new)); + + t2.i = 0; + t2.any = calloc(1, sizeof(*t2.any)); + t2.any->buf = test_any_buf2; + t2.any->size = sizeof(test_any_buf2); + + /* Save->Load must succeed */ + save_object(&t2, td2); + ret = load_object(&t2_new, td2); + + assert(ret == 0); + assert(t2_new.i == 0); + assert(t2_new.any->size == sizeof(test_any_buf2)); + assert(memcmp(t2_new.any->buf, test_any_buf2, sizeof(test_any_buf2)) == 0); + + /* + * Test T2 with ANY element omitted. + */ + free(t2.any); + t2.any = 0; + memset(&t2_new, 0, sizeof(t2_new)); + + save_object(&t2, td2); + ret = load_object(&t2_new, td2); + + assert(ret == 0); + assert(t2_new.i == 0); + assert(t2_new.any == 0); + + printf("OK\n"); + + return ret; +} diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 21497930418b2b3410aa8895b78376222dbdff43..039a2763fbd68be7ce5b98fd0abd61caa3bd44fb 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1176,7 +1176,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_constraint(asn_TYPE_descriptor_t *td, const void *sptr,\n"); INDENT(+1); - OUT("\t\tasn_app_consume_bytes_f *app_errlog, void *app_key) {"); + OUT("\t\tasn_app_constraint_failed_f *ctfailcb, void *app_key) {"); OUT("\n"); if(asn1c_emit_constraint_checking_code(arg) == 1) { OUT("/* Replace with underlying type checker */\n"); @@ -1184,7 +1184,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { "= asn_DEF_%s.check_constraints;\n", asn1c_type_name(arg, expr, TNF_SAFE)); OUT("return td->check_constraints" - "(td, sptr, app_errlog, app_key);\n"); + "(td, sptr, ctfailcb, app_key);\n"); } INDENT(-1); OUT("}\n"); @@ -2127,12 +2127,12 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr) { OUT("static int\n"); OUT("memb_%s_constraint_%d(asn_TYPE_descriptor_t *td, const void *sptr,\n", p, arg->expr->_type_unique_index); INDENT(+1); - OUT("\t\tasn_app_consume_bytes_f *app_errlog, void *app_key) {\n"); + OUT("\t\tasn_app_constraint_failed_f *ctfailcb, void *app_key) {\n"); tmp_arg = *arg; tmp_arg.expr = expr; if(asn1c_emit_constraint_checking_code(&tmp_arg) == 1) { OUT("return td->check_constraints" - "(td, sptr, app_errlog, app_key);\n"); + "(td, sptr, ctfailcb, app_key);\n"); } INDENT(-1); OUT("}\n"); diff --git a/libasn1compiler/asn1c_constraint.c b/libasn1compiler/asn1c_constraint.c index 5388bb3dc939c7a8b304f5456978b35e021d01e6..b44b4ebc331fd27e33ae07b10f26752b49e20537 100644 --- a/libasn1compiler/asn1c_constraint.c +++ b/libasn1compiler/asn1c_constraint.c @@ -111,7 +111,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) { */ OUT("if(!sptr) {\n"); INDENT(+1); - OUT("_ASN_ERRLOG(app_errlog, app_key,\n"); + OUT("_ASN_CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: value not given (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); @@ -177,7 +177,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) { case ASN_CONSTR_SEQUENCE_OF: case ASN_CONSTR_SET_OF: OUT("/* Perform validation of the inner elements */\n"); - OUT("return td->check_constraints(td, sptr, app_errlog, app_key);\n"); + OUT("return td->check_constraints(td, sptr, ctfailcb, app_key);\n"); break; default: OUT("/* Constraint check succeeded */\n"); @@ -186,7 +186,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) { INDENT(-1); OUT("} else {\n"); INDENT(+1); - OUT("_ASN_ERRLOG(app_errlog, app_key,\n"); + OUT("_ASN_CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: constraint failed (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); @@ -519,7 +519,7 @@ emit_size_determination_code(arg_t *arg, asn1p_expr_type_e etype) { case ASN_STRING_UTF8String: OUT("size = UTF8String_length(st);\n"); OUT("if((ssize_t)size < 0) {\n"); - OUT("\t_ASN_ERRLOG(app_errlog, app_key,\n"); + OUT("\t_ASN_CTFAIL(app_key, td, sptr,\n"); OUT("\t\t\"%%s: UTF-8: broken encoding (%%s:%%d)\",\n"); OUT("\t\ttd->name, __FILE__, __LINE__);\n"); OUT("\treturn -1;\n"); @@ -581,7 +581,7 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang OUT("if(asn_INTEGER2long(st, &value)) {\n"); INDENT(+1); - OUT("_ASN_ERRLOG(app_errlog, app_key,\n"); + OUT("_ASN_CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: value too large (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); @@ -595,7 +595,7 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang } else { OUT("if(asn_REAL2double(st, &value)) {\n"); INDENT(+1); - OUT("_ASN_ERRLOG(app_errlog, app_key,\n"); + OUT("_ASN_CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: value too large (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c index 900f41db9ae0f93fe7a6ec0e689ca23ad17c512c..7434a2e10d21dcbf5917f40ce698d675cb3489e1 100644 --- a/skeletons/BIT_STRING.c +++ b/skeletons/BIT_STRING.c @@ -45,18 +45,18 @@ asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { */ int BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; if(st && st->buf) { if(st->size == 1 && st->bits_unused) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: invalid padding byte (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } else { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c index 79f62e82b79d3815fbff47cd2e37182477a08519..015fc6a13962131e72599d5109fa8c1cb770348f 100644 --- a/skeletons/GeneralizedTime.c +++ b/skeletons/GeneralizedTime.c @@ -148,14 +148,14 @@ asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = { */ int GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; time_t tloc; errno = EPERM; /* Just an unlikely error code */ tloc = asn_GT2time(st, 0, 0); if(tloc == -1 && errno != EPERM) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: Invalid time format: %s (%s:%d)", td->name, strerror(errno), __FILE__, __LINE__); return -1; diff --git a/skeletons/IA5String.c b/skeletons/IA5String.c index a4d7ff84a1bf39bba847622bff1e8aeb58a71284..abc9ff3834049bfe69eff0f8a48cd7d04dd3a01b 100644 --- a/skeletons/IA5String.c +++ b/skeletons/IA5String.c @@ -37,7 +37,7 @@ asn_TYPE_descriptor_t asn_DEF_IA5String = { int IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(st && st->buf) { @@ -49,7 +49,7 @@ IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, */ for(; buf < end; buf++) { if(*buf > 0x7F) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value byte %ld out of range: " "%d > 127 (%s:%d)", td->name, @@ -60,7 +60,7 @@ IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, } } } else { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; diff --git a/skeletons/NativeReal.c b/skeletons/NativeReal.c index 34eef231514fcbd42affc24d6ed3690f60fde4c2..1683f9014b1e01905206aa614a1a10aaddbd0eca 100644 --- a/skeletons/NativeReal.c +++ b/skeletons/NativeReal.c @@ -168,6 +168,7 @@ NativeReal_decode_xer(asn_codec_ctx_t *opt_codec_ctx, const void *buf_ptr, size_t size) { asn_dec_rval_t rval; REAL_t *st = 0; + REAL_t **stp = &st; double *Dbl = (double *)*sptr; if(!Dbl) { @@ -180,7 +181,7 @@ NativeReal_decode_xer(asn_codec_ctx_t *opt_codec_ctx, } } - rval = REAL_decode_xer(opt_codec_ctx, td, (void **)&st, opt_mname, + rval = REAL_decode_xer(opt_codec_ctx, td, (void **)stp, opt_mname, buf_ptr, size); if(rval.code == RC_OK) { if(asn_REAL2double(st, Dbl)) { diff --git a/skeletons/NumericString.c b/skeletons/NumericString.c index e3302c6a7512cc2de0e35a6c96c5f489b564093c..f980dcdc82b14c05f25f702499efcd970a5f2334 100644 --- a/skeletons/NumericString.c +++ b/skeletons/NumericString.c @@ -37,7 +37,7 @@ asn_TYPE_descriptor_t asn_DEF_NumericString = { int NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const NumericString_t *st = (const NumericString_t *)sptr; if(st && st->buf) { @@ -55,7 +55,7 @@ NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: continue; } - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value byte %ld (%d) " "not in NumericString alphabet (%s:%d)", td->name, @@ -65,7 +65,7 @@ NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } } else { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c index a7cd52d5b7553b260d4adb5c5476f71f69c4f9f1..53d5353e1743123a6b8e2e925eda8e9df02856c1 100644 --- a/skeletons/OBJECT_IDENTIFIER.c +++ b/skeletons/OBJECT_IDENTIFIER.c @@ -39,19 +39,19 @@ asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER = { int OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr; if(st && st->buf) { if(st->size < 1) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: at least one numerical value " "expected (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } else { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; diff --git a/skeletons/PrintableString.c b/skeletons/PrintableString.c index 57f65731c9e56359189f747ae025082507c9d0e8..5533253f16ccceae486470a91e61416b78b242ed 100644 --- a/skeletons/PrintableString.c +++ b/skeletons/PrintableString.c @@ -60,7 +60,7 @@ static int _PrintableString_alphabet[256] = { int PrintableString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PrintableString_t *st = (const PrintableString_t *)sptr; if(st && st->buf) { @@ -73,7 +73,7 @@ PrintableString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, */ for(; buf < end; buf++) { if(!_PrintableString_alphabet[*buf]) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value byte %ld (%d) " "not in PrintableString alphabet " "(%s:%d)", @@ -85,7 +85,7 @@ PrintableString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, } } } else { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; diff --git a/skeletons/UTCTime.c b/skeletons/UTCTime.c index 9032dbd666367c818b9a064e2951054cf4a1361c..5d7ba84e2ac9b459b1cf6d7239b3dab7407d9c9b 100644 --- a/skeletons/UTCTime.c +++ b/skeletons/UTCTime.c @@ -48,14 +48,14 @@ asn_TYPE_descriptor_t asn_DEF_UTCTime = { */ int UTCTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTCTime_t *st = (const UTCTime_t *)sptr; time_t tloc; errno = EPERM; /* Just an unlikely error code */ tloc = asn_UT2time(st, 0, 0); if(tloc == -1 && errno != EPERM) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: Invalid time format: %s (%s:%d)", td->name, strerror(errno), __FILE__, __LINE__); return -1; diff --git a/skeletons/UTF8String.c b/skeletons/UTF8String.c index 5d0334f9706fb4c16fb1b57629ed2779bd1417e8..85f2ccd803f8e5ba171983afdb186be4f7025cdc 100644 --- a/skeletons/UTF8String.c +++ b/skeletons/UTF8String.c @@ -67,30 +67,30 @@ static int32_t UTF8String_mv[7] = { 0, 0, int UTF8String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { ssize_t len = UTF8String_length((const UTF8String_t *)sptr); switch(len) { case U8E_EINVAL: - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given", td->name); break; case U8E_TRUNC: - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: truncated UTF-8 sequence (%s:%d)", td->name, __FILE__, __LINE__); break; case U8E_ILLSTART: - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: UTF-8 illegal start of encoding (%s:%d)", td->name, __FILE__, __LINE__); break; case U8E_NOTCONT: - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: UTF-8 not continuation (%s:%d)", td->name, __FILE__, __LINE__); break; case U8E_NOTMIN: - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: UTF-8 not minimal sequence (%s:%d)", td->name, __FILE__, __LINE__); break; diff --git a/skeletons/VisibleString.c b/skeletons/VisibleString.c index 2a88169d20de5c8813e00cea61cbe4c14470119a..7c7050135c93d9e8ac1b108bfcc66a63a0959a53 100644 --- a/skeletons/VisibleString.c +++ b/skeletons/VisibleString.c @@ -37,7 +37,7 @@ asn_TYPE_descriptor_t asn_DEF_VisibleString = { int VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; if(st && st->buf) { @@ -52,7 +52,7 @@ VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, */ for(; buf < end; buf++) { if(*buf < 0x20 || *buf > 0x7e) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value byte %ld (%d) " "not in VisibleString alphabet (%s:%d)", td->name, @@ -63,7 +63,7 @@ VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, } } } else { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; diff --git a/skeletons/asn_application.h b/skeletons/asn_application.h index d6393416fa1aee643a2405d953ae9a4188ed4a78..3f2a4504ee95399a0f230602c6345edc61fde404 100644 --- a/skeletons/asn_application.h +++ b/skeletons/asn_application.h @@ -1,15 +1,15 @@ /*- - * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved. + * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* - * Application-level ASN.1 API. + * Application-level ASN.1 callbacks. */ #ifndef _ASN_APPLICATION_H_ #define _ASN_APPLICATION_H_ -#include <asn_system.h> /* for platform-dependent types */ -#include <asn_codecs.h> /* for ASN.1 codecs specifics */ +#include "asn_system.h" /* for platform-dependent types */ +#include "asn_codecs.h" /* for ASN.1 codecs specifics */ #ifdef __cplusplus extern "C" { @@ -25,10 +25,24 @@ extern "C" { typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, void *application_specific_key); -#include <constr_TYPE.h> /* for asn_TYPE_descriptor_t */ +/* + * A callback of this type is called whenever constraint validation fails + * on some ASN.1 type. See "constraints.h" for more details on constraint + * validation. + * This callback specifies a descriptor of the ASN.1 type which failed + * the constraint check, as well as human readable message on what + * particular constraint has failed. + */ +typedef void (asn_app_constraint_failed_f)(void *application_specific_key, + struct asn_TYPE_descriptor_s *type_descriptor_which_failed, + const void *structure_which_failed_ptr, + const char *error_message_format, ...) + __attribute__((format(printf, 4, 5))); #ifdef __cplusplus } #endif +#include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ + #endif /* _ASN_APPLICATION_H_ */ diff --git a/skeletons/asn_internal.h b/skeletons/asn_internal.h index 89c9c4182cf7cf52f1fe550ed57054ac26e56795..67f055a62fbf74c397d2c108469549291ef9e6af 100644 --- a/skeletons/asn_internal.h +++ b/skeletons/asn_internal.h @@ -9,7 +9,7 @@ #ifndef _ASN_INTERNAL_H_ #define _ASN_INTERNAL_H_ -#include <asn_application.h> /* Application-visible API */ +#include "asn_application.h" /* Application-visible API */ #ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */ #include <assert.h> /* for assert() macro */ diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c index 26fd8dd251f51c4e66d5e061dc187da83da6c20c..84a3b4e3cbb4b9f7bddff8c6887e380918f5bc7c 100644 --- a/skeletons/constr_CHOICE.c +++ b/skeletons/constr_CHOICE.c @@ -475,12 +475,12 @@ CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber int CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; if(!sptr) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; @@ -499,7 +499,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, if(!memb_ptr) { if(elm->optional) return 0; - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: mandatory CHOICE element %s absent (%s:%d)", td->name, elm->name, __FILE__, __LINE__); return -1; @@ -510,10 +510,10 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, if(elm->memb_constraints) { return elm->memb_constraints(elm->type, memb_ptr, - app_errlog, app_key); + ctfailcb, app_key); } else { int ret = elm->type->check_constraints(elm->type, - memb_ptr, app_errlog, app_key); + memb_ptr, ctfailcb, app_key); /* * Cannot inherit it eralier: * need to make sure we get the updated version. @@ -522,7 +522,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return ret; } } else { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: no CHOICE element given (%s:%d)", td->name, __FILE__, __LINE__); return -1; diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 80cd6af37e1126b6efe3f96dbe719af1f3d9e3dc..d38afb5aab7651dda0f6cc229b594eeec3358a14 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -972,11 +972,11 @@ SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { int SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { int edx; if(!sptr) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; @@ -994,7 +994,7 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, if(!memb_ptr) { if(elm->optional) continue; - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: mandatory element %s absent (%s:%d)", td->name, elm->name, __FILE__, __LINE__); return -1; @@ -1005,11 +1005,11 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, if(elm->memb_constraints) { int ret = elm->memb_constraints(elm->type, memb_ptr, - app_errlog, app_key); + ctfailcb, app_key); if(ret) return ret; } else { int ret = elm->type->check_constraints(elm->type, - memb_ptr, app_errlog, app_key); + memb_ptr, ctfailcb, app_key); if(ret) return ret; /* * Cannot inherit it earlier: diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c index bb99eed58d26a754d8d8292c790b27366649eff3..6d2d6c15d5ab677d6f7a70581651f2a64790d7d9 100644 --- a/skeletons/constr_SET.c +++ b/skeletons/constr_SET.c @@ -938,11 +938,11 @@ SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { int SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { int edx; if(!sptr) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; @@ -960,7 +960,7 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, if(!memb_ptr) { if(elm->optional) continue; - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: mandatory element %s absent (%s:%d)", td->name, elm->name, __FILE__, __LINE__); return -1; @@ -971,11 +971,11 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, if(elm->memb_constraints) { int ret = elm->memb_constraints(elm->type, memb_ptr, - app_errlog, app_key); + ctfailcb, app_key); if(ret) return ret; } else { int ret = elm->type->check_constraints(elm->type, - memb_ptr, app_errlog, app_key); + memb_ptr, ctfailcb, app_key); if(ret) return ret; /* * Cannot inherit it earlier: diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c index bb6d2d391d55fe633d6903311edef5e6aa3ca333..564296356702e96351987edaf4ccb9ebd8861155 100644 --- a/skeletons/constr_SET_OF.c +++ b/skeletons/constr_SET_OF.c @@ -812,14 +812,14 @@ SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { int SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { asn_TYPE_member_t *elm = td->elements; asn_constr_check_f *constr; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int i; if(!sptr) { - _ASN_ERRLOG(app_errlog, app_key, + _ASN_CTFAIL(app_key, td, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; @@ -838,7 +838,7 @@ SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, if(!memb_ptr) continue; - ret = constr(elm->type, memb_ptr, app_errlog, app_key); + ret = constr(elm->type, memb_ptr, ctfailcb, app_key); if(ret) return ret; } diff --git a/skeletons/constraints.c b/skeletons/constraints.c index e384352854994c2fb58e500dd48527eb1476e459..1bdda73e5d68cba8311e3fda444fd86d20865d2d 100644 --- a/skeletons/constraints.c +++ b/skeletons/constraints.c @@ -1,9 +1,9 @@ -#include <asn_internal.h> -#include <constraints.h> +#include "asn_internal.h" +#include "constraints.h" int asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, asn_app_consume_bytes_f *cb, void *key) { + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { (void)type_descriptor; /* Unused argument */ (void)struct_ptr; /* Unused argument */ @@ -16,7 +16,7 @@ asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, int asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, asn_app_consume_bytes_f *cb, void *key) { + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { (void)type_descriptor; /* Unused argument */ (void)struct_ptr; /* Unused argument */ @@ -27,98 +27,67 @@ asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, return 0; } -struct __fill_errbuf_arg { - char *errbuf; +struct errbufDesc { + asn_TYPE_descriptor_t *failed_type; + const void *failed_struct_ptr; + char *errbuf; size_t errlen; - size_t erroff; }; -static int -__fill_errbuf(const void *buffer, size_t size, void *app_key) { - struct __fill_errbuf_arg *arg = (struct __fill_errbuf_arg *)app_key; - size_t avail = arg->errlen - arg->erroff; - - if(avail > size) - avail = size + 1; - - switch(avail) { - default: - memcpy(arg->errbuf + arg->erroff, buffer, avail - 1); - arg->erroff += avail - 1; - case 1: - arg->errbuf[arg->erroff] = '\0'; - case 0: - return 0; - } - -} +static void +_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { + struct errbufDesc *arg = key; + va_list ap; + ssize_t vlen; + ssize_t maxlen; -int -asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, char *errbuf, size_t *errlen) { - - if(errlen) { - struct __fill_errbuf_arg arg; - int ret; - - arg.errbuf = errbuf; - arg.errlen = *errlen; - arg.erroff = 0; - - ret = type_descriptor->check_constraints(type_descriptor, - struct_ptr, __fill_errbuf, &arg); - - if(ret == -1) - *errlen = arg.erroff; - - return ret; - } else { - return type_descriptor->check_constraints(type_descriptor, - struct_ptr, 0, 0); - } -} + arg->failed_type = td; + arg->failed_struct_ptr = sptr; -void -_asn_i_log_error(asn_app_consume_bytes_f *cb, void *key, const char *fmt, ...) { - char buf[64]; - char *p; - va_list ap; - ssize_t ret; - size_t len; + maxlen = arg->errlen; + if(maxlen <= 0) + return; va_start(ap, fmt); - ret = vsnprintf(buf, sizeof(buf), fmt, ap); + vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); va_end(ap); - if(ret < 0) { + if(vlen >= maxlen) { + arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ + arg->errlen = maxlen - 1; /* Not counting termination */ + return; + } else if(vlen >= 0) { + arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ + arg->errlen = vlen; /* Not counting termination */ + } else { /* * The libc on this system is broken. */ - ret = sizeof("<broken vsnprintf>") - 1; - memcpy(buf, "<broken vsnprintf>", ret + 1); - /* Fall through */ + vlen = sizeof("<broken vsnprintf>") - 1; + maxlen--; + arg->errlen = vlen < maxlen ? vlen : maxlen; + memcpy(arg->errbuf, "<broken vsnprintf>", arg->errlen); + arg->errbuf[arg->errlen] = 0; } - if(ret < (ssize_t)sizeof(buf)) { - (void)cb(buf, ret, key); - return; - } + return; +} - /* - * More space required to hold the message. - */ - len = ret + 1; - p = (char *)alloca(len); - if(!p) return; /* Can fail on !x86. */ +int +asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, char *errbuf, size_t *errlen) { + struct errbufDesc arg; + int ret; - - va_start(ap, fmt); - ret = vsnprintf(p, len, fmt, ap); - va_end(ap); - if(ret < 0 || ret >= (ssize_t)len) { - ret = sizeof("<broken vsnprintf>") - 1; - memcpy(buf, "<broken vsnprintf>", ret + 1); - p = buf; - } + arg.failed_type = 0; + arg.failed_struct_ptr = 0; + arg.errbuf = errbuf; + arg.errlen = errlen ? *errlen : 0; - (void)cb(p, ret, key); + ret = type_descriptor->check_constraints(type_descriptor, + struct_ptr, _asn_i_ctfailcb, &arg); + if(ret == -1 && errlen) + *errlen = arg.errlen; + + return ret; } + diff --git a/skeletons/constraints.h b/skeletons/constraints.h index 51fad8ed5f10e8f7d790b1472e87e4148e3f87ae..5032345ee475564eeea0240bf73d76ae41139f6f 100644 --- a/skeletons/constraints.h +++ b/skeletons/constraints.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved. + * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _ASN1_CONSTRAINTS_VALIDATOR_H_ @@ -20,6 +20,10 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */ * they could be passed as NULL's. If constraints validation fails, * errlen will contain the actual number of bytes taken from the errbuf * to encode an error message (properly 0-terminated). + * + * RETURN VALUES: + * This function returns 0 in case all ASN.1 constraints are met + * and -1 if one or more constraints were failed. */ int asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, @@ -28,6 +32,7 @@ asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, size_t *errlen /* Length of the error description */ ); + /* * Generic type for constraint checking callback, * associated with every type descriptor. @@ -35,8 +40,8 @@ asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, typedef int (asn_constr_check_f)( struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, - asn_app_consume_bytes_f *optional_app_errlog, /* Log the error */ - void *optional_app_key /* Opaque key passed to app_errlog */ + asn_app_constraint_failed_f *optional_callback, /* Log the error */ + void *optional_app_key /* Opaque key passed to a callback */ ); /******************************* @@ -49,11 +54,7 @@ asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ /* * Invoke the callback with a complete error message. */ -/* Preprocessor may not support variable args macros, so act strangely */ -#define _ASN_ERRLOG if(app_errlog) _asn_i_log_error - -void _asn_i_log_error(asn_app_consume_bytes_f *, void *key, - const char *fmt, ...) __attribute__ ((format(printf, 3, 4))); +#define _ASN_CTFAIL if(ctfailcb) ctfailcb #ifdef __cplusplus } diff --git a/tests/105-param-2-OK.asn1.-P b/tests/105-param-2-OK.asn1.-P index 009a0773a11b1f35f462516d775d305ab5ac4a55..08b5d6622fada3263efc42fcc5ae33507029dc58 100644 --- a/tests/105-param-2-OK.asn1.-P +++ b/tests/105-param-2-OK.asn1.-P @@ -227,10 +227,10 @@ xer_type_encoder_f SignedREAL_encode_xer; int SignedREAL_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_SIGNED_16P0.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -350,10 +350,10 @@ xer_type_encoder_f SignedSET_encode_xer; int SignedSET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_SIGNED_16P1.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/106-param-constr-OK.asn1.-P b/tests/106-param-constr-OK.asn1.-P index db115163f3e39765d3a9f1445335cda90b9df182..545e163716c253ee7d8ed7e79501a6ffbfe469f5 100644 --- a/tests/106-param-constr-OK.asn1.-P +++ b/tests/106-param-constr-OK.asn1.-P @@ -23,7 +23,7 @@ extern asn_TYPE_descriptor_t asn_DEF_Narrow_15P0; static int memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -48,7 +48,7 @@ memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -73,7 +73,7 @@ memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_narrow3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -205,10 +205,10 @@ xer_type_encoder_f NarrowInteger_encode_xer; int NarrowInteger_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Narrow_15P0.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/108-param-constr-3-OK.asn1.-P b/tests/108-param-constr-3-OK.asn1.-P index ee5a50425fdb0f372c2e35a5af7209d68b74ecf9..0f00d5da57fea42da0003af5696718f69b09f1d5 100644 --- a/tests/108-param-constr-3-OK.asn1.-P +++ b/tests/108-param-constr-3-OK.asn1.-P @@ -22,7 +22,7 @@ xer_type_encoder_f MinMax_16P0_encode_xer; int MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -168,7 +168,7 @@ xer_type_encoder_f ThreePlus_encode_xer; int ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr; long value; diff --git a/tests/110-param-3-OK.asn1.-P b/tests/110-param-3-OK.asn1.-P index 37ab930e1b2d8b201277b6615240c73963c01e1e..429bf5832ccc65307b7c9ea4f2ca6b5fcb5e635e 100644 --- a/tests/110-param-3-OK.asn1.-P +++ b/tests/110-param-3-OK.asn1.-P @@ -43,10 +43,10 @@ extern asn_TYPE_descriptor_t asn_DEF_Flag_16P1; static int field_7_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -306,10 +306,10 @@ xer_type_encoder_f IntegerColorFlag_encode_xer; int IntegerColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Flag_16P0.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -429,10 +429,10 @@ xer_type_encoder_f EnumeratedColorFlag_encode_xer; int EnumeratedColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Flag_16P1.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/19-param-OK.asn1.-P b/tests/19-param-OK.asn1.-P index 272cceec8670eec8f08ff4e1ce4a16d4339bd3c6..a11ef62f63f1dc237c51bfa26baf31ac506419f1 100644 --- a/tests/19-param-OK.asn1.-P +++ b/tests/19-param-OK.asn1.-P @@ -33,7 +33,7 @@ extern asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0; static int memb_signature_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; @@ -230,10 +230,10 @@ xer_type_encoder_f Certificate_encode_xer; int Certificate_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_SIGNED_15P0.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -453,7 +453,7 @@ static int check_permitted_alphabet_2(const void *sptr) { static int memb_IA5String_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { diff --git a/tests/32-sequence-of-OK.asn1.-EF b/tests/32-sequence-of-OK.asn1.-EF index 1fa4e101b5cbfdf0a87d7d3c97d5d44535b35251..d0059b2110b6fbfb2bfc4ec8dd4f7a22e3945683 100644 --- a/tests/32-sequence-of-OK.asn1.-EF +++ b/tests/32-sequence-of-OK.asn1.-EF @@ -13,4 +13,14 @@ Error ::= SEQUENCE { maxSize INTEGER ::= 10 +SeqWithMandatory ::= SEQUENCE { + someString UTF8String, + seqOfMan [0] EXPLICIT SEQUENCE OF Error +} + +SeqWithOptional ::= SEQUENCE { + someString UTF8String, + seqOfOpt [0] EXPLICIT SEQUENCE OF Error OPTIONAL +} + END diff --git a/tests/32-sequence-of-OK.asn1.-P b/tests/32-sequence-of-OK.asn1.-P index fd34d5f45635dbe9ecd33b0d54ae16c13665c9c8..e95c541adfe289085c7ee1c6640e0bb2b9058a20 100644 --- a/tests/32-sequence-of-OK.asn1.-P +++ b/tests/32-sequence-of-OK.asn1.-P @@ -200,3 +200,287 @@ asn_TYPE_descriptor_t asn_DEF_Error = { &asn_SPC_Error_specs_1 /* Additional specs */ }; + +/*** <<< INCLUDES [SeqWithMandatory] >>> ***/ + +#include <UTF8String.h> +#include <asn_SEQUENCE_OF.h> +#include <constr_SEQUENCE_OF.h> +#include <constr_SEQUENCE.h> + +/*** <<< FWD-DECLS [SeqWithMandatory] >>> ***/ + +struct Error; + +/*** <<< TYPE-DECLS [SeqWithMandatory] >>> ***/ + +typedef struct SeqWithMandatory { + UTF8String_t someString; + struct seqOfMan { + A_SEQUENCE_OF(struct Error) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } seqOfMan; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqWithMandatory_t; + +/*** <<< FUNC-DECLS [SeqWithMandatory] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_SeqWithMandatory; + +/*** <<< POST-INCLUDE [SeqWithMandatory] >>> ***/ + +#include <Error.h> + +/*** <<< STAT-DEFS [SeqWithMandatory] >>> ***/ + +static asn_TYPE_member_t asn_MBR_seqOfMan_3[] = { + { ATF_POINTER, 0, 0, + .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + .tag_mode = 0, + .type = &asn_DEF_Error, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "" + }, +}; +static ber_tlv_tag_t asn_DEF_seqOfMan_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_seqOfMan_specs_3 = { + sizeof(struct seqOfMan), + offsetof(struct seqOfMan, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_seqOfMan_3 = { + "seqOfMan", + "seqOfMan", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + 0, /* No PER decoder, -gen-PER to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_seqOfMan_tags_3, + sizeof(asn_DEF_seqOfMan_tags_3) + /sizeof(asn_DEF_seqOfMan_tags_3[0]), /* 2 */ + asn_DEF_seqOfMan_tags_3, /* Same as above */ + sizeof(asn_DEF_seqOfMan_tags_3) + /sizeof(asn_DEF_seqOfMan_tags_3[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_seqOfMan_3, + 1, /* Single element */ + &asn_SPC_seqOfMan_specs_3 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_SeqWithMandatory_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SeqWithMandatory, someString), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), + .tag_mode = 0, + .type = &asn_DEF_UTF8String, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "someString" + }, + { ATF_NOFLAGS, 0, offsetof(struct SeqWithMandatory, seqOfMan), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_seqOfMan_3, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "seqOfMan" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqWithMandatory_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SeqWithMandatory_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, 0, 0 }, /* someString at 25 */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* seqOfMan at 27 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SeqWithMandatory_specs_1 = { + sizeof(struct SeqWithMandatory), + offsetof(struct SeqWithMandatory, _asn_ctx), + asn_MAP_SeqWithMandatory_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqWithMandatory = { + "SeqWithMandatory", + "SeqWithMandatory", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, /* No PER decoder, -gen-PER to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqWithMandatory_tags_1, + sizeof(asn_DEF_SeqWithMandatory_tags_1) + /sizeof(asn_DEF_SeqWithMandatory_tags_1[0]), /* 1 */ + asn_DEF_SeqWithMandatory_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqWithMandatory_tags_1) + /sizeof(asn_DEF_SeqWithMandatory_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SeqWithMandatory_1, + 2, /* Elements count */ + &asn_SPC_SeqWithMandatory_specs_1 /* Additional specs */ +}; + + +/*** <<< INCLUDES [SeqWithOptional] >>> ***/ + +#include <UTF8String.h> +#include <asn_SEQUENCE_OF.h> +#include <constr_SEQUENCE_OF.h> +#include <constr_SEQUENCE.h> + +/*** <<< FWD-DECLS [SeqWithOptional] >>> ***/ + +struct Error; + +/*** <<< TYPE-DECLS [SeqWithOptional] >>> ***/ + +typedef struct SeqWithOptional { + UTF8String_t someString; + struct seqOfOpt { + A_SEQUENCE_OF(struct Error) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *seqOfOpt; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqWithOptional_t; + +/*** <<< FUNC-DECLS [SeqWithOptional] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_SeqWithOptional; + +/*** <<< POST-INCLUDE [SeqWithOptional] >>> ***/ + +#include <Error.h> + +/*** <<< STAT-DEFS [SeqWithOptional] >>> ***/ + +static asn_TYPE_member_t asn_MBR_seqOfOpt_3[] = { + { ATF_POINTER, 0, 0, + .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + .tag_mode = 0, + .type = &asn_DEF_Error, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "" + }, +}; +static ber_tlv_tag_t asn_DEF_seqOfOpt_tags_3[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_seqOfOpt_specs_3 = { + sizeof(struct seqOfOpt), + offsetof(struct seqOfOpt, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_seqOfOpt_3 = { + "seqOfOpt", + "seqOfOpt", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + 0, /* No PER decoder, -gen-PER to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_seqOfOpt_tags_3, + sizeof(asn_DEF_seqOfOpt_tags_3) + /sizeof(asn_DEF_seqOfOpt_tags_3[0]), /* 2 */ + asn_DEF_seqOfOpt_tags_3, /* Same as above */ + sizeof(asn_DEF_seqOfOpt_tags_3) + /sizeof(asn_DEF_seqOfOpt_tags_3[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_seqOfOpt_3, + 1, /* Single element */ + &asn_SPC_seqOfOpt_specs_3 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_SeqWithOptional_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SeqWithOptional, someString), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), + .tag_mode = 0, + .type = &asn_DEF_UTF8String, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "someString" + }, + { ATF_POINTER, 1, offsetof(struct SeqWithOptional, seqOfOpt), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = +1, /* EXPLICIT tag at current level */ + .type = &asn_DEF_seqOfOpt_3, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "seqOfOpt" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqWithOptional_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SeqWithOptional_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, 0, 0 }, /* someString at 30 */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* seqOfOpt at 31 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SeqWithOptional_specs_1 = { + sizeof(struct SeqWithOptional), + offsetof(struct SeqWithOptional, _asn_ctx), + asn_MAP_SeqWithOptional_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqWithOptional = { + "SeqWithOptional", + "SeqWithOptional", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, /* No PER decoder, -gen-PER to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqWithOptional_tags_1, + sizeof(asn_DEF_SeqWithOptional_tags_1) + /sizeof(asn_DEF_SeqWithOptional_tags_1[0]), /* 1 */ + asn_DEF_SeqWithOptional_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqWithOptional_tags_1) + /sizeof(asn_DEF_SeqWithOptional_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SeqWithOptional_1, + 2, /* Elements count */ + &asn_SPC_SeqWithOptional_specs_1 /* Additional specs */ +}; + diff --git a/tests/42-real-life-OK.asn1.-PR b/tests/42-real-life-OK.asn1.-PR index 7e752afedbbaf0385a3e83e18c7715dc107d1524..37b5858e3318a22632df4ba8f7dceed4494e45fb 100644 --- a/tests/42-real-life-OK.asn1.-PR +++ b/tests/42-real-life-OK.asn1.-PR @@ -41,7 +41,7 @@ extern asn_TYPE_descriptor_t asn_DEF_LogLine; static int memb_varsets_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { size_t size; if(!sptr) { @@ -215,7 +215,7 @@ extern asn_TYPE_descriptor_t asn_DEF_VariablePartSet; static int memb_vparts_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, @@ -229,7 +229,7 @@ memb_vparts_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, /* Nothing is here. See below */ } - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } @@ -397,7 +397,7 @@ extern asn_TYPE_descriptor_t asn_DEF_VariablePart; static int memb_vset_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { size_t size; if(!sptr) { @@ -644,10 +644,10 @@ extern asn_TYPE_descriptor_t asn_DEF_ActionItem; static int accept_as_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/46-redefine-OK.asn1.-PR b/tests/46-redefine-OK.asn1.-PR index 449707e2bc62119166616056964a3134e4274245..426a9dbb0383bb5db2db9c2443f827caab1a2805 100644 --- a/tests/46-redefine-OK.asn1.-PR +++ b/tests/46-redefine-OK.asn1.-PR @@ -22,10 +22,10 @@ xer_type_encoder_f PrimitiveType_encode_xer; int PrimitiveType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_OCTET_STRING.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -216,10 +216,10 @@ xer_type_encoder_f T_encode_xer; int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ConstructedType.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/50-constraint-OK.asn1.-P b/tests/50-constraint-OK.asn1.-P index 6426a93993c5825632505ae9e6468a060e2bc3f2..43fe3ef569c0aa3030b16886d7a7adf8919f1b6f 100644 --- a/tests/50-constraint-OK.asn1.-P +++ b/tests/50-constraint-OK.asn1.-P @@ -22,10 +22,10 @@ xer_type_encoder_f Int1_encode_xer; int Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -145,7 +145,7 @@ xer_type_encoder_f Int2_encode_xer; int Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; long value; @@ -287,7 +287,7 @@ xer_type_encoder_f Int3_encode_xer; int Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int2_t *st = (const Int2_t *)sptr; long value; @@ -433,7 +433,7 @@ xer_type_encoder_f Int4_encode_xer; int Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int3_t *st = (const Int3_t *)sptr; long value; @@ -579,7 +579,7 @@ xer_type_encoder_f Int5_encode_xer; int Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; long value; @@ -725,7 +725,7 @@ xer_type_encoder_f ExtensibleExtensions_encode_xer; int ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -871,10 +871,10 @@ xer_type_encoder_f Str1_encode_xer; int Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_IA5String.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -1010,7 +1010,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str1_t *st = (const Str1_t *)sptr; size_t size; @@ -1179,7 +1179,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str2_t *st = (const Str2_t *)sptr; size_t size; @@ -1337,7 +1337,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { @@ -1492,7 +1492,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { @@ -1647,7 +1647,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -1802,7 +1802,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -1957,7 +1957,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -2112,7 +2112,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -2267,7 +2267,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; @@ -2425,7 +2425,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; @@ -2583,7 +2583,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -2732,7 +2732,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; if(!sptr) { @@ -2900,7 +2900,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_2_t *st = (const Utf8_2_t *)sptr; size_t size; @@ -3048,7 +3048,7 @@ xer_type_encoder_f Utf8_2_encode_xer; int Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_1_t *st = (const Utf8_1_t *)sptr; size_t size; @@ -3195,10 +3195,10 @@ xer_type_encoder_f Utf8_1_encode_xer; int Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_UTF8String.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -3346,7 +3346,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Identifier_t *st = (const Identifier_t *)sptr; size_t size; @@ -3514,10 +3514,10 @@ extern asn_TYPE_descriptor_t asn_DEF_Sequence; static int enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -3586,7 +3586,7 @@ enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, static int memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; long value; @@ -3617,7 +3617,7 @@ memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; long value; @@ -3648,7 +3648,7 @@ memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int5_t *st = (const Int5_t *)sptr; long value; @@ -3962,10 +3962,10 @@ xer_type_encoder_f Enum0_encode_xer; int Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -4107,7 +4107,7 @@ xer_type_encoder_f Enum1_encode_xer; int Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -4290,7 +4290,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; size_t size; diff --git a/tests/50-constraint-OK.asn1.-Pgen-PER b/tests/50-constraint-OK.asn1.-Pgen-PER index 5092b01bf6e5ef4a5f46ffca8cba90e872ac0778..7f9affba62baa5a6d89c4dcc3e135f92975c17ad 100644 --- a/tests/50-constraint-OK.asn1.-Pgen-PER +++ b/tests/50-constraint-OK.asn1.-Pgen-PER @@ -23,10 +23,10 @@ per_type_decoder_f Int1_decode_uper; int Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -154,7 +154,7 @@ per_type_decoder_f Int2_decode_uper; int Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; long value; @@ -308,7 +308,7 @@ per_type_decoder_f Int3_decode_uper; int Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int2_t *st = (const Int2_t *)sptr; long value; @@ -466,7 +466,7 @@ per_type_decoder_f Int4_decode_uper; int Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int3_t *st = (const Int3_t *)sptr; long value; @@ -624,7 +624,7 @@ per_type_decoder_f Int5_decode_uper; int Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; long value; @@ -782,7 +782,7 @@ per_type_decoder_f ExtensibleExtensions_decode_uper; int ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -940,10 +940,10 @@ per_type_decoder_f Str1_decode_uper; int Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_IA5String.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -1087,7 +1087,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str1_t *st = (const Str1_t *)sptr; size_t size; @@ -1268,7 +1268,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str2_t *st = (const Str2_t *)sptr; size_t size; @@ -1438,7 +1438,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { @@ -1605,7 +1605,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { @@ -1772,7 +1772,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -1939,7 +1939,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -2106,7 +2106,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -2273,7 +2273,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -2440,7 +2440,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; @@ -2610,7 +2610,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; @@ -2780,7 +2780,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { @@ -2941,7 +2941,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; if(!sptr) { @@ -3121,7 +3121,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_2_t *st = (const Utf8_2_t *)sptr; size_t size; @@ -3281,7 +3281,7 @@ per_type_decoder_f Utf8_2_decode_uper; int Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_1_t *st = (const Utf8_1_t *)sptr; size_t size; @@ -3440,10 +3440,10 @@ per_type_decoder_f Utf8_1_decode_uper; int Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_UTF8String.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -3599,7 +3599,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Identifier_t *st = (const Identifier_t *)sptr; size_t size; @@ -3774,10 +3774,10 @@ extern asn_TYPE_descriptor_t asn_DEF_Sequence; static int enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -3853,7 +3853,7 @@ enum_c_6_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, static int memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; long value; @@ -3884,7 +3884,7 @@ memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; long value; @@ -3915,7 +3915,7 @@ memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int5_t *st = (const Int5_t *)sptr; long value; @@ -4256,10 +4256,10 @@ per_type_decoder_f Enum0_decode_uper; int Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -4413,7 +4413,7 @@ per_type_decoder_f Enum1_decode_uper; int Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -4608,7 +4608,7 @@ static int check_permitted_alphabet_1(const void *sptr) { int Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; size_t size; diff --git a/tests/65-multi-tag-OK.asn1.-P b/tests/65-multi-tag-OK.asn1.-P index f4b390779ee16a9c8f288a94f0d98cc74c1a706d..a77bd3e20b79b10d1c8437ebc3dfab089596cde9 100644 --- a/tests/65-multi-tag-OK.asn1.-P +++ b/tests/65-multi-tag-OK.asn1.-P @@ -22,10 +22,10 @@ xer_type_encoder_f T1_encode_xer; int T1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T2.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -156,10 +156,10 @@ xer_type_encoder_f T2_encode_xer; int T2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T3.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -288,10 +288,10 @@ xer_type_encoder_f T3_encode_xer; int T3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T4.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -418,10 +418,10 @@ xer_type_encoder_f T4_encode_xer; int T4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T5.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -543,10 +543,10 @@ xer_type_encoder_f T5_encode_xer; int T5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T6.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -667,10 +667,10 @@ xer_type_encoder_f T6_encode_xer; int T6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_REAL.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -790,10 +790,10 @@ xer_type_encoder_f T_encode_xer; int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Ts.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/65-multi-tag-OK.asn1.-Pfnative-types b/tests/65-multi-tag-OK.asn1.-Pfnative-types index fd5b46fbfe4a53250c227b1df448dfa3a1029a3c..76642fb2e822408a247c48fa87b5aa466d5fd05d 100644 --- a/tests/65-multi-tag-OK.asn1.-Pfnative-types +++ b/tests/65-multi-tag-OK.asn1.-Pfnative-types @@ -22,10 +22,10 @@ xer_type_encoder_f T1_encode_xer; int T1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T2.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -156,10 +156,10 @@ xer_type_encoder_f T2_encode_xer; int T2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T3.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -288,10 +288,10 @@ xer_type_encoder_f T3_encode_xer; int T3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T4.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -418,10 +418,10 @@ xer_type_encoder_f T4_encode_xer; int T4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T5.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -543,10 +543,10 @@ xer_type_encoder_f T5_encode_xer; int T5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T6.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -667,10 +667,10 @@ xer_type_encoder_f T6_encode_xer; int T6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeReal.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -790,10 +790,10 @@ xer_type_encoder_f T_encode_xer; int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Ts.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/66-ref-simple-OK.asn1.-P b/tests/66-ref-simple-OK.asn1.-P index b424e478876aa871f55bf0551fc28aadc216a9a6..b6dc5cedde8ff288672e8690d171eff7e8f7260d 100644 --- a/tests/66-ref-simple-OK.asn1.-P +++ b/tests/66-ref-simple-OK.asn1.-P @@ -95,10 +95,10 @@ xer_type_encoder_f SimpleType_encode_xer; int SimpleType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/69-reserved-words-OK.asn1.-P b/tests/69-reserved-words-OK.asn1.-P index 897295d79c6e26f89fb34020916e965a80986c93..f6f4168c243b45116fb1b36dedc5d3106be2b4ce 100644 --- a/tests/69-reserved-words-OK.asn1.-P +++ b/tests/69-reserved-words-OK.asn1.-P @@ -48,7 +48,7 @@ extern asn_TYPE_descriptor_t asn_DEF_T; static int memb_char_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; diff --git a/tests/70-xer-test-OK.asn1.-P b/tests/70-xer-test-OK.asn1.-P index b3d2ff9c8d53a9a26642f2450df6893021f730fc..a5a4d608e13e663881a93ade4500661a3bfdc1fe 100644 --- a/tests/70-xer-test-OK.asn1.-P +++ b/tests/70-xer-test-OK.asn1.-P @@ -528,10 +528,10 @@ extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSet; static int enum_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -1057,10 +1057,10 @@ extern asn_TYPE_descriptor_t asn_DEF_SetOfEnums; static int Member_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -1377,10 +1377,10 @@ extern asn_TYPE_descriptor_t asn_DEF_NamedSetOfEnums; static int name_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/72-same-names-OK.asn1.-P b/tests/72-same-names-OK.asn1.-P index 4b804ea92340a6106f5b788b5a6fd068b1f20cb5..3ef0465d2847757b73c592f692688d1623105cbb 100644 --- a/tests/72-same-names-OK.asn1.-P +++ b/tests/72-same-names-OK.asn1.-P @@ -411,7 +411,7 @@ extern asn_TYPE_descriptor_t asn_DEF_Type2; static int memb_a_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; @@ -442,7 +442,7 @@ memb_a_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_a_constraint_8(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; diff --git a/tests/73-circular-OK.asn1.-P b/tests/73-circular-OK.asn1.-P index 5fe6fc333e8405be7b799ea78d695cf45101deda..d9852b8cf962da1919b01b6d0d3d7dc28fefff81 100644 --- a/tests/73-circular-OK.asn1.-P +++ b/tests/73-circular-OK.asn1.-P @@ -151,10 +151,10 @@ xer_type_encoder_f EpytRef_encode_xer; int EpytRef_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Epyt.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -494,7 +494,7 @@ static int check_permitted_alphabet_7(const void *sptr) { static int memb_patest1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { @@ -518,7 +518,7 @@ memb_patest1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_patest2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { @@ -724,10 +724,10 @@ xer_type_encoder_f EnumType_encode_xer; int EnumType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/84-param-tags-OK.asn1.-P b/tests/84-param-tags-OK.asn1.-P index d3a61c67eca1bae8332dc861e4ac1ac4155c2572..4c684850193bd875f25450bd516b7f5f6412de7c 100644 --- a/tests/84-param-tags-OK.asn1.-P +++ b/tests/84-param-tags-OK.asn1.-P @@ -29,7 +29,7 @@ extern asn_TYPE_descriptor_t asn_DEF_TestType_16P1; static int memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -299,7 +299,7 @@ extern asn_TYPE_descriptor_t asn_DEF_AutoType_34P1; static int memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -324,7 +324,7 @@ memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_common_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { BOOLEAN_t value; if(!sptr) { diff --git a/tests/88-integer-enum-OK.asn1.-P b/tests/88-integer-enum-OK.asn1.-P index bbd437aaa1dc77440e64ee21c053ffd41ffa799b..af25491db9122e5e8d8802abe0a6fe1c3f2a8689 100644 --- a/tests/88-integer-enum-OK.asn1.-P +++ b/tests/88-integer-enum-OK.asn1.-P @@ -29,10 +29,10 @@ xer_type_encoder_f T_encode_xer; int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/90-cond-int-type-OK.asn1.-P b/tests/90-cond-int-type-OK.asn1.-P index aae3b12636f2a4cde8f69f9007e695acff123676..ebcfb63f06fd1f0d5bdb05018d04ecbaa46c6c93 100644 --- a/tests/90-cond-int-type-OK.asn1.-P +++ b/tests/90-cond-int-type-OK.asn1.-P @@ -22,10 +22,10 @@ xer_type_encoder_f CN_IntegerUnlimited_encode_xer; int CN_IntegerUnlimited_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -145,7 +145,7 @@ xer_type_encoder_f CN_IntegerMinMax_encode_xer; int CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; if(!sptr) { @@ -162,7 +162,7 @@ CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -282,7 +282,7 @@ xer_type_encoder_f CN_IntegerMinLow_encode_xer; int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -428,7 +428,7 @@ xer_type_encoder_f NO_IntegerMinHigh_encode_xer; int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -574,7 +574,7 @@ xer_type_encoder_f NO_IntegerLowHigh_encode_xer; int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -720,7 +720,7 @@ xer_type_encoder_f CN_IntegerLowMax_encode_xer; int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -866,7 +866,7 @@ xer_type_encoder_f NO_IntegerHighMax_encode_xer; int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1012,7 +1012,7 @@ xer_type_encoder_f NO_IntegerLowestMax_encode_xer; int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1158,7 +1158,7 @@ xer_type_encoder_f NO_IntegerOutRange_encode_xer; int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1304,7 +1304,7 @@ xer_type_encoder_f NO_IntegerOutValue_encode_xer; int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1450,7 +1450,7 @@ xer_type_encoder_f OK_IntegerInRange1_encode_xer; int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1590,7 +1590,7 @@ xer_type_encoder_f OK_IntegerInRange2_encode_xer; int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1730,7 +1730,7 @@ xer_type_encoder_f OK_IntegerInRange3_encode_xer; int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1870,7 +1870,7 @@ xer_type_encoder_f OK_IntegerInRange4_encode_xer; int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -2010,7 +2010,7 @@ xer_type_encoder_f OK_IntegerInRange5_encode_xer; int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -2156,7 +2156,7 @@ xer_type_encoder_f NO_IntegerInRange6_encode_xer; int NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -2309,10 +2309,10 @@ xer_type_encoder_f CN_IntegerEnumerated1_encode_xer; int CN_IntegerEnumerated1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -2439,10 +2439,10 @@ xer_type_encoder_f NO_IntegerEnumerated2_encode_xer; int NO_IntegerEnumerated2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/90-cond-int-type-OK.asn1.-Pfnative-types b/tests/90-cond-int-type-OK.asn1.-Pfnative-types index 765d2847e8f5f5b7b27bc7cfd52284903ccb0087..efcd3dc63f670c1de7175ad4726d86a23527c882 100644 --- a/tests/90-cond-int-type-OK.asn1.-Pfnative-types +++ b/tests/90-cond-int-type-OK.asn1.-Pfnative-types @@ -22,10 +22,10 @@ xer_type_encoder_f CN_IntegerUnlimited_encode_xer; int CN_IntegerUnlimited_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -145,7 +145,7 @@ xer_type_encoder_f CN_IntegerMinMax_encode_xer; int CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, @@ -161,7 +161,7 @@ CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -281,7 +281,7 @@ xer_type_encoder_f CN_IntegerMinLow_encode_xer; int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -421,7 +421,7 @@ xer_type_encoder_f NO_IntegerMinHigh_encode_xer; int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -567,7 +567,7 @@ xer_type_encoder_f NO_IntegerLowHigh_encode_xer; int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -713,7 +713,7 @@ xer_type_encoder_f CN_IntegerLowMax_encode_xer; int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -853,7 +853,7 @@ xer_type_encoder_f NO_IntegerHighMax_encode_xer; int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -999,7 +999,7 @@ xer_type_encoder_f NO_IntegerLowestMax_encode_xer; int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1145,7 +1145,7 @@ xer_type_encoder_f NO_IntegerOutRange_encode_xer; int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1291,7 +1291,7 @@ xer_type_encoder_f NO_IntegerOutValue_encode_xer; int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1437,7 +1437,7 @@ xer_type_encoder_f OK_IntegerInRange1_encode_xer; int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1577,7 +1577,7 @@ xer_type_encoder_f OK_IntegerInRange2_encode_xer; int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1717,7 +1717,7 @@ xer_type_encoder_f OK_IntegerInRange3_encode_xer; int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1857,7 +1857,7 @@ xer_type_encoder_f OK_IntegerInRange4_encode_xer; int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1997,7 +1997,7 @@ xer_type_encoder_f OK_IntegerInRange5_encode_xer; int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -2137,7 +2137,7 @@ xer_type_encoder_f NO_IntegerInRange6_encode_xer; int NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -2290,10 +2290,10 @@ xer_type_encoder_f CN_IntegerEnumerated1_encode_xer; int CN_IntegerEnumerated1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -2420,10 +2420,10 @@ xer_type_encoder_f NO_IntegerEnumerated2_encode_xer; int NO_IntegerEnumerated2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/90-cond-int-type-OK.asn1.-Pgen-PER b/tests/90-cond-int-type-OK.asn1.-Pgen-PER index 88d7b33fbc443a020a54eaf269177a2bd78749e7..0516de8567a92d23e7a69750706058ac1e1ff8af 100644 --- a/tests/90-cond-int-type-OK.asn1.-Pgen-PER +++ b/tests/90-cond-int-type-OK.asn1.-Pgen-PER @@ -23,10 +23,10 @@ per_type_decoder_f CN_IntegerUnlimited_decode_uper; int CN_IntegerUnlimited_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -154,7 +154,7 @@ per_type_decoder_f CN_IntegerMinMax_decode_uper; int CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; if(!sptr) { @@ -171,7 +171,7 @@ CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -303,7 +303,7 @@ per_type_decoder_f CN_IntegerMinLow_decode_uper; int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -461,7 +461,7 @@ per_type_decoder_f NO_IntegerMinHigh_decode_uper; int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -619,7 +619,7 @@ per_type_decoder_f NO_IntegerLowHigh_decode_uper; int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -777,7 +777,7 @@ per_type_decoder_f CN_IntegerLowMax_decode_uper; int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -935,7 +935,7 @@ per_type_decoder_f NO_IntegerHighMax_decode_uper; int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1093,7 +1093,7 @@ per_type_decoder_f NO_IntegerLowestMax_decode_uper; int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1251,7 +1251,7 @@ per_type_decoder_f NO_IntegerOutRange_decode_uper; int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1409,7 +1409,7 @@ per_type_decoder_f NO_IntegerOutValue_decode_uper; int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -1567,7 +1567,7 @@ per_type_decoder_f OK_IntegerInRange1_decode_uper; int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1719,7 +1719,7 @@ per_type_decoder_f OK_IntegerInRange2_decode_uper; int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -1871,7 +1871,7 @@ per_type_decoder_f OK_IntegerInRange3_decode_uper; int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -2023,7 +2023,7 @@ per_type_decoder_f OK_IntegerInRange4_decode_uper; int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { @@ -2175,7 +2175,7 @@ per_type_decoder_f OK_IntegerInRange5_decode_uper; int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -2333,7 +2333,7 @@ per_type_decoder_f NO_IntegerInRange6_decode_uper; int NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; @@ -2498,10 +2498,10 @@ per_type_decoder_f CN_IntegerEnumerated1_decode_uper; int CN_IntegerEnumerated1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -2636,10 +2636,10 @@ per_type_decoder_f NO_IntegerEnumerated2_decode_uper; int NO_IntegerEnumerated2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE index 1164e418927c2aee2dac26d9b4fed598c7b24063..0bf1fd558632b79c43a64c7be4ca627d99626944 100644 --- a/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE +++ b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE @@ -22,7 +22,7 @@ xer_type_encoder_f OK_Integer1_encode_xer; int OK_Integer1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, @@ -38,7 +38,7 @@ OK_Integer1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -158,7 +158,7 @@ xer_type_encoder_f OK_Integer2_encode_xer; int OK_Integer2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, @@ -174,7 +174,7 @@ OK_Integer2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -294,7 +294,7 @@ xer_type_encoder_f OK_Integer3_encode_xer; int OK_Integer3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, @@ -310,7 +310,7 @@ OK_Integer3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -430,7 +430,7 @@ xer_type_encoder_f OK_Integer4_encode_xer; int OK_Integer4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, @@ -446,7 +446,7 @@ OK_Integer4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* @@ -566,7 +566,7 @@ xer_type_encoder_f NO_Integer5_encode_xer; int NO_Integer5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; if(!sptr) { @@ -583,7 +583,7 @@ NO_Integer5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/92-circular-loops-OK.asn1.-P b/tests/92-circular-loops-OK.asn1.-P index 5e161af1c7613158a5f640e00789d38edcd03642..48d0c149dbde49ae8a6a7655d5d5c2870a0fa14c 100644 --- a/tests/92-circular-loops-OK.asn1.-P +++ b/tests/92-circular-loops-OK.asn1.-P @@ -931,10 +931,10 @@ xer_type_encoder_f TypeRef_encode_xer; int TypeRef_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Sequence.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice index 7f0c38597b8620bc59597a2e936e5518f8beda1d..66e63c15f0c28591dd81f53621f4108a72afb70b 100644 --- a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice +++ b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice @@ -932,10 +932,10 @@ xer_type_encoder_f TypeRef_encode_xer; int TypeRef_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Sequence.check_constraints; - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); } /* diff --git a/tests/98-attribute-class-OK.asn1.-P b/tests/98-attribute-class-OK.asn1.-P index c018f87c1977c931d55d98fac2f705c27179afc4..a200048a4511157f70841c44c712ef434dd014a7 100644 --- a/tests/98-attribute-class-OK.asn1.-P +++ b/tests/98-attribute-class-OK.asn1.-P @@ -23,7 +23,7 @@ extern asn_TYPE_descriptor_t asn_DEF_Attribute; static int memb_identifier_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *app_errlog, void *app_key) { + asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, @@ -37,7 +37,7 @@ memb_identifier_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, /* Nothing is here. See below */ } - return td->check_constraints(td, sptr, app_errlog, app_key); + return td->check_constraints(td, sptr, ctfailcb, app_key); }