]> git.sur5r.net Git - openldap/blob - servers/slapd/slapi/slapi.h
use slapi_pblock_delete_param()
[openldap] / servers / slapd / slapi / slapi.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 2002-2005 The OpenLDAP Foundation.
5  * Portions Copyright 1997,2002-2003 IBM Corporation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /* ACKNOWLEDGEMENTS:
17  * This work was initially developed by IBM Corporation for use in
18  * IBM products and subsequently ported to OpenLDAP Software by
19  * Steve Omrani.  Additional significant contributors include:
20  *   Luke Howard
21  */
22
23 #ifdef LDAP_SLAPI /* SLAPI is OPTIONAL */
24
25 #ifndef _SLAPI_H
26 #define _SLAPI_H
27
28 LDAP_BEGIN_DECL
29
30 /*
31  * Quick 'n' dirty to make struct slapi_* in slapi-plugin.h opaque
32  */
33 #define slapi_entry     slap_entry
34 #define slapi_attr      slap_attr
35 #define slapi_value     berval
36 #define slapi_valueset  berval *
37 #define slapi_filter    slap_filter
38
39 LDAP_END_DECL
40
41 #include <slapi-plugin.h>
42
43 LDAP_BEGIN_DECL
44
45 #define SLAPI_OVERLAY_NAME                      "slapi"
46
47 #define SLAPI_OPERATION_PBLOCK(_op)             ((_op)->o_callback->sc_private)
48 #define SLAPI_CONNECTION_PBLOCK(_conn)          ((_conn)->c_pb);
49 #define SLAPI_BACKEND_PBLOCK(_be)               ((_be)->be_pb)
50
51 #define SLAPI_OPERATION_EXTENSIONS(_op)         ((_op)->o_hdr->oh_extensions)
52 #define SLAPI_CONNECTION_EXTENSIONS(_conn)      ((_conn)->c_extensions)
53
54 #define SLAPI_CONTROL_MANAGEDSAIT_OID           LDAP_CONTROL_MANAGEDSAIT
55 #define SLAPI_CONTROL_SORTEDSEARCH_OID          LDAP_CONTROL_SORTREQUEST
56 #define SLAPI_CONTROL_PAGED_RESULTS_OID         LDAP_CONTROL_PAGEDRESULTS
57
58 typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb );
59
60 typedef struct _slapi_control {
61         int                     s_ctrl_num;
62         char                    **s_ctrl_oids;
63         unsigned long           *s_ctrl_ops;
64 } Slapi_Control;
65
66 typedef struct _ExtendedOp {
67         struct berval           ext_oid;
68         SLAPI_FUNC              ext_func;
69         Backend                 *ext_be;
70         struct _ExtendedOp      *ext_next;
71 } ExtendedOp;
72
73 /* Computed attribute support */
74 struct _computed_attr_context {
75         Slapi_PBlock    *cac_pb;
76         Operation       *cac_op;
77         void            *cac_private;
78 };
79
80 /* for slapi_attr_type_cmp() */
81 #define SLAPI_TYPE_CMP_EXACT    0
82 #define SLAPI_TYPE_CMP_BASE     1
83 #define SLAPI_TYPE_CMP_SUBTYPE  2
84
85 typedef enum slapi_extension_e {
86         SLAPI_X_EXT_CONNECTION = 0,
87         SLAPI_X_EXT_OPERATION = 1,
88         SLAPI_X_EXT_MAX = 2
89 } slapi_extension_t;
90
91 /*
92  * Was: slapi_pblock.h
93  */
94
95 #ifndef NO_PBLOCK_CLASS         /* where's this test from? */
96
97 typedef enum slapi_pblock_class_e {
98         PBLOCK_CLASS_INVALID = 0,
99         PBLOCK_CLASS_INTEGER,
100         PBLOCK_CLASS_LONG_INTEGER,
101         PBLOCK_CLASS_POINTER,
102         PBLOCK_CLASS_FUNCTION_POINTER
103 } slapi_pblock_class_t;
104
105 #define PBLOCK_SUCCESS                  (0)
106 #define PBLOCK_ERROR                    (-1)
107 #define PBLOCK_MAX_PARAMS               100
108
109 struct slapi_pblock {
110         ldap_pvt_thread_mutex_t pblockMutex;
111         int                     ckParams;
112         int                     numParams;
113         int                     curParams[PBLOCK_MAX_PARAMS];
114         void                    *curVals[PBLOCK_MAX_PARAMS];
115         /* native types */
116         Connection              *pconn;
117         Operation               *pop;
118         SlapReply               rs;
119         int                     internal_op;
120         char                    textbuf[ SLAP_TEXT_BUFLEN ];
121 };
122
123 #endif /* !NO_PBLOCK_CLASS */
124
125 /*
126  * Was: plugin.h
127  */
128
129 #define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_BE_POST_DELETE_FN)
130
131 #define SLAPI_OPERATION_PARAMETERS              138
132
133 #define SLAPI_PLUGIN_DB_TEST_FN                 227
134 #define SLAPI_PLUGIN_DB_NO_ACL                  250
135
136 /* DS 5.x Computed Attribute Callbacks (not exposed) */
137 #define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN       1200
138 #define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
139
140 #define SLAPI_ENTRY_PRE_OP                      52
141 #define SLAPI_ENTRY_POST_OP                     53
142
143 /* This is the spelling in the SunOne 5.2 docs */
144 #define SLAPI_RES_CONTROLS      SLAPI_RESCONTROLS
145
146 #define SLAPI_ABANDON_MSGID                     120
147
148 #define SLAPI_SEQ_TYPE                          150
149 #define SLAPI_SEQ_ATTRNAME                      151
150 #define SLAPI_SEQ_VAL                           152
151
152 #define SLAPI_MR_FILTER_ENTRY                   170     
153 #define SLAPI_MR_FILTER_TYPE                    171
154 #define SLAPI_MR_FILTER_VALUE                   172
155 #define SLAPI_MR_FILTER_OID                     173
156 #define SLAPI_MR_FILTER_DNATTRS                 174
157
158 #define SLAPI_LDIF2DB_FILE                      180
159 #define SLAPI_LDIF2DB_REMOVEDUPVALS             185
160
161 #define SLAPI_DB2LDIF_PRINTKEY                  183
162
163 #define SLAPI_PARENT_TXN                        190
164 #define SLAPI_TXN                               191
165
166 #define SLAPI_CHANGENUMBER                      197
167 #define SLAPI_LOG_OPERATION                     198
168
169 #define SLAPI_DBSIZE                            199
170
171 /* really private stuff */
172 #define SLAPI_X_CONFIG_ARGV                     1400
173 #define SLAPI_X_INTOP_FLAGS                     1401
174 #define SLAPI_X_INTOP_RESULT_CALLBACK           1402
175 #define SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK     1403
176 #define SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK   1404
177 #define SLAPI_X_INTOP_CALLBACK_DATA             1405
178 #define SLAPI_X_OLD_RESCONTROLS                 1406
179
180 #define SLAPI_IBM_PBLOCK                        -3
181
182 LDAP_SLAPI_V (ldap_pvt_thread_mutex_t)  slapi_hn_mutex;
183 LDAP_SLAPI_V (ldap_pvt_thread_mutex_t)  slapi_time_mutex;
184 LDAP_SLAPI_V (ldap_pvt_thread_mutex_t)  slapi_printmessage_mutex; 
185 LDAP_SLAPI_V (char *)                   slapi_log_file;
186 LDAP_SLAPI_V (int)                      slapi_log_level;
187
188 #include "proto-slapi.h"
189
190 #endif /* _SLAPI_H */
191 #endif /* LDAP_SLAPI */