vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 1 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 2 | /*** <<< INCLUDES [PrimitiveType] >>> ***/ |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 3 | |
| 4 | #include <OCTET_STRING.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [PrimitiveType] >>> ***/ |
| 7 | |
| 8 | |
| 9 | typedef OCTET_STRING_t PrimitiveType_t; |
| 10 | |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 11 | /*** <<< FUNC-DECLS [PrimitiveType] >>> ***/ |
| 12 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 13 | /* This type is equivalent to OCTET_STRING */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 14 | #define asn_DEF_PrimitiveType asn_DEF_OCTET_STRING |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 15 | |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 16 | /*** <<< CODE [PrimitiveType] >>> ***/ |
| 17 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 18 | /* This type is equivalent to OCTET_STRING */ |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 19 | |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 20 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 21 | /*** <<< INCLUDES [ConstructedType] >>> ***/ |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 22 | |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 23 | #include <PrimitiveType.h> |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 24 | #include <constr_SEQUENCE.h> |
| 25 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 26 | /*** <<< DEPS [ConstructedType] >>> ***/ |
| 27 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 28 | extern asn_TYPE_descriptor_t asn_DEF_ConstructedType; |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 29 | |
| 30 | /*** <<< TYPE-DECLS [ConstructedType] >>> ***/ |
| 31 | |
| 32 | |
| 33 | typedef struct ConstructedType { |
| 34 | PrimitiveType_t field; |
| 35 | |
| 36 | /* Context for parsing across buffer boundaries */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 37 | asn_struct_ctx_t _asn_ctx; |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 38 | } ConstructedType_t; |
| 39 | |
| 40 | /*** <<< STAT-DEFS [ConstructedType] >>> ***/ |
| 41 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 42 | static asn_TYPE_member_t asn_MBR_ConstructedType[] = { |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 43 | { ATF_NOFLAGS, 0, offsetof(struct ConstructedType, field), |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 44 | .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)), |
| 45 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 46 | .type = (void *)&asn_DEF_PrimitiveType, |
vlm | 0a9af51 | 2005-01-17 12:20:19 +0000 | [diff] [blame] | 47 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 48 | .name = "field" |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 49 | }, |
| 50 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 51 | static ber_tlv_tag_t asn_DEF_ConstructedType_tags[] = { |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 52 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 53 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 54 | static asn_TYPE_tag2member_t asn_DEF_ConstructedType_tag2el[] = { |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 55 | { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 }, /* field at 18 */ |
| 56 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 57 | static asn_SEQUENCE_specifics_t asn_DEF_ConstructedType_specs = { |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 58 | sizeof(struct ConstructedType), |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 59 | offsetof(struct ConstructedType, _asn_ctx), |
| 60 | asn_DEF_ConstructedType_tag2el, |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 61 | 1, /* Count of tags in the map */ |
| 62 | -1, /* Start extensions */ |
| 63 | -1 /* Stop extensions */ |
| 64 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 65 | asn_TYPE_descriptor_t asn_DEF_ConstructedType = { |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 66 | "ConstructedType", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 67 | "ConstructedType", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 68 | SEQUENCE_free, |
| 69 | SEQUENCE_print, |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 70 | SEQUENCE_constraint, |
| 71 | SEQUENCE_decode_ber, |
| 72 | SEQUENCE_encode_der, |
vlm | 2dbab7c | 2004-10-23 15:07:45 +0000 | [diff] [blame] | 73 | SEQUENCE_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 74 | SEQUENCE_encode_xer, |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 75 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 76 | 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, |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 83 | 1, /* Elements count */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 84 | &asn_DEF_ConstructedType_specs /* Additional specs */ |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 88 | /*** <<< INCLUDES [T] >>> ***/ |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 89 | |
| 90 | #include <ConstructedType.h> |
| 91 | |
| 92 | /*** <<< TYPE-DECLS [T] >>> ***/ |
| 93 | |
| 94 | |
| 95 | typedef ConstructedType_t T_t; |
| 96 | |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 97 | /*** <<< FUNC-DECLS [T] >>> ***/ |
| 98 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 99 | extern asn_TYPE_descriptor_t asn_DEF_T; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 100 | asn_struct_free_f T_free; |
| 101 | asn_struct_print_f T_print; |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 102 | asn_constr_check_f T_constraint; |
| 103 | ber_type_decoder_f T_decode_ber; |
| 104 | der_type_encoder_f T_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 105 | xer_type_decoder_f T_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 106 | xer_type_encoder_f T_encode_xer; |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 107 | |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 108 | /*** <<< CODE [T] >>> ***/ |
| 109 | |
| 110 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 111 | T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 112 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 113 | /* Replace with underlying type checker */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 114 | td->check_constraints = asn_DEF_ConstructedType.check_constraints; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 115 | return td->check_constraints(td, sptr, app_errlog, app_key); |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | /* |
| 119 | * This type is implemented using ConstructedType, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 120 | * so here we adjust the DEF accordingly. |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 121 | */ |
| 122 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 123 | T_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; |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 133 | } |
| 134 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 135 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 136 | T_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 137 | void *struct_ptr, int contents_only) { |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 138 | T_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 139 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 143 | T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 144 | 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 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 149 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 150 | T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 151 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 152 | T_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 153 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 157 | T_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 158 | 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 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 164 | asn_dec_rval_t |
| 165 | T_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 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 171 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 172 | T_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 173 | 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); |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 180 | /*** <<< STAT-DEFS [T] >>> ***/ |
| 181 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 182 | static ber_tlv_tag_t asn_DEF_T_tags[] = { |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 183 | (ASN_TAG_CLASS_CONTEXT | (3 << 2)), |
| 184 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 185 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 186 | asn_TYPE_descriptor_t asn_DEF_T = { |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 187 | "T", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 188 | "T", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 189 | T_free, |
| 190 | T_print, |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 191 | T_constraint, |
| 192 | T_decode_ber, |
| 193 | T_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 194 | T_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 195 | T_encode_xer, |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 196 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 197 | 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 */ |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 203 | 0, 0, /* Defined elsewhere */ |
vlm | 3df7966 | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 204 | 0 /* No specifics */ |
| 205 | }; |
| 206 | |