blob: 92a81cae5c4a1791ab7233f610ac6697a5b9923f [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,
vlm21e46002004-08-20 13:36:32 +000047 .memb_constraints = 0, /* Defer to actual type */
48 .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[] = {
vlm3df79662004-06-28 21:13:22 +000055 { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 }, /* field at 18 */
56};
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",
vlm39ba4c42004-09-22 16:06:28 +000067 SEQUENCE_free,
68 SEQUENCE_print,
vlm3df79662004-06-28 21:13:22 +000069 SEQUENCE_constraint,
70 SEQUENCE_decode_ber,
71 SEQUENCE_encode_der,
vlm39ba4c42004-09-22 16:06:28 +000072 0, /* Not implemented yet */
73 SEQUENCE_encode_xer,
vlm3df79662004-06-28 21:13:22 +000074 0, /* Use generic outmost tag fetcher */
vlm02296432004-09-29 13:19:37 +000075 asn_DEF_ConstructedType_tags,
76 sizeof(asn_DEF_ConstructedType_tags)
77 /sizeof(asn_DEF_ConstructedType_tags[0]), /* 1 */
78 asn_DEF_ConstructedType_tags, /* Same as above */
79 sizeof(asn_DEF_ConstructedType_tags)
80 /sizeof(asn_DEF_ConstructedType_tags[0]), /* 1 */
81 asn_MBR_ConstructedType,
vlm21e46002004-08-20 13:36:32 +000082 1, /* Elements count */
vlm02296432004-09-29 13:19:37 +000083 &asn_DEF_ConstructedType_specs /* Additional specs */
vlm3df79662004-06-28 21:13:22 +000084};
85
86
vlm6e1b13e2004-08-11 05:25:47 +000087/*** <<< INCLUDES [T] >>> ***/
vlm3df79662004-06-28 21:13:22 +000088
89#include <ConstructedType.h>
90
91/*** <<< TYPE-DECLS [T] >>> ***/
92
93
94typedef ConstructedType_t T_t;
95
vlm3df79662004-06-28 21:13:22 +000096/*** <<< FUNC-DECLS [T] >>> ***/
97
vlm02296432004-09-29 13:19:37 +000098extern asn_TYPE_descriptor_t asn_DEF_T;
vlm39ba4c42004-09-22 16:06:28 +000099asn_struct_free_f T_free;
100asn_struct_print_f T_print;
vlm3df79662004-06-28 21:13:22 +0000101asn_constr_check_f T_constraint;
102ber_type_decoder_f T_decode_ber;
103der_type_encoder_f T_encode_der;
vlm39ba4c42004-09-22 16:06:28 +0000104xer_type_encoder_f T_encode_xer;
vlm3df79662004-06-28 21:13:22 +0000105
vlm21e46002004-08-20 13:36:32 +0000106/*** <<< CODE [T] >>> ***/
107
108int
vlm02296432004-09-29 13:19:37 +0000109T_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
vlm21e46002004-08-20 13:36:32 +0000110 asn_app_consume_bytes_f *app_errlog, void *app_key) {
vlmaafc9412004-09-26 13:12:56 +0000111 /* Replace with underlying type checker */
vlm02296432004-09-29 13:19:37 +0000112 td->check_constraints = asn_DEF_ConstructedType.check_constraints;
vlmaafc9412004-09-26 13:12:56 +0000113 return td->check_constraints(td, sptr, app_errlog, app_key);
vlm21e46002004-08-20 13:36:32 +0000114}
115
116/*
117 * This type is implemented using ConstructedType,
vlmcb0b7fc2004-09-23 22:14:58 +0000118 * so here we adjust the DEF accordingly.
vlm21e46002004-08-20 13:36:32 +0000119 */
120static void
vlm02296432004-09-29 13:19:37 +0000121T_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
122 td->free_struct = asn_DEF_ConstructedType.free_struct;
123 td->print_struct = asn_DEF_ConstructedType.print_struct;
124 td->ber_decoder = asn_DEF_ConstructedType.ber_decoder;
125 td->der_encoder = asn_DEF_ConstructedType.der_encoder;
126 td->xer_decoder = asn_DEF_ConstructedType.xer_decoder;
127 td->xer_encoder = asn_DEF_ConstructedType.xer_encoder;
128 td->elements = asn_DEF_ConstructedType.elements;
129 td->elements_count = asn_DEF_ConstructedType.elements_count;
130 td->specifics = asn_DEF_ConstructedType.specifics;
vlm21e46002004-08-20 13:36:32 +0000131}
132
vlm39ba4c42004-09-22 16:06:28 +0000133void
vlm02296432004-09-29 13:19:37 +0000134T_free(asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000135 void *struct_ptr, int contents_only) {
vlm21e46002004-08-20 13:36:32 +0000136 T_inherit_TYPE_descriptor(td);
vlm39ba4c42004-09-22 16:06:28 +0000137 td->free_struct(td, struct_ptr, contents_only);
vlm21e46002004-08-20 13:36:32 +0000138}
139
140int
vlm02296432004-09-29 13:19:37 +0000141T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
vlm21e46002004-08-20 13:36:32 +0000142 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
143 T_inherit_TYPE_descriptor(td);
144 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
145}
146
vlm39ba4c42004-09-22 16:06:28 +0000147ber_dec_rval_t
vlm02296432004-09-29 13:19:37 +0000148T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000149 void **structure, void *bufptr, size_t size, int tag_mode) {
vlm21e46002004-08-20 13:36:32 +0000150 T_inherit_TYPE_descriptor(td);
vlm02296432004-09-29 13:19:37 +0000151 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
vlm39ba4c42004-09-22 16:06:28 +0000152}
153
154asn_enc_rval_t
vlm02296432004-09-29 13:19:37 +0000155T_encode_der(asn_TYPE_descriptor_t *td,
vlm39ba4c42004-09-22 16:06:28 +0000156 void *structure, int tag_mode, ber_tlv_tag_t tag,
157 asn_app_consume_bytes_f *cb, void *app_key) {
158 T_inherit_TYPE_descriptor(td);
159 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
160}
161
162asn_enc_rval_t
vlm02296432004-09-29 13:19:37 +0000163T_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
vlm39ba4c42004-09-22 16:06:28 +0000164 int ilevel, enum xer_encoder_flags_e flags,
165 asn_app_consume_bytes_f *cb, void *app_key) {
166 T_inherit_TYPE_descriptor(td);
167 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
vlm21e46002004-08-20 13:36:32 +0000168}
169
170
vlm3df79662004-06-28 21:13:22 +0000171/*** <<< STAT-DEFS [T] >>> ***/
172
vlm02296432004-09-29 13:19:37 +0000173static ber_tlv_tag_t asn_DEF_T_tags[] = {
vlm72425de2004-09-13 08:31:01 +0000174 (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
175 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
vlm3df79662004-06-28 21:13:22 +0000176};
vlm02296432004-09-29 13:19:37 +0000177asn_TYPE_descriptor_t asn_DEF_T = {
vlm3df79662004-06-28 21:13:22 +0000178 "T",
vlm39ba4c42004-09-22 16:06:28 +0000179 T_free,
180 T_print,
vlm3df79662004-06-28 21:13:22 +0000181 T_constraint,
182 T_decode_ber,
183 T_encode_der,
vlm39ba4c42004-09-22 16:06:28 +0000184 0, /* Not implemented yet */
185 T_encode_xer,
vlm3df79662004-06-28 21:13:22 +0000186 0, /* Use generic outmost tag fetcher */
vlm02296432004-09-29 13:19:37 +0000187 asn_DEF_T_tags,
188 sizeof(asn_DEF_T_tags)
189 /sizeof(asn_DEF_T_tags[0]) - 1, /* 1 */
190 asn_DEF_T_tags, /* Same as above */
191 sizeof(asn_DEF_T_tags)
192 /sizeof(asn_DEF_T_tags[0]), /* 2 */
vlm21e46002004-08-20 13:36:32 +0000193 0, 0, /* Defined elsewhere */
vlm3df79662004-06-28 21:13:22 +0000194 0 /* No specifics */
195};
196