blob: b732292b3a3b875ef46c6808e145480c19f58451 [file] [log] [blame]
Lev Walkin64d99e92005-01-30 18:34:07 +00001
2/*** <<< INCLUDES [T] >>> ***/
3
4#include <INTEGER.h>
5#include <OCTET_STRING.h>
6#include <REAL.h>
7#include <constr_SET.h>
8#include <constr_SEQUENCE.h>
9
10/*** <<< DEPS [T] >>> ***/
11
12
13/*
14 * Method of determining the components presence
15 */
16typedef enum class_PR {
17} class_PR;
Lev Walkin64d99e92005-01-30 18:34:07 +000018
19/*** <<< TYPE-DECLS [T] >>> ***/
20
Lev Walkin64d99e92005-01-30 18:34:07 +000021typedef struct T {
22 INTEGER_t Int;
23 OCTET_STRING_t Char;
24 struct Class {
25 /*
26 * This type is extensible,
27 * possible extensions are below.
28 */
29
30 /* Presence bitmask: ASN_SET_ISPRESENT(pclass, class_PR_x) */
31 unsigned int _presence_map
32 [((0+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
33
34 /* Context for parsing across buffer boundaries */
35 asn_struct_ctx_t _asn_ctx;
36 } Class;
37 REAL_t Double;
38
39 /* Context for parsing across buffer boundaries */
40 asn_struct_ctx_t _asn_ctx;
41} T_t;
42
Lev Walkinc8285712005-03-04 22:18:20 +000043/*** <<< FUNC-DECLS [T] >>> ***/
44
45extern asn_TYPE_descriptor_t asn_DEF_T;
46
Lev Walkin64d99e92005-01-30 18:34:07 +000047/*** <<< CODE [T] >>> ***/
48
49static int
Lev Walkin20696a42017-10-17 21:27:33 -070050memb_char_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +000051 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +000052 const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
Lev Walkin64d99e92005-01-30 18:34:07 +000053 size_t size;
54
55 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070056 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin64d99e92005-01-30 18:34:07 +000057 "%s: value not given (%s:%d)",
58 td->name, __FILE__, __LINE__);
59 return -1;
60 }
61
62 size = st->size;
63
64 if((size == 1)) {
65 /* Constraint check succeeded */
66 return 0;
67 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -070068 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin64d99e92005-01-30 18:34:07 +000069 "%s: constraint failed (%s:%d)",
70 td->name, __FILE__, __LINE__);
71 return -1;
72 }
73}
74
75
76/*** <<< STAT-DEFS [T] >>> ***/
77
Lev Walkina7591b52014-10-12 18:37:35 -070078static const ber_tlv_tag_t asn_DEF_class_tags_4[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +000079 (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
80};
Lev Walkina7591b52014-10-12 18:37:35 -070081static const uint8_t asn_MAP_class_mmap_4[(0 + (8 * sizeof(unsigned int)) - 1) / 8] = {
Lev Walkin64d99e92005-01-30 18:34:07 +000082 0
83};
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +080084static
85asn_SET_specifics_t asn_SPC_class_specs_4 = {
Lev Walkin64d99e92005-01-30 18:34:07 +000086 sizeof(struct Class),
87 offsetof(struct Class, _asn_ctx),
88 offsetof(struct Class, _presence_map),
Lev Walkine3917082017-08-23 10:29:38 -070089 0, /* No top level tags */
90 0, /* No tags in the map */
Lev Walkin59b176e2005-11-26 11:25:14 +000091 asn_MAP_class_tag2el_4, /* Same as above */
Lev Walkinf82138b2005-02-25 08:20:32 +000092 0, /* Count of tags in the CXER map */
Lev Walkin64d99e92005-01-30 18:34:07 +000093 1, /* Whether extensible */
Lev Walkin46ef3f32017-07-06 08:47:53 -070094 (const unsigned int *)asn_MAP_class_mmap_4 /* Mandatory elements map */
Lev Walkin64d99e92005-01-30 18:34:07 +000095};
96static /* Use -fall-defs-global to expose */
Lev Walkine8318b82005-03-06 09:29:03 +000097asn_TYPE_descriptor_t asn_DEF_class_4 = {
Lev Walkin64d99e92005-01-30 18:34:07 +000098 "class",
99 "class",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800100 &asn_OP_SET,
Lev Walkin59b176e2005-11-26 11:25:14 +0000101 asn_DEF_class_tags_4,
102 sizeof(asn_DEF_class_tags_4)
103 /sizeof(asn_DEF_class_tags_4[0]), /* 1 */
104 asn_DEF_class_tags_4, /* Same as above */
105 sizeof(asn_DEF_class_tags_4)
106 /sizeof(asn_DEF_class_tags_4[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700107 { 0, 0, SET_constraint },
Lev Walkin64d99e92005-01-30 18:34:07 +0000108 0, 0, /* No members */
Lev Walkin59b176e2005-11-26 11:25:14 +0000109 &asn_SPC_class_specs_4 /* Additional specs */
Lev Walkin64d99e92005-01-30 18:34:07 +0000110};
111
Lev Walkine0272aa2005-03-04 11:26:08 +0000112static asn_TYPE_member_t asn_MBR_T_1[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000113 { ATF_NOFLAGS, 0, offsetof(struct T, Int),
114 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
115 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000116 .type = &asn_DEF_INTEGER,
Lev Walkin67a30122017-08-10 05:48:54 -0700117 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700118 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700119 0, 0, /* No default value */
Lev Walkin64d99e92005-01-30 18:34:07 +0000120 .name = "int"
121 },
122 { ATF_NOFLAGS, 0, offsetof(struct T, Char),
123 .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
124 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000125 .type = &asn_DEF_OCTET_STRING,
Lev Walkin67a30122017-08-10 05:48:54 -0700126 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700127 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = memb_char_constraint_1 },
Lev Walkin20696a42017-10-17 21:27:33 -0700128 0, 0, /* No default value */
Lev Walkin64d99e92005-01-30 18:34:07 +0000129 .name = "char"
130 },
131 { ATF_NOFLAGS, 0, offsetof(struct T, Class),
132 .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
133 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000134 .type = &asn_DEF_class_4,
Lev Walkin67a30122017-08-10 05:48:54 -0700135 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700136 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700137 0, 0, /* No default value */
Lev Walkin64d99e92005-01-30 18:34:07 +0000138 .name = "class"
139 },
140 { ATF_NOFLAGS, 0, offsetof(struct T, Double),
141 .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)),
142 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000143 .type = &asn_DEF_REAL,
Lev Walkin67a30122017-08-10 05:48:54 -0700144 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700145 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700146 0, 0, /* No default value */
Lev Walkin64d99e92005-01-30 18:34:07 +0000147 .name = "double"
148 },
149};
Lev Walkina7591b52014-10-12 18:37:35 -0700150static const ber_tlv_tag_t asn_DEF_T_tags_1[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000151 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
152};
Lev Walkina7591b52014-10-12 18:37:35 -0700153static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = {
Lev Walkin4062b012013-10-11 14:29:38 -0700154 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* int */
155 { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* char */
156 { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 3, 0, 0 }, /* double */
157 { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 } /* class */
Lev Walkin64d99e92005-01-30 18:34:07 +0000158};
Lev Walkin59b176e2005-11-26 11:25:14 +0000159static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000160 sizeof(struct T),
161 offsetof(struct T, _asn_ctx),
Lev Walkine3917082017-08-23 10:29:38 -0700162 .tag2el = asn_MAP_T_tag2el_1,
163 .tag2el_count = 4, /* Count of tags in the map */
Lev Walkin59b176e2005-11-26 11:25:14 +0000164 0, 0, 0, /* Optional elements (not needed) */
Lev Walkindf2edbb2017-10-21 13:40:07 -0700165 -1, /* First extension addition */
Lev Walkin64d99e92005-01-30 18:34:07 +0000166};
167asn_TYPE_descriptor_t asn_DEF_T = {
168 "T",
169 "T",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800170 &asn_OP_SEQUENCE,
Lev Walkin59b176e2005-11-26 11:25:14 +0000171 asn_DEF_T_tags_1,
172 sizeof(asn_DEF_T_tags_1)
173 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
174 asn_DEF_T_tags_1, /* Same as above */
175 sizeof(asn_DEF_T_tags_1)
176 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700177 { 0, 0, SEQUENCE_constraint },
Lev Walkine0272aa2005-03-04 11:26:08 +0000178 asn_MBR_T_1,
Lev Walkin64d99e92005-01-30 18:34:07 +0000179 4, /* Elements count */
Lev Walkin59b176e2005-11-26 11:25:14 +0000180 &asn_SPC_T_specs_1 /* Additional specs */
Lev Walkin64d99e92005-01-30 18:34:07 +0000181};
182