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