From 2a744a747082995dec6f524368807391e0baa569 Mon Sep 17 00:00:00 2001 From: Lev Walkin Date: Wed, 27 Mar 2013 01:56:23 -0700 Subject: Behavior of -fnative-types made default; old behavior saved under -fwide-types --- tests/03-enum-OK.asn1.-P | 798 ---- tests/03-enum-OK.asn1.-Pfwide-types | 798 ++++ tests/104-param-1-OK.asn1.-P | 198 - tests/104-param-1-OK.asn1.-Pfwide-types | 198 + tests/105-param-2-OK.asn1.-P | 453 -- tests/105-param-2-OK.asn1.-Pfwide-types | 453 ++ tests/108-param-constr-3-OK.asn1.-P | 294 -- tests/108-param-constr-3-OK.asn1.-Pfwide-types | 294 ++ tests/110-param-3-OK.asn1.-P | 553 --- tests/110-param-3-OK.asn1.-Pfwide-types | 553 +++ tests/119-per-strings-OK.asn1.-Pgen-PER | 6 +- tests/125-bitstring-constraint-OK.asn1.-X | 2 +- tests/126-per-extensions-OK.asn1.-Pgen-PER | 14 +- tests/127-per-long-OK.asn1.-Pgen-PER | 4 - tests/19-param-OK.asn1.-P | 524 --- tests/19-param-OK.asn1.-Pfwide-types | 524 +++ tests/22-tags-OK.asn1.-P | 170 - tests/22-tags-OK.asn1.-Pfwide-types | 170 + tests/30-set-OK.asn1.-P | 120 - tests/30-set-OK.asn1.-Pfwide-types | 120 + tests/31-set-of-OK.asn1.-P | 522 --- tests/31-set-of-OK.asn1.-Pfwide-types | 522 +++ tests/37-indirect-choice-OK.asn1.-P | 819 ---- tests/37-indirect-choice-OK.asn1.-Pfwide-types | 819 ++++ tests/39-sequence-of-OK.asn1.-P | 224 - tests/39-sequence-of-OK.asn1.-Pfwide-types | 224 + tests/42-real-life-OK.asn1.-PR | 32 +- tests/43-recursion-OK.asn1.-P | 581 --- tests/43-recursion-OK.asn1.-Pfwide-types | 581 +++ tests/47-set-ext-OK.asn1.-P | 354 -- tests/47-set-ext-OK.asn1.-Pfwide-types | 354 ++ tests/50-constraint-OK.asn1.-P | 4458 -------------------- tests/50-constraint-OK.asn1.-Pfwide-types | 4458 ++++++++++++++++++++ tests/50-constraint-OK.asn1.-Pgen-PER | 198 +- tests/59-choice-extended-OK.asn1.-P | 119 - tests/59-choice-extended-OK.asn1.-Pfwide-types | 119 + tests/60-any-OK.asn1.-P | 243 -- tests/60-any-OK.asn1.-Pfwide-types | 243 ++ tests/65-multi-tag-OK.asn1.-P | 995 ----- tests/65-multi-tag-OK.asn1.-Pfwide-types | 995 +++++ tests/66-ref-simple-OK.asn1.-P | 216 - tests/66-ref-simple-OK.asn1.-Pfwide-types | 216 + tests/69-reserved-words-OK.asn1.-P | 198 - tests/69-reserved-words-OK.asn1.-Pfwide-types | 198 + tests/70-xer-test-OK.asn1.-P | 1911 --------- tests/70-xer-test-OK.asn1.-Pfwide-types | 1911 +++++++++ tests/72-same-names-OK.asn1.-P | 761 ---- tests/72-same-names-OK.asn1.-Pfwide-types | 761 ++++ tests/73-circular-OK.asn1.-P | 853 ---- tests/73-circular-OK.asn1.-Pfwide-types | 853 ++++ tests/84-param-tags-OK.asn1.-P | 553 --- tests/84-param-tags-OK.asn1.-Pfwide-types | 553 +++ tests/88-integer-enum-OK.asn1.-P | 131 - tests/88-integer-enum-OK.asn1.-Pfwide-types | 131 + tests/89-bit-string-enum-OK.asn1.-P | 81 - tests/89-bit-string-enum-OK.asn1.-Pfwide-types | 81 + tests/90-cond-int-type-OK.asn1.-P | 213 +- tests/90-cond-int-type-OK.asn1.-Pfnative-types | 2528 ----------- tests/90-cond-int-type-OK.asn1.-Pfwide-types | 2545 +++++++++++ tests/90-cond-int-type-OK.asn1.-Pgen-PER | 213 +- tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE | 33 +- tests/92-circular-loops-OK.asn1.-P | 1679 -------- tests/92-circular-loops-OK.asn1.-Pfindirect-choice | 16 +- tests/92-circular-loops-OK.asn1.-Pfwide-types | 1679 ++++++++ tests/93-asn1c-controls-OK.asn1.-P | 354 -- tests/93-asn1c-controls-OK.asn1.-Pfwide-types | 354 ++ tests/95-choice-per-order-OK.asn1.-P | 284 -- tests/95-choice-per-order-OK.asn1.-Pfwide-types | 284 ++ tests/95-choice-per-order-OK.asn1.-Pgen-PER | 10 +- 69 files changed, 21315 insertions(+), 21391 deletions(-) delete mode 100644 tests/03-enum-OK.asn1.-P create mode 100644 tests/03-enum-OK.asn1.-Pfwide-types delete mode 100644 tests/104-param-1-OK.asn1.-P create mode 100644 tests/104-param-1-OK.asn1.-Pfwide-types delete mode 100644 tests/105-param-2-OK.asn1.-P create mode 100644 tests/105-param-2-OK.asn1.-Pfwide-types delete mode 100644 tests/108-param-constr-3-OK.asn1.-P create mode 100644 tests/108-param-constr-3-OK.asn1.-Pfwide-types delete mode 100644 tests/110-param-3-OK.asn1.-P create mode 100644 tests/110-param-3-OK.asn1.-Pfwide-types delete mode 100644 tests/19-param-OK.asn1.-P create mode 100644 tests/19-param-OK.asn1.-Pfwide-types delete mode 100644 tests/22-tags-OK.asn1.-P create mode 100644 tests/22-tags-OK.asn1.-Pfwide-types delete mode 100644 tests/30-set-OK.asn1.-P create mode 100644 tests/30-set-OK.asn1.-Pfwide-types delete mode 100644 tests/31-set-of-OK.asn1.-P create mode 100644 tests/31-set-of-OK.asn1.-Pfwide-types delete mode 100644 tests/37-indirect-choice-OK.asn1.-P create mode 100644 tests/37-indirect-choice-OK.asn1.-Pfwide-types delete mode 100644 tests/39-sequence-of-OK.asn1.-P create mode 100644 tests/39-sequence-of-OK.asn1.-Pfwide-types delete mode 100644 tests/43-recursion-OK.asn1.-P create mode 100644 tests/43-recursion-OK.asn1.-Pfwide-types delete mode 100644 tests/47-set-ext-OK.asn1.-P create mode 100644 tests/47-set-ext-OK.asn1.-Pfwide-types delete mode 100644 tests/50-constraint-OK.asn1.-P create mode 100644 tests/50-constraint-OK.asn1.-Pfwide-types delete mode 100644 tests/59-choice-extended-OK.asn1.-P create mode 100644 tests/59-choice-extended-OK.asn1.-Pfwide-types delete mode 100644 tests/60-any-OK.asn1.-P create mode 100644 tests/60-any-OK.asn1.-Pfwide-types delete mode 100644 tests/65-multi-tag-OK.asn1.-P create mode 100644 tests/65-multi-tag-OK.asn1.-Pfwide-types delete mode 100644 tests/66-ref-simple-OK.asn1.-P create mode 100644 tests/66-ref-simple-OK.asn1.-Pfwide-types delete mode 100644 tests/69-reserved-words-OK.asn1.-P create mode 100644 tests/69-reserved-words-OK.asn1.-Pfwide-types delete mode 100644 tests/70-xer-test-OK.asn1.-P create mode 100644 tests/70-xer-test-OK.asn1.-Pfwide-types delete mode 100644 tests/72-same-names-OK.asn1.-P create mode 100644 tests/72-same-names-OK.asn1.-Pfwide-types delete mode 100644 tests/73-circular-OK.asn1.-P create mode 100644 tests/73-circular-OK.asn1.-Pfwide-types delete mode 100644 tests/84-param-tags-OK.asn1.-P create mode 100644 tests/84-param-tags-OK.asn1.-Pfwide-types delete mode 100644 tests/88-integer-enum-OK.asn1.-P create mode 100644 tests/88-integer-enum-OK.asn1.-Pfwide-types delete mode 100644 tests/89-bit-string-enum-OK.asn1.-P create mode 100644 tests/89-bit-string-enum-OK.asn1.-Pfwide-types delete mode 100644 tests/90-cond-int-type-OK.asn1.-Pfnative-types create mode 100644 tests/90-cond-int-type-OK.asn1.-Pfwide-types delete mode 100644 tests/92-circular-loops-OK.asn1.-P create mode 100644 tests/92-circular-loops-OK.asn1.-Pfwide-types delete mode 100644 tests/93-asn1c-controls-OK.asn1.-P create mode 100644 tests/93-asn1c-controls-OK.asn1.-Pfwide-types delete mode 100644 tests/95-choice-per-order-OK.asn1.-P create mode 100644 tests/95-choice-per-order-OK.asn1.-Pfwide-types (limited to 'tests') diff --git a/tests/03-enum-OK.asn1.-P b/tests/03-enum-OK.asn1.-P deleted file mode 100644 index d2e8ad0f..00000000 --- a/tests/03-enum-OK.asn1.-P +++ /dev/null @@ -1,798 +0,0 @@ - -/*** <<< INCLUDES [Enum1] >>> ***/ - -#include - -/*** <<< DEPS [Enum1] >>> ***/ - -typedef enum Enum1 { - Enum1_red = 0, - Enum1_green = 1, - Enum1_blue = 4, - Enum1_alpha = 5 - /* - * Enumeration is extensible - */ -} e_Enum1; - -/*** <<< TYPE-DECLS [Enum1] >>> ***/ - -typedef ENUMERATED_t Enum1_t; - -/*** <<< FUNC-DECLS [Enum1] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Enum1; -asn_struct_free_f Enum1_free; -asn_struct_print_f Enum1_print; -asn_constr_check_f Enum1_constraint; -ber_type_decoder_f Enum1_decode_ber; -der_type_encoder_f Enum1_encode_der; -xer_type_decoder_f Enum1_decode_xer; -xer_type_encoder_f Enum1_encode_xer; - -/*** <<< CODE [Enum1] >>> ***/ - -int -Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using ENUMERATED, - * so here we adjust the DEF accordingly. - */ -static void -Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; - td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ -} - -void -Enum1_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - Enum1_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - Enum1_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - Enum1_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -Enum1_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum1_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - Enum1_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum1_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [Enum1] >>> ***/ - -static asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { - { 0, 3, "red" }, - { 1, 5, "green" }, - { 4, 4, "blue" }, - { 5, 5, "alpha" } - /* This list is extensible */ -}; -static unsigned int asn_MAP_Enum1_enum2value_1[] = { - 3, /* alpha(5) */ - 2, /* blue(4) */ - 1, /* green(1) */ - 0 /* red(0) */ - /* This list is extensible */ -}; -static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { - asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ - 4, /* Number of elements in the maps */ - 5, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; -static ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_Enum1 = { - "Enum1", - "Enum1", - Enum1_free, - Enum1_print, - Enum1_constraint, - Enum1_decode_ber, - Enum1_encode_der, - Enum1_decode_xer, - Enum1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Enum1_tags_1, - sizeof(asn_DEF_Enum1_tags_1) - /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ - asn_DEF_Enum1_tags_1, /* Same as above */ - sizeof(asn_DEF_Enum1_tags_1) - /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - &asn_SPC_Enum1_specs_1 /* Additional specs */ -}; - - -/*** <<< INCLUDES [Enum2] >>> ***/ - -#include - -/*** <<< DEPS [Enum2] >>> ***/ - -typedef enum Enum2 { - Enum2_red = 0, - Enum2_green = 1, - Enum2_blue = 45, - Enum2_orange = 23, - Enum2_alpha = 46, - /* - * Enumeration is extensible - */ - Enum2_beta = 12, - Enum2_gamma = 103 -} e_Enum2; - -/*** <<< TYPE-DECLS [Enum2] >>> ***/ - -typedef ENUMERATED_t Enum2_t; - -/*** <<< FUNC-DECLS [Enum2] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Enum2; -asn_struct_free_f Enum2_free; -asn_struct_print_f Enum2_print; -asn_constr_check_f Enum2_constraint; -ber_type_decoder_f Enum2_decode_ber; -der_type_encoder_f Enum2_encode_der; -xer_type_decoder_f Enum2_decode_xer; -xer_type_encoder_f Enum2_encode_xer; - -/*** <<< CODE [Enum2] >>> ***/ - -int -Enum2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using ENUMERATED, - * so here we adjust the DEF accordingly. - */ -static void -Enum2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; - td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ -} - -void -Enum2_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - Enum2_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -Enum2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - Enum2_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -Enum2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - Enum2_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -Enum2_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum2_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -Enum2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - Enum2_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -Enum2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum2_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [Enum2] >>> ***/ - -static asn_INTEGER_enum_map_t asn_MAP_Enum2_value2enum_1[] = { - { 0, 3, "red" }, - { 1, 5, "green" }, - { 12, 4, "beta" }, - { 23, 6, "orange" }, - { 45, 4, "blue" }, - { 46, 5, "alpha" }, - { 103, 5, "gamma" } - /* This list is extensible */ -}; -static unsigned int asn_MAP_Enum2_enum2value_1[] = { - 5, /* alpha(46) */ - 2, /* beta(12) */ - 4, /* blue(45) */ - 6, /* gamma(103) */ - 1, /* green(1) */ - 3, /* orange(23) */ - 0 /* red(0) */ - /* This list is extensible */ -}; -static asn_INTEGER_specifics_t asn_SPC_Enum2_specs_1 = { - asn_MAP_Enum2_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_Enum2_enum2value_1, /* N => "tag"; sorted by N */ - 7, /* Number of elements in the maps */ - 6, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; -static ber_tlv_tag_t asn_DEF_Enum2_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_Enum2 = { - "Enum2", - "Enum2", - Enum2_free, - Enum2_print, - Enum2_constraint, - Enum2_decode_ber, - Enum2_encode_der, - Enum2_decode_xer, - Enum2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Enum2_tags_1, - sizeof(asn_DEF_Enum2_tags_1) - /sizeof(asn_DEF_Enum2_tags_1[0]), /* 1 */ - asn_DEF_Enum2_tags_1, /* Same as above */ - sizeof(asn_DEF_Enum2_tags_1) - /sizeof(asn_DEF_Enum2_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - &asn_SPC_Enum2_specs_1 /* Additional specs */ -}; - - -/*** <<< INCLUDES [Enum3] >>> ***/ - -#include - -/*** <<< DEPS [Enum3] >>> ***/ - -typedef enum Enum3 { - Enum3_a = 0, - Enum3_b = 3, - /* - * Enumeration is extensible - */ - Enum3_c = 1 -} e_Enum3; - -/*** <<< TYPE-DECLS [Enum3] >>> ***/ - -typedef ENUMERATED_t Enum3_t; - -/*** <<< FUNC-DECLS [Enum3] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Enum3; -asn_struct_free_f Enum3_free; -asn_struct_print_f Enum3_print; -asn_constr_check_f Enum3_constraint; -ber_type_decoder_f Enum3_decode_ber; -der_type_encoder_f Enum3_encode_der; -xer_type_decoder_f Enum3_decode_xer; -xer_type_encoder_f Enum3_encode_xer; - -/*** <<< CODE [Enum3] >>> ***/ - -int -Enum3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using ENUMERATED, - * so here we adjust the DEF accordingly. - */ -static void -Enum3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; - td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ -} - -void -Enum3_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - Enum3_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -Enum3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - Enum3_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -Enum3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - Enum3_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -Enum3_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum3_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -Enum3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - Enum3_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -Enum3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum3_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [Enum3] >>> ***/ - -static asn_INTEGER_enum_map_t asn_MAP_Enum3_value2enum_1[] = { - { 0, 1, "a" }, - { 1, 1, "c" }, - { 3, 1, "b" } - /* This list is extensible */ -}; -static unsigned int asn_MAP_Enum3_enum2value_1[] = { - 0, /* a(0) */ - 2, /* b(3) */ - 1 /* c(1) */ - /* This list is extensible */ -}; -static asn_INTEGER_specifics_t asn_SPC_Enum3_specs_1 = { - asn_MAP_Enum3_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_Enum3_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 3, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; -static ber_tlv_tag_t asn_DEF_Enum3_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_Enum3 = { - "Enum3", - "Enum3", - Enum3_free, - Enum3_print, - Enum3_constraint, - Enum3_decode_ber, - Enum3_encode_der, - Enum3_decode_xer, - Enum3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Enum3_tags_1, - sizeof(asn_DEF_Enum3_tags_1) - /sizeof(asn_DEF_Enum3_tags_1[0]), /* 1 */ - asn_DEF_Enum3_tags_1, /* Same as above */ - sizeof(asn_DEF_Enum3_tags_1) - /sizeof(asn_DEF_Enum3_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - &asn_SPC_Enum3_specs_1 /* Additional specs */ -}; - - -/*** <<< INCLUDES [Enum4] >>> ***/ - -#include - -/*** <<< DEPS [Enum4] >>> ***/ - -typedef enum Enum4 { - Enum4_a = 0, - Enum4_b = 1, - /* - * Enumeration is extensible - */ - Enum4_c = 3, - Enum4_d = 4 -} e_Enum4; - -/*** <<< TYPE-DECLS [Enum4] >>> ***/ - -typedef ENUMERATED_t Enum4_t; - -/*** <<< FUNC-DECLS [Enum4] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Enum4; -asn_struct_free_f Enum4_free; -asn_struct_print_f Enum4_print; -asn_constr_check_f Enum4_constraint; -ber_type_decoder_f Enum4_decode_ber; -der_type_encoder_f Enum4_encode_der; -xer_type_decoder_f Enum4_decode_xer; -xer_type_encoder_f Enum4_encode_xer; - -/*** <<< CODE [Enum4] >>> ***/ - -int -Enum4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using ENUMERATED, - * so here we adjust the DEF accordingly. - */ -static void -Enum4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; - td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ -} - -void -Enum4_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - Enum4_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -Enum4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - Enum4_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -Enum4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - Enum4_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -Enum4_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum4_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -Enum4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - Enum4_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -Enum4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum4_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [Enum4] >>> ***/ - -static asn_INTEGER_enum_map_t asn_MAP_Enum4_value2enum_1[] = { - { 0, 1, "a" }, - { 1, 1, "b" }, - { 3, 1, "c" }, - { 4, 1, "d" } - /* This list is extensible */ -}; -static unsigned int asn_MAP_Enum4_enum2value_1[] = { - 0, /* a(0) */ - 1, /* b(1) */ - 2, /* c(3) */ - 3 /* d(4) */ - /* This list is extensible */ -}; -static asn_INTEGER_specifics_t asn_SPC_Enum4_specs_1 = { - asn_MAP_Enum4_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_Enum4_enum2value_1, /* N => "tag"; sorted by N */ - 4, /* Number of elements in the maps */ - 3, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; -static ber_tlv_tag_t asn_DEF_Enum4_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_Enum4 = { - "Enum4", - "Enum4", - Enum4_free, - Enum4_print, - Enum4_constraint, - Enum4_decode_ber, - Enum4_encode_der, - Enum4_decode_xer, - Enum4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Enum4_tags_1, - sizeof(asn_DEF_Enum4_tags_1) - /sizeof(asn_DEF_Enum4_tags_1[0]), /* 1 */ - asn_DEF_Enum4_tags_1, /* Same as above */ - sizeof(asn_DEF_Enum4_tags_1) - /sizeof(asn_DEF_Enum4_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - &asn_SPC_Enum4_specs_1 /* Additional specs */ -}; - - -/*** <<< INCLUDES [Enum5] >>> ***/ - -#include - -/*** <<< DEPS [Enum5] >>> ***/ - -typedef enum Enum5 { - Enum5_a = 0, - Enum5_z = 25, - /* - * Enumeration is extensible - */ - Enum5_d = 26 -} e_Enum5; - -/*** <<< TYPE-DECLS [Enum5] >>> ***/ - -typedef ENUMERATED_t Enum5_t; - -/*** <<< FUNC-DECLS [Enum5] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Enum5; -asn_struct_free_f Enum5_free; -asn_struct_print_f Enum5_print; -asn_constr_check_f Enum5_constraint; -ber_type_decoder_f Enum5_decode_ber; -der_type_encoder_f Enum5_encode_der; -xer_type_decoder_f Enum5_decode_xer; -xer_type_encoder_f Enum5_encode_xer; - -/*** <<< CODE [Enum5] >>> ***/ - -int -Enum5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using ENUMERATED, - * so here we adjust the DEF accordingly. - */ -static void -Enum5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; - td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ -} - -void -Enum5_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - Enum5_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -Enum5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - Enum5_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -Enum5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - Enum5_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -Enum5_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum5_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -Enum5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - Enum5_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -Enum5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - Enum5_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [Enum5] >>> ***/ - -static asn_INTEGER_enum_map_t asn_MAP_Enum5_value2enum_1[] = { - { 0, 1, "a" }, - { 25, 1, "z" }, - { 26, 1, "d" } - /* This list is extensible */ -}; -static unsigned int asn_MAP_Enum5_enum2value_1[] = { - 0, /* a(0) */ - 2, /* d(26) */ - 1 /* z(25) */ - /* This list is extensible */ -}; -static asn_INTEGER_specifics_t asn_SPC_Enum5_specs_1 = { - asn_MAP_Enum5_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_Enum5_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 3, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; -static ber_tlv_tag_t asn_DEF_Enum5_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_Enum5 = { - "Enum5", - "Enum5", - Enum5_free, - Enum5_print, - Enum5_constraint, - Enum5_decode_ber, - Enum5_encode_der, - Enum5_decode_xer, - Enum5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Enum5_tags_1, - sizeof(asn_DEF_Enum5_tags_1) - /sizeof(asn_DEF_Enum5_tags_1[0]), /* 1 */ - asn_DEF_Enum5_tags_1, /* Same as above */ - sizeof(asn_DEF_Enum5_tags_1) - /sizeof(asn_DEF_Enum5_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - &asn_SPC_Enum5_specs_1 /* Additional specs */ -}; - diff --git a/tests/03-enum-OK.asn1.-Pfwide-types b/tests/03-enum-OK.asn1.-Pfwide-types new file mode 100644 index 00000000..d2e8ad0f --- /dev/null +++ b/tests/03-enum-OK.asn1.-Pfwide-types @@ -0,0 +1,798 @@ + +/*** <<< INCLUDES [Enum1] >>> ***/ + +#include + +/*** <<< DEPS [Enum1] >>> ***/ + +typedef enum Enum1 { + Enum1_red = 0, + Enum1_green = 1, + Enum1_blue = 4, + Enum1_alpha = 5 + /* + * Enumeration is extensible + */ +} e_Enum1; + +/*** <<< TYPE-DECLS [Enum1] >>> ***/ + +typedef ENUMERATED_t Enum1_t; + +/*** <<< FUNC-DECLS [Enum1] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Enum1; +asn_struct_free_f Enum1_free; +asn_struct_print_f Enum1_print; +asn_constr_check_f Enum1_constraint; +ber_type_decoder_f Enum1_decode_ber; +der_type_encoder_f Enum1_encode_der; +xer_type_decoder_f Enum1_decode_xer; +xer_type_encoder_f Enum1_encode_xer; + +/*** <<< CODE [Enum1] >>> ***/ + +int +Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +Enum1_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Enum1_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Enum1_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Enum1_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Enum1_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum1_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Enum1_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum1_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [Enum1] >>> ***/ + +static asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { + { 0, 3, "red" }, + { 1, 5, "green" }, + { 4, 4, "blue" }, + { 5, 5, "alpha" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_Enum1_enum2value_1[] = { + 3, /* alpha(5) */ + 2, /* blue(4) */ + 1, /* green(1) */ + 0 /* red(0) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { + asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 5, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Enum1 = { + "Enum1", + "Enum1", + Enum1_free, + Enum1_print, + Enum1_constraint, + Enum1_decode_ber, + Enum1_encode_der, + Enum1_decode_xer, + Enum1_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Enum1_tags_1, + sizeof(asn_DEF_Enum1_tags_1) + /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ + asn_DEF_Enum1_tags_1, /* Same as above */ + sizeof(asn_DEF_Enum1_tags_1) + /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_Enum1_specs_1 /* Additional specs */ +}; + + +/*** <<< INCLUDES [Enum2] >>> ***/ + +#include + +/*** <<< DEPS [Enum2] >>> ***/ + +typedef enum Enum2 { + Enum2_red = 0, + Enum2_green = 1, + Enum2_blue = 45, + Enum2_orange = 23, + Enum2_alpha = 46, + /* + * Enumeration is extensible + */ + Enum2_beta = 12, + Enum2_gamma = 103 +} e_Enum2; + +/*** <<< TYPE-DECLS [Enum2] >>> ***/ + +typedef ENUMERATED_t Enum2_t; + +/*** <<< FUNC-DECLS [Enum2] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Enum2; +asn_struct_free_f Enum2_free; +asn_struct_print_f Enum2_print; +asn_constr_check_f Enum2_constraint; +ber_type_decoder_f Enum2_decode_ber; +der_type_encoder_f Enum2_encode_der; +xer_type_decoder_f Enum2_decode_xer; +xer_type_encoder_f Enum2_encode_xer; + +/*** <<< CODE [Enum2] >>> ***/ + +int +Enum2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +Enum2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +Enum2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Enum2_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Enum2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Enum2_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Enum2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Enum2_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Enum2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum2_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Enum2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Enum2_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Enum2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum2_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [Enum2] >>> ***/ + +static asn_INTEGER_enum_map_t asn_MAP_Enum2_value2enum_1[] = { + { 0, 3, "red" }, + { 1, 5, "green" }, + { 12, 4, "beta" }, + { 23, 6, "orange" }, + { 45, 4, "blue" }, + { 46, 5, "alpha" }, + { 103, 5, "gamma" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_Enum2_enum2value_1[] = { + 5, /* alpha(46) */ + 2, /* beta(12) */ + 4, /* blue(45) */ + 6, /* gamma(103) */ + 1, /* green(1) */ + 3, /* orange(23) */ + 0 /* red(0) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_Enum2_specs_1 = { + asn_MAP_Enum2_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_Enum2_enum2value_1, /* N => "tag"; sorted by N */ + 7, /* Number of elements in the maps */ + 6, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_Enum2_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Enum2 = { + "Enum2", + "Enum2", + Enum2_free, + Enum2_print, + Enum2_constraint, + Enum2_decode_ber, + Enum2_encode_der, + Enum2_decode_xer, + Enum2_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Enum2_tags_1, + sizeof(asn_DEF_Enum2_tags_1) + /sizeof(asn_DEF_Enum2_tags_1[0]), /* 1 */ + asn_DEF_Enum2_tags_1, /* Same as above */ + sizeof(asn_DEF_Enum2_tags_1) + /sizeof(asn_DEF_Enum2_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_Enum2_specs_1 /* Additional specs */ +}; + + +/*** <<< INCLUDES [Enum3] >>> ***/ + +#include + +/*** <<< DEPS [Enum3] >>> ***/ + +typedef enum Enum3 { + Enum3_a = 0, + Enum3_b = 3, + /* + * Enumeration is extensible + */ + Enum3_c = 1 +} e_Enum3; + +/*** <<< TYPE-DECLS [Enum3] >>> ***/ + +typedef ENUMERATED_t Enum3_t; + +/*** <<< FUNC-DECLS [Enum3] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Enum3; +asn_struct_free_f Enum3_free; +asn_struct_print_f Enum3_print; +asn_constr_check_f Enum3_constraint; +ber_type_decoder_f Enum3_decode_ber; +der_type_encoder_f Enum3_encode_der; +xer_type_decoder_f Enum3_decode_xer; +xer_type_encoder_f Enum3_encode_xer; + +/*** <<< CODE [Enum3] >>> ***/ + +int +Enum3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +Enum3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +Enum3_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Enum3_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Enum3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Enum3_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Enum3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Enum3_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Enum3_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum3_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Enum3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Enum3_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Enum3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum3_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [Enum3] >>> ***/ + +static asn_INTEGER_enum_map_t asn_MAP_Enum3_value2enum_1[] = { + { 0, 1, "a" }, + { 1, 1, "c" }, + { 3, 1, "b" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_Enum3_enum2value_1[] = { + 0, /* a(0) */ + 2, /* b(3) */ + 1 /* c(1) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_Enum3_specs_1 = { + asn_MAP_Enum3_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_Enum3_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 3, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_Enum3_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Enum3 = { + "Enum3", + "Enum3", + Enum3_free, + Enum3_print, + Enum3_constraint, + Enum3_decode_ber, + Enum3_encode_der, + Enum3_decode_xer, + Enum3_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Enum3_tags_1, + sizeof(asn_DEF_Enum3_tags_1) + /sizeof(asn_DEF_Enum3_tags_1[0]), /* 1 */ + asn_DEF_Enum3_tags_1, /* Same as above */ + sizeof(asn_DEF_Enum3_tags_1) + /sizeof(asn_DEF_Enum3_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_Enum3_specs_1 /* Additional specs */ +}; + + +/*** <<< INCLUDES [Enum4] >>> ***/ + +#include + +/*** <<< DEPS [Enum4] >>> ***/ + +typedef enum Enum4 { + Enum4_a = 0, + Enum4_b = 1, + /* + * Enumeration is extensible + */ + Enum4_c = 3, + Enum4_d = 4 +} e_Enum4; + +/*** <<< TYPE-DECLS [Enum4] >>> ***/ + +typedef ENUMERATED_t Enum4_t; + +/*** <<< FUNC-DECLS [Enum4] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Enum4; +asn_struct_free_f Enum4_free; +asn_struct_print_f Enum4_print; +asn_constr_check_f Enum4_constraint; +ber_type_decoder_f Enum4_decode_ber; +der_type_encoder_f Enum4_encode_der; +xer_type_decoder_f Enum4_decode_xer; +xer_type_encoder_f Enum4_encode_xer; + +/*** <<< CODE [Enum4] >>> ***/ + +int +Enum4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +Enum4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +Enum4_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Enum4_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Enum4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Enum4_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Enum4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Enum4_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Enum4_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum4_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Enum4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Enum4_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Enum4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum4_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [Enum4] >>> ***/ + +static asn_INTEGER_enum_map_t asn_MAP_Enum4_value2enum_1[] = { + { 0, 1, "a" }, + { 1, 1, "b" }, + { 3, 1, "c" }, + { 4, 1, "d" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_Enum4_enum2value_1[] = { + 0, /* a(0) */ + 1, /* b(1) */ + 2, /* c(3) */ + 3 /* d(4) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_Enum4_specs_1 = { + asn_MAP_Enum4_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_Enum4_enum2value_1, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 3, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_Enum4_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Enum4 = { + "Enum4", + "Enum4", + Enum4_free, + Enum4_print, + Enum4_constraint, + Enum4_decode_ber, + Enum4_encode_der, + Enum4_decode_xer, + Enum4_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Enum4_tags_1, + sizeof(asn_DEF_Enum4_tags_1) + /sizeof(asn_DEF_Enum4_tags_1[0]), /* 1 */ + asn_DEF_Enum4_tags_1, /* Same as above */ + sizeof(asn_DEF_Enum4_tags_1) + /sizeof(asn_DEF_Enum4_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_Enum4_specs_1 /* Additional specs */ +}; + + +/*** <<< INCLUDES [Enum5] >>> ***/ + +#include + +/*** <<< DEPS [Enum5] >>> ***/ + +typedef enum Enum5 { + Enum5_a = 0, + Enum5_z = 25, + /* + * Enumeration is extensible + */ + Enum5_d = 26 +} e_Enum5; + +/*** <<< TYPE-DECLS [Enum5] >>> ***/ + +typedef ENUMERATED_t Enum5_t; + +/*** <<< FUNC-DECLS [Enum5] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Enum5; +asn_struct_free_f Enum5_free; +asn_struct_print_f Enum5_print; +asn_constr_check_f Enum5_constraint; +ber_type_decoder_f Enum5_decode_ber; +der_type_encoder_f Enum5_encode_der; +xer_type_decoder_f Enum5_decode_xer; +xer_type_encoder_f Enum5_encode_xer; + +/*** <<< CODE [Enum5] >>> ***/ + +int +Enum5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +Enum5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +Enum5_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Enum5_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Enum5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Enum5_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Enum5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Enum5_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Enum5_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum5_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Enum5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Enum5_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Enum5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Enum5_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [Enum5] >>> ***/ + +static asn_INTEGER_enum_map_t asn_MAP_Enum5_value2enum_1[] = { + { 0, 1, "a" }, + { 25, 1, "z" }, + { 26, 1, "d" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_Enum5_enum2value_1[] = { + 0, /* a(0) */ + 2, /* d(26) */ + 1 /* z(25) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_Enum5_specs_1 = { + asn_MAP_Enum5_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_Enum5_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 3, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_Enum5_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Enum5 = { + "Enum5", + "Enum5", + Enum5_free, + Enum5_print, + Enum5_constraint, + Enum5_decode_ber, + Enum5_encode_der, + Enum5_decode_xer, + Enum5_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Enum5_tags_1, + sizeof(asn_DEF_Enum5_tags_1) + /sizeof(asn_DEF_Enum5_tags_1[0]), /* 1 */ + asn_DEF_Enum5_tags_1, /* Same as above */ + sizeof(asn_DEF_Enum5_tags_1) + /sizeof(asn_DEF_Enum5_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_Enum5_specs_1 /* Additional specs */ +}; + diff --git a/tests/104-param-1-OK.asn1.-P b/tests/104-param-1-OK.asn1.-P deleted file mode 100644 index 24f4a64a..00000000 --- a/tests/104-param-1-OK.asn1.-P +++ /dev/null @@ -1,198 +0,0 @@ - -/*** <<< INCLUDES [Collection] >>> ***/ - -#include -#include -#include -#include - -/*** <<< TYPE-DECLS [Collection] >>> ***/ - -typedef struct Collection_16P0 { - A_SET_OF(REAL_t) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Collection_16P0_t; -typedef struct Collection_16P1 { - A_SET_OF(IA5String_t) list; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Collection_16P1_t; - -/*** <<< FUNC-DECLS [Collection] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Collection_16P0; -extern asn_TYPE_descriptor_t asn_DEF_Collection_16P1; - -/*** <<< STAT-DEFS [Collection] >>> ***/ - -static asn_TYPE_member_t asn_MBR_Collection_16P0_1[] = { - { ATF_POINTER, 0, 0, - .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), - .tag_mode = 0, - .type = &asn_DEF_REAL, - .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_Collection_16P0_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) -}; -static asn_SET_OF_specifics_t asn_SPC_Collection_16P0_specs_1 = { - sizeof(struct Collection_16P0), - offsetof(struct Collection_16P0, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ -}; -asn_TYPE_descriptor_t asn_DEF_Collection_16P0 = { - "Collection", - "Collection", - SET_OF_free, - SET_OF_print, - SET_OF_constraint, - SET_OF_decode_ber, - SET_OF_encode_der, - SET_OF_decode_xer, - SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Collection_16P0_tags_1, - sizeof(asn_DEF_Collection_16P0_tags_1) - /sizeof(asn_DEF_Collection_16P0_tags_1[0]), /* 1 */ - asn_DEF_Collection_16P0_tags_1, /* Same as above */ - sizeof(asn_DEF_Collection_16P0_tags_1) - /sizeof(asn_DEF_Collection_16P0_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_Collection_16P0_1, - 1, /* Single element */ - &asn_SPC_Collection_16P0_specs_1 /* Additional specs */ -}; - -static asn_TYPE_member_t asn_MBR_Collection_16P1_3[] = { - { ATF_POINTER, 0, 0, - .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), - .tag_mode = 0, - .type = &asn_DEF_IA5String, - .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_Collection_16P1_tags_3[] = { - (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) -}; -static asn_SET_OF_specifics_t asn_SPC_Collection_16P1_specs_3 = { - sizeof(struct Collection_16P1), - offsetof(struct Collection_16P1, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ -}; -asn_TYPE_descriptor_t asn_DEF_Collection_16P1 = { - "Collection", - "Collection", - SET_OF_free, - SET_OF_print, - SET_OF_constraint, - SET_OF_decode_ber, - SET_OF_encode_der, - SET_OF_decode_xer, - SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Collection_16P1_tags_3, - sizeof(asn_DEF_Collection_16P1_tags_3) - /sizeof(asn_DEF_Collection_16P1_tags_3[0]), /* 1 */ - asn_DEF_Collection_16P1_tags_3, /* Same as above */ - sizeof(asn_DEF_Collection_16P1_tags_3) - /sizeof(asn_DEF_Collection_16P1_tags_3[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_Collection_16P1_3, - 1, /* Single element */ - &asn_SPC_Collection_16P1_specs_3 /* Additional specs */ -}; - - -/*** <<< INCLUDES [Bunch] >>> ***/ - -#include "Collection.h" -#include - -/*** <<< TYPE-DECLS [Bunch] >>> ***/ - -typedef struct Bunch { - Collection_16P0_t field_REAL; - Collection_16P1_t field_IA5String; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Bunch_t; - -/*** <<< FUNC-DECLS [Bunch] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Bunch; - -/*** <<< STAT-DEFS [Bunch] >>> ***/ - -static asn_TYPE_member_t asn_MBR_Bunch_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Bunch, field_REAL), - .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), - .tag_mode = 0, - .type = &asn_DEF_Collection_16P0, - .memb_constraints = 0, /* Defer constraints checking to the member type */ - .per_constraints = 0, /* PER is not compiled, use -gen-PER */ - .default_value = 0, - .name = "field-REAL" - }, - { ATF_NOFLAGS, 0, offsetof(struct Bunch, field_IA5String), - .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), - .tag_mode = 0, - .type = &asn_DEF_Collection_16P1, - .memb_constraints = 0, /* Defer constraints checking to the member type */ - .per_constraints = 0, /* PER is not compiled, use -gen-PER */ - .default_value = 0, - .name = "field-IA5String" - }, -}; -static ber_tlv_tag_t asn_DEF_Bunch_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_TYPE_tag2member_t asn_MAP_Bunch_tag2el_1[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 1 }, /* field-REAL at 17 */ - { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, -1, 0 } /* field-IA5String at 18 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Bunch_specs_1 = { - sizeof(struct Bunch), - offsetof(struct Bunch, _asn_ctx), - asn_MAP_Bunch_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_Bunch = { - "Bunch", - "Bunch", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Bunch_tags_1, - sizeof(asn_DEF_Bunch_tags_1) - /sizeof(asn_DEF_Bunch_tags_1[0]), /* 1 */ - asn_DEF_Bunch_tags_1, /* Same as above */ - sizeof(asn_DEF_Bunch_tags_1) - /sizeof(asn_DEF_Bunch_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_Bunch_1, - 2, /* Elements count */ - &asn_SPC_Bunch_specs_1 /* Additional specs */ -}; - diff --git a/tests/104-param-1-OK.asn1.-Pfwide-types b/tests/104-param-1-OK.asn1.-Pfwide-types new file mode 100644 index 00000000..24f4a64a --- /dev/null +++ b/tests/104-param-1-OK.asn1.-Pfwide-types @@ -0,0 +1,198 @@ + +/*** <<< INCLUDES [Collection] >>> ***/ + +#include +#include +#include +#include + +/*** <<< TYPE-DECLS [Collection] >>> ***/ + +typedef struct Collection_16P0 { + A_SET_OF(REAL_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Collection_16P0_t; +typedef struct Collection_16P1 { + A_SET_OF(IA5String_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Collection_16P1_t; + +/*** <<< FUNC-DECLS [Collection] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Collection_16P0; +extern asn_TYPE_descriptor_t asn_DEF_Collection_16P1; + +/*** <<< STAT-DEFS [Collection] >>> ***/ + +static asn_TYPE_member_t asn_MBR_Collection_16P0_1[] = { + { ATF_POINTER, 0, 0, + .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), + .tag_mode = 0, + .type = &asn_DEF_REAL, + .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_Collection_16P0_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_Collection_16P0_specs_1 = { + sizeof(struct Collection_16P0), + offsetof(struct Collection_16P0, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_Collection_16P0 = { + "Collection", + "Collection", + SET_OF_free, + SET_OF_print, + SET_OF_constraint, + SET_OF_decode_ber, + SET_OF_encode_der, + SET_OF_decode_xer, + SET_OF_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Collection_16P0_tags_1, + sizeof(asn_DEF_Collection_16P0_tags_1) + /sizeof(asn_DEF_Collection_16P0_tags_1[0]), /* 1 */ + asn_DEF_Collection_16P0_tags_1, /* Same as above */ + sizeof(asn_DEF_Collection_16P0_tags_1) + /sizeof(asn_DEF_Collection_16P0_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Collection_16P0_1, + 1, /* Single element */ + &asn_SPC_Collection_16P0_specs_1 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_Collection_16P1_3[] = { + { ATF_POINTER, 0, 0, + .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), + .tag_mode = 0, + .type = &asn_DEF_IA5String, + .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_Collection_16P1_tags_3[] = { + (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_Collection_16P1_specs_3 = { + sizeof(struct Collection_16P1), + offsetof(struct Collection_16P1, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_Collection_16P1 = { + "Collection", + "Collection", + SET_OF_free, + SET_OF_print, + SET_OF_constraint, + SET_OF_decode_ber, + SET_OF_encode_der, + SET_OF_decode_xer, + SET_OF_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Collection_16P1_tags_3, + sizeof(asn_DEF_Collection_16P1_tags_3) + /sizeof(asn_DEF_Collection_16P1_tags_3[0]), /* 1 */ + asn_DEF_Collection_16P1_tags_3, /* Same as above */ + sizeof(asn_DEF_Collection_16P1_tags_3) + /sizeof(asn_DEF_Collection_16P1_tags_3[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Collection_16P1_3, + 1, /* Single element */ + &asn_SPC_Collection_16P1_specs_3 /* Additional specs */ +}; + + +/*** <<< INCLUDES [Bunch] >>> ***/ + +#include "Collection.h" +#include + +/*** <<< TYPE-DECLS [Bunch] >>> ***/ + +typedef struct Bunch { + Collection_16P0_t field_REAL; + Collection_16P1_t field_IA5String; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Bunch_t; + +/*** <<< FUNC-DECLS [Bunch] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Bunch; + +/*** <<< STAT-DEFS [Bunch] >>> ***/ + +static asn_TYPE_member_t asn_MBR_Bunch_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Bunch, field_REAL), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), + .tag_mode = 0, + .type = &asn_DEF_Collection_16P0, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "field-REAL" + }, + { ATF_NOFLAGS, 0, offsetof(struct Bunch, field_IA5String), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), + .tag_mode = 0, + .type = &asn_DEF_Collection_16P1, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "field-IA5String" + }, +}; +static ber_tlv_tag_t asn_DEF_Bunch_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Bunch_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 1 }, /* field-REAL at 17 */ + { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, -1, 0 } /* field-IA5String at 18 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Bunch_specs_1 = { + sizeof(struct Bunch), + offsetof(struct Bunch, _asn_ctx), + asn_MAP_Bunch_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_Bunch = { + "Bunch", + "Bunch", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Bunch_tags_1, + sizeof(asn_DEF_Bunch_tags_1) + /sizeof(asn_DEF_Bunch_tags_1[0]), /* 1 */ + asn_DEF_Bunch_tags_1, /* Same as above */ + sizeof(asn_DEF_Bunch_tags_1) + /sizeof(asn_DEF_Bunch_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Bunch_1, + 2, /* Elements count */ + &asn_SPC_Bunch_specs_1 /* Additional specs */ +}; + diff --git a/tests/105-param-2-OK.asn1.-P b/tests/105-param-2-OK.asn1.-P deleted file mode 100644 index 8a9b9f86..00000000 --- a/tests/105-param-2-OK.asn1.-P +++ /dev/null @@ -1,453 +0,0 @@ - -/*** <<< INCLUDES [SIGNED] >>> ***/ - -#include -#include -#include -#include - -/*** <<< DEPS [SIGNED] >>> ***/ - - -/* - * Method of determining the components presence - */ -typedef enum signed_PR { - signed_PR_a, /* Member a is present */ -} signed_PR; - -/*** <<< TYPE-DECLS [SIGNED] >>> ***/ - -typedef struct SIGNED_16P0 { - REAL_t Signed; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} SIGNED_16P0_t; -typedef struct SIGNED_16P1 { - struct Signed { - INTEGER_t a; - - /* Presence bitmask: ASN_SET_ISPRESENT(psigned, signed_PR_x) */ - unsigned int _presence_map - [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; - } Signed; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} SIGNED_16P1_t; - -/*** <<< FUNC-DECLS [SIGNED] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_SIGNED_16P0; -extern asn_TYPE_descriptor_t asn_DEF_SIGNED_16P1; - -/*** <<< STAT-DEFS [SIGNED] >>> ***/ - -static asn_TYPE_member_t asn_MBR_SIGNED_16P0_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SIGNED_16P0, Signed), - .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), - .tag_mode = 0, - .type = &asn_DEF_REAL, - .memb_constraints = 0, /* Defer constraints checking to the member type */ - .per_constraints = 0, /* PER is not compiled, use -gen-PER */ - .default_value = 0, - .name = "signed" - }, -}; -static ber_tlv_tag_t asn_DEF_SIGNED_16P0_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_TYPE_tag2member_t asn_MAP_SIGNED_16P0_tag2el_1[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 0, 0, 0 } /* signed at 18 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_16P0_specs_1 = { - sizeof(struct SIGNED_16P0), - offsetof(struct SIGNED_16P0, _asn_ctx), - asn_MAP_SIGNED_16P0_tag2el_1, - 1, /* 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_SIGNED_16P0 = { - "SIGNED", - "SIGNED", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_SIGNED_16P0_tags_1, - sizeof(asn_DEF_SIGNED_16P0_tags_1) - /sizeof(asn_DEF_SIGNED_16P0_tags_1[0]), /* 1 */ - asn_DEF_SIGNED_16P0_tags_1, /* Same as above */ - sizeof(asn_DEF_SIGNED_16P0_tags_1) - /sizeof(asn_DEF_SIGNED_16P0_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_SIGNED_16P0_1, - 1, /* Elements count */ - &asn_SPC_SIGNED_16P0_specs_1 /* Additional specs */ -}; - -static asn_TYPE_member_t asn_MBR_signed_4[] = { - { ATF_NOFLAGS, 0, offsetof(struct Signed, a), - .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), - .tag_mode = 0, - .type = &asn_DEF_INTEGER, - .memb_constraints = 0, /* Defer constraints checking to the member type */ - .per_constraints = 0, /* PER is not compiled, use -gen-PER */ - .default_value = 0, - .name = "a" - }, -}; -static ber_tlv_tag_t asn_DEF_signed_tags_4[] = { - (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) -}; -static asn_TYPE_tag2member_t asn_MAP_signed_tag2el_4[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* a at 19 */ -}; -static uint8_t asn_MAP_signed_mmap_4[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { - (1 << 7) -}; -static asn_SET_specifics_t asn_SPC_signed_specs_4 = { - sizeof(struct Signed), - offsetof(struct Signed, _asn_ctx), - offsetof(struct Signed, _presence_map), - asn_MAP_signed_tag2el_4, - 1, /* Count of tags in the map */ - asn_MAP_signed_tag2el_4, /* Same as above */ - 1, /* Count of tags in the CXER map */ - 0, /* Whether extensible */ - (unsigned int *)asn_MAP_signed_mmap_4 /* Mandatory elements map */ -}; -static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_signed_4 = { - "signed", - "signed", - SET_free, - SET_print, - SET_constraint, - SET_decode_ber, - SET_encode_der, - SET_decode_xer, - SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_signed_tags_4, - sizeof(asn_DEF_signed_tags_4) - /sizeof(asn_DEF_signed_tags_4[0]), /* 1 */ - asn_DEF_signed_tags_4, /* Same as above */ - sizeof(asn_DEF_signed_tags_4) - /sizeof(asn_DEF_signed_tags_4[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_signed_4, - 1, /* Elements count */ - &asn_SPC_signed_specs_4 /* Additional specs */ -}; - -static asn_TYPE_member_t asn_MBR_SIGNED_16P1_3[] = { - { ATF_NOFLAGS, 0, offsetof(struct SIGNED_16P1, Signed), - .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), - .tag_mode = 0, - .type = &asn_DEF_signed_4, - .memb_constraints = 0, /* Defer constraints checking to the member type */ - .per_constraints = 0, /* PER is not compiled, use -gen-PER */ - .default_value = 0, - .name = "signed" - }, -}; -static ber_tlv_tag_t asn_DEF_SIGNED_16P1_tags_3[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_TYPE_tag2member_t asn_MAP_SIGNED_16P1_tag2el_3[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 } /* signed at 19 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_16P1_specs_3 = { - sizeof(struct SIGNED_16P1), - offsetof(struct SIGNED_16P1, _asn_ctx), - asn_MAP_SIGNED_16P1_tag2el_3, - 1, /* 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_SIGNED_16P1 = { - "SIGNED", - "SIGNED", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_SIGNED_16P1_tags_3, - sizeof(asn_DEF_SIGNED_16P1_tags_3) - /sizeof(asn_DEF_SIGNED_16P1_tags_3[0]), /* 1 */ - asn_DEF_SIGNED_16P1_tags_3, /* Same as above */ - sizeof(asn_DEF_SIGNED_16P1_tags_3) - /sizeof(asn_DEF_SIGNED_16P1_tags_3[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_SIGNED_16P1_3, - 1, /* Elements count */ - &asn_SPC_SIGNED_16P1_specs_3 /* Additional specs */ -}; - - -/*** <<< INCLUDES [SignedREAL] >>> ***/ - -#include "SIGNED.h" - -/*** <<< TYPE-DECLS [SignedREAL] >>> ***/ - -typedef SIGNED_16P0_t SignedREAL_t; - -/*** <<< FUNC-DECLS [SignedREAL] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_SignedREAL; -asn_struct_free_f SignedREAL_free; -asn_struct_print_f SignedREAL_print; -asn_constr_check_f SignedREAL_constraint; -ber_type_decoder_f SignedREAL_decode_ber; -der_type_encoder_f SignedREAL_encode_der; -xer_type_decoder_f SignedREAL_decode_xer; -xer_type_encoder_f SignedREAL_encode_xer; - -/*** <<< CODE [SignedREAL] >>> ***/ - -int -SignedREAL_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using SIGNED_16P0, - * so here we adjust the DEF accordingly. - */ -static void -SignedREAL_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_SIGNED_16P0.free_struct; - td->print_struct = asn_DEF_SIGNED_16P0.print_struct; - td->ber_decoder = asn_DEF_SIGNED_16P0.ber_decoder; - td->der_encoder = asn_DEF_SIGNED_16P0.der_encoder; - td->xer_decoder = asn_DEF_SIGNED_16P0.xer_decoder; - td->xer_encoder = asn_DEF_SIGNED_16P0.xer_encoder; - td->uper_decoder = asn_DEF_SIGNED_16P0.uper_decoder; - td->uper_encoder = asn_DEF_SIGNED_16P0.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_SIGNED_16P0.per_constraints; - td->elements = asn_DEF_SIGNED_16P0.elements; - td->elements_count = asn_DEF_SIGNED_16P0.elements_count; - td->specifics = asn_DEF_SIGNED_16P0.specifics; -} - -void -SignedREAL_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - SignedREAL_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -SignedREAL_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - SignedREAL_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -SignedREAL_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - SignedREAL_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -SignedREAL_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - SignedREAL_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -SignedREAL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - SignedREAL_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -SignedREAL_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - SignedREAL_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [SignedREAL] >>> ***/ - -static ber_tlv_tag_t asn_DEF_SignedREAL_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_SignedREAL = { - "SignedREAL", - "SignedREAL", - SignedREAL_free, - SignedREAL_print, - SignedREAL_constraint, - SignedREAL_decode_ber, - SignedREAL_encode_der, - SignedREAL_decode_xer, - SignedREAL_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_SignedREAL_tags_1, - sizeof(asn_DEF_SignedREAL_tags_1) - /sizeof(asn_DEF_SignedREAL_tags_1[0]), /* 1 */ - asn_DEF_SignedREAL_tags_1, /* Same as above */ - sizeof(asn_DEF_SignedREAL_tags_1) - /sizeof(asn_DEF_SignedREAL_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ -}; - - -/*** <<< INCLUDES [SignedSET] >>> ***/ - -#include "SIGNED.h" - -/*** <<< TYPE-DECLS [SignedSET] >>> ***/ - -typedef SIGNED_16P1_t SignedSET_t; - -/*** <<< FUNC-DECLS [SignedSET] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_SignedSET; -asn_struct_free_f SignedSET_free; -asn_struct_print_f SignedSET_print; -asn_constr_check_f SignedSET_constraint; -ber_type_decoder_f SignedSET_decode_ber; -der_type_encoder_f SignedSET_encode_der; -xer_type_decoder_f SignedSET_decode_xer; -xer_type_encoder_f SignedSET_encode_xer; - -/*** <<< CODE [SignedSET] >>> ***/ - -int -SignedSET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using SIGNED_16P1, - * so here we adjust the DEF accordingly. - */ -static void -SignedSET_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_SIGNED_16P1.free_struct; - td->print_struct = asn_DEF_SIGNED_16P1.print_struct; - td->ber_decoder = asn_DEF_SIGNED_16P1.ber_decoder; - td->der_encoder = asn_DEF_SIGNED_16P1.der_encoder; - td->xer_decoder = asn_DEF_SIGNED_16P1.xer_decoder; - td->xer_encoder = asn_DEF_SIGNED_16P1.xer_encoder; - td->uper_decoder = asn_DEF_SIGNED_16P1.uper_decoder; - td->uper_encoder = asn_DEF_SIGNED_16P1.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_SIGNED_16P1.per_constraints; - td->elements = asn_DEF_SIGNED_16P1.elements; - td->elements_count = asn_DEF_SIGNED_16P1.elements_count; - td->specifics = asn_DEF_SIGNED_16P1.specifics; -} - -void -SignedSET_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - SignedSET_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -SignedSET_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - SignedSET_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -SignedSET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - SignedSET_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -SignedSET_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - SignedSET_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -SignedSET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - SignedSET_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -SignedSET_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - SignedSET_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [SignedSET] >>> ***/ - -static ber_tlv_tag_t asn_DEF_SignedSET_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_SignedSET = { - "SignedSET", - "SignedSET", - SignedSET_free, - SignedSET_print, - SignedSET_constraint, - SignedSET_decode_ber, - SignedSET_encode_der, - SignedSET_decode_xer, - SignedSET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_SignedSET_tags_1, - sizeof(asn_DEF_SignedSET_tags_1) - /sizeof(asn_DEF_SignedSET_tags_1[0]), /* 1 */ - asn_DEF_SignedSET_tags_1, /* Same as above */ - sizeof(asn_DEF_SignedSET_tags_1) - /sizeof(asn_DEF_SignedSET_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ -}; - diff --git a/tests/105-param-2-OK.asn1.-Pfwide-types b/tests/105-param-2-OK.asn1.-Pfwide-types new file mode 100644 index 00000000..8a9b9f86 --- /dev/null +++ b/tests/105-param-2-OK.asn1.-Pfwide-types @@ -0,0 +1,453 @@ + +/*** <<< INCLUDES [SIGNED] >>> ***/ + +#include +#include +#include +#include + +/*** <<< DEPS [SIGNED] >>> ***/ + + +/* + * Method of determining the components presence + */ +typedef enum signed_PR { + signed_PR_a, /* Member a is present */ +} signed_PR; + +/*** <<< TYPE-DECLS [SIGNED] >>> ***/ + +typedef struct SIGNED_16P0 { + REAL_t Signed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SIGNED_16P0_t; +typedef struct SIGNED_16P1 { + struct Signed { + INTEGER_t a; + + /* Presence bitmask: ASN_SET_ISPRESENT(psigned, signed_PR_x) */ + unsigned int _presence_map + [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } Signed; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SIGNED_16P1_t; + +/*** <<< FUNC-DECLS [SIGNED] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_SIGNED_16P0; +extern asn_TYPE_descriptor_t asn_DEF_SIGNED_16P1; + +/*** <<< STAT-DEFS [SIGNED] >>> ***/ + +static asn_TYPE_member_t asn_MBR_SIGNED_16P0_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SIGNED_16P0, Signed), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), + .tag_mode = 0, + .type = &asn_DEF_REAL, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "signed" + }, +}; +static ber_tlv_tag_t asn_DEF_SIGNED_16P0_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SIGNED_16P0_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 0, 0, 0 } /* signed at 18 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_16P0_specs_1 = { + sizeof(struct SIGNED_16P0), + offsetof(struct SIGNED_16P0, _asn_ctx), + asn_MAP_SIGNED_16P0_tag2el_1, + 1, /* 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_SIGNED_16P0 = { + "SIGNED", + "SIGNED", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SIGNED_16P0_tags_1, + sizeof(asn_DEF_SIGNED_16P0_tags_1) + /sizeof(asn_DEF_SIGNED_16P0_tags_1[0]), /* 1 */ + asn_DEF_SIGNED_16P0_tags_1, /* Same as above */ + sizeof(asn_DEF_SIGNED_16P0_tags_1) + /sizeof(asn_DEF_SIGNED_16P0_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SIGNED_16P0_1, + 1, /* Elements count */ + &asn_SPC_SIGNED_16P0_specs_1 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_signed_4[] = { + { ATF_NOFLAGS, 0, offsetof(struct Signed, a), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "a" + }, +}; +static ber_tlv_tag_t asn_DEF_signed_tags_4[] = { + (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_signed_tag2el_4[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* a at 19 */ +}; +static uint8_t asn_MAP_signed_mmap_4[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { + (1 << 7) +}; +static asn_SET_specifics_t asn_SPC_signed_specs_4 = { + sizeof(struct Signed), + offsetof(struct Signed, _asn_ctx), + offsetof(struct Signed, _presence_map), + asn_MAP_signed_tag2el_4, + 1, /* Count of tags in the map */ + asn_MAP_signed_tag2el_4, /* Same as above */ + 1, /* Count of tags in the CXER map */ + 0, /* Whether extensible */ + (unsigned int *)asn_MAP_signed_mmap_4 /* Mandatory elements map */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_signed_4 = { + "signed", + "signed", + SET_free, + SET_print, + SET_constraint, + SET_decode_ber, + SET_encode_der, + SET_decode_xer, + SET_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_signed_tags_4, + sizeof(asn_DEF_signed_tags_4) + /sizeof(asn_DEF_signed_tags_4[0]), /* 1 */ + asn_DEF_signed_tags_4, /* Same as above */ + sizeof(asn_DEF_signed_tags_4) + /sizeof(asn_DEF_signed_tags_4[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_signed_4, + 1, /* Elements count */ + &asn_SPC_signed_specs_4 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_SIGNED_16P1_3[] = { + { ATF_NOFLAGS, 0, offsetof(struct SIGNED_16P1, Signed), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), + .tag_mode = 0, + .type = &asn_DEF_signed_4, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = 0, + .name = "signed" + }, +}; +static ber_tlv_tag_t asn_DEF_SIGNED_16P1_tags_3[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SIGNED_16P1_tag2el_3[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 } /* signed at 19 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_16P1_specs_3 = { + sizeof(struct SIGNED_16P1), + offsetof(struct SIGNED_16P1, _asn_ctx), + asn_MAP_SIGNED_16P1_tag2el_3, + 1, /* 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_SIGNED_16P1 = { + "SIGNED", + "SIGNED", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SIGNED_16P1_tags_3, + sizeof(asn_DEF_SIGNED_16P1_tags_3) + /sizeof(asn_DEF_SIGNED_16P1_tags_3[0]), /* 1 */ + asn_DEF_SIGNED_16P1_tags_3, /* Same as above */ + sizeof(asn_DEF_SIGNED_16P1_tags_3) + /sizeof(asn_DEF_SIGNED_16P1_tags_3[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SIGNED_16P1_3, + 1, /* Elements count */ + &asn_SPC_SIGNED_16P1_specs_3 /* Additional specs */ +}; + + +/*** <<< INCLUDES [SignedREAL] >>> ***/ + +#include "SIGNED.h" + +/*** <<< TYPE-DECLS [SignedREAL] >>> ***/ + +typedef SIGNED_16P0_t SignedREAL_t; + +/*** <<< FUNC-DECLS [SignedREAL] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_SignedREAL; +asn_struct_free_f SignedREAL_free; +asn_struct_print_f SignedREAL_print; +asn_constr_check_f SignedREAL_constraint; +ber_type_decoder_f SignedREAL_decode_ber; +der_type_encoder_f SignedREAL_encode_der; +xer_type_decoder_f SignedREAL_decode_xer; +xer_type_encoder_f SignedREAL_encode_xer; + +/*** <<< CODE [SignedREAL] >>> ***/ + +int +SignedREAL_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using SIGNED_16P0, + * so here we adjust the DEF accordingly. + */ +static void +SignedREAL_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_SIGNED_16P0.free_struct; + td->print_struct = asn_DEF_SIGNED_16P0.print_struct; + td->ber_decoder = asn_DEF_SIGNED_16P0.ber_decoder; + td->der_encoder = asn_DEF_SIGNED_16P0.der_encoder; + td->xer_decoder = asn_DEF_SIGNED_16P0.xer_decoder; + td->xer_encoder = asn_DEF_SIGNED_16P0.xer_encoder; + td->uper_decoder = asn_DEF_SIGNED_16P0.uper_decoder; + td->uper_encoder = asn_DEF_SIGNED_16P0.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_SIGNED_16P0.per_constraints; + td->elements = asn_DEF_SIGNED_16P0.elements; + td->elements_count = asn_DEF_SIGNED_16P0.elements_count; + td->specifics = asn_DEF_SIGNED_16P0.specifics; +} + +void +SignedREAL_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + SignedREAL_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +SignedREAL_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + SignedREAL_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +SignedREAL_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + SignedREAL_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +SignedREAL_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + SignedREAL_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +SignedREAL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + SignedREAL_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +SignedREAL_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + SignedREAL_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [SignedREAL] >>> ***/ + +static ber_tlv_tag_t asn_DEF_SignedREAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SignedREAL = { + "SignedREAL", + "SignedREAL", + SignedREAL_free, + SignedREAL_print, + SignedREAL_constraint, + SignedREAL_decode_ber, + SignedREAL_encode_der, + SignedREAL_decode_xer, + SignedREAL_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SignedREAL_tags_1, + sizeof(asn_DEF_SignedREAL_tags_1) + /sizeof(asn_DEF_SignedREAL_tags_1[0]), /* 1 */ + asn_DEF_SignedREAL_tags_1, /* Same as above */ + sizeof(asn_DEF_SignedREAL_tags_1) + /sizeof(asn_DEF_SignedREAL_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + + +/*** <<< INCLUDES [SignedSET] >>> ***/ + +#include "SIGNED.h" + +/*** <<< TYPE-DECLS [SignedSET] >>> ***/ + +typedef SIGNED_16P1_t SignedSET_t; + +/*** <<< FUNC-DECLS [SignedSET] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_SignedSET; +asn_struct_free_f SignedSET_free; +asn_struct_print_f SignedSET_print; +asn_constr_check_f SignedSET_constraint; +ber_type_decoder_f SignedSET_decode_ber; +der_type_encoder_f SignedSET_encode_der; +xer_type_decoder_f SignedSET_decode_xer; +xer_type_encoder_f SignedSET_encode_xer; + +/*** <<< CODE [SignedSET] >>> ***/ + +int +SignedSET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using SIGNED_16P1, + * so here we adjust the DEF accordingly. + */ +static void +SignedSET_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_SIGNED_16P1.free_struct; + td->print_struct = asn_DEF_SIGNED_16P1.print_struct; + td->ber_decoder = asn_DEF_SIGNED_16P1.ber_decoder; + td->der_encoder = asn_DEF_SIGNED_16P1.der_encoder; + td->xer_decoder = asn_DEF_SIGNED_16P1.xer_decoder; + td->xer_encoder = asn_DEF_SIGNED_16P1.xer_encoder; + td->uper_decoder = asn_DEF_SIGNED_16P1.uper_decoder; + td->uper_encoder = asn_DEF_SIGNED_16P1.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_SIGNED_16P1.per_constraints; + td->elements = asn_DEF_SIGNED_16P1.elements; + td->elements_count = asn_DEF_SIGNED_16P1.elements_count; + td->specifics = asn_DEF_SIGNED_16P1.specifics; +} + +void +SignedSET_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + SignedSET_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +SignedSET_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + SignedSET_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +SignedSET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + SignedSET_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +SignedSET_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + SignedSET_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +SignedSET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + SignedSET_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +SignedSET_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + SignedSET_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [SignedSET] >>> ***/ + +static ber_tlv_tag_t asn_DEF_SignedSET_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SignedSET = { + "SignedSET", + "SignedSET", + SignedSET_free, + SignedSET_print, + SignedSET_constraint, + SignedSET_decode_ber, + SignedSET_encode_der, + SignedSET_decode_xer, + SignedSET_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SignedSET_tags_1, + sizeof(asn_DEF_SignedSET_tags_1) + /sizeof(asn_DEF_SignedSET_tags_1[0]), /* 1 */ + asn_DEF_SignedSET_tags_1, /* Same as above */ + sizeof(asn_DEF_SignedSET_tags_1) + /sizeof(asn_DEF_SignedSET_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/tests/108-param-constr-3-OK.asn1.-P b/tests/108-param-constr-3-OK.asn1.-P deleted file mode 100644 index b0903001..00000000 --- a/tests/108-param-constr-3-OK.asn1.-P +++ /dev/null @@ -1,294 +0,0 @@ - -/*** <<< INCLUDES [MinMax] >>> ***/ - -#include - -/*** <<< TYPE-DECLS [MinMax] >>> ***/ - -typedef INTEGER_t MinMax_16P0_t; - -/*** <<< FUNC-DECLS [MinMax] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_MinMax_16P0; -asn_struct_free_f MinMax_16P0_free; -asn_struct_print_f MinMax_16P0_print; -asn_constr_check_f MinMax_16P0_constraint; -ber_type_decoder_f MinMax_16P0_decode_ber; -der_type_encoder_f MinMax_16P0_encode_der; -xer_type_decoder_f MinMax_16P0_decode_xer; -xer_type_encoder_f MinMax_16P0_encode_xer; - -/*** <<< CODE [MinMax] >>> ***/ - -int -MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { - const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - if(asn_INTEGER2long(st, &value)) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value too large (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - if((value >= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } -} - -/* - * This type is implemented using INTEGER, - * so here we adjust the DEF accordingly. - */ -static void -MinMax_16P0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_INTEGER.free_struct; - td->print_struct = asn_DEF_INTEGER.print_struct; - td->ber_decoder = asn_DEF_INTEGER.ber_decoder; - td->der_encoder = asn_DEF_INTEGER.der_encoder; - td->xer_decoder = asn_DEF_INTEGER.xer_decoder; - td->xer_encoder = asn_DEF_INTEGER.xer_encoder; - td->uper_decoder = asn_DEF_INTEGER.uper_decoder; - td->uper_encoder = asn_DEF_INTEGER.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_INTEGER.per_constraints; - td->elements = asn_DEF_INTEGER.elements; - td->elements_count = asn_DEF_INTEGER.elements_count; - td->specifics = asn_DEF_INTEGER.specifics; -} - -void -MinMax_16P0_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - MinMax_16P0_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -MinMax_16P0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - MinMax_16P0_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -MinMax_16P0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - MinMax_16P0_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -MinMax_16P0_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - MinMax_16P0_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -MinMax_16P0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - MinMax_16P0_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -MinMax_16P0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - MinMax_16P0_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [MinMax] >>> ***/ - -static ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_MinMax_16P0 = { - "MinMax", - "MinMax", - MinMax_16P0_free, - MinMax_16P0_print, - MinMax_16P0_constraint, - MinMax_16P0_decode_ber, - MinMax_16P0_encode_der, - MinMax_16P0_decode_xer, - MinMax_16P0_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_MinMax_16P0_tags_1, - sizeof(asn_DEF_MinMax_16P0_tags_1) - /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ - asn_DEF_MinMax_16P0_tags_1, /* Same as above */ - sizeof(asn_DEF_MinMax_16P0_tags_1) - /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ -}; - - -/*** <<< INCLUDES [ThreePlus] >>> ***/ - -#include "MinMax.h" - -/*** <<< TYPE-DECLS [ThreePlus] >>> ***/ - -typedef MinMax_16P0_t ThreePlus_t; - -/*** <<< FUNC-DECLS [ThreePlus] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_ThreePlus; -asn_struct_free_f ThreePlus_free; -asn_struct_print_f ThreePlus_print; -asn_constr_check_f ThreePlus_constraint; -ber_type_decoder_f ThreePlus_decode_ber; -der_type_encoder_f ThreePlus_encode_der; -xer_type_decoder_f ThreePlus_decode_xer; -xer_type_encoder_f ThreePlus_encode_xer; - -/*** <<< CODE [ThreePlus] >>> ***/ - -int -ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { - const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr; - long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - if(asn_INTEGER2long(st, &value)) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value too large (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - if((value >= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } -} - -/* - * This type is implemented using MinMax_16P0, - * so here we adjust the DEF accordingly. - */ -static void -ThreePlus_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_MinMax_16P0.free_struct; - td->print_struct = asn_DEF_MinMax_16P0.print_struct; - td->ber_decoder = asn_DEF_MinMax_16P0.ber_decoder; - td->der_encoder = asn_DEF_MinMax_16P0.der_encoder; - td->xer_decoder = asn_DEF_MinMax_16P0.xer_decoder; - td->xer_encoder = asn_DEF_MinMax_16P0.xer_encoder; - td->uper_decoder = asn_DEF_MinMax_16P0.uper_decoder; - td->uper_encoder = asn_DEF_MinMax_16P0.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_MinMax_16P0.per_constraints; - td->elements = asn_DEF_MinMax_16P0.elements; - td->elements_count = asn_DEF_MinMax_16P0.elements_count; - td->specifics = asn_DEF_MinMax_16P0.specifics; -} - -void -ThreePlus_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - ThreePlus_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -ThreePlus_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - ThreePlus_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -ThreePlus_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - ThreePlus_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -ThreePlus_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - ThreePlus_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -ThreePlus_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - ThreePlus_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -ThreePlus_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - ThreePlus_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [ThreePlus] >>> ***/ - -static ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_ThreePlus = { - "ThreePlus", - "ThreePlus", - ThreePlus_free, - ThreePlus_print, - ThreePlus_constraint, - ThreePlus_decode_ber, - ThreePlus_encode_der, - ThreePlus_decode_xer, - ThreePlus_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_ThreePlus_tags_1, - sizeof(asn_DEF_ThreePlus_tags_1) - /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ - asn_DEF_ThreePlus_tags_1, /* Same as above */ - sizeof(asn_DEF_ThreePlus_tags_1) - /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ -}; - diff --git a/tests/108-param-constr-3-OK.asn1.-Pfwide-types b/tests/108-param-constr-3-OK.asn1.-Pfwide-types new file mode 100644 index 00000000..b0903001 --- /dev/null +++ b/tests/108-param-constr-3-OK.asn1.-Pfwide-types @@ -0,0 +1,294 @@ + +/*** <<< INCLUDES [MinMax] >>> ***/ + +#include + +/*** <<< TYPE-DECLS [MinMax] >>> ***/ + +typedef INTEGER_t MinMax_16P0_t; + +/*** <<< FUNC-DECLS [MinMax] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_MinMax_16P0; +asn_struct_free_f MinMax_16P0_free; +asn_struct_print_f MinMax_16P0_print; +asn_constr_check_f MinMax_16P0_constraint; +ber_type_decoder_f MinMax_16P0_decode_ber; +der_type_encoder_f MinMax_16P0_encode_der; +xer_type_decoder_f MinMax_16P0_decode_xer; +xer_type_encoder_f MinMax_16P0_encode_xer; + +/*** <<< CODE [MinMax] >>> ***/ + +int +MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(asn_INTEGER2long(st, &value)) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value too large (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if((value >= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +MinMax_16P0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->uper_decoder = asn_DEF_INTEGER.uper_decoder; + td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_INTEGER.per_constraints; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +MinMax_16P0_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + MinMax_16P0_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +MinMax_16P0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + MinMax_16P0_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +MinMax_16P0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + MinMax_16P0_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +MinMax_16P0_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + MinMax_16P0_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +MinMax_16P0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + MinMax_16P0_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +MinMax_16P0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + MinMax_16P0_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [MinMax] >>> ***/ + +static ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_MinMax_16P0 = { + "MinMax", + "MinMax", + MinMax_16P0_free, + MinMax_16P0_print, + MinMax_16P0_constraint, + MinMax_16P0_decode_ber, + MinMax_16P0_encode_der, + MinMax_16P0_decode_xer, + MinMax_16P0_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MinMax_16P0_tags_1, + sizeof(asn_DEF_MinMax_16P0_tags_1) + /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ + asn_DEF_MinMax_16P0_tags_1, /* Same as above */ + sizeof(asn_DEF_MinMax_16P0_tags_1) + /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + + +/*** <<< INCLUDES [ThreePlus] >>> ***/ + +#include "MinMax.h" + +/*** <<< TYPE-DECLS [ThreePlus] >>> ***/ + +typedef MinMax_16P0_t ThreePlus_t; + +/*** <<< FUNC-DECLS [ThreePlus] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_ThreePlus; +asn_struct_free_f ThreePlus_free; +asn_struct_print_f ThreePlus_print; +asn_constr_check_f ThreePlus_constraint; +ber_type_decoder_f ThreePlus_decode_ber; +der_type_encoder_f ThreePlus_encode_der; +xer_type_decoder_f ThreePlus_decode_xer; +xer_type_encoder_f ThreePlus_encode_xer; + +/*** <<< CODE [ThreePlus] >>> ***/ + +int +ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr; + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(asn_INTEGER2long(st, &value)) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value too large (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if((value >= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using MinMax_16P0, + * so here we adjust the DEF accordingly. + */ +static void +ThreePlus_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_MinMax_16P0.free_struct; + td->print_struct = asn_DEF_MinMax_16P0.print_struct; + td->ber_decoder = asn_DEF_MinMax_16P0.ber_decoder; + td->der_encoder = asn_DEF_MinMax_16P0.der_encoder; + td->xer_decoder = asn_DEF_MinMax_16P0.xer_decoder; + td->xer_encoder = asn_DEF_MinMax_16P0.xer_encoder; + td->uper_decoder = asn_DEF_MinMax_16P0.uper_decoder; + td->uper_encoder = asn_DEF_MinMax_16P0.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_MinMax_16P0.per_constraints; + td->elements = asn_DEF_MinMax_16P0.elements; + td->elements_count = asn_DEF_MinMax_16P0.elements_count; + td->specifics = asn_DEF_MinMax_16P0.specifics; +} + +void +ThreePlus_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ThreePlus_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ThreePlus_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ThreePlus_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ThreePlus_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ThreePlus_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ThreePlus_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ThreePlus_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ThreePlus_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ThreePlus_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ThreePlus_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ThreePlus_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [ThreePlus] >>> ***/ + +static ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ThreePlus = { + "ThreePlus", + "ThreePlus", + ThreePlus_free, + ThreePlus_print, + ThreePlus_constraint, + ThreePlus_decode_ber, + ThreePlus_encode_der, + ThreePlus_decode_xer, + ThreePlus_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ThreePlus_tags_1, + sizeof(asn_DEF_ThreePlus_tags_1) + /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ + asn_DEF_ThreePlus_tags_1, /* Same as above */ + sizeof(asn_DEF_ThreePlus_tags_1) + /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/tests/110-param-3-OK.asn1.-P b/tests/110-param-3-OK.asn1.-P deleted file mode 100644 index 9bd39a9b..00000000 --- a/tests/110-param-3-OK.asn1.-P +++ /dev/null @@ -1,553 +0,0 @@ - -/*** <<< INCLUDES [Flag] >>> ***/ - -#include -#include -#include - -/*** <<< DEPS [Flag] >>> ***/ - -typedef enum field { - field_red = 0, - field_green = 1, - field_blue = 5 -} e_field; -typedef enum field { - field_red = 3, - field_green = 4, - field_blue = 5 -} e_field; - -/*** <<< TYPE-DECLS [Flag] >>> ***/ - -typedef struct Flag_16P0 { - INTEGER_t *field /* DEFAULT 5 */; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Flag_16P0_t; -typedef struct Flag_16P1 { - ENUMERATED_t *field /* DEFAULT 5 */; - - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; -} Flag_16P1_t; - -/*** <<< FUNC-DECLS [Flag] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_Flag_16P0; -/* extern asn_TYPE_descriptor_t asn_DEF_field_7; // (Use -fall-defs-global to expose) */ -extern asn_TYPE_descriptor_t asn_DEF_Flag_16P1; - -/*** <<< CODE [Flag] >>> ***/ - -static int -field_7_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using ENUMERATED, - * so here we adjust the DEF accordingly. - */ -static void -field_7_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; - td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ -} - -static void -field_7_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - field_7_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -static int -field_7_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - field_7_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -static asn_dec_rval_t -field_7_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - field_7_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -static asn_enc_rval_t -field_7_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - field_7_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -static asn_dec_rval_t -field_7_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - field_7_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -static asn_enc_rval_t -field_7_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - field_7_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [Flag] >>> ***/ - -static int asn_DFL_2_set_5(int set_value, void **sptr) { - INTEGER_t *st = *sptr; - - if(!st) { - if(!set_value) return -1; /* Not a default value */ - st = (*sptr = CALLOC(1, sizeof(*st))); - if(!st) return -1; - } - - if(set_value) { - /* Install default value 5 */ - return asn_long2INTEGER(st, 5); - } else { - /* Test default value 5 */ - long value; - if(asn_INTEGER2long(st, &value)) - return -1; - return (value == 5); - } -} -static asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = { - { ATF_POINTER, 1, offsetof(struct Flag_16P0, field), - .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), - .tag_mode = 0, - .type = &asn_DEF_INTEGER, - .memb_constraints = 0, /* Defer constraints checking to the member type */ - .per_constraints = 0, /* PER is not compiled, use -gen-PER */ - .default_value = asn_DFL_2_set_5, /* DEFAULT 5 */ - .name = "field" - }, -}; -static ber_tlv_tag_t asn_DEF_Flag_16P0_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_TYPE_tag2member_t asn_MAP_Flag_16P0_tag2el_1[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field at 18 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1 = { - sizeof(struct Flag_16P0), - offsetof(struct Flag_16P0, _asn_ctx), - asn_MAP_Flag_16P0_tag2el_1, - 1, /* 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_Flag_16P0 = { - "Flag", - "Flag", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Flag_16P0_tags_1, - sizeof(asn_DEF_Flag_16P0_tags_1) - /sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ - asn_DEF_Flag_16P0_tags_1, /* Same as above */ - sizeof(asn_DEF_Flag_16P0_tags_1) - /sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_Flag_16P0_1, - 1, /* Elements count */ - &asn_SPC_Flag_16P0_specs_1 /* Additional specs */ -}; - -static int asn_DFL_7_set_5(int set_value, void **sptr) { - ENUMERATED_t *st = *sptr; - - if(!st) { - if(!set_value) return -1; /* Not a default value */ - st = (*sptr = CALLOC(1, sizeof(*st))); - if(!st) return -1; - } - - if(set_value) { - /* Install default value 5 */ - return asn_long2INTEGER(st, 5); - } else { - /* Test default value 5 */ - long value; - if(asn_INTEGER2long(st, &value)) - return -1; - return (value == 5); - } -} -static asn_INTEGER_enum_map_t asn_MAP_field_value2enum_7[] = { - { 3, 3, "red" }, - { 4, 5, "green" }, - { 5, 4, "blue" } -}; -static unsigned int asn_MAP_field_enum2value_7[] = { - 2, /* blue(5) */ - 1, /* green(4) */ - 0 /* red(3) */ -}; -static asn_INTEGER_specifics_t asn_SPC_field_specs_7 = { - asn_MAP_field_value2enum_7, /* "tag" => N; sorted by tag */ - asn_MAP_field_enum2value_7, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; -static ber_tlv_tag_t asn_DEF_field_tags_7[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; -static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_field_7 = { - "field", - "field", - field_7_free, - field_7_print, - field_7_constraint, - field_7_decode_ber, - field_7_encode_der, - field_7_decode_xer, - field_7_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_field_tags_7, - sizeof(asn_DEF_field_tags_7) - /sizeof(asn_DEF_field_tags_7[0]), /* 1 */ - asn_DEF_field_tags_7, /* Same as above */ - sizeof(asn_DEF_field_tags_7) - /sizeof(asn_DEF_field_tags_7[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - &asn_SPC_field_specs_7 /* Additional specs */ -}; - -static asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = { - { ATF_POINTER, 1, offsetof(struct Flag_16P1, field), - .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), - .tag_mode = 0, - .type = &asn_DEF_field_7, - .memb_constraints = 0, /* Defer constraints checking to the member type */ - .per_constraints = 0, /* PER is not compiled, use -gen-PER */ - .default_value = asn_DFL_7_set_5, /* DEFAULT 5 */ - .name = "field" - }, -}; -static ber_tlv_tag_t asn_DEF_Flag_16P1_tags_6[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_TYPE_tag2member_t asn_MAP_Flag_16P1_tag2el_6[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field at 19 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6 = { - sizeof(struct Flag_16P1), - offsetof(struct Flag_16P1, _asn_ctx), - asn_MAP_Flag_16P1_tag2el_6, - 1, /* 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_Flag_16P1 = { - "Flag", - "Flag", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_Flag_16P1_tags_6, - sizeof(asn_DEF_Flag_16P1_tags_6) - /sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ - asn_DEF_Flag_16P1_tags_6, /* Same as above */ - sizeof(asn_DEF_Flag_16P1_tags_6) - /sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_Flag_16P1_6, - 1, /* Elements count */ - &asn_SPC_Flag_16P1_specs_6 /* Additional specs */ -}; - - -/*** <<< INCLUDES [IntegerColorFlag] >>> ***/ - -#include "Flag.h" - -/*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/ - -typedef Flag_16P0_t IntegerColorFlag_t; - -/*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag; -asn_struct_free_f IntegerColorFlag_free; -asn_struct_print_f IntegerColorFlag_print; -asn_constr_check_f IntegerColorFlag_constraint; -ber_type_decoder_f IntegerColorFlag_decode_ber; -der_type_encoder_f IntegerColorFlag_encode_der; -xer_type_decoder_f IntegerColorFlag_decode_xer; -xer_type_encoder_f IntegerColorFlag_encode_xer; - -/*** <<< CODE [IntegerColorFlag] >>> ***/ - -int -IntegerColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using Flag_16P0, - * so here we adjust the DEF accordingly. - */ -static void -IntegerColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_Flag_16P0.free_struct; - td->print_struct = asn_DEF_Flag_16P0.print_struct; - td->ber_decoder = asn_DEF_Flag_16P0.ber_decoder; - td->der_encoder = asn_DEF_Flag_16P0.der_encoder; - td->xer_decoder = asn_DEF_Flag_16P0.xer_decoder; - td->xer_encoder = asn_DEF_Flag_16P0.xer_encoder; - td->uper_decoder = asn_DEF_Flag_16P0.uper_decoder; - td->uper_encoder = asn_DEF_Flag_16P0.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_Flag_16P0.per_constraints; - td->elements = asn_DEF_Flag_16P0.elements; - td->elements_count = asn_DEF_Flag_16P0.elements_count; - td->specifics = asn_DEF_Flag_16P0.specifics; -} - -void -IntegerColorFlag_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - IntegerColorFlag_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -IntegerColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - IntegerColorFlag_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -IntegerColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - IntegerColorFlag_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -IntegerColorFlag_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - IntegerColorFlag_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -IntegerColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - IntegerColorFlag_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -IntegerColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - IntegerColorFlag_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [IntegerColorFlag] >>> ***/ - -static ber_tlv_tag_t asn_DEF_IntegerColorFlag_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = { - "IntegerColorFlag", - "IntegerColorFlag", - IntegerColorFlag_free, - IntegerColorFlag_print, - IntegerColorFlag_constraint, - IntegerColorFlag_decode_ber, - IntegerColorFlag_encode_der, - IntegerColorFlag_decode_xer, - IntegerColorFlag_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_IntegerColorFlag_tags_1, - sizeof(asn_DEF_IntegerColorFlag_tags_1) - /sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */ - asn_DEF_IntegerColorFlag_tags_1, /* Same as above */ - sizeof(asn_DEF_IntegerColorFlag_tags_1) - /sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ -}; - - -/*** <<< INCLUDES [EnumeratedColorFlag] >>> ***/ - -#include "Flag.h" - -/*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/ - -typedef Flag_16P1_t EnumeratedColorFlag_t; - -/*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/ - -extern asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag; -asn_struct_free_f EnumeratedColorFlag_free; -asn_struct_print_f EnumeratedColorFlag_print; -asn_constr_check_f EnumeratedColorFlag_constraint; -ber_type_decoder_f EnumeratedColorFlag_decode_ber; -der_type_encoder_f EnumeratedColorFlag_encode_der; -xer_type_decoder_f EnumeratedColorFlag_decode_xer; -xer_type_encoder_f EnumeratedColorFlag_encode_xer; - -/*** <<< CODE [EnumeratedColorFlag] >>> ***/ - -int -EnumeratedColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - 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, ctfailcb, app_key); -} - -/* - * This type is implemented using Flag_16P1, - * so here we adjust the DEF accordingly. - */ -static void -EnumeratedColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_Flag_16P1.free_struct; - td->print_struct = asn_DEF_Flag_16P1.print_struct; - td->ber_decoder = asn_DEF_Flag_16P1.ber_decoder; - td->der_encoder = asn_DEF_Flag_16P1.der_encoder; - td->xer_decoder = asn_DEF_Flag_16P1.xer_decoder; - td->xer_encoder = asn_DEF_Flag_16P1.xer_encoder; - td->uper_decoder = asn_DEF_Flag_16P1.uper_decoder; - td->uper_encoder = asn_DEF_Flag_16P1.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_Flag_16P1.per_constraints; - td->elements = asn_DEF_Flag_16P1.elements; - td->elements_count = asn_DEF_Flag_16P1.elements_count; - td->specifics = asn_DEF_Flag_16P1.specifics; -} - -void -EnumeratedColorFlag_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { - EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); - td->free_struct(td, struct_ptr, contents_only); -} - -int -EnumeratedColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { - EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); - return td->print_struct(td, struct_ptr, ilevel, cb, app_key); -} - -asn_dec_rval_t -EnumeratedColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { - EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); -} - -asn_enc_rval_t -EnumeratedColorFlag_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); - return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); -} - -asn_dec_rval_t -EnumeratedColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { - EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); -} - -asn_enc_rval_t -EnumeratedColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); - return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); -} - - -/*** <<< STAT-DEFS [EnumeratedColorFlag] >>> ***/ - -static ber_tlv_tag_t asn_DEF_EnumeratedColorFlag_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = { - "EnumeratedColorFlag", - "EnumeratedColorFlag", - EnumeratedColorFlag_free, - EnumeratedColorFlag_print, - EnumeratedColorFlag_constraint, - EnumeratedColorFlag_decode_ber, - EnumeratedColorFlag_encode_der, - EnumeratedColorFlag_decode_xer, - EnumeratedColorFlag_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ - 0, /* Use generic outmost tag fetcher */ - asn_DEF_EnumeratedColorFlag_tags_1, - sizeof(asn_DEF_EnumeratedColorFlag_tags_1) - /sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */ - asn_DEF_EnumeratedColorFlag_tags_1, /* Same as above */ - sizeof(asn_DEF_EnumeratedColorFlag_tags_1) - /sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ -}; - diff --git a/tests/110-param-3-OK.asn1.-Pfwide-types b/tests/110-param-3-OK.asn1.-Pfwide-types new file mode 100644 index 00000000..9bd39a9b --- /dev/null +++ b/tests/110-param-3-OK.asn1.-Pfwide-types @@ -0,0 +1,553 @@ + +/*** <<< INCLUDES [Flag] >>> ***/ + +#include +#include +#include + +/*** <<< DEPS [Flag] >>> ***/ + +typedef enum field { + field_red = 0, + field_green = 1, + field_blue = 5 +} e_field; +typedef enum field { + field_red = 3, + field_green = 4, + field_blue = 5 +} e_field; + +/*** <<< TYPE-DECLS [Flag] >>> ***/ + +typedef struct Flag_16P0 { + INTEGER_t *field /* DEFAULT 5 */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Flag_16P0_t; +typedef struct Flag_16P1 { + ENUMERATED_t *field /* DEFAULT 5 */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Flag_16P1_t; + +/*** <<< FUNC-DECLS [Flag] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_Flag_16P0; +/* extern asn_TYPE_descriptor_t asn_DEF_field_7; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_Flag_16P1; + +/*** <<< CODE [Flag] >>> ***/ + +static int +field_7_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +field_7_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +static void +field_7_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + field_7_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +field_7_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + field_7_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +field_7_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + field_7_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +field_7_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + field_7_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +field_7_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + field_7_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +field_7_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + field_7_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [Flag] >>> ***/ + +static int asn_DFL_2_set_5(int set_value, void **sptr) { + INTEGER_t *st = *sptr; + + if(!st) { + if(!set_value) return -1; /* Not a default value */ + st = (*sptr = CALLOC(1, sizeof(*st))); + if(!st) return -1; + } + + if(set_value) { + /* Install default value 5 */ + return asn_long2INTEGER(st, 5); + } else { + /* Test default value 5 */ + long value; + if(asn_INTEGER2long(st, &value)) + return -1; + return (value == 5); + } +} +static asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = { + { ATF_POINTER, 1, offsetof(struct Flag_16P0, field), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + .tag_mode = 0, + .type = &asn_DEF_INTEGER, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = asn_DFL_2_set_5, /* DEFAULT 5 */ + .name = "field" + }, +}; +static ber_tlv_tag_t asn_DEF_Flag_16P0_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Flag_16P0_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field at 18 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1 = { + sizeof(struct Flag_16P0), + offsetof(struct Flag_16P0, _asn_ctx), + asn_MAP_Flag_16P0_tag2el_1, + 1, /* 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_Flag_16P0 = { + "Flag", + "Flag", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Flag_16P0_tags_1, + sizeof(asn_DEF_Flag_16P0_tags_1) + /sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ + asn_DEF_Flag_16P0_tags_1, /* Same as above */ + sizeof(asn_DEF_Flag_16P0_tags_1) + /sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Flag_16P0_1, + 1, /* Elements count */ + &asn_SPC_Flag_16P0_specs_1 /* Additional specs */ +}; + +static int asn_DFL_7_set_5(int set_value, void **sptr) { + ENUMERATED_t *st = *sptr; + + if(!st) { + if(!set_value) return -1; /* Not a default value */ + st = (*sptr = CALLOC(1, sizeof(*st))); + if(!st) return -1; + } + + if(set_value) { + /* Install default value 5 */ + return asn_long2INTEGER(st, 5); + } else { + /* Test default value 5 */ + long value; + if(asn_INTEGER2long(st, &value)) + return -1; + return (value == 5); + } +} +static asn_INTEGER_enum_map_t asn_MAP_field_value2enum_7[] = { + { 3, 3, "red" }, + { 4, 5, "green" }, + { 5, 4, "blue" } +}; +static unsigned int asn_MAP_field_enum2value_7[] = { + 2, /* blue(5) */ + 1, /* green(4) */ + 0 /* red(3) */ +}; +static asn_INTEGER_specifics_t asn_SPC_field_specs_7 = { + asn_MAP_field_value2enum_7, /* "tag" => N; sorted by tag */ + asn_MAP_field_enum2value_7, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_field_tags_7[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_field_7 = { + "field", + "field", + field_7_free, + field_7_print, + field_7_constraint, + field_7_decode_ber, + field_7_encode_der, + field_7_decode_xer, + field_7_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_field_tags_7, + sizeof(asn_DEF_field_tags_7) + /sizeof(asn_DEF_field_tags_7[0]), /* 1 */ + asn_DEF_field_tags_7, /* Same as above */ + sizeof(asn_DEF_field_tags_7) + /sizeof(asn_DEF_field_tags_7[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_field_specs_7 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = { + { ATF_POINTER, 1, offsetof(struct Flag_16P1, field), + .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + .tag_mode = 0, + .type = &asn_DEF_field_7, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* PER is not compiled, use -gen-PER */ + .default_value = asn_DFL_7_set_5, /* DEFAULT 5 */ + .name = "field" + }, +}; +static ber_tlv_tag_t asn_DEF_Flag_16P1_tags_6[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Flag_16P1_tag2el_6[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field at 19 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6 = { + sizeof(struct Flag_16P1), + offsetof(struct Flag_16P1, _asn_ctx), + asn_MAP_Flag_16P1_tag2el_6, + 1, /* 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_Flag_16P1 = { + "Flag", + "Flag", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Flag_16P1_tags_6, + sizeof(asn_DEF_Flag_16P1_tags_6) + /sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ + asn_DEF_Flag_16P1_tags_6, /* Same as above */ + sizeof(asn_DEF_Flag_16P1_tags_6) + /sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Flag_16P1_6, + 1, /* Elements count */ + &asn_SPC_Flag_16P1_specs_6 /* Additional specs */ +}; + + +/*** <<< INCLUDES [IntegerColorFlag] >>> ***/ + +#include "Flag.h" + +/*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/ + +typedef Flag_16P0_t IntegerColorFlag_t; + +/*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag; +asn_struct_free_f IntegerColorFlag_free; +asn_struct_print_f IntegerColorFlag_print; +asn_constr_check_f IntegerColorFlag_constraint; +ber_type_decoder_f IntegerColorFlag_decode_ber; +der_type_encoder_f IntegerColorFlag_encode_der; +xer_type_decoder_f IntegerColorFlag_decode_xer; +xer_type_encoder_f IntegerColorFlag_encode_xer; + +/*** <<< CODE [IntegerColorFlag] >>> ***/ + +int +IntegerColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using Flag_16P0, + * so here we adjust the DEF accordingly. + */ +static void +IntegerColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_Flag_16P0.free_struct; + td->print_struct = asn_DEF_Flag_16P0.print_struct; + td->ber_decoder = asn_DEF_Flag_16P0.ber_decoder; + td->der_encoder = asn_DEF_Flag_16P0.der_encoder; + td->xer_decoder = asn_DEF_Flag_16P0.xer_decoder; + td->xer_encoder = asn_DEF_Flag_16P0.xer_encoder; + td->uper_decoder = asn_DEF_Flag_16P0.uper_decoder; + td->uper_encoder = asn_DEF_Flag_16P0.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_Flag_16P0.per_constraints; + td->elements = asn_DEF_Flag_16P0.elements; + td->elements_count = asn_DEF_Flag_16P0.elements_count; + td->specifics = asn_DEF_Flag_16P0.specifics; +} + +void +IntegerColorFlag_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + IntegerColorFlag_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +IntegerColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + IntegerColorFlag_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +IntegerColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + IntegerColorFlag_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +IntegerColorFlag_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + IntegerColorFlag_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +IntegerColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + IntegerColorFlag_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +IntegerColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + IntegerColorFlag_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [IntegerColorFlag] >>> ***/ + +static ber_tlv_tag_t asn_DEF_IntegerColorFlag_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = { + "IntegerColorFlag", + "IntegerColorFlag", + IntegerColorFlag_free, + IntegerColorFlag_print, + IntegerColorFlag_constraint, + IntegerColorFlag_decode_ber, + IntegerColorFlag_encode_der, + IntegerColorFlag_decode_xer, + IntegerColorFlag_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_IntegerColorFlag_tags_1, + sizeof(asn_DEF_IntegerColorFlag_tags_1) + /sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */ + asn_DEF_IntegerColorFlag_tags_1, /* Same as above */ + sizeof(asn_DEF_IntegerColorFlag_tags_1) + /sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + + +/*** <<< INCLUDES [EnumeratedColorFlag] >>> ***/ + +#include "Flag.h" + +/*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/ + +typedef Flag_16P1_t EnumeratedColorFlag_t; + +/*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag; +asn_struct_free_f EnumeratedColorFlag_free; +asn_struct_print_f EnumeratedColorFlag_print; +asn_constr_check_f EnumeratedColorFlag_constraint; +ber_type_decoder_f EnumeratedColorFlag_decode_ber; +der_type_encoder_f EnumeratedColorFlag_encode_der; +xer_type_decoder_f EnumeratedColorFlag_decode_xer; +xer_type_encoder_f EnumeratedColorFlag_encode_xer; + +/*** <<< CODE [EnumeratedColorFlag] >>> ***/ + +int +EnumeratedColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + 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, ctfailcb, app_key); +} + +/* + * This type is implemented using Flag_16P1, + * so here we adjust the DEF accordingly. + */ +static void +EnumeratedColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_Flag_16P1.free_struct; + td->print_struct = asn_DEF_Flag_16P1.print_struct; + td->ber_decoder = asn_DEF_Flag_16P1.ber_decoder; + td->der_encoder = asn_DEF_Flag_16P1.der_encoder; + td->xer_decoder = asn_DEF_Flag_16P1.xer_decoder; + td->xer_encoder = asn_DEF_Flag_16P1.xer_encoder; + td->uper_decoder = asn_DEF_Flag_16P1.uper_decoder; + td->uper_encoder = asn_DEF_Flag_16P1.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_Flag_16P1.per_constraints; + td->elements = asn_DEF_Flag_16P1.elements; + td->elements_count = asn_DEF_Flag_16P1.elements_count; + td->specifics = asn_DEF_Flag_16P1.specifics; +} + +void +EnumeratedColorFlag_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +EnumeratedColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +EnumeratedColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +EnumeratedColorFlag_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +EnumeratedColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +EnumeratedColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + + +/*** <<< STAT-DEFS [EnumeratedColorFlag] >>> ***/ + +static ber_tlv_tag_t asn_DEF_EnumeratedColorFlag_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = { + "EnumeratedColorFlag", + "EnumeratedColorFlag", + EnumeratedColorFlag_free, + EnumeratedColorFlag_print, + EnumeratedColorFlag_constraint, + EnumeratedColorFlag_decode_ber, + EnumeratedColorFlag_encode_der, + EnumeratedColorFlag_decode_xer, + EnumeratedColorFlag_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EnumeratedColorFlag_tags_1, + sizeof(asn_DEF_EnumeratedColorFlag_tags_1) + /sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */ + asn_DEF_EnumeratedColorFlag_tags_1, /* Same as above */ + sizeof(asn_DEF_EnumeratedColorFlag_tags_1) + /sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/tests/119-per-strings-OK.asn1.-Pgen-PER b/tests/119-per-strings-OK.asn1.-Pgen-PER index 3a24fda9..d21d818d 100644 --- a/tests/119-per-strings-OK.asn1.-Pgen-PER +++ b/tests/119-per-strings-OK.asn1.-Pgen-PER @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -55,7 +55,7 @@ typedef struct PDU { UniversalString_t *us_cs /* OPTIONAL */; UniversalString_t *us_ce /* OPTIONAL */; UniversalString_t *us_ir /* OPTIONAL */; - REAL_t *real /* OPTIONAL */; + double *real /* OPTIONAL */; OBJECT_IDENTIFIER_t *oid /* OPTIONAL */; /* Context for parsing across buffer boundaries */ @@ -1492,7 +1492,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = { { ATF_POINTER, 2, offsetof(struct PDU, real), .tag = (ASN_TAG_CLASS_CONTEXT | (29 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ - .type = &asn_DEF_REAL, + .type = &asn_DEF_NativeReal, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, diff --git a/tests/125-bitstring-constraint-OK.asn1.-X b/tests/125-bitstring-constraint-OK.asn1.-X index 64a21c41..2cccb90b 100644 --- a/tests/125-bitstring-constraint-OK.asn1.-X +++ b/tests/125-bitstring-constraint-OK.asn1.-X @@ -1,4 +1,4 @@ - +