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