blob: 3dc4a06e1998f9605985436608c4856bee467547 [file] [log] [blame]
vlm3df79662004-06-28 21:13:22 +00001
vlm6e1b13e2004-08-11 05:25:47 +00002/*** <<< INCLUDES [PrimitiveType] >>> ***/
vlm3df79662004-06-28 21:13:22 +00003
4#include <OCTET_STRING.h>
5
6/*** <<< TYPE-DECLS [PrimitiveType] >>> ***/
7
vlm3df79662004-06-28 21:13:22 +00008typedef OCTET_STRING_t PrimitiveType_t;
9
vlm3df79662004-06-28 21:13:22 +000010/*** <<< FUNC-DECLS [PrimitiveType] >>> ***/
11
vlm1f7df782005-03-04 23:48:19 +000012extern asn_TYPE_descriptor_t asn_DEF_PrimitiveType;
13asn_struct_free_f PrimitiveType_free;
14asn_struct_print_f PrimitiveType_print;
15asn_constr_check_f PrimitiveType_constraint;
16ber_type_decoder_f PrimitiveType_decode_ber;
17der_type_encoder_f PrimitiveType_encode_der;
18xer_type_decoder_f PrimitiveType_decode_xer;
19xer_type_encoder_f PrimitiveType_encode_xer;
vlm3df79662004-06-28 21:13:22 +000020
vlm21e46002004-08-20 13:36:32 +000021/*** <<< CODE [PrimitiveType] >>> ***/
22
vlm1f7df782005-03-04 23:48:19 +000023int
24PrimitiveType_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
vlmaf68ef52006-07-13 11:19:01 +000025 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
vlm1f7df782005-03-04 23:48:19 +000026 /* Replace with underlying type checker */
27 td->check_constraints = asn_DEF_OCTET_STRING.check_constraints;
vlmaf68ef52006-07-13 11:19:01 +000028 return td->check_constraints(td, sptr, ctfailcb, app_key);
vlm1f7df782005-03-04 23:48:19 +000029}
30
31/*
32 * This type is implemented using OCTET_STRING,
33 * so here we adjust the DEF accordingly.
34 */
35static void
vlm67d57fe2005-03-06 09:29:03 +000036PrimitiveType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
vlm1f7df782005-03-04 23:48:19 +000037 td->free_struct = asn_DEF_OCTET_STRING.free_struct;
38 td->print_struct = asn_DEF_OCTET_STRING.print_struct;
39 td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder;
40 td->der_encoder = asn_DEF_OCTET_STRING.der_encoder;
41 td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder;
42 td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder;
vlm337167e2005-11-26 11:25:14 +000043 td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder;
vlmb1b193e2006-08-18 01:46:46 +000044 td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder;
vlm337167e2005-11-26 11:25:14 +000045 if(!td->per_constraints)
46 td->per_constraints = asn_DEF_OCTET_STRING.per_constraints;
vlm1f7df782005-03-04 23:48:19 +000047 td->elements = asn_DEF_OCTET_STRING.elements;
48 td->elements_count = asn_DEF_OCTET_STRING.elements_count;
49 td->specifics = asn_DEF_OCTET_STRING.specifics;
50}
51
52void
53PrimitiveType_free(asn_TYPE_descriptor_t *td,
54 void *struct_ptr, int contents_only) {
vlm67d57fe2005-03-06 09:29:03 +000055 PrimitiveType_1_inherit_TYPE_descriptor(td);
vlm1f7df782005-03-04 23:48:19 +000056 td->free_struct(td, struct_ptr, contents_only);
57}
58
59int
60PrimitiveType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
61 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
vlm67d57fe2005-03-06 09:29:03 +000062 PrimitiveType_1_inherit_TYPE_descriptor(td);
vlm1f7df782005-03-04 23:48:19 +000063 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
64}
65
66asn_dec_rval_t
67PrimitiveType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
vlmc04faea2005-03-17 21:57:19 +000068 void **structure, const void *bufptr, size_t size, int tag_mode) {
vlm67d57fe2005-03-06 09:29:03 +000069 PrimitiveType_1_inherit_TYPE_descriptor(td);
vlm1f7df782005-03-04 23:48:19 +000070 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
71}
72
73asn_enc_rval_t
74PrimitiveType_encode_der(asn_TYPE_descriptor_t *td,
75 void *structure, int tag_mode, ber_tlv_tag_t tag,
76 asn_app_consume_bytes_f *cb, void *app_key) {
vlm67d57fe2005-03-06 09:29:03 +000077 PrimitiveType_1_inherit_TYPE_descriptor(td);
vlm1f7df782005-03-04 23:48:19 +000078 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
79}
80
81asn_dec_rval_t
82PrimitiveType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
vlmc04faea2005-03-17 21:57:19 +000083 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
vlm67d57fe2005-03-06 09:29:03 +000084 PrimitiveType_1_inherit_TYPE_descriptor(td);
vlm1f7df782005-03-04 23:48:19 +000085 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
86}
87
88asn_enc_rval_t
89PrimitiveType_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
90 int ilevel, enum xer_encoder_flags_e flags,
91 asn_app_consume_bytes_f *cb, void *app_key) {
vlm67d57fe2005-03-06 09:29:03 +000092 PrimitiveType_1_inherit_TYPE_descriptor(td);
vlm1f7df782005-03-04 23:48:19 +000093 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
94}
95
96
97/*** <<< STAT-DEFS [PrimitiveType] >>> ***/
98
vlm337167e2005-11-26 11:25:14 +000099static ber_tlv_tag_t asn_DEF_PrimitiveType_tags_1[] = {
vlm1f7df782005-03-04 23:48:19 +0000100 (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
101};
102asn_TYPE_descriptor_t asn_DEF_PrimitiveType = {
103 "PrimitiveType",
104 "PrimitiveType",
105 PrimitiveType_free,
106 PrimitiveType_print,
107 PrimitiveType_constraint,
108 PrimitiveType_decode_ber,
109 PrimitiveType_encode_der,
110 PrimitiveType_decode_xer,
111 PrimitiveType_encode_xer,
vlmb1b193e2006-08-18 01:46:46 +0000112 0, 0, /* No PER support, use "-gen-PER" to enable */
vlm1f7df782005-03-04 23:48:19 +0000113 0, /* Use generic outmost tag fetcher */
vlm337167e2005-11-26 11:25:14 +0000114 asn_DEF_PrimitiveType_tags_1,
115 sizeof(asn_DEF_PrimitiveType_tags_1)
116 /sizeof(asn_DEF_PrimitiveType_tags_1[0]), /* 1 */
117 asn_DEF_PrimitiveType_tags_1, /* Same as above */
118 sizeof(asn_DEF_PrimitiveType_tags_1)
119 /sizeof(asn_DEF_PrimitiveType_tags_1[0]), /* 1 */
120 0, /* No PER visible constraints */
vlm1f7df782005-03-04 23:48:19 +0000121 0, 0, /* No members */
122 0 /* No specifics */
123};
vlm3df79662004-06-28 21:13:22 +0000124
vlm3df79662004-06-28 21:13:22 +0000125
vlm6e1b13e2004-08-11 05:25:47 +0000126/*** <<< INCLUDES [ConstructedType] >>> ***/
vlm3df79662004-06-28 21:13:22 +0000127
vlmea226772006-09-13 02:51:20 +0000128#include "PrimitiveType.h"
vlm3df79662004-06-28 21:13:22 +0000129#include <constr_SEQUENCE.h>
130
vlm3df79662004-06-28 21:13:22 +0000131/*** <<< TYPE-DECLS [ConstructedType] >>> ***/
132
vlm3df79662004-06-28 21:13:22 +0000133typedef struct ConstructedType {
134 PrimitiveType_t field;
135
136 /* Context for parsing across buffer boundaries */
vlm02296432004-09-29 13:19:37 +0000137 asn_struct_ctx_t _asn_ctx;
vlm3df79662004-06-28 21:13:22 +0000138} ConstructedType_t;
139
vlm0b567bf2005-03-04 22:18:20 +0000140/*** <<< FUNC-DECLS [ConstructedType] >>> ***/
141
142extern asn_TYPE_descriptor_t asn_DEF_ConstructedType;
143
vlm3df79662004-06-28 21:13:22 +0000144/*** <<< STAT-DEFS [ConstructedType] >>> ***/
145
vlm44fe49a2005-03-04 11:26:08 +0000146static asn_TYPE_member_t asn_MBR_ConstructedType_1[] = {
vlmddd5a7d2004-09-10 09:18:20 +0000147 { ATF_NOFLAGS, 0, offsetof(struct ConstructedType, field),
vlm21e46002004-08-20 13:36:32 +0000148 .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
149 .tag_mode = -1, /* IMPLICIT tag at current level */
vlme0fea712005-08-29 10:31:14 +0000150 .type = &asn_DEF_PrimitiveType,
vlm0a9af512005-01-17 12:20:19 +0000151 .memb_constraints = 0, /* Defer constraints checking to the member type */
vlm337167e2005-11-26 11:25:14 +0000152 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
153 .default_value = 0,
vlm21e46002004-08-20 13:36:32 +0000154 .name = "field"
vlm3df79662004-06-28 21:13:22 +0000155 },
156};
vlm337167e2005-11-26 11:25:14 +0000157static ber_tlv_tag_t asn_DEF_ConstructedType_tags_1[] = {
vlm3df79662004-06-28 21:13:22 +0000158 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
159};
vlm337167e2005-11-26 11:25:14 +0000160static asn_TYPE_tag2member_t asn_MAP_ConstructedType_tag2el_1[] = {
vlm3b0d1e52005-02-25 08:24:19 +0000161 { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 } /* field at 18 */
vlm3df79662004-06-28 21:13:22 +0000162};
vlm337167e2005-11-26 11:25:14 +0000163static asn_SEQUENCE_specifics_t asn_SPC_ConstructedType_specs_1 = {
vlm3df79662004-06-28 21:13:22 +0000164 sizeof(struct ConstructedType),
vlm02296432004-09-29 13:19:37 +0000165 offsetof(struct ConstructedType, _asn_ctx),
vlm337167e2005-11-26 11:25:14 +0000166 asn_MAP_ConstructedType_tag2el_1,
vlm3df79662004-06-28 21:13:22 +0000167 1, /* Count of tags in the map */
vlm337167e2005-11-26 11:25:14 +0000168 0, 0, 0, /* Optional elements (not needed) */
vlm3df79662004-06-28 21:13:22 +0000169 -1, /* Start extensions */
170 -1 /* Stop extensions */
171};
vlm02296432004-09-29 13:19:37 +0000172asn_TYPE_descriptor_t asn_DEF_ConstructedType = {
vlm3df79662004-06-28 21:13:22 +0000173 "ConstructedType",
vlm9de248e2004-10-20 15:50:55 +0000174 "ConstructedType",
vlm39ba4c42004-09-22 16:06:28 +0000175 SEQUENCE_free,
176 SEQUENCE_print,
vlm3df79662004-06-28 21:13:22 +0000177 SEQUENCE_constraint,
178 SEQUENCE_decode_ber,
179 SEQUENCE_encode_der,
vlm2dbab7c2004-10-23 15:07:45 +0000180 SEQUENCE_decode_xer,
vlm39ba4c42004-09-22 16:06:28 +0000181 SEQUENCE_encode_xer,
vlmb1b193e2006-08-18 01:46:46 +0000182 0, 0, /* No PER support, use "-gen-PER" to enable */
vlm3df79662004-06-28 21:13:22 +0000183 0, /* Use generic outmost tag fetcher */
vlm337167e2005-11-26 11:25:14 +0000184 asn_DEF_ConstructedType_tags_1,
185 sizeof(asn_DEF_ConstructedType_tags_1)
186 /sizeof(asn_DEF_ConstructedType_tags_1[0]), /* 1 */
187 asn_DEF_ConstructedType_tags_1, /* Same as above */
188 sizeof(asn_DEF_ConstructedType_tags_1)
189 /sizeof(asn_DEF_ConstructedType_tags_1[0]), /* 1 */
190 0, /* No PER visible constraints */
vlm44fe49a2005-03-04 11:26:08 +0000191 asn_MBR_ConstructedType_1,
vlm21e46002004-08-20 13:36:32 +0000192 1, /* Elements count */
vlm337167e2005-11-26 11:25:14 +0000193 &asn_SPC_ConstructedType_specs_1 /* Additional specs */
vlm3df79662004-06-28 21:13:22 +0000194};
195
196
vlm6e1b13e2004-08-11 05:25:47 +0000197/*** <<< INCLUDES [T] >>> ***/
vlm3df79662004-06-28 21:13:22 +0000198
vlmea226772006-09-13 02:51:20 +0000199#include "ConstructedType.h"
vlm3df79662004-06-28 21:13:22 +0000200
201/*** <<< TYPE-DECLS [T] >>> ***/
202
vlm3df79662004-06-28 21:13:22 +0000203typedef ConstructedType_t T_t;
204
vlm3df79662004-06-28 21:13:22 +0000205/*** <<< FUNC-DECLS [T] >>> ***/
206
vlm02296432004-09-29 13:19:37 +0000207extern asn_TYPE_descriptor_t asn_DEF_T;
vlm39ba4c42004-09-22 16:06:28 +0000208asn_struct_free_f T_free;
209asn_struct_print_f T_print;
vlm3df79662004-06-28 21:13:22 +0000210asn_constr_check_f T_constraint;
211ber_type_decoder_f T_decode_ber;
212der_type_encoder_f T_encode_der;
vlma6af74c2004-10-23 13:26:56 +0000213xer_type_decoder_f T_decode_xer;
vlm39ba4c42004-09-22 16:06:28 +0000214xer_type_encoder_f T_encode_xer;
vlm3df79662004-06-28 21:13:22 +0000215
vlm21e46002004-08-20 13:36:32 +0000216/*** <<< CODE [T] >>> ***/
217
218int
vlm02296432004-09-29 13:19:37 +0000219T_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
vlmaf68ef52006-07-13 11:19:01 +0000220 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
vlmaafc9412004-09-26 13:12:56 +0000221 /* Replace with underlying type checker */
vlm02296432004-09-29 13:19:37 +0000222 td->check_constraints = asn_DEF_ConstructedType.check_constraints;
vlmaf68ef52006-07-13 11:19:01 +0000223 return td->check_constraints(td, sptr, ctfailcb, app_key);
vlm21e46002004-08-20 13:36:32 +0000224}
225
226/*
227 * This type is implemented using ConstructedType,
vlmcb0b7fc2004-09-23 22:14:58 +0000228 * so here we adjust the DEF accordingly.
vlm21e46002004-08-20 13:36:32 +0000229 */
230static void
vlm67d57fe2005-03-06 09:29:03 +0000231T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
vlm02296432004-09-29 13:19:37 +0000232 td->free_struct = asn_DEF_ConstructedType.free_struct;
233 td->print_struct = asn_DEF_ConstructedType.print_struct;
234 td->ber_decoder = asn_DEF_ConstructedType.ber_decoder;
235 td->der_encoder = asn_DEF_ConstructedType.der_encoder;
236 td->xer_decoder = asn_DEF_ConstructedType.xer_decoder;
237 td->xer_encoder = asn_DEF_ConstructedType.xer_encoder;
vlm337167e2005-11-26 11:25:14 +0000238 td->uper_decoder = asn_DEF_ConstructedType.uper_decoder;
vlmb1b193e2006-08-18 01:46:46 +0000239 td->uper_encoder = asn_DEF_ConstructedType.uper_encoder;
vlm337167e2005-11-26 11:25:14 +0000240 if(!td->per_constraints)
241 td->per_constraints = asn_DEF_ConstructedType.per_constraints;
vlm02296432004-09-29 13:19:37 +0000242 td->elements = asn_DEF_ConstructedType.elements;
243 td->elements_count = asn_DEF_ConstructedType.elements_count;
244 td->specifics = asn_DEF_ConstructedType.specifics;
vlm21e46002004-08-20 13:36:32 +0000245}
246
vlm39ba4c42004-09-22 16:06:28 +0000247void
vlm02296432004-09-29 13:19:37 +0000248T_free(asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000249 void *struct_ptr, int contents_only) {
vlm67d57fe2005-03-06 09:29:03 +0000250 T_1_inherit_TYPE_descriptor(td);
vlm39ba4c42004-09-22 16:06:28 +0000251 td->free_struct(td, struct_ptr, contents_only);
vlm21e46002004-08-20 13:36:32 +0000252}
253
254int
vlm02296432004-09-29 13:19:37 +0000255T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
vlm21e46002004-08-20 13:36:32 +0000256 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
vlm67d57fe2005-03-06 09:29:03 +0000257 T_1_inherit_TYPE_descriptor(td);
vlm21e46002004-08-20 13:36:32 +0000258 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
259}
260
vlm9de248e2004-10-20 15:50:55 +0000261asn_dec_rval_t
vlm02296432004-09-29 13:19:37 +0000262T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
vlmc04faea2005-03-17 21:57:19 +0000263 void **structure, const void *bufptr, size_t size, int tag_mode) {
vlm67d57fe2005-03-06 09:29:03 +0000264 T_1_inherit_TYPE_descriptor(td);
vlm02296432004-09-29 13:19:37 +0000265 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
vlm39ba4c42004-09-22 16:06:28 +0000266}
267
268asn_enc_rval_t
vlm02296432004-09-29 13:19:37 +0000269T_encode_der(asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000270 void *structure, int tag_mode, ber_tlv_tag_t tag,
271 asn_app_consume_bytes_f *cb, void *app_key) {
vlm67d57fe2005-03-06 09:29:03 +0000272 T_1_inherit_TYPE_descriptor(td);
vlm39ba4c42004-09-22 16:06:28 +0000273 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
274}
275
vlma6af74c2004-10-23 13:26:56 +0000276asn_dec_rval_t
277T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
vlmc04faea2005-03-17 21:57:19 +0000278 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
vlm67d57fe2005-03-06 09:29:03 +0000279 T_1_inherit_TYPE_descriptor(td);
vlma6af74c2004-10-23 13:26:56 +0000280 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
281}
282
vlm39ba4c42004-09-22 16:06:28 +0000283asn_enc_rval_t
vlm02296432004-09-29 13:19:37 +0000284T_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
vlm39ba4c42004-09-22 16:06:28 +0000285 int ilevel, enum xer_encoder_flags_e flags,
286 asn_app_consume_bytes_f *cb, void *app_key) {
vlm67d57fe2005-03-06 09:29:03 +0000287 T_1_inherit_TYPE_descriptor(td);
vlm39ba4c42004-09-22 16:06:28 +0000288 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
vlm21e46002004-08-20 13:36:32 +0000289}
290
291
vlm3df79662004-06-28 21:13:22 +0000292/*** <<< STAT-DEFS [T] >>> ***/
293
vlm337167e2005-11-26 11:25:14 +0000294static ber_tlv_tag_t asn_DEF_T_tags_1[] = {
vlm72425de2004-09-13 08:31:01 +0000295 (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
296 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
vlm3df79662004-06-28 21:13:22 +0000297};
vlm02296432004-09-29 13:19:37 +0000298asn_TYPE_descriptor_t asn_DEF_T = {
vlm3df79662004-06-28 21:13:22 +0000299 "T",
vlm9de248e2004-10-20 15:50:55 +0000300 "T",
vlm39ba4c42004-09-22 16:06:28 +0000301 T_free,
302 T_print,
vlm3df79662004-06-28 21:13:22 +0000303 T_constraint,
304 T_decode_ber,
305 T_encode_der,
vlma6af74c2004-10-23 13:26:56 +0000306 T_decode_xer,
vlm39ba4c42004-09-22 16:06:28 +0000307 T_encode_xer,
vlmb1b193e2006-08-18 01:46:46 +0000308 0, 0, /* No PER support, use "-gen-PER" to enable */
vlm3df79662004-06-28 21:13:22 +0000309 0, /* Use generic outmost tag fetcher */
vlm337167e2005-11-26 11:25:14 +0000310 asn_DEF_T_tags_1,
311 sizeof(asn_DEF_T_tags_1)
312 /sizeof(asn_DEF_T_tags_1[0]) - 1, /* 1 */
313 asn_DEF_T_tags_1, /* Same as above */
314 sizeof(asn_DEF_T_tags_1)
315 /sizeof(asn_DEF_T_tags_1[0]), /* 2 */
316 0, /* No PER visible constraints */
vlm21e46002004-08-20 13:36:32 +0000317 0, 0, /* Defined elsewhere */
vlm3df79662004-06-28 21:13:22 +0000318 0 /* No specifics */
319};
320