blob: 6091ff59b489940870fc69edcff2b1a6e1fd75e5 [file] [log] [blame]
Lev Walkin5bbff1e2004-06-28 21:13:22 +00001
Lev Walkinb47ddce2004-08-11 05:25:47 +00002/*** <<< INCLUDES [PrimitiveType] >>> ***/
Lev Walkin5bbff1e2004-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
Lev Walkin5bbff1e2004-06-28 21:13:22 +000011/*** <<< FUNC-DECLS [PrimitiveType] >>> ***/
12
Lev Walkin154aa182004-09-26 13:12:56 +000013/* This type is equivalent to OCTET_STRING */
Lev Walkindfae9752004-09-29 13:19:37 +000014#define asn_DEF_PrimitiveType asn_DEF_OCTET_STRING
Lev Walkin5bbff1e2004-06-28 21:13:22 +000015
Lev Walkin2e3055d2004-08-20 13:36:32 +000016/*** <<< CODE [PrimitiveType] >>> ***/
17
Lev Walkin154aa182004-09-26 13:12:56 +000018/* This type is equivalent to OCTET_STRING */
Lev Walkin5bbff1e2004-06-28 21:13:22 +000019
Lev Walkin5bbff1e2004-06-28 21:13:22 +000020
Lev Walkinb47ddce2004-08-11 05:25:47 +000021/*** <<< INCLUDES [ConstructedType] >>> ***/
Lev Walkin5bbff1e2004-06-28 21:13:22 +000022
Lev Walkin5bbff1e2004-06-28 21:13:22 +000023#include <PrimitiveType.h>
Lev Walkin5bbff1e2004-06-28 21:13:22 +000024#include <constr_SEQUENCE.h>
25
Lev Walkinb47ddce2004-08-11 05:25:47 +000026/*** <<< DEPS [ConstructedType] >>> ***/
27
Lev Walkindfae9752004-09-29 13:19:37 +000028extern asn_TYPE_descriptor_t asn_DEF_ConstructedType;
Lev Walkin5bbff1e2004-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 */
Lev Walkindfae9752004-09-29 13:19:37 +000037 asn_struct_ctx_t _asn_ctx;
Lev Walkin5bbff1e2004-06-28 21:13:22 +000038} ConstructedType_t;
39
40/*** <<< STAT-DEFS [ConstructedType] >>> ***/
41
Lev Walkindfae9752004-09-29 13:19:37 +000042static asn_TYPE_member_t asn_MBR_ConstructedType[] = {
Lev Walkincc93b0f2004-09-10 09:18:20 +000043 { ATF_NOFLAGS, 0, offsetof(struct ConstructedType, field),
Lev Walkin2e3055d2004-08-20 13:36:32 +000044 .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
45 .tag_mode = -1, /* IMPLICIT tag at current level */
Lev Walkindfae9752004-09-29 13:19:37 +000046 .type = (void *)&asn_DEF_PrimitiveType,
Lev Walkinba58e1b2005-01-17 12:20:19 +000047 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkin2e3055d2004-08-20 13:36:32 +000048 .name = "field"
Lev Walkin5bbff1e2004-06-28 21:13:22 +000049 },
50};
Lev Walkindfae9752004-09-29 13:19:37 +000051static ber_tlv_tag_t asn_DEF_ConstructedType_tags[] = {
Lev Walkin5bbff1e2004-06-28 21:13:22 +000052 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
53};
Lev Walkindfae9752004-09-29 13:19:37 +000054static asn_TYPE_tag2member_t asn_DEF_ConstructedType_tag2el[] = {
Lev Walkin5bbff1e2004-06-28 21:13:22 +000055 { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 }, /* field at 18 */
56};
Lev Walkindfae9752004-09-29 13:19:37 +000057static asn_SEQUENCE_specifics_t asn_DEF_ConstructedType_specs = {
Lev Walkin5bbff1e2004-06-28 21:13:22 +000058 sizeof(struct ConstructedType),
Lev Walkindfae9752004-09-29 13:19:37 +000059 offsetof(struct ConstructedType, _asn_ctx),
60 asn_DEF_ConstructedType_tag2el,
Lev Walkin5bbff1e2004-06-28 21:13:22 +000061 1, /* Count of tags in the map */
62 -1, /* Start extensions */
63 -1 /* Stop extensions */
64};
Lev Walkindfae9752004-09-29 13:19:37 +000065asn_TYPE_descriptor_t asn_DEF_ConstructedType = {
Lev Walkin5bbff1e2004-06-28 21:13:22 +000066 "ConstructedType",
Lev Walkindc06f6b2004-10-20 15:50:55 +000067 "ConstructedType",
Lev Walkina9cc46e2004-09-22 16:06:28 +000068 SEQUENCE_free,
69 SEQUENCE_print,
Lev Walkin5bbff1e2004-06-28 21:13:22 +000070 SEQUENCE_constraint,
71 SEQUENCE_decode_ber,
72 SEQUENCE_encode_der,
Lev Walkin61b40d82004-10-23 15:07:45 +000073 SEQUENCE_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +000074 SEQUENCE_encode_xer,
Lev Walkin5bbff1e2004-06-28 21:13:22 +000075 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-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,
Lev Walkin2e3055d2004-08-20 13:36:32 +000083 1, /* Elements count */
Lev Walkindfae9752004-09-29 13:19:37 +000084 &asn_DEF_ConstructedType_specs /* Additional specs */
Lev Walkin5bbff1e2004-06-28 21:13:22 +000085};
86
87
Lev Walkinb47ddce2004-08-11 05:25:47 +000088/*** <<< INCLUDES [T] >>> ***/
Lev Walkin5bbff1e2004-06-28 21:13:22 +000089
90#include <ConstructedType.h>
91
92/*** <<< TYPE-DECLS [T] >>> ***/
93
94
95typedef ConstructedType_t T_t;
96
Lev Walkin5bbff1e2004-06-28 21:13:22 +000097/*** <<< FUNC-DECLS [T] >>> ***/
98
Lev Walkindfae9752004-09-29 13:19:37 +000099extern asn_TYPE_descriptor_t asn_DEF_T;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000100asn_struct_free_f T_free;
101asn_struct_print_f T_print;
Lev Walkin5bbff1e2004-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;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000105xer_type_decoder_f T_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000106xer_type_encoder_f T_encode_xer;
Lev Walkin5bbff1e2004-06-28 21:13:22 +0000107
Lev Walkin2e3055d2004-08-20 13:36:32 +0000108/*** <<< CODE [T] >>> ***/
109
110int
Lev Walkindfae9752004-09-29 13:19:37 +0000111T_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin2e3055d2004-08-20 13:36:32 +0000112 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin154aa182004-09-26 13:12:56 +0000113 /* Replace with underlying type checker */
Lev Walkindfae9752004-09-29 13:19:37 +0000114 td->check_constraints = asn_DEF_ConstructedType.check_constraints;
Lev Walkin154aa182004-09-26 13:12:56 +0000115 return td->check_constraints(td, sptr, app_errlog, app_key);
Lev Walkin2e3055d2004-08-20 13:36:32 +0000116}
117
118/*
119 * This type is implemented using ConstructedType,
Lev Walkinc3808c12004-09-23 22:14:58 +0000120 * so here we adjust the DEF accordingly.
Lev Walkin2e3055d2004-08-20 13:36:32 +0000121 */
122static void
Lev Walkindfae9752004-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;
Lev Walkin2e3055d2004-08-20 13:36:32 +0000133}
134
Lev Walkina9cc46e2004-09-22 16:06:28 +0000135void
Lev Walkindfae9752004-09-29 13:19:37 +0000136T_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000137 void *struct_ptr, int contents_only) {
Lev Walkin2e3055d2004-08-20 13:36:32 +0000138 T_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000139 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin2e3055d2004-08-20 13:36:32 +0000140}
141
142int
Lev Walkindfae9752004-09-29 13:19:37 +0000143T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin2e3055d2004-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
Lev Walkindc06f6b2004-10-20 15:50:55 +0000149asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000150T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000151 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin2e3055d2004-08-20 13:36:32 +0000152 T_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000153 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000154}
155
156asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000157T_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-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
Lev Walkin0ebe8b32004-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
Lev Walkina9cc46e2004-09-22 16:06:28 +0000171asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000172T_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-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);
Lev Walkin2e3055d2004-08-20 13:36:32 +0000177}
178
179
Lev Walkin5bbff1e2004-06-28 21:13:22 +0000180/*** <<< STAT-DEFS [T] >>> ***/
181
Lev Walkindfae9752004-09-29 13:19:37 +0000182static ber_tlv_tag_t asn_DEF_T_tags[] = {
Lev Walkin188ed2c2004-09-13 08:31:01 +0000183 (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
184 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
Lev Walkin5bbff1e2004-06-28 21:13:22 +0000185};
Lev Walkindfae9752004-09-29 13:19:37 +0000186asn_TYPE_descriptor_t asn_DEF_T = {
Lev Walkin5bbff1e2004-06-28 21:13:22 +0000187 "T",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000188 "T",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000189 T_free,
190 T_print,
Lev Walkin5bbff1e2004-06-28 21:13:22 +0000191 T_constraint,
192 T_decode_ber,
193 T_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000194 T_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000195 T_encode_xer,
Lev Walkin5bbff1e2004-06-28 21:13:22 +0000196 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-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 */
Lev Walkin2e3055d2004-08-20 13:36:32 +0000203 0, 0, /* Defined elsewhere */
Lev Walkin5bbff1e2004-06-28 21:13:22 +0000204 0 /* No specifics */
205};
206