| 1 |
|
| 2 |
/*** <<< INCLUDES [T] >>> ***/ |
| 3 |
|
| 4 |
#include <INTEGER.h> |
| 5 |
|
| 6 |
/*** <<< DEPS [T] >>> ***/ |
| 7 |
|
| 8 |
typedef enum T { |
| 9 |
T_a = 1, |
| 10 |
T_b = 2 |
| 11 |
} e_T; |
| 12 |
|
| 13 |
/*** <<< TYPE-DECLS [T] >>> ***/ |
| 14 |
|
| 15 |
typedef INTEGER_t T_t; |
| 16 |
|
| 17 |
/*** <<< FUNC-DECLS [T] >>> ***/ |
| 18 |
|
| 19 |
extern asn_TYPE_descriptor_t asn_DEF_T; |
| 20 |
asn_struct_free_f T_free; |
| 21 |
asn_struct_print_f T_print; |
| 22 |
asn_constr_check_f T_constraint; |
| 23 |
ber_type_decoder_f T_decode_ber; |
| 24 |
der_type_encoder_f T_encode_der; |
| 25 |
xer_type_decoder_f T_decode_xer; |
| 26 |
xer_type_encoder_f T_encode_xer; |
| 27 |
|
| 28 |
/*** <<< CODE [T] >>> ***/ |
| 29 |
|
| 30 |
int |
| 31 |
T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 32 |
asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
| 33 |
/* Replace with underlying type checker */ |
| 34 |
td->check_constraints = asn_DEF_INTEGER.check_constraints; |
| 35 |
return td->check_constraints(td, sptr, ctfailcb, app_key); |
| 36 |
} |
| 37 |
|
| 38 |
/* |
| 39 |
* This type is implemented using INTEGER, |
| 40 |
* so here we adjust the DEF accordingly. |
| 41 |
*/ |
| 42 |
static void |
| 43 |
T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 44 |
td->free_struct = asn_DEF_INTEGER.free_struct; |
| 45 |
td->print_struct = asn_DEF_INTEGER.print_struct; |
| 46 |
td->check_constraints = asn_DEF_INTEGER.check_constraints; |
| 47 |
td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 48 |
td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 49 |
td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 50 |
td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
| 51 |
td->uper_decoder = asn_DEF_INTEGER.uper_decoder; |
| 52 |
td->uper_encoder = asn_DEF_INTEGER.uper_encoder; |
| 53 |
if(!td->per_constraints) |
| 54 |
td->per_constraints = asn_DEF_INTEGER.per_constraints; |
| 55 |
td->elements = asn_DEF_INTEGER.elements; |
| 56 |
td->elements_count = asn_DEF_INTEGER.elements_count; |
| 57 |
td->specifics = asn_DEF_INTEGER.specifics; |
| 58 |
} |
| 59 |
|
| 60 |
void |
| 61 |
T_free(asn_TYPE_descriptor_t *td, |
| 62 |
void *struct_ptr, int contents_only) { |
| 63 |
T_1_inherit_TYPE_descriptor(td); |
| 64 |
td->free_struct(td, struct_ptr, contents_only); |
| 65 |
} |
| 66 |
|
| 67 |
int |
| 68 |
T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 69 |
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 70 |
T_1_inherit_TYPE_descriptor(td); |
| 71 |
return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 72 |
} |
| 73 |
|
| 74 |
asn_dec_rval_t |
| 75 |
T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 76 |
void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 77 |
T_1_inherit_TYPE_descriptor(td); |
| 78 |
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 79 |
} |
| 80 |
|
| 81 |
asn_enc_rval_t |
| 82 |
T_encode_der(asn_TYPE_descriptor_t *td, |
| 83 |
void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 84 |
asn_app_consume_bytes_f *cb, void *app_key) { |
| 85 |
T_1_inherit_TYPE_descriptor(td); |
| 86 |
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 87 |
} |
| 88 |
|
| 89 |
asn_dec_rval_t |
| 90 |
T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 91 |
void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 92 |
T_1_inherit_TYPE_descriptor(td); |
| 93 |
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 94 |
} |
| 95 |
|
| 96 |
asn_enc_rval_t |
| 97 |
T_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 98 |
int ilevel, enum xer_encoder_flags_e flags, |
| 99 |
asn_app_consume_bytes_f *cb, void *app_key) { |
| 100 |
T_1_inherit_TYPE_descriptor(td); |
| 101 |
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
/*** <<< STAT-DEFS [T] >>> ***/ |
| 106 |
|
| 107 |
static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { |
| 108 |
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 109 |
}; |
| 110 |
asn_TYPE_descriptor_t asn_DEF_T = { |
| 111 |
"T", |
| 112 |
"T", |
| 113 |
T_free, |
| 114 |
T_print, |
| 115 |
T_constraint, |
| 116 |
T_decode_ber, |
| 117 |
T_encode_der, |
| 118 |
T_decode_xer, |
| 119 |
T_encode_xer, |
| 120 |
0, 0, /* No PER support, use "-gen-PER" to enable */ |
| 121 |
0, /* Use generic outmost tag fetcher */ |
| 122 |
asn_DEF_T_tags_1, |
| 123 |
sizeof(asn_DEF_T_tags_1) |
| 124 |
/sizeof(asn_DEF_T_tags_1[0]), /* 1 */ |
| 125 |
asn_DEF_T_tags_1, /* Same as above */ |
| 126 |
sizeof(asn_DEF_T_tags_1) |
| 127 |
/sizeof(asn_DEF_T_tags_1[0]), /* 1 */ |
| 128 |
0, /* No PER visible constraints */ |
| 129 |
0, 0, /* Defined elsewhere */ |
| 130 |
0 /* No specifics */ |
| 131 |
}; |
| 132 |
|