Back to index

openldap  2.4.31
sets.h
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 1998-2012 The OpenLDAP Foundation.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted only as authorized by the OpenLDAP
00009  * Public License.
00010  *
00011  * A copy of this license is available in the file LICENSE in the
00012  * top-level directory of the distribution or, alternatively, at
00013  * <http://www.OpenLDAP.org/license.html>.
00014  */
00015 
00016 #ifndef SLAP_SETS_H_
00017 #define SLAP_SETS_H_
00018 
00019 #include <ldap_cdefs.h>
00020 
00021 LDAP_BEGIN_DECL
00022 
00023 typedef struct slap_set_cookie {
00024        Operation *set_op;
00025 } SetCookie;
00026 
00027 /* this routine needs to return the bervals instead of
00028  * plain strings, since syntax is not known.  It should
00029  * also return the syntax or some "comparison cookie"
00030  * that is used by set_filter.
00031  */
00032 typedef BerVarray (SLAP_SET_GATHER)( SetCookie *cookie,
00033               struct berval *name, AttributeDescription *ad);
00034 
00035 LDAP_SLAPD_F (int) slap_set_filter(
00036        SLAP_SET_GATHER gatherer,
00037        SetCookie *cookie, struct berval *filter,
00038        struct berval *user, struct berval *target, BerVarray *results);
00039 
00040 LDAP_SLAPD_F (BerVarray) slap_set_join(SetCookie *cp,
00041        BerVarray lset, unsigned op, BerVarray rset);
00042 
00043 #define SLAP_SET_OPMASK            0x00FF
00044 
00045 #define SLAP_SET_REFARR            0x0100
00046 #define SLAP_SET_REFVAL            0x0200
00047 #define SLAP_SET_REF        (SLAP_SET_REFARR|SLAP_SET_REFVAL)
00048 
00049 /* The unsigned "op" can be ORed with the flags below;
00050  * - if the rset's values must not be freed, or must be copied if kept,
00051  *   it is ORed with SLAP_SET_RREFVAL
00052  * - if the rset array must not be freed, or must be copied if kept,
00053  *   it is ORed with SLAP_SET_RREFARR
00054  * - the same applies to the lset with SLAP_SET_LREFVAL and SLAP_SET_LREFARR
00055  * - it is assumed that SLAP_SET_REFVAL implies SLAP_SET_REFARR,
00056  *   i.e. the former is checked only if the latter is set.
00057  */
00058 
00059 #define SLAP_SET_RREFARR    SLAP_SET_REFARR
00060 #define SLAP_SET_RREFVAL    SLAP_SET_REFVAL
00061 #define SLAP_SET_RREF              SLAP_SET_REF
00062 #define SLAP_SET_RREFMASK   0x0F00
00063 
00064 #define SLAP_SET_RREF2REF(r)       ((r) & SLAP_SET_RREFMASK)
00065        
00066 #define SLAP_SET_LREFARR    0x1000
00067 #define SLAP_SET_LREFVAL    0x2000
00068 #define SLAP_SET_LREF              (SLAP_SET_LREFARR|SLAP_SET_LREFVAL)
00069 #define SLAP_SET_LREFMASK   0xF000
00070        
00071 #define SLAP_SET_LREF2REF(r)       (((r) & SLAP_SET_LREFMASK) >> 4)
00072        
00073 LDAP_END_DECL
00074 
00075 #endif