1 .TH LDAP_SCHEMA 3 "RELEASEDATE" "OpenLDAP LDVERSION"
3 .\" Copyright 2000-2002 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap_str2syntax, ldap_syntax2str, ldap_syntax2name, ldap_syntax_free,
7 ldap_str2matchingrule, ldap_matchingrule2str, ldap_matchingrule2name,
8 ldap_matchingrule_free,
9 ldap_str2attributetype, ldap_attributetype2str,
10 ldap_attributetype2name, ldap_attributetype_free,
11 ldap_str2objectclass, ldap_objectclass2str, ldap_objectclass2name,
12 ldap_objectclass_free,
13 ldap_scherr2str \- Schema definition handling routines
18 #include <ldap_schema.h>
21 LDAPSyntax * ldap_str2syntax(s, code, errp, flags)
29 char * ldap_syntax2str(syn)
31 const LDAPSyntax * syn;
34 const char * ldap_syntax2name(syn)
44 LDAPMatchingRule * ldap_str2matchingrule(s, code, errp, flags)
52 char * ldap_matchingrule2str(mr);
54 const LDAPMatchingRule * mr;
57 const char * ldap_matchingrule2name(mr)
59 LDAPMatchingRule * mr;
62 ldap_matchingrule_free(mr)
64 LDAPMatchingRule * mr;
67 LDAPAttributeType * ldap_str2attributetype(s, code, errp, flags)
75 char * ldap_attributetype2str(at)
77 const LDAPAttributeType * at;
80 const char * ldap_attributetype2name(at)
82 LDAPAttributeType * at;
85 ldap_attributetype_free(at)
87 LDAPAttributeType * at;
90 LDAPObjectClass * ldap_str2objectclass(s, code, errp, flags)
98 char * ldap_objectclass2str(oc)
100 const LDAPObjectClass * oc;
103 const char * ldap_objectclass2name(oc)
105 LDAPObjectClass * oc;
108 ldap_objectclass_free(oc)
110 LDAPObjectClass * oc;
113 char * ldap_scherr2str(code)
117 These routines are used to parse schema definitions in the syntax
118 defined in RFC 2252 into structs and handle these structs. These
119 routines handle four kinds of definitions: syntaxes, matching rules,
120 attribute types and objectclasses. For each definition kind, four
121 routines are provided.
124 takes a definition in RFC 2252 format in argument
126 as a NUL-terminated string and returns, if possible, a pointer to a
127 newly allocated struct of the appropriate kind. The caller is
128 responsible for freeing the struct by calling
130 when not needed any longer. The routine returns NULL if some problem
131 happened. In this case, the integer pointed at by argument
133 will receive an error code (see below the description of
135 for an explanation of the values) and a pointer to a NUL-terminated
136 string will be placed where requested by argument
138 , indicating where in argument
140 the error happened, so it must not be freed by the caller. Argument
142 is a bit mask of parsing options controlling the relaxation of the
143 syntax recognized. The following values are defined:
145 .B LDAP_SCHEMA_ALLOW_NONE
146 strict parsing according to RFC 2252.
148 .B LDAP_SCHEMA_ALLOW_NO_OID
149 permit definitions that do not contain an initial OID.
151 .B LDAP_SCHEMA_ALLOW_QUOTED
152 permit quotes around some items that should not have them.
154 .B LDAP_SCHEMA_ALLOW_DESCR
157 instead of a numeric OID in places where the syntax expect the latter.
159 .B LDAP_SCHEMA_ALLOW_DESCR_PREFIX
160 permit that the initial numeric OID contains a prefix in
164 .B LDAP_SCHEMA_ALLOW_ALL
165 be very liberal, include all options.
167 The structures returned are as follows:
173 typedef struct ldap_schema_extension_item {
174 char *lsei_name; /* Extension name */
175 char **lsei_values; /* Extension values */
176 } LDAPSchemaExtensionItem;
178 typedef struct ldap_syntax {
179 char *syn_oid; /* OID */
180 char **syn_names; /* Names */
181 char *syn_desc; /* Description */
182 LDAPSchemaExtensionItem **syn_extensions; /* Extension */
185 typedef struct ldap_matchingrule {
186 char *mr_oid; /* OID */
187 char **mr_names; /* Names */
188 char *mr_desc; /* Description */
189 int mr_obsolete; /* Is obsolete? */
190 char *mr_syntax_oid; /* Syntax of asserted values */
191 LDAPSchemaExtensionItem **mr_extensions; /* Extensions */
194 typedef struct ldap_attributetype {
195 char *at_oid; /* OID */
196 char **at_names; /* Names */
197 char *at_desc; /* Description */
198 int at_obsolete; /* Is obsolete? */
199 char *at_sup_oid; /* OID of superior type */
200 char *at_equality_oid; /* OID of equality matching rule */
201 char *at_ordering_oid; /* OID of ordering matching rule */
202 char *at_substr_oid; /* OID of substrings matching rule */
203 char *at_syntax_oid; /* OID of syntax of values */
204 int at_syntax_len; /* Suggested minimum maximum length */
205 int at_single_value; /* Is single-valued? */
206 int at_collective; /* Is collective? */
207 int at_no_user_mod; /* Are changes forbidden through LDAP? */
208 int at_usage; /* Usage, see below */
209 LDAPSchemaExtensionItem **at_extensions; /* Extensions */
212 typedef struct ldap_objectclass {
213 char *oc_oid; /* OID */
214 char **oc_names; /* Names */
215 char *oc_desc; /* Description */
216 int oc_obsolete; /* Is obsolete? */
217 char **oc_sup_oids; /* OIDs of superior classes */
218 int oc_kind; /* Kind, see below */
219 char **oc_at_oids_must; /* OIDs of required attribute types */
220 char **oc_at_oids_may; /* OIDs of optional attribute types */
221 LDAPSchemaExtensionItem **oc_extensions; /* Extensions */
227 Some integer fields (those described with a question mark) have a
228 truth value, for these fields the possible values are:
231 The answer to the question is no.
234 The answer to the question is yes.
236 For attribute types, the following usages are possible:
238 .B LDAP_SCHEMA_USER_APPLICATIONS
239 the attribute type is non-operational.
241 .B LDAP_SCHEMA_DIRECTORY_OPERATION
242 the attribute type is operational and is pertinent to the directory
243 itself, i.e. it has the same value on all servers that master the
244 entry containing this attribute type.
246 .B LDAP_SCHEMA_DISTRIBUTED_OPERATION
247 the attribute type is operational and is pertinent to replication,
248 shadowing or other distributed directory aspect. TBC.
250 .B LDAP_SCHEMA_DSA_OPERATION
251 the attribute type is operational and is pertinent to the directory
252 server itself, i.e. it may have different values for the same entry
253 when retrieved from different servers that master the entry.
255 Object classes can be of three kinds:
257 .B LDAP_SCHEMA_ABSTRACT
258 the object class is abstract, i.e. there cannot be entries of this
261 .B LDAP_SCHEMA_STRUCTURAL
262 the object class is structural, i.e. it describes the main role of the
263 entry. On some servers, once the entry is created the set of
264 structural object classes assigned cannot be changed: none of those
265 present can be removed and none other can be added.
267 .B LDAP_SCHEMA_AUXILIARY
268 the object class is auxiliary, i.e. it is intended to go with other,
269 structural, object classes. These can be added or removed at any time
270 if attribute types are added or removed at the same time as needed by
271 the set of object classes resulting from the operation.
275 return a canonical name for the definition.
279 return a string representation in the format described by RFC 2252 of
280 the struct passed in the argument. The string is a newly allocated
281 string that must be freed by the caller. These routines may return
282 NULL if no memory can be allocated for the string.
285 returns a NUL-terminated string with a text description of the error
286 found. This is a pointer to a static area, so it must not be freed by
287 the caller. The argument
289 comes from one of the parsing routines and can adopt the following
292 .B LDAP_SCHERR_OUTOFMEM
295 .B LDAP_SCHERR_UNEXPTOKEN
298 .B LDAP_SCHERR_NOLEFTPAREN
299 Missing opening parenthesis.
301 .B LDAP_SCHERR_NORIGHTPAREN
302 Missing closing parenthesis.
304 .B LDAP_SCHERR_NODIGIT
307 .B LDAP_SCHERR_BADNAME
310 .B LDAP_SCHERR_BADDESC
313 .B LDAP_SCHERR_BADSUP
316 .B LDAP_SCHERR_DUPOPT
320 Unexpected end of data.
326 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
328 is derived from University of Michigan LDAP 3.3 Release.