2
2
/*** <<< INCLUDES [T] >>> ***/
3
3
4
4
#include <INTEGER.h>
5
+ #include <NativeInteger.h>
5
6
#include <constr_SEQUENCE.h>
6
7
7
8
/*** <<< TYPE-DECLS [T] >>> ***/
8
9
9
10
typedef struct T {
10
11
INTEGER_t unsigned33;
11
12
INTEGER_t unsigned42;
13
+ INTEGER_t signed33;
14
+ long signed33ext;
12
15
13
16
/* Context for parsing across buffer boundaries */
14
17
asn_struct_ctx_t _asn_ctx;
@@ -82,6 +85,62 @@ memb_unsigned42_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
82
85
}
83
86
}
84
87
88
+ static int
89
+ memb_signed33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
90
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
91
+ const INTEGER_t *st = (const INTEGER_t *)sptr;
92
+ long value;
93
+
94
+ if(!sptr) {
95
+ _ASN_CTFAIL(app_key, td, sptr,
96
+ "%s: value not given (%s:%d)",
97
+ td->name, __FILE__, __LINE__);
98
+ return -1;
99
+ }
100
+
101
+ if(asn_INTEGER2long(st, &value)) {
102
+ _ASN_CTFAIL(app_key, td, sptr,
103
+ "%s: value too large (%s:%d)",
104
+ td->name, __FILE__, __LINE__);
105
+ return -1;
106
+ }
107
+
108
+ if((value >= -4000000000 && value <= 4000000000)) {
109
+ /* Constraint check succeeded */
110
+ return 0;
111
+ } else {
112
+ _ASN_CTFAIL(app_key, td, sptr,
113
+ "%s: constraint failed (%s:%d)",
114
+ td->name, __FILE__, __LINE__);
115
+ return -1;
116
+ }
117
+ }
118
+
119
+ static int
120
+ memb_signed33ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
121
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
122
+ long value;
123
+
124
+ if(!sptr) {
125
+ _ASN_CTFAIL(app_key, td, sptr,
126
+ "%s: value not given (%s:%d)",
127
+ td->name, __FILE__, __LINE__);
128
+ return -1;
129
+ }
130
+
131
+ value = *(const long *)sptr;
132
+
133
+ if((value >= -4000000000 && value <= 4000000000)) {
134
+ /* Constraint check succeeded */
135
+ return 0;
136
+ } else {
137
+ _ASN_CTFAIL(app_key, td, sptr,
138
+ "%s: constraint failed (%s:%d)",
139
+ td->name, __FILE__, __LINE__);
140
+ return -1;
141
+ }
142
+ }
143
+
85
144
86
145
/*** <<< CTDEFS [T] >>> ***/
87
146
@@ -95,6 +154,16 @@ static asn_per_constraints_t asn_PER_memb_unsigned42_constr_3 GCC_NOTUSED = {
95
154
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
96
155
0, 0 /* No PER value map */
97
156
};
157
+ static asn_per_constraints_t asn_PER_memb_signed33_constr_4 GCC_NOTUSED = {
158
+ { APC_CONSTRAINED, 33, -1, -4000000000, 4000000000 } /* (-4000000000..4000000000) */,
159
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
160
+ 0, 0 /* No PER value map */
161
+ };
162
+ static asn_per_constraints_t asn_PER_memb_signed33ext_constr_5 GCC_NOTUSED = {
163
+ { APC_CONSTRAINED | APC_EXTENSIBLE, 33, -1, -4000000000, 4000000000 } /* (-4000000000..4000000000,...) */,
164
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
165
+ 0, 0 /* No PER value map */
166
+ };
98
167
99
168
/*** <<< STAT-DEFS [T] >>> ***/
100
169
@@ -117,19 +186,39 @@ static asn_TYPE_member_t asn_MBR_T_1[] = {
117
186
.default_value = 0,
118
187
.name = "unsigned42"
119
188
},
189
+ { ATF_NOFLAGS, 0, offsetof(struct T, signed33),
190
+ .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
191
+ .tag_mode = -1, /* IMPLICIT tag at current level */
192
+ .type = &asn_DEF_INTEGER,
193
+ .memb_constraints = memb_signed33_constraint_1,
194
+ .per_constraints = &asn_PER_memb_signed33_constr_4,
195
+ .default_value = 0,
196
+ .name = "signed33"
197
+ },
198
+ { ATF_NOFLAGS, 0, offsetof(struct T, signed33ext),
199
+ .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
200
+ .tag_mode = -1, /* IMPLICIT tag at current level */
201
+ .type = &asn_DEF_NativeInteger,
202
+ .memb_constraints = memb_signed33ext_constraint_1,
203
+ .per_constraints = &asn_PER_memb_signed33ext_constr_5,
204
+ .default_value = 0,
205
+ .name = "signed33ext"
206
+ },
120
207
};
121
208
static ber_tlv_tag_t asn_DEF_T_tags_1[] = {
122
209
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
123
210
};
124
211
static asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = {
125
212
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* unsigned33 */
126
- { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* unsigned42 */
213
+ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* unsigned42 */
214
+ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* signed33 */
215
+ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* signed33ext */
127
216
};
128
217
static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = {
129
218
sizeof(struct T),
130
219
offsetof(struct T, _asn_ctx),
131
220
asn_MAP_T_tag2el_1,
132
- 2 , /* Count of tags in the map */
221
+ 4 , /* Count of tags in the map */
133
222
0, 0, 0, /* Optional elements (not needed) */
134
223
-1, /* Start extensions */
135
224
-1 /* Stop extensions */
@@ -155,7 +244,7 @@ asn_TYPE_descriptor_t asn_DEF_T = {
155
244
/sizeof(asn_DEF_T_tags_1[0]), /* 1 */
156
245
0, /* No PER visible constraints */
157
246
asn_MBR_T_1,
158
- 2 , /* Elements count */
247
+ 4 , /* Elements count */
159
248
&asn_SPC_T_specs_1 /* Additional specs */
160
249
};
161
250
0 commit comments