]> git.sur5r.net Git - openldap/blob - servers/slapd/slapi/slapi.h
d13cb6fa8678dba88310852a3be8fd43b624cbd9
[openldap] / servers / slapd / slapi / slapi.h
1 /*
2  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5 /*
6  * (C) Copyright IBM Corp. 1997,2002
7  * Redistribution and use in source and binary forms are permitted
8  * provided that this notice is preserved and that due credit is 
9  * given to IBM Corporation. This software is provided ``as is'' 
10  * without express or implied warranty.
11  */
12
13 #ifndef _SLAPI_H
14 #define _SLAPI_H
15
16 #include <ibm_pblock_params.h> 
17
18 #define slapi_entry     slap_entry
19 #define slapi_attr      slap_attr
20 #define slapi_filter    slap_filter
21 #include <slapi-plugin.h>
22
23 LDAP_BEGIN_DECL
24
25 /*
26  * Generic typedefs
27  */
28 #if 0
29 typedef struct  slapi_pblock    Slapi_PBlock;
30 typedef struct  slap_entry      Slapi_Entry;
31 typedef struct  slap_attr       Slapi_Attr;
32 typedef struct  berval          Slapi_Value;
33 typedef BerVarray               Slapi_ValueSet;
34 typedef Filter                  Slapi_Filter;
35 #endif
36
37 /*
38  * Was: slapi_common.h
39  */
40
41 /* a little naif ... */
42 #ifndef TRUE
43 #define TRUE 1
44 #endif
45
46 #ifndef FALSE
47 #define FALSE 0
48 #endif
49
50 #if 0
51
52 #define dn_normalize_case       dn_normalize
53 #define SLAPD_NO_MEMORY         7
54 #define ANYBODY_STRING          "CN=ANYBODY"
55
56 extern int slap_debug;
57
58 int
59 dn_check(char *, int *);
60
61 typedef struct strlist {
62         char *string;
63         struct strlist *next;
64 } StrList;
65
66 #endif
67
68
69 /*
70  * Was: slapi_utils.h
71  */
72 typedef struct _Audit_record Audit_record;
73
74 #define SLAPI_CONTROL_MANAGEDSAIT_OID           LDAP_CONTROL_MANAGEDSAIT
75 #define SLAPI_CONTROL_SORTEDSEARCH_OID          LDAP_CONTROL_SORTREQUEST
76 #define SLAPI_CONTROL_PAGED_RESULTS_OID         LDAP_CONTROL_PAGEDRESULTS
77
78 typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb );
79
80 #if 0
81 #define DOMAIN "Domain"
82 #define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
83 #endif
84
85 typedef struct _slapi_control {
86         int                     s_ctrl_num;
87         char                    **s_ctrl_oids;
88         unsigned long           *s_ctrl_ops;
89 } Slapi_Control;
90
91 typedef struct _ExtendedOp {
92         struct berval           ext_oid;
93         SLAPI_FUNC              ext_func;
94         Backend                 *ext_be;
95         struct _ExtendedOp      *ext_next;
96 } ExtendedOp;
97
98 /* Computed attribute support */
99 struct _computed_attr_context {
100         /* slap_send_search_entry() argblock */
101         Slapi_PBlock    *cac_pb;
102         AttributeName   *cac_attrs;
103         int             cac_attrsonly : 1;
104         int             cac_userattrs : 1;
105         int             cac_opattrs : 1;
106         AccessControlState      cac_acl_state;
107         /* private data */
108         void *cac_private;
109 };
110
111 /* for slapi_attr_type_cmp() */
112 #define SLAPI_TYPE_CMP_EXACT    0
113 #define SLAPI_TYPE_CMP_BASE     1
114 #define SLAPI_TYPE_CMP_SUBTYPE  2
115
116
117 /*
118  * Was: slapi_pblock.h
119  */
120
121 #ifndef NO_PBLOCK_CLASS
122
123 #if 0
124 #define CMP_EQUAL                       0
125 #define CMP_GREATER                     1
126 #define CMP_LOWER                       (-1)
127 #endif
128 #define PBLOCK_ERROR                    (-1)
129 #define INVALID_PARAM                   PBLOCK_ERROR
130 #define PBLOCK_MAX_PARAMS               100
131
132 struct slapi_pblock {
133         ldap_pvt_thread_mutex_t pblockMutex;
134         int                     ckParams;
135         int                     numParams;
136         int                     curParams[PBLOCK_MAX_PARAMS];
137         void                    *curVals[PBLOCK_MAX_PARAMS];
138 };
139
140 #endif /* !NO_PBLOCK_CLASS */
141
142 /*
143  * Was: plugin.h
144  */
145
146 #define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN)
147
148 #if 0
149 #include <slapi_utils.h.h>
150 #include <slapi_pblock.h>
151 #include <plugin.h>
152 #include <slapi_ops.h>
153 #if 0 /* unused (yet?) */
154 #include <slapi_cl.h>
155 #endif /* 0 */
156 #endif
157
158 /*
159  * Attribute flags returned by slapi_attr_get_flags()
160  */
161 #define SLAPI_ATTR_FLAG_SINGLE          0x0001
162 #define SLAPI_ATTR_FLAG_OPATTR          0x0002
163 #define SLAPI_ATTR_FLAG_READONLY        0x0004
164 #define SLAPI_ATTR_FLAG_STD_ATTR        SLAPI_ATTR_FLAG_READONLY
165 #define SLAPI_ATTR_FLAG_OBSOLETE        0x0040
166 #define SLAPI_ATTR_FLAG_COLLECTIVE      0x0080
167 #define SLAPI_ATTR_FLAG_NOUSERMOD       0x0100
168
169 /*
170  * ACL levels
171  */
172 #define SLAPI_ACL_COMPARE       0x01
173 #define SLAPI_ACL_SEARCH        0x02
174 #define SLAPI_ACL_READ          0x04
175 #define SLAPI_ACL_WRITE         0x08
176 #define SLAPI_ACL_DELETE        0x10
177 #define SLAPI_ACL_ADD           0x20
178 #define SLAPI_ACL_SELF          0x40
179 #define SLAPI_ACL_PROXY         0x80
180 #define SLAPI_ACL_ALL           0x7f
181
182 /*
183  * Plugin types universally supported by SLAPI
184  * implementations
185  */
186 #define SLAPI_PLUGIN_DATABASE           1
187 #define SLAPI_PLUGIN_EXTENDEDOP         2
188 #define SLAPI_PLUGIN_PREOPERATION       3
189 #define SLAPI_PLUGIN_POSTOPERATION      4
190 #define SLAPI_PLUGIN_MATCHINGRULE       5
191 #define SLAPI_PLUGIN_SYNTAX             6
192 /* XXX this is SLAPI_PLUGIN_ACL in SunDS */
193 #define SLAPI_PLUGIN_AUDIT              7
194 /*
195  * The following plugin types are reserved for future
196  * Sun ONE DS compatability.
197  */
198 #define SLAPI_PLUGIN_BEPREOPERATION             8       
199 #define SLAPI_PLUGIN_BEPOSTOPERATION            9       
200 #define SLAPI_PLUGIN_ENTRY                      10      
201 #define SLAPI_PLUGIN_TYPE_OBJECT                11      
202 #define SLAPI_PLUGIN_INTERNAL_PREOPERATION      12      
203 #define SLAPI_PLUGIN_INTERNAL_POSTOPERATION     13
204 #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME         14
205 #define SLAPI_PLUGIN_VATTR_SP                   15
206 #define SLAPI_PLUGIN_REVER_PWD_STORAGE_SCHEME   16
207
208 #define SLAPI_PLUGIN_EXTENDED_SENT_RESULT       -1
209 #define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED       -2
210
211 #define SLAPI_BIND_SUCCESS              0
212 #define SLAPI_BIND_FAIL                 2
213 #define SLAPI_BIND_ANONYMOUS            3
214
215 #define SLAPI_BACKEND                           130
216 #define SLAPI_CONNECTION                        131
217 #define SLAPI_OPERATION                         132
218 #define SLAPI_REQUESTOR_ISROOT                  133
219 #define SLAPI_BE_MONITORDN                      134
220 #define SLAPI_BE_TYPE                           135
221 #define SLAPI_BE_READONLY                       136
222 #define SLAPI_BE_LASTMOD                        137
223 #define SLAPI_OPERATION_PARAMETERS              138
224 #define SLAPI_CONN_ID                           139
225
226 #define SLAPI_OPINITIATED_TIME                  140
227 #define SLAPI_REQUESTOR_DN                      141
228 #define SLAPI_REQUESTOR_ISUPDATEDN              142
229 #define SLAPI_IS_REPLICATED_OPERATION           SLAPI_REQUESTOR_ISUPDATEDN
230 #define SLAPI_CONN_DN                           143
231 #define SLAPI_CONN_AUTHTYPE                     144
232 #define SLAPI_CONN_CLIENTIP                     145
233 #define SLAPI_CONN_SERVERIP                     146
234 #define SLAPI_X_CONN_CLIENTPATH                 1300
235 #define SLAPI_X_CONN_SERVERPATH                 1301
236 #define SLAPI_X_CONN_IS_UDP                     1302
237
238 #define SLAPD_AUTH_NONE   "none"
239 #define SLAPD_AUTH_SIMPLE "simple"
240 #define SLAPD_AUTH_SSL    "SSL"
241 #define SLAPD_AUTH_SASL   "SASL "
242
243 #define SLAPI_PLUGIN                            3
244 #define SLAPI_PLUGIN_PRIVATE                    4
245 #define SLAPI_PLUGIN_TYPE                       5
246 #define SLAPI_PLUGIN_ARGV                       6
247 #define SLAPI_PLUGIN_ARGC                       7
248 #define SLAPI_PLUGIN_VERSION                    8
249
250 #define SLAPI_PLUGIN_OPRETURN                   9
251 #define SLAPI_PLUGIN_OBJECT                     10
252 #define SLAPI_PLUGIN_DESTROY_FN                 11
253
254 #define SLAPI_PLUGIN_DESCRIPTION                12
255
256 #define SLAPI_PLUGIN_INTOP_RESULT               15
257 #define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES       16
258 #define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS     17
259
260 #define SLAPI_PLUGIN_DB_BIND_FN                 200
261 #define SLAPI_PLUGIN_DB_UNBIND_FN               201
262 #define SLAPI_PLUGIN_DB_SEARCH_FN               202
263 #define SLAPI_PLUGIN_DB_COMPARE_FN              203
264 #define SLAPI_PLUGIN_DB_MODIFY_FN               204
265 #define SLAPI_PLUGIN_DB_MODRDN_FN               205
266 #define SLAPI_PLUGIN_DB_ADD_FN                  206
267 #define SLAPI_PLUGIN_DB_DELETE_FN               207
268 #define SLAPI_PLUGIN_DB_ABANDON_FN              208
269 #define SLAPI_PLUGIN_DB_CONFIG_FN               209
270 #define SLAPI_PLUGIN_CLOSE_FN                   210
271 #define SLAPI_PLUGIN_DB_FLUSH_FN                211
272 #define SLAPI_PLUGIN_START_FN                   212
273 #define SLAPI_PLUGIN_DB_SEQ_FN                  213
274 #define SLAPI_PLUGIN_DB_ENTRY_FN                214
275 #define SLAPI_PLUGIN_DB_REFERRAL_FN             215
276 #define SLAPI_PLUGIN_DB_RESULT_FN               216
277 #define SLAPI_PLUGIN_DB_LDIF2DB_FN              217
278 #define SLAPI_PLUGIN_DB_DB2LDIF_FN              218
279 #define SLAPI_PLUGIN_DB_BEGIN_FN                219
280 #define SLAPI_PLUGIN_DB_COMMIT_FN               220
281 #define SLAPI_PLUGIN_DB_ABORT_FN                221
282 #define SLAPI_PLUGIN_DB_ARCHIVE2DB_FN           222
283 #define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN           223
284 #define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN    224
285 #define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN      225
286 #define SLAPI_PLUGIN_DB_SIZE_FN                 226
287 #define SLAPI_PLUGIN_DB_TEST_FN                 227
288 #define SLAPI_PLUGIN_DB_NO_ACL                  250
289
290 #define SLAPI_PLUGIN_EXT_OP_FN                  300
291 #define SLAPI_PLUGIN_EXT_OP_OIDLIST             301
292 #define SLAPI_PLUGIN_PRE_BIND_FN                401
293 #define SLAPI_PLUGIN_PRE_UNBIND_FN              402
294 #define SLAPI_PLUGIN_PRE_SEARCH_FN              403
295 #define SLAPI_PLUGIN_PRE_COMPARE_FN             404
296 #define SLAPI_PLUGIN_PRE_MODIFY_FN              405
297 #define SLAPI_PLUGIN_PRE_MODRDN_FN              406
298 #define SLAPI_PLUGIN_PRE_ADD_FN                 407
299 #define SLAPI_PLUGIN_PRE_DELETE_FN              408
300 #define SLAPI_PLUGIN_PRE_ABANDON_FN             409
301 #define SLAPI_PLUGIN_PRE_ENTRY_FN               410
302 #define SLAPI_PLUGIN_PRE_REFERRAL_FN            411
303 #define SLAPI_PLUGIN_PRE_RESULT_FN              412
304 #define SLAPI_PLUGIN_POST_BIND_FN               501
305 #define SLAPI_PLUGIN_POST_UNBIND_FN             502
306 #define SLAPI_PLUGIN_POST_SEARCH_FN             503
307 #define SLAPI_PLUGIN_POST_COMPARE_FN            504
308 #define SLAPI_PLUGIN_POST_MODIFY_FN             505
309 #define SLAPI_PLUGIN_POST_MODRDN_FN             506
310 #define SLAPI_PLUGIN_POST_ADD_FN                507
311 #define SLAPI_PLUGIN_POST_DELETE_FN             508
312 #define SLAPI_PLUGIN_POST_ABANDON_FN            509
313 #define SLAPI_PLUGIN_POST_ENTRY_FN              510
314 #define SLAPI_PLUGIN_POST_REFERRAL_FN           511
315 #define SLAPI_PLUGIN_POST_RESULT_FN             512
316
317 #define SLAPI_OPERATION_TYPE                    590
318
319 #define SLAPI_PLUGIN_MR_FILTER_CREATE_FN        600
320 #define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN       601
321 #define SLAPI_PLUGIN_MR_FILTER_MATCH_FN         602
322 #define SLAPI_PLUGIN_MR_FILTER_INDEX_FN         603
323 #define SLAPI_PLUGIN_MR_FILTER_RESET_FN         604
324 #define SLAPI_PLUGIN_MR_INDEX_FN                605
325 #define SLAPI_PLUGIN_MR_OID                     610
326 #define SLAPI_PLUGIN_MR_TYPE                    611
327 #define SLAPI_PLUGIN_MR_VALUE                   612
328 #define SLAPI_PLUGIN_MR_VALUES                  613
329 #define SLAPI_PLUGIN_MR_KEYS                    614
330 #define SLAPI_PLUGIN_MR_FILTER_REUSABLE         615
331 #define SLAPI_PLUGIN_MR_QUERY_OPERATOR          616
332 #define SLAPI_PLUGIN_MR_USAGE                   617
333
334 #define SLAPI_OP_LESS                                   1
335 #define SLAPI_OP_LESS_OR_EQUAL                          2
336 #define SLAPI_OP_EQUAL                                  3
337 #define SLAPI_OP_GREATER_OR_EQUAL                       4
338 #define SLAPI_OP_GREATER                                5
339 #define SLAPI_OP_SUBSTRING                              6
340
341 #define SLAPI_PLUGIN_MR_USAGE_INDEX             0
342 #define SLAPI_PLUGIN_MR_USAGE_SORT              1
343
344 #define SLAPI_MATCHINGRULE_NAME                 1
345 #define SLAPI_MATCHINGRULE_OID                  2
346 #define SLAPI_MATCHINGRULE_DESC                 3
347 #define SLAPI_MATCHINGRULE_SYNTAX               4
348 #define SLAPI_MATCHINGRULE_OBSOLETE             5
349
350 #define SLAPI_PLUGIN_SYNTAX_FILTER_AVA          700
351 #define SLAPI_PLUGIN_SYNTAX_FILTER_SUB          701
352 #define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS         702
353 #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA  703
354 #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB  704
355 #define SLAPI_PLUGIN_SYNTAX_NAMES               705
356 #define SLAPI_PLUGIN_SYNTAX_OID                 706
357 #define SLAPI_PLUGIN_SYNTAX_FLAGS               707
358 #define SLAPI_PLUGIN_SYNTAX_COMPARE             708
359
360 #define SLAPI_OPERATION_AUTHTYPE                741
361 #define SLAPI_OPERATION_ID                      742
362 #define SLAPI_CONN_CERT                         743
363 #define SLAPI_CONN_AUTHMETHOD                   746
364
365 #define SLAPI_RESULT_CODE                       881
366 #define SLAPI_RESULT_TEXT                       882
367 #define SLAPI_RESULT_MATCHED                    883
368
369 #define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS                 1
370 #define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING               2
371
372 #define SLAPI_PLUGIN_AUDIT_DATA                 1100
373 #define SLAPI_PLUGIN_AUDIT_FN                   1101
374
375 /* DS 5.x Computed Attribute Callbacks (not exposed) */
376 #define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN       1200
377 #define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
378
379 #define SLAPI_MANAGEDSAIT                       1000
380
381 #define SLAPI_CONFIG_FILENAME                   40
382 #define SLAPI_CONFIG_LINENO                     41
383 #define SLAPI_CONFIG_ARGC                       42
384 #define SLAPI_CONFIG_ARGV                       43
385
386 #define SLAPI_TARGET_DN                         50
387 #define SLAPI_REQCONTROLS                       51
388
389 #define SLAPI_ENTRY_PRE_OP                      52
390 #define SLAPI_ENTRY_POST_OP                     53
391
392 #define SLAPI_RESCONTROLS                       55
393 #define SLAPI_ADD_RESCONTROL                    56
394
395 #define SLAPI_ADD_TARGET                        SLAPI_TARGET_DN
396 #define SLAPI_ADD_ENTRY                         60
397
398 #define SLAPI_BIND_TARGET                       SLAPI_TARGET_DN
399 #define SLAPI_BIND_METHOD                       70
400 #define SLAPI_BIND_CREDENTIALS                  71
401 #define SLAPI_BIND_SASLMECHANISM                72
402 #define SLAPI_BIND_RET_SASLCREDS                73
403
404 #define SLAPI_COMPARE_TARGET                    SLAPI_TARGET_DN
405 #define SLAPI_COMPARE_TYPE                      80
406 #define SLAPI_COMPARE_VALUE                     81
407
408 #define SLAPI_DELETE_TARGET                     SLAPI_TARGET_DN
409
410 #define SLAPI_MODIFY_TARGET                     SLAPI_TARGET_DN
411 #define SLAPI_MODIFY_MODS                       90
412
413 #define SLAPI_MODRDN_TARGET                     SLAPI_TARGET_DN
414 #define SLAPI_MODRDN_NEWRDN                     100
415 #define SLAPI_MODRDN_DELOLDRDN                  101
416 #define SLAPI_MODRDN_NEWSUPERIOR                102
417
418 #define SLAPI_SEARCH_TARGET                     SLAPI_TARGET_DN
419 #define SLAPI_SEARCH_SCOPE                      110
420 #define SLAPI_SEARCH_DEREF                      111
421 #define SLAPI_SEARCH_SIZELIMIT                  112
422 #define SLAPI_SEARCH_TIMELIMIT                  113
423 #define SLAPI_SEARCH_FILTER                     114
424 #define SLAPI_SEARCH_STRFILTER                  115
425 #define SLAPI_SEARCH_ATTRS                      116
426 #define SLAPI_SEARCH_ATTRSONLY                  117
427
428 #define SLAPI_ABANDON_MSGID                     120
429
430 #define SLAPI_SEQ_TYPE                          150
431 #define SLAPI_SEQ_ATTRNAME                      151
432 #define SLAPI_SEQ_VAL                           152
433
434 #define SLAPI_EXT_OP_REQ_OID                    160
435 #define SLAPI_EXT_OP_REQ_VALUE                  161
436 #define SLAPI_EXT_OP_RET_OID                    162
437 #define SLAPI_EXT_OP_RET_VALUE                  163
438
439 #define SLAPI_MR_FILTER_ENTRY                   170     
440 #define SLAPI_MR_FILTER_TYPE                    171
441 #define SLAPI_MR_FILTER_VALUE                   172
442 #define SLAPI_MR_FILTER_OID                     173
443 #define SLAPI_MR_FILTER_DNATTRS                 174
444
445 #define SLAPI_LDIF2DB_FILE                      180
446 #define SLAPI_LDIF2DB_REMOVEDUPVALS             185
447
448 #define SLAPI_DB2LDIF_PRINTKEY                  183
449
450 #define SLAPI_PARENT_TXN                        190
451 #define SLAPI_TXN                               191
452
453 #define SLAPI_SEARCH_RESULT_SET                 193
454 #define SLAPI_SEARCH_RESULT_ENTRY               194
455 #define SLAPI_NENTRIES                          195
456 #define SLAPI_SEARCH_REFERRALS                  196
457
458 #define SLAPI_CHANGENUMBER                      197
459 #define SLAPI_LOG_OPERATION                     198
460
461 #define SLAPI_DBSIZE                            199
462
463 #define SLAPI_LOG_FATAL                         0
464 #define SLAPI_LOG_TRACE                         1
465 #define SLAPI_LOG_PACKETS                       2
466 #define SLAPI_LOG_ARGS                          3
467 #define SLAPI_LOG_CONNS                         4
468 #define SLAPI_LOG_BER                           5
469 #define SLAPI_LOG_FILTER                        6
470 #define SLAPI_LOG_CONFIG                        7
471 #define SLAPI_LOG_ACL                           8
472 #define SLAPI_LOG_SHELL                         9
473 #define SLAPI_LOG_PARSE                         10
474 #define SLAPI_LOG_HOUSE                         11
475 #define SLAPI_LOG_REPL                          12
476 #define SLAPI_LOG_CACHE                         13
477 #define SLAPI_LOG_PLUGIN                        14
478
479 #define SLAPI_OPERATION_BIND                    0x00000001L
480 #define SLAPI_OPERATION_UNBIND                  0x00000002L
481 #define SLAPI_OPERATION_SEARCH                  0x00000004L
482 #define SLAPI_OPERATION_MODIFY                  0x00000008L
483 #define SLAPI_OPERATION_ADD                     0x00000010L
484 #define SLAPI_OPERATION_DELETE                  0x00000020L
485 #define SLAPI_OPERATION_MODDN                   0x00000040L
486 #define SLAPI_OPERATION_MODRDN                  SLAPI_OPERATION_MODDN
487 #define SLAPI_OPERATION_COMPARE                 0x00000080L
488 #define SLAPI_OPERATION_ABANDON                 0x00000100L
489 #define SLAPI_OPERATION_EXTENDED                0x00000200L
490 #define SLAPI_OPERATION_ANY                     0xFFFFFFFFL
491 #define SLAPI_OPERATION_NONE                    0x00000000L
492
493 LDAP_END_DECL
494
495 #include "proto-slapi.h"
496
497 #endif /* _SLAPI_H */
498