]> git.sur5r.net Git - openldap/blob - include/ldap_schema.h
Added ldap_X509dn2bv()
[openldap] / include / ldap_schema.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2002 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
38 typedef struct ldap_schema_extension_item {
39         char *lsei_name;
40         char **lsei_values;
41 } LDAPSchemaExtensionItem;
42
43 typedef struct ldap_syntax {
44         char *syn_oid;          /* REQUIRED */
45         char **syn_names;       /* OPTIONAL */
46         char *syn_desc;         /* OPTIONAL */
47         LDAPSchemaExtensionItem **syn_extensions; /* OPTIONAL */
48 } LDAPSyntax;
49
50 typedef struct ldap_matchingrule {
51         char *mr_oid;           /* REQUIRED */
52         char **mr_names;        /* OPTIONAL */
53         char *mr_desc;          /* OPTIONAL */
54         int  mr_obsolete;       /* OPTIONAL */
55         char *mr_syntax_oid;    /* REQUIRED */
56         LDAPSchemaExtensionItem **mr_extensions; /* OPTIONAL */
57 } LDAPMatchingRule;
58
59 typedef struct ldap_matchingruleuse {
60         char *mru_oid;          /* REQUIRED */
61         char **mru_names;       /* OPTIONAL */
62         char *mru_desc;         /* OPTIONAL */
63         int  mru_obsolete;      /* OPTIONAL */
64         char **mru_applies_oids;        /* REQUIRED */
65         LDAPSchemaExtensionItem **mru_extensions; /* OPTIONAL */
66 } LDAPMatchingRuleUse;
67
68 typedef struct ldap_attributetype {
69         char *at_oid;           /* REQUIRED */
70         char **at_names;        /* OPTIONAL */
71         char *at_desc;          /* OPTIONAL */
72         int  at_obsolete;       /* 0=no, 1=yes */
73         char *at_sup_oid;       /* OPTIONAL */
74         char *at_equality_oid;  /* OPTIONAL */
75         char *at_ordering_oid;  /* OPTIONAL */
76         char *at_substr_oid;    /* OPTIONAL */
77         char *at_syntax_oid;    /* OPTIONAL */
78         int  at_syntax_len;     /* OPTIONAL */
79         int  at_single_value;   /* 0=no, 1=yes */
80         int  at_collective;     /* 0=no, 1=yes */
81         int  at_no_user_mod;    /* 0=no, 1=yes */
82         int  at_usage;          /* 0=userApplications, 1=directoryOperation,
83                                    2=distributedOperation, 3=dSAOperation */
84         LDAPSchemaExtensionItem **at_extensions; /* OPTIONAL */
85 } LDAPAttributeType;
86
87 typedef struct ldap_objectclass {
88         char *oc_oid;           /* REQUIRED */
89         char **oc_names;        /* OPTIONAL */
90         char *oc_desc;          /* OPTIONAL */
91         int  oc_obsolete;       /* 0=no, 1=yes */
92         char **oc_sup_oids;     /* OPTIONAL */
93         int  oc_kind;           /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
94         char **oc_at_oids_must; /* OPTIONAL */
95         char **oc_at_oids_may;  /* OPTIONAL */
96         LDAPSchemaExtensionItem **oc_extensions; /* OPTIONAL */
97 } LDAPObjectClass;
98
99 #define LDAP_SCHEMA_NO                          0
100 #define LDAP_SCHEMA_YES                         1
101
102 #define LDAP_SCHEMA_USER_APPLICATIONS           0
103 #define LDAP_SCHEMA_DIRECTORY_OPERATION         1
104 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION       2
105 #define LDAP_SCHEMA_DSA_OPERATION               3
106
107 #define LDAP_SCHEMA_ABSTRACT                    0
108 #define LDAP_SCHEMA_STRUCTURAL                  1
109 #define LDAP_SCHEMA_AUXILIARY                   2
110
111 /*
112  * Flags that control how liberal the parsing routines are.
113  */
114 #define LDAP_SCHEMA_ALLOW_NONE          0x00 /* Strict parsing               */
115 #define LDAP_SCHEMA_ALLOW_NO_OID        0x01 /* Allow missing oid            */
116 #define LDAP_SCHEMA_ALLOW_QUOTED        0x02 /* Allow bogus extra quotes     */
117 #define LDAP_SCHEMA_ALLOW_DESCR         0x04 /* Allow descr instead of OID   */
118 #define LDAP_SCHEMA_ALLOW_DESCR_PREFIX  0x08 /* Allow descr as OID prefix    */
119 #define LDAP_SCHEMA_ALLOW_OID_MACRO     0x10 /* Allow OID macros in slapd    */
120 #define LDAP_SCHEMA_ALLOW_ALL           0x1f /* Be very liberal in parsing   */
121 #define LDAP_SCHEMA_SKIP                0x80 /* Don't malloc any result      */
122
123 LDAP_F( LDAP_CONST char * )
124 ldap_syntax2name LDAP_P((
125         LDAPSyntax * syn ));
126
127 LDAP_F( LDAP_CONST char * )
128 ldap_matchingrule2name LDAP_P((
129         LDAPMatchingRule * mr ));
130
131 LDAP_F( LDAP_CONST char * )
132 ldap_matchingruleuse2name LDAP_P((
133         LDAPMatchingRuleUse * mru ));
134
135 LDAP_F( LDAP_CONST char * )
136 ldap_attributetype2name LDAP_P((
137         LDAPAttributeType * at ));
138
139 LDAP_F( LDAP_CONST char * )
140 ldap_objectclass2name LDAP_P((
141         LDAPObjectClass * oc ));
142
143 LDAP_F( void )
144 ldap_syntax_free LDAP_P((
145         LDAPSyntax * syn ));
146
147 LDAP_F( void )
148 ldap_matchingrule_free LDAP_P((
149         LDAPMatchingRule * mr ));
150
151 LDAP_F( void )
152 ldap_matchingruleuse_free LDAP_P((
153         LDAPMatchingRuleUse * mr ));
154
155 LDAP_F( void )
156 ldap_attributetype_free LDAP_P((
157         LDAPAttributeType * at ));
158
159 LDAP_F( void )
160 ldap_objectclass_free LDAP_P((
161         LDAPObjectClass * oc ));
162
163 LDAP_F( LDAPObjectClass * )
164 ldap_str2objectclass LDAP_P((
165         LDAP_CONST char * s,
166         int * code,
167         LDAP_CONST char ** errp,
168         LDAP_CONST int flags ));
169
170 LDAP_F( LDAPAttributeType * )
171 ldap_str2attributetype LDAP_P((
172         LDAP_CONST char * s,
173         int * code,
174         LDAP_CONST char ** errp,
175         LDAP_CONST int flags ));
176
177 LDAP_F( LDAPSyntax * )
178 ldap_str2syntax LDAP_P((
179         LDAP_CONST char * s,
180         int * code,
181         LDAP_CONST char ** errp,
182         LDAP_CONST int flags ));
183
184 LDAP_F( LDAPMatchingRule * )
185 ldap_str2matchingrule LDAP_P((
186         LDAP_CONST char * s,
187         int * code,
188         LDAP_CONST char ** errp,
189         LDAP_CONST int flags ));
190
191 LDAP_F( LDAPMatchingRuleUse * )
192 ldap_str2matchingruleuse LDAP_P((
193         LDAP_CONST char * s,
194         int * code,
195         LDAP_CONST char ** errp,
196         LDAP_CONST int flags ));
197
198 LDAP_F( char * )
199 ldap_objectclass2str LDAP_P((
200         LDAPObjectClass * oc ));
201
202 LDAP_F( struct berval * )
203 ldap_objectclass2bv LDAP_P((
204         LDAPObjectClass * oc, struct berval *bv ));
205
206 LDAP_F( char * )
207 ldap_attributetype2str LDAP_P((
208         LDAPAttributeType * at ));
209
210 LDAP_F( struct berval * )
211 ldap_attributetype2bv LDAP_P((
212         LDAPAttributeType * at, struct berval *bv ));
213
214 LDAP_F( char * )
215 ldap_syntax2str LDAP_P((
216         LDAPSyntax * syn ));
217
218 LDAP_F( struct berval * )
219 ldap_syntax2bv LDAP_P((
220         LDAPSyntax * syn, struct berval *bv ));
221
222 LDAP_F( char * )
223 ldap_matchingrule2str LDAP_P((
224         LDAPMatchingRule * mr ));
225
226 LDAP_F( struct berval * )
227 ldap_matchingrule2bv LDAP_P((
228         LDAPMatchingRule * mr, struct berval *bv ));
229
230 LDAP_F( char * )
231 ldap_matchingruleuse2str LDAP_P((
232         LDAPMatchingRuleUse * mru ));
233
234 LDAP_F( struct berval * )
235 ldap_matchingruleuse2bv LDAP_P((
236         LDAPMatchingRuleUse * mru, struct berval *bv ));
237
238 LDAP_F( char * )
239 ldap_scherr2str LDAP_P((
240         int code )) LDAP_GCCATTR((const));
241
242 LDAP_END_DECL
243
244 #endif
245