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