]> git.sur5r.net Git - openldap/blob - servers/slapd/sets.h
Happy New Year
[openldap] / servers / slapd / sets.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1998-2018 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
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>.
14  */
15
16 #ifndef SLAP_SETS_H_
17 #define SLAP_SETS_H_
18
19 #include <ldap_cdefs.h>
20
21 LDAP_BEGIN_DECL
22
23 typedef struct slap_set_cookie {
24         Operation *set_op;
25 } SetCookie;
26
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.
31  */
32 typedef BerVarray (SLAP_SET_GATHER)( SetCookie *cookie,
33                 struct berval *name, AttributeDescription *ad);
34
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);
39
40 LDAP_SLAPD_F (BerVarray) slap_set_join(SetCookie *cp,
41         BerVarray lset, unsigned op, BerVarray rset);
42
43 #define SLAP_SET_OPMASK         0x00FF
44
45 #define SLAP_SET_REFARR         0x0100
46 #define SLAP_SET_REFVAL         0x0200
47 #define SLAP_SET_REF            (SLAP_SET_REFARR|SLAP_SET_REFVAL)
48
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.
57  */
58
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
63
64 #define SLAP_SET_RREF2REF(r)    ((r) & SLAP_SET_RREFMASK)
65         
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
70         
71 #define SLAP_SET_LREF2REF(r)    (((r) & SLAP_SET_LREFMASK) >> 4)
72         
73 LDAP_END_DECL
74
75 #endif