Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Narrow] >>> ***/ |
| 3 | |
| 4 | #include <NativeInteger.h> |
| 5 | #include <constr_SEQUENCE.h> |
| 6 | |
| 7 | /*** <<< TYPE-DECLS [Narrow] >>> ***/ |
| 8 | |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 9 | typedef struct Narrow_15P0 { |
| 10 | long *narrow1 /* DEFAULT 3 */; |
| 11 | long narrow2; |
| 12 | long *narrow3 /* OPTIONAL */; |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 13 | |
| 14 | /* Context for parsing across buffer boundaries */ |
| 15 | asn_struct_ctx_t _asn_ctx; |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 16 | } Narrow_15P0_t; |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 17 | |
| 18 | /*** <<< FUNC-DECLS [Narrow] >>> ***/ |
| 19 | |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 20 | extern asn_TYPE_descriptor_t asn_DEF_Narrow_15P0; |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 21 | extern asn_SEQUENCE_specifics_t asn_SPC_Narrow_15P0_specs_1; |
| 22 | extern asn_TYPE_member_t asn_MBR_Narrow_15P0_1[3]; |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 23 | |
| 24 | /*** <<< CODE [Narrow] >>> ***/ |
| 25 | |
| 26 | static int |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 27 | memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 28 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 29 | long value; |
| 30 | |
| 31 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 32 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 33 | "%s: value not given (%s:%d)", |
| 34 | td->name, __FILE__, __LINE__); |
| 35 | return -1; |
| 36 | } |
| 37 | |
| 38 | value = *(const long *)sptr; |
| 39 | |
| 40 | if((value >= 1 && value <= 5)) { |
| 41 | /* Constraint check succeeded */ |
| 42 | return 0; |
| 43 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 44 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 45 | "%s: constraint failed (%s:%d)", |
| 46 | td->name, __FILE__, __LINE__); |
| 47 | return -1; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | static int |
| 52 | memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 53 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 54 | long value; |
| 55 | |
| 56 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 57 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 58 | "%s: value not given (%s:%d)", |
| 59 | td->name, __FILE__, __LINE__); |
| 60 | return -1; |
| 61 | } |
| 62 | |
| 63 | value = *(const long *)sptr; |
| 64 | |
| 65 | if((value >= 2 && value <= 5)) { |
| 66 | /* Constraint check succeeded */ |
| 67 | return 0; |
| 68 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 69 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 70 | "%s: constraint failed (%s:%d)", |
| 71 | td->name, __FILE__, __LINE__); |
| 72 | return -1; |
| 73 | } |
| 74 | } |
| 75 | |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 76 | static int |
| 77 | memb_narrow3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 78 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 79 | long value; |
| 80 | |
| 81 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 82 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 83 | "%s: value not given (%s:%d)", |
| 84 | td->name, __FILE__, __LINE__); |
| 85 | return -1; |
| 86 | } |
| 87 | |
| 88 | value = *(const long *)sptr; |
| 89 | |
| 90 | if((value >= 3 && value <= 5)) { |
| 91 | /* Constraint check succeeded */ |
| 92 | return 0; |
| 93 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 94 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 95 | "%s: constraint failed (%s:%d)", |
| 96 | td->name, __FILE__, __LINE__); |
| 97 | return -1; |
| 98 | } |
| 99 | } |
| 100 | |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 101 | |
| 102 | /*** <<< STAT-DEFS [Narrow] >>> ***/ |
| 103 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 104 | static int asn_DFL_2_set_3(int set_value, void **sptr) { |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 105 | long *st = *sptr; |
| 106 | |
| 107 | if(!st) { |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 108 | if(!set_value) return -1; /* Not a default value */ |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 109 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 110 | if(!st) return -1; |
| 111 | } |
| 112 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 113 | if(set_value) { |
| 114 | /* Install default value 3 */ |
| 115 | *st = 3; |
| 116 | return 0; |
| 117 | } else { |
| 118 | /* Test default value 3 */ |
| 119 | return (*st == 3); |
| 120 | } |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 121 | } |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 122 | asn_TYPE_member_t asn_MBR_Narrow_15P0_1[] = { |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 123 | { ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow1), |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 124 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 125 | .tag_mode = 0, |
| 126 | .type = &asn_DEF_NativeInteger, |
Lev Walkin | 67a3012 | 2017-08-10 05:48:54 -0700 | [diff] [blame] | 127 | .type_selector = 0, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 128 | .memb_constraints = memb_narrow1_constraint_1, |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 129 | .oer_constraints = 0, /* OER is not compiled, use -gen-OER */ |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 130 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 131 | .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ |
| 132 | .name = "narrow1" |
| 133 | }, |
| 134 | { ATF_NOFLAGS, 0, offsetof(struct Narrow_15P0, narrow2), |
| 135 | .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 136 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 137 | .type = &asn_DEF_NativeInteger, |
Lev Walkin | 67a3012 | 2017-08-10 05:48:54 -0700 | [diff] [blame] | 138 | .type_selector = 0, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 139 | .memb_constraints = memb_narrow2_constraint_1, |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 140 | .oer_constraints = 0, /* OER is not compiled, use -gen-OER */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 141 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 142 | .default_value = 0, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 143 | .name = "narrow2" |
| 144 | }, |
| 145 | { ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow3), |
| 146 | .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), |
| 147 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 148 | .type = &asn_DEF_NativeInteger, |
Lev Walkin | 67a3012 | 2017-08-10 05:48:54 -0700 | [diff] [blame] | 149 | .type_selector = 0, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 150 | .memb_constraints = memb_narrow3_constraint_1, |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 151 | .oer_constraints = 0, /* OER is not compiled, use -gen-OER */ |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 152 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 153 | .default_value = 0, |
| 154 | .name = "narrow3" |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 155 | }, |
| 156 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 157 | static const ber_tlv_tag_t asn_DEF_Narrow_15P0_tags_1[] = { |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 158 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 159 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 160 | static const asn_TYPE_tag2member_t asn_MAP_Narrow_15P0_tag2el_1[] = { |
Lev Walkin | 4062b01 | 2013-10-11 14:29:38 -0700 | [diff] [blame] | 161 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* narrow1 */ |
| 162 | { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* narrow2 */ |
| 163 | { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 } /* narrow3 */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 164 | }; |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 165 | asn_SEQUENCE_specifics_t asn_SPC_Narrow_15P0_specs_1 = { |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 166 | sizeof(struct Narrow_15P0), |
| 167 | offsetof(struct Narrow_15P0, _asn_ctx), |
Lev Walkin | e391708 | 2017-08-23 10:29:38 -0700 | [diff] [blame] | 168 | .tag2el = asn_MAP_Narrow_15P0_tag2el_1, |
| 169 | .tag2el_count = 3, /* Count of tags in the map */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 170 | 0, 0, 0, /* Optional elements (not needed) */ |
| 171 | -1, /* Start extensions */ |
| 172 | -1 /* Stop extensions */ |
| 173 | }; |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 174 | asn_TYPE_descriptor_t asn_DEF_Narrow_15P0 = { |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 175 | "Narrow", |
| 176 | "Narrow", |
Bi-Ruei, Chiu | 1f87ac0 | 2017-08-20 01:25:45 +0800 | [diff] [blame] | 177 | &asn_OP_SEQUENCE, |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 178 | SEQUENCE_constraint, |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 179 | asn_DEF_Narrow_15P0_tags_1, |
| 180 | sizeof(asn_DEF_Narrow_15P0_tags_1) |
| 181 | /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */ |
| 182 | asn_DEF_Narrow_15P0_tags_1, /* Same as above */ |
| 183 | sizeof(asn_DEF_Narrow_15P0_tags_1) |
| 184 | /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */ |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 185 | 0, /* No OER visible constraints */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 186 | 0, /* No PER visible constraints */ |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 187 | asn_MBR_Narrow_15P0_1, |
| 188 | 3, /* Elements count */ |
| 189 | &asn_SPC_Narrow_15P0_specs_1 /* Additional specs */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 190 | }; |
| 191 | |
| 192 | |
| 193 | /*** <<< INCLUDES [NarrowInteger] >>> ***/ |
| 194 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 195 | #include "Narrow.h" |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 196 | |
| 197 | /*** <<< TYPE-DECLS [NarrowInteger] >>> ***/ |
| 198 | |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 199 | typedef Narrow_15P0_t NarrowInteger_t; |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 200 | |
| 201 | /*** <<< FUNC-DECLS [NarrowInteger] >>> ***/ |
| 202 | |
| 203 | extern asn_TYPE_descriptor_t asn_DEF_NarrowInteger; |
| 204 | asn_struct_free_f NarrowInteger_free; |
| 205 | asn_struct_print_f NarrowInteger_print; |
| 206 | asn_constr_check_f NarrowInteger_constraint; |
| 207 | ber_type_decoder_f NarrowInteger_decode_ber; |
| 208 | der_type_encoder_f NarrowInteger_encode_der; |
| 209 | xer_type_decoder_f NarrowInteger_decode_xer; |
| 210 | xer_type_encoder_f NarrowInteger_encode_xer; |
| 211 | |
| 212 | /*** <<< CODE [NarrowInteger] >>> ***/ |
| 213 | |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 214 | /* |
Lev Walkin | 0c0bca6 | 2006-03-21 04:48:15 +0000 | [diff] [blame] | 215 | * This type is implemented using Narrow_15P0, |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 216 | * so here we adjust the DEF accordingly. |
| 217 | */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 218 | |
| 219 | /*** <<< STAT-DEFS [NarrowInteger] >>> ***/ |
| 220 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 221 | static const ber_tlv_tag_t asn_DEF_NarrowInteger_tags_1[] = { |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 222 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 223 | }; |
| 224 | asn_TYPE_descriptor_t asn_DEF_NarrowInteger = { |
| 225 | "NarrowInteger", |
| 226 | "NarrowInteger", |
Bi-Ruei, Chiu | 1f87ac0 | 2017-08-20 01:25:45 +0800 | [diff] [blame] | 227 | &asn_OP_SEQUENCE, |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 228 | SEQUENCE_constraint, |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 229 | asn_DEF_NarrowInteger_tags_1, |
| 230 | sizeof(asn_DEF_NarrowInteger_tags_1) |
| 231 | /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */ |
| 232 | asn_DEF_NarrowInteger_tags_1, /* Same as above */ |
| 233 | sizeof(asn_DEF_NarrowInteger_tags_1) |
| 234 | /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */ |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 235 | 0, /* No OER visible constraints */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 236 | 0, /* No PER visible constraints */ |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 237 | asn_MBR_Narrow_15P0_1, |
| 238 | 3, /* Elements count */ |
| 239 | &asn_SPC_Narrow_15P0_specs_1 /* Additional specs */ |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 240 | }; |
| 241 | |