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