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