blob: 635a573ca28083aadfe1c2a7ba3595595a4e06d6 [file] [log] [blame]
Lev Walkina00d6b32006-03-21 03:40:38 +00001
2/*** <<< INCLUDES [Narrow] >>> ***/
3
4#include <NativeInteger.h>
5#include <constr_SEQUENCE.h>
6
7/*** <<< TYPE-DECLS [Narrow] >>> ***/
8
Lev Walkin0c0bca62006-03-21 04:48:15 +00009typedef struct Narrow_15P0 {
10 long *narrow1 /* DEFAULT 3 */;
11 long narrow2;
12 long *narrow3 /* OPTIONAL */;
Lev Walkina00d6b32006-03-21 03:40:38 +000013
14 /* Context for parsing across buffer boundaries */
15 asn_struct_ctx_t _asn_ctx;
Lev Walkin0c0bca62006-03-21 04:48:15 +000016} Narrow_15P0_t;
Lev Walkina00d6b32006-03-21 03:40:38 +000017
18/*** <<< FUNC-DECLS [Narrow] >>> ***/
19
Lev Walkin0c0bca62006-03-21 04:48:15 +000020extern asn_TYPE_descriptor_t asn_DEF_Narrow_15P0;
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +080021extern asn_SEQUENCE_specifics_t asn_SPC_Narrow_15P0_specs_1;
22extern asn_TYPE_member_t asn_MBR_Narrow_15P0_1[3];
Lev Walkina00d6b32006-03-21 03:40:38 +000023
24/*** <<< CODE [Narrow] >>> ***/
25
26static int
Lev Walkin0c0bca62006-03-21 04:48:15 +000027memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +000028 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin0c0bca62006-03-21 04:48:15 +000029 long value;
30
31 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070032 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin0c0bca62006-03-21 04:48:15 +000033 "%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 Walkin7c1dc052016-03-14 03:08:15 -070044 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin0c0bca62006-03-21 04:48:15 +000045 "%s: constraint failed (%s:%d)",
46 td->name, __FILE__, __LINE__);
47 return -1;
48 }
49}
50
51static int
52memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +000053 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkina00d6b32006-03-21 03:40:38 +000054 long value;
55
56 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070057 ASN__CTFAIL(app_key, td, sptr,
Lev Walkina00d6b32006-03-21 03:40:38 +000058 "%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 Walkin7c1dc052016-03-14 03:08:15 -070069 ASN__CTFAIL(app_key, td, sptr,
Lev Walkina00d6b32006-03-21 03:40:38 +000070 "%s: constraint failed (%s:%d)",
71 td->name, __FILE__, __LINE__);
72 return -1;
73 }
74}
75
Lev Walkin0c0bca62006-03-21 04:48:15 +000076static int
77memb_narrow3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +000078 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin0c0bca62006-03-21 04:48:15 +000079 long value;
80
81 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070082 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin0c0bca62006-03-21 04:48:15 +000083 "%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 Walkin7c1dc052016-03-14 03:08:15 -070094 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin0c0bca62006-03-21 04:48:15 +000095 "%s: constraint failed (%s:%d)",
96 td->name, __FILE__, __LINE__);
97 return -1;
98 }
99}
100
Lev Walkina00d6b32006-03-21 03:40:38 +0000101
102/*** <<< STAT-DEFS [Narrow] >>> ***/
103
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000104static int asn_DFL_2_set_3(int set_value, void **sptr) {
Lev Walkin0c0bca62006-03-21 04:48:15 +0000105 long *st = *sptr;
106
107 if(!st) {
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000108 if(!set_value) return -1; /* Not a default value */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000109 st = (*sptr = CALLOC(1, sizeof(*st)));
110 if(!st) return -1;
111 }
112
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000113 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 Walkin0c0bca62006-03-21 04:48:15 +0000121}
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800122asn_TYPE_member_t asn_MBR_Narrow_15P0_1[] = {
Lev Walkin0c0bca62006-03-21 04:48:15 +0000123 { ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow1),
Lev Walkina00d6b32006-03-21 03:40:38 +0000124 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
125 .tag_mode = 0,
126 .type = &asn_DEF_NativeInteger,
Lev Walkin67a30122017-08-10 05:48:54 -0700127 .type_selector = 0,
Lev Walkin0c0bca62006-03-21 04:48:15 +0000128 .memb_constraints = memb_narrow1_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400129 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000130 .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 Walkin67a30122017-08-10 05:48:54 -0700138 .type_selector = 0,
Lev Walkin0c0bca62006-03-21 04:48:15 +0000139 .memb_constraints = memb_narrow2_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400140 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkina00d6b32006-03-21 03:40:38 +0000141 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
142 .default_value = 0,
Lev Walkin0c0bca62006-03-21 04:48:15 +0000143 .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 Walkin67a30122017-08-10 05:48:54 -0700149 .type_selector = 0,
Lev Walkin0c0bca62006-03-21 04:48:15 +0000150 .memb_constraints = memb_narrow3_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400151 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000152 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
153 .default_value = 0,
154 .name = "narrow3"
Lev Walkina00d6b32006-03-21 03:40:38 +0000155 },
156};
Lev Walkina7591b52014-10-12 18:37:35 -0700157static const ber_tlv_tag_t asn_DEF_Narrow_15P0_tags_1[] = {
Lev Walkina00d6b32006-03-21 03:40:38 +0000158 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
159};
Lev Walkina7591b52014-10-12 18:37:35 -0700160static const asn_TYPE_tag2member_t asn_MAP_Narrow_15P0_tag2el_1[] = {
Lev Walkin4062b012013-10-11 14:29:38 -0700161 { (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 Walkina00d6b32006-03-21 03:40:38 +0000164};
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800165asn_SEQUENCE_specifics_t asn_SPC_Narrow_15P0_specs_1 = {
Lev Walkin0c0bca62006-03-21 04:48:15 +0000166 sizeof(struct Narrow_15P0),
167 offsetof(struct Narrow_15P0, _asn_ctx),
Lev Walkine3917082017-08-23 10:29:38 -0700168 .tag2el = asn_MAP_Narrow_15P0_tag2el_1,
169 .tag2el_count = 3, /* Count of tags in the map */
Lev Walkina00d6b32006-03-21 03:40:38 +0000170 0, 0, 0, /* Optional elements (not needed) */
171 -1, /* Start extensions */
172 -1 /* Stop extensions */
173};
Lev Walkin0c0bca62006-03-21 04:48:15 +0000174asn_TYPE_descriptor_t asn_DEF_Narrow_15P0 = {
Lev Walkina00d6b32006-03-21 03:40:38 +0000175 "Narrow",
176 "Narrow",
177 SEQUENCE_free,
178 SEQUENCE_print,
Lev Walkincd2f48e2017-08-10 02:14:59 -0700179 SEQUENCE_compare,
Lev Walkina00d6b32006-03-21 03:40:38 +0000180 SEQUENCE_constraint,
181 SEQUENCE_decode_ber,
182 SEQUENCE_encode_der,
183 SEQUENCE_decode_xer,
184 SEQUENCE_encode_xer,
Lev Walkinba68c912017-07-06 07:52:39 -0700185 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkinb33425f2017-07-14 14:59:52 +0400186 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkina00d6b32006-03-21 03:40:38 +0000187 0, /* Use generic outmost tag fetcher */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000188 asn_DEF_Narrow_15P0_tags_1,
189 sizeof(asn_DEF_Narrow_15P0_tags_1)
190 /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */
191 asn_DEF_Narrow_15P0_tags_1, /* Same as above */
192 sizeof(asn_DEF_Narrow_15P0_tags_1)
193 /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400194 0, /* No OER visible constraints */
Lev Walkina00d6b32006-03-21 03:40:38 +0000195 0, /* No PER visible constraints */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000196 asn_MBR_Narrow_15P0_1,
197 3, /* Elements count */
198 &asn_SPC_Narrow_15P0_specs_1 /* Additional specs */
Lev Walkina00d6b32006-03-21 03:40:38 +0000199};
200
201
202/*** <<< INCLUDES [NarrowInteger] >>> ***/
203
Lev Walkin22b5ed42006-09-13 02:51:20 +0000204#include "Narrow.h"
Lev Walkina00d6b32006-03-21 03:40:38 +0000205
206/*** <<< TYPE-DECLS [NarrowInteger] >>> ***/
207
Lev Walkin0c0bca62006-03-21 04:48:15 +0000208typedef Narrow_15P0_t NarrowInteger_t;
Lev Walkina00d6b32006-03-21 03:40:38 +0000209
210/*** <<< FUNC-DECLS [NarrowInteger] >>> ***/
211
212extern asn_TYPE_descriptor_t asn_DEF_NarrowInteger;
213asn_struct_free_f NarrowInteger_free;
214asn_struct_print_f NarrowInteger_print;
215asn_constr_check_f NarrowInteger_constraint;
216ber_type_decoder_f NarrowInteger_decode_ber;
217der_type_encoder_f NarrowInteger_encode_der;
218xer_type_decoder_f NarrowInteger_decode_xer;
219xer_type_encoder_f NarrowInteger_encode_xer;
220
221/*** <<< CODE [NarrowInteger] >>> ***/
222
Lev Walkina00d6b32006-03-21 03:40:38 +0000223/*
Lev Walkin0c0bca62006-03-21 04:48:15 +0000224 * This type is implemented using Narrow_15P0,
Lev Walkina00d6b32006-03-21 03:40:38 +0000225 * so here we adjust the DEF accordingly.
226 */
Lev Walkina00d6b32006-03-21 03:40:38 +0000227
228/*** <<< STAT-DEFS [NarrowInteger] >>> ***/
229
Lev Walkina7591b52014-10-12 18:37:35 -0700230static const ber_tlv_tag_t asn_DEF_NarrowInteger_tags_1[] = {
Lev Walkina00d6b32006-03-21 03:40:38 +0000231 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
232};
233asn_TYPE_descriptor_t asn_DEF_NarrowInteger = {
234 "NarrowInteger",
235 "NarrowInteger",
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800236 SEQUENCE_free,
237 SEQUENCE_print,
Lev Walkincd2f48e2017-08-10 02:14:59 -0700238 SEQUENCE_compare,
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800239 SEQUENCE_constraint,
240 SEQUENCE_decode_ber,
241 SEQUENCE_encode_der,
242 SEQUENCE_decode_xer,
243 SEQUENCE_encode_xer,
Lev Walkinba68c912017-07-06 07:52:39 -0700244 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkinb33425f2017-07-14 14:59:52 +0400245 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkina00d6b32006-03-21 03:40:38 +0000246 0, /* Use generic outmost tag fetcher */
247 asn_DEF_NarrowInteger_tags_1,
248 sizeof(asn_DEF_NarrowInteger_tags_1)
249 /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */
250 asn_DEF_NarrowInteger_tags_1, /* Same as above */
251 sizeof(asn_DEF_NarrowInteger_tags_1)
252 /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400253 0, /* No OER visible constraints */
Lev Walkina00d6b32006-03-21 03:40:38 +0000254 0, /* No PER visible constraints */
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800255 asn_MBR_Narrow_15P0_1,
256 3, /* Elements count */
257 &asn_SPC_Narrow_15P0_specs_1 /* Additional specs */
Lev Walkina00d6b32006-03-21 03:40:38 +0000258};
259