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