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