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