blob: 1ba216104142680a08cb802f714284ecd9b092f7 [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 Walkin20696a42017-10-17 21:27:33 -070027memb_narrow1_constraint_1(const 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
Lev Walkin20696a42017-10-17 21:27:33 -070052memb_narrow2_constraint_1(const 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
Lev Walkin20696a42017-10-17 21:27:33 -070077memb_narrow3_constraint_1(const 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 Walkin20696a42017-10-17 21:27:33 -0700104static int asn_DFL_2_cmp_3(const void *sptr) {
105 const long *st = sptr;
106
107 if(!st) {
108 return -1; /* No value is not a default value */
109 }
110
111 /* Test default value 3 */
112 return (*st != 3);
113}
114static int asn_DFL_2_set_3(void **sptr) {
Lev Walkin0c0bca62006-03-21 04:48:15 +0000115 long *st = *sptr;
116
117 if(!st) {
118 st = (*sptr = CALLOC(1, sizeof(*st)));
119 if(!st) return -1;
120 }
121
Lev Walkin20696a42017-10-17 21:27:33 -0700122 /* Install default value 3 */
123 *st = 3;
124 return 0;
Lev Walkin0c0bca62006-03-21 04:48:15 +0000125}
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800126asn_TYPE_member_t asn_MBR_Narrow_15P0_1[] = {
Lev Walkin0c0bca62006-03-21 04:48:15 +0000127 { ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow1),
Lev Walkina00d6b32006-03-21 03:40:38 +0000128 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
129 .tag_mode = 0,
130 .type = &asn_DEF_NativeInteger,
Lev Walkin67a30122017-08-10 05:48:54 -0700131 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700132 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = memb_narrow1_constraint_1 },
Lev Walkinb37ee632017-10-18 16:52:18 -0700133 .default_value_cmp = &asn_DFL_2_cmp_3, /* Compare DEFAULT 3 */
134 .default_value_set = &asn_DFL_2_set_3, /* Set DEFAULT 3 */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000135 .name = "narrow1"
136 },
137 { ATF_NOFLAGS, 0, offsetof(struct Narrow_15P0, narrow2),
138 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
139 .tag_mode = +1, /* EXPLICIT tag at current level */
140 .type = &asn_DEF_NativeInteger,
Lev Walkin67a30122017-08-10 05:48:54 -0700141 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700142 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = memb_narrow2_constraint_1 },
Lev Walkin20696a42017-10-17 21:27:33 -0700143 0, 0, /* No default value */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000144 .name = "narrow2"
145 },
146 { ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow3),
147 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
148 .tag_mode = +1, /* EXPLICIT tag at current level */
149 .type = &asn_DEF_NativeInteger,
Lev Walkin67a30122017-08-10 05:48:54 -0700150 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700151 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = memb_narrow3_constraint_1 },
Lev Walkin20696a42017-10-17 21:27:33 -0700152 0, 0, /* No default value */
Lev Walkin0c0bca62006-03-21 04:48:15 +0000153 .name = "narrow3"
Lev Walkina00d6b32006-03-21 03:40:38 +0000154 },
155};
Lev Walkina7591b52014-10-12 18:37:35 -0700156static const ber_tlv_tag_t asn_DEF_Narrow_15P0_tags_1[] = {
Lev Walkina00d6b32006-03-21 03:40:38 +0000157 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
158};
Lev Walkina7591b52014-10-12 18:37:35 -0700159static const asn_TYPE_tag2member_t asn_MAP_Narrow_15P0_tag2el_1[] = {
Lev Walkin4062b012013-10-11 14:29:38 -0700160 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* narrow1 */
161 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* narrow2 */
162 { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 } /* narrow3 */
Lev Walkina00d6b32006-03-21 03:40:38 +0000163};
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800164asn_SEQUENCE_specifics_t asn_SPC_Narrow_15P0_specs_1 = {
Lev Walkin0c0bca62006-03-21 04:48:15 +0000165 sizeof(struct Narrow_15P0),
166 offsetof(struct Narrow_15P0, _asn_ctx),
Lev Walkine3917082017-08-23 10:29:38 -0700167 .tag2el = asn_MAP_Narrow_15P0_tag2el_1,
168 .tag2el_count = 3, /* Count of tags in the map */
Lev Walkina00d6b32006-03-21 03:40:38 +0000169 0, 0, 0, /* Optional elements (not needed) */
Lev Walkindf2edbb2017-10-21 13:40:07 -0700170 -1, /* First extension addition */
Lev Walkina00d6b32006-03-21 03:40:38 +0000171};
Lev Walkin0c0bca62006-03-21 04:48:15 +0000172asn_TYPE_descriptor_t asn_DEF_Narrow_15P0 = {
Lev Walkina00d6b32006-03-21 03:40:38 +0000173 "Narrow",
174 "Narrow",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800175 &asn_OP_SEQUENCE,
Lev Walkin0c0bca62006-03-21 04:48:15 +0000176 asn_DEF_Narrow_15P0_tags_1,
177 sizeof(asn_DEF_Narrow_15P0_tags_1)
178 /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */
179 asn_DEF_Narrow_15P0_tags_1, /* Same as above */
180 sizeof(asn_DEF_Narrow_15P0_tags_1)
181 /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700182 { 0, 0, SEQUENCE_constraint },
Lev Walkin0c0bca62006-03-21 04:48:15 +0000183 asn_MBR_Narrow_15P0_1,
184 3, /* Elements count */
185 &asn_SPC_Narrow_15P0_specs_1 /* Additional specs */
Lev Walkina00d6b32006-03-21 03:40:38 +0000186};
187
188
189/*** <<< INCLUDES [NarrowInteger] >>> ***/
190
Lev Walkin22b5ed42006-09-13 02:51:20 +0000191#include "Narrow.h"
Lev Walkina00d6b32006-03-21 03:40:38 +0000192
193/*** <<< TYPE-DECLS [NarrowInteger] >>> ***/
194
Lev Walkin0c0bca62006-03-21 04:48:15 +0000195typedef Narrow_15P0_t NarrowInteger_t;
Lev Walkina00d6b32006-03-21 03:40:38 +0000196
197/*** <<< FUNC-DECLS [NarrowInteger] >>> ***/
198
199extern asn_TYPE_descriptor_t asn_DEF_NarrowInteger;
200asn_struct_free_f NarrowInteger_free;
201asn_struct_print_f NarrowInteger_print;
202asn_constr_check_f NarrowInteger_constraint;
203ber_type_decoder_f NarrowInteger_decode_ber;
204der_type_encoder_f NarrowInteger_encode_der;
205xer_type_decoder_f NarrowInteger_decode_xer;
206xer_type_encoder_f NarrowInteger_encode_xer;
207
208/*** <<< CODE [NarrowInteger] >>> ***/
209
Lev Walkina00d6b32006-03-21 03:40:38 +0000210/*
Lev Walkin0c0bca62006-03-21 04:48:15 +0000211 * This type is implemented using Narrow_15P0,
Lev Walkina00d6b32006-03-21 03:40:38 +0000212 * so here we adjust the DEF accordingly.
213 */
Lev Walkina00d6b32006-03-21 03:40:38 +0000214
215/*** <<< STAT-DEFS [NarrowInteger] >>> ***/
216
Lev Walkina7591b52014-10-12 18:37:35 -0700217static const ber_tlv_tag_t asn_DEF_NarrowInteger_tags_1[] = {
Lev Walkina00d6b32006-03-21 03:40:38 +0000218 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
219};
220asn_TYPE_descriptor_t asn_DEF_NarrowInteger = {
221 "NarrowInteger",
222 "NarrowInteger",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800223 &asn_OP_SEQUENCE,
Lev Walkina00d6b32006-03-21 03:40:38 +0000224 asn_DEF_NarrowInteger_tags_1,
225 sizeof(asn_DEF_NarrowInteger_tags_1)
226 /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */
227 asn_DEF_NarrowInteger_tags_1, /* Same as above */
228 sizeof(asn_DEF_NarrowInteger_tags_1)
229 /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700230 { 0, 0, SEQUENCE_constraint },
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800231 asn_MBR_Narrow_15P0_1,
232 3, /* Elements count */
233 &asn_SPC_Narrow_15P0_specs_1 /* Additional specs */
Lev Walkina00d6b32006-03-21 03:40:38 +0000234};
235