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