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