Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-17 09:55:46

0001 /* $OpenLDAP$ */
0002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
0003  *
0004  * Copyright 1998-2024 The OpenLDAP Foundation.
0005  * All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted only as authorized by the OpenLDAP
0009  * Public License.
0010  *
0011  * A copy of this license is available in file LICENSE in the
0012  * top-level directory of the distribution or, alternatively, at
0013  * <http://www.OpenLDAP.org/license.html>.
0014  */
0015 
0016 /* ldap-schema.h - Header for basic schema handling functions that can be
0017  *      used by both clients and servers.
0018  * these routines should be renamed ldap_x_...
0019  */
0020 
0021 #ifndef _LDAP_SCHEMA_H
0022 #define _LDAP_SCHEMA_H 1
0023 
0024 #include <ldap_cdefs.h>
0025 
0026 LDAP_BEGIN_DECL
0027 
0028 /* Codes for parsing errors */
0029 
0030 #define LDAP_SCHERR_OUTOFMEM        1
0031 #define LDAP_SCHERR_UNEXPTOKEN      2
0032 #define LDAP_SCHERR_NOLEFTPAREN     3
0033 #define LDAP_SCHERR_NORIGHTPAREN    4
0034 #define LDAP_SCHERR_NODIGIT         5
0035 #define LDAP_SCHERR_BADNAME         6
0036 #define LDAP_SCHERR_BADDESC         7
0037 #define LDAP_SCHERR_BADSUP          8
0038 #define LDAP_SCHERR_DUPOPT          9
0039 #define LDAP_SCHERR_EMPTY           10
0040 #define LDAP_SCHERR_MISSING         11
0041 #define LDAP_SCHERR_OUT_OF_ORDER    12
0042 
0043 typedef struct ldap_schema_extension_item {
0044     char *lsei_name;
0045     char **lsei_values;
0046 } LDAPSchemaExtensionItem;
0047 
0048 typedef struct ldap_syntax {
0049     char *syn_oid;      /* REQUIRED */
0050     char **syn_names;   /* OPTIONAL */
0051     char *syn_desc;     /* OPTIONAL */
0052     LDAPSchemaExtensionItem **syn_extensions; /* OPTIONAL */
0053 } LDAPSyntax;
0054 
0055 typedef struct ldap_matchingrule {
0056     char *mr_oid;       /* REQUIRED */
0057     char **mr_names;    /* OPTIONAL */
0058     char *mr_desc;      /* OPTIONAL */
0059     int  mr_obsolete;   /* OPTIONAL */
0060     char *mr_syntax_oid;    /* REQUIRED */
0061     LDAPSchemaExtensionItem **mr_extensions; /* OPTIONAL */
0062 } LDAPMatchingRule;
0063 
0064 typedef struct ldap_matchingruleuse {
0065     char *mru_oid;      /* REQUIRED */
0066     char **mru_names;   /* OPTIONAL */
0067     char *mru_desc;     /* OPTIONAL */
0068     int  mru_obsolete;  /* OPTIONAL */
0069     char **mru_applies_oids;    /* REQUIRED */
0070     LDAPSchemaExtensionItem **mru_extensions; /* OPTIONAL */
0071 } LDAPMatchingRuleUse;
0072 
0073 typedef struct ldap_attributetype {
0074     char *at_oid;       /* REQUIRED */
0075     char **at_names;    /* OPTIONAL */
0076     char *at_desc;      /* OPTIONAL */
0077     int  at_obsolete;   /* 0=no, 1=yes */
0078     char *at_sup_oid;   /* OPTIONAL */
0079     char *at_equality_oid;  /* OPTIONAL */
0080     char *at_ordering_oid;  /* OPTIONAL */
0081     char *at_substr_oid;    /* OPTIONAL */
0082     char *at_syntax_oid;    /* OPTIONAL */
0083     int  at_syntax_len; /* OPTIONAL */
0084     int  at_single_value;   /* 0=no, 1=yes */
0085     int  at_collective; /* 0=no, 1=yes */
0086     int  at_no_user_mod;    /* 0=no, 1=yes */
0087     int  at_usage;      /* 0=userApplications, 1=directoryOperation,
0088                    2=distributedOperation, 3=dSAOperation */
0089     LDAPSchemaExtensionItem **at_extensions; /* OPTIONAL */
0090 } LDAPAttributeType;
0091 
0092 typedef struct ldap_objectclass {
0093     char *oc_oid;       /* REQUIRED */
0094     char **oc_names;    /* OPTIONAL */
0095     char *oc_desc;      /* OPTIONAL */
0096     int  oc_obsolete;   /* 0=no, 1=yes */
0097     char **oc_sup_oids; /* OPTIONAL */
0098     int  oc_kind;       /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
0099     char **oc_at_oids_must; /* OPTIONAL */
0100     char **oc_at_oids_may;  /* OPTIONAL */
0101     LDAPSchemaExtensionItem **oc_extensions; /* OPTIONAL */
0102 } LDAPObjectClass;
0103 
0104 typedef struct ldap_contentrule {
0105     char *cr_oid;       /* REQUIRED */
0106     char **cr_names;    /* OPTIONAL */
0107     char *cr_desc;      /* OPTIONAL */
0108     char **cr_sup_oids; /* OPTIONAL */
0109     int  cr_obsolete;   /* 0=no, 1=yes */
0110     char **cr_oc_oids_aux;  /* OPTIONAL */
0111     char **cr_at_oids_must; /* OPTIONAL */
0112     char **cr_at_oids_may;  /* OPTIONAL */
0113     char **cr_at_oids_not;  /* OPTIONAL */
0114     LDAPSchemaExtensionItem **cr_extensions; /* OPTIONAL */
0115 } LDAPContentRule;
0116 
0117 typedef struct ldap_nameform {
0118     char *nf_oid;       /* REQUIRED */
0119     char **nf_names;    /* OPTIONAL */
0120     char *nf_desc;      /* OPTIONAL */
0121     int  nf_obsolete;   /* 0=no, 1=yes */
0122     char *nf_objectclass;   /* REQUIRED */
0123     char **nf_at_oids_must; /* REQUIRED */
0124     char **nf_at_oids_may;  /* OPTIONAL */
0125     LDAPSchemaExtensionItem **nf_extensions; /* OPTIONAL */
0126 } LDAPNameForm;
0127 
0128 typedef struct ldap_structurerule {
0129     int sr_ruleid;      /* REQUIRED */
0130     char **sr_names;    /* OPTIONAL */
0131     char *sr_desc;      /* OPTIONAL */
0132     int  sr_obsolete;   /* 0=no, 1=yes */
0133     char *sr_nameform;  /* REQUIRED */
0134     int sr_nsup_ruleids;/* number of sr_sup_ruleids */
0135     int *sr_sup_ruleids;/* OPTIONAL */
0136     LDAPSchemaExtensionItem **sr_extensions; /* OPTIONAL */
0137 } LDAPStructureRule;
0138 
0139 /*
0140  * Misc macros
0141  */
0142 #define LDAP_SCHEMA_NO              0
0143 #define LDAP_SCHEMA_YES             1
0144 
0145 #define LDAP_SCHEMA_USER_APPLICATIONS       0
0146 #define LDAP_SCHEMA_DIRECTORY_OPERATION     1
0147 #define LDAP_SCHEMA_DISTRIBUTED_OPERATION   2
0148 #define LDAP_SCHEMA_DSA_OPERATION       3
0149 
0150 #define LDAP_SCHEMA_ABSTRACT            0
0151 #define LDAP_SCHEMA_STRUCTURAL          1
0152 #define LDAP_SCHEMA_AUXILIARY           2
0153 
0154 
0155 /*
0156  * Flags that control how liberal the parsing routines are.
0157  */
0158 #define LDAP_SCHEMA_ALLOW_NONE      0x00U /* Strict parsing               */
0159 #define LDAP_SCHEMA_ALLOW_NO_OID    0x01U /* Allow missing oid            */
0160 #define LDAP_SCHEMA_ALLOW_QUOTED    0x02U /* Allow bogus extra quotes     */
0161 #define LDAP_SCHEMA_ALLOW_DESCR     0x04U /* Allow descr instead of OID   */
0162 #define LDAP_SCHEMA_ALLOW_DESCR_PREFIX  0x08U /* Allow descr as OID prefix    */
0163 #define LDAP_SCHEMA_ALLOW_OID_MACRO 0x10U /* Allow OID macros in slapd    */
0164 #define LDAP_SCHEMA_ALLOW_OUT_OF_ORDER_FIELDS 0x20U /* Allow fields in most any order */
0165 #define LDAP_SCHEMA_ALLOW_ALL       0x3fU /* Be very liberal in parsing   */
0166 #define LDAP_SCHEMA_SKIP            0x80U /* Don't malloc any result      */
0167 
0168 
0169 LDAP_F( LDAP_CONST char * )
0170 ldap_syntax2name LDAP_P((
0171     LDAPSyntax * syn ));
0172 
0173 LDAP_F( LDAP_CONST char * )
0174 ldap_matchingrule2name LDAP_P((
0175     LDAPMatchingRule * mr ));
0176 
0177 LDAP_F( LDAP_CONST char * )
0178 ldap_matchingruleuse2name LDAP_P((
0179     LDAPMatchingRuleUse * mru ));
0180 
0181 LDAP_F( LDAP_CONST char * )
0182 ldap_attributetype2name LDAP_P((
0183     LDAPAttributeType * at ));
0184 
0185 LDAP_F( LDAP_CONST char * )
0186 ldap_objectclass2name LDAP_P((
0187     LDAPObjectClass * oc ));
0188 
0189 LDAP_F( LDAP_CONST char * )
0190 ldap_contentrule2name LDAP_P((
0191     LDAPContentRule * cr ));
0192 
0193 LDAP_F( LDAP_CONST char * )
0194 ldap_nameform2name LDAP_P((
0195     LDAPNameForm * nf ));
0196 
0197 LDAP_F( LDAP_CONST char * )
0198 ldap_structurerule2name LDAP_P((
0199     LDAPStructureRule * sr ));
0200 
0201 LDAP_F( void )
0202 ldap_syntax_free LDAP_P((
0203     LDAPSyntax * syn ));
0204 
0205 LDAP_F( void )
0206 ldap_matchingrule_free LDAP_P((
0207     LDAPMatchingRule * mr ));
0208 
0209 LDAP_F( void )
0210 ldap_matchingruleuse_free LDAP_P((
0211     LDAPMatchingRuleUse * mr ));
0212 
0213 LDAP_F( void )
0214 ldap_attributetype_free LDAP_P((
0215     LDAPAttributeType * at ));
0216 
0217 LDAP_F( void )
0218 ldap_objectclass_free LDAP_P((
0219     LDAPObjectClass * oc ));
0220 
0221 LDAP_F( void )
0222 ldap_contentrule_free LDAP_P((
0223     LDAPContentRule * cr ));
0224 
0225 LDAP_F( void )
0226 ldap_nameform_free LDAP_P((
0227     LDAPNameForm * nf ));
0228 
0229 LDAP_F( void )
0230 ldap_structurerule_free LDAP_P((
0231     LDAPStructureRule * sr ));
0232 
0233 LDAP_F( LDAPStructureRule * )
0234 ldap_str2structurerule LDAP_P((
0235     LDAP_CONST char * s,
0236     int * code,
0237     LDAP_CONST char ** errp,
0238     LDAP_CONST unsigned flags ));
0239 
0240 LDAP_F( LDAPNameForm * )
0241 ldap_str2nameform LDAP_P((
0242     LDAP_CONST char * s,
0243     int * code,
0244     LDAP_CONST char ** errp,
0245     LDAP_CONST unsigned flags ));
0246 
0247 LDAP_F( LDAPContentRule * )
0248 ldap_str2contentrule LDAP_P((
0249     LDAP_CONST char * s,
0250     int * code,
0251     LDAP_CONST char ** errp,
0252     LDAP_CONST unsigned flags ));
0253 
0254 LDAP_F( LDAPObjectClass * )
0255 ldap_str2objectclass LDAP_P((
0256     LDAP_CONST char * s,
0257     int * code,
0258     LDAP_CONST char ** errp,
0259     LDAP_CONST unsigned flags ));
0260 
0261 LDAP_F( LDAPAttributeType * )
0262 ldap_str2attributetype LDAP_P((
0263     LDAP_CONST char * s,
0264     int * code,
0265     LDAP_CONST char ** errp,
0266     LDAP_CONST unsigned flags ));
0267 
0268 LDAP_F( LDAPSyntax * )
0269 ldap_str2syntax LDAP_P((
0270     LDAP_CONST char * s,
0271     int * code,
0272     LDAP_CONST char ** errp,
0273     LDAP_CONST unsigned flags ));
0274 
0275 LDAP_F( LDAPMatchingRule * )
0276 ldap_str2matchingrule LDAP_P((
0277     LDAP_CONST char * s,
0278     int * code,
0279     LDAP_CONST char ** errp,
0280     LDAP_CONST unsigned flags ));
0281 
0282 LDAP_F( LDAPMatchingRuleUse * )
0283 ldap_str2matchingruleuse LDAP_P((
0284     LDAP_CONST char * s,
0285     int * code,
0286     LDAP_CONST char ** errp,
0287     LDAP_CONST unsigned flags ));
0288 
0289 LDAP_F( char * )
0290 ldap_structurerule2str LDAP_P((
0291     LDAPStructureRule * sr ));
0292 
0293 LDAP_F( struct berval * )
0294 ldap_structurerule2bv LDAP_P((
0295     LDAPStructureRule * sr, struct berval *bv ));
0296 
0297 LDAP_F( char * )
0298 ldap_nameform2str LDAP_P((
0299     LDAPNameForm * nf ));
0300 
0301 LDAP_F( struct berval * )
0302 ldap_nameform2bv LDAP_P((
0303     LDAPNameForm * nf, struct berval *bv ));
0304 
0305 LDAP_F( char * )
0306 ldap_contentrule2str LDAP_P((
0307     LDAPContentRule * cr ));
0308 
0309 LDAP_F( struct berval * )
0310 ldap_contentrule2bv LDAP_P((
0311     LDAPContentRule * cr, struct berval *bv ));
0312 
0313 LDAP_F( char * )
0314 ldap_objectclass2str LDAP_P((
0315     LDAPObjectClass * oc ));
0316 
0317 LDAP_F( struct berval * )
0318 ldap_objectclass2bv LDAP_P((
0319     LDAPObjectClass * oc, struct berval *bv ));
0320 
0321 LDAP_F( char * )
0322 ldap_attributetype2str LDAP_P((
0323     LDAPAttributeType * at ));
0324 
0325 LDAP_F( struct berval * )
0326 ldap_attributetype2bv LDAP_P((
0327     LDAPAttributeType * at, struct berval *bv ));
0328 
0329 LDAP_F( char * )
0330 ldap_syntax2str LDAP_P((
0331     LDAPSyntax * syn ));
0332 
0333 LDAP_F( struct berval * )
0334 ldap_syntax2bv LDAP_P((
0335     LDAPSyntax * syn, struct berval *bv ));
0336 
0337 LDAP_F( char * )
0338 ldap_matchingrule2str LDAP_P((
0339     LDAPMatchingRule * mr ));
0340 
0341 LDAP_F( struct berval * )
0342 ldap_matchingrule2bv LDAP_P((
0343     LDAPMatchingRule * mr, struct berval *bv ));
0344 
0345 LDAP_F( char * )
0346 ldap_matchingruleuse2str LDAP_P((
0347     LDAPMatchingRuleUse * mru ));
0348 
0349 LDAP_F( struct berval * )
0350 ldap_matchingruleuse2bv LDAP_P((
0351     LDAPMatchingRuleUse * mru, struct berval *bv ));
0352 
0353 LDAP_F( char * )
0354 ldap_scherr2str LDAP_P((
0355     int code )) LDAP_GCCATTR((const));
0356 
0357 LDAP_END_DECL
0358 
0359 #endif
0360