2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2010 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
19 #include <ldap_cdefs.h>
23 typedef struct slap_set_cookie {
27 /* this routine needs to return the bervals instead of
28 * plain strings, since syntax is not known. It should
29 * also return the syntax or some "comparison cookie"
30 * that is used by set_filter.
32 typedef BerVarray (SLAP_SET_GATHER)( SetCookie *cookie,
33 struct berval *name, AttributeDescription *ad);
35 LDAP_SLAPD_F (int) slap_set_filter(
36 SLAP_SET_GATHER gatherer,
37 SetCookie *cookie, struct berval *filter,
38 struct berval *user, struct berval *target, BerVarray *results);
40 LDAP_SLAPD_F (BerVarray) slap_set_join(SetCookie *cp,
41 BerVarray lset, unsigned op, BerVarray rset);
43 #define SLAP_SET_OPMASK 0x00FF
45 #define SLAP_SET_REFARR 0x0100
46 #define SLAP_SET_REFVAL 0x0200
47 #define SLAP_SET_REF (SLAP_SET_REFARR|SLAP_SET_REFVAL)
49 /* The unsigned "op" can be ORed with the flags below;
50 * - if the rset's values must not be freed, or must be copied if kept,
51 * it is ORed with SLAP_SET_RREFVAL
52 * - if the rset array must not be freed, or must be copied if kept,
53 * it is ORed with SLAP_SET_RREFARR
54 * - the same applies to the lset with SLAP_SET_LREFVAL and SLAP_SET_LREFARR
55 * - it is assumed that SLAP_SET_REFVAL implies SLAP_SET_REFARR,
56 * i.e. the former is checked only if the latter is set.
59 #define SLAP_SET_RREFARR SLAP_SET_REFARR
60 #define SLAP_SET_RREFVAL SLAP_SET_REFVAL
61 #define SLAP_SET_RREF SLAP_SET_REF
62 #define SLAP_SET_RREFMASK 0x0F00
64 #define SLAP_SET_RREF2REF(r) ((r) & SLAP_SET_RREFMASK)
66 #define SLAP_SET_LREFARR 0x1000
67 #define SLAP_SET_LREFVAL 0x2000
68 #define SLAP_SET_LREF (SLAP_SET_LREFARR|SLAP_SET_LREFVAL)
69 #define SLAP_SET_LREFMASK 0xF000
71 #define SLAP_SET_LREF2REF(r) (((r) & SLAP_SET_LREFMASK) >> 4)