blob: bbd437aaa1dc77440e64ee21c053ffd41ffa799b [file] [log] [blame]
Lev Walkin414b0782005-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
Lev Walkin171487e2006-03-21 07:25:18 +000011} e_T;
Lev Walkin414b0782005-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,
32 asn_app_consume_bytes_f *app_errlog, 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, app_errlog, app_key);
36}
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;
Lev Walkin59b176e2005-11-26 11:25:14 +000050 td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
51 if(!td->per_constraints)
52 td->per_constraints = asn_DEF_INTEGER.per_constraints;
Lev Walkin414b0782005-08-13 23:30:24 +000053 td->elements = asn_DEF_INTEGER.elements;
54 td->elements_count = asn_DEF_INTEGER.elements_count;
55 td->specifics = asn_DEF_INTEGER.specifics;
56}
57
58void
59T_free(asn_TYPE_descriptor_t *td,
60 void *struct_ptr, int contents_only) {
61 T_1_inherit_TYPE_descriptor(td);
62 td->free_struct(td, struct_ptr, contents_only);
63}
64
65int
66T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
67 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
68 T_1_inherit_TYPE_descriptor(td);
69 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
70}
71
72asn_dec_rval_t
73T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
74 void **structure, const void *bufptr, size_t size, int tag_mode) {
75 T_1_inherit_TYPE_descriptor(td);
76 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
77}
78
79asn_enc_rval_t
80T_encode_der(asn_TYPE_descriptor_t *td,
81 void *structure, int tag_mode, ber_tlv_tag_t tag,
82 asn_app_consume_bytes_f *cb, void *app_key) {
83 T_1_inherit_TYPE_descriptor(td);
84 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
85}
86
87asn_dec_rval_t
88T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
89 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
90 T_1_inherit_TYPE_descriptor(td);
91 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
92}
93
94asn_enc_rval_t
95T_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
96 int ilevel, enum xer_encoder_flags_e flags,
97 asn_app_consume_bytes_f *cb, void *app_key) {
98 T_1_inherit_TYPE_descriptor(td);
99 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
100}
101
102
103/*** <<< STAT-DEFS [T] >>> ***/
104
Lev Walkin59b176e2005-11-26 11:25:14 +0000105static ber_tlv_tag_t asn_DEF_T_tags_1[] = {
Lev Walkin414b0782005-08-13 23:30:24 +0000106 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
107};
108asn_TYPE_descriptor_t asn_DEF_T = {
109 "T",
110 "T",
111 T_free,
112 T_print,
113 T_constraint,
114 T_decode_ber,
115 T_encode_der,
116 T_decode_xer,
117 T_encode_xer,
Lev Walkin59b176e2005-11-26 11:25:14 +0000118 0, /* No PER decoder, -gen-PER to enable */
Lev Walkin414b0782005-08-13 23:30:24 +0000119 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000120 asn_DEF_T_tags_1,
121 sizeof(asn_DEF_T_tags_1)
122 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
123 asn_DEF_T_tags_1, /* Same as above */
124 sizeof(asn_DEF_T_tags_1)
125 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
126 0, /* No PER visible constraints */
Lev Walkin414b0782005-08-13 23:30:24 +0000127 0, 0, /* Defined elsewhere */
128 0 /* No specifics */
129};
130