]> git.sur5r.net Git - openldap/blob - include/ldap_schema.h
Statement concerning appropriate use of I-D.
[openldap] / include / ldap_schema.h
1 /*
2  * Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted only
6  * as authorized by the OpenLDAP Public License.  A copy of this
7  * license is available at http://www.OpenLDAP.org/license.html or
8  * in file LICENSE in the top-level directory of the distribution.
9  */
10 /*
11  * ldap-schema.h - Header for basic schema handling functions that can be
12  *              used by both clients and servers.
13  */
14
15 #ifndef _LDAP_SCHEMA_H
16 #define _LDAP_SCHEMA_H 1
17
18 #include <ldap_cdefs.h>
19
20 LDAP_BEGIN_DECL
21
22 /* Codes for parsing errors */
23
24 #define LDAP_SCHERR_OUTOFMEM            1
25 #define LDAP_SCHERR_UNEXPTOKEN          2
26 #define LDAP_SCHERR_NOLEFTPAREN         3
27 #define LDAP_SCHERR_NORIGHTPAREN        4
28 #define LDAP_SCHERR_NODIGIT             5
29 #define LDAP_SCHERR_BADNAME             6
30 #define LDAP_SCHERR_BADDESC             7
31 #define LDAP_SCHERR_BADSUP              8
32 #define LDAP_SCHERR_DUPOPT              9
33 #define LDAP_SCHERR_EMPTY               10
34
35 typedef struct ldap_syntax {
36         char *syn_oid;          /* REQUIRED */
37         char *syn_desc;         /* OPTIONAL */
38 } LDAP_SYNTAX;
39
40 typedef struct ldap_matchingrule {
41         char *mr_oid;           /* REQUIRED */
42         char **mr_names;        /* OPTIONAL */
43         char *mr_desc;          /* OPTIONAL */
44         int  mr_obsolete;       /* OPTIONAL */
45         char *mr_syntax_oid;    /* REQUIRED */
46 } LDAP_MATCHING_RULE;
47
48 typedef struct ldap_attributetype {
49         char *at_oid;           /* REQUIRED */
50         char **at_names;        /* OPTIONAL */
51         char *at_desc;          /* OPTIONAL */
52         int  at_obsolete;       /* 0=no, 1=yes */
53         char *at_sup_oid;       /* OPTIONAL */
54         char *at_equality_oid;  /* OPTIONAL */
55         char *at_ordering_oid;  /* OPTIONAL */
56         char *at_substr_oid;    /* OPTIONAL */
57         char *at_syntax_oid;    /* OPTIONAL */
58         int  at_syntax_len;     /* OPTIONAL */
59         int  at_single_value;   /* 0=no, 1=yes */
60         int  at_collective;     /* 0=no, 1=yes */
61         int  at_no_user_mod;    /* 0=no, 1=yes */
62         int  at_usage;          /* 0=userApplications, 1=directoryOperation,
63                                    2=distributedOperation, 3=dSAOperation */
64 } LDAP_ATTRIBUTE_TYPE;
65
66 typedef struct ldap_objectclass {
67         char *oc_oid;           /* REQUIRED */
68         char **oc_names;        /* OPTIONAL */
69         char *oc_desc;          /* OPTIONAL */
70         int  oc_obsolete;       /* 0=no, 1=yes */
71         char **oc_sup_oids;     /* OPTIONAL */
72         int  oc_kind;           /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
73         char **oc_at_oids_must; /* OPTIONAL */
74         char **oc_at_oids_may;  /* OPTIONAL */
75 } LDAP_OBJECT_CLASS;
76
77 #define LDAP_SCHEMA_NO                          0
78 #define LDAP_SCHEMA_YES                         1
79
80 #define LDAP_SCHEMA_USER_APPLICATIONS           0
81 #define LDAP_SCHEMA_DIRECTORY_OPERATION         1
82 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION       2
83 #define LDAP_SCHEMA_DSA_OPERATION               3
84
85 #define LDAP_SCHEMA_ABSTRACT                    0
86 #define LDAP_SCHEMA_STRUCTURAL                  1
87 #define LDAP_SCHEMA_AUXILIARY                   2
88
89 LDAP_F( LDAP_CONST char * )
90 ldap_syntax2name LDAP_P((
91         LDAP_SYNTAX * syn ));
92
93 LDAP_F( LDAP_CONST char * )
94 ldap_matchingrule2name LDAP_P((
95         LDAP_MATCHING_RULE * mr ));
96
97 LDAP_F( LDAP_CONST char * )
98 ldap_attributetype2name LDAP_P((
99         LDAP_ATTRIBUTE_TYPE * at ));
100
101 LDAP_F( LDAP_CONST char * )
102 ldap_objectclass2name LDAP_P((
103         LDAP_OBJECT_CLASS * oc ));
104
105 LDAP_F( void )
106 ldap_syntax_free LDAP_P((
107         LDAP_SYNTAX * syn ));
108
109 LDAP_F( void )
110 ldap_matchingrule_free LDAP_P((
111         LDAP_MATCHING_RULE * mr ));
112
113 LDAP_F( void )
114 ldap_attributetype_free LDAP_P((
115         LDAP_ATTRIBUTE_TYPE * at ));
116
117 LDAP_F( void )
118 ldap_objectclass_free LDAP_P((
119         LDAP_OBJECT_CLASS * oc ));
120
121 LDAP_F( LDAP_OBJECT_CLASS * )
122 ldap_str2objectclass LDAP_P((
123         LDAP_CONST char * s,
124         int * code,
125         LDAP_CONST char ** errp ));
126
127 LDAP_F( LDAP_ATTRIBUTE_TYPE * )
128 ldap_str2attributetype LDAP_P((
129         LDAP_CONST char * s,
130         int * code,
131         LDAP_CONST char ** errp ));
132
133 LDAP_F( LDAP_SYNTAX * )
134 ldap_str2syntax LDAP_P((
135         LDAP_CONST char * s,
136         int * code,
137         LDAP_CONST char ** errp ));
138
139 LDAP_F( LDAP_MATCHING_RULE * )
140 ldap_str2matchingrule LDAP_P((
141         LDAP_CONST char * s,
142         int * code,
143         LDAP_CONST char ** errp ));
144
145 LDAP_F( char *)
146 ldap_objectclass2str LDAP_P((
147         LDAP_CONST LDAP_OBJECT_CLASS * oc ));
148
149 LDAP_F( char *)
150 ldap_attributetype2str LDAP_P((
151         LDAP_CONST LDAP_ATTRIBUTE_TYPE * at ));
152
153 LDAP_F( char *)
154 ldap_syntax2str LDAP_P((
155         LDAP_CONST LDAP_SYNTAX * syn ));
156
157 LDAP_F( char *)
158 ldap_matchingrule2str LDAP_P((
159         LDAP_CONST LDAP_MATCHING_RULE * mr ));
160
161 LDAP_F( char *)
162 ldap_scherr2str LDAP_P((
163         int code ));
164
165 LDAP_END_DECL
166
167 #endif
168