Back to index

openldap  2.4.31
ldap_schema.h
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 1998-2012 The OpenLDAP Foundation.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted only as authorized by the OpenLDAP
00009  * Public License.
00010  *
00011  * A copy of this license is available in file LICENSE in the
00012  * top-level directory of the distribution or, alternatively, at
00013  * <http://www.OpenLDAP.org/license.html>.
00014  */
00015 
00016 /* ldap-schema.h - Header for basic schema handling functions that can be
00017  *            used by both clients and servers.
00018  * these routines should be renamed ldap_x_...
00019  */
00020 
00021 #ifndef _LDAP_SCHEMA_H
00022 #define _LDAP_SCHEMA_H 1
00023 
00024 #include <ldap_cdefs.h>
00025 
00026 LDAP_BEGIN_DECL
00027 
00028 /* Codes for parsing errors */
00029 
00030 #define LDAP_SCHERR_OUTOFMEM              1
00031 #define LDAP_SCHERR_UNEXPTOKEN            2
00032 #define LDAP_SCHERR_NOLEFTPAREN           3
00033 #define LDAP_SCHERR_NORIGHTPAREN   4
00034 #define LDAP_SCHERR_NODIGIT               5
00035 #define LDAP_SCHERR_BADNAME               6
00036 #define LDAP_SCHERR_BADDESC               7
00037 #define LDAP_SCHERR_BADSUP                8
00038 #define LDAP_SCHERR_DUPOPT                9
00039 #define LDAP_SCHERR_EMPTY                 10
00040 #define LDAP_SCHERR_MISSING               11
00041 #define LDAP_SCHERR_OUT_OF_ORDER   12
00042 
00043 typedef struct ldap_schema_extension_item {
00044        char *lsei_name;
00045        char **lsei_values;
00046 } LDAPSchemaExtensionItem;
00047 
00048 typedef struct ldap_syntax {
00049        char *syn_oid;              /* REQUIRED */
00050        char **syn_names;    /* OPTIONAL */
00051        char *syn_desc;             /* OPTIONAL */
00052        LDAPSchemaExtensionItem **syn_extensions; /* OPTIONAL */
00053 } LDAPSyntax;
00054 
00055 typedef struct ldap_matchingrule {
00056        char *mr_oid;        /* REQUIRED */
00057        char **mr_names;     /* OPTIONAL */
00058        char *mr_desc;              /* OPTIONAL */
00059        int  mr_obsolete;    /* OPTIONAL */
00060        char *mr_syntax_oid; /* REQUIRED */
00061        LDAPSchemaExtensionItem **mr_extensions; /* OPTIONAL */
00062 } LDAPMatchingRule;
00063 
00064 typedef struct ldap_matchingruleuse {
00065        char *mru_oid;              /* REQUIRED */
00066        char **mru_names;    /* OPTIONAL */
00067        char *mru_desc;             /* OPTIONAL */
00068        int  mru_obsolete;   /* OPTIONAL */
00069        char **mru_applies_oids;    /* REQUIRED */
00070        LDAPSchemaExtensionItem **mru_extensions; /* OPTIONAL */
00071 } LDAPMatchingRuleUse;
00072 
00073 typedef struct ldap_attributetype {
00074        char *at_oid;        /* REQUIRED */
00075        char **at_names;     /* OPTIONAL */
00076        char *at_desc;              /* OPTIONAL */
00077        int  at_obsolete;    /* 0=no, 1=yes */
00078        char *at_sup_oid;    /* OPTIONAL */
00079        char *at_equality_oid;      /* OPTIONAL */
00080        char *at_ordering_oid;      /* OPTIONAL */
00081        char *at_substr_oid; /* OPTIONAL */
00082        char *at_syntax_oid; /* OPTIONAL */
00083        int  at_syntax_len;  /* OPTIONAL */
00084        int  at_single_value;       /* 0=no, 1=yes */
00085        int  at_collective;  /* 0=no, 1=yes */
00086        int  at_no_user_mod; /* 0=no, 1=yes */
00087        int  at_usage;              /* 0=userApplications, 1=directoryOperation,
00088                                2=distributedOperation, 3=dSAOperation */
00089        LDAPSchemaExtensionItem **at_extensions; /* OPTIONAL */
00090 } LDAPAttributeType;
00091 
00092 typedef struct ldap_objectclass {
00093        char *oc_oid;        /* REQUIRED */
00094        char **oc_names;     /* OPTIONAL */
00095        char *oc_desc;              /* OPTIONAL */
00096        int  oc_obsolete;    /* 0=no, 1=yes */
00097        char **oc_sup_oids;  /* OPTIONAL */
00098        int  oc_kind;        /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
00099        char **oc_at_oids_must;     /* OPTIONAL */
00100        char **oc_at_oids_may;      /* OPTIONAL */
00101        LDAPSchemaExtensionItem **oc_extensions; /* OPTIONAL */
00102 } LDAPObjectClass;
00103 
00104 typedef struct ldap_contentrule {
00105        char *cr_oid;        /* REQUIRED */
00106        char **cr_names;     /* OPTIONAL */
00107        char *cr_desc;              /* OPTIONAL */
00108        char **cr_sup_oids;  /* OPTIONAL */
00109        int  cr_obsolete;    /* 0=no, 1=yes */
00110        char **cr_oc_oids_aux;      /* OPTIONAL */
00111        char **cr_at_oids_must;     /* OPTIONAL */
00112        char **cr_at_oids_may;      /* OPTIONAL */
00113        char **cr_at_oids_not;      /* OPTIONAL */
00114        LDAPSchemaExtensionItem **cr_extensions; /* OPTIONAL */
00115 } LDAPContentRule;
00116 
00117 typedef struct ldap_nameform {
00118        char *nf_oid;        /* REQUIRED */
00119        char **nf_names;     /* OPTIONAL */
00120        char *nf_desc;              /* OPTIONAL */
00121        int  nf_obsolete;    /* 0=no, 1=yes */
00122        char *nf_objectclass;       /* REQUIRED */
00123        char **nf_at_oids_must;     /* REQUIRED */
00124        char **nf_at_oids_may;      /* OPTIONAL */
00125        LDAPSchemaExtensionItem **nf_extensions; /* OPTIONAL */
00126 } LDAPNameForm;
00127 
00128 typedef struct ldap_structurerule {
00129        int sr_ruleid;              /* REQUIRED */
00130        char **sr_names;     /* OPTIONAL */
00131        char *sr_desc;              /* OPTIONAL */
00132        int  sr_obsolete;    /* 0=no, 1=yes */
00133        char *sr_nameform;   /* REQUIRED */
00134        int sr_nsup_ruleids;/* number of sr_sup_ruleids */
00135        int *sr_sup_ruleids;/* OPTIONAL */
00136        LDAPSchemaExtensionItem **sr_extensions; /* OPTIONAL */
00137 } LDAPStructureRule;
00138 
00139 /*
00140  * Misc macros
00141  */
00142 #define LDAP_SCHEMA_NO                           0
00143 #define LDAP_SCHEMA_YES                          1
00144 
00145 #define LDAP_SCHEMA_USER_APPLICATIONS            0
00146 #define LDAP_SCHEMA_DIRECTORY_OPERATION          1
00147 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION 2
00148 #define LDAP_SCHEMA_DSA_OPERATION         3
00149 
00150 #define LDAP_SCHEMA_ABSTRACT                     0
00151 #define LDAP_SCHEMA_STRUCTURAL                   1
00152 #define LDAP_SCHEMA_AUXILIARY                    2
00153 
00154 
00155 /*
00156  * Flags that control how liberal the parsing routines are.
00157  */
00158 #define LDAP_SCHEMA_ALLOW_NONE            0x00U /* Strict parsing               */
00159 #define LDAP_SCHEMA_ALLOW_NO_OID   0x01U /* Allow missing oid            */
00160 #define LDAP_SCHEMA_ALLOW_QUOTED   0x02U /* Allow bogus extra quotes     */
00161 #define LDAP_SCHEMA_ALLOW_DESCR           0x04U /* Allow descr instead of OID   */
00162 #define LDAP_SCHEMA_ALLOW_DESCR_PREFIX    0x08U /* Allow descr as OID prefix    */
00163 #define LDAP_SCHEMA_ALLOW_OID_MACRO       0x10U /* Allow OID macros in slapd    */
00164 #define LDAP_SCHEMA_ALLOW_OUT_OF_ORDER_FIELDS 0x20U /* Allow fields in most any order */
00165 #define LDAP_SCHEMA_ALLOW_ALL             0x3fU /* Be very liberal in parsing   */
00166 #define       LDAP_SCHEMA_SKIP                   0x80U /* Don't malloc any result      */
00167 
00168 
00169 LDAP_F( LDAP_CONST char * )
00170 ldap_syntax2name LDAP_P((
00171        LDAPSyntax * syn ));
00172 
00173 LDAP_F( LDAP_CONST char * )
00174 ldap_matchingrule2name LDAP_P((
00175        LDAPMatchingRule * mr ));
00176 
00177 LDAP_F( LDAP_CONST char * )
00178 ldap_matchingruleuse2name LDAP_P((
00179        LDAPMatchingRuleUse * mru ));
00180 
00181 LDAP_F( LDAP_CONST char * )
00182 ldap_attributetype2name LDAP_P((
00183        LDAPAttributeType * at ));
00184 
00185 LDAP_F( LDAP_CONST char * )
00186 ldap_objectclass2name LDAP_P((
00187        LDAPObjectClass * oc ));
00188 
00189 LDAP_F( LDAP_CONST char * )
00190 ldap_contentrule2name LDAP_P((
00191        LDAPContentRule * cr ));
00192 
00193 LDAP_F( LDAP_CONST char * )
00194 ldap_nameform2name LDAP_P((
00195        LDAPNameForm * nf ));
00196 
00197 LDAP_F( LDAP_CONST char * )
00198 ldap_structurerule2name LDAP_P((
00199        LDAPStructureRule * sr ));
00200 
00201 LDAP_F( void )
00202 ldap_syntax_free LDAP_P((
00203        LDAPSyntax * syn ));
00204 
00205 LDAP_F( void )
00206 ldap_matchingrule_free LDAP_P((
00207        LDAPMatchingRule * mr ));
00208 
00209 LDAP_F( void )
00210 ldap_matchingruleuse_free LDAP_P((
00211        LDAPMatchingRuleUse * mr ));
00212 
00213 LDAP_F( void )
00214 ldap_attributetype_free LDAP_P((
00215        LDAPAttributeType * at ));
00216 
00217 LDAP_F( void )
00218 ldap_objectclass_free LDAP_P((
00219        LDAPObjectClass * oc ));
00220 
00221 LDAP_F( void )
00222 ldap_contentrule_free LDAP_P((
00223        LDAPContentRule * cr ));
00224 
00225 LDAP_F( void )
00226 ldap_nameform_free LDAP_P((
00227        LDAPNameForm * nf ));
00228 
00229 LDAP_F( void )
00230 ldap_structurerule_free LDAP_P((
00231        LDAPStructureRule * sr ));
00232 
00233 LDAP_F( LDAPStructureRule * )
00234 ldap_str2structurerule LDAP_P((
00235        LDAP_CONST char * s,
00236        int * code,
00237        LDAP_CONST char ** errp,
00238        LDAP_CONST unsigned flags ));
00239 
00240 LDAP_F( LDAPNameForm * )
00241 ldap_str2nameform LDAP_P((
00242        LDAP_CONST char * s,
00243        int * code,
00244        LDAP_CONST char ** errp,
00245        LDAP_CONST unsigned flags ));
00246 
00247 LDAP_F( LDAPContentRule * )
00248 ldap_str2contentrule LDAP_P((
00249        LDAP_CONST char * s,
00250        int * code,
00251        LDAP_CONST char ** errp,
00252        LDAP_CONST unsigned flags ));
00253 
00254 LDAP_F( LDAPObjectClass * )
00255 ldap_str2objectclass LDAP_P((
00256        LDAP_CONST char * s,
00257        int * code,
00258        LDAP_CONST char ** errp,
00259        LDAP_CONST unsigned flags ));
00260 
00261 LDAP_F( LDAPAttributeType * )
00262 ldap_str2attributetype LDAP_P((
00263        LDAP_CONST char * s,
00264        int * code,
00265        LDAP_CONST char ** errp,
00266        LDAP_CONST unsigned flags ));
00267 
00268 LDAP_F( LDAPSyntax * )
00269 ldap_str2syntax LDAP_P((
00270        LDAP_CONST char * s,
00271        int * code,
00272        LDAP_CONST char ** errp,
00273        LDAP_CONST unsigned flags ));
00274 
00275 LDAP_F( LDAPMatchingRule * )
00276 ldap_str2matchingrule LDAP_P((
00277        LDAP_CONST char * s,
00278        int * code,
00279        LDAP_CONST char ** errp,
00280        LDAP_CONST unsigned flags ));
00281 
00282 LDAP_F( LDAPMatchingRuleUse * )
00283 ldap_str2matchingruleuse LDAP_P((
00284        LDAP_CONST char * s,
00285        int * code,
00286        LDAP_CONST char ** errp,
00287        LDAP_CONST unsigned flags ));
00288 
00289 LDAP_F( char * )
00290 ldap_structurerule2str LDAP_P((
00291        LDAPStructureRule * sr ));
00292 
00293 LDAP_F( struct berval * )
00294 ldap_structurerule2bv LDAP_P((
00295        LDAPStructureRule * sr, struct berval *bv ));
00296 
00297 LDAP_F( char * )
00298 ldap_nameform2str LDAP_P((
00299        LDAPNameForm * nf ));
00300 
00301 LDAP_F( struct berval * )
00302 ldap_nameform2bv LDAP_P((
00303        LDAPNameForm * nf, struct berval *bv ));
00304 
00305 LDAP_F( char * )
00306 ldap_contentrule2str LDAP_P((
00307        LDAPContentRule * cr ));
00308 
00309 LDAP_F( struct berval * )
00310 ldap_contentrule2bv LDAP_P((
00311        LDAPContentRule * cr, struct berval *bv ));
00312 
00313 LDAP_F( char * )
00314 ldap_objectclass2str LDAP_P((
00315        LDAPObjectClass * oc ));
00316 
00317 LDAP_F( struct berval * )
00318 ldap_objectclass2bv LDAP_P((
00319        LDAPObjectClass * oc, struct berval *bv ));
00320 
00321 LDAP_F( char * )
00322 ldap_attributetype2str LDAP_P((
00323        LDAPAttributeType * at ));
00324 
00325 LDAP_F( struct berval * )
00326 ldap_attributetype2bv LDAP_P((
00327        LDAPAttributeType * at, struct berval *bv ));
00328 
00329 LDAP_F( char * )
00330 ldap_syntax2str LDAP_P((
00331        LDAPSyntax * syn ));
00332 
00333 LDAP_F( struct berval * )
00334 ldap_syntax2bv LDAP_P((
00335        LDAPSyntax * syn, struct berval *bv ));
00336 
00337 LDAP_F( char * )
00338 ldap_matchingrule2str LDAP_P((
00339        LDAPMatchingRule * mr ));
00340 
00341 LDAP_F( struct berval * )
00342 ldap_matchingrule2bv LDAP_P((
00343        LDAPMatchingRule * mr, struct berval *bv ));
00344 
00345 LDAP_F( char * )
00346 ldap_matchingruleuse2str LDAP_P((
00347        LDAPMatchingRuleUse * mru ));
00348 
00349 LDAP_F( struct berval * )
00350 ldap_matchingruleuse2bv LDAP_P((
00351        LDAPMatchingRuleUse * mru, struct berval *bv ));
00352 
00353 LDAP_F( char * )
00354 ldap_scherr2str LDAP_P((
00355        int code )) LDAP_GCCATTR((const));
00356 
00357 LDAP_END_DECL
00358 
00359 #endif
00360