]> git.sur5r.net Git - openldap/blob - include/ldap_schema.h
Clarify LinuxThreads USR1/USR2 issue
[openldap] / include / ldap_schema.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1999-2000 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11 /*
12  * ldap-schema.h - Header for basic schema handling functions that can be
13  *              used by both clients and servers.
14  */
15
16 #ifndef _LDAP_SCHEMA_H
17 #define _LDAP_SCHEMA_H 1
18
19 #include <ldap_cdefs.h>
20
21 LDAP_BEGIN_DECL
22
23 /* Codes for parsing errors */
24
25 #define LDAP_SCHERR_OUTOFMEM            1
26 #define LDAP_SCHERR_UNEXPTOKEN          2
27 #define LDAP_SCHERR_NOLEFTPAREN         3
28 #define LDAP_SCHERR_NORIGHTPAREN        4
29 #define LDAP_SCHERR_NODIGIT             5
30 #define LDAP_SCHERR_BADNAME             6
31 #define LDAP_SCHERR_BADDESC             7
32 #define LDAP_SCHERR_BADSUP              8
33 #define LDAP_SCHERR_DUPOPT              9
34 #define LDAP_SCHERR_EMPTY               10
35
36 typedef struct ldap_schema_extension_item {
37         char *lsei_name;
38         char **lsei_values;
39 } LDAP_SCHEMA_EXTENSION_ITEM;
40
41 typedef struct ldap_syntax {
42         char *syn_oid;          /* REQUIRED */
43         char **syn_names;       /* OPTIONAL */
44         char *syn_desc;         /* OPTIONAL */
45         LDAP_SCHEMA_EXTENSION_ITEM **syn_extensions; /* OPTIONAL */
46 } LDAP_SYNTAX;
47
48 typedef struct ldap_matchingrule {
49         char *mr_oid;           /* REQUIRED */
50         char **mr_names;        /* OPTIONAL */
51         char *mr_desc;          /* OPTIONAL */
52         int  mr_obsolete;       /* OPTIONAL */
53         char *mr_syntax_oid;    /* REQUIRED */
54         LDAP_SCHEMA_EXTENSION_ITEM **mr_extensions; /* OPTIONAL */
55 } LDAP_MATCHING_RULE;
56
57 typedef struct ldap_attributetype {
58         char *at_oid;           /* REQUIRED */
59         char **at_names;        /* OPTIONAL */
60         char *at_desc;          /* OPTIONAL */
61         int  at_obsolete;       /* 0=no, 1=yes */
62         char *at_sup_oid;       /* OPTIONAL */
63         char *at_equality_oid;  /* OPTIONAL */
64         char *at_ordering_oid;  /* OPTIONAL */
65         char *at_substr_oid;    /* OPTIONAL */
66         char *at_syntax_oid;    /* OPTIONAL */
67         int  at_syntax_len;     /* OPTIONAL */
68         int  at_single_value;   /* 0=no, 1=yes */
69         int  at_collective;     /* 0=no, 1=yes */
70         int  at_no_user_mod;    /* 0=no, 1=yes */
71         int  at_usage;          /* 0=userApplications, 1=directoryOperation,
72                                    2=distributedOperation, 3=dSAOperation */
73         LDAP_SCHEMA_EXTENSION_ITEM **at_extensions; /* OPTIONAL */
74 } LDAP_ATTRIBUTE_TYPE;
75
76 typedef struct ldap_objectclass {
77         char *oc_oid;           /* REQUIRED */
78         char **oc_names;        /* OPTIONAL */
79         char *oc_desc;          /* OPTIONAL */
80         int  oc_obsolete;       /* 0=no, 1=yes */
81         char **oc_sup_oids;     /* OPTIONAL */
82         int  oc_kind;           /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
83         char **oc_at_oids_must; /* OPTIONAL */
84         char **oc_at_oids_may;  /* OPTIONAL */
85         LDAP_SCHEMA_EXTENSION_ITEM **oc_extensions; /* OPTIONAL */
86 } LDAP_OBJECT_CLASS;
87
88 #define LDAP_SCHEMA_NO                          0
89 #define LDAP_SCHEMA_YES                         1
90
91 #define LDAP_SCHEMA_USER_APPLICATIONS           0
92 #define LDAP_SCHEMA_DIRECTORY_OPERATION         1
93 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION       2
94 #define LDAP_SCHEMA_DSA_OPERATION               3
95
96 #define LDAP_SCHEMA_ABSTRACT                    0
97 #define LDAP_SCHEMA_STRUCTURAL                  1
98 #define LDAP_SCHEMA_AUXILIARY                   2
99
100 /*
101  * Flags that control how liberal the parsing routines are.
102  */
103 #define LDAP_SCHEMA_ALLOW_NONE          0x00 /* Strict parsing               */
104 #define LDAP_SCHEMA_ALLOW_NO_OID        0x01 /* Allow missing oid            */
105 #define LDAP_SCHEMA_ALLOW_QUOTED        0x02 /* Allow bogus extra quotes     */
106 #define LDAP_SCHEMA_ALLOW_DESCR         0x04 /* Allow descr instead of OID   */
107 #define LDAP_SCHEMA_ALLOW_DESCR_PREFIX  0x08 /* Allow descr as OID prefix    */
108 #define LDAP_SCHEMA_ALLOW_ALL           0x0f /* Be very liberal in parsing   */
109
110 LDAP_F( LDAP_CONST char * )
111 ldap_syntax2name LDAP_P((
112         LDAP_SYNTAX * syn ));
113
114 LDAP_F( LDAP_CONST char * )
115 ldap_matchingrule2name LDAP_P((
116         LDAP_MATCHING_RULE * mr ));
117
118 LDAP_F( LDAP_CONST char * )
119 ldap_attributetype2name LDAP_P((
120         LDAP_ATTRIBUTE_TYPE * at ));
121
122 LDAP_F( LDAP_CONST char * )
123 ldap_objectclass2name LDAP_P((
124         LDAP_OBJECT_CLASS * oc ));
125
126 LDAP_F( void )
127 ldap_syntax_free LDAP_P((
128         LDAP_SYNTAX * syn ));
129
130 LDAP_F( void )
131 ldap_matchingrule_free LDAP_P((
132         LDAP_MATCHING_RULE * mr ));
133
134 LDAP_F( void )
135 ldap_attributetype_free LDAP_P((
136         LDAP_ATTRIBUTE_TYPE * at ));
137
138 LDAP_F( void )
139 ldap_objectclass_free LDAP_P((
140         LDAP_OBJECT_CLASS * oc ));
141
142 LDAP_F( LDAP_OBJECT_CLASS * )
143 ldap_str2objectclass LDAP_P((
144         LDAP_CONST char * s,
145         int * code,
146         LDAP_CONST char ** errp,
147         LDAP_CONST int flags ));
148
149 LDAP_F( LDAP_ATTRIBUTE_TYPE * )
150 ldap_str2attributetype LDAP_P((
151         LDAP_CONST char * s,
152         int * code,
153         LDAP_CONST char ** errp,
154         LDAP_CONST int flags ));
155
156 LDAP_F( LDAP_SYNTAX * )
157 ldap_str2syntax LDAP_P((
158         LDAP_CONST char * s,
159         int * code,
160         LDAP_CONST char ** errp,
161         LDAP_CONST int flags ));
162
163 LDAP_F( LDAP_MATCHING_RULE * )
164 ldap_str2matchingrule LDAP_P((
165         LDAP_CONST char * s,
166         int * code,
167         LDAP_CONST char ** errp,
168         LDAP_CONST int flags ));
169
170 LDAP_F( char *)
171 ldap_objectclass2str LDAP_P((
172         LDAP_CONST LDAP_OBJECT_CLASS * oc ));
173
174 LDAP_F( char *)
175 ldap_attributetype2str LDAP_P((
176         LDAP_CONST LDAP_ATTRIBUTE_TYPE * at ));
177
178 LDAP_F( char *)
179 ldap_syntax2str LDAP_P((
180         LDAP_CONST LDAP_SYNTAX * syn ));
181
182 LDAP_F( char *)
183 ldap_matchingrule2str LDAP_P((
184         LDAP_CONST LDAP_MATCHING_RULE * mr ));
185
186 LDAP_F( char *)
187 ldap_scherr2str LDAP_P((
188         int code )) LDAP_GCCATTR((const));
189
190 LDAP_END_DECL
191
192 #endif
193