X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=include%2Fldap_schema.h;h=1dbc6b0647b44c84852e29feb06530d6869c58a9;hb=78066c08c0650e5b1e7e205946d409e3dd10e73b;hp=0e66b681f13031c3592d6154b7a607486ea69520;hpb=7129d11e8fd02854312b7bb42b1402d4041f52b0;p=openldap diff --git a/include/ldap_schema.h b/include/ldap_schema.h index 0e66b681f1..1dbc6b0647 100644 --- a/include/ldap_schema.h +++ b/include/ldap_schema.h @@ -1,15 +1,18 @@ +/* $OpenLDAP$ */ /* - * Copyright 1999 The OpenLDAP Foundation, Redwood City, California, USA + * Copyright 1998-2001 The OpenLDAP Foundation, Redwood City, California, USA * All rights reserved. * - * Redistribution and use in source and binary forms are permitted only - * as authorized by the OpenLDAP Public License. A copy of this - * license is available at http://www.OpenLDAP.org/license.html or - * in file LICENSE in the top-level directory of the distribution. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. A copy of this license is available at + * http://www.OpenLDAP.org/license.html or in file LICENSE in the + * top-level directory of the distribution. */ /* * ldap-schema.h - Header for basic schema handling functions that can be * used by both clients and servers. + * these routines should be renamed ldap_x_... */ #ifndef _LDAP_SCHEMA_H @@ -32,6 +35,36 @@ LDAP_BEGIN_DECL #define LDAP_SCHERR_DUPOPT 9 #define LDAP_SCHERR_EMPTY 10 +typedef struct ldap_schema_extension_item { + char *lsei_name; + char **lsei_values; +} LDAPSchemaExtensionItem; + +typedef struct ldap_syntax { + char *syn_oid; /* REQUIRED */ + char **syn_names; /* OPTIONAL */ + char *syn_desc; /* OPTIONAL */ + LDAPSchemaExtensionItem **syn_extensions; /* OPTIONAL */ +} LDAPSyntax; + +typedef struct ldap_matchingrule { + char *mr_oid; /* REQUIRED */ + char **mr_names; /* OPTIONAL */ + char *mr_desc; /* OPTIONAL */ + int mr_obsolete; /* OPTIONAL */ + char *mr_syntax_oid; /* REQUIRED */ + LDAPSchemaExtensionItem **mr_extensions; /* OPTIONAL */ +} LDAPMatchingRule; + +typedef struct ldap_matchingruleuse { + char *mru_oid; /* REQUIRED */ + char **mru_names; /* OPTIONAL */ + char *mru_desc; /* OPTIONAL */ + int mru_obsolete; /* OPTIONAL */ + char **mru_applies_oids; /* REQUIRED */ + LDAPSchemaExtensionItem **mru_extensions; /* OPTIONAL */ +} LDAPMatchingRuleUse; + typedef struct ldap_attributetype { char *at_oid; /* REQUIRED */ char **at_names; /* OPTIONAL */ @@ -48,7 +81,8 @@ typedef struct ldap_attributetype { int at_no_user_mod; /* 0=no, 1=yes */ int at_usage; /* 0=userApplications, 1=directoryOperation, 2=distributedOperation, 3=dSAOperation */ -} LDAP_ATTRIBUTE_TYPE; + LDAPSchemaExtensionItem **at_extensions; /* OPTIONAL */ +} LDAPAttributeType; typedef struct ldap_objectclass { char *oc_oid; /* REQUIRED */ @@ -59,7 +93,8 @@ typedef struct ldap_objectclass { int oc_kind; /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */ char **oc_at_oids_must; /* OPTIONAL */ char **oc_at_oids_may; /* OPTIONAL */ -} LDAP_OBJECT_CLASS; + LDAPSchemaExtensionItem **oc_extensions; /* OPTIONAL */ +} LDAPObjectClass; #define LDAP_SCHEMA_NO 0 #define LDAP_SCHEMA_YES 1 @@ -73,11 +108,115 @@ typedef struct ldap_objectclass { #define LDAP_SCHEMA_STRUCTURAL 1 #define LDAP_SCHEMA_AUXILIARY 2 -LDAP_F(LDAP_OBJECT_CLASS *) ldap_str2objectclass LDAP_P(( char * s, int * code, char ** errp )); -LDAP_F(LDAP_ATTRIBUTE_TYPE *) ldap_str2attributetype LDAP_P(( char * s, int * code, char ** errp )); -LDAP_F( char *) ldap_objectclass2str LDAP_P(( LDAP_OBJECT_CLASS * oc )); -LDAP_F( char *) ldap_attributetype2str LDAP_P(( LDAP_ATTRIBUTE_TYPE * at )); -LDAP_F( char *) ldap_scherr2str LDAP_P(( int code )); +/* + * Flags that control how liberal the parsing routines are. + */ +#define LDAP_SCHEMA_ALLOW_NONE 0x00 /* Strict parsing */ +#define LDAP_SCHEMA_ALLOW_NO_OID 0x01 /* Allow missing oid */ +#define LDAP_SCHEMA_ALLOW_QUOTED 0x02 /* Allow bogus extra quotes */ +#define LDAP_SCHEMA_ALLOW_DESCR 0x04 /* Allow descr instead of OID */ +#define LDAP_SCHEMA_ALLOW_DESCR_PREFIX 0x08 /* Allow descr as OID prefix */ +#define LDAP_SCHEMA_ALLOW_OID_MACRO 0x10 /* Allow OID macros in slapd */ +#define LDAP_SCHEMA_ALLOW_ALL 0x1f /* Be very liberal in parsing */ + +LDAP_F( LDAP_CONST char * ) +ldap_syntax2name LDAP_P(( + LDAPSyntax * syn )); + +LDAP_F( LDAP_CONST char * ) +ldap_matchingrule2name LDAP_P(( + LDAPMatchingRule * mr )); + +LDAP_F( LDAP_CONST char * ) +ldap_matchingruleuse2name LDAP_P(( + LDAPMatchingRuleUse * mru )); + +LDAP_F( LDAP_CONST char * ) +ldap_attributetype2name LDAP_P(( + LDAPAttributeType * at )); + +LDAP_F( LDAP_CONST char * ) +ldap_objectclass2name LDAP_P(( + LDAPObjectClass * oc )); + +LDAP_F( void ) +ldap_syntax_free LDAP_P(( + LDAPSyntax * syn )); + +LDAP_F( void ) +ldap_matchingrule_free LDAP_P(( + LDAPMatchingRule * mr )); + +LDAP_F( void ) +ldap_matchingruleuse_free LDAP_P(( + LDAPMatchingRuleUse * mr )); + +LDAP_F( void ) +ldap_attributetype_free LDAP_P(( + LDAPAttributeType * at )); + +LDAP_F( void ) +ldap_objectclass_free LDAP_P(( + LDAPObjectClass * oc )); + +LDAP_F( LDAPObjectClass * ) +ldap_str2objectclass LDAP_P(( + LDAP_CONST char * s, + int * code, + LDAP_CONST char ** errp, + LDAP_CONST int flags )); + +LDAP_F( LDAPAttributeType * ) +ldap_str2attributetype LDAP_P(( + LDAP_CONST char * s, + int * code, + LDAP_CONST char ** errp, + LDAP_CONST int flags )); + +LDAP_F( LDAPSyntax * ) +ldap_str2syntax LDAP_P(( + LDAP_CONST char * s, + int * code, + LDAP_CONST char ** errp, + LDAP_CONST int flags )); + +LDAP_F( LDAPMatchingRule * ) +ldap_str2matchingrule LDAP_P(( + LDAP_CONST char * s, + int * code, + LDAP_CONST char ** errp, + LDAP_CONST int flags )); + +LDAP_F( LDAPMatchingRuleUse * ) +ldap_str2matchingruleuse LDAP_P(( + LDAP_CONST char * s, + int * code, + LDAP_CONST char ** errp, + LDAP_CONST int flags )); + +LDAP_F( char * ) +ldap_objectclass2str LDAP_P(( + LDAP_CONST LDAPObjectClass * oc )); + +LDAP_F( char * ) +ldap_attributetype2str LDAP_P(( + LDAP_CONST LDAPAttributeType * at )); + +LDAP_F( char * ) +ldap_syntax2str LDAP_P(( + LDAP_CONST LDAPSyntax * syn )); + +LDAP_F( char * ) +ldap_matchingrule2str LDAP_P(( + LDAP_CONST LDAPMatchingRule * mr )); + +LDAP_F( char * ) +ldap_matchingruleuse2str LDAP_P(( + LDAP_CONST LDAPMatchingRuleUse * mru )); + +LDAP_F( char * ) +ldap_scherr2str LDAP_P(( + int code )) LDAP_GCCATTR((const)); LDAP_END_DECL