diff options
Diffstat (limited to 'tests/110-param-3-OK.asn1.-P')
-rw-r--r-- | tests/110-param-3-OK.asn1.-P | 530 |
1 files changed, 530 insertions, 0 deletions
diff --git a/tests/110-param-3-OK.asn1.-P b/tests/110-param-3-OK.asn1.-P new file mode 100644 index 00000000..37ab930e --- /dev/null +++ b/tests/110-param-3-OK.asn1.-P @@ -0,0 +1,530 @@ + +/*** <<< INCLUDES [Flag] >>> ***/ + +#include <INTEGER.h> +#include <constr_SEQUENCE.h> +#include <ENUMERATED.h> + +/*** <<< 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_consume_bytes_f *app_errlog, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * 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; + 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(void **sptr) { + INTEGER_t *st = *sptr; + + if(!st) { + st = (*sptr = CALLOC(1, sizeof(*st))); + if(!st) return -1; + } + + /* Install default value 5 */ + return asn_long2INTEGER(st, 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, /* No PER decoder, -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(void **sptr) { + ENUMERATED_t *st = *sptr; + + if(!st) { + st = (*sptr = CALLOC(1, sizeof(*st))); + if(!st) return -1; + } + + /* Install default value 5 */ + return asn_long2INTEGER(st, 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 */ +}; +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, /* No PER decoder, -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, /* No PER decoder, -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_consume_bytes_f *app_errlog, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_Flag_16P0.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * 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; + 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, /* No PER decoder, -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_consume_bytes_f *app_errlog, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_Flag_16P1.check_constraints; + return td->check_constraints(td, sptr, app_errlog, app_key); +} + +/* + * 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; + 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, /* No PER decoder, -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 */ +}; + |