vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Int1] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [Int1] >>> ***/ |
| 7 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 8 | typedef INTEGER_t Int1_t; |
| 9 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 10 | /*** <<< FUNC-DECLS [Int1] >>> ***/ |
| 11 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 12 | extern asn_TYPE_descriptor_t asn_DEF_Int1; |
| 13 | asn_struct_free_f Int1_free; |
| 14 | asn_struct_print_f Int1_print; |
| 15 | asn_constr_check_f Int1_constraint; |
| 16 | ber_type_decoder_f Int1_decode_ber; |
| 17 | der_type_encoder_f Int1_encode_der; |
| 18 | xer_type_decoder_f Int1_decode_xer; |
| 19 | xer_type_encoder_f Int1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 20 | |
| 21 | /*** <<< CODE [Int1] >>> ***/ |
| 22 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 23 | int |
| 24 | Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 25 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 26 | /* Replace with underlying type checker */ |
| 27 | td->check_constraints = asn_DEF_INTEGER.check_constraints; |
| 28 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 29 | } |
| 30 | |
| 31 | /* |
| 32 | * This type is implemented using INTEGER, |
| 33 | * so here we adjust the DEF accordingly. |
| 34 | */ |
| 35 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 36 | Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 37 | td->free_struct = asn_DEF_INTEGER.free_struct; |
| 38 | td->print_struct = asn_DEF_INTEGER.print_struct; |
| 39 | td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 40 | td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 41 | td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 42 | td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 43 | td->uper_decoder = asn_DEF_INTEGER.uper_decoder; |
| 44 | if(!td->per_constraints) |
| 45 | td->per_constraints = asn_DEF_INTEGER.per_constraints; |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 46 | td->elements = asn_DEF_INTEGER.elements; |
| 47 | td->elements_count = asn_DEF_INTEGER.elements_count; |
| 48 | td->specifics = asn_DEF_INTEGER.specifics; |
| 49 | } |
| 50 | |
| 51 | void |
| 52 | Int1_free(asn_TYPE_descriptor_t *td, |
| 53 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 54 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 55 | td->free_struct(td, struct_ptr, contents_only); |
| 56 | } |
| 57 | |
| 58 | int |
| 59 | Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 60 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 61 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 62 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 63 | } |
| 64 | |
| 65 | asn_dec_rval_t |
| 66 | Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 67 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 68 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 69 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 70 | } |
| 71 | |
| 72 | asn_enc_rval_t |
| 73 | Int1_encode_der(asn_TYPE_descriptor_t *td, |
| 74 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 75 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 76 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 77 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 78 | } |
| 79 | |
| 80 | asn_dec_rval_t |
| 81 | Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 82 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 83 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 84 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 85 | } |
| 86 | |
| 87 | asn_enc_rval_t |
| 88 | Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 89 | int ilevel, enum xer_encoder_flags_e flags, |
| 90 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 91 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 92 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 93 | } |
| 94 | |
| 95 | |
| 96 | /*** <<< STAT-DEFS [Int1] >>> ***/ |
| 97 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 98 | static ber_tlv_tag_t asn_DEF_Int1_tags_1[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 99 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 100 | }; |
| 101 | asn_TYPE_descriptor_t asn_DEF_Int1 = { |
| 102 | "Int1", |
| 103 | "Int1", |
| 104 | Int1_free, |
| 105 | Int1_print, |
| 106 | Int1_constraint, |
| 107 | Int1_decode_ber, |
| 108 | Int1_encode_der, |
| 109 | Int1_decode_xer, |
| 110 | Int1_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 111 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 112 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 113 | asn_DEF_Int1_tags_1, |
| 114 | sizeof(asn_DEF_Int1_tags_1) |
| 115 | /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ |
| 116 | asn_DEF_Int1_tags_1, /* Same as above */ |
| 117 | sizeof(asn_DEF_Int1_tags_1) |
| 118 | /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ |
| 119 | 0, /* No PER visible constraints */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 120 | 0, 0, /* No members */ |
| 121 | 0 /* No specifics */ |
| 122 | }; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 123 | |
| 124 | |
| 125 | /*** <<< INCLUDES [Int2] >>> ***/ |
| 126 | |
| 127 | #include <Int1.h> |
| 128 | |
| 129 | /*** <<< TYPE-DECLS [Int2] >>> ***/ |
| 130 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 131 | typedef Int1_t Int2_t; |
| 132 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 133 | /*** <<< FUNC-DECLS [Int2] >>> ***/ |
| 134 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 135 | extern asn_TYPE_descriptor_t asn_DEF_Int2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 136 | asn_struct_free_f Int2_free; |
| 137 | asn_struct_print_f Int2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 138 | asn_constr_check_f Int2_constraint; |
| 139 | ber_type_decoder_f Int2_decode_ber; |
| 140 | der_type_encoder_f Int2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 141 | xer_type_decoder_f Int2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 142 | xer_type_encoder_f Int2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 143 | |
| 144 | /*** <<< CODE [Int2] >>> ***/ |
| 145 | |
| 146 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 147 | Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 148 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 149 | const Int1_t *st = (const Int1_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 150 | long value; |
| 151 | |
| 152 | if(!sptr) { |
| 153 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 154 | "%s: value not given (%s:%d)", |
| 155 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 156 | return -1; |
| 157 | } |
| 158 | |
vlm | 34ce8ad | 2004-09-07 06:43:57 +0000 | [diff] [blame] | 159 | /* Check if the sign bit is present */ |
| 160 | value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 161 | |
| 162 | if((value >= 0)) { |
| 163 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 164 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 165 | } else { |
| 166 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 167 | "%s: constraint failed (%s:%d)", |
| 168 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 169 | return -1; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /* |
| 174 | * This type is implemented using Int1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 175 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 176 | */ |
| 177 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 178 | Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 179 | td->free_struct = asn_DEF_Int1.free_struct; |
| 180 | td->print_struct = asn_DEF_Int1.print_struct; |
| 181 | td->ber_decoder = asn_DEF_Int1.ber_decoder; |
| 182 | td->der_encoder = asn_DEF_Int1.der_encoder; |
| 183 | td->xer_decoder = asn_DEF_Int1.xer_decoder; |
| 184 | td->xer_encoder = asn_DEF_Int1.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 185 | td->uper_decoder = asn_DEF_Int1.uper_decoder; |
| 186 | if(!td->per_constraints) |
| 187 | td->per_constraints = asn_DEF_Int1.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 188 | td->elements = asn_DEF_Int1.elements; |
| 189 | td->elements_count = asn_DEF_Int1.elements_count; |
| 190 | td->specifics = asn_DEF_Int1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 191 | } |
| 192 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 193 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 194 | Int2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 195 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 196 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 197 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 201 | Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 202 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 203 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 204 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 205 | } |
| 206 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 207 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 208 | Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 209 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 210 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 211 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 215 | Int2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 216 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 217 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 218 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 219 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 220 | } |
| 221 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 222 | asn_dec_rval_t |
| 223 | Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 224 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 225 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 226 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 227 | } |
| 228 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 229 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 230 | Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 231 | int ilevel, enum xer_encoder_flags_e flags, |
| 232 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 233 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 234 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | |
| 238 | /*** <<< STAT-DEFS [Int2] >>> ***/ |
| 239 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 240 | static ber_tlv_tag_t asn_DEF_Int2_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 241 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 242 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 243 | asn_TYPE_descriptor_t asn_DEF_Int2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 244 | "Int2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 245 | "Int2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 246 | Int2_free, |
| 247 | Int2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 248 | Int2_constraint, |
| 249 | Int2_decode_ber, |
| 250 | Int2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 251 | Int2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 252 | Int2_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 253 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 254 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 255 | asn_DEF_Int2_tags_1, |
| 256 | sizeof(asn_DEF_Int2_tags_1) |
| 257 | /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ |
| 258 | asn_DEF_Int2_tags_1, /* Same as above */ |
| 259 | sizeof(asn_DEF_Int2_tags_1) |
| 260 | /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ |
| 261 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 262 | 0, 0, /* No members */ |
| 263 | 0 /* No specifics */ |
| 264 | }; |
| 265 | |
| 266 | |
| 267 | /*** <<< INCLUDES [Int3] >>> ***/ |
| 268 | |
| 269 | #include <Int2.h> |
| 270 | |
| 271 | /*** <<< TYPE-DECLS [Int3] >>> ***/ |
| 272 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 273 | typedef Int2_t Int3_t; |
| 274 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 275 | /*** <<< FUNC-DECLS [Int3] >>> ***/ |
| 276 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 277 | extern asn_TYPE_descriptor_t asn_DEF_Int3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 278 | asn_struct_free_f Int3_free; |
| 279 | asn_struct_print_f Int3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 280 | asn_constr_check_f Int3_constraint; |
| 281 | ber_type_decoder_f Int3_decode_ber; |
| 282 | der_type_encoder_f Int3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 283 | xer_type_decoder_f Int3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 284 | xer_type_encoder_f Int3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 285 | |
| 286 | /*** <<< CODE [Int3] >>> ***/ |
| 287 | |
| 288 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 289 | Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 290 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 291 | const Int2_t *st = (const Int2_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 292 | long value; |
| 293 | |
| 294 | if(!sptr) { |
| 295 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 296 | "%s: value not given (%s:%d)", |
| 297 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 298 | return -1; |
| 299 | } |
| 300 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 301 | if(asn_INTEGER2long(st, &value)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 302 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 303 | "%s: value too large (%s:%d)", |
| 304 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 305 | return -1; |
| 306 | } |
| 307 | |
| 308 | if((value >= 0 && value <= 10)) { |
| 309 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 310 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 311 | } else { |
| 312 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 313 | "%s: constraint failed (%s:%d)", |
| 314 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 315 | return -1; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | /* |
| 320 | * This type is implemented using Int2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 321 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 322 | */ |
| 323 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 324 | Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 325 | td->free_struct = asn_DEF_Int2.free_struct; |
| 326 | td->print_struct = asn_DEF_Int2.print_struct; |
| 327 | td->ber_decoder = asn_DEF_Int2.ber_decoder; |
| 328 | td->der_encoder = asn_DEF_Int2.der_encoder; |
| 329 | td->xer_decoder = asn_DEF_Int2.xer_decoder; |
| 330 | td->xer_encoder = asn_DEF_Int2.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 331 | td->uper_decoder = asn_DEF_Int2.uper_decoder; |
| 332 | if(!td->per_constraints) |
| 333 | td->per_constraints = asn_DEF_Int2.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 334 | td->elements = asn_DEF_Int2.elements; |
| 335 | td->elements_count = asn_DEF_Int2.elements_count; |
| 336 | td->specifics = asn_DEF_Int2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 337 | } |
| 338 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 339 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 340 | Int3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 341 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 342 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 343 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 347 | Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 348 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 349 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 350 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 351 | } |
| 352 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 353 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 354 | Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 355 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 356 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 357 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 361 | Int3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 362 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 363 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 364 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 365 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 366 | } |
| 367 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 368 | asn_dec_rval_t |
| 369 | Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 370 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 371 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 372 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 373 | } |
| 374 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 375 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 376 | Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 377 | int ilevel, enum xer_encoder_flags_e flags, |
| 378 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 379 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 380 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | |
| 384 | /*** <<< STAT-DEFS [Int3] >>> ***/ |
| 385 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 386 | static ber_tlv_tag_t asn_DEF_Int3_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 387 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 388 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 389 | asn_TYPE_descriptor_t asn_DEF_Int3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 390 | "Int3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 391 | "Int3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 392 | Int3_free, |
| 393 | Int3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 394 | Int3_constraint, |
| 395 | Int3_decode_ber, |
| 396 | Int3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 397 | Int3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 398 | Int3_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 399 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 400 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 401 | asn_DEF_Int3_tags_1, |
| 402 | sizeof(asn_DEF_Int3_tags_1) |
| 403 | /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ |
| 404 | asn_DEF_Int3_tags_1, /* Same as above */ |
| 405 | sizeof(asn_DEF_Int3_tags_1) |
| 406 | /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ |
| 407 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 408 | 0, 0, /* No members */ |
| 409 | 0 /* No specifics */ |
| 410 | }; |
| 411 | |
| 412 | |
| 413 | /*** <<< INCLUDES [Int4] >>> ***/ |
| 414 | |
| 415 | #include <Int3.h> |
| 416 | |
| 417 | /*** <<< TYPE-DECLS [Int4] >>> ***/ |
| 418 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 419 | typedef Int3_t Int4_t; |
| 420 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 421 | /*** <<< FUNC-DECLS [Int4] >>> ***/ |
| 422 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 423 | extern asn_TYPE_descriptor_t asn_DEF_Int4; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 424 | asn_struct_free_f Int4_free; |
| 425 | asn_struct_print_f Int4_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 426 | asn_constr_check_f Int4_constraint; |
| 427 | ber_type_decoder_f Int4_decode_ber; |
| 428 | der_type_encoder_f Int4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 429 | xer_type_decoder_f Int4_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 430 | xer_type_encoder_f Int4_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 431 | |
| 432 | /*** <<< CODE [Int4] >>> ***/ |
| 433 | |
| 434 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 435 | Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 436 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 437 | const Int3_t *st = (const Int3_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 438 | long value; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 439 | |
| 440 | if(!sptr) { |
| 441 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 442 | "%s: value not given (%s:%d)", |
| 443 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 444 | return -1; |
| 445 | } |
| 446 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 447 | if(asn_INTEGER2long(st, &value)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 448 | _ASN_ERRLOG(app_errlog, app_key, |
| 449 | "%s: value too large (%s:%d)", |
| 450 | td->name, __FILE__, __LINE__); |
| 451 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 452 | } |
| 453 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 454 | if((value >= 1 && value <= 10)) { |
| 455 | /* Constraint check succeeded */ |
| 456 | return 0; |
| 457 | } else { |
| 458 | _ASN_ERRLOG(app_errlog, app_key, |
| 459 | "%s: constraint failed (%s:%d)", |
| 460 | td->name, __FILE__, __LINE__); |
| 461 | return -1; |
| 462 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 463 | } |
| 464 | |
| 465 | /* |
| 466 | * This type is implemented using Int3, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 467 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 468 | */ |
| 469 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 470 | Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 471 | td->free_struct = asn_DEF_Int3.free_struct; |
| 472 | td->print_struct = asn_DEF_Int3.print_struct; |
| 473 | td->ber_decoder = asn_DEF_Int3.ber_decoder; |
| 474 | td->der_encoder = asn_DEF_Int3.der_encoder; |
| 475 | td->xer_decoder = asn_DEF_Int3.xer_decoder; |
| 476 | td->xer_encoder = asn_DEF_Int3.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 477 | td->uper_decoder = asn_DEF_Int3.uper_decoder; |
| 478 | if(!td->per_constraints) |
| 479 | td->per_constraints = asn_DEF_Int3.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 480 | td->elements = asn_DEF_Int3.elements; |
| 481 | td->elements_count = asn_DEF_Int3.elements_count; |
| 482 | td->specifics = asn_DEF_Int3.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 483 | } |
| 484 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 485 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 486 | Int4_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 487 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 488 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 489 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 493 | Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 494 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 495 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 496 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 497 | } |
| 498 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 499 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 500 | Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 501 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 502 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 503 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 504 | } |
| 505 | |
| 506 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 507 | Int4_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 508 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 509 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 510 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 511 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 512 | } |
| 513 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 514 | asn_dec_rval_t |
| 515 | Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 516 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 517 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 518 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 519 | } |
| 520 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 521 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 522 | Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 523 | int ilevel, enum xer_encoder_flags_e flags, |
| 524 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 525 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 526 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 527 | } |
| 528 | |
| 529 | |
| 530 | /*** <<< STAT-DEFS [Int4] >>> ***/ |
| 531 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 532 | static ber_tlv_tag_t asn_DEF_Int4_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 533 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 534 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 535 | asn_TYPE_descriptor_t asn_DEF_Int4 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 536 | "Int4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 537 | "Int4", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 538 | Int4_free, |
| 539 | Int4_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 540 | Int4_constraint, |
| 541 | Int4_decode_ber, |
| 542 | Int4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 543 | Int4_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 544 | Int4_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 545 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 546 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 547 | asn_DEF_Int4_tags_1, |
| 548 | sizeof(asn_DEF_Int4_tags_1) |
| 549 | /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ |
| 550 | asn_DEF_Int4_tags_1, /* Same as above */ |
| 551 | sizeof(asn_DEF_Int4_tags_1) |
| 552 | /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ |
| 553 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 554 | 0, 0, /* No members */ |
| 555 | 0 /* No specifics */ |
| 556 | }; |
| 557 | |
| 558 | |
| 559 | /*** <<< INCLUDES [Int5] >>> ***/ |
| 560 | |
| 561 | #include <Int4.h> |
| 562 | |
| 563 | /*** <<< TYPE-DECLS [Int5] >>> ***/ |
| 564 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 565 | typedef Int4_t Int5_t; |
| 566 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 567 | /*** <<< FUNC-DECLS [Int5] >>> ***/ |
| 568 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 569 | extern asn_TYPE_descriptor_t asn_DEF_Int5; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 570 | asn_struct_free_f Int5_free; |
| 571 | asn_struct_print_f Int5_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 572 | asn_constr_check_f Int5_constraint; |
| 573 | ber_type_decoder_f Int5_decode_ber; |
| 574 | der_type_encoder_f Int5_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 575 | xer_type_decoder_f Int5_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 576 | xer_type_encoder_f Int5_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 577 | |
| 578 | /*** <<< CODE [Int5] >>> ***/ |
| 579 | |
| 580 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 581 | Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 582 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 583 | const Int4_t *st = (const Int4_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 584 | long value; |
| 585 | |
| 586 | if(!sptr) { |
| 587 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 588 | "%s: value not given (%s:%d)", |
| 589 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 590 | return -1; |
| 591 | } |
| 592 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 593 | if(asn_INTEGER2long(st, &value)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 594 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 595 | "%s: value too large (%s:%d)", |
| 596 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 597 | return -1; |
| 598 | } |
| 599 | |
| 600 | if((value == 5)) { |
| 601 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 602 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 603 | } else { |
| 604 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 605 | "%s: constraint failed (%s:%d)", |
| 606 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 607 | return -1; |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | /* |
| 612 | * This type is implemented using Int4, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 613 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 614 | */ |
| 615 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 616 | Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 617 | td->free_struct = asn_DEF_Int4.free_struct; |
| 618 | td->print_struct = asn_DEF_Int4.print_struct; |
| 619 | td->ber_decoder = asn_DEF_Int4.ber_decoder; |
| 620 | td->der_encoder = asn_DEF_Int4.der_encoder; |
| 621 | td->xer_decoder = asn_DEF_Int4.xer_decoder; |
| 622 | td->xer_encoder = asn_DEF_Int4.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 623 | td->uper_decoder = asn_DEF_Int4.uper_decoder; |
| 624 | if(!td->per_constraints) |
| 625 | td->per_constraints = asn_DEF_Int4.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 626 | td->elements = asn_DEF_Int4.elements; |
| 627 | td->elements_count = asn_DEF_Int4.elements_count; |
| 628 | td->specifics = asn_DEF_Int4.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 629 | } |
| 630 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 631 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 632 | Int5_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 633 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 634 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 635 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 639 | Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 640 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 641 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 642 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 643 | } |
| 644 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 645 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 646 | Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 647 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 648 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 649 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 650 | } |
| 651 | |
| 652 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 653 | Int5_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 654 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 655 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 656 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 657 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 658 | } |
| 659 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 660 | asn_dec_rval_t |
| 661 | Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 662 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 663 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 664 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 665 | } |
| 666 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 667 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 668 | Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 669 | int ilevel, enum xer_encoder_flags_e flags, |
| 670 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 671 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 672 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | |
| 676 | /*** <<< STAT-DEFS [Int5] >>> ***/ |
| 677 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 678 | static ber_tlv_tag_t asn_DEF_Int5_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 679 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 680 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 681 | asn_TYPE_descriptor_t asn_DEF_Int5 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 682 | "Int5", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 683 | "Int5", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 684 | Int5_free, |
| 685 | Int5_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 686 | Int5_constraint, |
| 687 | Int5_decode_ber, |
| 688 | Int5_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 689 | Int5_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 690 | Int5_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 691 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 692 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 693 | asn_DEF_Int5_tags_1, |
| 694 | sizeof(asn_DEF_Int5_tags_1) |
| 695 | /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ |
| 696 | asn_DEF_Int5_tags_1, /* Same as above */ |
| 697 | sizeof(asn_DEF_Int5_tags_1) |
| 698 | /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ |
| 699 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 700 | 0, 0, /* No members */ |
| 701 | 0 /* No specifics */ |
| 702 | }; |
| 703 | |
| 704 | |
| 705 | /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ |
| 706 | |
| 707 | #include <INTEGER.h> |
| 708 | |
| 709 | /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ |
| 710 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 711 | typedef INTEGER_t ExtensibleExtensions_t; |
| 712 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 713 | /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ |
| 714 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 715 | extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 716 | asn_struct_free_f ExtensibleExtensions_free; |
| 717 | asn_struct_print_f ExtensibleExtensions_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 718 | asn_constr_check_f ExtensibleExtensions_constraint; |
| 719 | ber_type_decoder_f ExtensibleExtensions_decode_ber; |
| 720 | der_type_encoder_f ExtensibleExtensions_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 721 | xer_type_decoder_f ExtensibleExtensions_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 722 | xer_type_encoder_f ExtensibleExtensions_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 723 | |
| 724 | /*** <<< CODE [ExtensibleExtensions] >>> ***/ |
| 725 | |
| 726 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 727 | ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 728 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 729 | const INTEGER_t *st = (const INTEGER_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 730 | long value; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 731 | |
| 732 | if(!sptr) { |
| 733 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 734 | "%s: value not given (%s:%d)", |
| 735 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 736 | return -1; |
| 737 | } |
| 738 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 739 | if(asn_INTEGER2long(st, &value)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 740 | _ASN_ERRLOG(app_errlog, app_key, |
| 741 | "%s: value too large (%s:%d)", |
| 742 | td->name, __FILE__, __LINE__); |
| 743 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 744 | } |
| 745 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 746 | if((value >= 1 && value <= 256)) { |
| 747 | /* Constraint check succeeded */ |
| 748 | return 0; |
| 749 | } else { |
| 750 | _ASN_ERRLOG(app_errlog, app_key, |
| 751 | "%s: constraint failed (%s:%d)", |
| 752 | td->name, __FILE__, __LINE__); |
| 753 | return -1; |
| 754 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 755 | } |
| 756 | |
| 757 | /* |
| 758 | * This type is implemented using INTEGER, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 759 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 760 | */ |
| 761 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 762 | ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 763 | td->free_struct = asn_DEF_INTEGER.free_struct; |
| 764 | td->print_struct = asn_DEF_INTEGER.print_struct; |
| 765 | td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 766 | td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 767 | td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 768 | td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 769 | td->uper_decoder = asn_DEF_INTEGER.uper_decoder; |
| 770 | if(!td->per_constraints) |
| 771 | td->per_constraints = asn_DEF_INTEGER.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 772 | td->elements = asn_DEF_INTEGER.elements; |
| 773 | td->elements_count = asn_DEF_INTEGER.elements_count; |
| 774 | td->specifics = asn_DEF_INTEGER.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 775 | } |
| 776 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 777 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 778 | ExtensibleExtensions_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 779 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 780 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 781 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 785 | ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 786 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 787 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 788 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 789 | } |
| 790 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 791 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 792 | ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 793 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 794 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 795 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 796 | } |
| 797 | |
| 798 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 799 | ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 800 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 801 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 802 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 803 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 804 | } |
| 805 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 806 | asn_dec_rval_t |
| 807 | ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 808 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 809 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 810 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 811 | } |
| 812 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 813 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 814 | ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 815 | int ilevel, enum xer_encoder_flags_e flags, |
| 816 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 817 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 818 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 819 | } |
| 820 | |
| 821 | |
| 822 | /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ |
| 823 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 824 | static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 825 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 826 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 827 | asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 828 | "ExtensibleExtensions", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 829 | "ExtensibleExtensions", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 830 | ExtensibleExtensions_free, |
| 831 | ExtensibleExtensions_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 832 | ExtensibleExtensions_constraint, |
| 833 | ExtensibleExtensions_decode_ber, |
| 834 | ExtensibleExtensions_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 835 | ExtensibleExtensions_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 836 | ExtensibleExtensions_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 837 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 838 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 839 | asn_DEF_ExtensibleExtensions_tags_1, |
| 840 | sizeof(asn_DEF_ExtensibleExtensions_tags_1) |
| 841 | /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ |
| 842 | asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */ |
| 843 | sizeof(asn_DEF_ExtensibleExtensions_tags_1) |
| 844 | /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ |
| 845 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 846 | 0, 0, /* No members */ |
| 847 | 0 /* No specifics */ |
| 848 | }; |
| 849 | |
| 850 | |
| 851 | /*** <<< INCLUDES [Str1] >>> ***/ |
| 852 | |
| 853 | #include <IA5String.h> |
| 854 | |
| 855 | /*** <<< TYPE-DECLS [Str1] >>> ***/ |
| 856 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 857 | typedef IA5String_t Str1_t; |
| 858 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 859 | /*** <<< FUNC-DECLS [Str1] >>> ***/ |
| 860 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 861 | extern asn_TYPE_descriptor_t asn_DEF_Str1; |
| 862 | asn_struct_free_f Str1_free; |
| 863 | asn_struct_print_f Str1_print; |
| 864 | asn_constr_check_f Str1_constraint; |
| 865 | ber_type_decoder_f Str1_decode_ber; |
| 866 | der_type_encoder_f Str1_encode_der; |
| 867 | xer_type_decoder_f Str1_decode_xer; |
| 868 | xer_type_encoder_f Str1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 869 | |
| 870 | /*** <<< CODE [Str1] >>> ***/ |
| 871 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 872 | int |
| 873 | Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 874 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 875 | /* Replace with underlying type checker */ |
| 876 | td->check_constraints = asn_DEF_IA5String.check_constraints; |
| 877 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 878 | } |
| 879 | |
| 880 | /* |
| 881 | * This type is implemented using IA5String, |
| 882 | * so here we adjust the DEF accordingly. |
| 883 | */ |
| 884 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 885 | Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 886 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 887 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 888 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 889 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 890 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 891 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 892 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
| 893 | if(!td->per_constraints) |
| 894 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 895 | td->elements = asn_DEF_IA5String.elements; |
| 896 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 897 | td->specifics = asn_DEF_IA5String.specifics; |
| 898 | } |
| 899 | |
| 900 | void |
| 901 | Str1_free(asn_TYPE_descriptor_t *td, |
| 902 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 903 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 904 | td->free_struct(td, struct_ptr, contents_only); |
| 905 | } |
| 906 | |
| 907 | int |
| 908 | Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 909 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 910 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 911 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 912 | } |
| 913 | |
| 914 | asn_dec_rval_t |
| 915 | Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 916 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 917 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 918 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 919 | } |
| 920 | |
| 921 | asn_enc_rval_t |
| 922 | Str1_encode_der(asn_TYPE_descriptor_t *td, |
| 923 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 924 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 925 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 926 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 927 | } |
| 928 | |
| 929 | asn_dec_rval_t |
| 930 | Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 931 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 932 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 933 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 934 | } |
| 935 | |
| 936 | asn_enc_rval_t |
| 937 | Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 938 | int ilevel, enum xer_encoder_flags_e flags, |
| 939 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 940 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 941 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 942 | } |
| 943 | |
| 944 | |
| 945 | /*** <<< STAT-DEFS [Str1] >>> ***/ |
| 946 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 947 | static ber_tlv_tag_t asn_DEF_Str1_tags_1[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 948 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 949 | }; |
| 950 | asn_TYPE_descriptor_t asn_DEF_Str1 = { |
| 951 | "Str1", |
| 952 | "Str1", |
| 953 | Str1_free, |
| 954 | Str1_print, |
| 955 | Str1_constraint, |
| 956 | Str1_decode_ber, |
| 957 | Str1_encode_der, |
| 958 | Str1_decode_xer, |
| 959 | Str1_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 960 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 961 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 962 | asn_DEF_Str1_tags_1, |
| 963 | sizeof(asn_DEF_Str1_tags_1) |
| 964 | /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ |
| 965 | asn_DEF_Str1_tags_1, /* Same as above */ |
| 966 | sizeof(asn_DEF_Str1_tags_1) |
| 967 | /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ |
| 968 | 0, /* No PER visible constraints */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 969 | 0, 0, /* No members */ |
| 970 | 0 /* No specifics */ |
| 971 | }; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 972 | |
| 973 | |
| 974 | /*** <<< INCLUDES [Str2] >>> ***/ |
| 975 | |
| 976 | #include <Str1.h> |
| 977 | |
| 978 | /*** <<< TYPE-DECLS [Str2] >>> ***/ |
| 979 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 980 | typedef Str1_t Str2_t; |
| 981 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 982 | /*** <<< FUNC-DECLS [Str2] >>> ***/ |
| 983 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 984 | extern asn_TYPE_descriptor_t asn_DEF_Str2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 985 | asn_struct_free_f Str2_free; |
| 986 | asn_struct_print_f Str2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 987 | asn_constr_check_f Str2_constraint; |
| 988 | ber_type_decoder_f Str2_decode_ber; |
| 989 | der_type_encoder_f Str2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 990 | xer_type_decoder_f Str2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 991 | xer_type_encoder_f Str2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 992 | |
| 993 | /*** <<< CTABLES [Str2] >>> ***/ |
| 994 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 995 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 996 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 997 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 998 | const uint8_t *ch = st->buf; |
| 999 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1000 | |
| 1001 | for(; ch < end; ch++) { |
| 1002 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1003 | if(!(cv <= 127)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1004 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1005 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | |
| 1009 | /*** <<< CODE [Str2] >>> ***/ |
| 1010 | |
| 1011 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1012 | Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1013 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1014 | const Str1_t *st = (const Str1_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1015 | size_t size; |
| 1016 | |
| 1017 | if(!sptr) { |
| 1018 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1019 | "%s: value not given (%s:%d)", |
| 1020 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1021 | return -1; |
| 1022 | } |
| 1023 | |
| 1024 | size = st->size; |
| 1025 | |
| 1026 | if(((size <= 20) || (size >= 25 && size <= 30)) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1027 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1028 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1029 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1030 | } else { |
| 1031 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1032 | "%s: constraint failed (%s:%d)", |
| 1033 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1034 | return -1; |
| 1035 | } |
| 1036 | } |
| 1037 | |
| 1038 | /* |
| 1039 | * This type is implemented using Str1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1040 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1041 | */ |
| 1042 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1043 | Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1044 | td->free_struct = asn_DEF_Str1.free_struct; |
| 1045 | td->print_struct = asn_DEF_Str1.print_struct; |
| 1046 | td->ber_decoder = asn_DEF_Str1.ber_decoder; |
| 1047 | td->der_encoder = asn_DEF_Str1.der_encoder; |
| 1048 | td->xer_decoder = asn_DEF_Str1.xer_decoder; |
| 1049 | td->xer_encoder = asn_DEF_Str1.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1050 | td->uper_decoder = asn_DEF_Str1.uper_decoder; |
| 1051 | if(!td->per_constraints) |
| 1052 | td->per_constraints = asn_DEF_Str1.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1053 | td->elements = asn_DEF_Str1.elements; |
| 1054 | td->elements_count = asn_DEF_Str1.elements_count; |
| 1055 | td->specifics = asn_DEF_Str1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1056 | } |
| 1057 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1058 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1059 | Str2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1060 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1061 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1062 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1063 | } |
| 1064 | |
| 1065 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1066 | Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1067 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1068 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1069 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1070 | } |
| 1071 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1072 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1073 | Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1074 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1075 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1076 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1077 | } |
| 1078 | |
| 1079 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1080 | Str2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1081 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1082 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1083 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1084 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1085 | } |
| 1086 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1087 | asn_dec_rval_t |
| 1088 | Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1089 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1090 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1091 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1092 | } |
| 1093 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1094 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1095 | Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1096 | int ilevel, enum xer_encoder_flags_e flags, |
| 1097 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1098 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1099 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1100 | } |
| 1101 | |
| 1102 | |
| 1103 | /*** <<< STAT-DEFS [Str2] >>> ***/ |
| 1104 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1105 | static ber_tlv_tag_t asn_DEF_Str2_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1106 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1107 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1108 | asn_TYPE_descriptor_t asn_DEF_Str2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1109 | "Str2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1110 | "Str2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1111 | Str2_free, |
| 1112 | Str2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1113 | Str2_constraint, |
| 1114 | Str2_decode_ber, |
| 1115 | Str2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1116 | Str2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1117 | Str2_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1118 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1119 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1120 | asn_DEF_Str2_tags_1, |
| 1121 | sizeof(asn_DEF_Str2_tags_1) |
| 1122 | /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ |
| 1123 | asn_DEF_Str2_tags_1, /* Same as above */ |
| 1124 | sizeof(asn_DEF_Str2_tags_1) |
| 1125 | /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ |
| 1126 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1127 | 0, 0, /* No members */ |
| 1128 | 0 /* No specifics */ |
| 1129 | }; |
| 1130 | |
| 1131 | |
| 1132 | /*** <<< INCLUDES [Str3] >>> ***/ |
| 1133 | |
| 1134 | #include <Str2.h> |
| 1135 | |
| 1136 | /*** <<< TYPE-DECLS [Str3] >>> ***/ |
| 1137 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1138 | typedef Str2_t Str3_t; |
| 1139 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1140 | /*** <<< FUNC-DECLS [Str3] >>> ***/ |
| 1141 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1142 | extern asn_TYPE_descriptor_t asn_DEF_Str3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1143 | asn_struct_free_f Str3_free; |
| 1144 | asn_struct_print_f Str3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1145 | asn_constr_check_f Str3_constraint; |
| 1146 | ber_type_decoder_f Str3_decode_ber; |
| 1147 | der_type_encoder_f Str3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1148 | xer_type_decoder_f Str3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1149 | xer_type_encoder_f Str3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1150 | |
| 1151 | /*** <<< CTABLES [Str3] >>> ***/ |
| 1152 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1153 | static int permitted_alphabet_table_1[256] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1154 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1155 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1156 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1157 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1158 | 0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */ |
| 1159 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1160 | 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */ |
| 1161 | }; |
| 1162 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1163 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1164 | int *table = permitted_alphabet_table_1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1165 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1166 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1167 | const uint8_t *ch = st->buf; |
| 1168 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1169 | |
| 1170 | for(; ch < end; ch++) { |
| 1171 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1172 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1173 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1174 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1175 | } |
| 1176 | |
| 1177 | |
| 1178 | /*** <<< CODE [Str3] >>> ***/ |
| 1179 | |
| 1180 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1181 | Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1182 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1183 | const Str2_t *st = (const Str2_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1184 | size_t size; |
| 1185 | |
| 1186 | if(!sptr) { |
| 1187 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1188 | "%s: value not given (%s:%d)", |
| 1189 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1190 | return -1; |
| 1191 | } |
| 1192 | |
| 1193 | size = st->size; |
| 1194 | |
| 1195 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1196 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1197 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1198 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1199 | } else { |
| 1200 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1201 | "%s: constraint failed (%s:%d)", |
| 1202 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1203 | return -1; |
| 1204 | } |
| 1205 | } |
| 1206 | |
| 1207 | /* |
| 1208 | * This type is implemented using Str2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1209 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1210 | */ |
| 1211 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1212 | Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1213 | td->free_struct = asn_DEF_Str2.free_struct; |
| 1214 | td->print_struct = asn_DEF_Str2.print_struct; |
| 1215 | td->ber_decoder = asn_DEF_Str2.ber_decoder; |
| 1216 | td->der_encoder = asn_DEF_Str2.der_encoder; |
| 1217 | td->xer_decoder = asn_DEF_Str2.xer_decoder; |
| 1218 | td->xer_encoder = asn_DEF_Str2.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1219 | td->uper_decoder = asn_DEF_Str2.uper_decoder; |
| 1220 | if(!td->per_constraints) |
| 1221 | td->per_constraints = asn_DEF_Str2.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1222 | td->elements = asn_DEF_Str2.elements; |
| 1223 | td->elements_count = asn_DEF_Str2.elements_count; |
| 1224 | td->specifics = asn_DEF_Str2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1225 | } |
| 1226 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1227 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1228 | Str3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1229 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1230 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1231 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1232 | } |
| 1233 | |
| 1234 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1235 | Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1236 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1237 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1238 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1239 | } |
| 1240 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1241 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1242 | Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1243 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1244 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1245 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1246 | } |
| 1247 | |
| 1248 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1249 | Str3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1250 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1251 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1252 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1253 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1254 | } |
| 1255 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1256 | asn_dec_rval_t |
| 1257 | Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1258 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1259 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1260 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1261 | } |
| 1262 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1263 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1264 | Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1265 | int ilevel, enum xer_encoder_flags_e flags, |
| 1266 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1267 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1268 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1269 | } |
| 1270 | |
| 1271 | |
| 1272 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1273 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1274 | static ber_tlv_tag_t asn_DEF_Str3_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1275 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1276 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1277 | asn_TYPE_descriptor_t asn_DEF_Str3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1278 | "Str3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1279 | "Str3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1280 | Str3_free, |
| 1281 | Str3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1282 | Str3_constraint, |
| 1283 | Str3_decode_ber, |
| 1284 | Str3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1285 | Str3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1286 | Str3_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1287 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1288 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1289 | asn_DEF_Str3_tags_1, |
| 1290 | sizeof(asn_DEF_Str3_tags_1) |
| 1291 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
| 1292 | asn_DEF_Str3_tags_1, /* Same as above */ |
| 1293 | sizeof(asn_DEF_Str3_tags_1) |
| 1294 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
| 1295 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1296 | 0, 0, /* No members */ |
| 1297 | 0 /* No specifics */ |
| 1298 | }; |
| 1299 | |
| 1300 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1301 | /*** <<< INCLUDES [Str4] >>> ***/ |
| 1302 | |
| 1303 | #include <IA5String.h> |
| 1304 | |
| 1305 | /*** <<< TYPE-DECLS [Str4] >>> ***/ |
| 1306 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1307 | typedef IA5String_t Str4_t; |
| 1308 | |
| 1309 | /*** <<< FUNC-DECLS [Str4] >>> ***/ |
| 1310 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1311 | extern asn_TYPE_descriptor_t asn_DEF_Str4; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1312 | asn_struct_free_f Str4_free; |
| 1313 | asn_struct_print_f Str4_print; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1314 | asn_constr_check_f Str4_constraint; |
| 1315 | ber_type_decoder_f Str4_decode_ber; |
| 1316 | der_type_encoder_f Str4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1317 | xer_type_decoder_f Str4_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1318 | xer_type_encoder_f Str4_encode_xer; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1319 | |
| 1320 | /*** <<< CTABLES [Str4] >>> ***/ |
| 1321 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1322 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1323 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1324 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1325 | const uint8_t *ch = st->buf; |
| 1326 | const uint8_t *end = ch + st->size; |
| 1327 | |
| 1328 | for(; ch < end; ch++) { |
| 1329 | uint8_t cv = *ch; |
| 1330 | if(!(cv <= 127)) return -1; |
| 1331 | } |
| 1332 | return 0; |
| 1333 | } |
| 1334 | |
| 1335 | |
| 1336 | /*** <<< CODE [Str4] >>> ***/ |
| 1337 | |
| 1338 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1339 | Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1340 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1341 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1342 | |
| 1343 | if(!sptr) { |
| 1344 | _ASN_ERRLOG(app_errlog, app_key, |
| 1345 | "%s: value not given (%s:%d)", |
| 1346 | td->name, __FILE__, __LINE__); |
| 1347 | return -1; |
| 1348 | } |
| 1349 | |
| 1350 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1351 | if(!check_permitted_alphabet_1(st)) { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1352 | /* Constraint check succeeded */ |
| 1353 | return 0; |
| 1354 | } else { |
| 1355 | _ASN_ERRLOG(app_errlog, app_key, |
| 1356 | "%s: constraint failed (%s:%d)", |
| 1357 | td->name, __FILE__, __LINE__); |
| 1358 | return -1; |
| 1359 | } |
| 1360 | } |
| 1361 | |
| 1362 | /* |
| 1363 | * This type is implemented using IA5String, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1364 | * so here we adjust the DEF accordingly. |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1365 | */ |
| 1366 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1367 | Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1368 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1369 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1370 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1371 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1372 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1373 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1374 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
| 1375 | if(!td->per_constraints) |
| 1376 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1377 | td->elements = asn_DEF_IA5String.elements; |
| 1378 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1379 | td->specifics = asn_DEF_IA5String.specifics; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1380 | } |
| 1381 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1382 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1383 | Str4_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1384 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1385 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1386 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1387 | } |
| 1388 | |
| 1389 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1390 | Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1391 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1392 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1393 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1394 | } |
| 1395 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1396 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1397 | Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1398 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1399 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1400 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1401 | } |
| 1402 | |
| 1403 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1404 | Str4_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1405 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1406 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1407 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1408 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1409 | } |
| 1410 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1411 | asn_dec_rval_t |
| 1412 | Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1413 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1414 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1415 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1416 | } |
| 1417 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1418 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1419 | Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1420 | int ilevel, enum xer_encoder_flags_e flags, |
| 1421 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1422 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1423 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1424 | } |
| 1425 | |
| 1426 | |
| 1427 | /*** <<< STAT-DEFS [Str4] >>> ***/ |
| 1428 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1429 | static ber_tlv_tag_t asn_DEF_Str4_tags_1[] = { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1430 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1431 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1432 | asn_TYPE_descriptor_t asn_DEF_Str4 = { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1433 | "Str4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1434 | "Str4", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1435 | Str4_free, |
| 1436 | Str4_print, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1437 | Str4_constraint, |
| 1438 | Str4_decode_ber, |
| 1439 | Str4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1440 | Str4_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1441 | Str4_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1442 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1443 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1444 | asn_DEF_Str4_tags_1, |
| 1445 | sizeof(asn_DEF_Str4_tags_1) |
| 1446 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
| 1447 | asn_DEF_Str4_tags_1, /* Same as above */ |
| 1448 | sizeof(asn_DEF_Str4_tags_1) |
| 1449 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
| 1450 | 0, /* No PER visible constraints */ |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1451 | 0, 0, /* No members */ |
| 1452 | 0 /* No specifics */ |
| 1453 | }; |
| 1454 | |
| 1455 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1456 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1457 | |
| 1458 | #include <IA5String.h> |
| 1459 | |
| 1460 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1461 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1462 | typedef IA5String_t PER_Visible_t; |
| 1463 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1464 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1465 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1466 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1467 | asn_struct_free_f PER_Visible_free; |
| 1468 | asn_struct_print_f PER_Visible_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1469 | asn_constr_check_f PER_Visible_constraint; |
| 1470 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1471 | der_type_encoder_f PER_Visible_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1472 | xer_type_decoder_f PER_Visible_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1473 | xer_type_encoder_f PER_Visible_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1474 | |
| 1475 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1476 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1477 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1478 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1479 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1480 | const uint8_t *ch = st->buf; |
| 1481 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1482 | |
| 1483 | for(; ch < end; ch++) { |
| 1484 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1485 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1486 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1487 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1488 | } |
| 1489 | |
| 1490 | |
| 1491 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1492 | |
| 1493 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1494 | PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1495 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1496 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1497 | |
| 1498 | if(!sptr) { |
| 1499 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1500 | "%s: value not given (%s:%d)", |
| 1501 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1502 | return -1; |
| 1503 | } |
| 1504 | |
| 1505 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1506 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1507 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1508 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1509 | } else { |
| 1510 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1511 | "%s: constraint failed (%s:%d)", |
| 1512 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1513 | return -1; |
| 1514 | } |
| 1515 | } |
| 1516 | |
| 1517 | /* |
| 1518 | * This type is implemented using IA5String, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1519 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1520 | */ |
| 1521 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1522 | PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1523 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1524 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1525 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1526 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1527 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1528 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1529 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
| 1530 | if(!td->per_constraints) |
| 1531 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1532 | td->elements = asn_DEF_IA5String.elements; |
| 1533 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1534 | td->specifics = asn_DEF_IA5String.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1535 | } |
| 1536 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1537 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1538 | PER_Visible_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1539 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1540 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1541 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1542 | } |
| 1543 | |
| 1544 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1545 | PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1546 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1547 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1548 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1549 | } |
| 1550 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1551 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1552 | PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1553 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1554 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1555 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1556 | } |
| 1557 | |
| 1558 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1559 | PER_Visible_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1560 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1561 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1562 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1563 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1564 | } |
| 1565 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1566 | asn_dec_rval_t |
| 1567 | PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1568 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1569 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1570 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1571 | } |
| 1572 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1573 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1574 | PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1575 | int ilevel, enum xer_encoder_flags_e flags, |
| 1576 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1577 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1578 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1579 | } |
| 1580 | |
| 1581 | |
| 1582 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1583 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1584 | static ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1585 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1586 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1587 | asn_TYPE_descriptor_t asn_DEF_PER_Visible = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1588 | "PER-Visible", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1589 | "PER-Visible", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1590 | PER_Visible_free, |
| 1591 | PER_Visible_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1592 | PER_Visible_constraint, |
| 1593 | PER_Visible_decode_ber, |
| 1594 | PER_Visible_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1595 | PER_Visible_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1596 | PER_Visible_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1597 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1598 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1599 | asn_DEF_PER_Visible_tags_1, |
| 1600 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1601 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
| 1602 | asn_DEF_PER_Visible_tags_1, /* Same as above */ |
| 1603 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1604 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
| 1605 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1606 | 0, 0, /* No members */ |
| 1607 | 0 /* No specifics */ |
| 1608 | }; |
| 1609 | |
| 1610 | |
| 1611 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1612 | |
| 1613 | #include <PER-Visible.h> |
| 1614 | |
| 1615 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1616 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1617 | typedef PER_Visible_t PER_Visible_2_t; |
| 1618 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1619 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1620 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1621 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1622 | asn_struct_free_f PER_Visible_2_free; |
| 1623 | asn_struct_print_f PER_Visible_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1624 | asn_constr_check_f PER_Visible_2_constraint; |
| 1625 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1626 | der_type_encoder_f PER_Visible_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1627 | xer_type_decoder_f PER_Visible_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1628 | xer_type_encoder_f PER_Visible_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1629 | |
| 1630 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1631 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1632 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1633 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1634 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1635 | const uint8_t *ch = st->buf; |
| 1636 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1637 | |
| 1638 | for(; ch < end; ch++) { |
| 1639 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1640 | if(!(cv >= 69 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1641 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1642 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1643 | } |
| 1644 | |
| 1645 | |
| 1646 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1647 | |
| 1648 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1649 | PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1650 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1651 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1652 | |
| 1653 | if(!sptr) { |
| 1654 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1655 | "%s: value not given (%s:%d)", |
| 1656 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1657 | return -1; |
| 1658 | } |
| 1659 | |
| 1660 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1661 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1662 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1663 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1664 | } else { |
| 1665 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1666 | "%s: constraint failed (%s:%d)", |
| 1667 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1668 | return -1; |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | /* |
| 1673 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1674 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1675 | */ |
| 1676 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1677 | PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1678 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1679 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1680 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1681 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1682 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1683 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1684 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
| 1685 | if(!td->per_constraints) |
| 1686 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1687 | td->elements = asn_DEF_PER_Visible.elements; |
| 1688 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1689 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1690 | } |
| 1691 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1692 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1693 | PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1694 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1695 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1696 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1697 | } |
| 1698 | |
| 1699 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1700 | PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1701 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1702 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1703 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1704 | } |
| 1705 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1706 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1707 | PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1708 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1709 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1710 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1711 | } |
| 1712 | |
| 1713 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1714 | PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1715 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1716 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1717 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1718 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1719 | } |
| 1720 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1721 | asn_dec_rval_t |
| 1722 | PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1723 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1724 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1725 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1726 | } |
| 1727 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1728 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1729 | PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1730 | int ilevel, enum xer_encoder_flags_e flags, |
| 1731 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1732 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1733 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1734 | } |
| 1735 | |
| 1736 | |
| 1737 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 1738 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1739 | static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1740 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1741 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1742 | asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1743 | "PER-Visible-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1744 | "PER-Visible-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1745 | PER_Visible_2_free, |
| 1746 | PER_Visible_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1747 | PER_Visible_2_constraint, |
| 1748 | PER_Visible_2_decode_ber, |
| 1749 | PER_Visible_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1750 | PER_Visible_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1751 | PER_Visible_2_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1752 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1753 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1754 | asn_DEF_PER_Visible_2_tags_1, |
| 1755 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 1756 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
| 1757 | asn_DEF_PER_Visible_2_tags_1, /* Same as above */ |
| 1758 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 1759 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
| 1760 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1761 | 0, 0, /* No members */ |
| 1762 | 0 /* No specifics */ |
| 1763 | }; |
| 1764 | |
| 1765 | |
| 1766 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 1767 | |
| 1768 | #include <PER-Visible.h> |
| 1769 | |
| 1770 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1771 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1772 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 1773 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1774 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1775 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1776 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1777 | asn_struct_free_f Not_PER_Visible_1_free; |
| 1778 | asn_struct_print_f Not_PER_Visible_1_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1779 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 1780 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 1781 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1782 | xer_type_decoder_f Not_PER_Visible_1_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1783 | xer_type_encoder_f Not_PER_Visible_1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1784 | |
| 1785 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 1786 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1787 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1788 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1789 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1790 | const uint8_t *ch = st->buf; |
| 1791 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1792 | |
| 1793 | for(; ch < end; ch++) { |
| 1794 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1795 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1796 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1797 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1798 | } |
| 1799 | |
| 1800 | |
| 1801 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 1802 | |
| 1803 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1804 | Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1805 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1806 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1807 | |
| 1808 | if(!sptr) { |
| 1809 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1810 | "%s: value not given (%s:%d)", |
| 1811 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1812 | return -1; |
| 1813 | } |
| 1814 | |
| 1815 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1816 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1817 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1818 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1819 | } else { |
| 1820 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1821 | "%s: constraint failed (%s:%d)", |
| 1822 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1823 | return -1; |
| 1824 | } |
| 1825 | } |
| 1826 | |
| 1827 | /* |
| 1828 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1829 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1830 | */ |
| 1831 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1832 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1833 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1834 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1835 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1836 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1837 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1838 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1839 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
| 1840 | if(!td->per_constraints) |
| 1841 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1842 | td->elements = asn_DEF_PER_Visible.elements; |
| 1843 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1844 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1845 | } |
| 1846 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1847 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1848 | Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1849 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1850 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1851 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1852 | } |
| 1853 | |
| 1854 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1855 | Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1856 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1857 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1858 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1859 | } |
| 1860 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1861 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1862 | Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1863 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1864 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1865 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1866 | } |
| 1867 | |
| 1868 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1869 | Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1870 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1871 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1872 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1873 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1874 | } |
| 1875 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1876 | asn_dec_rval_t |
| 1877 | Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1878 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1879 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1880 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1881 | } |
| 1882 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1883 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1884 | Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1885 | int ilevel, enum xer_encoder_flags_e flags, |
| 1886 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1887 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1888 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1889 | } |
| 1890 | |
| 1891 | |
| 1892 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 1893 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1894 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1895 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1896 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1897 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1898 | "Not-PER-Visible-1", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1899 | "Not-PER-Visible-1", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1900 | Not_PER_Visible_1_free, |
| 1901 | Not_PER_Visible_1_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1902 | Not_PER_Visible_1_constraint, |
| 1903 | Not_PER_Visible_1_decode_ber, |
| 1904 | Not_PER_Visible_1_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1905 | Not_PER_Visible_1_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1906 | Not_PER_Visible_1_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1907 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1908 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1909 | asn_DEF_Not_PER_Visible_1_tags_1, |
| 1910 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 1911 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
| 1912 | asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */ |
| 1913 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 1914 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
| 1915 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1916 | 0, 0, /* No members */ |
| 1917 | 0 /* No specifics */ |
| 1918 | }; |
| 1919 | |
| 1920 | |
| 1921 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 1922 | |
| 1923 | #include <PER-Visible.h> |
| 1924 | |
| 1925 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1926 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1927 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 1928 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1929 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1930 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1931 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1932 | asn_struct_free_f Not_PER_Visible_2_free; |
| 1933 | asn_struct_print_f Not_PER_Visible_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1934 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 1935 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 1936 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1937 | xer_type_decoder_f Not_PER_Visible_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1938 | xer_type_encoder_f Not_PER_Visible_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1939 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1940 | /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ |
| 1941 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1942 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1943 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1944 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1945 | const uint8_t *ch = st->buf; |
| 1946 | const uint8_t *end = ch + st->size; |
| 1947 | |
| 1948 | for(; ch < end; ch++) { |
| 1949 | uint8_t cv = *ch; |
| 1950 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 1951 | } |
| 1952 | return 0; |
| 1953 | } |
| 1954 | |
| 1955 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1956 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 1957 | |
| 1958 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1959 | Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1960 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1961 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1962 | |
| 1963 | if(!sptr) { |
| 1964 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1965 | "%s: value not given (%s:%d)", |
| 1966 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1967 | return -1; |
| 1968 | } |
| 1969 | |
| 1970 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1971 | if(!check_permitted_alphabet_1(st)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1972 | /* Constraint check succeeded */ |
| 1973 | return 0; |
| 1974 | } else { |
| 1975 | _ASN_ERRLOG(app_errlog, app_key, |
| 1976 | "%s: constraint failed (%s:%d)", |
| 1977 | td->name, __FILE__, __LINE__); |
| 1978 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1979 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1980 | } |
| 1981 | |
| 1982 | /* |
| 1983 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1984 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1985 | */ |
| 1986 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1987 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1988 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1989 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1990 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1991 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1992 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1993 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1994 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
| 1995 | if(!td->per_constraints) |
| 1996 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1997 | td->elements = asn_DEF_PER_Visible.elements; |
| 1998 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1999 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2000 | } |
| 2001 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2002 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2003 | Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2004 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2005 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2006 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2007 | } |
| 2008 | |
| 2009 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2010 | Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2011 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2012 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2013 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2014 | } |
| 2015 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2016 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2017 | Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2018 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2019 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2020 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2021 | } |
| 2022 | |
| 2023 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2024 | Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2025 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2026 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2027 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2028 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2029 | } |
| 2030 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2031 | asn_dec_rval_t |
| 2032 | Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2033 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2034 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2035 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2036 | } |
| 2037 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2038 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2039 | Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2040 | int ilevel, enum xer_encoder_flags_e flags, |
| 2041 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2042 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2043 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2044 | } |
| 2045 | |
| 2046 | |
| 2047 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 2048 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2049 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2050 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2051 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2052 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2053 | "Not-PER-Visible-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2054 | "Not-PER-Visible-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2055 | Not_PER_Visible_2_free, |
| 2056 | Not_PER_Visible_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2057 | Not_PER_Visible_2_constraint, |
| 2058 | Not_PER_Visible_2_decode_ber, |
| 2059 | Not_PER_Visible_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2060 | Not_PER_Visible_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2061 | Not_PER_Visible_2_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2062 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2063 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2064 | asn_DEF_Not_PER_Visible_2_tags_1, |
| 2065 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2066 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2067 | asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */ |
| 2068 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2069 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2070 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2071 | 0, 0, /* No members */ |
| 2072 | 0 /* No specifics */ |
| 2073 | }; |
| 2074 | |
| 2075 | |
| 2076 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 2077 | |
| 2078 | #include <PER-Visible.h> |
| 2079 | |
| 2080 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2081 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2082 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 2083 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2084 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2085 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2086 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2087 | asn_struct_free_f Not_PER_Visible_3_free; |
| 2088 | asn_struct_print_f Not_PER_Visible_3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2089 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 2090 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 2091 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2092 | xer_type_decoder_f Not_PER_Visible_3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2093 | xer_type_encoder_f Not_PER_Visible_3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2094 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2095 | /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ |
| 2096 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2097 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2098 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2099 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2100 | const uint8_t *ch = st->buf; |
| 2101 | const uint8_t *end = ch + st->size; |
| 2102 | |
| 2103 | for(; ch < end; ch++) { |
| 2104 | uint8_t cv = *ch; |
| 2105 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2106 | } |
| 2107 | return 0; |
| 2108 | } |
| 2109 | |
| 2110 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2111 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 2112 | |
| 2113 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2114 | Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2115 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2116 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2117 | |
| 2118 | if(!sptr) { |
| 2119 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2120 | "%s: value not given (%s:%d)", |
| 2121 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2122 | return -1; |
| 2123 | } |
| 2124 | |
| 2125 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2126 | if(!check_permitted_alphabet_1(st)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2127 | /* Constraint check succeeded */ |
| 2128 | return 0; |
| 2129 | } else { |
| 2130 | _ASN_ERRLOG(app_errlog, app_key, |
| 2131 | "%s: constraint failed (%s:%d)", |
| 2132 | td->name, __FILE__, __LINE__); |
| 2133 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2134 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2135 | } |
| 2136 | |
| 2137 | /* |
| 2138 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2139 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2140 | */ |
| 2141 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2142 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2143 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2144 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2145 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2146 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2147 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2148 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2149 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
| 2150 | if(!td->per_constraints) |
| 2151 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2152 | td->elements = asn_DEF_PER_Visible.elements; |
| 2153 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2154 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2155 | } |
| 2156 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2157 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2158 | Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2159 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2160 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2161 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2162 | } |
| 2163 | |
| 2164 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2165 | Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2166 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2167 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2168 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2169 | } |
| 2170 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2171 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2172 | Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2173 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2174 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2175 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2176 | } |
| 2177 | |
| 2178 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2179 | Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2180 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2181 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2182 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2183 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2184 | } |
| 2185 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2186 | asn_dec_rval_t |
| 2187 | Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2188 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2189 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2190 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2191 | } |
| 2192 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2193 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2194 | Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2195 | int ilevel, enum xer_encoder_flags_e flags, |
| 2196 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2197 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2198 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2199 | } |
| 2200 | |
| 2201 | |
| 2202 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 2203 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2204 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2205 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2206 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2207 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2208 | "Not-PER-Visible-3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2209 | "Not-PER-Visible-3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2210 | Not_PER_Visible_3_free, |
| 2211 | Not_PER_Visible_3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2212 | Not_PER_Visible_3_constraint, |
| 2213 | Not_PER_Visible_3_decode_ber, |
| 2214 | Not_PER_Visible_3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2215 | Not_PER_Visible_3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2216 | Not_PER_Visible_3_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2217 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2218 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2219 | asn_DEF_Not_PER_Visible_3_tags_1, |
| 2220 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2221 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
| 2222 | asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */ |
| 2223 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2224 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
| 2225 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2226 | 0, 0, /* No members */ |
| 2227 | 0 /* No specifics */ |
| 2228 | }; |
| 2229 | |
| 2230 | |
| 2231 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 2232 | |
| 2233 | #include <PER-Visible.h> |
| 2234 | |
| 2235 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2236 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2237 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 2238 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2239 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2240 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2241 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2242 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 2243 | asn_struct_print_f SIZE_but_not_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2244 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 2245 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 2246 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2247 | xer_type_decoder_f SIZE_but_not_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2248 | xer_type_encoder_f SIZE_but_not_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2249 | |
| 2250 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 2251 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2252 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2253 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2254 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2255 | const uint8_t *ch = st->buf; |
| 2256 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2257 | |
| 2258 | for(; ch < end; ch++) { |
| 2259 | uint8_t cv = *ch; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2260 | if(!(cv >= 65 && cv <= 68)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2261 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2262 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2263 | } |
| 2264 | |
| 2265 | |
| 2266 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 2267 | |
| 2268 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2269 | SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2270 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2271 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2272 | size_t size; |
| 2273 | |
| 2274 | if(!sptr) { |
| 2275 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2276 | "%s: value not given (%s:%d)", |
| 2277 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2278 | return -1; |
| 2279 | } |
| 2280 | |
| 2281 | size = st->size; |
| 2282 | |
| 2283 | if((size >= 1 && size <= 4) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2284 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2285 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2286 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2287 | } else { |
| 2288 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2289 | "%s: constraint failed (%s:%d)", |
| 2290 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2291 | return -1; |
| 2292 | } |
| 2293 | } |
| 2294 | |
| 2295 | /* |
| 2296 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2297 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2298 | */ |
| 2299 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2300 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2301 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2302 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2303 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2304 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2305 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2306 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2307 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
| 2308 | if(!td->per_constraints) |
| 2309 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2310 | td->elements = asn_DEF_PER_Visible.elements; |
| 2311 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2312 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2313 | } |
| 2314 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2315 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2316 | SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2317 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2318 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2319 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2320 | } |
| 2321 | |
| 2322 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2323 | SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2324 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2325 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2326 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2327 | } |
| 2328 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2329 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2330 | SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2331 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2332 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2333 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2334 | } |
| 2335 | |
| 2336 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2337 | SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2338 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2339 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2340 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2341 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2342 | } |
| 2343 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2344 | asn_dec_rval_t |
| 2345 | SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2346 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2347 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2348 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2349 | } |
| 2350 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2351 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2352 | SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2353 | int ilevel, enum xer_encoder_flags_e flags, |
| 2354 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2355 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2356 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2357 | } |
| 2358 | |
| 2359 | |
| 2360 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 2361 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2362 | static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2363 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2364 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2365 | asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2366 | "SIZE-but-not-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2367 | "SIZE-but-not-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2368 | SIZE_but_not_FROM_free, |
| 2369 | SIZE_but_not_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2370 | SIZE_but_not_FROM_constraint, |
| 2371 | SIZE_but_not_FROM_decode_ber, |
| 2372 | SIZE_but_not_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2373 | SIZE_but_not_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2374 | SIZE_but_not_FROM_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2375 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2376 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2377 | asn_DEF_SIZE_but_not_FROM_tags_1, |
| 2378 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2379 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
| 2380 | asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */ |
| 2381 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2382 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
| 2383 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2384 | 0, 0, /* No members */ |
| 2385 | 0 /* No specifics */ |
| 2386 | }; |
| 2387 | |
| 2388 | |
| 2389 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 2390 | |
| 2391 | #include <PER-Visible.h> |
| 2392 | |
| 2393 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 2394 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2395 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 2396 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2397 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 2398 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2399 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2400 | asn_struct_free_f SIZE_and_FROM_free; |
| 2401 | asn_struct_print_f SIZE_and_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2402 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 2403 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 2404 | der_type_encoder_f SIZE_and_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2405 | xer_type_decoder_f SIZE_and_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2406 | xer_type_encoder_f SIZE_and_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2407 | |
| 2408 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 2409 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2410 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2411 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2412 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2413 | const uint8_t *ch = st->buf; |
| 2414 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2415 | |
| 2416 | for(; ch < end; ch++) { |
| 2417 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2418 | if(!(cv >= 65 && cv <= 68)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2419 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2420 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2421 | } |
| 2422 | |
| 2423 | |
| 2424 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 2425 | |
| 2426 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2427 | SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2428 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2429 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2430 | size_t size; |
| 2431 | |
| 2432 | if(!sptr) { |
| 2433 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2434 | "%s: value not given (%s:%d)", |
| 2435 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2436 | return -1; |
| 2437 | } |
| 2438 | |
| 2439 | size = st->size; |
| 2440 | |
| 2441 | if((size >= 1 && size <= 4) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2442 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2443 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2444 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2445 | } else { |
| 2446 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2447 | "%s: constraint failed (%s:%d)", |
| 2448 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2449 | return -1; |
| 2450 | } |
| 2451 | } |
| 2452 | |
| 2453 | /* |
| 2454 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2455 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2456 | */ |
| 2457 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2458 | SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2459 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2460 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2461 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2462 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2463 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2464 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2465 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
| 2466 | if(!td->per_constraints) |
| 2467 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2468 | td->elements = asn_DEF_PER_Visible.elements; |
| 2469 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2470 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2471 | } |
| 2472 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2473 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2474 | SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2475 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2476 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2477 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2478 | } |
| 2479 | |
| 2480 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2481 | SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2482 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2483 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2484 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2485 | } |
| 2486 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2487 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2488 | SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2489 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2490 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2491 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2492 | } |
| 2493 | |
| 2494 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2495 | SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2496 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2497 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2498 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2499 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2500 | } |
| 2501 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2502 | asn_dec_rval_t |
| 2503 | SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2504 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2505 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2506 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2507 | } |
| 2508 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2509 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2510 | SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2511 | int ilevel, enum xer_encoder_flags_e flags, |
| 2512 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2513 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2514 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2515 | } |
| 2516 | |
| 2517 | |
| 2518 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 2519 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2520 | static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2521 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2522 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2523 | asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2524 | "SIZE-and-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2525 | "SIZE-and-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2526 | SIZE_and_FROM_free, |
| 2527 | SIZE_and_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2528 | SIZE_and_FROM_constraint, |
| 2529 | SIZE_and_FROM_decode_ber, |
| 2530 | SIZE_and_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2531 | SIZE_and_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2532 | SIZE_and_FROM_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2533 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2534 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2535 | asn_DEF_SIZE_and_FROM_tags_1, |
| 2536 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2537 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
| 2538 | asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */ |
| 2539 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2540 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
| 2541 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2542 | 0, 0, /* No members */ |
| 2543 | 0 /* No specifics */ |
| 2544 | }; |
| 2545 | |
| 2546 | |
| 2547 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2548 | |
| 2549 | #include <PER-Visible.h> |
| 2550 | |
| 2551 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2552 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2553 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 2554 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2555 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2556 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2557 | extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2558 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 2559 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2560 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 2561 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 2562 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2563 | xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2564 | xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2565 | |
| 2566 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2567 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2568 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2569 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2570 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2571 | const uint8_t *ch = st->buf; |
| 2572 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2573 | |
| 2574 | for(; ch < end; ch++) { |
| 2575 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2576 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2577 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2578 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2579 | } |
| 2580 | |
| 2581 | |
| 2582 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 2583 | |
| 2584 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2585 | Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2586 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2587 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2588 | |
| 2589 | if(!sptr) { |
| 2590 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2591 | "%s: value not given (%s:%d)", |
| 2592 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2593 | return -1; |
| 2594 | } |
| 2595 | |
| 2596 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2597 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2598 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2599 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2600 | } else { |
| 2601 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2602 | "%s: constraint failed (%s:%d)", |
| 2603 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2604 | return -1; |
| 2605 | } |
| 2606 | } |
| 2607 | |
| 2608 | /* |
| 2609 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2610 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2611 | */ |
| 2612 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2613 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2614 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2615 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2616 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2617 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2618 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2619 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2620 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
| 2621 | if(!td->per_constraints) |
| 2622 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2623 | td->elements = asn_DEF_PER_Visible.elements; |
| 2624 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2625 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2626 | } |
| 2627 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2628 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2629 | Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2630 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2631 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2632 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2633 | } |
| 2634 | |
| 2635 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2636 | Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2637 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2638 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2639 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2640 | } |
| 2641 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2642 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2643 | Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2644 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2645 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2646 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2647 | } |
| 2648 | |
| 2649 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2650 | Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2651 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2652 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2653 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2654 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2655 | } |
| 2656 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2657 | asn_dec_rval_t |
| 2658 | Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2659 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2660 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2661 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2662 | } |
| 2663 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2664 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2665 | Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2666 | int ilevel, enum xer_encoder_flags_e flags, |
| 2667 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2668 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2669 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2670 | } |
| 2671 | |
| 2672 | |
| 2673 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2674 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2675 | static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2676 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2677 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2678 | asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2679 | "Neither-SIZE-nor-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2680 | "Neither-SIZE-nor-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2681 | Neither_SIZE_nor_FROM_free, |
| 2682 | Neither_SIZE_nor_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2683 | Neither_SIZE_nor_FROM_constraint, |
| 2684 | Neither_SIZE_nor_FROM_decode_ber, |
| 2685 | Neither_SIZE_nor_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2686 | Neither_SIZE_nor_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2687 | Neither_SIZE_nor_FROM_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2688 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2689 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2690 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, |
| 2691 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 2692 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
| 2693 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */ |
| 2694 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 2695 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
| 2696 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2697 | 0, 0, /* No members */ |
| 2698 | 0 /* No specifics */ |
| 2699 | }; |
| 2700 | |
| 2701 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2702 | /*** <<< INCLUDES [Utf8-4] >>> ***/ |
| 2703 | |
| 2704 | #include <UTF8String.h> |
| 2705 | |
| 2706 | /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ |
| 2707 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2708 | typedef UTF8String_t Utf8_4_t; |
| 2709 | |
| 2710 | /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ |
| 2711 | |
| 2712 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; |
| 2713 | asn_struct_free_f Utf8_4_free; |
| 2714 | asn_struct_print_f Utf8_4_print; |
| 2715 | asn_constr_check_f Utf8_4_constraint; |
| 2716 | ber_type_decoder_f Utf8_4_decode_ber; |
| 2717 | der_type_encoder_f Utf8_4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2718 | xer_type_decoder_f Utf8_4_decode_xer; |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2719 | xer_type_encoder_f Utf8_4_encode_xer; |
| 2720 | |
| 2721 | /*** <<< CTABLES [Utf8-4] >>> ***/ |
| 2722 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2723 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2724 | if(UTF8String_length((const UTF8String_t *)sptr) < 0) |
| 2725 | return -1; /* Alphabet (sic!) test failed. */ |
| 2726 | |
| 2727 | return 0; |
| 2728 | } |
| 2729 | |
| 2730 | |
| 2731 | /*** <<< CODE [Utf8-4] >>> ***/ |
| 2732 | |
| 2733 | int |
| 2734 | Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 2735 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2736 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2737 | |
| 2738 | if(!sptr) { |
| 2739 | _ASN_ERRLOG(app_errlog, app_key, |
| 2740 | "%s: value not given (%s:%d)", |
| 2741 | td->name, __FILE__, __LINE__); |
| 2742 | return -1; |
| 2743 | } |
| 2744 | |
| 2745 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2746 | if(!check_permitted_alphabet_1(st)) { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2747 | /* Constraint check succeeded */ |
| 2748 | return 0; |
| 2749 | } else { |
| 2750 | _ASN_ERRLOG(app_errlog, app_key, |
| 2751 | "%s: constraint failed (%s:%d)", |
| 2752 | td->name, __FILE__, __LINE__); |
| 2753 | return -1; |
| 2754 | } |
| 2755 | } |
| 2756 | |
| 2757 | /* |
| 2758 | * This type is implemented using UTF8String, |
| 2759 | * so here we adjust the DEF accordingly. |
| 2760 | */ |
| 2761 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2762 | Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2763 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 2764 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 2765 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 2766 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 2767 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 2768 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2769 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
| 2770 | if(!td->per_constraints) |
| 2771 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2772 | td->elements = asn_DEF_UTF8String.elements; |
| 2773 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 2774 | td->specifics = asn_DEF_UTF8String.specifics; |
| 2775 | } |
| 2776 | |
| 2777 | void |
| 2778 | Utf8_4_free(asn_TYPE_descriptor_t *td, |
| 2779 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2780 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2781 | td->free_struct(td, struct_ptr, contents_only); |
| 2782 | } |
| 2783 | |
| 2784 | int |
| 2785 | Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2786 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2787 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2788 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2789 | } |
| 2790 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2791 | asn_dec_rval_t |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2792 | Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2793 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2794 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2795 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2796 | } |
| 2797 | |
| 2798 | asn_enc_rval_t |
| 2799 | Utf8_4_encode_der(asn_TYPE_descriptor_t *td, |
| 2800 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2801 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2802 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2803 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2804 | } |
| 2805 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2806 | asn_dec_rval_t |
| 2807 | Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2808 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2809 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2810 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2811 | } |
| 2812 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2813 | asn_enc_rval_t |
| 2814 | Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2815 | int ilevel, enum xer_encoder_flags_e flags, |
| 2816 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2817 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2818 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2819 | } |
| 2820 | |
| 2821 | |
| 2822 | /*** <<< STAT-DEFS [Utf8-4] >>> ***/ |
| 2823 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2824 | static ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2825 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 2826 | }; |
| 2827 | asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { |
| 2828 | "Utf8-4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2829 | "Utf8-4", |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2830 | Utf8_4_free, |
| 2831 | Utf8_4_print, |
| 2832 | Utf8_4_constraint, |
| 2833 | Utf8_4_decode_ber, |
| 2834 | Utf8_4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2835 | Utf8_4_decode_xer, |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2836 | Utf8_4_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2837 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2838 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2839 | asn_DEF_Utf8_4_tags_1, |
| 2840 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 2841 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
| 2842 | asn_DEF_Utf8_4_tags_1, /* Same as above */ |
| 2843 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 2844 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
| 2845 | 0, /* No PER visible constraints */ |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2846 | 0, 0, /* No members */ |
| 2847 | 0 /* No specifics */ |
| 2848 | }; |
| 2849 | |
| 2850 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2851 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 2852 | |
| 2853 | #include <Utf8-2.h> |
| 2854 | |
| 2855 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 2856 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2857 | typedef Utf8_2_t Utf8_3_t; |
| 2858 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2859 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 2860 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2861 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2862 | asn_struct_free_f Utf8_3_free; |
| 2863 | asn_struct_print_f Utf8_3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2864 | asn_constr_check_f Utf8_3_constraint; |
| 2865 | ber_type_decoder_f Utf8_3_decode_ber; |
| 2866 | der_type_encoder_f Utf8_3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2867 | xer_type_decoder_f Utf8_3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2868 | xer_type_encoder_f Utf8_3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2869 | |
| 2870 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 2871 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2872 | static int permitted_alphabet_table_1[128] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2873 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2874 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2875 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2876 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2877 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 2878 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ |
| 2879 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 2880 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 2881 | }; |
| 2882 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2883 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2884 | int *table = permitted_alphabet_table_1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2885 | /* The underlying type is UTF8String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2886 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2887 | const uint8_t *ch = st->buf; |
| 2888 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2889 | |
| 2890 | for(; ch < end; ch++) { |
| 2891 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2892 | if(cv >= 0x80) return -1; |
| 2893 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2894 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2895 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2896 | } |
| 2897 | |
| 2898 | |
| 2899 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 2900 | |
| 2901 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2902 | Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2903 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2904 | const Utf8_2_t *st = (const Utf8_2_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2905 | size_t size; |
| 2906 | |
| 2907 | if(!sptr) { |
| 2908 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2909 | "%s: value not given (%s:%d)", |
| 2910 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2911 | return -1; |
| 2912 | } |
| 2913 | |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2914 | size = UTF8String_length(st); |
vlm | 1ba4275 | 2004-10-02 16:44:30 +0000 | [diff] [blame] | 2915 | if((ssize_t)size < 0) { |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2916 | _ASN_ERRLOG(app_errlog, app_key, |
| 2917 | "%s: UTF-8: broken encoding (%s:%d)", |
| 2918 | td->name, __FILE__, __LINE__); |
| 2919 | return -1; |
| 2920 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2921 | |
| 2922 | if((size >= 1 && size <= 2) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2923 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2924 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2925 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2926 | } else { |
| 2927 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2928 | "%s: constraint failed (%s:%d)", |
| 2929 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2930 | return -1; |
| 2931 | } |
| 2932 | } |
| 2933 | |
| 2934 | /* |
| 2935 | * This type is implemented using Utf8_2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2936 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2937 | */ |
| 2938 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2939 | Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2940 | td->free_struct = asn_DEF_Utf8_2.free_struct; |
| 2941 | td->print_struct = asn_DEF_Utf8_2.print_struct; |
| 2942 | td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; |
| 2943 | td->der_encoder = asn_DEF_Utf8_2.der_encoder; |
| 2944 | td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; |
| 2945 | td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2946 | td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; |
| 2947 | if(!td->per_constraints) |
| 2948 | td->per_constraints = asn_DEF_Utf8_2.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2949 | td->elements = asn_DEF_Utf8_2.elements; |
| 2950 | td->elements_count = asn_DEF_Utf8_2.elements_count; |
| 2951 | td->specifics = asn_DEF_Utf8_2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2952 | } |
| 2953 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2954 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2955 | Utf8_3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2956 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2957 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2958 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2959 | } |
| 2960 | |
| 2961 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2962 | Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2963 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2964 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2965 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2966 | } |
| 2967 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2968 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2969 | Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2970 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2971 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2972 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2973 | } |
| 2974 | |
| 2975 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2976 | Utf8_3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2977 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2978 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2979 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2980 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2981 | } |
| 2982 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2983 | asn_dec_rval_t |
| 2984 | Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2985 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2986 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2987 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2988 | } |
| 2989 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2990 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2991 | Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2992 | int ilevel, enum xer_encoder_flags_e flags, |
| 2993 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2994 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2995 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2996 | } |
| 2997 | |
| 2998 | |
| 2999 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 3000 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3001 | static ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 3002 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3003 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3004 | asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3005 | "Utf8-3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3006 | "Utf8-3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3007 | Utf8_3_free, |
| 3008 | Utf8_3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3009 | Utf8_3_constraint, |
| 3010 | Utf8_3_decode_ber, |
| 3011 | Utf8_3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3012 | Utf8_3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3013 | Utf8_3_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3014 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3015 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3016 | asn_DEF_Utf8_3_tags_1, |
| 3017 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3018 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
| 3019 | asn_DEF_Utf8_3_tags_1, /* Same as above */ |
| 3020 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3021 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
| 3022 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3023 | 0, 0, /* No members */ |
| 3024 | 0 /* No specifics */ |
| 3025 | }; |
| 3026 | |
| 3027 | |
| 3028 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 3029 | |
| 3030 | #include <Utf8-1.h> |
| 3031 | |
| 3032 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 3033 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3034 | typedef Utf8_1_t Utf8_2_t; |
| 3035 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3036 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 3037 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3038 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3039 | asn_struct_free_f Utf8_2_free; |
| 3040 | asn_struct_print_f Utf8_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3041 | asn_constr_check_f Utf8_2_constraint; |
| 3042 | ber_type_decoder_f Utf8_2_decode_ber; |
| 3043 | der_type_encoder_f Utf8_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3044 | xer_type_decoder_f Utf8_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3045 | xer_type_encoder_f Utf8_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3046 | |
| 3047 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 3048 | |
| 3049 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3050 | Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3051 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 3052 | const Utf8_1_t *st = (const Utf8_1_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3053 | size_t size; |
| 3054 | |
| 3055 | if(!sptr) { |
| 3056 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 3057 | "%s: value not given (%s:%d)", |
| 3058 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3059 | return -1; |
| 3060 | } |
| 3061 | |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 3062 | size = UTF8String_length(st); |
vlm | 1ba4275 | 2004-10-02 16:44:30 +0000 | [diff] [blame] | 3063 | if((ssize_t)size < 0) { |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 3064 | _ASN_ERRLOG(app_errlog, app_key, |
| 3065 | "%s: UTF-8: broken encoding (%s:%d)", |
| 3066 | td->name, __FILE__, __LINE__); |
| 3067 | return -1; |
| 3068 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3069 | |
| 3070 | if((size >= 1 && size <= 2)) { |
| 3071 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 3072 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3073 | } else { |
| 3074 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 3075 | "%s: constraint failed (%s:%d)", |
| 3076 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3077 | return -1; |
| 3078 | } |
| 3079 | } |
| 3080 | |
| 3081 | /* |
| 3082 | * This type is implemented using Utf8_1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 3083 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3084 | */ |
| 3085 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3086 | Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3087 | td->free_struct = asn_DEF_Utf8_1.free_struct; |
| 3088 | td->print_struct = asn_DEF_Utf8_1.print_struct; |
| 3089 | td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; |
| 3090 | td->der_encoder = asn_DEF_Utf8_1.der_encoder; |
| 3091 | td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; |
| 3092 | td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3093 | td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; |
| 3094 | if(!td->per_constraints) |
| 3095 | td->per_constraints = asn_DEF_Utf8_1.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3096 | td->elements = asn_DEF_Utf8_1.elements; |
| 3097 | td->elements_count = asn_DEF_Utf8_1.elements_count; |
| 3098 | td->specifics = asn_DEF_Utf8_1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3099 | } |
| 3100 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3101 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3102 | Utf8_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3103 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3104 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3105 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3106 | } |
| 3107 | |
| 3108 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3109 | Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3110 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3111 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3112 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3113 | } |
| 3114 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3115 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3116 | Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3117 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3118 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3119 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3120 | } |
| 3121 | |
| 3122 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3123 | Utf8_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3124 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3125 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3126 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3127 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3128 | } |
| 3129 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3130 | asn_dec_rval_t |
| 3131 | Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3132 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3133 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3134 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3135 | } |
| 3136 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3137 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3138 | Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3139 | int ilevel, enum xer_encoder_flags_e flags, |
| 3140 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3141 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3142 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3143 | } |
| 3144 | |
| 3145 | |
| 3146 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 3147 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3148 | static ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 3149 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3150 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3151 | asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3152 | "Utf8-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3153 | "Utf8-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3154 | Utf8_2_free, |
| 3155 | Utf8_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3156 | Utf8_2_constraint, |
| 3157 | Utf8_2_decode_ber, |
| 3158 | Utf8_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3159 | Utf8_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3160 | Utf8_2_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3161 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3162 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3163 | asn_DEF_Utf8_2_tags_1, |
| 3164 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3165 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
| 3166 | asn_DEF_Utf8_2_tags_1, /* Same as above */ |
| 3167 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3168 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
| 3169 | 0, /* No PER visible constraints */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3170 | 0, 0, /* No members */ |
| 3171 | 0 /* No specifics */ |
| 3172 | }; |
| 3173 | |
| 3174 | |
| 3175 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 3176 | |
| 3177 | #include <UTF8String.h> |
| 3178 | |
| 3179 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 3180 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3181 | typedef UTF8String_t Utf8_1_t; |
| 3182 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3183 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 3184 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3185 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_1; |
| 3186 | asn_struct_free_f Utf8_1_free; |
| 3187 | asn_struct_print_f Utf8_1_print; |
| 3188 | asn_constr_check_f Utf8_1_constraint; |
| 3189 | ber_type_decoder_f Utf8_1_decode_ber; |
| 3190 | der_type_encoder_f Utf8_1_encode_der; |
| 3191 | xer_type_decoder_f Utf8_1_decode_xer; |
| 3192 | xer_type_encoder_f Utf8_1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3193 | |
| 3194 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 3195 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3196 | int |
| 3197 | Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3198 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3199 | /* Replace with underlying type checker */ |
| 3200 | td->check_constraints = asn_DEF_UTF8String.check_constraints; |
| 3201 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 3202 | } |
| 3203 | |
| 3204 | /* |
| 3205 | * This type is implemented using UTF8String, |
| 3206 | * so here we adjust the DEF accordingly. |
| 3207 | */ |
| 3208 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3209 | Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3210 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3211 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 3212 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3213 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3214 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3215 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3216 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
| 3217 | if(!td->per_constraints) |
| 3218 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3219 | td->elements = asn_DEF_UTF8String.elements; |
| 3220 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3221 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3222 | } |
| 3223 | |
| 3224 | void |
| 3225 | Utf8_1_free(asn_TYPE_descriptor_t *td, |
| 3226 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3227 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3228 | td->free_struct(td, struct_ptr, contents_only); |
| 3229 | } |
| 3230 | |
| 3231 | int |
| 3232 | Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3233 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3234 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3235 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3236 | } |
| 3237 | |
| 3238 | asn_dec_rval_t |
| 3239 | Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3240 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3241 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3242 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3243 | } |
| 3244 | |
| 3245 | asn_enc_rval_t |
| 3246 | Utf8_1_encode_der(asn_TYPE_descriptor_t *td, |
| 3247 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3248 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3249 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3250 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3251 | } |
| 3252 | |
| 3253 | asn_dec_rval_t |
| 3254 | Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3255 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3256 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3257 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3258 | } |
| 3259 | |
| 3260 | asn_enc_rval_t |
| 3261 | Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3262 | int ilevel, enum xer_encoder_flags_e flags, |
| 3263 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3264 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3265 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3266 | } |
| 3267 | |
| 3268 | |
| 3269 | /*** <<< STAT-DEFS [Utf8-1] >>> ***/ |
| 3270 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3271 | static ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3272 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3273 | }; |
| 3274 | asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { |
| 3275 | "Utf8-1", |
| 3276 | "Utf8-1", |
| 3277 | Utf8_1_free, |
| 3278 | Utf8_1_print, |
| 3279 | Utf8_1_constraint, |
| 3280 | Utf8_1_decode_ber, |
| 3281 | Utf8_1_encode_der, |
| 3282 | Utf8_1_decode_xer, |
| 3283 | Utf8_1_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3284 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3285 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3286 | asn_DEF_Utf8_1_tags_1, |
| 3287 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3288 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3289 | asn_DEF_Utf8_1_tags_1, /* Same as above */ |
| 3290 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3291 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3292 | 0, /* No PER visible constraints */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3293 | 0, 0, /* No members */ |
| 3294 | 0 /* No specifics */ |
| 3295 | }; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3296 | |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3297 | |
| 3298 | /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ |
| 3299 | |
| 3300 | #include <Identifier.h> |
| 3301 | |
| 3302 | /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ |
| 3303 | |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3304 | typedef Identifier_t VisibleIdentifier_t; |
| 3305 | |
| 3306 | /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ |
| 3307 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3308 | extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier; |
| 3309 | asn_struct_free_f VisibleIdentifier_free; |
| 3310 | asn_struct_print_f VisibleIdentifier_print; |
| 3311 | asn_constr_check_f VisibleIdentifier_constraint; |
| 3312 | ber_type_decoder_f VisibleIdentifier_decode_ber; |
| 3313 | der_type_encoder_f VisibleIdentifier_encode_der; |
| 3314 | xer_type_decoder_f VisibleIdentifier_decode_xer; |
| 3315 | xer_type_encoder_f VisibleIdentifier_encode_xer; |
| 3316 | |
| 3317 | /*** <<< CTABLES [VisibleIdentifier] >>> ***/ |
| 3318 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3319 | static int permitted_alphabet_table_1[256] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3320 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3321 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3322 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */ |
| 3323 | 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */ |
| 3324 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 3325 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */ |
| 3326 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 3327 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 3328 | }; |
| 3329 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3330 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3331 | int *table = permitted_alphabet_table_1; |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3332 | /* The underlying type is VisibleString */ |
| 3333 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 3334 | const uint8_t *ch = st->buf; |
| 3335 | const uint8_t *end = ch + st->size; |
| 3336 | |
| 3337 | for(; ch < end; ch++) { |
| 3338 | uint8_t cv = *ch; |
| 3339 | if(!table[cv]) return -1; |
| 3340 | } |
| 3341 | return 0; |
| 3342 | } |
| 3343 | |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3344 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3345 | /*** <<< CODE [VisibleIdentifier] >>> ***/ |
| 3346 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3347 | int |
| 3348 | VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3349 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3350 | const Identifier_t *st = (const Identifier_t *)sptr; |
| 3351 | size_t size; |
| 3352 | |
| 3353 | if(!sptr) { |
| 3354 | _ASN_ERRLOG(app_errlog, app_key, |
| 3355 | "%s: value not given (%s:%d)", |
| 3356 | td->name, __FILE__, __LINE__); |
| 3357 | return -1; |
| 3358 | } |
| 3359 | |
| 3360 | size = st->size; |
| 3361 | |
| 3362 | if((size >= 1 && size <= 32) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3363 | && !check_permitted_alphabet_1(st)) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3364 | /* Constraint check succeeded */ |
| 3365 | return 0; |
| 3366 | } else { |
| 3367 | _ASN_ERRLOG(app_errlog, app_key, |
| 3368 | "%s: constraint failed (%s:%d)", |
| 3369 | td->name, __FILE__, __LINE__); |
| 3370 | return -1; |
| 3371 | } |
| 3372 | } |
| 3373 | |
| 3374 | /* |
| 3375 | * This type is implemented using Identifier, |
| 3376 | * so here we adjust the DEF accordingly. |
| 3377 | */ |
| 3378 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3379 | VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3380 | td->free_struct = asn_DEF_Identifier.free_struct; |
| 3381 | td->print_struct = asn_DEF_Identifier.print_struct; |
| 3382 | td->ber_decoder = asn_DEF_Identifier.ber_decoder; |
| 3383 | td->der_encoder = asn_DEF_Identifier.der_encoder; |
| 3384 | td->xer_decoder = asn_DEF_Identifier.xer_decoder; |
| 3385 | td->xer_encoder = asn_DEF_Identifier.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3386 | td->uper_decoder = asn_DEF_Identifier.uper_decoder; |
| 3387 | if(!td->per_constraints) |
| 3388 | td->per_constraints = asn_DEF_Identifier.per_constraints; |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3389 | td->elements = asn_DEF_Identifier.elements; |
| 3390 | td->elements_count = asn_DEF_Identifier.elements_count; |
| 3391 | td->specifics = asn_DEF_Identifier.specifics; |
| 3392 | } |
| 3393 | |
| 3394 | void |
| 3395 | VisibleIdentifier_free(asn_TYPE_descriptor_t *td, |
| 3396 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3397 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3398 | td->free_struct(td, struct_ptr, contents_only); |
| 3399 | } |
| 3400 | |
| 3401 | int |
| 3402 | VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3403 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3404 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3405 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3406 | } |
| 3407 | |
| 3408 | asn_dec_rval_t |
| 3409 | VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3410 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3411 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3412 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3413 | } |
| 3414 | |
| 3415 | asn_enc_rval_t |
| 3416 | VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td, |
| 3417 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3418 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3419 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3420 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3421 | } |
| 3422 | |
| 3423 | asn_dec_rval_t |
| 3424 | VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3425 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3426 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3427 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3428 | } |
| 3429 | |
| 3430 | asn_enc_rval_t |
| 3431 | VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3432 | int ilevel, enum xer_encoder_flags_e flags, |
| 3433 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3434 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3435 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3436 | } |
| 3437 | |
| 3438 | |
| 3439 | /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ |
| 3440 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3441 | static ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3442 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 3443 | }; |
| 3444 | asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { |
| 3445 | "VisibleIdentifier", |
| 3446 | "VisibleIdentifier", |
| 3447 | VisibleIdentifier_free, |
| 3448 | VisibleIdentifier_print, |
| 3449 | VisibleIdentifier_constraint, |
| 3450 | VisibleIdentifier_decode_ber, |
| 3451 | VisibleIdentifier_encode_der, |
| 3452 | VisibleIdentifier_decode_xer, |
| 3453 | VisibleIdentifier_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3454 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3455 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3456 | asn_DEF_VisibleIdentifier_tags_1, |
| 3457 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 3458 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 3459 | asn_DEF_VisibleIdentifier_tags_1, /* Same as above */ |
| 3460 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 3461 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 3462 | 0, /* No PER visible constraints */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3463 | 0, 0, /* No members */ |
| 3464 | 0 /* No specifics */ |
| 3465 | }; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3466 | |
| 3467 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3468 | /*** <<< INCLUDES [Sequence] >>> ***/ |
| 3469 | |
| 3470 | #include <Int1.h> |
| 3471 | #include <Int4.h> |
| 3472 | #include <BOOLEAN.h> |
| 3473 | #include <ENUMERATED.h> |
| 3474 | #include <NULL.h> |
| 3475 | #include <Int5.h> |
| 3476 | #include <constr_SEQUENCE.h> |
| 3477 | |
| 3478 | /*** <<< DEPS [Sequence] >>> ***/ |
| 3479 | |
| 3480 | typedef enum enum_c { |
| 3481 | enum_c_one = 1, |
| 3482 | enum_c_two = 2, |
| 3483 | /* |
| 3484 | * Enumeration is extensible |
| 3485 | */ |
| 3486 | enum_c_three = 3 |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 3487 | } e_enum_c; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3488 | |
| 3489 | /*** <<< TYPE-DECLS [Sequence] >>> ***/ |
| 3490 | |
| 3491 | typedef struct Sequence { |
| 3492 | Int1_t *int1_c /* DEFAULT 3 */; |
| 3493 | Int4_t int4; |
| 3494 | Int4_t int4_c; |
| 3495 | BOOLEAN_t *bool /* DEFAULT 1 */; |
| 3496 | ENUMERATED_t enum_c; |
| 3497 | NULL_t *null /* OPTIONAL */; |
| 3498 | /* |
| 3499 | * This type is extensible, |
| 3500 | * possible extensions are below. |
| 3501 | */ |
| 3502 | Int5_t *int5_c /* OPTIONAL */; |
| 3503 | |
| 3504 | /* Context for parsing across buffer boundaries */ |
| 3505 | asn_struct_ctx_t _asn_ctx; |
| 3506 | } Sequence_t; |
| 3507 | |
| 3508 | /*** <<< FUNC-DECLS [Sequence] >>> ***/ |
| 3509 | |
| 3510 | /* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */ |
| 3511 | extern asn_TYPE_descriptor_t asn_DEF_Sequence; |
| 3512 | |
| 3513 | /*** <<< CODE [Sequence] >>> ***/ |
| 3514 | |
| 3515 | static int |
| 3516 | enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3517 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3518 | /* Replace with underlying type checker */ |
| 3519 | td->check_constraints = asn_DEF_ENUMERATED.check_constraints; |
| 3520 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 3521 | } |
| 3522 | |
| 3523 | /* |
| 3524 | * This type is implemented using ENUMERATED, |
| 3525 | * so here we adjust the DEF accordingly. |
| 3526 | */ |
| 3527 | static void |
| 3528 | enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3529 | td->free_struct = asn_DEF_ENUMERATED.free_struct; |
| 3530 | td->print_struct = asn_DEF_ENUMERATED.print_struct; |
| 3531 | td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; |
| 3532 | td->der_encoder = asn_DEF_ENUMERATED.der_encoder; |
| 3533 | td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; |
| 3534 | td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; |
| 3535 | td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; |
| 3536 | if(!td->per_constraints) |
| 3537 | td->per_constraints = asn_DEF_ENUMERATED.per_constraints; |
| 3538 | td->elements = asn_DEF_ENUMERATED.elements; |
| 3539 | td->elements_count = asn_DEF_ENUMERATED.elements_count; |
| 3540 | /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ |
| 3541 | } |
| 3542 | |
| 3543 | static void |
| 3544 | enum_c_6_free(asn_TYPE_descriptor_t *td, |
| 3545 | void *struct_ptr, int contents_only) { |
| 3546 | enum_c_6_inherit_TYPE_descriptor(td); |
| 3547 | td->free_struct(td, struct_ptr, contents_only); |
| 3548 | } |
| 3549 | |
| 3550 | static int |
| 3551 | enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3552 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3553 | enum_c_6_inherit_TYPE_descriptor(td); |
| 3554 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3555 | } |
| 3556 | |
| 3557 | static asn_dec_rval_t |
| 3558 | enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3559 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3560 | enum_c_6_inherit_TYPE_descriptor(td); |
| 3561 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3562 | } |
| 3563 | |
| 3564 | static asn_enc_rval_t |
| 3565 | enum_c_6_encode_der(asn_TYPE_descriptor_t *td, |
| 3566 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3567 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3568 | enum_c_6_inherit_TYPE_descriptor(td); |
| 3569 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3570 | } |
| 3571 | |
| 3572 | static asn_dec_rval_t |
| 3573 | enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3574 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3575 | enum_c_6_inherit_TYPE_descriptor(td); |
| 3576 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3577 | } |
| 3578 | |
| 3579 | static asn_enc_rval_t |
| 3580 | enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3581 | int ilevel, enum xer_encoder_flags_e flags, |
| 3582 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3583 | enum_c_6_inherit_TYPE_descriptor(td); |
| 3584 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3585 | } |
| 3586 | |
| 3587 | static int |
| 3588 | memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3589 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3590 | const Int1_t *st = (const Int1_t *)sptr; |
| 3591 | long value; |
| 3592 | |
| 3593 | if(!sptr) { |
| 3594 | _ASN_ERRLOG(app_errlog, app_key, |
| 3595 | "%s: value not given (%s:%d)", |
| 3596 | td->name, __FILE__, __LINE__); |
| 3597 | return -1; |
| 3598 | } |
| 3599 | |
| 3600 | if(asn_INTEGER2long(st, &value)) { |
| 3601 | _ASN_ERRLOG(app_errlog, app_key, |
| 3602 | "%s: value too large (%s:%d)", |
| 3603 | td->name, __FILE__, __LINE__); |
| 3604 | return -1; |
| 3605 | } |
| 3606 | |
| 3607 | if((value >= -2)) { |
| 3608 | /* Constraint check succeeded */ |
| 3609 | return 0; |
| 3610 | } else { |
| 3611 | _ASN_ERRLOG(app_errlog, app_key, |
| 3612 | "%s: constraint failed (%s:%d)", |
| 3613 | td->name, __FILE__, __LINE__); |
| 3614 | return -1; |
| 3615 | } |
| 3616 | } |
| 3617 | |
| 3618 | static int |
| 3619 | memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3620 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3621 | const Int4_t *st = (const Int4_t *)sptr; |
| 3622 | long value; |
| 3623 | |
| 3624 | if(!sptr) { |
| 3625 | _ASN_ERRLOG(app_errlog, app_key, |
| 3626 | "%s: value not given (%s:%d)", |
| 3627 | td->name, __FILE__, __LINE__); |
| 3628 | return -1; |
| 3629 | } |
| 3630 | |
| 3631 | if(asn_INTEGER2long(st, &value)) { |
| 3632 | _ASN_ERRLOG(app_errlog, app_key, |
| 3633 | "%s: value too large (%s:%d)", |
| 3634 | td->name, __FILE__, __LINE__); |
| 3635 | return -1; |
| 3636 | } |
| 3637 | |
| 3638 | if((value >= 5 && value <= 7)) { |
| 3639 | /* Constraint check succeeded */ |
| 3640 | return 0; |
| 3641 | } else { |
| 3642 | _ASN_ERRLOG(app_errlog, app_key, |
| 3643 | "%s: constraint failed (%s:%d)", |
| 3644 | td->name, __FILE__, __LINE__); |
| 3645 | return -1; |
| 3646 | } |
| 3647 | } |
| 3648 | |
| 3649 | static int |
| 3650 | memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3651 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3652 | const Int5_t *st = (const Int5_t *)sptr; |
| 3653 | long value; |
| 3654 | |
| 3655 | if(!sptr) { |
| 3656 | _ASN_ERRLOG(app_errlog, app_key, |
| 3657 | "%s: value not given (%s:%d)", |
| 3658 | td->name, __FILE__, __LINE__); |
| 3659 | return -1; |
| 3660 | } |
| 3661 | |
| 3662 | if(asn_INTEGER2long(st, &value)) { |
| 3663 | _ASN_ERRLOG(app_errlog, app_key, |
| 3664 | "%s: value too large (%s:%d)", |
| 3665 | td->name, __FILE__, __LINE__); |
| 3666 | return -1; |
| 3667 | } |
| 3668 | |
| 3669 | if((value == 5)) { |
| 3670 | /* Constraint check succeeded */ |
| 3671 | return 0; |
| 3672 | } else { |
| 3673 | _ASN_ERRLOG(app_errlog, app_key, |
| 3674 | "%s: constraint failed (%s:%d)", |
| 3675 | td->name, __FILE__, __LINE__); |
| 3676 | return -1; |
| 3677 | } |
| 3678 | } |
| 3679 | |
| 3680 | |
| 3681 | /*** <<< STAT-DEFS [Sequence] >>> ***/ |
| 3682 | |
| 3683 | static int asn_DFL_2_set_3(void **sptr) { |
| 3684 | Int1_t *st = *sptr; |
| 3685 | |
| 3686 | if(!st) { |
| 3687 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 3688 | if(!st) return -1; |
| 3689 | } |
| 3690 | |
| 3691 | /* Install default value 3 */ |
| 3692 | return asn_long2INTEGER(st, 3); |
| 3693 | } |
| 3694 | static int asn_DFL_5_set_1(void **sptr) { |
| 3695 | BOOLEAN_t *st = *sptr; |
| 3696 | |
| 3697 | if(!st) { |
| 3698 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 3699 | if(!st) return -1; |
| 3700 | } |
| 3701 | |
| 3702 | /* Install default value 1 */ |
| 3703 | *st = 1; |
| 3704 | return 0; |
| 3705 | } |
| 3706 | static asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = { |
| 3707 | { 1, 3, "one" }, |
| 3708 | { 2, 3, "two" }, |
| 3709 | { 3, 5, "three" } |
| 3710 | /* This list is extensible */ |
| 3711 | }; |
| 3712 | static unsigned int asn_MAP_enum_c_enum2value_6[] = { |
| 3713 | 0, /* one(1) */ |
| 3714 | 2, /* three(3) */ |
| 3715 | 1 /* two(2) */ |
| 3716 | /* This list is extensible */ |
| 3717 | }; |
| 3718 | static asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = { |
| 3719 | asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */ |
| 3720 | asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */ |
| 3721 | 3, /* Number of elements in the maps */ |
| 3722 | 3, /* Extensions before this member */ |
| 3723 | 1 /* Strict enumeration */ |
| 3724 | }; |
| 3725 | static ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = { |
| 3726 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 3727 | }; |
| 3728 | static /* Use -fall-defs-global to expose */ |
| 3729 | asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { |
| 3730 | "enum-c", |
| 3731 | "enum-c", |
| 3732 | enum_c_6_free, |
| 3733 | enum_c_6_print, |
| 3734 | enum_c_6_constraint, |
| 3735 | enum_c_6_decode_ber, |
| 3736 | enum_c_6_encode_der, |
| 3737 | enum_c_6_decode_xer, |
| 3738 | enum_c_6_encode_xer, |
| 3739 | 0, /* No PER decoder, -gen-PER to enable */ |
| 3740 | 0, /* Use generic outmost tag fetcher */ |
| 3741 | asn_DEF_enum_c_tags_6, |
| 3742 | sizeof(asn_DEF_enum_c_tags_6) |
| 3743 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
| 3744 | asn_DEF_enum_c_tags_6, /* Same as above */ |
| 3745 | sizeof(asn_DEF_enum_c_tags_6) |
| 3746 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
| 3747 | 0, /* No PER visible constraints */ |
| 3748 | 0, 0, /* Defined elsewhere */ |
| 3749 | &asn_SPC_enum_c_specs_6 /* Additional specs */ |
| 3750 | }; |
| 3751 | |
| 3752 | static asn_TYPE_member_t asn_MBR_Sequence_1[] = { |
| 3753 | { ATF_POINTER, 1, offsetof(struct Sequence, int1_c), |
| 3754 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 3755 | .tag_mode = 0, |
| 3756 | .type = &asn_DEF_Int1, |
| 3757 | .memb_constraints = memb_int1_c_constraint_1, |
| 3758 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3759 | .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ |
| 3760 | .name = "int1-c" |
| 3761 | }, |
| 3762 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4), |
| 3763 | .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), |
| 3764 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 3765 | .type = &asn_DEF_Int4, |
| 3766 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 3767 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3768 | .default_value = 0, |
| 3769 | .name = "int4" |
| 3770 | }, |
| 3771 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c), |
| 3772 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 3773 | .tag_mode = 0, |
| 3774 | .type = &asn_DEF_Int4, |
| 3775 | .memb_constraints = memb_int4_c_constraint_1, |
| 3776 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3777 | .default_value = 0, |
| 3778 | .name = "int4-c" |
| 3779 | }, |
| 3780 | { ATF_POINTER, 1, offsetof(struct Sequence, bool), |
| 3781 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), |
| 3782 | .tag_mode = 0, |
| 3783 | .type = &asn_DEF_BOOLEAN, |
| 3784 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 3785 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3786 | .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */ |
| 3787 | .name = "bool" |
| 3788 | }, |
| 3789 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c), |
| 3790 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), |
| 3791 | .tag_mode = 0, |
| 3792 | .type = &asn_DEF_enum_c_6, |
| 3793 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 3794 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3795 | .default_value = 0, |
| 3796 | .name = "enum-c" |
| 3797 | }, |
| 3798 | { ATF_POINTER, 2, offsetof(struct Sequence, null), |
| 3799 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), |
| 3800 | .tag_mode = 0, |
| 3801 | .type = &asn_DEF_NULL, |
| 3802 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 3803 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3804 | .default_value = 0, |
| 3805 | .name = "null" |
| 3806 | }, |
| 3807 | { ATF_POINTER, 1, offsetof(struct Sequence, int5_c), |
| 3808 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 3809 | .tag_mode = 0, |
| 3810 | .type = &asn_DEF_Int5, |
| 3811 | .memb_constraints = memb_int5_c_constraint_1, |
| 3812 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3813 | .default_value = 0, |
| 3814 | .name = "int5-c" |
| 3815 | }, |
| 3816 | }; |
| 3817 | static ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { |
| 3818 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 3819 | }; |
| 3820 | static asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { |
| 3821 | { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool at 59 */ |
| 3822 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c at 56 */ |
| 3823 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c at 58 */ |
| 3824 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c at 62 */ |
| 3825 | { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null at 64 */ |
| 3826 | { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c at 60 */ |
| 3827 | { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 at 57 */ |
| 3828 | }; |
| 3829 | static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { |
| 3830 | sizeof(struct Sequence), |
| 3831 | offsetof(struct Sequence, _asn_ctx), |
| 3832 | asn_MAP_Sequence_tag2el_1, |
| 3833 | 7, /* Count of tags in the map */ |
| 3834 | 0, 0, 0, /* Optional elements (not needed) */ |
| 3835 | 5, /* Start extensions */ |
| 3836 | 8 /* Stop extensions */ |
| 3837 | }; |
| 3838 | asn_TYPE_descriptor_t asn_DEF_Sequence = { |
| 3839 | "Sequence", |
| 3840 | "Sequence", |
| 3841 | SEQUENCE_free, |
| 3842 | SEQUENCE_print, |
| 3843 | SEQUENCE_constraint, |
| 3844 | SEQUENCE_decode_ber, |
| 3845 | SEQUENCE_encode_der, |
| 3846 | SEQUENCE_decode_xer, |
| 3847 | SEQUENCE_encode_xer, |
| 3848 | 0, /* No PER decoder, -gen-PER to enable */ |
| 3849 | 0, /* Use generic outmost tag fetcher */ |
| 3850 | asn_DEF_Sequence_tags_1, |
| 3851 | sizeof(asn_DEF_Sequence_tags_1) |
| 3852 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 3853 | asn_DEF_Sequence_tags_1, /* Same as above */ |
| 3854 | sizeof(asn_DEF_Sequence_tags_1) |
| 3855 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 3856 | 0, /* No PER visible constraints */ |
| 3857 | asn_MBR_Sequence_1, |
| 3858 | 7, /* Elements count */ |
| 3859 | &asn_SPC_Sequence_specs_1 /* Additional specs */ |
| 3860 | }; |
| 3861 | |
| 3862 | |
| 3863 | /*** <<< INCLUDES [SequenceOf] >>> ***/ |
| 3864 | |
| 3865 | #include <asn_SEQUENCE_OF.h> |
| 3866 | #include <constr_SEQUENCE_OF.h> |
| 3867 | |
| 3868 | /*** <<< FWD-DECLS [SequenceOf] >>> ***/ |
| 3869 | |
| 3870 | struct Sequence; |
| 3871 | |
| 3872 | /*** <<< TYPE-DECLS [SequenceOf] >>> ***/ |
| 3873 | |
| 3874 | typedef struct SequenceOf { |
| 3875 | A_SEQUENCE_OF(struct Sequence) list; |
| 3876 | |
| 3877 | /* Context for parsing across buffer boundaries */ |
| 3878 | asn_struct_ctx_t _asn_ctx; |
| 3879 | } SequenceOf_t; |
| 3880 | |
| 3881 | /*** <<< FUNC-DECLS [SequenceOf] >>> ***/ |
| 3882 | |
| 3883 | extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; |
| 3884 | |
| 3885 | /*** <<< POST-INCLUDE [SequenceOf] >>> ***/ |
| 3886 | |
| 3887 | #include <Sequence.h> |
| 3888 | |
| 3889 | /*** <<< STAT-DEFS [SequenceOf] >>> ***/ |
| 3890 | |
| 3891 | static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = { |
| 3892 | { ATF_POINTER, 0, 0, |
| 3893 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 3894 | .tag_mode = 0, |
| 3895 | .type = &asn_DEF_Sequence, |
| 3896 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 3897 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 3898 | .default_value = 0, |
| 3899 | .name = "" |
| 3900 | }, |
| 3901 | }; |
| 3902 | static ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = { |
| 3903 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 3904 | }; |
| 3905 | static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = { |
| 3906 | sizeof(struct SequenceOf), |
| 3907 | offsetof(struct SequenceOf, _asn_ctx), |
| 3908 | 0, /* XER encoding is XMLDelimitedItemList */ |
| 3909 | }; |
| 3910 | asn_TYPE_descriptor_t asn_DEF_SequenceOf = { |
| 3911 | "SequenceOf", |
| 3912 | "SequenceOf", |
| 3913 | SEQUENCE_OF_free, |
| 3914 | SEQUENCE_OF_print, |
| 3915 | SEQUENCE_OF_constraint, |
| 3916 | SEQUENCE_OF_decode_ber, |
| 3917 | SEQUENCE_OF_encode_der, |
| 3918 | SEQUENCE_OF_decode_xer, |
| 3919 | SEQUENCE_OF_encode_xer, |
| 3920 | 0, /* No PER decoder, -gen-PER to enable */ |
| 3921 | 0, /* Use generic outmost tag fetcher */ |
| 3922 | asn_DEF_SequenceOf_tags_1, |
| 3923 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 3924 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
| 3925 | asn_DEF_SequenceOf_tags_1, /* Same as above */ |
| 3926 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 3927 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
| 3928 | 0, /* No PER visible constraints */ |
| 3929 | asn_MBR_SequenceOf_1, |
| 3930 | 1, /* Single element */ |
| 3931 | &asn_SPC_SequenceOf_specs_1 /* Additional specs */ |
| 3932 | }; |
| 3933 | |
| 3934 | |
| 3935 | /*** <<< INCLUDES [Enum0] >>> ***/ |
| 3936 | |
| 3937 | #include <ENUMERATED.h> |
| 3938 | |
| 3939 | /*** <<< DEPS [Enum0] >>> ***/ |
| 3940 | |
| 3941 | typedef enum Enum0 { |
| 3942 | Enum0_one = 0, |
| 3943 | Enum0_two = 1 |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 3944 | } e_Enum0; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3945 | |
| 3946 | /*** <<< TYPE-DECLS [Enum0] >>> ***/ |
| 3947 | |
| 3948 | typedef ENUMERATED_t Enum0_t; |
| 3949 | |
| 3950 | /*** <<< FUNC-DECLS [Enum0] >>> ***/ |
| 3951 | |
| 3952 | extern asn_TYPE_descriptor_t asn_DEF_Enum0; |
| 3953 | asn_struct_free_f Enum0_free; |
| 3954 | asn_struct_print_f Enum0_print; |
| 3955 | asn_constr_check_f Enum0_constraint; |
| 3956 | ber_type_decoder_f Enum0_decode_ber; |
| 3957 | der_type_encoder_f Enum0_encode_der; |
| 3958 | xer_type_decoder_f Enum0_decode_xer; |
| 3959 | xer_type_encoder_f Enum0_encode_xer; |
| 3960 | |
| 3961 | /*** <<< CODE [Enum0] >>> ***/ |
| 3962 | |
| 3963 | int |
| 3964 | Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3965 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3966 | /* Replace with underlying type checker */ |
| 3967 | td->check_constraints = asn_DEF_ENUMERATED.check_constraints; |
| 3968 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 3969 | } |
| 3970 | |
| 3971 | /* |
| 3972 | * This type is implemented using ENUMERATED, |
| 3973 | * so here we adjust the DEF accordingly. |
| 3974 | */ |
| 3975 | static void |
| 3976 | Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3977 | td->free_struct = asn_DEF_ENUMERATED.free_struct; |
| 3978 | td->print_struct = asn_DEF_ENUMERATED.print_struct; |
| 3979 | td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; |
| 3980 | td->der_encoder = asn_DEF_ENUMERATED.der_encoder; |
| 3981 | td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; |
| 3982 | td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; |
| 3983 | td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; |
| 3984 | if(!td->per_constraints) |
| 3985 | td->per_constraints = asn_DEF_ENUMERATED.per_constraints; |
| 3986 | td->elements = asn_DEF_ENUMERATED.elements; |
| 3987 | td->elements_count = asn_DEF_ENUMERATED.elements_count; |
| 3988 | /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ |
| 3989 | } |
| 3990 | |
| 3991 | void |
| 3992 | Enum0_free(asn_TYPE_descriptor_t *td, |
| 3993 | void *struct_ptr, int contents_only) { |
| 3994 | Enum0_1_inherit_TYPE_descriptor(td); |
| 3995 | td->free_struct(td, struct_ptr, contents_only); |
| 3996 | } |
| 3997 | |
| 3998 | int |
| 3999 | Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4000 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4001 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4002 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4003 | } |
| 4004 | |
| 4005 | asn_dec_rval_t |
| 4006 | Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4007 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4008 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4009 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4010 | } |
| 4011 | |
| 4012 | asn_enc_rval_t |
| 4013 | Enum0_encode_der(asn_TYPE_descriptor_t *td, |
| 4014 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4015 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4016 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4017 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4018 | } |
| 4019 | |
| 4020 | asn_dec_rval_t |
| 4021 | Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4022 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4023 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4024 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4025 | } |
| 4026 | |
| 4027 | asn_enc_rval_t |
| 4028 | Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4029 | int ilevel, enum xer_encoder_flags_e flags, |
| 4030 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4031 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4032 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4033 | } |
| 4034 | |
| 4035 | |
| 4036 | /*** <<< STAT-DEFS [Enum0] >>> ***/ |
| 4037 | |
| 4038 | static asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = { |
| 4039 | { 0, 3, "one" }, |
| 4040 | { 1, 3, "two" } |
| 4041 | }; |
| 4042 | static unsigned int asn_MAP_Enum0_enum2value_1[] = { |
| 4043 | 0, /* one(0) */ |
| 4044 | 1 /* two(1) */ |
| 4045 | }; |
| 4046 | static asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = { |
| 4047 | asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4048 | asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */ |
| 4049 | 2, /* Number of elements in the maps */ |
| 4050 | 0, /* Enumeration is not extensible */ |
| 4051 | 1 /* Strict enumeration */ |
| 4052 | }; |
| 4053 | static ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = { |
| 4054 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4055 | }; |
| 4056 | asn_TYPE_descriptor_t asn_DEF_Enum0 = { |
| 4057 | "Enum0", |
| 4058 | "Enum0", |
| 4059 | Enum0_free, |
| 4060 | Enum0_print, |
| 4061 | Enum0_constraint, |
| 4062 | Enum0_decode_ber, |
| 4063 | Enum0_encode_der, |
| 4064 | Enum0_decode_xer, |
| 4065 | Enum0_encode_xer, |
| 4066 | 0, /* No PER decoder, -gen-PER to enable */ |
| 4067 | 0, /* Use generic outmost tag fetcher */ |
| 4068 | asn_DEF_Enum0_tags_1, |
| 4069 | sizeof(asn_DEF_Enum0_tags_1) |
| 4070 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
| 4071 | asn_DEF_Enum0_tags_1, /* Same as above */ |
| 4072 | sizeof(asn_DEF_Enum0_tags_1) |
| 4073 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
| 4074 | 0, /* No PER visible constraints */ |
| 4075 | 0, 0, /* Defined elsewhere */ |
| 4076 | &asn_SPC_Enum0_specs_1 /* Additional specs */ |
| 4077 | }; |
| 4078 | |
| 4079 | |
| 4080 | /*** <<< INCLUDES [Enum1] >>> ***/ |
| 4081 | |
| 4082 | #include <NativeEnumerated.h> |
| 4083 | |
| 4084 | /*** <<< DEPS [Enum1] >>> ***/ |
| 4085 | |
| 4086 | typedef enum Enum1 { |
| 4087 | Enum1_one = 0, |
| 4088 | Enum1_two = 1 |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4089 | } e_Enum1; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4090 | |
| 4091 | /*** <<< TYPE-DECLS [Enum1] >>> ***/ |
| 4092 | |
| 4093 | typedef long Enum1_t; |
| 4094 | |
| 4095 | /*** <<< FUNC-DECLS [Enum1] >>> ***/ |
| 4096 | |
| 4097 | extern asn_TYPE_descriptor_t asn_DEF_Enum1; |
| 4098 | asn_struct_free_f Enum1_free; |
| 4099 | asn_struct_print_f Enum1_print; |
| 4100 | asn_constr_check_f Enum1_constraint; |
| 4101 | ber_type_decoder_f Enum1_decode_ber; |
| 4102 | der_type_encoder_f Enum1_encode_der; |
| 4103 | xer_type_decoder_f Enum1_decode_xer; |
| 4104 | xer_type_encoder_f Enum1_encode_xer; |
| 4105 | |
| 4106 | /*** <<< CODE [Enum1] >>> ***/ |
| 4107 | |
| 4108 | int |
| 4109 | Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 4110 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 4111 | long value; |
| 4112 | |
| 4113 | if(!sptr) { |
| 4114 | _ASN_ERRLOG(app_errlog, app_key, |
| 4115 | "%s: value not given (%s:%d)", |
| 4116 | td->name, __FILE__, __LINE__); |
| 4117 | return -1; |
| 4118 | } |
| 4119 | |
| 4120 | value = *(const long *)sptr; |
| 4121 | |
| 4122 | if((value == 0)) { |
| 4123 | /* Constraint check succeeded */ |
| 4124 | return 0; |
| 4125 | } else { |
| 4126 | _ASN_ERRLOG(app_errlog, app_key, |
| 4127 | "%s: constraint failed (%s:%d)", |
| 4128 | td->name, __FILE__, __LINE__); |
| 4129 | return -1; |
| 4130 | } |
| 4131 | } |
| 4132 | |
| 4133 | /* |
| 4134 | * This type is implemented using NativeEnumerated, |
| 4135 | * so here we adjust the DEF accordingly. |
| 4136 | */ |
| 4137 | static void |
| 4138 | Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4139 | td->free_struct = asn_DEF_NativeEnumerated.free_struct; |
| 4140 | td->print_struct = asn_DEF_NativeEnumerated.print_struct; |
| 4141 | td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; |
| 4142 | td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; |
| 4143 | td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; |
| 4144 | td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; |
| 4145 | td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; |
| 4146 | if(!td->per_constraints) |
| 4147 | td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; |
| 4148 | td->elements = asn_DEF_NativeEnumerated.elements; |
| 4149 | td->elements_count = asn_DEF_NativeEnumerated.elements_count; |
| 4150 | /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ |
| 4151 | } |
| 4152 | |
| 4153 | void |
| 4154 | Enum1_free(asn_TYPE_descriptor_t *td, |
| 4155 | void *struct_ptr, int contents_only) { |
| 4156 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4157 | td->free_struct(td, struct_ptr, contents_only); |
| 4158 | } |
| 4159 | |
| 4160 | int |
| 4161 | Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4162 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4163 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4164 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4165 | } |
| 4166 | |
| 4167 | asn_dec_rval_t |
| 4168 | Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4169 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4170 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4171 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4172 | } |
| 4173 | |
| 4174 | asn_enc_rval_t |
| 4175 | Enum1_encode_der(asn_TYPE_descriptor_t *td, |
| 4176 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4177 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4178 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4179 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4180 | } |
| 4181 | |
| 4182 | asn_dec_rval_t |
| 4183 | Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4184 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4185 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4186 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4187 | } |
| 4188 | |
| 4189 | asn_enc_rval_t |
| 4190 | Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4191 | int ilevel, enum xer_encoder_flags_e flags, |
| 4192 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4193 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4194 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4195 | } |
| 4196 | |
| 4197 | |
| 4198 | /*** <<< STAT-DEFS [Enum1] >>> ***/ |
| 4199 | |
| 4200 | static asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { |
| 4201 | { 0, 3, "one" }, |
| 4202 | { 1, 3, "two" } |
| 4203 | }; |
| 4204 | static unsigned int asn_MAP_Enum1_enum2value_1[] = { |
| 4205 | 0, /* one(0) */ |
| 4206 | 1 /* two(1) */ |
| 4207 | }; |
| 4208 | static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { |
| 4209 | asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4210 | asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ |
| 4211 | 2, /* Number of elements in the maps */ |
| 4212 | 0, /* Enumeration is not extensible */ |
| 4213 | 1 /* Strict enumeration */ |
| 4214 | }; |
| 4215 | static ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { |
| 4216 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4217 | }; |
| 4218 | asn_TYPE_descriptor_t asn_DEF_Enum1 = { |
| 4219 | "Enum1", |
| 4220 | "Enum1", |
| 4221 | Enum1_free, |
| 4222 | Enum1_print, |
| 4223 | Enum1_constraint, |
| 4224 | Enum1_decode_ber, |
| 4225 | Enum1_encode_der, |
| 4226 | Enum1_decode_xer, |
| 4227 | Enum1_encode_xer, |
| 4228 | 0, /* No PER decoder, -gen-PER to enable */ |
| 4229 | 0, /* Use generic outmost tag fetcher */ |
| 4230 | asn_DEF_Enum1_tags_1, |
| 4231 | sizeof(asn_DEF_Enum1_tags_1) |
| 4232 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
| 4233 | asn_DEF_Enum1_tags_1, /* Same as above */ |
| 4234 | sizeof(asn_DEF_Enum1_tags_1) |
| 4235 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
| 4236 | 0, /* No PER visible constraints */ |
| 4237 | 0, 0, /* Defined elsewhere */ |
| 4238 | &asn_SPC_Enum1_specs_1 /* Additional specs */ |
| 4239 | }; |
| 4240 | |
| 4241 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 4242 | /*** <<< INCLUDES [Identifier] >>> ***/ |
| 4243 | |
| 4244 | #include <VisibleString.h> |
| 4245 | |
| 4246 | /*** <<< TYPE-DECLS [Identifier] >>> ***/ |
| 4247 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 4248 | typedef VisibleString_t Identifier_t; |
| 4249 | |
| 4250 | /*** <<< FUNC-DECLS [Identifier] >>> ***/ |
| 4251 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4252 | extern asn_TYPE_descriptor_t asn_DEF_Identifier; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 4253 | asn_struct_free_f Identifier_free; |
| 4254 | asn_struct_print_f Identifier_print; |
| 4255 | asn_constr_check_f Identifier_constraint; |
| 4256 | ber_type_decoder_f Identifier_decode_ber; |
| 4257 | der_type_encoder_f Identifier_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 4258 | xer_type_decoder_f Identifier_decode_xer; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 4259 | xer_type_encoder_f Identifier_encode_xer; |
| 4260 | |
| 4261 | /*** <<< CTABLES [Identifier] >>> ***/ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4262 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4263 | static int permitted_alphabet_table_1[256] = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4264 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 4265 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 4266 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */ |
| 4267 | 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */ |
| 4268 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 4269 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */ |
| 4270 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 4271 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 4272 | }; |
| 4273 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4274 | static int check_permitted_alphabet_1(const void *sptr) { |
| 4275 | int *table = permitted_alphabet_table_1; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4276 | /* The underlying type is VisibleString */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 4277 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4278 | const uint8_t *ch = st->buf; |
| 4279 | const uint8_t *end = ch + st->size; |
| 4280 | |
| 4281 | for(; ch < end; ch++) { |
| 4282 | uint8_t cv = *ch; |
| 4283 | if(!table[cv]) return -1; |
| 4284 | } |
| 4285 | return 0; |
| 4286 | } |
| 4287 | |
| 4288 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 4289 | /*** <<< CODE [Identifier] >>> ***/ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4290 | |
| 4291 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4292 | Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4293 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 4294 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4295 | size_t size; |
| 4296 | |
| 4297 | if(!sptr) { |
| 4298 | _ASN_ERRLOG(app_errlog, app_key, |
| 4299 | "%s: value not given (%s:%d)", |
| 4300 | td->name, __FILE__, __LINE__); |
| 4301 | return -1; |
| 4302 | } |
| 4303 | |
| 4304 | size = st->size; |
| 4305 | |
| 4306 | if((size >= 1 && size <= 32) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4307 | && !check_permitted_alphabet_1(st)) { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4308 | /* Constraint check succeeded */ |
| 4309 | return 0; |
| 4310 | } else { |
| 4311 | _ASN_ERRLOG(app_errlog, app_key, |
| 4312 | "%s: constraint failed (%s:%d)", |
| 4313 | td->name, __FILE__, __LINE__); |
| 4314 | return -1; |
| 4315 | } |
| 4316 | } |
| 4317 | |
| 4318 | /* |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4319 | * This type is implemented using VisibleString, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 4320 | * so here we adjust the DEF accordingly. |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4321 | */ |
| 4322 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4323 | Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4324 | td->free_struct = asn_DEF_VisibleString.free_struct; |
| 4325 | td->print_struct = asn_DEF_VisibleString.print_struct; |
| 4326 | td->ber_decoder = asn_DEF_VisibleString.ber_decoder; |
| 4327 | td->der_encoder = asn_DEF_VisibleString.der_encoder; |
| 4328 | td->xer_decoder = asn_DEF_VisibleString.xer_decoder; |
| 4329 | td->xer_encoder = asn_DEF_VisibleString.xer_encoder; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4330 | td->uper_decoder = asn_DEF_VisibleString.uper_decoder; |
| 4331 | if(!td->per_constraints) |
| 4332 | td->per_constraints = asn_DEF_VisibleString.per_constraints; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4333 | td->elements = asn_DEF_VisibleString.elements; |
| 4334 | td->elements_count = asn_DEF_VisibleString.elements_count; |
| 4335 | td->specifics = asn_DEF_VisibleString.specifics; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4336 | } |
| 4337 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4338 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4339 | Identifier_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4340 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4341 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4342 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4343 | } |
| 4344 | |
| 4345 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4346 | Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4347 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4348 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4349 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4350 | } |
| 4351 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 4352 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4353 | Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 4354 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4355 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4356 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4357 | } |
| 4358 | |
| 4359 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4360 | Identifier_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4361 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4362 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4363 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4364 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4365 | } |
| 4366 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 4367 | asn_dec_rval_t |
| 4368 | Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 4369 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4370 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 4371 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4372 | } |
| 4373 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4374 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4375 | Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4376 | int ilevel, enum xer_encoder_flags_e flags, |
| 4377 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 4378 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4379 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4380 | } |
| 4381 | |
| 4382 | |
| 4383 | /*** <<< STAT-DEFS [Identifier] >>> ***/ |
| 4384 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4385 | static ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4386 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 4387 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 4388 | asn_TYPE_descriptor_t asn_DEF_Identifier = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4389 | "Identifier", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 4390 | "Identifier", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4391 | Identifier_free, |
| 4392 | Identifier_print, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4393 | Identifier_constraint, |
| 4394 | Identifier_decode_ber, |
| 4395 | Identifier_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 4396 | Identifier_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 4397 | Identifier_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4398 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4399 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4400 | asn_DEF_Identifier_tags_1, |
| 4401 | sizeof(asn_DEF_Identifier_tags_1) |
| 4402 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
| 4403 | asn_DEF_Identifier_tags_1, /* Same as above */ |
| 4404 | sizeof(asn_DEF_Identifier_tags_1) |
| 4405 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
| 4406 | 0, /* No PER visible constraints */ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 4407 | 0, 0, /* No members */ |
| 4408 | 0 /* No specifics */ |
| 4409 | }; |
| 4410 | |