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_syntax {
36 char *syn_oid; /* REQUIRED */
37 char *syn_desc; /* OPTIONAL */
40 typedef struct ldap_attributetype {
41 char *at_oid; /* REQUIRED */
42 char **at_names; /* OPTIONAL */
43 char *at_desc; /* OPTIONAL */
44 int at_obsolete; /* 0=no, 1=yes */
45 char *at_sup_oid; /* OPTIONAL */
46 char *at_equality_oid; /* OPTIONAL */
47 char *at_ordering_oid; /* OPTIONAL */
48 char *at_substr_oid; /* OPTIONAL */
49 char *at_syntax_oid; /* OPTIONAL */
50 int at_syntax_len; /* OPTIONAL */
51 int at_single_value; /* 0=no, 1=yes */
52 int at_collective; /* 0=no, 1=yes */
53 int at_no_user_mod; /* 0=no, 1=yes */
54 int at_usage; /* 0=userApplications, 1=directoryOperation,
55 2=distributedOperation, 3=dSAOperation */
56 } LDAP_ATTRIBUTE_TYPE;
58 typedef struct ldap_objectclass {
59 char *oc_oid; /* REQUIRED */
60 char **oc_names; /* OPTIONAL */
61 char *oc_desc; /* OPTIONAL */
62 int oc_obsolete; /* 0=no, 1=yes */
63 char **oc_sup_oids; /* OPTIONAL */
64 int oc_kind; /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
65 char **oc_at_oids_must; /* OPTIONAL */
66 char **oc_at_oids_may; /* OPTIONAL */
69 #define LDAP_SCHEMA_NO 0
70 #define LDAP_SCHEMA_YES 1
72 #define LDAP_SCHEMA_USER_APPLICATIONS 0
73 #define LDAP_SCHEMA_DIRECTORY_OPERATION 1
74 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION 2
75 #define LDAP_SCHEMA_DSA_OPERATION 3
77 #define LDAP_SCHEMA_ABSTRACT 0
78 #define LDAP_SCHEMA_STRUCTURAL 1
79 #define LDAP_SCHEMA_AUXILIARY 2
81 LDAP_F(LDAP_OBJECT_CLASS *) ldap_str2objectclass LDAP_P(( char * s, int * code, char ** errp ));
82 LDAP_F(LDAP_ATTRIBUTE_TYPE *) ldap_str2attributetype LDAP_P(( char * s, int * code, char ** errp ));
83 LDAP_F(LDAP_SYNTAX *) ldap_str2syntax LDAP_P(( char * s, int * code, char ** errp ));
84 LDAP_F( char *) ldap_objectclass2str LDAP_P(( LDAP_OBJECT_CLASS * oc ));
85 LDAP_F( char *) ldap_attributetype2str LDAP_P(( LDAP_ATTRIBUTE_TYPE * at ));
86 LDAP_F( char *) ldap_syntax2str LDAP_P(( LDAP_SYNTAX * syn ));
87 LDAP_F( char *) ldap_scherr2str LDAP_P(( int code ));