]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapi/slapi.h
Do not return pointers into BerElement we do not own
[openldap] / servers / slapd / slapi / slapi.h
index e0c36c1eb48224648f34a5eeae87cddee2d8a67e..0766b89fad65906218beb27058f3e133a1263b2c 100644 (file)
@@ -10,6 +10,8 @@
  * without express or implied warranty.
  */
 
+#ifdef LDAP_SLAPI /* SLAPI is OPTIONAL */
+
 #ifndef _SLAPI_H
 #define _SLAPI_H
 
 
 LDAP_BEGIN_DECL
 
-typedef struct slapi_pblock    Slapi_PBlock;
-typedef struct slap_entry      Slapi_Entry;
-typedef struct slap_attr       Slapi_Attr;
-typedef struct berval          Slapi_Value;
-typedef BerVarray              Slapi_ValueSet;
-typedef Filter                 Slapi_Filter;
+/*
+ * Quick 'n' dirty to make struct slapi_* in slapi-plugin.h opaque
+ */
+#define slapi_entry    slap_entry
+#define slapi_attr     slap_attr
+#define slapi_value    berval
+#define slapi_valueset berval*
+#define slapi_filter   slap_filter
 
 LDAP_END_DECL
 
-#include <slapi_utils.h>
-#ifndef NO_PBLOCK_CLASS
-#include <slapi_pblock.h>
-#endif /* NO_PBLOCK_CLASS */
-#include <plugin.h>
-#include <slapi_ops.h>
-#if 0 /* unused (yet?) */
-#include <slapi_cl.h>
-#endif /* 0 */
+#include <slapi-plugin.h>
 
 LDAP_BEGIN_DECL
 
+/*
+ * Was: slapi_common.h
+ */
+
+/* a little naif ... */
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#if 0  /* unused (yet?) */
+#define dn_normalize_case      dn_normalize
+#define SLAPD_NO_MEMORY        7
+#define ANYBODY_STRING                 "CN=ANYBODY"
+
+extern int slap_debug;
+
+extern int dn_check(char *, int *);
+
+typedef struct strlist {
+       char *string;
+       struct strlist *next;
+} StrList;
+#endif
+
+extern struct berval *ns_get_supported_extop( int );
+
+/*
+ * Was: slapi_utils.h
+ */
+typedef struct _Audit_record Audit_record;
+
+#define SLAPI_CONTROL_MANAGEDSAIT_OID          LDAP_CONTROL_MANAGEDSAIT
+#define SLAPI_CONTROL_SORTEDSEARCH_OID         LDAP_CONTROL_SORTREQUEST
+#define SLAPI_CONTROL_PAGED_RESULTS_OID                LDAP_CONTROL_PAGEDRESULTS
+
+typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb );
+
+#if 0  /* unused (yet?) */
+#define DOMAIN "Domain"
+#define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
+#endif
+
+typedef struct _slapi_control {
+        int                    s_ctrl_num;
+        char                   **s_ctrl_oids;
+        unsigned long          *s_ctrl_ops;
+} Slapi_Control;
+
+typedef struct _ExtendedOp {
+       struct berval           ext_oid;
+        SLAPI_FUNC             ext_func;
+        Backend                        *ext_be;
+        struct _ExtendedOp     *ext_next;
+} ExtendedOp;
+
+/* Computed attribute support */
+struct _computed_attr_context {
+       /* slap_send_search_entry() argblock */
+       Slapi_PBlock    *cac_pb;
+       AttributeName   *cac_attrs;
+       int             cac_attrsonly : 1;
+       int             cac_userattrs : 1;
+       int             cac_opattrs : 1;
+       AccessControlState      cac_acl_state;
+       /* private data */
+       void *cac_private;
+};
+
+/* for slapi_attr_type_cmp() */
+#define SLAPI_TYPE_CMP_EXACT   0
+#define SLAPI_TYPE_CMP_BASE    1
+#define SLAPI_TYPE_CMP_SUBTYPE 2
+
+
+/*
+ * Was: slapi_pblock.h
+ */
+
+#ifndef NO_PBLOCK_CLASS                /* where's this test from? */
+
+#if 0  /* unused (yet?) */
+#define CMP_EQUAL                      0
+#define CMP_GREATER                    1
+#define CMP_LOWER                      (-1)
+#endif
+#define PBLOCK_ERROR                   (-1)
+#define INVALID_PARAM                  PBLOCK_ERROR
+#define PBLOCK_MAX_PARAMS              100
+
+struct slapi_pblock {
+       ldap_pvt_thread_mutex_t pblockMutex;
+       int                     ckParams;
+       int                     numParams;
+       int                     curParams[PBLOCK_MAX_PARAMS];
+       void                    *curVals[PBLOCK_MAX_PARAMS];
+};
+
+#endif /* !NO_PBLOCK_CLASS */
+
+/*
+ * Was: plugin.h
+ */
+
+#define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN)
+
+/*
+ * Was: slapi_cl.h
+ */
+
+#if 0
+#define TIME_SIZE 20
+#define OBJECTCLASS "objectclass"
+#define TOP "top"
+#define CHANGE_TIME "changetime"
+#define CHANGE_TYPE "changetype"
+#define CHANGE_TARGETDN "targetdn"
+#define CHANGES        "changes"
+#define CHANGE_NUMBER "changenumber"
+/*
+ * FIXME: I get complaints like "ADD" being redefined - first definition
+ * being in "/usr/include/arpa/nameser.h:552"
+ */
+#undef ADD
+#define ADD "add: "
+#define ADDLEN 5
+#define DEL "delete: "
+#define DELLEN 8
+#define REPLACE "replace: "
+#define REPLEN 9
+#define MOD "modify"
+#define MODRDN "modrdn"
+#define CHANGE_LOGENTRY "changelogentry"
+#define IBM_CHANGE_LOGENTRY "ibm-changelog"
+#define CL_NEWRDN "newrdn"
+#define CL_DELRDN "deleteoldrdn"
+#define CHANGE_INITIATOR "ibm-changeInitiatorsName" 
+
+extern void slapi_register_changelog_suffix(char *suffix);
+extern char **slapi_get_changelog_suffixes();
+extern void slapi_update_changelog_counters(long curNum, long numEntries);
+extern char *slapi_get_cl_firstNum();
+extern char *slapi_get_cl_lastNum();
+extern int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix, char *chNum, Operation* op); 
+extern int slapi_delete_changelog(char *dn, char *suffix, char *chNum, Operation* op); 
+extern int slapi_modify_changelog(char *dn,LDAPMod     *mods,char *suffix, char *chNum, Operation* op); 
+extern int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn, char *suffix, char *chNum, Operation* op);
+extern Backend * slapi_cl_get_be(char *dn);
+#endif
+
+
 /*
  * Attribute flags returned by slapi_attr_get_flags()
  */
@@ -111,9 +261,12 @@ LDAP_BEGIN_DECL
 #define SLAPI_REQUESTOR_ISUPDATEDN             142
 #define SLAPI_IS_REPLICATED_OPERATION          SLAPI_REQUESTOR_ISUPDATEDN
 #define SLAPI_CONN_DN                          143
+#define SLAPI_CONN_AUTHTYPE                            144
 #define SLAPI_CONN_CLIENTIP                    145
 #define SLAPI_CONN_SERVERIP                    146
-#define SLAPI_CONN_AUTHTYPE                            144
+#define SLAPI_X_CONN_CLIENTPATH                        1300
+#define SLAPI_X_CONN_SERVERPATH                        1301
+#define SLAPI_X_CONN_IS_UDP                    1302
 
 #define SLAPD_AUTH_NONE   "none"
 #define SLAPD_AUTH_SIMPLE "simple"
@@ -221,6 +374,12 @@ LDAP_BEGIN_DECL
 #define SLAPI_PLUGIN_MR_USAGE_INDEX            0
 #define SLAPI_PLUGIN_MR_USAGE_SORT             1
 
+#define SLAPI_MATCHINGRULE_NAME                        1
+#define SLAPI_MATCHINGRULE_OID                 2
+#define SLAPI_MATCHINGRULE_DESC                        3
+#define SLAPI_MATCHINGRULE_SYNTAX              4
+#define SLAPI_MATCHINGRULE_OBSOLETE            5
+
 #define SLAPI_PLUGIN_SYNTAX_FILTER_AVA         700
 #define SLAPI_PLUGIN_SYNTAX_FILTER_SUB         701
 #define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS                702
@@ -366,5 +525,7 @@ LDAP_BEGIN_DECL
 
 LDAP_END_DECL
 
-#endif /* _SLAPI_H */
+#include "proto-slapi.h"
 
+#endif /* _SLAPI_H */
+#endif /* LDAP_SLAPI */