]> git.sur5r.net Git - openldap/blobdiff - include/slapi-plugin.h
New access_allowed()
[openldap] / include / slapi-plugin.h
index 9bad08a8fb1ad2e88a1cc49ac79ef9ad256d97d0..afcb8e38fbe4ed988b28aaedc27677ce7dcab87e 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2009 The OpenLDAP Foundation.
  * Portions Copyright 1997,2002,2003 IBM Corporation.
  * All rights reserved.
  *
@@ -31,9 +31,9 @@ typedef struct slapi_attr             Slapi_Attr;
 typedef struct slapi_value             Slapi_Value;
 typedef struct slapi_valueset          Slapi_ValueSet;
 typedef struct slapi_filter            Slapi_Filter;
-typedef struct slap_backend_db         Slapi_Backend;
-typedef struct slap_op                 Slapi_Operation;
-typedef struct slap_conn               Slapi_Connection;
+typedef struct BackendDB               Slapi_Backend;
+typedef struct Operation               Slapi_Operation;
+typedef struct Connection              Slapi_Connection;
 typedef struct slapi_dn                        Slapi_DN;
 typedef struct slapi_rdn               Slapi_RDN;
 typedef struct slapi_mod               Slapi_Mod;
@@ -43,8 +43,6 @@ typedef struct slapi_componentid      Slapi_ComponentId;
 #define SLAPI_ATTR_UNIQUEID    "entryUUID"
 #define SLAPI_ATTR_OBJECTCLASS "objectClass"
 
-#ifndef SLAP
-
 /* pblock routines */
 int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
 int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
@@ -81,6 +79,7 @@ char *slapi_dn_normalize( char *dn );
 char *slapi_dn_normalize_case( char *dn );
 int slapi_dn_issuffix( char *dn, char *suffix );
 char *slapi_dn_beparent( Slapi_PBlock *pb, const char *dn );
+int slapi_dn_isbesuffix( Slapi_PBlock *pb, char *dn );
 char *slapi_dn_parent( const char *dn );
 int slapi_dn_isparent( const char *parentdn, const char *childdn );
 char *slapi_dn_ignore_case( char *dn );
@@ -146,7 +145,7 @@ Slapi_Value *slapi_value_new_value(const Slapi_Value *v);
 Slapi_Value *slapi_value_new_string(const char *s);
 Slapi_Value *slapi_value_init(Slapi_Value *v);
 Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval);
-Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s);
+Slapi_Value *slapi_value_init_string(Slapi_Value *v, const char *s);
 Slapi_Value *slapi_value_dup(const Slapi_Value *v);
 void slapi_value_free(Slapi_Value **value);
 const struct berval *slapi_value_get_berval( const Slapi_Value *value );
@@ -161,7 +160,7 @@ unsigned int slapi_value_get_uint(const Slapi_Value *value);
 long slapi_value_get_long(const Slapi_Value *value); 
 unsigned long slapi_value_get_ulong(const Slapi_Value *value); 
 size_t slapi_value_get_length(const Slapi_Value *value);
-int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Value *v2);
+int slapi_value_compare(const Slapi_Attr *a, const Slapi_Value *v1, const Slapi_Value *v2);
 
 Slapi_ValueSet *slapi_valueset_new( void );
 void slapi_valueset_free(Slapi_ValueSet *vs);
@@ -173,6 +172,70 @@ int slapi_valueset_next_value( Slapi_ValueSet *vs, int index, Slapi_Value **v);
 int slapi_valueset_count( const Slapi_ValueSet *vs);
 void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2);
 
+/* DNs */
+Slapi_DN *slapi_sdn_new( void );
+Slapi_DN *slapi_sdn_new_dn_byval( const char *dn );
+Slapi_DN *slapi_sdn_new_ndn_byval( const char *ndn );
+Slapi_DN *slapi_sdn_new_dn_byref( const char *dn );
+Slapi_DN *slapi_sdn_new_ndn_byref( const char *ndn );
+Slapi_DN *slapi_sdn_new_dn_passin( const char *dn );
+Slapi_DN *slapi_sdn_set_dn_byval( Slapi_DN *sdn, const char *dn );
+Slapi_DN *slapi_sdn_set_dn_byref( Slapi_DN *sdn, const char *dn );
+Slapi_DN *slapi_sdn_set_dn_passin( Slapi_DN *sdn, const char *dn );
+Slapi_DN *slapi_sdn_set_ndn_byval( Slapi_DN *sdn, const char *ndn );
+Slapi_DN *slapi_sdn_set_ndn_byref( Slapi_DN *sdn, const char *ndn );
+void slapi_sdn_done( Slapi_DN *sdn );
+void slapi_sdn_free( Slapi_DN **sdn );
+const char * slapi_sdn_get_dn( const Slapi_DN *sdn );
+const char * slapi_sdn_get_ndn( const Slapi_DN *sdn );
+void slapi_sdn_get_parent( const Slapi_DN *sdn,Slapi_DN *sdn_parent );
+void slapi_sdn_get_backend_parent( const Slapi_DN *sdn, Slapi_DN *sdn_parent, const Slapi_Backend *backend );
+Slapi_DN * slapi_sdn_dup( const Slapi_DN *sdn );
+void slapi_sdn_copy( const Slapi_DN *from, Slapi_DN *to );
+int slapi_sdn_compare( const Slapi_DN *sdn1, const Slapi_DN *sdn2 );
+int slapi_sdn_isempty( const Slapi_DN *sdn );
+int slapi_sdn_issuffix(const Slapi_DN *sdn, const Slapi_DN *suffixsdn );
+int slapi_sdn_isparent( const Slapi_DN *parent, const Slapi_DN *child );
+int slapi_sdn_isgrandparent( const Slapi_DN *parent, const Slapi_DN *child );
+int slapi_sdn_get_ndn_len( const Slapi_DN *sdn );
+int slapi_sdn_scope_test( const Slapi_DN *dn, const Slapi_DN *base, int scope );
+void slapi_sdn_get_rdn( const Slapi_DN *sdn,Slapi_RDN *rdn );
+Slapi_DN *slapi_sdn_set_rdn( Slapi_DN *sdn, const Slapi_RDN *rdn );
+Slapi_DN *slapi_sdn_set_parent( Slapi_DN *sdn, const Slapi_DN *parentdn );
+int slapi_sdn_is_rdn_component( const Slapi_DN *rdn, const Slapi_Attr *a, const Slapi_Value *v );
+char * slapi_moddn_get_newdn( Slapi_DN *dn_olddn, char *newrdn, char *newsuperiordn );
+
+/* RDNs */
+Slapi_RDN *slapi_rdn_new( void );
+Slapi_RDN *slapi_rdn_new_dn( const char *dn );
+Slapi_RDN *slapi_rdn_new_sdn( const Slapi_DN *sdn );
+Slapi_RDN *slapi_rdn_new_rdn( const Slapi_RDN *fromrdn ); 
+void slapi_rdn_init( Slapi_RDN *rdn );
+void slapi_rdn_init_dn( Slapi_RDN *rdn, const char *dn );
+void slapi_rdn_init_sdn( Slapi_RDN *rdn, const Slapi_DN *sdn );
+void slapi_rdn_init_rdn( Slapi_RDN *rdn, const Slapi_RDN *fromrdn ); 
+void slapi_rdn_set_dn( Slapi_RDN *rdn, const char *dn );
+void slapi_rdn_set_sdn( Slapi_RDN *rdn, const Slapi_DN *sdn );
+void slapi_rdn_set_rdn( Slapi_RDN *rdn, const Slapi_RDN *fromrdn );
+void slapi_rdn_free( Slapi_RDN **rdn );
+void slapi_rdn_done( Slapi_RDN *rdn );
+int slapi_rdn_get_first( Slapi_RDN *rdn, char **type, char **value );
+int slapi_rdn_get_next( Slapi_RDN *rdn, int index, char **type, char **value );
+int slapi_rdn_get_index( Slapi_RDN *rdn, const char *type, const char *value, size_t length );
+int slapi_rdn_get_index_attr( Slapi_RDN *rdn, const char *type, char **value );
+int slapi_rdn_contains( Slapi_RDN *rdn, const char *type, const char *value,size_t length );
+int slapi_rdn_contains_attr( Slapi_RDN *rdn, const char *type, char **value );
+int slapi_rdn_add( Slapi_RDN *rdn, const char *type, const char *value );
+int slapi_rdn_remove_index( Slapi_RDN *rdn, int atindex );
+int slapi_rdn_remove( Slapi_RDN *rdn, const char *type, const char *value, size_t length );
+int slapi_rdn_remove_attr( Slapi_RDN *rdn, const char *type );
+int slapi_rdn_isempty( const Slapi_RDN *rdn );
+int slapi_rdn_get_num_components( Slapi_RDN *rdn );
+int slapi_rdn_compare( Slapi_RDN *rdn1, Slapi_RDN *rdn2 );
+const char *slapi_rdn_get_rdn( const Slapi_RDN *rdn );
+const char *slapi_rdn_get_nrdn( const Slapi_RDN *rdn );
+Slapi_DN *slapi_sdn_add_rdn( Slapi_DN *sdn, const Slapi_RDN *rdn );
+
 /* locks and synchronization */
 typedef struct slapi_mutex     Slapi_Mutex;
 typedef struct slapi_condvar   Slapi_CondVar;
@@ -194,7 +257,7 @@ void slapi_ch_free( void **ptr );
 void slapi_ch_free_string( char **ptr );
 char *slapi_ch_calloc( unsigned long nelem, unsigned long size );
 char *slapi_ch_realloc( char *block, unsigned long size );
-char *slapi_ch_strdup( char *s );
+char *slapi_ch_strdup( const char *s );
 void slapi_ch_array_free( char **arrayp );
 struct berval *slapi_ch_bvdup(const struct berval *v);
 struct berval **slapi_ch_bvecdup(const struct berval **v);
@@ -223,6 +286,13 @@ void slapi_register_supported_saslmechanism(char *mechanism);
 char **slapi_get_supported_saslmechanisms();
 char **slapi_get_supported_extended_ops(void);
 
+/* operation */
+int slapi_op_abandoned( Slapi_PBlock *pb );
+unsigned long slapi_op_get_type(Slapi_Operation * op);
+void slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag);
+void slapi_operation_clear_flag(Slapi_Operation *op, unsigned long flag);
+int slapi_operation_is_flag_set(Slapi_Operation *op, unsigned long flag);
+char *slapi_op_type_to_string(unsigned long type);
 
 /* send ldap result back */
 void slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched,
@@ -285,7 +355,6 @@ typedef int (*plugin_search_entry_callback)( Slapi_Entry *e,
        void *callback_data );
 void slapi_free_search_results_internal( Slapi_PBlock *pb );
 
-#define SLAPI_OP_FLAG_LOG_CHANGE       0x0001
 #define SLAPI_OP_FLAG_NEVER_CHAIN      0x0800
 
 int slapi_search_internal_pb( Slapi_PBlock *pb );
@@ -342,6 +411,12 @@ int compute_rewrite_search_filter(Slapi_PBlock *pb);
 int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn);
 int slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb);
 
+/* backend routines */
+void slapi_be_set_readonly( Slapi_Backend *be, int readonly );
+int slapi_be_get_readonly( Slapi_Backend *be );
+const char *slapi_x_be_get_updatedn( Slapi_Backend *be );
+Slapi_Backend *slapi_be_select( const Slapi_DN *sdn );
+
 /* ACL plugins; only SLAPI_PLUGIN_ACL_ALLOW_ACCESS supported now */
 typedef int (*slapi_acl_callback_t)(Slapi_PBlock *pb,
        Slapi_Entry *e,
@@ -438,7 +513,8 @@ int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
 /* operation params */
 #define SLAPI_OPINITIATED_TIME                 140
 #define SLAPI_REQUESTOR_DN                     141
-#define SLAPI_REQUESTOR_ISUPDATEDN             142
+#define SLAPI_IS_REPLICATED_OPERATION          142
+#define SLAPI_REQUESTOR_ISUPDATEDN             SLAPI_IS_REPLICATED_OPERATION
 
 /* connection  structure params*/
 #define SLAPI_CONN_DN                          143
@@ -451,6 +527,12 @@ int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
 #define SLAPI_X_CONN_IS_UDP                    1302
 #define SLAPI_X_CONN_SSF                       1303
 #define SLAPI_X_CONN_SASL_CONTEXT              1304
+#define SLAPI_X_OPERATION_DELETE_GLUE_PARENT   1305
+#define SLAPI_X_RELAX                  1306
+#define SLAPI_X_MANAGEDIT                      SLAPI_X_RELAX
+#define SLAPI_X_OPERATION_NO_SCHEMA_CHECK      1307
+#define SLAPI_X_ADD_STRUCTURAL_CLASS           1308
+#define SLAPI_X_OPERATION_NO_SUBORDINATE_GLUE  1309
 
 /*  Authentication types */
 #define SLAPD_AUTH_NONE   "none"
@@ -476,6 +558,10 @@ int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
 #define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES      16
 #define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS    17
 
+/* transaction arguments */
+#define SLAPI_PARENT_TXN                       190
+#define SLAPI_TXN                              191
+
 /* function pointer params for backends */
 #define SLAPI_PLUGIN_DB_BIND_FN                        200
 #define SLAPI_PLUGIN_DB_UNBIND_FN              201
@@ -564,6 +650,7 @@ int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
 #define SLAPI_PLUGIN_BE_POST_DELETE_FN         553
 
 #define SLAPI_OPERATION_TYPE                   590
+#define SLAPI_OPERATION_MSGID                  591
 
 #define SLAPI_PLUGIN_MR_FILTER_CREATE_FN       600
 #define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN      601
@@ -619,6 +706,7 @@ int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
 #define SLAPI_OPERATION_ID                      742
 #define SLAPI_CONN_CERT                         743
 #define SLAPI_CONN_AUTHMETHOD                   746
+#define SLAPI_IS_INTERNAL_OPERATION            748
 
 #define SLAPI_RESULT_CODE                       881
 #define SLAPI_RESULT_TEXT                       882
@@ -640,6 +728,20 @@ int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
 #define SLAPI_X_GROUP_OPERATION_DN             1252 /* asserted value */
 #define SLAPI_X_GROUP_TARGET_ENTRY             1253 /* target entry */
 
+/* internal preoperation extensions */
+#define SLAPI_PLUGIN_INTERNAL_PRE_BIND_FN      1260
+#define SLAPI_PLUGIN_INTERNAL_PRE_UNBIND_FN    1261
+#define SLAPI_PLUGIN_INTERNAL_PRE_SEARCH_FN    1262
+#define SLAPI_PLUGIN_INTERNAL_PRE_COMPARE_FN   1263
+#define SLAPI_PLUGIN_INTERNAL_PRE_ABANDON_FN   1264
+
+/* internal postoperation extensions */
+#define SLAPI_PLUGIN_INTERNAL_POST_BIND_FN     1270
+#define SLAPI_PLUGIN_INTERNAL_POST_UNBIND_FN   1271
+#define SLAPI_PLUGIN_INTERNAL_POST_SEARCH_FN   1272
+#define SLAPI_PLUGIN_INTERNAL_POST_COMPARE_FN  1273
+#define SLAPI_PLUGIN_INTERNAL_POST_ABANDON_FN  1274
+
 /* config stuff */
 #define SLAPI_CONFIG_FILENAME                  40
 #define SLAPI_CONFIG_LINENO                    41
@@ -650,11 +752,12 @@ int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
 #define SLAPI_TARGET_ADDRESS                   48
 #define SLAPI_TARGET_UNIQUEID                  49
 #define SLAPI_TARGET_DN                                50
-#define SLAPI_REQCONTROLS                      51
 
 /* server LDAPv3 controls  */
+#define SLAPI_REQCONTROLS                      51
 #define SLAPI_RESCONTROLS                      55
 #define SLAPI_ADD_RESCONTROL                   56      
+#define SLAPI_CONTROLS_ARG                     58
 
 /* add params */
 #define SLAPI_ADD_TARGET                       SLAPI_TARGET_DN