blob: 33db670bafc5e5c2f62e289a2cf03e4de8dc9cae [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
50memb_char_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
51 asn_app_consume_bytes_f *app_errlog, 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) {
56 _ASN_ERRLOG(app_errlog, app_key,
57 "%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 {
68 _ASN_ERRLOG(app_errlog, app_key,
69 "%s: constraint failed (%s:%d)",
70 td->name, __FILE__, __LINE__);
71 return -1;
72 }
73}
74
75
76/*** <<< STAT-DEFS [T] >>> ***/
77
Lev Walkine8318b82005-03-06 09:29:03 +000078static ber_tlv_tag_t asn_DEF_class_4_tags[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +000079 (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
80};
Lev Walkine8318b82005-03-06 09:29:03 +000081static uint8_t asn_MAP_class_4_mmap[(0 + (8 * sizeof(unsigned int)) - 1) / 8] = {
Lev Walkin64d99e92005-01-30 18:34:07 +000082 0
83};
Lev Walkine8318b82005-03-06 09:29:03 +000084static asn_SET_specifics_t asn_SPC_class_4_specs = {
Lev Walkin64d99e92005-01-30 18:34:07 +000085 sizeof(struct Class),
86 offsetof(struct Class, _asn_ctx),
87 offsetof(struct Class, _presence_map),
Lev Walkine8318b82005-03-06 09:29:03 +000088 asn_MAP_class_4_tag2el,
Lev Walkin64d99e92005-01-30 18:34:07 +000089 0, /* Count of tags in the map */
Lev Walkine8318b82005-03-06 09:29:03 +000090 asn_MAP_class_4_tag2el, /* Same as above */
Lev Walkinf82138b2005-02-25 08:20:32 +000091 0, /* Count of tags in the CXER map */
Lev Walkin64d99e92005-01-30 18:34:07 +000092 1, /* Whether extensible */
Lev Walkine8318b82005-03-06 09:29:03 +000093 (unsigned int *)asn_MAP_class_4_mmap /* Mandatory elements map */
Lev Walkin64d99e92005-01-30 18:34:07 +000094};
95static /* Use -fall-defs-global to expose */
Lev Walkine8318b82005-03-06 09:29:03 +000096asn_TYPE_descriptor_t asn_DEF_class_4 = {
Lev Walkin64d99e92005-01-30 18:34:07 +000097 "class",
98 "class",
99 SET_free,
100 SET_print,
101 SET_constraint,
102 SET_decode_ber,
103 SET_encode_der,
Lev Walkinb2230802005-02-14 20:31:31 +0000104 SET_decode_xer,
Lev Walkin64d99e92005-01-30 18:34:07 +0000105 SET_encode_xer,
106 0, /* Use generic outmost tag fetcher */
Lev Walkine8318b82005-03-06 09:29:03 +0000107 asn_DEF_class_4_tags,
108 sizeof(asn_DEF_class_4_tags)
109 /sizeof(asn_DEF_class_4_tags[0]), /* 1 */
110 asn_DEF_class_4_tags, /* Same as above */
111 sizeof(asn_DEF_class_4_tags)
112 /sizeof(asn_DEF_class_4_tags[0]), /* 1 */
Lev Walkin64d99e92005-01-30 18:34:07 +0000113 0, 0, /* No members */
Lev Walkine8318b82005-03-06 09:29:03 +0000114 &asn_SPC_class_4_specs /* Additional specs */
Lev Walkin64d99e92005-01-30 18:34:07 +0000115};
116
Lev Walkine0272aa2005-03-04 11:26:08 +0000117static asn_TYPE_member_t asn_MBR_T_1[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000118 { ATF_NOFLAGS, 0, offsetof(struct T, Int),
119 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
120 .tag_mode = 0,
121 .type = (void *)&asn_DEF_INTEGER,
122 .memb_constraints = 0, /* Defer constraints checking to the member type */
123 .name = "int"
124 },
125 { ATF_NOFLAGS, 0, offsetof(struct T, Char),
126 .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
127 .tag_mode = 0,
128 .type = (void *)&asn_DEF_OCTET_STRING,
129 .memb_constraints = memb_char_1_constraint,
130 .name = "char"
131 },
132 { ATF_NOFLAGS, 0, offsetof(struct T, Class),
133 .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
134 .tag_mode = 0,
Lev Walkine8318b82005-03-06 09:29:03 +0000135 .type = (void *)&asn_DEF_class_4,
Lev Walkin64d99e92005-01-30 18:34:07 +0000136 .memb_constraints = 0, /* Defer constraints checking to the member type */
137 .name = "class"
138 },
139 { ATF_NOFLAGS, 0, offsetof(struct T, Double),
140 .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)),
141 .tag_mode = 0,
142 .type = (void *)&asn_DEF_REAL,
143 .memb_constraints = 0, /* Defer constraints checking to the member type */
144 .name = "double"
145 },
146};
Lev Walkine0272aa2005-03-04 11:26:08 +0000147static ber_tlv_tag_t asn_DEF_T_1_tags[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000148 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
149};
Lev Walkine0272aa2005-03-04 11:26:08 +0000150static asn_TYPE_tag2member_t asn_MAP_T_1_tag2el[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000151 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* int at 15 */
152 { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* char at 16 */
153 { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 3, 0, 0 }, /* double at 18 */
Lev Walkinf82138b2005-02-25 08:20:32 +0000154 { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 } /* class at 17 */
Lev Walkin64d99e92005-01-30 18:34:07 +0000155};
Lev Walkine0272aa2005-03-04 11:26:08 +0000156static asn_SEQUENCE_specifics_t asn_SPC_T_1_specs = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000157 sizeof(struct T),
158 offsetof(struct T, _asn_ctx),
Lev Walkine0272aa2005-03-04 11:26:08 +0000159 asn_MAP_T_1_tag2el,
Lev Walkin64d99e92005-01-30 18:34:07 +0000160 4, /* Count of tags in the map */
161 -1, /* Start extensions */
162 -1 /* Stop extensions */
163};
164asn_TYPE_descriptor_t asn_DEF_T = {
165 "T",
166 "T",
167 SEQUENCE_free,
168 SEQUENCE_print,
169 SEQUENCE_constraint,
170 SEQUENCE_decode_ber,
171 SEQUENCE_encode_der,
172 SEQUENCE_decode_xer,
173 SEQUENCE_encode_xer,
174 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000175 asn_DEF_T_1_tags,
176 sizeof(asn_DEF_T_1_tags)
177 /sizeof(asn_DEF_T_1_tags[0]), /* 1 */
178 asn_DEF_T_1_tags, /* Same as above */
179 sizeof(asn_DEF_T_1_tags)
180 /sizeof(asn_DEF_T_1_tags[0]), /* 1 */
181 asn_MBR_T_1,
Lev Walkin64d99e92005-01-30 18:34:07 +0000182 4, /* Elements count */
Lev Walkine0272aa2005-03-04 11:26:08 +0000183 &asn_SPC_T_1_specs /* Additional specs */
Lev Walkin64d99e92005-01-30 18:34:07 +0000184};
185