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