2 * Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA
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.
11 * ldap-schema.h - Header for basic schema handling functions that can be
12 * used by both clients and servers.
15 #ifndef _LDAP_SCHEMA_H
16 #define _LDAP_SCHEMA_H 1
18 #include <ldap_cdefs.h>
22 /* Codes for parsing errors */
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
35 typedef struct ldap_attributetype {
36 char *at_oid; /* REQUIRED */
37 char **at_names; /* OPTIONAL */
38 char *at_desc; /* OPTIONAL */
39 int at_obsolete; /* 0=no, 1=yes */
40 char *at_sup_oid; /* OPTIONAL */
41 char *at_equality_oid; /* OPTIONAL */
42 char *at_ordering_oid; /* OPTIONAL */
43 char *at_substr_oid; /* OPTIONAL */
44 char *at_syntax_oid; /* OPTIONAL */
45 int at_syntax_len; /* OPTIONAL */
46 int at_single_value; /* 0=no, 1=yes */
47 int at_collective; /* 0=no, 1=yes */
48 int at_no_user_mod; /* 0=no, 1=yes */
49 int at_usage; /* 0=userApplications, 1=directoryOperation,
50 2=distributedOperation, 3=dSAOperation */
51 } LDAP_ATTRIBUTE_TYPE;
53 typedef struct ldap_objectclass {
54 char *oc_oid; /* REQUIRED */
55 char **oc_names; /* OPTIONAL */
56 char *oc_desc; /* OPTIONAL */
57 int oc_obsolete; /* 0=no, 1=yes */
58 char **oc_sup_oids; /* OPTIONAL */
59 int oc_kind; /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
60 char **oc_at_oids_must; /* OPTIONAL */
61 char **oc_at_oids_may; /* OPTIONAL */
64 #define LDAP_SCHEMA_NO 0
65 #define LDAP_SCHEMA_YES 1
67 #define LDAP_SCHEMA_USER_APPLICATIONS 0
68 #define LDAP_SCHEMA_DIRECTORY_OPERATION 1
69 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION 2
70 #define LDAP_SCHEMA_DSA_OPERATION 3
72 #define LDAP_SCHEMA_ABSTRACT 0
73 #define LDAP_SCHEMA_STRUCTURAL 1
74 #define LDAP_SCHEMA_AUXILIARY 2
76 LDAP_F(LDAP_OBJECT_CLASS *) ldap_str2objectclass LDAP_P(( char * s, int * code, char ** errp ));
77 LDAP_F(LDAP_ATTRIBUTE_TYPE *) ldap_str2attributetype LDAP_P(( char * s, int * code, char ** errp ));
78 LDAP_F( char *) ldap_objectclass2str LDAP_P(( LDAP_OBJECT_CLASS * oc ));
79 LDAP_F( char *) ldap_attributetype2str LDAP_P(( LDAP_ATTRIBUTE_TYPE * at ));
80 LDAP_F( char *) ldap_scherr2str LDAP_P(( int code ));