NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / tests / tests-asn1c-compiler / 98-attribute-class-OK.asn1.-P
1
2 /*** <<< INCLUDES [Attribute] >>> ***/
3
4 #include <RELATIVE-OID.h>
5 #include <IA5String.h>
6 #include <asn_ioc.h>
7 #include <constr_SEQUENCE.h>
8
9 /*** <<< TYPE-DECLS [Attribute] >>> ***/
10
11 typedef struct Attribute {
12         RELATIVE_OID_t   identifier;
13         IA5String_t      siAttributeValue;
14         
15         /* Context for parsing across buffer boundaries */
16         asn_struct_ctx_t _asn_ctx;
17 } Attribute_t;
18
19 /*** <<< FUNC-DECLS [Attribute] >>> ***/
20
21 extern asn_TYPE_descriptor_t asn_DEF_Attribute;
22
23 /*** <<< IOC-TABLES [Attribute] >>> ***/
24
25 static const RELATIVE_OID_t asn_VAL_1_raf = { "not supported", 0 };
26 static const RELATIVE_OID_t asn_VAL_2_rcf = { "not supported", 0 };
27 static const asn_ioc_cell_t asn_IOS_Attributes_1_rows[] = {
28         { "&id", aioc__value, &asn_DEF_RELATIVE_OID, &asn_VAL_1_raf },
29         { "&id", aioc__value, &asn_DEF_RELATIVE_OID, &asn_VAL_2_rcf }
30 };
31 static const asn_ioc_set_t asn_IOS_Attributes_1[] = {
32         { 2, 1, asn_IOS_Attributes_1_rows }
33 };
34
35 /*** <<< CODE [Attribute] >>> ***/
36
37 static int
38 memb_identifier_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
39                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
40         
41         if(!sptr) {
42                 ASN__CTFAIL(app_key, td, sptr,
43                         "%s: value not given (%s:%d)",
44                         td->name, __FILE__, __LINE__);
45                 return -1;
46         }
47         
48         
49         if(1 /* No applicable constraints whatsoever */) {
50                 /* Nothing is here. See below */
51         }
52         
53         return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
54 }
55
56
57 /*** <<< STAT-DEFS [Attribute] >>> ***/
58
59 static asn_TYPE_member_t asn_MBR_Attribute_1[] = {
60         { ATF_NOFLAGS, 0, offsetof(struct Attribute, identifier),
61                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)),
62                 .tag_mode = 0,
63                 .type = &asn_DEF_RELATIVE_OID,
64                 .type_selector = 0,
65                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints =  memb_identifier_constraint_1 },
66                 0, 0, /* No default value */
67                 .name = "identifier"
68                 },
69         { ATF_NOFLAGS, 0, offsetof(struct Attribute, siAttributeValue),
70                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)),
71                 .tag_mode = 0,
72                 .type = &asn_DEF_IA5String,
73                 .type_selector = 0,
74                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
75                 0, 0, /* No default value */
76                 .name = "siAttributeValue"
77                 },
78 };
79 static const ber_tlv_tag_t asn_DEF_Attribute_tags_1[] = {
80         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
81 };
82 static const asn_TYPE_tag2member_t asn_MAP_Attribute_tag2el_1[] = {
83     { (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), 0, 0, 0 }, /* identifier */
84     { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 1, 0, 0 } /* siAttributeValue */
85 };
86 static asn_SEQUENCE_specifics_t asn_SPC_Attribute_specs_1 = {
87         sizeof(struct Attribute),
88         offsetof(struct Attribute, _asn_ctx),
89         .tag2el = asn_MAP_Attribute_tag2el_1,
90         .tag2el_count = 2,      /* Count of tags in the map */
91         0, 0, 0,        /* Optional elements (not needed) */
92         -1,     /* First extension addition */
93 };
94 asn_TYPE_descriptor_t asn_DEF_Attribute = {
95         "Attribute",
96         "Attribute",
97         &asn_OP_SEQUENCE,
98         asn_DEF_Attribute_tags_1,
99         sizeof(asn_DEF_Attribute_tags_1)
100                 /sizeof(asn_DEF_Attribute_tags_1[0]), /* 1 */
101         asn_DEF_Attribute_tags_1,       /* Same as above */
102         sizeof(asn_DEF_Attribute_tags_1)
103                 /sizeof(asn_DEF_Attribute_tags_1[0]), /* 1 */
104         { 0, 0, SEQUENCE_constraint },
105         asn_MBR_Attribute_1,
106         2,      /* Elements count */
107         &asn_SPC_Attribute_specs_1      /* Additional specs */
108 };
109