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-2004 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>
32 typedef struct monitor_callback_t {
33 int (*mc_update)( Operation *op, Entry *e, void *priv );
35 for user-defined entries */
36 void *mc_private; /* opaque pointer to
38 struct monitor_callback_t *mc_next;
42 typedef struct monitor_entry_t {
43 ldap_pvt_thread_mutex_t mp_mutex; /* entry mutex */
44 Entry *mp_next; /* pointer to next sibling */
45 Entry *mp_children; /* pointer to first child */
46 struct monitor_subsys_t *mp_info; /* subsystem info */
47 #define mp_type mp_info->mss_type
48 unsigned long mp_flags; /* flags */
50 #define MONITOR_F_NONE 0x0000U
51 #define MONITOR_F_SUB 0x0001U /* subentry of subsystem */
52 #define MONITOR_F_PERSISTENT 0x0010U /* persistent entry */
53 #define MONITOR_F_PERSISTENT_CH 0x0020U /* subsystem generates
55 #define MONITOR_F_VOLATILE 0x0040U /* volatile entry */
56 #define MONITOR_F_VOLATILE_CH 0x0080U /* subsystem generates
58 #define MONITOR_F_EXTERNAL 0x0100U /* externally added - don't free */
59 /* NOTE: flags with 0xF0000000U mask are reserved for subsystem internals */
61 struct monitor_callback_t *mp_cb; /* callback sequence */
64 typedef struct monitor_info_t {
70 ldap_pvt_thread_mutex_t mi_cache_mutex;
76 struct berval mi_startTime; /* don't free it! */
77 struct berval mi_creatorsName; /* don't free it! */
80 * Specific schema entities
82 ObjectClass *mi_oc_monitor;
83 ObjectClass *mi_oc_monitorServer;
84 ObjectClass *mi_oc_monitorContainer;
85 ObjectClass *mi_oc_monitorCounterObject;
86 ObjectClass *mi_oc_monitorOperation;
87 ObjectClass *mi_oc_monitorConnection;
88 ObjectClass *mi_oc_managedObject;
89 ObjectClass *mi_oc_monitoredObject;
91 AttributeDescription *mi_ad_monitoredInfo;
92 AttributeDescription *mi_ad_managedInfo;
93 AttributeDescription *mi_ad_monitorCounter;
94 AttributeDescription *mi_ad_monitorOpCompleted;
95 AttributeDescription *mi_ad_monitorOpInitiated;
96 AttributeDescription *mi_ad_monitorConnectionNumber;
97 AttributeDescription *mi_ad_monitorConnectionAuthzDN;
98 AttributeDescription *mi_ad_monitorConnectionLocalAddress;
99 AttributeDescription *mi_ad_monitorConnectionPeerAddress;
100 AttributeDescription *mi_ad_monitorTimestamp;
101 AttributeDescription *mi_ad_monitorOverlay;
104 * Generic description attribute
106 AttributeDescription *mi_ad_description;
107 AttributeDescription *mi_ad_seeAlso;
108 AttributeDescription *mi_ad_l;
109 AttributeDescription *mi_ad_labeledURI;
110 AttributeDescription *mi_ad_readOnly;
111 AttributeDescription *mi_ad_restrictedOperation;
113 void *mi_entry_limbo;
121 SLAPD_MONITOR_BACKEND = 0,
123 SLAPD_MONITOR_DATABASE,
124 SLAPD_MONITOR_LISTENER,
127 SLAPD_MONITOR_OVERLAY,
130 SLAPD_MONITOR_THREAD,
138 #define SLAPD_MONITOR_AT "cn"
140 #define SLAPD_MONITOR_BACKEND_NAME "Backends"
141 #define SLAPD_MONITOR_BACKEND_RDN \
142 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_BACKEND_NAME
143 #define SLAPD_MONITOR_BACKEND_DN \
144 SLAPD_MONITOR_BACKEND_RDN "," SLAPD_MONITOR_DN
146 #define SLAPD_MONITOR_CONN_NAME "Connections"
147 #define SLAPD_MONITOR_CONN_RDN \
148 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_CONN_NAME
149 #define SLAPD_MONITOR_CONN_DN \
150 SLAPD_MONITOR_CONN_RDN "," SLAPD_MONITOR_DN
152 #define SLAPD_MONITOR_DATABASE_NAME "Databases"
153 #define SLAPD_MONITOR_DATABASE_RDN \
154 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_DATABASE_NAME
155 #define SLAPD_MONITOR_DATABASE_DN \
156 SLAPD_MONITOR_DATABASE_RDN "," SLAPD_MONITOR_DN
158 #define SLAPD_MONITOR_LISTENER_NAME "Listeners"
159 #define SLAPD_MONITOR_LISTENER_RDN \
160 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LISTENER_NAME
161 #define SLAPD_MONITOR_LISTENER_DN \
162 SLAPD_MONITOR_LISTENER_RDN "," SLAPD_MONITOR_DN
164 #define SLAPD_MONITOR_LOG_NAME "Log"
165 #define SLAPD_MONITOR_LOG_RDN \
166 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LOG_NAME
167 #define SLAPD_MONITOR_LOG_DN \
168 SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
170 #define SLAPD_MONITOR_OPS_NAME "Operations"
171 #define SLAPD_MONITOR_OPS_RDN \
172 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OPS_NAME
173 #define SLAPD_MONITOR_OPS_DN \
174 SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
176 #define SLAPD_MONITOR_OVERLAY_NAME "Overlay"
177 #define SLAPD_MONITOR_OVERLAY_RDN \
178 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OVERLAY_NAME
179 #define SLAPD_MONITOR_OVERLAY_DN \
180 SLAPD_MONITOR_OVERLAY_RDN "," SLAPD_MONITOR_DN
182 #define SLAPD_MONITOR_SASL_NAME "SASL"
183 #define SLAPD_MONITOR_SASL_RDN \
184 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SASL_NAME
185 #define SLAPD_MONITOR_SASL_DN \
186 SLAPD_MONITOR_SASL_RDN "," SLAPD_MONITOR_DN
188 #define SLAPD_MONITOR_SENT_NAME "Statistics"
189 #define SLAPD_MONITOR_SENT_RDN \
190 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SENT_NAME
191 #define SLAPD_MONITOR_SENT_DN \
192 SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
194 #define SLAPD_MONITOR_THREAD_NAME "Threads"
195 #define SLAPD_MONITOR_THREAD_RDN \
196 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_THREAD_NAME
197 #define SLAPD_MONITOR_THREAD_DN \
198 SLAPD_MONITOR_THREAD_RDN "," SLAPD_MONITOR_DN
200 #define SLAPD_MONITOR_TIME_NAME "Time"
201 #define SLAPD_MONITOR_TIME_RDN \
202 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TIME_NAME
203 #define SLAPD_MONITOR_TIME_DN \
204 SLAPD_MONITOR_TIME_RDN "," SLAPD_MONITOR_DN
206 #define SLAPD_MONITOR_TLS_NAME "TLS"
207 #define SLAPD_MONITOR_TLS_RDN \
208 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TLS_NAME
209 #define SLAPD_MONITOR_TLS_DN \
210 SLAPD_MONITOR_TLS_RDN "," SLAPD_MONITOR_DN
212 #define SLAPD_MONITOR_RWW_NAME "Waiters"
213 #define SLAPD_MONITOR_RWW_RDN \
214 SLAPD_MONITOR_AT "=" SLAPD_MONITOR_RWW_NAME
215 #define SLAPD_MONITOR_RWW_DN \
216 SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
218 typedef struct monitor_subsys_t {
220 struct berval mss_rdn;
221 struct berval mss_dn;
222 struct berval mss_ndn;
224 #define MONITOR_F_OPENED 0x10000000U
226 #define MONITOR_HAS_VOLATILE_CH( mp ) \
227 ( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
228 #define MONITOR_HAS_CHILDREN( mp ) \
229 ( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
231 /* initialize entry and subentries */
232 int ( *mss_open )( BackendDB *, struct monitor_subsys_t *ms );
233 /* update existing dynamic entry and subentries */
234 int ( *mss_update )( Operation *, Entry * );
235 /* create new dynamic subentries */
236 int ( *mss_create )( Operation *,
237 struct berval *ndn, Entry *, Entry ** );
238 /* modify entry and subentries */
239 int ( *mss_modify )( Operation *, Entry * );
242 extern BackendDB *be_monitor;
244 /* increase this bufsize if entries in string form get too big */
245 #define BACKMONITOR_BUFSIZE 1024
249 #include "proto-back-monitor.h"
251 #endif /* _back_monitor_h_ */