2 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
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.
16 #include <ibm_pblock_params.h>
21 * Quick 'n' dirty to make struct slapi_* in slapi-plugin.h opaque
23 #define slapi_entry slap_entry
24 #define slapi_attr slap_attr
25 #define slapi_value berval
26 #define slapi_valueset berval*
27 #define slapi_filter slap_filter
31 #include <slapi-plugin.h>
39 /* a little naif ... */
48 #if 0 /* unused (yet?) */
49 #define dn_normalize_case dn_normalize
50 #define SLAPD_NO_MEMORY 7
51 #define ANYBODY_STRING "CN=ANYBODY"
53 extern int slap_debug;
56 dn_check(char *, int *);
58 typedef struct strlist {
68 typedef struct _Audit_record Audit_record;
70 #define SLAPI_CONTROL_MANAGEDSAIT_OID LDAP_CONTROL_MANAGEDSAIT
71 #define SLAPI_CONTROL_SORTEDSEARCH_OID LDAP_CONTROL_SORTREQUEST
72 #define SLAPI_CONTROL_PAGED_RESULTS_OID LDAP_CONTROL_PAGEDRESULTS
74 typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb );
76 #if 0 /* unused (yet?) */
77 #define DOMAIN "Domain"
78 #define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
81 typedef struct _slapi_control {
84 unsigned long *s_ctrl_ops;
87 typedef struct _ExtendedOp {
88 struct berval ext_oid;
91 struct _ExtendedOp *ext_next;
94 /* Computed attribute support */
95 struct _computed_attr_context {
96 /* slap_send_search_entry() argblock */
98 AttributeName *cac_attrs;
99 int cac_attrsonly : 1;
100 int cac_userattrs : 1;
102 AccessControlState cac_acl_state;
107 /* for slapi_attr_type_cmp() */
108 #define SLAPI_TYPE_CMP_EXACT 0
109 #define SLAPI_TYPE_CMP_BASE 1
110 #define SLAPI_TYPE_CMP_SUBTYPE 2
114 * Was: slapi_pblock.h
117 #ifndef NO_PBLOCK_CLASS /* where's this test from? */
119 #if 0 /* unused (yet?) */
121 #define CMP_GREATER 1
122 #define CMP_LOWER (-1)
124 #define PBLOCK_ERROR (-1)
125 #define INVALID_PARAM PBLOCK_ERROR
126 #define PBLOCK_MAX_PARAMS 100
128 struct slapi_pblock {
129 ldap_pvt_thread_mutex_t pblockMutex;
132 int curParams[PBLOCK_MAX_PARAMS];
133 void *curVals[PBLOCK_MAX_PARAMS];
136 #endif /* !NO_PBLOCK_CLASS */
142 #define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN)
150 #define OBJECTCLASS "objectclass"
152 #define CHANGE_TIME "changetime"
153 #define CHANGE_TYPE "changetype"
154 #define CHANGE_TARGETDN "targetdn"
155 #define CHANGES "changes"
156 #define CHANGE_NUMBER "changenumber"
158 * FIXME: I get complaints like "ADD" being redefined - first definition
159 * being in "/usr/include/arpa/nameser.h:552"
164 #define DEL "delete: "
166 #define REPLACE "replace: "
169 #define MODRDN "modrdn"
170 #define CHANGE_LOGENTRY "changelogentry"
171 #define IBM_CHANGE_LOGENTRY "ibm-changelog"
172 #define CL_NEWRDN "newrdn"
173 #define CL_DELRDN "deleteoldrdn"
174 #define CHANGE_INITIATOR "ibm-changeInitiatorsName"
176 void slapi_register_changelog_suffix(char *suffix);
177 char **slapi_get_changelog_suffixes();
178 void slapi_update_changelog_counters(long curNum, long numEntries);
179 char *slapi_get_cl_firstNum();
180 char *slapi_get_cl_lastNum();
181 int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix, char *chNum, Operation* op);
182 int slapi_delete_changelog(char *dn, char *suffix, char *chNum, Operation* op);
183 int slapi_modify_changelog(char *dn,LDAPMod *mods,char *suffix, char *chNum, Operation* op);
184 int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn, char *suffix, char *chNum, Operation* op);
185 Backend * slapi_cl_get_be(char *dn);
190 * Attribute flags returned by slapi_attr_get_flags()
192 #define SLAPI_ATTR_FLAG_SINGLE 0x0001
193 #define SLAPI_ATTR_FLAG_OPATTR 0x0002
194 #define SLAPI_ATTR_FLAG_READONLY 0x0004
195 #define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY
196 #define SLAPI_ATTR_FLAG_OBSOLETE 0x0040
197 #define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080
198 #define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100
203 #define SLAPI_ACL_COMPARE 0x01
204 #define SLAPI_ACL_SEARCH 0x02
205 #define SLAPI_ACL_READ 0x04
206 #define SLAPI_ACL_WRITE 0x08
207 #define SLAPI_ACL_DELETE 0x10
208 #define SLAPI_ACL_ADD 0x20
209 #define SLAPI_ACL_SELF 0x40
210 #define SLAPI_ACL_PROXY 0x80
211 #define SLAPI_ACL_ALL 0x7f
214 * Plugin types universally supported by SLAPI
217 #define SLAPI_PLUGIN_DATABASE 1
218 #define SLAPI_PLUGIN_EXTENDEDOP 2
219 #define SLAPI_PLUGIN_PREOPERATION 3
220 #define SLAPI_PLUGIN_POSTOPERATION 4
221 #define SLAPI_PLUGIN_MATCHINGRULE 5
222 #define SLAPI_PLUGIN_SYNTAX 6
223 /* XXX this is SLAPI_PLUGIN_ACL in SunDS */
224 #define SLAPI_PLUGIN_AUDIT 7
226 * The following plugin types are reserved for future
227 * Sun ONE DS compatability.
229 #define SLAPI_PLUGIN_BEPREOPERATION 8
230 #define SLAPI_PLUGIN_BEPOSTOPERATION 9
231 #define SLAPI_PLUGIN_ENTRY 10
232 #define SLAPI_PLUGIN_TYPE_OBJECT 11
233 #define SLAPI_PLUGIN_INTERNAL_PREOPERATION 12
234 #define SLAPI_PLUGIN_INTERNAL_POSTOPERATION 13
235 #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME 14
236 #define SLAPI_PLUGIN_VATTR_SP 15
237 #define SLAPI_PLUGIN_REVER_PWD_STORAGE_SCHEME 16
239 #define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
240 #define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
242 #define SLAPI_BIND_SUCCESS 0
243 #define SLAPI_BIND_FAIL 2
244 #define SLAPI_BIND_ANONYMOUS 3
246 #define SLAPI_BACKEND 130
247 #define SLAPI_CONNECTION 131
248 #define SLAPI_OPERATION 132
249 #define SLAPI_REQUESTOR_ISROOT 133
250 #define SLAPI_BE_MONITORDN 134
251 #define SLAPI_BE_TYPE 135
252 #define SLAPI_BE_READONLY 136
253 #define SLAPI_BE_LASTMOD 137
254 #define SLAPI_OPERATION_PARAMETERS 138
255 #define SLAPI_CONN_ID 139
257 #define SLAPI_OPINITIATED_TIME 140
258 #define SLAPI_REQUESTOR_DN 141
259 #define SLAPI_REQUESTOR_ISUPDATEDN 142
260 #define SLAPI_IS_REPLICATED_OPERATION SLAPI_REQUESTOR_ISUPDATEDN
261 #define SLAPI_CONN_DN 143
262 #define SLAPI_CONN_AUTHTYPE 144
263 #define SLAPI_CONN_CLIENTIP 145
264 #define SLAPI_CONN_SERVERIP 146
265 #define SLAPI_X_CONN_CLIENTPATH 1300
266 #define SLAPI_X_CONN_SERVERPATH 1301
267 #define SLAPI_X_CONN_IS_UDP 1302
269 #define SLAPD_AUTH_NONE "none"
270 #define SLAPD_AUTH_SIMPLE "simple"
271 #define SLAPD_AUTH_SSL "SSL"
272 #define SLAPD_AUTH_SASL "SASL "
274 #define SLAPI_PLUGIN 3
275 #define SLAPI_PLUGIN_PRIVATE 4
276 #define SLAPI_PLUGIN_TYPE 5
277 #define SLAPI_PLUGIN_ARGV 6
278 #define SLAPI_PLUGIN_ARGC 7
279 #define SLAPI_PLUGIN_VERSION 8
281 #define SLAPI_PLUGIN_OPRETURN 9
282 #define SLAPI_PLUGIN_OBJECT 10
283 #define SLAPI_PLUGIN_DESTROY_FN 11
285 #define SLAPI_PLUGIN_DESCRIPTION 12
287 #define SLAPI_PLUGIN_INTOP_RESULT 15
288 #define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
289 #define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
291 #define SLAPI_PLUGIN_DB_BIND_FN 200
292 #define SLAPI_PLUGIN_DB_UNBIND_FN 201
293 #define SLAPI_PLUGIN_DB_SEARCH_FN 202
294 #define SLAPI_PLUGIN_DB_COMPARE_FN 203
295 #define SLAPI_PLUGIN_DB_MODIFY_FN 204
296 #define SLAPI_PLUGIN_DB_MODRDN_FN 205
297 #define SLAPI_PLUGIN_DB_ADD_FN 206
298 #define SLAPI_PLUGIN_DB_DELETE_FN 207
299 #define SLAPI_PLUGIN_DB_ABANDON_FN 208
300 #define SLAPI_PLUGIN_DB_CONFIG_FN 209
301 #define SLAPI_PLUGIN_CLOSE_FN 210
302 #define SLAPI_PLUGIN_DB_FLUSH_FN 211
303 #define SLAPI_PLUGIN_START_FN 212
304 #define SLAPI_PLUGIN_DB_SEQ_FN 213
305 #define SLAPI_PLUGIN_DB_ENTRY_FN 214
306 #define SLAPI_PLUGIN_DB_REFERRAL_FN 215
307 #define SLAPI_PLUGIN_DB_RESULT_FN 216
308 #define SLAPI_PLUGIN_DB_LDIF2DB_FN 217
309 #define SLAPI_PLUGIN_DB_DB2LDIF_FN 218
310 #define SLAPI_PLUGIN_DB_BEGIN_FN 219
311 #define SLAPI_PLUGIN_DB_COMMIT_FN 220
312 #define SLAPI_PLUGIN_DB_ABORT_FN 221
313 #define SLAPI_PLUGIN_DB_ARCHIVE2DB_FN 222
314 #define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN 223
315 #define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN 224
316 #define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN 225
317 #define SLAPI_PLUGIN_DB_SIZE_FN 226
318 #define SLAPI_PLUGIN_DB_TEST_FN 227
319 #define SLAPI_PLUGIN_DB_NO_ACL 250
321 #define SLAPI_PLUGIN_EXT_OP_FN 300
322 #define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
323 #define SLAPI_PLUGIN_PRE_BIND_FN 401
324 #define SLAPI_PLUGIN_PRE_UNBIND_FN 402
325 #define SLAPI_PLUGIN_PRE_SEARCH_FN 403
326 #define SLAPI_PLUGIN_PRE_COMPARE_FN 404
327 #define SLAPI_PLUGIN_PRE_MODIFY_FN 405
328 #define SLAPI_PLUGIN_PRE_MODRDN_FN 406
329 #define SLAPI_PLUGIN_PRE_ADD_FN 407
330 #define SLAPI_PLUGIN_PRE_DELETE_FN 408
331 #define SLAPI_PLUGIN_PRE_ABANDON_FN 409
332 #define SLAPI_PLUGIN_PRE_ENTRY_FN 410
333 #define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
334 #define SLAPI_PLUGIN_PRE_RESULT_FN 412
335 #define SLAPI_PLUGIN_POST_BIND_FN 501
336 #define SLAPI_PLUGIN_POST_UNBIND_FN 502
337 #define SLAPI_PLUGIN_POST_SEARCH_FN 503
338 #define SLAPI_PLUGIN_POST_COMPARE_FN 504
339 #define SLAPI_PLUGIN_POST_MODIFY_FN 505
340 #define SLAPI_PLUGIN_POST_MODRDN_FN 506
341 #define SLAPI_PLUGIN_POST_ADD_FN 507
342 #define SLAPI_PLUGIN_POST_DELETE_FN 508
343 #define SLAPI_PLUGIN_POST_ABANDON_FN 509
344 #define SLAPI_PLUGIN_POST_ENTRY_FN 510
345 #define SLAPI_PLUGIN_POST_REFERRAL_FN 511
346 #define SLAPI_PLUGIN_POST_RESULT_FN 512
348 #define SLAPI_OPERATION_TYPE 590
350 #define SLAPI_PLUGIN_MR_FILTER_CREATE_FN 600
351 #define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN 601
352 #define SLAPI_PLUGIN_MR_FILTER_MATCH_FN 602
353 #define SLAPI_PLUGIN_MR_FILTER_INDEX_FN 603
354 #define SLAPI_PLUGIN_MR_FILTER_RESET_FN 604
355 #define SLAPI_PLUGIN_MR_INDEX_FN 605
356 #define SLAPI_PLUGIN_MR_OID 610
357 #define SLAPI_PLUGIN_MR_TYPE 611
358 #define SLAPI_PLUGIN_MR_VALUE 612
359 #define SLAPI_PLUGIN_MR_VALUES 613
360 #define SLAPI_PLUGIN_MR_KEYS 614
361 #define SLAPI_PLUGIN_MR_FILTER_REUSABLE 615
362 #define SLAPI_PLUGIN_MR_QUERY_OPERATOR 616
363 #define SLAPI_PLUGIN_MR_USAGE 617
365 #define SLAPI_OP_LESS 1
366 #define SLAPI_OP_LESS_OR_EQUAL 2
367 #define SLAPI_OP_EQUAL 3
368 #define SLAPI_OP_GREATER_OR_EQUAL 4
369 #define SLAPI_OP_GREATER 5
370 #define SLAPI_OP_SUBSTRING 6
372 #define SLAPI_PLUGIN_MR_USAGE_INDEX 0
373 #define SLAPI_PLUGIN_MR_USAGE_SORT 1
375 #define SLAPI_MATCHINGRULE_NAME 1
376 #define SLAPI_MATCHINGRULE_OID 2
377 #define SLAPI_MATCHINGRULE_DESC 3
378 #define SLAPI_MATCHINGRULE_SYNTAX 4
379 #define SLAPI_MATCHINGRULE_OBSOLETE 5
381 #define SLAPI_PLUGIN_SYNTAX_FILTER_AVA 700
382 #define SLAPI_PLUGIN_SYNTAX_FILTER_SUB 701
383 #define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS 702
384 #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA 703
385 #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB 704
386 #define SLAPI_PLUGIN_SYNTAX_NAMES 705
387 #define SLAPI_PLUGIN_SYNTAX_OID 706
388 #define SLAPI_PLUGIN_SYNTAX_FLAGS 707
389 #define SLAPI_PLUGIN_SYNTAX_COMPARE 708
391 #define SLAPI_OPERATION_AUTHTYPE 741
392 #define SLAPI_OPERATION_ID 742
393 #define SLAPI_CONN_CERT 743
394 #define SLAPI_CONN_AUTHMETHOD 746
396 #define SLAPI_RESULT_CODE 881
397 #define SLAPI_RESULT_TEXT 882
398 #define SLAPI_RESULT_MATCHED 883
400 #define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS 1
401 #define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING 2
403 #define SLAPI_PLUGIN_AUDIT_DATA 1100
404 #define SLAPI_PLUGIN_AUDIT_FN 1101
406 /* DS 5.x Computed Attribute Callbacks (not exposed) */
407 #define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN 1200
408 #define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
410 #define SLAPI_MANAGEDSAIT 1000
412 #define SLAPI_CONFIG_FILENAME 40
413 #define SLAPI_CONFIG_LINENO 41
414 #define SLAPI_CONFIG_ARGC 42
415 #define SLAPI_CONFIG_ARGV 43
417 #define SLAPI_TARGET_DN 50
418 #define SLAPI_REQCONTROLS 51
420 #define SLAPI_ENTRY_PRE_OP 52
421 #define SLAPI_ENTRY_POST_OP 53
423 #define SLAPI_RESCONTROLS 55
424 #define SLAPI_ADD_RESCONTROL 56
426 #define SLAPI_ADD_TARGET SLAPI_TARGET_DN
427 #define SLAPI_ADD_ENTRY 60
429 #define SLAPI_BIND_TARGET SLAPI_TARGET_DN
430 #define SLAPI_BIND_METHOD 70
431 #define SLAPI_BIND_CREDENTIALS 71
432 #define SLAPI_BIND_SASLMECHANISM 72
433 #define SLAPI_BIND_RET_SASLCREDS 73
435 #define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
436 #define SLAPI_COMPARE_TYPE 80
437 #define SLAPI_COMPARE_VALUE 81
439 #define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
441 #define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
442 #define SLAPI_MODIFY_MODS 90
444 #define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
445 #define SLAPI_MODRDN_NEWRDN 100
446 #define SLAPI_MODRDN_DELOLDRDN 101
447 #define SLAPI_MODRDN_NEWSUPERIOR 102
449 #define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
450 #define SLAPI_SEARCH_SCOPE 110
451 #define SLAPI_SEARCH_DEREF 111
452 #define SLAPI_SEARCH_SIZELIMIT 112
453 #define SLAPI_SEARCH_TIMELIMIT 113
454 #define SLAPI_SEARCH_FILTER 114
455 #define SLAPI_SEARCH_STRFILTER 115
456 #define SLAPI_SEARCH_ATTRS 116
457 #define SLAPI_SEARCH_ATTRSONLY 117
459 #define SLAPI_ABANDON_MSGID 120
461 #define SLAPI_SEQ_TYPE 150
462 #define SLAPI_SEQ_ATTRNAME 151
463 #define SLAPI_SEQ_VAL 152
465 #define SLAPI_EXT_OP_REQ_OID 160
466 #define SLAPI_EXT_OP_REQ_VALUE 161
467 #define SLAPI_EXT_OP_RET_OID 162
468 #define SLAPI_EXT_OP_RET_VALUE 163
470 #define SLAPI_MR_FILTER_ENTRY 170
471 #define SLAPI_MR_FILTER_TYPE 171
472 #define SLAPI_MR_FILTER_VALUE 172
473 #define SLAPI_MR_FILTER_OID 173
474 #define SLAPI_MR_FILTER_DNATTRS 174
476 #define SLAPI_LDIF2DB_FILE 180
477 #define SLAPI_LDIF2DB_REMOVEDUPVALS 185
479 #define SLAPI_DB2LDIF_PRINTKEY 183
481 #define SLAPI_PARENT_TXN 190
482 #define SLAPI_TXN 191
484 #define SLAPI_SEARCH_RESULT_SET 193
485 #define SLAPI_SEARCH_RESULT_ENTRY 194
486 #define SLAPI_NENTRIES 195
487 #define SLAPI_SEARCH_REFERRALS 196
489 #define SLAPI_CHANGENUMBER 197
490 #define SLAPI_LOG_OPERATION 198
492 #define SLAPI_DBSIZE 199
494 #define SLAPI_LOG_FATAL 0
495 #define SLAPI_LOG_TRACE 1
496 #define SLAPI_LOG_PACKETS 2
497 #define SLAPI_LOG_ARGS 3
498 #define SLAPI_LOG_CONNS 4
499 #define SLAPI_LOG_BER 5
500 #define SLAPI_LOG_FILTER 6
501 #define SLAPI_LOG_CONFIG 7
502 #define SLAPI_LOG_ACL 8
503 #define SLAPI_LOG_SHELL 9
504 #define SLAPI_LOG_PARSE 10
505 #define SLAPI_LOG_HOUSE 11
506 #define SLAPI_LOG_REPL 12
507 #define SLAPI_LOG_CACHE 13
508 #define SLAPI_LOG_PLUGIN 14
510 #define SLAPI_OPERATION_BIND 0x00000001L
511 #define SLAPI_OPERATION_UNBIND 0x00000002L
512 #define SLAPI_OPERATION_SEARCH 0x00000004L
513 #define SLAPI_OPERATION_MODIFY 0x00000008L
514 #define SLAPI_OPERATION_ADD 0x00000010L
515 #define SLAPI_OPERATION_DELETE 0x00000020L
516 #define SLAPI_OPERATION_MODDN 0x00000040L
517 #define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
518 #define SLAPI_OPERATION_COMPARE 0x00000080L
519 #define SLAPI_OPERATION_ABANDON 0x00000100L
520 #define SLAPI_OPERATION_EXTENDED 0x00000200L
521 #define SLAPI_OPERATION_ANY 0xFFFFFFFFL
522 #define SLAPI_OPERATION_NONE 0x00000000L
526 #include "proto-slapi.h"
528 #endif /* _SLAPI_H */