blob: 9f222eb4600e00d4ab380e3a3312a6e8c429e9ff [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 Walkine0272aa2005-03-04 11:26:08 +000078static ber_tlv_tag_t asn_DEF_class_2_tags[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +000079 (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
80};
Lev Walkine0272aa2005-03-04 11:26:08 +000081static asn_TYPE_tag2member_t asn_MAP_class_2_tag2el[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +000082};
Lev Walkine0272aa2005-03-04 11:26:08 +000083static uint8_t asn_MAP_class_2_mmap[(0 + (8 * sizeof(unsigned int)) - 1) / 8] = {
Lev Walkin64d99e92005-01-30 18:34:07 +000084 0
85};
Lev Walkine0272aa2005-03-04 11:26:08 +000086static asn_SET_specifics_t asn_SPC_class_2_specs = {
Lev Walkin64d99e92005-01-30 18:34:07 +000087 sizeof(struct Class),
88 offsetof(struct Class, _asn_ctx),
89 offsetof(struct Class, _presence_map),
Lev Walkine0272aa2005-03-04 11:26:08 +000090 asn_MAP_class_2_tag2el,
Lev Walkin64d99e92005-01-30 18:34:07 +000091 0, /* Count of tags in the map */
Lev Walkine0272aa2005-03-04 11:26:08 +000092 asn_MAP_class_2_tag2el, /* Same as above */
Lev Walkinf82138b2005-02-25 08:20:32 +000093 0, /* Count of tags in the CXER map */
Lev Walkin64d99e92005-01-30 18:34:07 +000094 1, /* Whether extensible */
Lev Walkine0272aa2005-03-04 11:26:08 +000095 (unsigned int *)asn_MAP_class_2_mmap /* Mandatory elements map */
Lev Walkin64d99e92005-01-30 18:34:07 +000096};
97static /* Use -fall-defs-global to expose */
Lev Walkine0272aa2005-03-04 11:26:08 +000098asn_TYPE_descriptor_t asn_DEF_class_2 = {
Lev Walkin64d99e92005-01-30 18:34:07 +000099 "class",
100 "class",
101 SET_free,
102 SET_print,
103 SET_constraint,
104 SET_decode_ber,
105 SET_encode_der,
Lev Walkinb2230802005-02-14 20:31:31 +0000106 SET_decode_xer,
Lev Walkin64d99e92005-01-30 18:34:07 +0000107 SET_encode_xer,
108 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000109 asn_DEF_class_2_tags,
110 sizeof(asn_DEF_class_2_tags)
111 /sizeof(asn_DEF_class_2_tags[0]), /* 1 */
112 asn_DEF_class_2_tags, /* Same as above */
113 sizeof(asn_DEF_class_2_tags)
114 /sizeof(asn_DEF_class_2_tags[0]), /* 1 */
Lev Walkin64d99e92005-01-30 18:34:07 +0000115 0, 0, /* No members */
Lev Walkine0272aa2005-03-04 11:26:08 +0000116 &asn_SPC_class_2_specs /* Additional specs */
Lev Walkin64d99e92005-01-30 18:34:07 +0000117};
118
Lev Walkine0272aa2005-03-04 11:26:08 +0000119static asn_TYPE_member_t asn_MBR_T_1[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000120 { ATF_NOFLAGS, 0, offsetof(struct T, Int),
121 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
122 .tag_mode = 0,
123 .type = (void *)&asn_DEF_INTEGER,
124 .memb_constraints = 0, /* Defer constraints checking to the member type */
125 .name = "int"
126 },
127 { ATF_NOFLAGS, 0, offsetof(struct T, Char),
128 .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
129 .tag_mode = 0,
130 .type = (void *)&asn_DEF_OCTET_STRING,
131 .memb_constraints = memb_char_1_constraint,
132 .name = "char"
133 },
134 { ATF_NOFLAGS, 0, offsetof(struct T, Class),
135 .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
136 .tag_mode = 0,
Lev Walkine0272aa2005-03-04 11:26:08 +0000137 .type = (void *)&asn_DEF_class_2,
Lev Walkin64d99e92005-01-30 18:34:07 +0000138 .memb_constraints = 0, /* Defer constraints checking to the member type */
139 .name = "class"
140 },
141 { ATF_NOFLAGS, 0, offsetof(struct T, Double),
142 .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)),
143 .tag_mode = 0,
144 .type = (void *)&asn_DEF_REAL,
145 .memb_constraints = 0, /* Defer constraints checking to the member type */
146 .name = "double"
147 },
148};
Lev Walkine0272aa2005-03-04 11:26:08 +0000149static ber_tlv_tag_t asn_DEF_T_1_tags[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000150 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
151};
Lev Walkine0272aa2005-03-04 11:26:08 +0000152static asn_TYPE_tag2member_t asn_MAP_T_1_tag2el[] = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000153 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* int at 15 */
154 { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* char at 16 */
155 { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 3, 0, 0 }, /* double at 18 */
Lev Walkinf82138b2005-02-25 08:20:32 +0000156 { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 } /* class at 17 */
Lev Walkin64d99e92005-01-30 18:34:07 +0000157};
Lev Walkine0272aa2005-03-04 11:26:08 +0000158static asn_SEQUENCE_specifics_t asn_SPC_T_1_specs = {
Lev Walkin64d99e92005-01-30 18:34:07 +0000159 sizeof(struct T),
160 offsetof(struct T, _asn_ctx),
Lev Walkine0272aa2005-03-04 11:26:08 +0000161 asn_MAP_T_1_tag2el,
Lev Walkin64d99e92005-01-30 18:34:07 +0000162 4, /* Count of tags in the map */
163 -1, /* Start extensions */
164 -1 /* Stop extensions */
165};
166asn_TYPE_descriptor_t asn_DEF_T = {
167 "T",
168 "T",
169 SEQUENCE_free,
170 SEQUENCE_print,
171 SEQUENCE_constraint,
172 SEQUENCE_decode_ber,
173 SEQUENCE_encode_der,
174 SEQUENCE_decode_xer,
175 SEQUENCE_encode_xer,
176 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000177 asn_DEF_T_1_tags,
178 sizeof(asn_DEF_T_1_tags)
179 /sizeof(asn_DEF_T_1_tags[0]), /* 1 */
180 asn_DEF_T_1_tags, /* Same as above */
181 sizeof(asn_DEF_T_1_tags)
182 /sizeof(asn_DEF_T_1_tags[0]), /* 1 */
183 asn_MBR_T_1,
Lev Walkin64d99e92005-01-30 18:34:07 +0000184 4, /* Elements count */
Lev Walkine0272aa2005-03-04 11:26:08 +0000185 &asn_SPC_T_1_specs /* Additional specs */
Lev Walkin64d99e92005-01-30 18:34:07 +0000186};
187