1 /* back-monitor.h - ldap monitor back-end header file */
3 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
9 * This work has beed deveolped for the OpenLDAP Foundation
10 * in the hope that it may be useful to the Open Source community,
11 * but WITHOUT ANY WARRANTY.
13 * Permission is granted to anyone to use this software for any purpose
14 * on any computer system, and to alter it and redistribute it, subject
15 * to the following restrictions:
17 * 1. The author and SysNet s.n.c. are not responsible for the consequences
18 * of use of this software, no matter how awful, even if they arise from
21 * 2. The origin of this software must not be misrepresented, either by
22 * explicit claim or by omission. Since few users ever read sources,
23 * credits should appear in the documentation.
25 * 3. Altered versions must be plainly marked as such, and must not be
26 * misrepresented as being the original software. Since few users
27 * ever read sources, credits should appear in the documentation.
28 * SysNet s.n.c. cannot be responsible for the consequences of the
31 * 4. This notice may not be removed or altered.
34 #ifndef _BACK_MONITOR_H_
35 #define _BACK_MONITOR_H_
40 #include <ldap_pvt_thread.h>
45 * The cache maps DNs to Entries.
46 * Each entry, on turn, holds the list of its children in the e_private field.
47 * This is used by search operation to perform onelevel and subtree candidate
51 struct berval *mc_ndn;
55 struct monitorentrypriv {
56 ldap_pvt_thread_mutex_t mp_mutex; /* entry mutex */
57 Entry *mp_next; /* pointer to next sibling */
58 Entry *mp_children; /* pointer to first child */
59 struct monitorsubsys *mp_info; /* subsystem info */
60 #define mp_type mp_info->mss_type
61 int mp_flags; /* flags */
63 #define MONITOR_F_NONE 0x00
64 #define MONITOR_F_SUB 0x01 /* subentry of subsystem */
65 #define MONITOR_F_PERSISTENT 0x10 /* persistent entry */
66 #define MONITOR_F_PERSISTENT_CH 0x20 /* subsystem generates
68 #define MONITOR_F_VOLATILE 0x40 /* volatile entry */
69 #define MONITOR_F_VOLATILE_CH 0x80 /* subsystem generates
75 ldap_pvt_thread_mutex_t mi_cache_mutex;
81 #define SLAPD_MONITOR_LISTENER 0
82 #define SLAPD_MONITOR_LISTENER_NAME "Listener"
83 #define SLAPD_MONITOR_LISTENER_RDN \
84 "cn=" SLAPD_MONITOR_LISTENER_NAME
85 #define SLAPD_MONITOR_LISTENER_DN \
86 SLAPD_MONITOR_LISTENER_RDN "," SLAPD_MONITOR_DN
88 #define SLAPD_MONITOR_DATABASE 1
89 #define SLAPD_MONITOR_DATABASE_NAME "Databases"
90 #define SLAPD_MONITOR_DATABASE_RDN \
91 "cn=" SLAPD_MONITOR_DATABASE_NAME
92 #define SLAPD_MONITOR_DATABASE_DN \
93 SLAPD_MONITOR_DATABASE_RDN "," SLAPD_MONITOR_DN
95 #define SLAPD_MONITOR_BACKEND 2
96 #define SLAPD_MONITOR_BACKEND_NAME "Backends"
97 #define SLAPD_MONITOR_BACKEND_RDN \
98 "cn=" SLAPD_MONITOR_BACKEND_NAME
99 #define SLAPD_MONITOR_BACKEND_DN \
100 SLAPD_MONITOR_BACKEND_RDN "," SLAPD_MONITOR_DN
102 #define SLAPD_MONITOR_THREAD 3
103 #define SLAPD_MONITOR_THREAD_NAME "Threads"
104 #define SLAPD_MONITOR_THREAD_RDN \
105 "cn=" SLAPD_MONITOR_THREAD_NAME
106 #define SLAPD_MONITOR_THREAD_DN \
107 SLAPD_MONITOR_THREAD_RDN "," SLAPD_MONITOR_DN
109 #define SLAPD_MONITOR_SASL 4
110 #define SLAPD_MONITOR_SASL_NAME "SASL"
111 #define SLAPD_MONITOR_SASL_RDN \
112 "cn=" SLAPD_MONITOR_SASL_NAME
113 #define SLAPD_MONITOR_SASL_DN \
114 SLAPD_MONITOR_SASL_RDN "," SLAPD_MONITOR_DN
116 #define SLAPD_MONITOR_TLS 5
117 #define SLAPD_MONITOR_TLS_NAME "TLS"
118 #define SLAPD_MONITOR_TLS_RDN \
119 "cn=" SLAPD_MONITOR_TLS_NAME
120 #define SLAPD_MONITOR_TLS_DN \
121 SLAPD_MONITOR_TLS_RDN "," SLAPD_MONITOR_DN
123 #define SLAPD_MONITOR_CONN 6
124 #define SLAPD_MONITOR_CONN_NAME "Connections"
125 #define SLAPD_MONITOR_CONN_RDN \
126 "cn=" SLAPD_MONITOR_CONN_NAME
127 #define SLAPD_MONITOR_CONN_DN \
128 SLAPD_MONITOR_CONN_RDN "," SLAPD_MONITOR_DN
130 #define SLAPD_MONITOR_READW 7
131 #define SLAPD_MONITOR_READW_NAME "Read Waiters"
132 #define SLAPD_MONITOR_READW_RDN \
133 "cn=" SLAPD_MONITOR_READW_NAME
134 #define SLAPD_MONITOR_READW_DN \
135 SLAPD_MONITOR_READW_RDN "," SLAPD_MONITOR_DN
137 #define SLAPD_MONITOR_WRITEW 8
138 #define SLAPD_MONITOR_WRITEW_NAME "Write Waiters"
139 #define SLAPD_MONITOR_WRITEW_RDN \
140 "cn=" SLAPD_MONITOR_WRITEW_NAME
141 #define SLAPD_MONITOR_WRITEW_DN \
142 SLAPD_MONITOR_WRITEW_RDN "," SLAPD_MONITOR_DN
144 #define SLAPD_MONITOR_LOG 9
145 #define SLAPD_MONITOR_LOG_NAME "Log"
146 #define SLAPD_MONITOR_LOG_RDN \
147 "cn=" SLAPD_MONITOR_LOG_NAME
148 #define SLAPD_MONITOR_LOG_DN \
149 SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
151 #define SLAPD_MONITOR_OPS 10
152 #define SLAPD_MONITOR_OPS_NAME "Operations"
153 #define SLAPD_MONITOR_OPS_RDN \
154 "cn=" SLAPD_MONITOR_OPS_NAME
155 #define SLAPD_MONITOR_OPS_DN \
156 SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
158 #define SLAPD_MONITOR_SENT 11
159 #define SLAPD_MONITOR_SENT_NAME "Sent"
160 #define SLAPD_MONITOR_SENT_RDN \
161 "cn=" SLAPD_MONITOR_SENT_NAME
162 #define SLAPD_MONITOR_SENT_DN \
163 SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
165 struct monitorsubsys {
168 struct berval mss_rdn;
169 struct berval mss_dn;
170 struct berval mss_ndn;
173 #define MONITOR_HAS_VOLATILE_CH( mp ) \
174 ( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
175 #define MONITOR_HAS_CHILDREN( mp ) \
176 ( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
178 /* initialize entry and subentries */
179 int ( *mss_init )( BackendDB * );
180 /* update existing dynamic entry and subentries */
181 int ( *mss_update )( struct monitorinfo *, Entry * );
182 /* create new dynamic subentries */
183 int ( *mss_create )( struct monitorinfo *,
184 struct berval *ndn, Entry *, Entry ** );
185 /* modify entry and subentries */
186 int ( *mss_modify )( struct monitorinfo *, Entry *,
187 Modifications *modlist );
190 extern struct monitorsubsys monitor_subsys[];
192 extern AttributeDescription *monitor_ad_desc;
198 extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
199 extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
200 extern int monitor_cache_add LDAP_P(( struct monitorinfo *mi, Entry *e ));
201 extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
202 extern int monitor_cache_dn2entry LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep, Entry **matched ));
203 extern int monitor_cache_lock LDAP_P(( Entry *e ));
204 extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
210 extern int monitor_entry_update LDAP_P(( struct monitorinfo *mi, Entry *e ));
211 extern int monitor_entry_create LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry *e_parent, Entry **ep ));
212 extern int monitor_entry_modify LDAP_P(( struct monitorinfo *mi, Entry *e, Modifications *modlist ));
216 #include "proto-back-monitor.h"
218 #endif /* _back_monitor_h_ */