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