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