sets.h revision 1.2 1 1.2 christos /* $NetBSD: sets.h,v 1.2 2020/08/11 13:15:39 christos Exp $ */
2 1.2 christos
3 1.2 christos /* $OpenLDAP$ */
4 1.1 lukem /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 1.1 lukem *
6 1.2 christos * Copyright 1998-2020 The OpenLDAP Foundation.
7 1.1 lukem * All rights reserved.
8 1.1 lukem *
9 1.1 lukem * Redistribution and use in source and binary forms, with or without
10 1.1 lukem * modification, are permitted only as authorized by the OpenLDAP
11 1.1 lukem * Public License.
12 1.1 lukem *
13 1.1 lukem * A copy of this license is available in the file LICENSE in the
14 1.1 lukem * top-level directory of the distribution or, alternatively, at
15 1.1 lukem * <http://www.OpenLDAP.org/license.html>.
16 1.1 lukem */
17 1.1 lukem
18 1.1 lukem #ifndef SLAP_SETS_H_
19 1.1 lukem #define SLAP_SETS_H_
20 1.1 lukem
21 1.1 lukem #include <ldap_cdefs.h>
22 1.1 lukem
23 1.1 lukem LDAP_BEGIN_DECL
24 1.1 lukem
25 1.1 lukem typedef struct slap_set_cookie {
26 1.1 lukem Operation *set_op;
27 1.1 lukem } SetCookie;
28 1.1 lukem
29 1.1 lukem /* this routine needs to return the bervals instead of
30 1.1 lukem * plain strings, since syntax is not known. It should
31 1.1 lukem * also return the syntax or some "comparison cookie"
32 1.1 lukem * that is used by set_filter.
33 1.1 lukem */
34 1.1 lukem typedef BerVarray (SLAP_SET_GATHER)( SetCookie *cookie,
35 1.1 lukem struct berval *name, AttributeDescription *ad);
36 1.1 lukem
37 1.1 lukem LDAP_SLAPD_F (int) slap_set_filter(
38 1.1 lukem SLAP_SET_GATHER gatherer,
39 1.1 lukem SetCookie *cookie, struct berval *filter,
40 1.1 lukem struct berval *user, struct berval *target, BerVarray *results);
41 1.1 lukem
42 1.1 lukem LDAP_SLAPD_F (BerVarray) slap_set_join(SetCookie *cp,
43 1.1 lukem BerVarray lset, unsigned op, BerVarray rset);
44 1.1 lukem
45 1.1 lukem #define SLAP_SET_OPMASK 0x00FF
46 1.1 lukem
47 1.1 lukem #define SLAP_SET_REFARR 0x0100
48 1.1 lukem #define SLAP_SET_REFVAL 0x0200
49 1.1 lukem #define SLAP_SET_REF (SLAP_SET_REFARR|SLAP_SET_REFVAL)
50 1.1 lukem
51 1.1 lukem /* The unsigned "op" can be ORed with the flags below;
52 1.1 lukem * - if the rset's values must not be freed, or must be copied if kept,
53 1.1 lukem * it is ORed with SLAP_SET_RREFVAL
54 1.1 lukem * - if the rset array must not be freed, or must be copied if kept,
55 1.1 lukem * it is ORed with SLAP_SET_RREFARR
56 1.1 lukem * - the same applies to the lset with SLAP_SET_LREFVAL and SLAP_SET_LREFARR
57 1.1 lukem * - it is assumed that SLAP_SET_REFVAL implies SLAP_SET_REFARR,
58 1.2 christos * i.e. the former is checked only if the latter is set.
59 1.1 lukem */
60 1.1 lukem
61 1.1 lukem #define SLAP_SET_RREFARR SLAP_SET_REFARR
62 1.1 lukem #define SLAP_SET_RREFVAL SLAP_SET_REFVAL
63 1.1 lukem #define SLAP_SET_RREF SLAP_SET_REF
64 1.1 lukem #define SLAP_SET_RREFMASK 0x0F00
65 1.1 lukem
66 1.1 lukem #define SLAP_SET_RREF2REF(r) ((r) & SLAP_SET_RREFMASK)
67 1.1 lukem
68 1.1 lukem #define SLAP_SET_LREFARR 0x1000
69 1.1 lukem #define SLAP_SET_LREFVAL 0x2000
70 1.1 lukem #define SLAP_SET_LREF (SLAP_SET_LREFARR|SLAP_SET_LREFVAL)
71 1.1 lukem #define SLAP_SET_LREFMASK 0xF000
72 1.1 lukem
73 1.1 lukem #define SLAP_SET_LREF2REF(r) (((r) & SLAP_SET_LREFMASK) >> 4)
74 1.1 lukem
75 1.1 lukem LDAP_END_DECL
76 1.1 lukem
77 1.1 lukem #endif
78