1 /* back-monitor.h - ldap monitor back-end header file */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2001-2003 The OpenLDAP Foundation.
6 * Portions Copyright 2001-2003 Pierangelo Masarati.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by Pierangelo Masarati for inclusion
19 * in OpenLDAP Software.
22 #ifndef _BACK_MONITOR_H_
23 #define _BACK_MONITOR_H_
26 #include <ldap_pvt_thread.h>
33 * The cache maps DNs to Entries.
34 * Each entry, on turn, holds the list of its children in the e_private field.
35 * This is used by search operation to perform onelevel and subtree candidate
43 struct monitorentrypriv {
44 ldap_pvt_thread_mutex_t mp_mutex; /* entry mutex */
45 Entry *mp_next; /* pointer to next sibling */
46 Entry *mp_children; /* pointer to first child */
47 struct monitorsubsys *mp_info; /* subsystem info */
48 #define mp_type mp_info->mss_type
49 int mp_flags; /* flags */
51 #define MONITOR_F_NONE 0x00
52 #define MONITOR_F_SUB 0x01 /* subentry of subsystem */
53 #define MONITOR_F_PERSISTENT 0x10 /* persistent entry */
54 #define MONITOR_F_PERSISTENT_CH 0x20 /* subsystem generates
56 #define MONITOR_F_VOLATILE 0x40 /* volatile entry */
57 #define MONITOR_F_VOLATILE_CH 0x80 /* subsystem generates
67 ldap_pvt_thread_mutex_t mi_cache_mutex;
73 struct berval mi_startTime; /* don't free it */
76 * Specific schema entities
78 ObjectClass *mi_oc_monitor;
79 ObjectClass *mi_oc_monitorServer;
80 ObjectClass *mi_oc_monitorContainer;
81 ObjectClass *mi_oc_monitorCounterObject;
82 ObjectClass *mi_oc_monitorOperation;
83 ObjectClass *mi_oc_monitorConnection;
84 ObjectClass *mi_oc_managedObject;
85 ObjectClass *mi_oc_monitoredObject;
87 AttributeDescription *mi_ad_monitoredInfo;
88 AttributeDescription *mi_ad_managedInfo;
89 AttributeDescription *mi_ad_monitorCounter;
90 AttributeDescription *mi_ad_monitorOpCompleted;
91 AttributeDescription *mi_ad_monitorOpInitiated;
92 AttributeDescription *mi_ad_monitorConnectionNumber;
93 AttributeDescription *mi_ad_monitorConnectionAuthzDN;
94 AttributeDescription *mi_ad_monitorConnectionLocalAddress;
95 AttributeDescription *mi_ad_monitorConnectionPeerAddress;
96 AttributeDescription *mi_ad_monitorTimestamp;
99 * Generic description attribute
101 AttributeDescription *mi_ad_description;
102 AttributeDescription *mi_ad_seeAlso;
103 AttributeDescription *mi_ad_l;
109 #define SLAPD_MONITOR_LISTENER 0
110 #define SLAPD_MONITOR_LISTENER_NAME "Listeners"
111 #define SLAPD_MONITOR_LISTENER_RDN \
112 "cn=" SLAPD_MONITOR_LISTENER_NAME
113 #define SLAPD_MONITOR_LISTENER_DN \
114 SLAPD_MONITOR_LISTENER_RDN "," SLAPD_MONITOR_DN
116 #define SLAPD_MONITOR_DATABASE 1
117 #define SLAPD_MONITOR_DATABASE_NAME "Databases"
118 #define SLAPD_MONITOR_DATABASE_RDN \
119 "cn=" SLAPD_MONITOR_DATABASE_NAME
120 #define SLAPD_MONITOR_DATABASE_DN \
121 SLAPD_MONITOR_DATABASE_RDN "," SLAPD_MONITOR_DN
123 #define SLAPD_MONITOR_BACKEND 2
124 #define SLAPD_MONITOR_BACKEND_NAME "Backends"
125 #define SLAPD_MONITOR_BACKEND_RDN \
126 "cn=" SLAPD_MONITOR_BACKEND_NAME
127 #define SLAPD_MONITOR_BACKEND_DN \
128 SLAPD_MONITOR_BACKEND_RDN "," SLAPD_MONITOR_DN
130 #define SLAPD_MONITOR_THREAD 3
131 #define SLAPD_MONITOR_THREAD_NAME "Threads"
132 #define SLAPD_MONITOR_THREAD_RDN \
133 "cn=" SLAPD_MONITOR_THREAD_NAME
134 #define SLAPD_MONITOR_THREAD_DN \
135 SLAPD_MONITOR_THREAD_RDN "," SLAPD_MONITOR_DN
137 #define SLAPD_MONITOR_SASL 4
138 #define SLAPD_MONITOR_SASL_NAME "SASL"
139 #define SLAPD_MONITOR_SASL_RDN \
140 "cn=" SLAPD_MONITOR_SASL_NAME
141 #define SLAPD_MONITOR_SASL_DN \
142 SLAPD_MONITOR_SASL_RDN "," SLAPD_MONITOR_DN
144 #define SLAPD_MONITOR_TLS 5
145 #define SLAPD_MONITOR_TLS_NAME "TLS"
146 #define SLAPD_MONITOR_TLS_RDN \
147 "cn=" SLAPD_MONITOR_TLS_NAME
148 #define SLAPD_MONITOR_TLS_DN \
149 SLAPD_MONITOR_TLS_RDN "," SLAPD_MONITOR_DN
151 #define SLAPD_MONITOR_CONN 6
152 #define SLAPD_MONITOR_CONN_NAME "Connections"
153 #define SLAPD_MONITOR_CONN_RDN \
154 "cn=" SLAPD_MONITOR_CONN_NAME
155 #define SLAPD_MONITOR_CONN_DN \
156 SLAPD_MONITOR_CONN_RDN "," SLAPD_MONITOR_DN
158 #define SLAPD_MONITOR_RWW 7
159 #define SLAPD_MONITOR_RWW_NAME "Waiters"
160 #define SLAPD_MONITOR_RWW_RDN \
161 "cn=" SLAPD_MONITOR_RWW_NAME
162 #define SLAPD_MONITOR_RWW_DN \
163 SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
165 #define SLAPD_MONITOR_LOG 8
166 #define SLAPD_MONITOR_LOG_NAME "Log"
167 #define SLAPD_MONITOR_LOG_RDN \
168 "cn=" SLAPD_MONITOR_LOG_NAME
169 #define SLAPD_MONITOR_LOG_DN \
170 SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
172 #define SLAPD_MONITOR_OPS 9
173 #define SLAPD_MONITOR_OPS_NAME "Operations"
174 #define SLAPD_MONITOR_OPS_RDN \
175 "cn=" SLAPD_MONITOR_OPS_NAME
176 #define SLAPD_MONITOR_OPS_DN \
177 SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
179 #define SLAPD_MONITOR_SENT 10
180 #define SLAPD_MONITOR_SENT_NAME "Statistics"
181 #define SLAPD_MONITOR_SENT_RDN \
182 "cn=" SLAPD_MONITOR_SENT_NAME
183 #define SLAPD_MONITOR_SENT_DN \
184 SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
186 #define SLAPD_MONITOR_TIME 11
187 #define SLAPD_MONITOR_TIME_NAME "Time"
188 #define SLAPD_MONITOR_TIME_RDN \
189 "cn=" SLAPD_MONITOR_TIME_NAME
190 #define SLAPD_MONITOR_TIME_DN \
191 SLAPD_MONITOR_TIME_RDN "," SLAPD_MONITOR_DN
193 struct monitorsubsys {
196 struct berval mss_rdn;
197 struct berval mss_dn;
198 struct berval mss_ndn;
201 #define MONITOR_HAS_VOLATILE_CH( mp ) \
202 ( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
203 #define MONITOR_HAS_CHILDREN( mp ) \
204 ( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
206 /* initialize entry and subentries */
207 int ( *mss_init )( BackendDB * );
208 /* update existing dynamic entry and subentries */
209 int ( *mss_update )( Operation *, Entry * );
210 /* create new dynamic subentries */
211 int ( *mss_create )( Operation *,
212 struct berval *ndn, Entry *, Entry ** );
213 /* modify entry and subentries */
214 int ( *mss_modify )( Operation *, Entry * );
217 extern struct monitorsubsys monitor_subsys[];
219 extern BackendDB *be_monitor;
221 /* increase this bufsize if entries in string form get too big */
222 #define BACKMONITOR_BUFSIZE 1024
228 extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
229 extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
230 extern int monitor_cache_add LDAP_P(( struct monitorinfo *mi, Entry *e ));
231 extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
232 extern int monitor_cache_dn2entry LDAP_P(( Operation *op, struct berval *ndn, Entry **ep, Entry **matched ));
233 extern int monitor_cache_lock LDAP_P(( Entry *e ));
234 extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
240 extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
241 extern int monitor_entry_create LDAP_P(( Operation *op, struct berval *ndn,
242 Entry *e_parent, Entry **ep ));
243 extern int monitor_entry_modify LDAP_P(( Operation *op, Entry *e ));
247 #include "proto-back-monitor.h"
249 #endif /* _back_monitor_h_ */