xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/component.h (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: component.h,v 1.3 2021/08/14 16:14:58 christos Exp $	*/
2 
3 /* component.h */
4 /* $OpenLDAP$ */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 2004-2021 The OpenLDAP Foundation.
8  * Portions Copyright 2004 by IBM Corporation.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted only as authorized by the OpenLDAP
13  * Public License.
14  *
15  * A copy of this license is available in the file LICENSE in the
16  * top-level directory of the distribution or, alternatively, at
17  * <http://www.OpenLDAP.org/license.html>.
18  */
19 
20 #ifndef _H_SLAPD_COMPONENT
21 #define _H_SLAPD_COMPONENT
22 
23 #include <sys/cdefs.h>
24 __RCSID("$NetBSD: component.h,v 1.3 2021/08/14 16:14:58 christos Exp $");
25 
26 #include "portable.h"
27 
28 #include <ac/string.h>
29 #include <ac/socket.h>
30 #include <ldap_pvt.h>
31 #include "lutil.h"
32 #include <ldap.h>
33 #include "slap.h"
34 
35 typedef enum { ASN_BASIC, ASN_COMPOSITE } AsnType;
36 /*
37  * Decoder Modes
38  * Different operation is required to handle Decoding(2), Extracted Component
39  * decoding(0), ANY DEFINED TYPe(2)
40  * b0 : Component Alloc(yes)
41  *      Constructed type : Component Alloc (Yes)
42  *      Primitive type : Component Alloc (Yes)
43  *      set to mode 2 in inner decoders
44  * b1 : Component Alloc (No)
45  *      Constructed type : Component Alloc (No)
46  *      Primitive type : Component Alloc (No)
47  *      set to mode 2 in inner decoders
48  * b2 : Default Mode
49  *      Constructed type : Component Alloc (Yes)
50  *      Primitive type : Component Alloc (No)
51  * in addition to above modes, the 4th bit has special meaning,
52  * b4 : if the 4th bit is clear, DecxxxContent is called
53  * b4 : if the 4th bit is set, Decxxx is called, then it is cleared.
54  */
55 #define DEC_ALLOC_MODE_0        0x01
56 #define DEC_ALLOC_MODE_1        0x02
57 #define DEC_ALLOC_MODE_2        0x04
58 #define CALL_TAG_DECODER        0x08
59 #define CALL_CONTENT_DECODER    ~0x08
60 /*
61  * For Attribute Aliasing
62  */
63 #define MAX_ALIASING_ENTRY 128
64 typedef struct comp_attribute_aliasing {
65 	AttributeDescription*	aa_aliasing_ad;
66 	AttributeDescription*	aa_aliased_ad;
67 	ComponentFilter*	aa_cf;
68 	MatchingRule*		aa_mr;
69 	char*			aa_cf_str;
70 } AttributeAliasing;
71 
72 typedef struct comp_matchingrule_aliasing {
73 	MatchingRule*	mra_aliasing_attr;
74 	MatchingRule*	mra_aliased_attr;
75 	AttributeDescription*	mra_attr;
76 	ComponentFilter*	mra_cf;
77 	MatchingRule*		mra_mr;
78 	char*			mra_cf_str;
79 } MatchingRuleAliasing;
80 
81 #endif
82