]> git.sur5r.net Git - openldap/blob - include/ldap_schema.h
a runqueue for periodic thread execution (for syncrepl)
[openldap] / include / ldap_schema.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted only as authorized by the OpenLDAP
8  * Public License.  A copy of this license is available at
9  * http://www.OpenLDAP.org/license.html or in file LICENSE in the
10  * top-level directory of the distribution.
11  */
12 /*
13  * ldap-schema.h - Header for basic schema handling functions that can be
14  *              used by both clients and servers.
15  * these routines should be renamed ldap_x_...
16  */
17
18 #ifndef _LDAP_SCHEMA_H
19 #define _LDAP_SCHEMA_H 1
20
21 #include <ldap_cdefs.h>
22
23 LDAP_BEGIN_DECL
24
25 /* Codes for parsing errors */
26
27 #define LDAP_SCHERR_OUTOFMEM            1
28 #define LDAP_SCHERR_UNEXPTOKEN          2
29 #define LDAP_SCHERR_NOLEFTPAREN         3
30 #define LDAP_SCHERR_NORIGHTPAREN        4
31 #define LDAP_SCHERR_NODIGIT                     5
32 #define LDAP_SCHERR_BADNAME                     6
33 #define LDAP_SCHERR_BADDESC                     7
34 #define LDAP_SCHERR_BADSUP                      8
35 #define LDAP_SCHERR_DUPOPT                      9
36 #define LDAP_SCHERR_EMPTY                       10
37 #define LDAP_SCHERR_MISSING                     11
38 #define LDAP_SCHERR_OUT_OF_ORDER        12
39
40 typedef struct ldap_schema_extension_item {
41         char *lsei_name;
42         char **lsei_values;
43 } LDAPSchemaExtensionItem;
44
45 typedef struct ldap_syntax {
46         char *syn_oid;          /* REQUIRED */
47         char **syn_names;       /* OPTIONAL */
48         char *syn_desc;         /* OPTIONAL */
49         LDAPSchemaExtensionItem **syn_extensions; /* OPTIONAL */
50 } LDAPSyntax;
51
52 typedef struct ldap_matchingrule {
53         char *mr_oid;           /* REQUIRED */
54         char **mr_names;        /* OPTIONAL */
55         char *mr_desc;          /* OPTIONAL */
56         int  mr_obsolete;       /* OPTIONAL */
57         char *mr_syntax_oid;    /* REQUIRED */
58         LDAPSchemaExtensionItem **mr_extensions; /* OPTIONAL */
59 } LDAPMatchingRule;
60
61 typedef struct ldap_matchingruleuse {
62         char *mru_oid;          /* REQUIRED */
63         char **mru_names;       /* OPTIONAL */
64         char *mru_desc;         /* OPTIONAL */
65         int  mru_obsolete;      /* OPTIONAL */
66         char **mru_applies_oids;        /* REQUIRED */
67         LDAPSchemaExtensionItem **mru_extensions; /* OPTIONAL */
68 } LDAPMatchingRuleUse;
69
70 typedef struct ldap_attributetype {
71         char *at_oid;           /* REQUIRED */
72         char **at_names;        /* OPTIONAL */
73         char *at_desc;          /* OPTIONAL */
74         int  at_obsolete;       /* 0=no, 1=yes */
75         char *at_sup_oid;       /* OPTIONAL */
76         char *at_equality_oid;  /* OPTIONAL */
77         char *at_ordering_oid;  /* OPTIONAL */
78         char *at_substr_oid;    /* OPTIONAL */
79         char *at_syntax_oid;    /* OPTIONAL */
80         int  at_syntax_len;     /* OPTIONAL */
81         int  at_single_value;   /* 0=no, 1=yes */
82         int  at_collective;     /* 0=no, 1=yes */
83         int  at_no_user_mod;    /* 0=no, 1=yes */
84         int  at_usage;          /* 0=userApplications, 1=directoryOperation,
85                                    2=distributedOperation, 3=dSAOperation */
86         LDAPSchemaExtensionItem **at_extensions; /* OPTIONAL */
87 } LDAPAttributeType;
88
89 typedef struct ldap_objectclass {
90         char *oc_oid;           /* REQUIRED */
91         char **oc_names;        /* OPTIONAL */
92         char *oc_desc;          /* OPTIONAL */
93         int  oc_obsolete;       /* 0=no, 1=yes */
94         char **oc_sup_oids;     /* OPTIONAL */
95         int  oc_kind;           /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
96         char **oc_at_oids_must; /* OPTIONAL */
97         char **oc_at_oids_may;  /* OPTIONAL */
98         LDAPSchemaExtensionItem **oc_extensions; /* OPTIONAL */
99 } LDAPObjectClass;
100
101 typedef struct ldap_contentrule {
102         char *cr_oid;           /* REQUIRED */
103         char **cr_names;        /* OPTIONAL */
104         char *cr_desc;          /* OPTIONAL */
105         char **cr_sup_oids;     /* OPTIONAL */
106         int  cr_obsolete;       /* 0=no, 1=yes */
107         char **cr_oc_oids_aux;  /* OPTIONAL */
108         char **cr_at_oids_must; /* OPTIONAL */
109         char **cr_at_oids_may;  /* OPTIONAL */
110         char **cr_at_oids_not;  /* OPTIONAL */
111         LDAPSchemaExtensionItem **cr_extensions; /* OPTIONAL */
112 } LDAPContentRule;
113
114 typedef struct ldap_nameform {
115         char *nf_oid;           /* REQUIRED */
116         char **nf_names;        /* OPTIONAL */
117         char *nf_desc;          /* OPTIONAL */
118         int  nf_obsolete;       /* 0=no, 1=yes */
119         char *nf_objectclass;   /* REQUIRED */
120         char **nf_at_oids_must; /* REQUIRED */
121         char **nf_at_oids_may;  /* OPTIONAL */
122         LDAPSchemaExtensionItem **nf_extensions; /* OPTIONAL */
123 } LDAPNameForm;
124
125 typedef struct ldap_structurerule {
126         int sr_ruleid;          /* REQUIRED */
127         char **sr_names;        /* OPTIONAL */
128         char *sr_desc;          /* OPTIONAL */
129         int  sr_obsolete;       /* 0=no, 1=yes */
130         char *sr_nameform;      /* REQUIRED */
131         int sr_nsup_ruleids;/* number of sr_sup_ruleids */
132         int *sr_sup_ruleids;/* OPTIONAL */
133         LDAPSchemaExtensionItem **sr_extensions; /* OPTIONAL */
134 } LDAPStructureRule;
135
136 /*
137  * Misc macros
138  */
139 #define LDAP_SCHEMA_NO                          0
140 #define LDAP_SCHEMA_YES                         1
141
142 #define LDAP_SCHEMA_USER_APPLICATIONS           0
143 #define LDAP_SCHEMA_DIRECTORY_OPERATION         1
144 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION       2
145 #define LDAP_SCHEMA_DSA_OPERATION               3
146
147 #define LDAP_SCHEMA_ABSTRACT                    0
148 #define LDAP_SCHEMA_STRUCTURAL                  1
149 #define LDAP_SCHEMA_AUXILIARY                   2
150
151
152 /*
153  * Flags that control how liberal the parsing routines are.
154  */
155 #define LDAP_SCHEMA_ALLOW_NONE          0x00U /* Strict parsing               */
156 #define LDAP_SCHEMA_ALLOW_NO_OID        0x01U /* Allow missing oid            */
157 #define LDAP_SCHEMA_ALLOW_QUOTED        0x02U /* Allow bogus extra quotes     */
158 #define LDAP_SCHEMA_ALLOW_DESCR         0x04U /* Allow descr instead of OID   */
159 #define LDAP_SCHEMA_ALLOW_DESCR_PREFIX  0x08U /* Allow descr as OID prefix    */
160 #define LDAP_SCHEMA_ALLOW_OID_MACRO     0x10U /* Allow OID macros in slapd    */
161 #define LDAP_SCHEMA_ALLOW_OUT_OF_ORDER_FIELDS 0x20U /* Allow fields in most any order */
162 #define LDAP_SCHEMA_ALLOW_ALL           0x3fU /* Be very liberal in parsing   */
163 #define LDAP_SCHEMA_SKIP                        0x80U /* Don't malloc any result      */
164
165
166 LDAP_F( LDAP_CONST char * )
167 ldap_syntax2name LDAP_P((
168         LDAPSyntax * syn ));
169
170 LDAP_F( LDAP_CONST char * )
171 ldap_matchingrule2name LDAP_P((
172         LDAPMatchingRule * mr ));
173
174 LDAP_F( LDAP_CONST char * )
175 ldap_matchingruleuse2name LDAP_P((
176         LDAPMatchingRuleUse * mru ));
177
178 LDAP_F( LDAP_CONST char * )
179 ldap_attributetype2name LDAP_P((
180         LDAPAttributeType * at ));
181
182 LDAP_F( LDAP_CONST char * )
183 ldap_objectclass2name LDAP_P((
184         LDAPObjectClass * oc ));
185
186 LDAP_F( LDAP_CONST char * )
187 ldap_contentrule2name LDAP_P((
188         LDAPContentRule * cr ));
189
190 LDAP_F( LDAP_CONST char * )
191 ldap_nameform2name LDAP_P((
192         LDAPNameForm * nf ));
193
194 LDAP_F( LDAP_CONST char * )
195 ldap_structurerule2name LDAP_P((
196         LDAPStructureRule * sr ));
197
198 LDAP_F( void )
199 ldap_syntax_free LDAP_P((
200         LDAPSyntax * syn ));
201
202 LDAP_F( void )
203 ldap_matchingrule_free LDAP_P((
204         LDAPMatchingRule * mr ));
205
206 LDAP_F( void )
207 ldap_matchingruleuse_free LDAP_P((
208         LDAPMatchingRuleUse * mr ));
209
210 LDAP_F( void )
211 ldap_attributetype_free LDAP_P((
212         LDAPAttributeType * at ));
213
214 LDAP_F( void )
215 ldap_objectclass_free LDAP_P((
216         LDAPObjectClass * oc ));
217
218 LDAP_F( void )
219 ldap_contentrule_free LDAP_P((
220         LDAPContentRule * cr ));
221
222 LDAP_F( void )
223 ldap_nameform_free LDAP_P((
224         LDAPNameForm * nf ));
225
226 LDAP_F( void )
227 ldap_structurerule_free LDAP_P((
228         LDAPStructureRule * sr ));
229
230 LDAP_F( LDAPStructureRule * )
231 ldap_str2structurerule LDAP_P((
232         LDAP_CONST char * s,
233         int * code,
234         LDAP_CONST char ** errp,
235         LDAP_CONST unsigned flags ));
236
237 LDAP_F( LDAPNameForm * )
238 ldap_str2nameform LDAP_P((
239         LDAP_CONST char * s,
240         int * code,
241         LDAP_CONST char ** errp,
242         LDAP_CONST unsigned flags ));
243
244 LDAP_F( LDAPContentRule * )
245 ldap_str2contentrule LDAP_P((
246         LDAP_CONST char * s,
247         int * code,
248         LDAP_CONST char ** errp,
249         LDAP_CONST unsigned flags ));
250
251 LDAP_F( LDAPObjectClass * )
252 ldap_str2objectclass LDAP_P((
253         LDAP_CONST char * s,
254         int * code,
255         LDAP_CONST char ** errp,
256         LDAP_CONST unsigned flags ));
257
258 LDAP_F( LDAPAttributeType * )
259 ldap_str2attributetype LDAP_P((
260         LDAP_CONST char * s,
261         int * code,
262         LDAP_CONST char ** errp,
263         LDAP_CONST unsigned flags ));
264
265 LDAP_F( LDAPSyntax * )
266 ldap_str2syntax LDAP_P((
267         LDAP_CONST char * s,
268         int * code,
269         LDAP_CONST char ** errp,
270         LDAP_CONST unsigned flags ));
271
272 LDAP_F( LDAPMatchingRule * )
273 ldap_str2matchingrule LDAP_P((
274         LDAP_CONST char * s,
275         int * code,
276         LDAP_CONST char ** errp,
277         LDAP_CONST unsigned flags ));
278
279 LDAP_F( LDAPMatchingRuleUse * )
280 ldap_str2matchingruleuse LDAP_P((
281         LDAP_CONST char * s,
282         int * code,
283         LDAP_CONST char ** errp,
284         LDAP_CONST unsigned flags ));
285
286 LDAP_F( char * )
287 ldap_structurerule2str LDAP_P((
288         LDAPStructureRule * sr ));
289
290 LDAP_F( struct berval * )
291 ldap_structurerule2bv LDAP_P((
292         LDAPStructureRule * sr, struct berval *bv ));
293
294 LDAP_F( char * )
295 ldap_nameform2str LDAP_P((
296         LDAPNameForm * nf ));
297
298 LDAP_F( struct berval * )
299 ldap_nameform2bv LDAP_P((
300         LDAPNameForm * nf, struct berval *bv ));
301
302 LDAP_F( char * )
303 ldap_contentrule2str LDAP_P((
304         LDAPContentRule * cr ));
305
306 LDAP_F( struct berval * )
307 ldap_contentrule2bv LDAP_P((
308         LDAPContentRule * cr, struct berval *bv ));
309
310 LDAP_F( char * )
311 ldap_objectclass2str LDAP_P((
312         LDAPObjectClass * oc ));
313
314 LDAP_F( struct berval * )
315 ldap_objectclass2bv LDAP_P((
316         LDAPObjectClass * oc, struct berval *bv ));
317
318 LDAP_F( char * )
319 ldap_attributetype2str LDAP_P((
320         LDAPAttributeType * at ));
321
322 LDAP_F( struct berval * )
323 ldap_attributetype2bv LDAP_P((
324         LDAPAttributeType * at, struct berval *bv ));
325
326 LDAP_F( char * )
327 ldap_syntax2str LDAP_P((
328         LDAPSyntax * syn ));
329
330 LDAP_F( struct berval * )
331 ldap_syntax2bv LDAP_P((
332         LDAPSyntax * syn, struct berval *bv ));
333
334 LDAP_F( char * )
335 ldap_matchingrule2str LDAP_P((
336         LDAPMatchingRule * mr ));
337
338 LDAP_F( struct berval * )
339 ldap_matchingrule2bv LDAP_P((
340         LDAPMatchingRule * mr, struct berval *bv ));
341
342 LDAP_F( char * )
343 ldap_matchingruleuse2str LDAP_P((
344         LDAPMatchingRuleUse * mru ));
345
346 LDAP_F( struct berval * )
347 ldap_matchingruleuse2bv LDAP_P((
348         LDAPMatchingRuleUse * mru, struct berval *bv ));
349
350 LDAP_F( char * )
351 ldap_scherr2str LDAP_P((
352         int code )) LDAP_GCCATTR((const));
353
354 LDAP_END_DECL
355
356 #endif
357