blob: d87bda5e54c2c98851ea59c1cf9e804cdef62862 [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
11} T_e;
12
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;
50 td->elements = asn_DEF_INTEGER.elements;
51 td->elements_count = asn_DEF_INTEGER.elements_count;
52 td->specifics = asn_DEF_INTEGER.specifics;
53}
54
55void
56T_free(asn_TYPE_descriptor_t *td,
57 void *struct_ptr, int contents_only) {
58 T_1_inherit_TYPE_descriptor(td);
59 td->free_struct(td, struct_ptr, contents_only);
60}
61
62int
63T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
64 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
65 T_1_inherit_TYPE_descriptor(td);
66 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
67}
68
69asn_dec_rval_t
70T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
71 void **structure, const void *bufptr, size_t size, int tag_mode) {
72 T_1_inherit_TYPE_descriptor(td);
73 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
74}
75
76asn_enc_rval_t
77T_encode_der(asn_TYPE_descriptor_t *td,
78 void *structure, int tag_mode, ber_tlv_tag_t tag,
79 asn_app_consume_bytes_f *cb, void *app_key) {
80 T_1_inherit_TYPE_descriptor(td);
81 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
82}
83
84asn_dec_rval_t
85T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
86 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
87 T_1_inherit_TYPE_descriptor(td);
88 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
89}
90
91asn_enc_rval_t
92T_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
93 int ilevel, enum xer_encoder_flags_e flags,
94 asn_app_consume_bytes_f *cb, void *app_key) {
95 T_1_inherit_TYPE_descriptor(td);
96 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
97}
98
99
100/*** <<< STAT-DEFS [T] >>> ***/
101
102static ber_tlv_tag_t asn_DEF_T_1_tags[] = {
103 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
104};
105asn_TYPE_descriptor_t asn_DEF_T = {
106 "T",
107 "T",
108 T_free,
109 T_print,
110 T_constraint,
111 T_decode_ber,
112 T_encode_der,
113 T_decode_xer,
114 T_encode_xer,
115 0, /* Use generic outmost tag fetcher */
116 asn_DEF_T_1_tags,
117 sizeof(asn_DEF_T_1_tags)
118 /sizeof(asn_DEF_T_1_tags[0]), /* 1 */
119 asn_DEF_T_1_tags, /* Same as above */
120 sizeof(asn_DEF_T_1_tags)
121 /sizeof(asn_DEF_T_1_tags[0]), /* 1 */
122 0, 0, /* Defined elsewhere */
123 0 /* No specifics */
124};
125