s4:torture: Adapt KDC canon test to Heimdal upstream changes
[Samba.git] / source4 / heimdal / lib / asn1 / symbol.h
blobb88386223b30590379e0e0b35905980fa8212b07
1 /*
2 * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 /* $Id$ */
36 #ifndef _SYMBOL_H
37 #define _SYMBOL_H
39 #include <heimqueue.h>
41 enum typetype {
42 TBitString,
43 TBoolean,
44 TChoice,
45 TEnumerated,
46 TGeneralString,
47 TTeletexString,
48 TGeneralizedTime,
49 TIA5String,
50 TInteger,
51 TNull,
52 TOID,
53 TOctetString,
54 TPrintableString,
55 TSequence,
56 TSequenceOf,
57 TSet,
58 TSetOf,
59 TTag,
60 TType,
61 TUTCTime,
62 TUTF8String,
63 TBMPString,
64 TUniversalString,
65 TVisibleString
68 typedef enum typetype Typetype;
70 struct type;
71 struct value;
72 struct typereference;
74 struct value {
75 enum { booleanvalue,
76 nullvalue,
77 integervalue,
78 stringvalue,
79 objectidentifiervalue
80 } type;
81 union {
82 int booleanvalue;
83 int64_t integervalue;
84 char *stringvalue;
85 struct objid *objectidentifiervalue;
86 } u;
87 struct symbol *s;
90 struct member {
91 char *name;
92 char *gen_name;
93 char *label;
94 int val;
95 int optional;
96 int ellipsis;
97 struct type *type;
98 HEIM_TAILQ_ENTRY(member) members;
99 struct value *defval;
102 typedef struct member Member;
104 HEIM_TAILQ_HEAD(memhead, member);
106 struct symbol;
108 struct tagtype {
109 int tagclass;
110 int tagvalue;
111 enum { TE_IMPLICIT, TE_EXPLICIT } tagenv;
114 struct range {
116 * We can't represent unsigned 64-bit ranges because max might be
117 * negative...
119 int64_t min;
120 int64_t max;
123 enum ctype { CT_CONTENTS, CT_USER, CT_TABLE_CONSTRAINT } ;
125 struct constraint_spec;
127 struct iosclassfield {
128 char *name;
129 struct type *type;
130 struct value *defval;
131 HEIM_TAILQ_ENTRY(iosclassfield) fields;
132 unsigned long id;
133 unsigned int optional:1;
134 unsigned int unique:1;
137 typedef struct iosclassfield Field;
138 HEIM_TAILQ_HEAD(fieldhead, iosclassfield);
140 struct iosobjectfield {
141 char *name;
142 struct type *type;
143 struct value *value;
144 HEIM_TAILQ_ENTRY(iosobjectfield) objfields;
145 unsigned long id;
148 typedef struct iosobjectfield ObjectField;
149 HEIM_TAILQ_HEAD(objfieldhead, iosobjectfield);
151 struct iosclass {
152 struct symbol *symbol;
153 struct fieldhead *fields;
154 unsigned long id;
157 typedef struct iosclass IOSClass;
159 struct iosobject {
160 struct symbol *symbol;
161 struct objfieldhead *objfields;
162 ObjectField *typeidf;
163 IOSClass *iosclass;
164 HEIM_TAILQ_ENTRY(iosobject) objects;
165 unsigned long id;
166 unsigned int ellipsis:1;
167 unsigned int optional:1;
170 typedef struct iosobject IOSObject;
171 HEIM_TAILQ_HEAD(objectshead, iosobject);
173 struct iosobjectset {
174 struct symbol *symbol;
175 IOSClass *iosclass;
176 struct objectshead *objects;
177 unsigned long id;
180 typedef struct iosobjectset IOSObjectSet;
182 struct typereference {
184 * For now we don't support link fields, so we don't support chains of more
185 * than one field.
187 IOSClass *iosclass;
188 Field *field;
191 struct type {
192 Typetype type;
193 struct memhead *members;
194 struct symbol *symbol;
195 struct type *subtype;
196 struct typereference typeref; /* For type fields */
197 IOSClass *formal_parameter;
198 IOSObjectSet *actual_parameter;
199 struct tagtype tag;
200 struct range *range;
201 struct constraint_spec *constraint;
202 unsigned long id;
205 typedef struct type Type;
207 struct component_relation_constraint {
208 char *objectname;
209 char *membername;
212 struct constraint_spec {
213 enum ctype ctype;
214 union {
215 struct {
216 Type *type;
217 struct value *encoding;
218 struct component_relation_constraint crel;
219 } content;
220 } u;
223 struct objid {
224 const char *label;
225 int value;
226 struct objid *next;
229 struct symbol {
230 char *name;
231 char *gen_name;
232 enum { SUndefined, SValue, Stype, Sparamtype, Sclass, Sobj, Sobjset } stype;
233 struct value *value;
234 Type *type;
235 IOSClass *iosclass;
236 IOSObject *object;
237 IOSObjectSet *objectset;
238 HEIM_TAILQ_ENTRY(symbol) symlist;
239 unsigned int emitted_declaration:1;
240 unsigned int emitted_definition:1;
241 unsigned int emitted_tag_enums:1;
242 unsigned int emitted_template:1;
245 typedef struct symbol Symbol;
247 //HEIM_TAILQ_HEAD(symhead, symbol);
248 struct symhead {
249 struct symbol *tqh_first;
250 struct symbol **tqh_last;
253 extern struct symhead symbols;
255 void initsym (void);
256 Symbol *addsym (char *);
257 Symbol *getsym(char *name);
258 void output_name (char *);
259 int checkundefined(void);
260 void generate_types(void);
261 void emitted_declaration(const Symbol *);
262 void emitted_definition(const Symbol *);
263 void emitted_tag_enums(const Symbol *);
264 #endif