blob: 5f9a6e28809dfe36fdfa339d227ce3dfddb80942 [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
8
9typedef OCTET_STRING_t PrimitiveType_t;
10
vlm3df79662004-06-28 21:13:22 +000011/*** <<< FUNC-DECLS [PrimitiveType] >>> ***/
12
vlmaafc9412004-09-26 13:12:56 +000013/* This type is equivalent to OCTET_STRING */
vlm02296432004-09-29 13:19:37 +000014#define asn_DEF_PrimitiveType asn_DEF_OCTET_STRING
vlm3df79662004-06-28 21:13:22 +000015
vlm21e46002004-08-20 13:36:32 +000016/*** <<< CODE [PrimitiveType] >>> ***/
17
vlmaafc9412004-09-26 13:12:56 +000018/* This type is equivalent to OCTET_STRING */
vlm3df79662004-06-28 21:13:22 +000019
vlm3df79662004-06-28 21:13:22 +000020
vlm6e1b13e2004-08-11 05:25:47 +000021/*** <<< INCLUDES [ConstructedType] >>> ***/
vlm3df79662004-06-28 21:13:22 +000022
vlm3df79662004-06-28 21:13:22 +000023#include <PrimitiveType.h>
vlm3df79662004-06-28 21:13:22 +000024#include <constr_SEQUENCE.h>
25
vlm6e1b13e2004-08-11 05:25:47 +000026/*** <<< DEPS [ConstructedType] >>> ***/
27
vlm02296432004-09-29 13:19:37 +000028extern asn_TYPE_descriptor_t asn_DEF_ConstructedType;
vlm3df79662004-06-28 21:13:22 +000029
30/*** <<< TYPE-DECLS [ConstructedType] >>> ***/
31
32
33typedef struct ConstructedType {
34 PrimitiveType_t field;
35
36 /* Context for parsing across buffer boundaries */
vlm02296432004-09-29 13:19:37 +000037 asn_struct_ctx_t _asn_ctx;
vlm3df79662004-06-28 21:13:22 +000038} ConstructedType_t;
39
40/*** <<< STAT-DEFS [ConstructedType] >>> ***/
41
vlm02296432004-09-29 13:19:37 +000042static asn_TYPE_member_t asn_MBR_ConstructedType[] = {
vlmddd5a7d2004-09-10 09:18:20 +000043 { ATF_NOFLAGS, 0, offsetof(struct ConstructedType, field),
vlm21e46002004-08-20 13:36:32 +000044 .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
45 .tag_mode = -1, /* IMPLICIT tag at current level */
vlm02296432004-09-29 13:19:37 +000046 .type = (void *)&asn_DEF_PrimitiveType,
vlm0a9af512005-01-17 12:20:19 +000047 .memb_constraints = 0, /* Defer constraints checking to the member type */
vlm21e46002004-08-20 13:36:32 +000048 .name = "field"
vlm3df79662004-06-28 21:13:22 +000049 },
50};
vlm02296432004-09-29 13:19:37 +000051static ber_tlv_tag_t asn_DEF_ConstructedType_tags[] = {
vlm3df79662004-06-28 21:13:22 +000052 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
53};
vlm02296432004-09-29 13:19:37 +000054static asn_TYPE_tag2member_t asn_DEF_ConstructedType_tag2el[] = {
vlm3b0d1e52005-02-25 08:24:19 +000055 { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 } /* field at 18 */
vlm3df79662004-06-28 21:13:22 +000056};
vlm02296432004-09-29 13:19:37 +000057static asn_SEQUENCE_specifics_t asn_DEF_ConstructedType_specs = {
vlm3df79662004-06-28 21:13:22 +000058 sizeof(struct ConstructedType),
vlm02296432004-09-29 13:19:37 +000059 offsetof(struct ConstructedType, _asn_ctx),
60 asn_DEF_ConstructedType_tag2el,
vlm3df79662004-06-28 21:13:22 +000061 1, /* Count of tags in the map */
62 -1, /* Start extensions */
63 -1 /* Stop extensions */
64};
vlm02296432004-09-29 13:19:37 +000065asn_TYPE_descriptor_t asn_DEF_ConstructedType = {
vlm3df79662004-06-28 21:13:22 +000066 "ConstructedType",
vlm9de248e2004-10-20 15:50:55 +000067 "ConstructedType",
vlm39ba4c42004-09-22 16:06:28 +000068 SEQUENCE_free,
69 SEQUENCE_print,
vlm3df79662004-06-28 21:13:22 +000070 SEQUENCE_constraint,
71 SEQUENCE_decode_ber,
72 SEQUENCE_encode_der,
vlm2dbab7c2004-10-23 15:07:45 +000073 SEQUENCE_decode_xer,
vlm39ba4c42004-09-22 16:06:28 +000074 SEQUENCE_encode_xer,
vlm3df79662004-06-28 21:13:22 +000075 0, /* Use generic outmost tag fetcher */
vlm02296432004-09-29 13:19:37 +000076 asn_DEF_ConstructedType_tags,
77 sizeof(asn_DEF_ConstructedType_tags)
78 /sizeof(asn_DEF_ConstructedType_tags[0]), /* 1 */
79 asn_DEF_ConstructedType_tags, /* Same as above */
80 sizeof(asn_DEF_ConstructedType_tags)
81 /sizeof(asn_DEF_ConstructedType_tags[0]), /* 1 */
82 asn_MBR_ConstructedType,
vlm21e46002004-08-20 13:36:32 +000083 1, /* Elements count */
vlm02296432004-09-29 13:19:37 +000084 &asn_DEF_ConstructedType_specs /* Additional specs */
vlm3df79662004-06-28 21:13:22 +000085};
86
87
vlm6e1b13e2004-08-11 05:25:47 +000088/*** <<< INCLUDES [T] >>> ***/
vlm3df79662004-06-28 21:13:22 +000089
90#include <ConstructedType.h>
91
92/*** <<< TYPE-DECLS [T] >>> ***/
93
94
95typedef ConstructedType_t T_t;
96
vlm3df79662004-06-28 21:13:22 +000097/*** <<< FUNC-DECLS [T] >>> ***/
98
vlm02296432004-09-29 13:19:37 +000099extern asn_TYPE_descriptor_t asn_DEF_T;
vlm39ba4c42004-09-22 16:06:28 +0000100asn_struct_free_f T_free;
101asn_struct_print_f T_print;
vlm3df79662004-06-28 21:13:22 +0000102asn_constr_check_f T_constraint;
103ber_type_decoder_f T_decode_ber;
104der_type_encoder_f T_encode_der;
vlma6af74c2004-10-23 13:26:56 +0000105xer_type_decoder_f T_decode_xer;
vlm39ba4c42004-09-22 16:06:28 +0000106xer_type_encoder_f T_encode_xer;
vlm3df79662004-06-28 21:13:22 +0000107
vlm21e46002004-08-20 13:36:32 +0000108/*** <<< CODE [T] >>> ***/
109
110int
vlm02296432004-09-29 13:19:37 +0000111T_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
vlm21e46002004-08-20 13:36:32 +0000112 asn_app_consume_bytes_f *app_errlog, void *app_key) {
vlmaafc9412004-09-26 13:12:56 +0000113 /* Replace with underlying type checker */
vlm02296432004-09-29 13:19:37 +0000114 td->check_constraints = asn_DEF_ConstructedType.check_constraints;
vlmaafc9412004-09-26 13:12:56 +0000115 return td->check_constraints(td, sptr, app_errlog, app_key);
vlm21e46002004-08-20 13:36:32 +0000116}
117
118/*
119 * This type is implemented using ConstructedType,
vlmcb0b7fc2004-09-23 22:14:58 +0000120 * so here we adjust the DEF accordingly.
vlm21e46002004-08-20 13:36:32 +0000121 */
122static void
vlm02296432004-09-29 13:19:37 +0000123T_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
124 td->free_struct = asn_DEF_ConstructedType.free_struct;
125 td->print_struct = asn_DEF_ConstructedType.print_struct;
126 td->ber_decoder = asn_DEF_ConstructedType.ber_decoder;
127 td->der_encoder = asn_DEF_ConstructedType.der_encoder;
128 td->xer_decoder = asn_DEF_ConstructedType.xer_decoder;
129 td->xer_encoder = asn_DEF_ConstructedType.xer_encoder;
130 td->elements = asn_DEF_ConstructedType.elements;
131 td->elements_count = asn_DEF_ConstructedType.elements_count;
132 td->specifics = asn_DEF_ConstructedType.specifics;
vlm21e46002004-08-20 13:36:32 +0000133}
134
vlm39ba4c42004-09-22 16:06:28 +0000135void
vlm02296432004-09-29 13:19:37 +0000136T_free(asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000137 void *struct_ptr, int contents_only) {
vlm21e46002004-08-20 13:36:32 +0000138 T_inherit_TYPE_descriptor(td);
vlm39ba4c42004-09-22 16:06:28 +0000139 td->free_struct(td, struct_ptr, contents_only);
vlm21e46002004-08-20 13:36:32 +0000140}
141
142int
vlm02296432004-09-29 13:19:37 +0000143T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
vlm21e46002004-08-20 13:36:32 +0000144 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
145 T_inherit_TYPE_descriptor(td);
146 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
147}
148
vlm9de248e2004-10-20 15:50:55 +0000149asn_dec_rval_t
vlm02296432004-09-29 13:19:37 +0000150T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000151 void **structure, void *bufptr, size_t size, int tag_mode) {
vlm21e46002004-08-20 13:36:32 +0000152 T_inherit_TYPE_descriptor(td);
vlm02296432004-09-29 13:19:37 +0000153 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
vlm39ba4c42004-09-22 16:06:28 +0000154}
155
156asn_enc_rval_t
vlm02296432004-09-29 13:19:37 +0000157T_encode_der(asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000158 void *structure, int tag_mode, ber_tlv_tag_t tag,
159 asn_app_consume_bytes_f *cb, void *app_key) {
160 T_inherit_TYPE_descriptor(td);
161 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
162}
163
vlma6af74c2004-10-23 13:26:56 +0000164asn_dec_rval_t
165T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
166 void **structure, const char *opt_mname, void *bufptr, size_t size) {
167 T_inherit_TYPE_descriptor(td);
168 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
169}
170
vlm39ba4c42004-09-22 16:06:28 +0000171asn_enc_rval_t
vlm02296432004-09-29 13:19:37 +0000172T_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
vlm39ba4c42004-09-22 16:06:28 +0000173 int ilevel, enum xer_encoder_flags_e flags,
174 asn_app_consume_bytes_f *cb, void *app_key) {
175 T_inherit_TYPE_descriptor(td);
176 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
vlm21e46002004-08-20 13:36:32 +0000177}
178
179
vlm3df79662004-06-28 21:13:22 +0000180/*** <<< STAT-DEFS [T] >>> ***/
181
vlm02296432004-09-29 13:19:37 +0000182static ber_tlv_tag_t asn_DEF_T_tags[] = {
vlm72425de2004-09-13 08:31:01 +0000183 (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
184 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
vlm3df79662004-06-28 21:13:22 +0000185};
vlm02296432004-09-29 13:19:37 +0000186asn_TYPE_descriptor_t asn_DEF_T = {
vlm3df79662004-06-28 21:13:22 +0000187 "T",
vlm9de248e2004-10-20 15:50:55 +0000188 "T",
vlm39ba4c42004-09-22 16:06:28 +0000189 T_free,
190 T_print,
vlm3df79662004-06-28 21:13:22 +0000191 T_constraint,
192 T_decode_ber,
193 T_encode_der,
vlma6af74c2004-10-23 13:26:56 +0000194 T_decode_xer,
vlm39ba4c42004-09-22 16:06:28 +0000195 T_encode_xer,
vlm3df79662004-06-28 21:13:22 +0000196 0, /* Use generic outmost tag fetcher */
vlm02296432004-09-29 13:19:37 +0000197 asn_DEF_T_tags,
198 sizeof(asn_DEF_T_tags)
199 /sizeof(asn_DEF_T_tags[0]) - 1, /* 1 */
200 asn_DEF_T_tags, /* Same as above */
201 sizeof(asn_DEF_T_tags)
202 /sizeof(asn_DEF_T_tags[0]), /* 2 */
vlm21e46002004-08-20 13:36:32 +0000203 0, 0, /* Defined elsewhere */
vlm3df79662004-06-28 21:13:22 +0000204 0 /* No specifics */
205};
206