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