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