3 * Copyright 1999-2000 The OpenLDAP Foundation, Redwood City, California, USA
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.
12 * ldap-schema.h - Header for basic schema handling functions that can be
13 * used by both clients and servers.
16 #ifndef _LDAP_SCHEMA_H
17 #define _LDAP_SCHEMA_H 1
19 #include <ldap_cdefs.h>
23 /* Codes for parsing errors */
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
36 typedef struct ldap_schema_extension_item {
39 } LDAP_SCHEMA_EXTENSION_ITEM;
41 typedef struct ldap_syntax {
42 char *syn_oid; /* REQUIRED */
43 char *syn_desc; /* OPTIONAL */
44 LDAP_SCHEMA_EXTENSION_ITEM **syn_extensions; /* OPTIONAL */
47 typedef struct ldap_matchingrule {
48 char *mr_oid; /* REQUIRED */
49 char **mr_names; /* OPTIONAL */
50 char *mr_desc; /* OPTIONAL */
51 int mr_obsolete; /* OPTIONAL */
52 char *mr_syntax_oid; /* REQUIRED */
53 LDAP_SCHEMA_EXTENSION_ITEM **mr_extensions; /* OPTIONAL */
56 typedef struct ldap_attributetype {
57 char *at_oid; /* REQUIRED */
58 char **at_names; /* OPTIONAL */
59 char *at_desc; /* OPTIONAL */
60 int at_obsolete; /* 0=no, 1=yes */
61 char *at_sup_oid; /* OPTIONAL */
62 char *at_equality_oid; /* OPTIONAL */
63 char *at_ordering_oid; /* OPTIONAL */
64 char *at_substr_oid; /* OPTIONAL */
65 char *at_syntax_oid; /* OPTIONAL */
66 int at_syntax_len; /* OPTIONAL */
67 int at_single_value; /* 0=no, 1=yes */
68 int at_collective; /* 0=no, 1=yes */
69 int at_no_user_mod; /* 0=no, 1=yes */
70 int at_usage; /* 0=userApplications, 1=directoryOperation,
71 2=distributedOperation, 3=dSAOperation */
72 LDAP_SCHEMA_EXTENSION_ITEM **at_extensions; /* OPTIONAL */
73 } LDAP_ATTRIBUTE_TYPE;
75 typedef struct ldap_objectclass {
76 char *oc_oid; /* REQUIRED */
77 char **oc_names; /* OPTIONAL */
78 char *oc_desc; /* OPTIONAL */
79 int oc_obsolete; /* 0=no, 1=yes */
80 char **oc_sup_oids; /* OPTIONAL */
81 int oc_kind; /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
82 char **oc_at_oids_must; /* OPTIONAL */
83 char **oc_at_oids_may; /* OPTIONAL */
84 LDAP_SCHEMA_EXTENSION_ITEM **oc_extensions; /* OPTIONAL */
87 #define LDAP_SCHEMA_NO 0
88 #define LDAP_SCHEMA_YES 1
90 #define LDAP_SCHEMA_USER_APPLICATIONS 0
91 #define LDAP_SCHEMA_DIRECTORY_OPERATION 1
92 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION 2
93 #define LDAP_SCHEMA_DSA_OPERATION 3
95 #define LDAP_SCHEMA_ABSTRACT 0
96 #define LDAP_SCHEMA_STRUCTURAL 1
97 #define LDAP_SCHEMA_AUXILIARY 2
99 LIBLDAP_F( LDAP_CONST char * )
100 ldap_syntax2name LDAP_P((
101 LDAP_SYNTAX * syn ));
103 LIBLDAP_F( LDAP_CONST char * )
104 ldap_matchingrule2name LDAP_P((
105 LDAP_MATCHING_RULE * mr ));
107 LIBLDAP_F( LDAP_CONST char * )
108 ldap_attributetype2name LDAP_P((
109 LDAP_ATTRIBUTE_TYPE * at ));
111 LIBLDAP_F( LDAP_CONST char * )
112 ldap_objectclass2name LDAP_P((
113 LDAP_OBJECT_CLASS * oc ));
116 ldap_syntax_free LDAP_P((
117 LDAP_SYNTAX * syn ));
120 ldap_matchingrule_free LDAP_P((
121 LDAP_MATCHING_RULE * mr ));
124 ldap_attributetype_free LDAP_P((
125 LDAP_ATTRIBUTE_TYPE * at ));
128 ldap_objectclass_free LDAP_P((
129 LDAP_OBJECT_CLASS * oc ));
131 LIBLDAP_F( LDAP_OBJECT_CLASS * )
132 ldap_str2objectclass LDAP_P((
135 LDAP_CONST char ** errp ));
137 LIBLDAP_F( LDAP_ATTRIBUTE_TYPE * )
138 ldap_str2attributetype LDAP_P((
141 LDAP_CONST char ** errp ));
143 LIBLDAP_F( LDAP_SYNTAX * )
144 ldap_str2syntax LDAP_P((
147 LDAP_CONST char ** errp ));
149 LIBLDAP_F( LDAP_MATCHING_RULE * )
150 ldap_str2matchingrule LDAP_P((
153 LDAP_CONST char ** errp ));
156 ldap_objectclass2str LDAP_P((
157 LDAP_CONST LDAP_OBJECT_CLASS * oc ));
160 ldap_attributetype2str LDAP_P((
161 LDAP_CONST LDAP_ATTRIBUTE_TYPE * at ));
164 ldap_syntax2str LDAP_P((
165 LDAP_CONST LDAP_SYNTAX * syn ));
168 ldap_matchingrule2str LDAP_P((
169 LDAP_CONST LDAP_MATCHING_RULE * mr ));
172 ldap_scherr2str LDAP_P((
173 int code )) LDAP_GCCATTR((const));