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 | |
| 8 | |
| 9 | typedef INTEGER_t Int1_t; |
| 10 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 11 | /*** <<< FUNC-DECLS [Int1] >>> ***/ |
| 12 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 13 | /* This type is equivalent to INTEGER */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 14 | #define asn_DEF_Int1 asn_DEF_INTEGER |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 15 | |
| 16 | /*** <<< CODE [Int1] >>> ***/ |
| 17 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 18 | /* This type is equivalent to INTEGER */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 19 | |
| 20 | |
| 21 | /*** <<< INCLUDES [Int2] >>> ***/ |
| 22 | |
| 23 | #include <Int1.h> |
| 24 | |
| 25 | /*** <<< TYPE-DECLS [Int2] >>> ***/ |
| 26 | |
| 27 | |
| 28 | typedef Int1_t Int2_t; |
| 29 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 30 | /*** <<< FUNC-DECLS [Int2] >>> ***/ |
| 31 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 32 | extern asn_TYPE_descriptor_t asn_DEF_Int2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 33 | asn_struct_free_f Int2_free; |
| 34 | asn_struct_print_f Int2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 35 | asn_constr_check_f Int2_constraint; |
| 36 | ber_type_decoder_f Int2_decode_ber; |
| 37 | der_type_encoder_f Int2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 38 | xer_type_decoder_f Int2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 39 | xer_type_encoder_f Int2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 40 | |
| 41 | /*** <<< CODE [Int2] >>> ***/ |
| 42 | |
| 43 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 44 | Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 45 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 46 | const Int1_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 47 | long value; |
| 48 | |
| 49 | if(!sptr) { |
| 50 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 51 | "%s: value not given (%s:%d)", |
| 52 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 53 | return -1; |
| 54 | } |
| 55 | |
vlm | 34ce8ad | 2004-09-07 06:43:57 +0000 | [diff] [blame] | 56 | /* Check if the sign bit is present */ |
| 57 | value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 58 | |
| 59 | if((value >= 0)) { |
| 60 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 61 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 62 | } else { |
| 63 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 64 | "%s: constraint failed (%s:%d)", |
| 65 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 66 | return -1; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * This type is implemented using Int1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 72 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 73 | */ |
| 74 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 75 | Int2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 76 | td->free_struct = asn_DEF_Int1.free_struct; |
| 77 | td->print_struct = asn_DEF_Int1.print_struct; |
| 78 | td->ber_decoder = asn_DEF_Int1.ber_decoder; |
| 79 | td->der_encoder = asn_DEF_Int1.der_encoder; |
| 80 | td->xer_decoder = asn_DEF_Int1.xer_decoder; |
| 81 | td->xer_encoder = asn_DEF_Int1.xer_encoder; |
| 82 | td->elements = asn_DEF_Int1.elements; |
| 83 | td->elements_count = asn_DEF_Int1.elements_count; |
| 84 | td->specifics = asn_DEF_Int1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 85 | } |
| 86 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 87 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 88 | Int2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 89 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 90 | Int2_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 91 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 95 | Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 96 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 97 | Int2_inherit_TYPE_descriptor(td); |
| 98 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 99 | } |
| 100 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 101 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 102 | Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 103 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 104 | Int2_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 105 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 109 | Int2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 110 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 111 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 112 | Int2_inherit_TYPE_descriptor(td); |
| 113 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 114 | } |
| 115 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 116 | asn_dec_rval_t |
| 117 | Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 118 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 119 | Int2_inherit_TYPE_descriptor(td); |
| 120 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 121 | } |
| 122 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 123 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 124 | Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 125 | int ilevel, enum xer_encoder_flags_e flags, |
| 126 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 127 | Int2_inherit_TYPE_descriptor(td); |
| 128 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | |
| 132 | /*** <<< STAT-DEFS [Int2] >>> ***/ |
| 133 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 134 | static ber_tlv_tag_t asn_DEF_Int2_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 135 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 136 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 137 | asn_TYPE_descriptor_t asn_DEF_Int2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 138 | "Int2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 139 | "Int2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 140 | Int2_free, |
| 141 | Int2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 142 | Int2_constraint, |
| 143 | Int2_decode_ber, |
| 144 | Int2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 145 | Int2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 146 | Int2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 147 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 148 | asn_DEF_Int2_tags, |
| 149 | sizeof(asn_DEF_Int2_tags) |
| 150 | /sizeof(asn_DEF_Int2_tags[0]), /* 1 */ |
| 151 | asn_DEF_Int2_tags, /* Same as above */ |
| 152 | sizeof(asn_DEF_Int2_tags) |
| 153 | /sizeof(asn_DEF_Int2_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 154 | 0, 0, /* No members */ |
| 155 | 0 /* No specifics */ |
| 156 | }; |
| 157 | |
| 158 | |
| 159 | /*** <<< INCLUDES [Int3] >>> ***/ |
| 160 | |
| 161 | #include <Int2.h> |
| 162 | |
| 163 | /*** <<< TYPE-DECLS [Int3] >>> ***/ |
| 164 | |
| 165 | |
| 166 | typedef Int2_t Int3_t; |
| 167 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 168 | /*** <<< FUNC-DECLS [Int3] >>> ***/ |
| 169 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 170 | extern asn_TYPE_descriptor_t asn_DEF_Int3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 171 | asn_struct_free_f Int3_free; |
| 172 | asn_struct_print_f Int3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 173 | asn_constr_check_f Int3_constraint; |
| 174 | ber_type_decoder_f Int3_decode_ber; |
| 175 | der_type_encoder_f Int3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 176 | xer_type_decoder_f Int3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 177 | xer_type_encoder_f Int3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 178 | |
| 179 | /*** <<< CODE [Int3] >>> ***/ |
| 180 | |
| 181 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 182 | Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 183 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 184 | const Int2_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 185 | long value; |
| 186 | |
| 187 | if(!sptr) { |
| 188 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 189 | "%s: value not given (%s:%d)", |
| 190 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 191 | return -1; |
| 192 | } |
| 193 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 194 | if(asn_INTEGER2long(st, &value)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 195 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 196 | "%s: value too large (%s:%d)", |
| 197 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 198 | return -1; |
| 199 | } |
| 200 | |
| 201 | if((value >= 0 && value <= 10)) { |
| 202 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 203 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 204 | } else { |
| 205 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 206 | "%s: constraint failed (%s:%d)", |
| 207 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 208 | return -1; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | /* |
| 213 | * This type is implemented using Int2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 214 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 215 | */ |
| 216 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 217 | Int3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 218 | td->free_struct = asn_DEF_Int2.free_struct; |
| 219 | td->print_struct = asn_DEF_Int2.print_struct; |
| 220 | td->ber_decoder = asn_DEF_Int2.ber_decoder; |
| 221 | td->der_encoder = asn_DEF_Int2.der_encoder; |
| 222 | td->xer_decoder = asn_DEF_Int2.xer_decoder; |
| 223 | td->xer_encoder = asn_DEF_Int2.xer_encoder; |
| 224 | td->elements = asn_DEF_Int2.elements; |
| 225 | td->elements_count = asn_DEF_Int2.elements_count; |
| 226 | td->specifics = asn_DEF_Int2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 227 | } |
| 228 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 229 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 230 | Int3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 231 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 232 | Int3_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 233 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 237 | Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 238 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 239 | Int3_inherit_TYPE_descriptor(td); |
| 240 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 241 | } |
| 242 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 243 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 244 | Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 245 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 246 | Int3_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 247 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 251 | Int3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 252 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 253 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 254 | Int3_inherit_TYPE_descriptor(td); |
| 255 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 256 | } |
| 257 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 258 | asn_dec_rval_t |
| 259 | Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 260 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 261 | Int3_inherit_TYPE_descriptor(td); |
| 262 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 263 | } |
| 264 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 265 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 266 | Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 267 | int ilevel, enum xer_encoder_flags_e flags, |
| 268 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 269 | Int3_inherit_TYPE_descriptor(td); |
| 270 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | |
| 274 | /*** <<< STAT-DEFS [Int3] >>> ***/ |
| 275 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 276 | static ber_tlv_tag_t asn_DEF_Int3_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 277 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 278 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 279 | asn_TYPE_descriptor_t asn_DEF_Int3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 280 | "Int3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 281 | "Int3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 282 | Int3_free, |
| 283 | Int3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 284 | Int3_constraint, |
| 285 | Int3_decode_ber, |
| 286 | Int3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 287 | Int3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 288 | Int3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 289 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 290 | asn_DEF_Int3_tags, |
| 291 | sizeof(asn_DEF_Int3_tags) |
| 292 | /sizeof(asn_DEF_Int3_tags[0]), /* 1 */ |
| 293 | asn_DEF_Int3_tags, /* Same as above */ |
| 294 | sizeof(asn_DEF_Int3_tags) |
| 295 | /sizeof(asn_DEF_Int3_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 296 | 0, 0, /* No members */ |
| 297 | 0 /* No specifics */ |
| 298 | }; |
| 299 | |
| 300 | |
| 301 | /*** <<< INCLUDES [Int4] >>> ***/ |
| 302 | |
| 303 | #include <Int3.h> |
| 304 | |
| 305 | /*** <<< TYPE-DECLS [Int4] >>> ***/ |
| 306 | |
| 307 | |
| 308 | typedef Int3_t Int4_t; |
| 309 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 310 | /*** <<< FUNC-DECLS [Int4] >>> ***/ |
| 311 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 312 | extern asn_TYPE_descriptor_t asn_DEF_Int4; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 313 | asn_struct_free_f Int4_free; |
| 314 | asn_struct_print_f Int4_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 315 | asn_constr_check_f Int4_constraint; |
| 316 | ber_type_decoder_f Int4_decode_ber; |
| 317 | der_type_encoder_f Int4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 318 | xer_type_decoder_f Int4_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 319 | xer_type_encoder_f Int4_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 320 | |
| 321 | /*** <<< CODE [Int4] >>> ***/ |
| 322 | |
| 323 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 324 | Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 325 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 326 | const Int3_t *st = sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 327 | long value; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 328 | |
| 329 | if(!sptr) { |
| 330 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 331 | "%s: value not given (%s:%d)", |
| 332 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 333 | return -1; |
| 334 | } |
| 335 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 336 | if(asn_INTEGER2long(st, &value)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 337 | _ASN_ERRLOG(app_errlog, app_key, |
| 338 | "%s: value too large (%s:%d)", |
| 339 | td->name, __FILE__, __LINE__); |
| 340 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 341 | } |
| 342 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 343 | if((value >= 1 && value <= 10)) { |
| 344 | /* Constraint check succeeded */ |
| 345 | return 0; |
| 346 | } else { |
| 347 | _ASN_ERRLOG(app_errlog, app_key, |
| 348 | "%s: constraint failed (%s:%d)", |
| 349 | td->name, __FILE__, __LINE__); |
| 350 | return -1; |
| 351 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | /* |
| 355 | * This type is implemented using Int3, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 356 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 357 | */ |
| 358 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 359 | Int4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 360 | td->free_struct = asn_DEF_Int3.free_struct; |
| 361 | td->print_struct = asn_DEF_Int3.print_struct; |
| 362 | td->ber_decoder = asn_DEF_Int3.ber_decoder; |
| 363 | td->der_encoder = asn_DEF_Int3.der_encoder; |
| 364 | td->xer_decoder = asn_DEF_Int3.xer_decoder; |
| 365 | td->xer_encoder = asn_DEF_Int3.xer_encoder; |
| 366 | td->elements = asn_DEF_Int3.elements; |
| 367 | td->elements_count = asn_DEF_Int3.elements_count; |
| 368 | td->specifics = asn_DEF_Int3.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 369 | } |
| 370 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 371 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 372 | Int4_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 373 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 374 | Int4_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 375 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 376 | } |
| 377 | |
| 378 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 379 | Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 380 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 381 | Int4_inherit_TYPE_descriptor(td); |
| 382 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 383 | } |
| 384 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 385 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 386 | Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 387 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 388 | Int4_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 389 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 393 | Int4_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 394 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 395 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 396 | Int4_inherit_TYPE_descriptor(td); |
| 397 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 398 | } |
| 399 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 400 | asn_dec_rval_t |
| 401 | Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 402 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 403 | Int4_inherit_TYPE_descriptor(td); |
| 404 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 405 | } |
| 406 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 407 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 408 | Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 409 | int ilevel, enum xer_encoder_flags_e flags, |
| 410 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 411 | Int4_inherit_TYPE_descriptor(td); |
| 412 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 413 | } |
| 414 | |
| 415 | |
| 416 | /*** <<< STAT-DEFS [Int4] >>> ***/ |
| 417 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 418 | static ber_tlv_tag_t asn_DEF_Int4_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 419 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 420 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 421 | asn_TYPE_descriptor_t asn_DEF_Int4 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 422 | "Int4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 423 | "Int4", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 424 | Int4_free, |
| 425 | Int4_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 426 | Int4_constraint, |
| 427 | Int4_decode_ber, |
| 428 | Int4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 429 | Int4_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 430 | Int4_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 431 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 432 | asn_DEF_Int4_tags, |
| 433 | sizeof(asn_DEF_Int4_tags) |
| 434 | /sizeof(asn_DEF_Int4_tags[0]), /* 1 */ |
| 435 | asn_DEF_Int4_tags, /* Same as above */ |
| 436 | sizeof(asn_DEF_Int4_tags) |
| 437 | /sizeof(asn_DEF_Int4_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 438 | 0, 0, /* No members */ |
| 439 | 0 /* No specifics */ |
| 440 | }; |
| 441 | |
| 442 | |
| 443 | /*** <<< INCLUDES [Int5] >>> ***/ |
| 444 | |
| 445 | #include <Int4.h> |
| 446 | |
| 447 | /*** <<< TYPE-DECLS [Int5] >>> ***/ |
| 448 | |
| 449 | |
| 450 | typedef Int4_t Int5_t; |
| 451 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 452 | /*** <<< FUNC-DECLS [Int5] >>> ***/ |
| 453 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 454 | extern asn_TYPE_descriptor_t asn_DEF_Int5; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 455 | asn_struct_free_f Int5_free; |
| 456 | asn_struct_print_f Int5_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 457 | asn_constr_check_f Int5_constraint; |
| 458 | ber_type_decoder_f Int5_decode_ber; |
| 459 | der_type_encoder_f Int5_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 460 | xer_type_decoder_f Int5_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 461 | xer_type_encoder_f Int5_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 462 | |
| 463 | /*** <<< CODE [Int5] >>> ***/ |
| 464 | |
| 465 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 466 | Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 467 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 468 | const Int4_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 469 | long value; |
| 470 | |
| 471 | if(!sptr) { |
| 472 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 473 | "%s: value not given (%s:%d)", |
| 474 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 475 | return -1; |
| 476 | } |
| 477 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 478 | if(asn_INTEGER2long(st, &value)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 479 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 480 | "%s: value too large (%s:%d)", |
| 481 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 482 | return -1; |
| 483 | } |
| 484 | |
| 485 | if((value == 5)) { |
| 486 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 487 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 488 | } else { |
| 489 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 490 | "%s: constraint failed (%s:%d)", |
| 491 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 492 | return -1; |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | /* |
| 497 | * This type is implemented using Int4, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 498 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 499 | */ |
| 500 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 501 | Int5_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 502 | td->free_struct = asn_DEF_Int4.free_struct; |
| 503 | td->print_struct = asn_DEF_Int4.print_struct; |
| 504 | td->ber_decoder = asn_DEF_Int4.ber_decoder; |
| 505 | td->der_encoder = asn_DEF_Int4.der_encoder; |
| 506 | td->xer_decoder = asn_DEF_Int4.xer_decoder; |
| 507 | td->xer_encoder = asn_DEF_Int4.xer_encoder; |
| 508 | td->elements = asn_DEF_Int4.elements; |
| 509 | td->elements_count = asn_DEF_Int4.elements_count; |
| 510 | td->specifics = asn_DEF_Int4.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 511 | } |
| 512 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 513 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 514 | Int5_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 515 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 516 | Int5_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 517 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 521 | Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 522 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 523 | Int5_inherit_TYPE_descriptor(td); |
| 524 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 525 | } |
| 526 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 527 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 528 | Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 529 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 530 | Int5_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 531 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 535 | Int5_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 536 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 537 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 538 | Int5_inherit_TYPE_descriptor(td); |
| 539 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 540 | } |
| 541 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 542 | asn_dec_rval_t |
| 543 | Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 544 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 545 | Int5_inherit_TYPE_descriptor(td); |
| 546 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 547 | } |
| 548 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 549 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 550 | Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 551 | int ilevel, enum xer_encoder_flags_e flags, |
| 552 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 553 | Int5_inherit_TYPE_descriptor(td); |
| 554 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 555 | } |
| 556 | |
| 557 | |
| 558 | /*** <<< STAT-DEFS [Int5] >>> ***/ |
| 559 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 560 | static ber_tlv_tag_t asn_DEF_Int5_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 561 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 562 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 563 | asn_TYPE_descriptor_t asn_DEF_Int5 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 564 | "Int5", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 565 | "Int5", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 566 | Int5_free, |
| 567 | Int5_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 568 | Int5_constraint, |
| 569 | Int5_decode_ber, |
| 570 | Int5_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 571 | Int5_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 572 | Int5_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 573 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 574 | asn_DEF_Int5_tags, |
| 575 | sizeof(asn_DEF_Int5_tags) |
| 576 | /sizeof(asn_DEF_Int5_tags[0]), /* 1 */ |
| 577 | asn_DEF_Int5_tags, /* Same as above */ |
| 578 | sizeof(asn_DEF_Int5_tags) |
| 579 | /sizeof(asn_DEF_Int5_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 580 | 0, 0, /* No members */ |
| 581 | 0 /* No specifics */ |
| 582 | }; |
| 583 | |
| 584 | |
| 585 | /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ |
| 586 | |
| 587 | #include <INTEGER.h> |
| 588 | |
| 589 | /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ |
| 590 | |
| 591 | |
| 592 | typedef INTEGER_t ExtensibleExtensions_t; |
| 593 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 594 | /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ |
| 595 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 596 | extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 597 | asn_struct_free_f ExtensibleExtensions_free; |
| 598 | asn_struct_print_f ExtensibleExtensions_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 599 | asn_constr_check_f ExtensibleExtensions_constraint; |
| 600 | ber_type_decoder_f ExtensibleExtensions_decode_ber; |
| 601 | der_type_encoder_f ExtensibleExtensions_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 602 | xer_type_decoder_f ExtensibleExtensions_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 603 | xer_type_encoder_f ExtensibleExtensions_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 604 | |
| 605 | /*** <<< CODE [ExtensibleExtensions] >>> ***/ |
| 606 | |
| 607 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 608 | ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 609 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 610 | const INTEGER_t *st = sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 611 | long value; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 612 | |
| 613 | if(!sptr) { |
| 614 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 615 | "%s: value not given (%s:%d)", |
| 616 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 617 | return -1; |
| 618 | } |
| 619 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 620 | if(asn_INTEGER2long(st, &value)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 621 | _ASN_ERRLOG(app_errlog, app_key, |
| 622 | "%s: value too large (%s:%d)", |
| 623 | td->name, __FILE__, __LINE__); |
| 624 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 625 | } |
| 626 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 627 | if((value >= 1 && value <= 256)) { |
| 628 | /* Constraint check succeeded */ |
| 629 | return 0; |
| 630 | } else { |
| 631 | _ASN_ERRLOG(app_errlog, app_key, |
| 632 | "%s: constraint failed (%s:%d)", |
| 633 | td->name, __FILE__, __LINE__); |
| 634 | return -1; |
| 635 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | /* |
| 639 | * This type is implemented using INTEGER, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 640 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 641 | */ |
| 642 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 643 | ExtensibleExtensions_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 644 | td->free_struct = asn_DEF_INTEGER.free_struct; |
| 645 | td->print_struct = asn_DEF_INTEGER.print_struct; |
| 646 | td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 647 | td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 648 | td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 649 | td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
| 650 | td->elements = asn_DEF_INTEGER.elements; |
| 651 | td->elements_count = asn_DEF_INTEGER.elements_count; |
| 652 | td->specifics = asn_DEF_INTEGER.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 653 | } |
| 654 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 655 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 656 | ExtensibleExtensions_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 657 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 658 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 659 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 660 | } |
| 661 | |
| 662 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 663 | ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 664 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 665 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 666 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 667 | } |
| 668 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 669 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 670 | ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 671 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 672 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 673 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 674 | } |
| 675 | |
| 676 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 677 | ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 678 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 679 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 680 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 681 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 682 | } |
| 683 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 684 | asn_dec_rval_t |
| 685 | ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 686 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 687 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 688 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 689 | } |
| 690 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 691 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 692 | ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 693 | int ilevel, enum xer_encoder_flags_e flags, |
| 694 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 695 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 696 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | |
| 700 | /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ |
| 701 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 702 | static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 703 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 704 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 705 | asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 706 | "ExtensibleExtensions", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 707 | "ExtensibleExtensions", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 708 | ExtensibleExtensions_free, |
| 709 | ExtensibleExtensions_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 710 | ExtensibleExtensions_constraint, |
| 711 | ExtensibleExtensions_decode_ber, |
| 712 | ExtensibleExtensions_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 713 | ExtensibleExtensions_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 714 | ExtensibleExtensions_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 715 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 716 | asn_DEF_ExtensibleExtensions_tags, |
| 717 | sizeof(asn_DEF_ExtensibleExtensions_tags) |
| 718 | /sizeof(asn_DEF_ExtensibleExtensions_tags[0]), /* 1 */ |
| 719 | asn_DEF_ExtensibleExtensions_tags, /* Same as above */ |
| 720 | sizeof(asn_DEF_ExtensibleExtensions_tags) |
| 721 | /sizeof(asn_DEF_ExtensibleExtensions_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 722 | 0, 0, /* No members */ |
| 723 | 0 /* No specifics */ |
| 724 | }; |
| 725 | |
| 726 | |
| 727 | /*** <<< INCLUDES [Str1] >>> ***/ |
| 728 | |
| 729 | #include <IA5String.h> |
| 730 | |
| 731 | /*** <<< TYPE-DECLS [Str1] >>> ***/ |
| 732 | |
| 733 | |
| 734 | typedef IA5String_t Str1_t; |
| 735 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 736 | /*** <<< FUNC-DECLS [Str1] >>> ***/ |
| 737 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 738 | /* This type is equivalent to IA5String */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 739 | #define asn_DEF_Str1 asn_DEF_IA5String |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 740 | |
| 741 | /*** <<< CODE [Str1] >>> ***/ |
| 742 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 743 | /* This type is equivalent to IA5String */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 744 | |
| 745 | |
| 746 | /*** <<< INCLUDES [Str2] >>> ***/ |
| 747 | |
| 748 | #include <Str1.h> |
| 749 | |
| 750 | /*** <<< TYPE-DECLS [Str2] >>> ***/ |
| 751 | |
| 752 | |
| 753 | typedef Str1_t Str2_t; |
| 754 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 755 | /*** <<< FUNC-DECLS [Str2] >>> ***/ |
| 756 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 757 | extern asn_TYPE_descriptor_t asn_DEF_Str2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 758 | asn_struct_free_f Str2_free; |
| 759 | asn_struct_print_f Str2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 760 | asn_constr_check_f Str2_constraint; |
| 761 | ber_type_decoder_f Str2_decode_ber; |
| 762 | der_type_encoder_f Str2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 763 | xer_type_decoder_f Str2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 764 | xer_type_encoder_f Str2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 765 | |
| 766 | /*** <<< CTABLES [Str2] >>> ***/ |
| 767 | |
| 768 | static int check_permitted_alphabet_1(const void *sptr) { |
| 769 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 770 | const IA5String_t *st = sptr; |
| 771 | const uint8_t *ch = st->buf; |
| 772 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 773 | |
| 774 | for(; ch < end; ch++) { |
| 775 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 776 | if(!(cv <= 127)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 777 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 778 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | |
| 782 | /*** <<< CODE [Str2] >>> ***/ |
| 783 | |
| 784 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 785 | Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 786 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 787 | const Str1_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 788 | size_t size; |
| 789 | |
| 790 | if(!sptr) { |
| 791 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 792 | "%s: value not given (%s:%d)", |
| 793 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 794 | return -1; |
| 795 | } |
| 796 | |
| 797 | size = st->size; |
| 798 | |
| 799 | if(((size <= 20) || (size >= 25 && size <= 30)) |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 800 | && !check_permitted_alphabet_1(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 801 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 802 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 803 | } else { |
| 804 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 805 | "%s: constraint failed (%s:%d)", |
| 806 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 807 | return -1; |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | /* |
| 812 | * This type is implemented using Str1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 813 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 814 | */ |
| 815 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 816 | Str2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 817 | td->free_struct = asn_DEF_Str1.free_struct; |
| 818 | td->print_struct = asn_DEF_Str1.print_struct; |
| 819 | td->ber_decoder = asn_DEF_Str1.ber_decoder; |
| 820 | td->der_encoder = asn_DEF_Str1.der_encoder; |
| 821 | td->xer_decoder = asn_DEF_Str1.xer_decoder; |
| 822 | td->xer_encoder = asn_DEF_Str1.xer_encoder; |
| 823 | td->elements = asn_DEF_Str1.elements; |
| 824 | td->elements_count = asn_DEF_Str1.elements_count; |
| 825 | td->specifics = asn_DEF_Str1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 826 | } |
| 827 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 828 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 829 | Str2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 830 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 831 | Str2_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 832 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 836 | Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 837 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 838 | Str2_inherit_TYPE_descriptor(td); |
| 839 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 840 | } |
| 841 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 842 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 843 | Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 844 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 845 | Str2_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 846 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 847 | } |
| 848 | |
| 849 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 850 | Str2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 851 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 852 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 853 | Str2_inherit_TYPE_descriptor(td); |
| 854 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 855 | } |
| 856 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 857 | asn_dec_rval_t |
| 858 | Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 859 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 860 | Str2_inherit_TYPE_descriptor(td); |
| 861 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 862 | } |
| 863 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 864 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 865 | Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 866 | int ilevel, enum xer_encoder_flags_e flags, |
| 867 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 868 | Str2_inherit_TYPE_descriptor(td); |
| 869 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | |
| 873 | /*** <<< STAT-DEFS [Str2] >>> ***/ |
| 874 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 875 | static ber_tlv_tag_t asn_DEF_Str2_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 876 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 877 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 878 | asn_TYPE_descriptor_t asn_DEF_Str2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 879 | "Str2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 880 | "Str2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 881 | Str2_free, |
| 882 | Str2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 883 | Str2_constraint, |
| 884 | Str2_decode_ber, |
| 885 | Str2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 886 | Str2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 887 | Str2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 888 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 889 | asn_DEF_Str2_tags, |
| 890 | sizeof(asn_DEF_Str2_tags) |
| 891 | /sizeof(asn_DEF_Str2_tags[0]), /* 1 */ |
| 892 | asn_DEF_Str2_tags, /* Same as above */ |
| 893 | sizeof(asn_DEF_Str2_tags) |
| 894 | /sizeof(asn_DEF_Str2_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 895 | 0, 0, /* No members */ |
| 896 | 0 /* No specifics */ |
| 897 | }; |
| 898 | |
| 899 | |
| 900 | /*** <<< INCLUDES [Str3] >>> ***/ |
| 901 | |
| 902 | #include <Str2.h> |
| 903 | |
| 904 | /*** <<< TYPE-DECLS [Str3] >>> ***/ |
| 905 | |
| 906 | |
| 907 | typedef Str2_t Str3_t; |
| 908 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 909 | /*** <<< FUNC-DECLS [Str3] >>> ***/ |
| 910 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 911 | extern asn_TYPE_descriptor_t asn_DEF_Str3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 912 | asn_struct_free_f Str3_free; |
| 913 | asn_struct_print_f Str3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 914 | asn_constr_check_f Str3_constraint; |
| 915 | ber_type_decoder_f Str3_decode_ber; |
| 916 | der_type_encoder_f Str3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 917 | xer_type_decoder_f Str3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 918 | xer_type_encoder_f Str3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 919 | |
| 920 | /*** <<< CTABLES [Str3] >>> ***/ |
| 921 | |
| 922 | static int permitted_alphabet_table_2[256] = { |
| 923 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 924 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 925 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 926 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 927 | 0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */ |
| 928 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 929 | 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */ |
| 930 | }; |
| 931 | |
| 932 | static int check_permitted_alphabet_2(const void *sptr) { |
| 933 | int *table = permitted_alphabet_table_2; |
| 934 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 935 | const IA5String_t *st = sptr; |
| 936 | const uint8_t *ch = st->buf; |
| 937 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 938 | |
| 939 | for(; ch < end; ch++) { |
| 940 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 941 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 942 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 943 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 944 | } |
| 945 | |
| 946 | |
| 947 | /*** <<< CODE [Str3] >>> ***/ |
| 948 | |
| 949 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 950 | Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 951 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 952 | const Str2_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 953 | size_t size; |
| 954 | |
| 955 | if(!sptr) { |
| 956 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 957 | "%s: value not given (%s:%d)", |
| 958 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 959 | return -1; |
| 960 | } |
| 961 | |
| 962 | size = st->size; |
| 963 | |
| 964 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 965 | && !check_permitted_alphabet_2(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 966 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 967 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 968 | } else { |
| 969 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 970 | "%s: constraint failed (%s:%d)", |
| 971 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 972 | return -1; |
| 973 | } |
| 974 | } |
| 975 | |
| 976 | /* |
| 977 | * This type is implemented using Str2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 978 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 979 | */ |
| 980 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 981 | Str3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 982 | td->free_struct = asn_DEF_Str2.free_struct; |
| 983 | td->print_struct = asn_DEF_Str2.print_struct; |
| 984 | td->ber_decoder = asn_DEF_Str2.ber_decoder; |
| 985 | td->der_encoder = asn_DEF_Str2.der_encoder; |
| 986 | td->xer_decoder = asn_DEF_Str2.xer_decoder; |
| 987 | td->xer_encoder = asn_DEF_Str2.xer_encoder; |
| 988 | td->elements = asn_DEF_Str2.elements; |
| 989 | td->elements_count = asn_DEF_Str2.elements_count; |
| 990 | td->specifics = asn_DEF_Str2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 991 | } |
| 992 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 993 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 994 | Str3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 995 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 996 | Str3_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 997 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 998 | } |
| 999 | |
| 1000 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1001 | Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1002 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1003 | Str3_inherit_TYPE_descriptor(td); |
| 1004 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1005 | } |
| 1006 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1007 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1008 | Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1009 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1010 | Str3_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1011 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1012 | } |
| 1013 | |
| 1014 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1015 | Str3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1016 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1017 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1018 | Str3_inherit_TYPE_descriptor(td); |
| 1019 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1020 | } |
| 1021 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1022 | asn_dec_rval_t |
| 1023 | Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1024 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 1025 | Str3_inherit_TYPE_descriptor(td); |
| 1026 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1027 | } |
| 1028 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1029 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1030 | Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1031 | int ilevel, enum xer_encoder_flags_e flags, |
| 1032 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1033 | Str3_inherit_TYPE_descriptor(td); |
| 1034 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1035 | } |
| 1036 | |
| 1037 | |
| 1038 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1039 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1040 | static ber_tlv_tag_t asn_DEF_Str3_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1041 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1042 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1043 | asn_TYPE_descriptor_t asn_DEF_Str3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1044 | "Str3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1045 | "Str3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1046 | Str3_free, |
| 1047 | Str3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1048 | Str3_constraint, |
| 1049 | Str3_decode_ber, |
| 1050 | Str3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1051 | Str3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1052 | Str3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1053 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1054 | asn_DEF_Str3_tags, |
| 1055 | sizeof(asn_DEF_Str3_tags) |
| 1056 | /sizeof(asn_DEF_Str3_tags[0]), /* 1 */ |
| 1057 | asn_DEF_Str3_tags, /* Same as above */ |
| 1058 | sizeof(asn_DEF_Str3_tags) |
| 1059 | /sizeof(asn_DEF_Str3_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1060 | 0, 0, /* No members */ |
| 1061 | 0 /* No specifics */ |
| 1062 | }; |
| 1063 | |
| 1064 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1065 | /*** <<< INCLUDES [Str4] >>> ***/ |
| 1066 | |
| 1067 | #include <IA5String.h> |
| 1068 | |
| 1069 | /*** <<< TYPE-DECLS [Str4] >>> ***/ |
| 1070 | |
| 1071 | |
| 1072 | typedef IA5String_t Str4_t; |
| 1073 | |
| 1074 | /*** <<< FUNC-DECLS [Str4] >>> ***/ |
| 1075 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1076 | extern asn_TYPE_descriptor_t asn_DEF_Str4; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1077 | asn_struct_free_f Str4_free; |
| 1078 | asn_struct_print_f Str4_print; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1079 | asn_constr_check_f Str4_constraint; |
| 1080 | ber_type_decoder_f Str4_decode_ber; |
| 1081 | der_type_encoder_f Str4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1082 | xer_type_decoder_f Str4_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1083 | xer_type_encoder_f Str4_encode_xer; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1084 | |
| 1085 | /*** <<< CTABLES [Str4] >>> ***/ |
| 1086 | |
| 1087 | static int check_permitted_alphabet_3(const void *sptr) { |
| 1088 | /* The underlying type is IA5String */ |
| 1089 | const IA5String_t *st = sptr; |
| 1090 | const uint8_t *ch = st->buf; |
| 1091 | const uint8_t *end = ch + st->size; |
| 1092 | |
| 1093 | for(; ch < end; ch++) { |
| 1094 | uint8_t cv = *ch; |
| 1095 | if(!(cv <= 127)) return -1; |
| 1096 | } |
| 1097 | return 0; |
| 1098 | } |
| 1099 | |
| 1100 | |
| 1101 | /*** <<< CODE [Str4] >>> ***/ |
| 1102 | |
| 1103 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1104 | Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1105 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1106 | const IA5String_t *st = sptr; |
| 1107 | |
| 1108 | if(!sptr) { |
| 1109 | _ASN_ERRLOG(app_errlog, app_key, |
| 1110 | "%s: value not given (%s:%d)", |
| 1111 | td->name, __FILE__, __LINE__); |
| 1112 | return -1; |
| 1113 | } |
| 1114 | |
| 1115 | |
| 1116 | if(!check_permitted_alphabet_3(sptr)) { |
| 1117 | /* Constraint check succeeded */ |
| 1118 | return 0; |
| 1119 | } else { |
| 1120 | _ASN_ERRLOG(app_errlog, app_key, |
| 1121 | "%s: constraint failed (%s:%d)", |
| 1122 | td->name, __FILE__, __LINE__); |
| 1123 | return -1; |
| 1124 | } |
| 1125 | } |
| 1126 | |
| 1127 | /* |
| 1128 | * This type is implemented using IA5String, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1129 | * so here we adjust the DEF accordingly. |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1130 | */ |
| 1131 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1132 | Str4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1133 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1134 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1135 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1136 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1137 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1138 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1139 | td->elements = asn_DEF_IA5String.elements; |
| 1140 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1141 | td->specifics = asn_DEF_IA5String.specifics; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1142 | } |
| 1143 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1144 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1145 | Str4_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1146 | void *struct_ptr, int contents_only) { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1147 | Str4_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1148 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1149 | } |
| 1150 | |
| 1151 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1152 | Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1153 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1154 | Str4_inherit_TYPE_descriptor(td); |
| 1155 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1156 | } |
| 1157 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1158 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1159 | Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1160 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1161 | Str4_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1162 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1163 | } |
| 1164 | |
| 1165 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1166 | Str4_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1167 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1168 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1169 | Str4_inherit_TYPE_descriptor(td); |
| 1170 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1171 | } |
| 1172 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1173 | asn_dec_rval_t |
| 1174 | Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1175 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 1176 | Str4_inherit_TYPE_descriptor(td); |
| 1177 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1178 | } |
| 1179 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1180 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1181 | Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1182 | int ilevel, enum xer_encoder_flags_e flags, |
| 1183 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1184 | Str4_inherit_TYPE_descriptor(td); |
| 1185 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1186 | } |
| 1187 | |
| 1188 | |
| 1189 | /*** <<< STAT-DEFS [Str4] >>> ***/ |
| 1190 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1191 | static ber_tlv_tag_t asn_DEF_Str4_tags[] = { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1192 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1193 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1194 | asn_TYPE_descriptor_t asn_DEF_Str4 = { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1195 | "Str4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1196 | "Str4", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1197 | Str4_free, |
| 1198 | Str4_print, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1199 | Str4_constraint, |
| 1200 | Str4_decode_ber, |
| 1201 | Str4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1202 | Str4_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1203 | Str4_encode_xer, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1204 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1205 | asn_DEF_Str4_tags, |
| 1206 | sizeof(asn_DEF_Str4_tags) |
| 1207 | /sizeof(asn_DEF_Str4_tags[0]), /* 1 */ |
| 1208 | asn_DEF_Str4_tags, /* Same as above */ |
| 1209 | sizeof(asn_DEF_Str4_tags) |
| 1210 | /sizeof(asn_DEF_Str4_tags[0]), /* 1 */ |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1211 | 0, 0, /* No members */ |
| 1212 | 0 /* No specifics */ |
| 1213 | }; |
| 1214 | |
| 1215 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1216 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1217 | |
| 1218 | #include <IA5String.h> |
| 1219 | |
| 1220 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1221 | |
| 1222 | |
| 1223 | typedef IA5String_t PER_Visible_t; |
| 1224 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1225 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1226 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1227 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1228 | asn_struct_free_f PER_Visible_free; |
| 1229 | asn_struct_print_f PER_Visible_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1230 | asn_constr_check_f PER_Visible_constraint; |
| 1231 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1232 | der_type_encoder_f PER_Visible_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1233 | xer_type_decoder_f PER_Visible_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1234 | xer_type_encoder_f PER_Visible_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1235 | |
| 1236 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1237 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1238 | static int check_permitted_alphabet_4(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1239 | /* The underlying type is IA5String */ |
vlm | 4fdaead | 2004-08-21 07:34:17 +0000 | [diff] [blame] | 1240 | const IA5String_t *st = sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1241 | const uint8_t *ch = st->buf; |
| 1242 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1243 | |
| 1244 | for(; ch < end; ch++) { |
| 1245 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1246 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1247 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1248 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1249 | } |
| 1250 | |
| 1251 | |
| 1252 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1253 | |
| 1254 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1255 | PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1256 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1257 | const IA5String_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1258 | |
| 1259 | if(!sptr) { |
| 1260 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1261 | "%s: value not given (%s:%d)", |
| 1262 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1263 | return -1; |
| 1264 | } |
| 1265 | |
| 1266 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1267 | if(!check_permitted_alphabet_4(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1268 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1269 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1270 | } else { |
| 1271 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1272 | "%s: constraint failed (%s:%d)", |
| 1273 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1274 | return -1; |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | /* |
| 1279 | * This type is implemented using IA5String, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1280 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1281 | */ |
| 1282 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1283 | PER_Visible_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1284 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1285 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1286 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1287 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1288 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1289 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1290 | td->elements = asn_DEF_IA5String.elements; |
| 1291 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1292 | td->specifics = asn_DEF_IA5String.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1293 | } |
| 1294 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1295 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1296 | PER_Visible_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1297 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1298 | PER_Visible_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1299 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1300 | } |
| 1301 | |
| 1302 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1303 | PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1304 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1305 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1306 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1307 | } |
| 1308 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1309 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1310 | PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1311 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1312 | PER_Visible_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1313 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1314 | } |
| 1315 | |
| 1316 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1317 | PER_Visible_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1318 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1319 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1320 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1321 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1322 | } |
| 1323 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1324 | asn_dec_rval_t |
| 1325 | PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1326 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 1327 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1328 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1329 | } |
| 1330 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1331 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1332 | PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1333 | int ilevel, enum xer_encoder_flags_e flags, |
| 1334 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1335 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1336 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1337 | } |
| 1338 | |
| 1339 | |
| 1340 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1341 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1342 | static ber_tlv_tag_t asn_DEF_PER_Visible_tags[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1343 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1344 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1345 | asn_TYPE_descriptor_t asn_DEF_PER_Visible = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1346 | "PER-Visible", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1347 | "PER-Visible", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1348 | PER_Visible_free, |
| 1349 | PER_Visible_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1350 | PER_Visible_constraint, |
| 1351 | PER_Visible_decode_ber, |
| 1352 | PER_Visible_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1353 | PER_Visible_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1354 | PER_Visible_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1355 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1356 | asn_DEF_PER_Visible_tags, |
| 1357 | sizeof(asn_DEF_PER_Visible_tags) |
| 1358 | /sizeof(asn_DEF_PER_Visible_tags[0]), /* 1 */ |
| 1359 | asn_DEF_PER_Visible_tags, /* Same as above */ |
| 1360 | sizeof(asn_DEF_PER_Visible_tags) |
| 1361 | /sizeof(asn_DEF_PER_Visible_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1362 | 0, 0, /* No members */ |
| 1363 | 0 /* No specifics */ |
| 1364 | }; |
| 1365 | |
| 1366 | |
| 1367 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1368 | |
| 1369 | #include <PER-Visible.h> |
| 1370 | |
| 1371 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1372 | |
| 1373 | |
| 1374 | typedef PER_Visible_t PER_Visible_2_t; |
| 1375 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1376 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1377 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1378 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1379 | asn_struct_free_f PER_Visible_2_free; |
| 1380 | asn_struct_print_f PER_Visible_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1381 | asn_constr_check_f PER_Visible_2_constraint; |
| 1382 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1383 | der_type_encoder_f PER_Visible_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1384 | xer_type_decoder_f PER_Visible_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1385 | xer_type_encoder_f PER_Visible_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1386 | |
| 1387 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1388 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1389 | static int check_permitted_alphabet_5(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1390 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1391 | const IA5String_t *st = sptr; |
| 1392 | const uint8_t *ch = st->buf; |
| 1393 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1394 | |
| 1395 | for(; ch < end; ch++) { |
| 1396 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1397 | if(!(cv >= 69 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1398 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1399 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1400 | } |
| 1401 | |
| 1402 | |
| 1403 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1404 | |
| 1405 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1406 | PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1407 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1408 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1409 | |
| 1410 | if(!sptr) { |
| 1411 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1412 | "%s: value not given (%s:%d)", |
| 1413 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1414 | return -1; |
| 1415 | } |
| 1416 | |
| 1417 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1418 | if(!check_permitted_alphabet_5(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1419 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1420 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1421 | } else { |
| 1422 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1423 | "%s: constraint failed (%s:%d)", |
| 1424 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1425 | return -1; |
| 1426 | } |
| 1427 | } |
| 1428 | |
| 1429 | /* |
| 1430 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1431 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1432 | */ |
| 1433 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1434 | PER_Visible_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1435 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1436 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1437 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1438 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1439 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1440 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1441 | td->elements = asn_DEF_PER_Visible.elements; |
| 1442 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1443 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1444 | } |
| 1445 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1446 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1447 | PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1448 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1449 | PER_Visible_2_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1450 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1451 | } |
| 1452 | |
| 1453 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1454 | PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1455 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1456 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1457 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1458 | } |
| 1459 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1460 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1461 | PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1462 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1463 | PER_Visible_2_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1464 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1465 | } |
| 1466 | |
| 1467 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1468 | PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1469 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1470 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1471 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1472 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1473 | } |
| 1474 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1475 | asn_dec_rval_t |
| 1476 | PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1477 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 1478 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1479 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1480 | } |
| 1481 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1482 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1483 | PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1484 | int ilevel, enum xer_encoder_flags_e flags, |
| 1485 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1486 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1487 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1488 | } |
| 1489 | |
| 1490 | |
| 1491 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 1492 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1493 | static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1494 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1495 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1496 | asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1497 | "PER-Visible-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1498 | "PER-Visible-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1499 | PER_Visible_2_free, |
| 1500 | PER_Visible_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1501 | PER_Visible_2_constraint, |
| 1502 | PER_Visible_2_decode_ber, |
| 1503 | PER_Visible_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1504 | PER_Visible_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1505 | PER_Visible_2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1506 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1507 | asn_DEF_PER_Visible_2_tags, |
| 1508 | sizeof(asn_DEF_PER_Visible_2_tags) |
| 1509 | /sizeof(asn_DEF_PER_Visible_2_tags[0]), /* 1 */ |
| 1510 | asn_DEF_PER_Visible_2_tags, /* Same as above */ |
| 1511 | sizeof(asn_DEF_PER_Visible_2_tags) |
| 1512 | /sizeof(asn_DEF_PER_Visible_2_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1513 | 0, 0, /* No members */ |
| 1514 | 0 /* No specifics */ |
| 1515 | }; |
| 1516 | |
| 1517 | |
| 1518 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 1519 | |
| 1520 | #include <PER-Visible.h> |
| 1521 | |
| 1522 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1523 | |
| 1524 | |
| 1525 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 1526 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1527 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1528 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1529 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1530 | asn_struct_free_f Not_PER_Visible_1_free; |
| 1531 | asn_struct_print_f Not_PER_Visible_1_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1532 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 1533 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 1534 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1535 | xer_type_decoder_f Not_PER_Visible_1_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1536 | xer_type_encoder_f Not_PER_Visible_1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1537 | |
| 1538 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 1539 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1540 | static int check_permitted_alphabet_6(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1541 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1542 | const IA5String_t *st = sptr; |
| 1543 | const uint8_t *ch = st->buf; |
| 1544 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1545 | |
| 1546 | for(; ch < end; ch++) { |
| 1547 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1548 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1549 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1550 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1551 | } |
| 1552 | |
| 1553 | |
| 1554 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 1555 | |
| 1556 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1557 | Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1558 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1559 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1560 | |
| 1561 | if(!sptr) { |
| 1562 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1563 | "%s: value not given (%s:%d)", |
| 1564 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1565 | return -1; |
| 1566 | } |
| 1567 | |
| 1568 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1569 | if(!check_permitted_alphabet_6(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1570 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1571 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1572 | } else { |
| 1573 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1574 | "%s: constraint failed (%s:%d)", |
| 1575 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1576 | return -1; |
| 1577 | } |
| 1578 | } |
| 1579 | |
| 1580 | /* |
| 1581 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1582 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1583 | */ |
| 1584 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1585 | Not_PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1586 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1587 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1588 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1589 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1590 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1591 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1592 | td->elements = asn_DEF_PER_Visible.elements; |
| 1593 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1594 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1595 | } |
| 1596 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1597 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1598 | Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1599 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1600 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1601 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1602 | } |
| 1603 | |
| 1604 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1605 | 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] | 1606 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1607 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1608 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1609 | } |
| 1610 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1611 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1612 | Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1613 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1614 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1615 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1616 | } |
| 1617 | |
| 1618 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1619 | Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1620 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1621 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1622 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1623 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1624 | } |
| 1625 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1626 | asn_dec_rval_t |
| 1627 | Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1628 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 1629 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1630 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1631 | } |
| 1632 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1633 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1634 | Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1635 | int ilevel, enum xer_encoder_flags_e flags, |
| 1636 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1637 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1638 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | |
| 1642 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 1643 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1644 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1645 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1646 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1647 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1648 | "Not-PER-Visible-1", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1649 | "Not-PER-Visible-1", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1650 | Not_PER_Visible_1_free, |
| 1651 | Not_PER_Visible_1_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1652 | Not_PER_Visible_1_constraint, |
| 1653 | Not_PER_Visible_1_decode_ber, |
| 1654 | Not_PER_Visible_1_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1655 | Not_PER_Visible_1_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1656 | Not_PER_Visible_1_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1657 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1658 | asn_DEF_Not_PER_Visible_1_tags, |
| 1659 | sizeof(asn_DEF_Not_PER_Visible_1_tags) |
| 1660 | /sizeof(asn_DEF_Not_PER_Visible_1_tags[0]), /* 1 */ |
| 1661 | asn_DEF_Not_PER_Visible_1_tags, /* Same as above */ |
| 1662 | sizeof(asn_DEF_Not_PER_Visible_1_tags) |
| 1663 | /sizeof(asn_DEF_Not_PER_Visible_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1664 | 0, 0, /* No members */ |
| 1665 | 0 /* No specifics */ |
| 1666 | }; |
| 1667 | |
| 1668 | |
| 1669 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 1670 | |
| 1671 | #include <PER-Visible.h> |
| 1672 | |
| 1673 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1674 | |
| 1675 | |
| 1676 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 1677 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1678 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1679 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1680 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1681 | asn_struct_free_f Not_PER_Visible_2_free; |
| 1682 | asn_struct_print_f Not_PER_Visible_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1683 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 1684 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 1685 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1686 | xer_type_decoder_f Not_PER_Visible_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1687 | xer_type_encoder_f Not_PER_Visible_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1688 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1689 | /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ |
| 1690 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1691 | static int check_permitted_alphabet_7(const void *sptr) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1692 | /* The underlying type is IA5String */ |
| 1693 | const IA5String_t *st = sptr; |
| 1694 | const uint8_t *ch = st->buf; |
| 1695 | const uint8_t *end = ch + st->size; |
| 1696 | |
| 1697 | for(; ch < end; ch++) { |
| 1698 | uint8_t cv = *ch; |
| 1699 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 1700 | } |
| 1701 | return 0; |
| 1702 | } |
| 1703 | |
| 1704 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1705 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 1706 | |
| 1707 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1708 | Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1709 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1710 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1711 | |
| 1712 | if(!sptr) { |
| 1713 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1714 | "%s: value not given (%s:%d)", |
| 1715 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1716 | return -1; |
| 1717 | } |
| 1718 | |
| 1719 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1720 | if(!check_permitted_alphabet_7(sptr)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1721 | /* Constraint check succeeded */ |
| 1722 | return 0; |
| 1723 | } else { |
| 1724 | _ASN_ERRLOG(app_errlog, app_key, |
| 1725 | "%s: constraint failed (%s:%d)", |
| 1726 | td->name, __FILE__, __LINE__); |
| 1727 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1728 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1729 | } |
| 1730 | |
| 1731 | /* |
| 1732 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1733 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1734 | */ |
| 1735 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1736 | Not_PER_Visible_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1737 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1738 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1739 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1740 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1741 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1742 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1743 | td->elements = asn_DEF_PER_Visible.elements; |
| 1744 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1745 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1746 | } |
| 1747 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1748 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1749 | Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1750 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1751 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1752 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1753 | } |
| 1754 | |
| 1755 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1756 | 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] | 1757 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1758 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1759 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1760 | } |
| 1761 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1762 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1763 | Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1764 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1765 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1766 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1767 | } |
| 1768 | |
| 1769 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1770 | Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1771 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1772 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1773 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1774 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1775 | } |
| 1776 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1777 | asn_dec_rval_t |
| 1778 | Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1779 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 1780 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1781 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1782 | } |
| 1783 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1784 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1785 | Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1786 | int ilevel, enum xer_encoder_flags_e flags, |
| 1787 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1788 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1789 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1790 | } |
| 1791 | |
| 1792 | |
| 1793 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 1794 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1795 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1796 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1797 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1798 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1799 | "Not-PER-Visible-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1800 | "Not-PER-Visible-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1801 | Not_PER_Visible_2_free, |
| 1802 | Not_PER_Visible_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1803 | Not_PER_Visible_2_constraint, |
| 1804 | Not_PER_Visible_2_decode_ber, |
| 1805 | Not_PER_Visible_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1806 | Not_PER_Visible_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1807 | Not_PER_Visible_2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1808 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1809 | asn_DEF_Not_PER_Visible_2_tags, |
| 1810 | sizeof(asn_DEF_Not_PER_Visible_2_tags) |
| 1811 | /sizeof(asn_DEF_Not_PER_Visible_2_tags[0]), /* 1 */ |
| 1812 | asn_DEF_Not_PER_Visible_2_tags, /* Same as above */ |
| 1813 | sizeof(asn_DEF_Not_PER_Visible_2_tags) |
| 1814 | /sizeof(asn_DEF_Not_PER_Visible_2_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1815 | 0, 0, /* No members */ |
| 1816 | 0 /* No specifics */ |
| 1817 | }; |
| 1818 | |
| 1819 | |
| 1820 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 1821 | |
| 1822 | #include <PER-Visible.h> |
| 1823 | |
| 1824 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 1825 | |
| 1826 | |
| 1827 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 1828 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1829 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 1830 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1831 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1832 | asn_struct_free_f Not_PER_Visible_3_free; |
| 1833 | asn_struct_print_f Not_PER_Visible_3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1834 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 1835 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 1836 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1837 | xer_type_decoder_f Not_PER_Visible_3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1838 | xer_type_encoder_f Not_PER_Visible_3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1839 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1840 | /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ |
| 1841 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1842 | static int check_permitted_alphabet_8(const void *sptr) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1843 | /* The underlying type is IA5String */ |
| 1844 | const IA5String_t *st = sptr; |
| 1845 | const uint8_t *ch = st->buf; |
| 1846 | const uint8_t *end = ch + st->size; |
| 1847 | |
| 1848 | for(; ch < end; ch++) { |
| 1849 | uint8_t cv = *ch; |
| 1850 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 1851 | } |
| 1852 | return 0; |
| 1853 | } |
| 1854 | |
| 1855 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1856 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 1857 | |
| 1858 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1859 | Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1860 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1861 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1862 | |
| 1863 | if(!sptr) { |
| 1864 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1865 | "%s: value not given (%s:%d)", |
| 1866 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1867 | return -1; |
| 1868 | } |
| 1869 | |
| 1870 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1871 | if(!check_permitted_alphabet_8(sptr)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1872 | /* Constraint check succeeded */ |
| 1873 | return 0; |
| 1874 | } else { |
| 1875 | _ASN_ERRLOG(app_errlog, app_key, |
| 1876 | "%s: constraint failed (%s:%d)", |
| 1877 | td->name, __FILE__, __LINE__); |
| 1878 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1879 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1880 | } |
| 1881 | |
| 1882 | /* |
| 1883 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1884 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1885 | */ |
| 1886 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1887 | Not_PER_Visible_3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1888 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1889 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1890 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1891 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1892 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1893 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1894 | td->elements = asn_DEF_PER_Visible.elements; |
| 1895 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1896 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1897 | } |
| 1898 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1899 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1900 | Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1901 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1902 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1903 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1904 | } |
| 1905 | |
| 1906 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1907 | 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] | 1908 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1909 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1910 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1911 | } |
| 1912 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1913 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1914 | Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1915 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1916 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1917 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1918 | } |
| 1919 | |
| 1920 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1921 | Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1922 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1923 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1924 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1925 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1926 | } |
| 1927 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1928 | asn_dec_rval_t |
| 1929 | Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1930 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 1931 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1932 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1933 | } |
| 1934 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1935 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1936 | Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1937 | int ilevel, enum xer_encoder_flags_e flags, |
| 1938 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1939 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1940 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1941 | } |
| 1942 | |
| 1943 | |
| 1944 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 1945 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1946 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1947 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1948 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1949 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1950 | "Not-PER-Visible-3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1951 | "Not-PER-Visible-3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1952 | Not_PER_Visible_3_free, |
| 1953 | Not_PER_Visible_3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1954 | Not_PER_Visible_3_constraint, |
| 1955 | Not_PER_Visible_3_decode_ber, |
| 1956 | Not_PER_Visible_3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1957 | Not_PER_Visible_3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1958 | Not_PER_Visible_3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1959 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1960 | asn_DEF_Not_PER_Visible_3_tags, |
| 1961 | sizeof(asn_DEF_Not_PER_Visible_3_tags) |
| 1962 | /sizeof(asn_DEF_Not_PER_Visible_3_tags[0]), /* 1 */ |
| 1963 | asn_DEF_Not_PER_Visible_3_tags, /* Same as above */ |
| 1964 | sizeof(asn_DEF_Not_PER_Visible_3_tags) |
| 1965 | /sizeof(asn_DEF_Not_PER_Visible_3_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1966 | 0, 0, /* No members */ |
| 1967 | 0 /* No specifics */ |
| 1968 | }; |
| 1969 | |
| 1970 | |
| 1971 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 1972 | |
| 1973 | #include <PER-Visible.h> |
| 1974 | |
| 1975 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 1976 | |
| 1977 | |
| 1978 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 1979 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1980 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 1981 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1982 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1983 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 1984 | asn_struct_print_f SIZE_but_not_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1985 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 1986 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 1987 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1988 | xer_type_decoder_f SIZE_but_not_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1989 | xer_type_encoder_f SIZE_but_not_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1990 | |
| 1991 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 1992 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1993 | static int check_permitted_alphabet_9(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1994 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1995 | const IA5String_t *st = sptr; |
| 1996 | const uint8_t *ch = st->buf; |
| 1997 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1998 | |
| 1999 | for(; ch < end; ch++) { |
| 2000 | uint8_t cv = *ch; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2001 | if(!(cv >= 65 && cv <= 68)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2002 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2003 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2004 | } |
| 2005 | |
| 2006 | |
| 2007 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 2008 | |
| 2009 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2010 | SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2011 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2012 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2013 | size_t size; |
| 2014 | |
| 2015 | if(!sptr) { |
| 2016 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2017 | "%s: value not given (%s:%d)", |
| 2018 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2019 | return -1; |
| 2020 | } |
| 2021 | |
| 2022 | size = st->size; |
| 2023 | |
| 2024 | if((size >= 1 && size <= 4) |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 2025 | && !check_permitted_alphabet_9(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2026 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2027 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2028 | } else { |
| 2029 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2030 | "%s: constraint failed (%s:%d)", |
| 2031 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2032 | return -1; |
| 2033 | } |
| 2034 | } |
| 2035 | |
| 2036 | /* |
| 2037 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2038 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2039 | */ |
| 2040 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2041 | SIZE_but_not_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2042 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2043 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2044 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2045 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2046 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2047 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2048 | td->elements = asn_DEF_PER_Visible.elements; |
| 2049 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2050 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2051 | } |
| 2052 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2053 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2054 | SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2055 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2056 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2057 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2058 | } |
| 2059 | |
| 2060 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2061 | 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] | 2062 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2063 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 2064 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2065 | } |
| 2066 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2067 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2068 | SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2069 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2070 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2071 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2072 | } |
| 2073 | |
| 2074 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2075 | SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2076 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2077 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2078 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 2079 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2080 | } |
| 2081 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2082 | asn_dec_rval_t |
| 2083 | SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2084 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 2085 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 2086 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2087 | } |
| 2088 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2089 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2090 | SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2091 | int ilevel, enum xer_encoder_flags_e flags, |
| 2092 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2093 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 2094 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2095 | } |
| 2096 | |
| 2097 | |
| 2098 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 2099 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2100 | static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2101 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2102 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2103 | asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2104 | "SIZE-but-not-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2105 | "SIZE-but-not-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2106 | SIZE_but_not_FROM_free, |
| 2107 | SIZE_but_not_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2108 | SIZE_but_not_FROM_constraint, |
| 2109 | SIZE_but_not_FROM_decode_ber, |
| 2110 | SIZE_but_not_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2111 | SIZE_but_not_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2112 | SIZE_but_not_FROM_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2113 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2114 | asn_DEF_SIZE_but_not_FROM_tags, |
| 2115 | sizeof(asn_DEF_SIZE_but_not_FROM_tags) |
| 2116 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */ |
| 2117 | asn_DEF_SIZE_but_not_FROM_tags, /* Same as above */ |
| 2118 | sizeof(asn_DEF_SIZE_but_not_FROM_tags) |
| 2119 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2120 | 0, 0, /* No members */ |
| 2121 | 0 /* No specifics */ |
| 2122 | }; |
| 2123 | |
| 2124 | |
| 2125 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 2126 | |
| 2127 | #include <PER-Visible.h> |
| 2128 | |
| 2129 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 2130 | |
| 2131 | |
| 2132 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 2133 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2134 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 2135 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2136 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2137 | asn_struct_free_f SIZE_and_FROM_free; |
| 2138 | asn_struct_print_f SIZE_and_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2139 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 2140 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 2141 | der_type_encoder_f SIZE_and_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2142 | xer_type_decoder_f SIZE_and_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2143 | xer_type_encoder_f SIZE_and_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2144 | |
| 2145 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 2146 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 2147 | static int check_permitted_alphabet_10(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2148 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2149 | const IA5String_t *st = sptr; |
| 2150 | const uint8_t *ch = st->buf; |
| 2151 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2152 | |
| 2153 | for(; ch < end; ch++) { |
| 2154 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2155 | if(!(cv >= 65 && cv <= 68)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2156 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2157 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2158 | } |
| 2159 | |
| 2160 | |
| 2161 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 2162 | |
| 2163 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2164 | SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2165 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2166 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2167 | size_t size; |
| 2168 | |
| 2169 | if(!sptr) { |
| 2170 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2171 | "%s: value not given (%s:%d)", |
| 2172 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2173 | return -1; |
| 2174 | } |
| 2175 | |
| 2176 | size = st->size; |
| 2177 | |
| 2178 | if((size >= 1 && size <= 4) |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 2179 | && !check_permitted_alphabet_10(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2180 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2181 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2182 | } else { |
| 2183 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2184 | "%s: constraint failed (%s:%d)", |
| 2185 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2186 | return -1; |
| 2187 | } |
| 2188 | } |
| 2189 | |
| 2190 | /* |
| 2191 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2192 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2193 | */ |
| 2194 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2195 | SIZE_and_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2196 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2197 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2198 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2199 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2200 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2201 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2202 | td->elements = asn_DEF_PER_Visible.elements; |
| 2203 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2204 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2205 | } |
| 2206 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2207 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2208 | SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2209 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2210 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2211 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2212 | } |
| 2213 | |
| 2214 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2215 | SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2216 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2217 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 2218 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2219 | } |
| 2220 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2221 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2222 | SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2223 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2224 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2225 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2226 | } |
| 2227 | |
| 2228 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2229 | SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2230 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2231 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2232 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 2233 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2234 | } |
| 2235 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2236 | asn_dec_rval_t |
| 2237 | SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2238 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 2239 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 2240 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2241 | } |
| 2242 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2243 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2244 | SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2245 | int ilevel, enum xer_encoder_flags_e flags, |
| 2246 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2247 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 2248 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2249 | } |
| 2250 | |
| 2251 | |
| 2252 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 2253 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2254 | static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2255 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2256 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2257 | asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2258 | "SIZE-and-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2259 | "SIZE-and-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2260 | SIZE_and_FROM_free, |
| 2261 | SIZE_and_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2262 | SIZE_and_FROM_constraint, |
| 2263 | SIZE_and_FROM_decode_ber, |
| 2264 | SIZE_and_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2265 | SIZE_and_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2266 | SIZE_and_FROM_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2267 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2268 | asn_DEF_SIZE_and_FROM_tags, |
| 2269 | sizeof(asn_DEF_SIZE_and_FROM_tags) |
| 2270 | /sizeof(asn_DEF_SIZE_and_FROM_tags[0]), /* 1 */ |
| 2271 | asn_DEF_SIZE_and_FROM_tags, /* Same as above */ |
| 2272 | sizeof(asn_DEF_SIZE_and_FROM_tags) |
| 2273 | /sizeof(asn_DEF_SIZE_and_FROM_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2274 | 0, 0, /* No members */ |
| 2275 | 0 /* No specifics */ |
| 2276 | }; |
| 2277 | |
| 2278 | |
| 2279 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2280 | |
| 2281 | #include <PER-Visible.h> |
| 2282 | |
| 2283 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2284 | |
| 2285 | |
| 2286 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 2287 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2288 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2289 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2290 | extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2291 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 2292 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2293 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 2294 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 2295 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2296 | xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2297 | xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2298 | |
| 2299 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2300 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 2301 | static int check_permitted_alphabet_11(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2302 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2303 | const IA5String_t *st = sptr; |
| 2304 | const uint8_t *ch = st->buf; |
| 2305 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2306 | |
| 2307 | for(; ch < end; ch++) { |
| 2308 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2309 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2310 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2311 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2312 | } |
| 2313 | |
| 2314 | |
| 2315 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 2316 | |
| 2317 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2318 | Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2319 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2320 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2321 | |
| 2322 | if(!sptr) { |
| 2323 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2324 | "%s: value not given (%s:%d)", |
| 2325 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2326 | return -1; |
| 2327 | } |
| 2328 | |
| 2329 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 2330 | if(!check_permitted_alphabet_11(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2331 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2332 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2333 | } else { |
| 2334 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2335 | "%s: constraint failed (%s:%d)", |
| 2336 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2337 | return -1; |
| 2338 | } |
| 2339 | } |
| 2340 | |
| 2341 | /* |
| 2342 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2343 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2344 | */ |
| 2345 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2346 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2347 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2348 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2349 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2350 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2351 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2352 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2353 | td->elements = asn_DEF_PER_Visible.elements; |
| 2354 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2355 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2356 | } |
| 2357 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2358 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2359 | Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2360 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2361 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2362 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2363 | } |
| 2364 | |
| 2365 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2366 | 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] | 2367 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2368 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2369 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2370 | } |
| 2371 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2372 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2373 | Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2374 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2375 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2376 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2377 | } |
| 2378 | |
| 2379 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2380 | Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2381 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2382 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2383 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2384 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2385 | } |
| 2386 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2387 | asn_dec_rval_t |
| 2388 | Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2389 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 2390 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2391 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2392 | } |
| 2393 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2394 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2395 | Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2396 | int ilevel, enum xer_encoder_flags_e flags, |
| 2397 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2398 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2399 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2400 | } |
| 2401 | |
| 2402 | |
| 2403 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2404 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2405 | static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2406 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2407 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2408 | asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2409 | "Neither-SIZE-nor-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2410 | "Neither-SIZE-nor-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2411 | Neither_SIZE_nor_FROM_free, |
| 2412 | Neither_SIZE_nor_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2413 | Neither_SIZE_nor_FROM_constraint, |
| 2414 | Neither_SIZE_nor_FROM_decode_ber, |
| 2415 | Neither_SIZE_nor_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2416 | Neither_SIZE_nor_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2417 | Neither_SIZE_nor_FROM_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2418 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2419 | asn_DEF_Neither_SIZE_nor_FROM_tags, |
| 2420 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags) |
| 2421 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */ |
| 2422 | asn_DEF_Neither_SIZE_nor_FROM_tags, /* Same as above */ |
| 2423 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags) |
| 2424 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2425 | 0, 0, /* No members */ |
| 2426 | 0 /* No specifics */ |
| 2427 | }; |
| 2428 | |
| 2429 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2430 | /*** <<< INCLUDES [Utf8-4] >>> ***/ |
| 2431 | |
| 2432 | #include <UTF8String.h> |
| 2433 | |
| 2434 | /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ |
| 2435 | |
| 2436 | |
| 2437 | typedef UTF8String_t Utf8_4_t; |
| 2438 | |
| 2439 | /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ |
| 2440 | |
| 2441 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; |
| 2442 | asn_struct_free_f Utf8_4_free; |
| 2443 | asn_struct_print_f Utf8_4_print; |
| 2444 | asn_constr_check_f Utf8_4_constraint; |
| 2445 | ber_type_decoder_f Utf8_4_decode_ber; |
| 2446 | der_type_encoder_f Utf8_4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2447 | xer_type_decoder_f Utf8_4_decode_xer; |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2448 | xer_type_encoder_f Utf8_4_encode_xer; |
| 2449 | |
| 2450 | /*** <<< CTABLES [Utf8-4] >>> ***/ |
| 2451 | |
| 2452 | static int check_permitted_alphabet_12(const void *sptr) { |
| 2453 | if(UTF8String_length((const UTF8String_t *)sptr) < 0) |
| 2454 | return -1; /* Alphabet (sic!) test failed. */ |
| 2455 | |
| 2456 | return 0; |
| 2457 | } |
| 2458 | |
| 2459 | |
| 2460 | /*** <<< CODE [Utf8-4] >>> ***/ |
| 2461 | |
| 2462 | int |
| 2463 | Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 2464 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2465 | const UTF8String_t *st = sptr; |
| 2466 | |
| 2467 | if(!sptr) { |
| 2468 | _ASN_ERRLOG(app_errlog, app_key, |
| 2469 | "%s: value not given (%s:%d)", |
| 2470 | td->name, __FILE__, __LINE__); |
| 2471 | return -1; |
| 2472 | } |
| 2473 | |
| 2474 | |
| 2475 | if(!check_permitted_alphabet_12(sptr)) { |
| 2476 | /* Constraint check succeeded */ |
| 2477 | return 0; |
| 2478 | } else { |
| 2479 | _ASN_ERRLOG(app_errlog, app_key, |
| 2480 | "%s: constraint failed (%s:%d)", |
| 2481 | td->name, __FILE__, __LINE__); |
| 2482 | return -1; |
| 2483 | } |
| 2484 | } |
| 2485 | |
| 2486 | /* |
| 2487 | * This type is implemented using UTF8String, |
| 2488 | * so here we adjust the DEF accordingly. |
| 2489 | */ |
| 2490 | static void |
| 2491 | Utf8_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2492 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 2493 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 2494 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 2495 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 2496 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 2497 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 2498 | td->elements = asn_DEF_UTF8String.elements; |
| 2499 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 2500 | td->specifics = asn_DEF_UTF8String.specifics; |
| 2501 | } |
| 2502 | |
| 2503 | void |
| 2504 | Utf8_4_free(asn_TYPE_descriptor_t *td, |
| 2505 | void *struct_ptr, int contents_only) { |
| 2506 | Utf8_4_inherit_TYPE_descriptor(td); |
| 2507 | td->free_struct(td, struct_ptr, contents_only); |
| 2508 | } |
| 2509 | |
| 2510 | int |
| 2511 | Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2512 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2513 | Utf8_4_inherit_TYPE_descriptor(td); |
| 2514 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2515 | } |
| 2516 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2517 | asn_dec_rval_t |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2518 | Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2519 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2520 | Utf8_4_inherit_TYPE_descriptor(td); |
| 2521 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2522 | } |
| 2523 | |
| 2524 | asn_enc_rval_t |
| 2525 | Utf8_4_encode_der(asn_TYPE_descriptor_t *td, |
| 2526 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2527 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2528 | Utf8_4_inherit_TYPE_descriptor(td); |
| 2529 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2530 | } |
| 2531 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2532 | asn_dec_rval_t |
| 2533 | Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2534 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 2535 | Utf8_4_inherit_TYPE_descriptor(td); |
| 2536 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2537 | } |
| 2538 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2539 | asn_enc_rval_t |
| 2540 | Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2541 | int ilevel, enum xer_encoder_flags_e flags, |
| 2542 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2543 | Utf8_4_inherit_TYPE_descriptor(td); |
| 2544 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2545 | } |
| 2546 | |
| 2547 | |
| 2548 | /*** <<< STAT-DEFS [Utf8-4] >>> ***/ |
| 2549 | |
| 2550 | static ber_tlv_tag_t asn_DEF_Utf8_4_tags[] = { |
| 2551 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 2552 | }; |
| 2553 | asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { |
| 2554 | "Utf8-4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2555 | "Utf8-4", |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2556 | Utf8_4_free, |
| 2557 | Utf8_4_print, |
| 2558 | Utf8_4_constraint, |
| 2559 | Utf8_4_decode_ber, |
| 2560 | Utf8_4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2561 | Utf8_4_decode_xer, |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2562 | Utf8_4_encode_xer, |
| 2563 | 0, /* Use generic outmost tag fetcher */ |
| 2564 | asn_DEF_Utf8_4_tags, |
| 2565 | sizeof(asn_DEF_Utf8_4_tags) |
| 2566 | /sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */ |
| 2567 | asn_DEF_Utf8_4_tags, /* Same as above */ |
| 2568 | sizeof(asn_DEF_Utf8_4_tags) |
| 2569 | /sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */ |
| 2570 | 0, 0, /* No members */ |
| 2571 | 0 /* No specifics */ |
| 2572 | }; |
| 2573 | |
| 2574 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2575 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 2576 | |
| 2577 | #include <Utf8-2.h> |
| 2578 | |
| 2579 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 2580 | |
| 2581 | |
| 2582 | typedef Utf8_2_t Utf8_3_t; |
| 2583 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2584 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 2585 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2586 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2587 | asn_struct_free_f Utf8_3_free; |
| 2588 | asn_struct_print_f Utf8_3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2589 | asn_constr_check_f Utf8_3_constraint; |
| 2590 | ber_type_decoder_f Utf8_3_decode_ber; |
| 2591 | der_type_encoder_f Utf8_3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2592 | xer_type_decoder_f Utf8_3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2593 | xer_type_encoder_f Utf8_3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2594 | |
| 2595 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 2596 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2597 | static int permitted_alphabet_table_13[128] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2598 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2599 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2600 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2601 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2602 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 2603 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ |
| 2604 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 2605 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 2606 | }; |
| 2607 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2608 | static int check_permitted_alphabet_13(const void *sptr) { |
| 2609 | int *table = permitted_alphabet_table_13; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2610 | /* The underlying type is UTF8String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2611 | const UTF8String_t *st = sptr; |
| 2612 | const uint8_t *ch = st->buf; |
| 2613 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2614 | |
| 2615 | for(; ch < end; ch++) { |
| 2616 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2617 | if(cv >= 0x80) return -1; |
| 2618 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2619 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2620 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2621 | } |
| 2622 | |
| 2623 | |
| 2624 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 2625 | |
| 2626 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2627 | Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2628 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2629 | const Utf8_2_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2630 | size_t size; |
| 2631 | |
| 2632 | if(!sptr) { |
| 2633 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2634 | "%s: value not given (%s:%d)", |
| 2635 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2636 | return -1; |
| 2637 | } |
| 2638 | |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2639 | size = UTF8String_length(st); |
vlm | 1ba4275 | 2004-10-02 16:44:30 +0000 | [diff] [blame] | 2640 | if((ssize_t)size < 0) { |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2641 | _ASN_ERRLOG(app_errlog, app_key, |
| 2642 | "%s: UTF-8: broken encoding (%s:%d)", |
| 2643 | td->name, __FILE__, __LINE__); |
| 2644 | return -1; |
| 2645 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2646 | |
| 2647 | if((size >= 1 && size <= 2) |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2648 | && !check_permitted_alphabet_13(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2649 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2650 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2651 | } else { |
| 2652 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2653 | "%s: constraint failed (%s:%d)", |
| 2654 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2655 | return -1; |
| 2656 | } |
| 2657 | } |
| 2658 | |
| 2659 | /* |
| 2660 | * This type is implemented using Utf8_2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2661 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2662 | */ |
| 2663 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2664 | Utf8_3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2665 | td->free_struct = asn_DEF_Utf8_2.free_struct; |
| 2666 | td->print_struct = asn_DEF_Utf8_2.print_struct; |
| 2667 | td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; |
| 2668 | td->der_encoder = asn_DEF_Utf8_2.der_encoder; |
| 2669 | td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; |
| 2670 | td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; |
| 2671 | td->elements = asn_DEF_Utf8_2.elements; |
| 2672 | td->elements_count = asn_DEF_Utf8_2.elements_count; |
| 2673 | td->specifics = asn_DEF_Utf8_2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2674 | } |
| 2675 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2676 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2677 | Utf8_3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2678 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2679 | Utf8_3_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2680 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2681 | } |
| 2682 | |
| 2683 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2684 | Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2685 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2686 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2687 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2688 | } |
| 2689 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2690 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2691 | Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2692 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2693 | Utf8_3_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2694 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2695 | } |
| 2696 | |
| 2697 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2698 | Utf8_3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2699 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2700 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2701 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2702 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2703 | } |
| 2704 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2705 | asn_dec_rval_t |
| 2706 | Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2707 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 2708 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2709 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2710 | } |
| 2711 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2712 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2713 | Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2714 | int ilevel, enum xer_encoder_flags_e flags, |
| 2715 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2716 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2717 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2718 | } |
| 2719 | |
| 2720 | |
| 2721 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 2722 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2723 | static ber_tlv_tag_t asn_DEF_Utf8_3_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2724 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2725 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2726 | asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2727 | "Utf8-3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2728 | "Utf8-3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2729 | Utf8_3_free, |
| 2730 | Utf8_3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2731 | Utf8_3_constraint, |
| 2732 | Utf8_3_decode_ber, |
| 2733 | Utf8_3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2734 | Utf8_3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2735 | Utf8_3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2736 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2737 | asn_DEF_Utf8_3_tags, |
| 2738 | sizeof(asn_DEF_Utf8_3_tags) |
| 2739 | /sizeof(asn_DEF_Utf8_3_tags[0]), /* 1 */ |
| 2740 | asn_DEF_Utf8_3_tags, /* Same as above */ |
| 2741 | sizeof(asn_DEF_Utf8_3_tags) |
| 2742 | /sizeof(asn_DEF_Utf8_3_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2743 | 0, 0, /* No members */ |
| 2744 | 0 /* No specifics */ |
| 2745 | }; |
| 2746 | |
| 2747 | |
| 2748 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 2749 | |
| 2750 | #include <Utf8-1.h> |
| 2751 | |
| 2752 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 2753 | |
| 2754 | |
| 2755 | typedef Utf8_1_t Utf8_2_t; |
| 2756 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2757 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 2758 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2759 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2760 | asn_struct_free_f Utf8_2_free; |
| 2761 | asn_struct_print_f Utf8_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2762 | asn_constr_check_f Utf8_2_constraint; |
| 2763 | ber_type_decoder_f Utf8_2_decode_ber; |
| 2764 | der_type_encoder_f Utf8_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2765 | xer_type_decoder_f Utf8_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2766 | xer_type_encoder_f Utf8_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2767 | |
| 2768 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 2769 | |
| 2770 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2771 | Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2772 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2773 | const Utf8_1_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2774 | size_t size; |
| 2775 | |
| 2776 | if(!sptr) { |
| 2777 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2778 | "%s: value not given (%s:%d)", |
| 2779 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2780 | return -1; |
| 2781 | } |
| 2782 | |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2783 | size = UTF8String_length(st); |
vlm | 1ba4275 | 2004-10-02 16:44:30 +0000 | [diff] [blame] | 2784 | if((ssize_t)size < 0) { |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2785 | _ASN_ERRLOG(app_errlog, app_key, |
| 2786 | "%s: UTF-8: broken encoding (%s:%d)", |
| 2787 | td->name, __FILE__, __LINE__); |
| 2788 | return -1; |
| 2789 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2790 | |
| 2791 | if((size >= 1 && size <= 2)) { |
| 2792 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2793 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2794 | } else { |
| 2795 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2796 | "%s: constraint failed (%s:%d)", |
| 2797 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2798 | return -1; |
| 2799 | } |
| 2800 | } |
| 2801 | |
| 2802 | /* |
| 2803 | * This type is implemented using Utf8_1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2804 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2805 | */ |
| 2806 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2807 | Utf8_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2808 | td->free_struct = asn_DEF_Utf8_1.free_struct; |
| 2809 | td->print_struct = asn_DEF_Utf8_1.print_struct; |
| 2810 | td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; |
| 2811 | td->der_encoder = asn_DEF_Utf8_1.der_encoder; |
| 2812 | td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; |
| 2813 | td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; |
| 2814 | td->elements = asn_DEF_Utf8_1.elements; |
| 2815 | td->elements_count = asn_DEF_Utf8_1.elements_count; |
| 2816 | td->specifics = asn_DEF_Utf8_1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2817 | } |
| 2818 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2819 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2820 | Utf8_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2821 | void *struct_ptr, int contents_only) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2822 | Utf8_2_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2823 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2824 | } |
| 2825 | |
| 2826 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2827 | Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2828 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2829 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2830 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2831 | } |
| 2832 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2833 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2834 | Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2835 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2836 | Utf8_2_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2837 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2838 | } |
| 2839 | |
| 2840 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2841 | Utf8_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2842 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2843 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2844 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2845 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2846 | } |
| 2847 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2848 | asn_dec_rval_t |
| 2849 | Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2850 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 2851 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2852 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2853 | } |
| 2854 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2855 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2856 | Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2857 | int ilevel, enum xer_encoder_flags_e flags, |
| 2858 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2859 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2860 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2861 | } |
| 2862 | |
| 2863 | |
| 2864 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 2865 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2866 | static ber_tlv_tag_t asn_DEF_Utf8_2_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2867 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2868 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2869 | asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2870 | "Utf8-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2871 | "Utf8-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2872 | Utf8_2_free, |
| 2873 | Utf8_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2874 | Utf8_2_constraint, |
| 2875 | Utf8_2_decode_ber, |
| 2876 | Utf8_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2877 | Utf8_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2878 | Utf8_2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2879 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2880 | asn_DEF_Utf8_2_tags, |
| 2881 | sizeof(asn_DEF_Utf8_2_tags) |
| 2882 | /sizeof(asn_DEF_Utf8_2_tags[0]), /* 1 */ |
| 2883 | asn_DEF_Utf8_2_tags, /* Same as above */ |
| 2884 | sizeof(asn_DEF_Utf8_2_tags) |
| 2885 | /sizeof(asn_DEF_Utf8_2_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2886 | 0, 0, /* No members */ |
| 2887 | 0 /* No specifics */ |
| 2888 | }; |
| 2889 | |
| 2890 | |
| 2891 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 2892 | |
| 2893 | #include <UTF8String.h> |
| 2894 | |
| 2895 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 2896 | |
| 2897 | |
| 2898 | typedef UTF8String_t Utf8_1_t; |
| 2899 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2900 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 2901 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2902 | /* This type is equivalent to UTF8String */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2903 | #define asn_DEF_Utf8_1 asn_DEF_UTF8String |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2904 | |
| 2905 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 2906 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2907 | /* This type is equivalent to UTF8String */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2908 | |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2909 | |
| 2910 | /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ |
| 2911 | |
| 2912 | #include <Identifier.h> |
| 2913 | |
| 2914 | /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ |
| 2915 | |
| 2916 | |
| 2917 | typedef Identifier_t VisibleIdentifier_t; |
| 2918 | |
| 2919 | /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ |
| 2920 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2921 | /* This type is equivalent to Identifier */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2922 | #define asn_DEF_VisibleIdentifier asn_DEF_Identifier |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2923 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2924 | /*** <<< CODE [VisibleIdentifier] >>> ***/ |
| 2925 | |
| 2926 | /* This type is equivalent to Identifier */ |
| 2927 | |
| 2928 | |
| 2929 | /*** <<< INCLUDES [Identifier] >>> ***/ |
| 2930 | |
| 2931 | #include <VisibleString.h> |
| 2932 | |
| 2933 | /*** <<< TYPE-DECLS [Identifier] >>> ***/ |
| 2934 | |
| 2935 | |
| 2936 | typedef VisibleString_t Identifier_t; |
| 2937 | |
| 2938 | /*** <<< FUNC-DECLS [Identifier] >>> ***/ |
| 2939 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2940 | extern asn_TYPE_descriptor_t asn_DEF_Identifier; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2941 | asn_struct_free_f Identifier_free; |
| 2942 | asn_struct_print_f Identifier_print; |
| 2943 | asn_constr_check_f Identifier_constraint; |
| 2944 | ber_type_decoder_f Identifier_decode_ber; |
| 2945 | der_type_encoder_f Identifier_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2946 | xer_type_decoder_f Identifier_decode_xer; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2947 | xer_type_encoder_f Identifier_encode_xer; |
| 2948 | |
| 2949 | /*** <<< CTABLES [Identifier] >>> ***/ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2950 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2951 | static int permitted_alphabet_table_15[256] = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2952 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2953 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2954 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */ |
| 2955 | 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */ |
| 2956 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 2957 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */ |
| 2958 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 2959 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 2960 | }; |
| 2961 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2962 | static int check_permitted_alphabet_15(const void *sptr) { |
| 2963 | int *table = permitted_alphabet_table_15; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2964 | /* The underlying type is VisibleString */ |
| 2965 | const VisibleString_t *st = sptr; |
| 2966 | const uint8_t *ch = st->buf; |
| 2967 | const uint8_t *end = ch + st->size; |
| 2968 | |
| 2969 | for(; ch < end; ch++) { |
| 2970 | uint8_t cv = *ch; |
| 2971 | if(!table[cv]) return -1; |
| 2972 | } |
| 2973 | return 0; |
| 2974 | } |
| 2975 | |
| 2976 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2977 | /*** <<< CODE [Identifier] >>> ***/ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2978 | |
| 2979 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2980 | Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2981 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 2982 | const VisibleString_t *st = sptr; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2983 | size_t size; |
| 2984 | |
| 2985 | if(!sptr) { |
| 2986 | _ASN_ERRLOG(app_errlog, app_key, |
| 2987 | "%s: value not given (%s:%d)", |
| 2988 | td->name, __FILE__, __LINE__); |
| 2989 | return -1; |
| 2990 | } |
| 2991 | |
| 2992 | size = st->size; |
| 2993 | |
| 2994 | if((size >= 1 && size <= 32) |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2995 | && !check_permitted_alphabet_15(sptr)) { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 2996 | /* Constraint check succeeded */ |
| 2997 | return 0; |
| 2998 | } else { |
| 2999 | _ASN_ERRLOG(app_errlog, app_key, |
| 3000 | "%s: constraint failed (%s:%d)", |
| 3001 | td->name, __FILE__, __LINE__); |
| 3002 | return -1; |
| 3003 | } |
| 3004 | } |
| 3005 | |
| 3006 | /* |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3007 | * This type is implemented using VisibleString, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 3008 | * so here we adjust the DEF accordingly. |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3009 | */ |
| 3010 | static void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3011 | Identifier_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3012 | td->free_struct = asn_DEF_VisibleString.free_struct; |
| 3013 | td->print_struct = asn_DEF_VisibleString.print_struct; |
| 3014 | td->ber_decoder = asn_DEF_VisibleString.ber_decoder; |
| 3015 | td->der_encoder = asn_DEF_VisibleString.der_encoder; |
| 3016 | td->xer_decoder = asn_DEF_VisibleString.xer_decoder; |
| 3017 | td->xer_encoder = asn_DEF_VisibleString.xer_encoder; |
| 3018 | td->elements = asn_DEF_VisibleString.elements; |
| 3019 | td->elements_count = asn_DEF_VisibleString.elements_count; |
| 3020 | td->specifics = asn_DEF_VisibleString.specifics; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3021 | } |
| 3022 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3023 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3024 | Identifier_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3025 | void *struct_ptr, int contents_only) { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3026 | Identifier_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3027 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3028 | } |
| 3029 | |
| 3030 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3031 | Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3032 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3033 | Identifier_inherit_TYPE_descriptor(td); |
| 3034 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3035 | } |
| 3036 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3037 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3038 | Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3039 | void **structure, void *bufptr, size_t size, int tag_mode) { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3040 | Identifier_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3041 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3042 | } |
| 3043 | |
| 3044 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3045 | Identifier_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3046 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3047 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3048 | Identifier_inherit_TYPE_descriptor(td); |
| 3049 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3050 | } |
| 3051 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3052 | asn_dec_rval_t |
| 3053 | Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3054 | void **structure, const char *opt_mname, void *bufptr, size_t size) { |
| 3055 | Identifier_inherit_TYPE_descriptor(td); |
| 3056 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3057 | } |
| 3058 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3059 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3060 | Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3061 | int ilevel, enum xer_encoder_flags_e flags, |
| 3062 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3063 | Identifier_inherit_TYPE_descriptor(td); |
| 3064 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3065 | } |
| 3066 | |
| 3067 | |
| 3068 | /*** <<< STAT-DEFS [Identifier] >>> ***/ |
| 3069 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3070 | static ber_tlv_tag_t asn_DEF_Identifier_tags[] = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3071 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 3072 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3073 | asn_TYPE_descriptor_t asn_DEF_Identifier = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3074 | "Identifier", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3075 | "Identifier", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3076 | Identifier_free, |
| 3077 | Identifier_print, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3078 | Identifier_constraint, |
| 3079 | Identifier_decode_ber, |
| 3080 | Identifier_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3081 | Identifier_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3082 | Identifier_encode_xer, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3083 | 0, /* Use generic outmost tag fetcher */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3084 | asn_DEF_Identifier_tags, |
| 3085 | sizeof(asn_DEF_Identifier_tags) |
| 3086 | /sizeof(asn_DEF_Identifier_tags[0]), /* 1 */ |
| 3087 | asn_DEF_Identifier_tags, /* Same as above */ |
| 3088 | sizeof(asn_DEF_Identifier_tags) |
| 3089 | /sizeof(asn_DEF_Identifier_tags[0]), /* 1 */ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3090 | 0, 0, /* No members */ |
| 3091 | 0 /* No specifics */ |
| 3092 | }; |
| 3093 | |