2001-07-15 01:34:24 +08:00
|
|
|
/* back-monitor.h - ldap monitor back-end header file */
|
2003-11-27 10:35:20 +08:00
|
|
|
/* $OpenLDAP$ */
|
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2005-01-02 04:49:32 +08:00
|
|
|
* Copyright 2001-2005 The OpenLDAP Foundation.
|
2003-12-09 01:41:40 +08:00
|
|
|
* Portions Copyright 2001-2003 Pierangelo Masarati.
|
2003-11-27 10:35:20 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted only as authorized by the OpenLDAP
|
|
|
|
* Public License.
|
|
|
|
*
|
|
|
|
* A copy of this license is available in file LICENSE in the
|
|
|
|
* top-level directory of the distribution or, alternatively, at
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
|
|
|
*/
|
|
|
|
/* ACKNOWLEDGEMENTS:
|
|
|
|
* This work was initially developed by Pierangelo Masarati for inclusion
|
|
|
|
* in OpenLDAP Software.
|
2001-07-15 01:34:24 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BACK_MONITOR_H_
|
|
|
|
#define _BACK_MONITOR_H_
|
|
|
|
|
|
|
|
#include <ldap_pvt.h>
|
|
|
|
#include <ldap_pvt_thread.h>
|
2003-03-11 20:26:05 +08:00
|
|
|
#include <avl.h>
|
|
|
|
#include <slap.h>
|
2001-07-15 01:34:24 +08:00
|
|
|
|
|
|
|
LDAP_BEGIN_DECL
|
|
|
|
|
2004-11-13 22:57:39 +08:00
|
|
|
/* define if si_ad_labeledURI is removed from slap_schema */
|
|
|
|
#undef MONITOR_DEFINE_LABELEDURI
|
|
|
|
|
2004-11-09 02:52:27 +08:00
|
|
|
typedef struct monitor_callback_t {
|
2005-04-28 05:30:35 +08:00
|
|
|
int (*mc_update)( Operation *op, SlapReply *rs, Entry *e, void *priv );
|
2004-11-09 02:52:27 +08:00
|
|
|
/* update callback
|
|
|
|
for user-defined entries */
|
2005-04-28 05:30:35 +08:00
|
|
|
int (*mc_modify)( Operation *op, SlapReply *rs, Entry *e, void *priv );
|
2005-04-27 10:43:38 +08:00
|
|
|
/* modify callback
|
|
|
|
for user-defined entries */
|
2005-04-28 05:30:35 +08:00
|
|
|
int (*mc_free)( Entry *e, void *priv );
|
2005-04-27 10:43:38 +08:00
|
|
|
/* update callback
|
|
|
|
for user-defined entries */
|
2005-04-28 05:30:35 +08:00
|
|
|
void *mc_private; /* opaque pointer to
|
2004-11-09 02:52:27 +08:00
|
|
|
private data */
|
|
|
|
struct monitor_callback_t *mc_next;
|
|
|
|
} monitor_callback_t;
|
|
|
|
|
2001-07-15 01:34:24 +08:00
|
|
|
|
2004-11-09 02:52:27 +08:00
|
|
|
typedef struct monitor_entry_t {
|
2001-07-15 01:34:24 +08:00
|
|
|
ldap_pvt_thread_mutex_t mp_mutex; /* entry mutex */
|
|
|
|
Entry *mp_next; /* pointer to next sibling */
|
|
|
|
Entry *mp_children; /* pointer to first child */
|
2004-11-09 02:52:27 +08:00
|
|
|
struct monitor_subsys_t *mp_info; /* subsystem info */
|
2001-07-15 01:34:24 +08:00
|
|
|
#define mp_type mp_info->mss_type
|
2004-11-08 19:33:53 +08:00
|
|
|
unsigned long mp_flags; /* flags */
|
2001-07-15 01:34:24 +08:00
|
|
|
|
2004-11-09 02:52:27 +08:00
|
|
|
#define MONITOR_F_NONE 0x0000U
|
|
|
|
#define MONITOR_F_SUB 0x0001U /* subentry of subsystem */
|
|
|
|
#define MONITOR_F_PERSISTENT 0x0010U /* persistent entry */
|
|
|
|
#define MONITOR_F_PERSISTENT_CH 0x0020U /* subsystem generates
|
2001-07-15 01:34:24 +08:00
|
|
|
persistent entries */
|
2004-11-09 02:52:27 +08:00
|
|
|
#define MONITOR_F_VOLATILE 0x0040U /* volatile entry */
|
|
|
|
#define MONITOR_F_VOLATILE_CH 0x0080U /* subsystem generates
|
2001-07-15 01:34:24 +08:00
|
|
|
volatile entries */
|
2004-11-09 02:52:27 +08:00
|
|
|
#define MONITOR_F_EXTERNAL 0x0100U /* externally added - don't free */
|
2004-11-08 19:33:53 +08:00
|
|
|
/* NOTE: flags with 0xF0000000U mask are reserved for subsystem internals */
|
|
|
|
|
2004-11-09 02:52:27 +08:00
|
|
|
struct monitor_callback_t *mp_cb; /* callback sequence */
|
|
|
|
} monitor_entry_t;
|
2001-07-15 01:34:24 +08:00
|
|
|
|
2004-11-09 02:52:27 +08:00
|
|
|
typedef struct monitor_info_t {
|
2003-04-13 01:41:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Internal data
|
|
|
|
*/
|
2001-07-15 01:34:24 +08:00
|
|
|
Avlnode *mi_cache;
|
|
|
|
ldap_pvt_thread_mutex_t mi_cache_mutex;
|
2003-04-12 08:30:47 +08:00
|
|
|
|
2003-04-13 01:41:49 +08:00
|
|
|
/*
|
|
|
|
* Config parameters
|
|
|
|
*/
|
2004-07-20 05:42:11 +08:00
|
|
|
struct berval mi_startTime; /* don't free it! */
|
|
|
|
struct berval mi_creatorsName; /* don't free it! */
|
2003-04-13 01:41:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Specific schema entities
|
|
|
|
*/
|
2004-11-09 02:52:27 +08:00
|
|
|
ObjectClass *mi_oc_monitor;
|
|
|
|
ObjectClass *mi_oc_monitorServer;
|
|
|
|
ObjectClass *mi_oc_monitorContainer;
|
|
|
|
ObjectClass *mi_oc_monitorCounterObject;
|
|
|
|
ObjectClass *mi_oc_monitorOperation;
|
|
|
|
ObjectClass *mi_oc_monitorConnection;
|
|
|
|
ObjectClass *mi_oc_managedObject;
|
|
|
|
ObjectClass *mi_oc_monitoredObject;
|
|
|
|
|
|
|
|
AttributeDescription *mi_ad_monitoredInfo;
|
|
|
|
AttributeDescription *mi_ad_managedInfo;
|
|
|
|
AttributeDescription *mi_ad_monitorCounter;
|
|
|
|
AttributeDescription *mi_ad_monitorOpCompleted;
|
|
|
|
AttributeDescription *mi_ad_monitorOpInitiated;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionNumber;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionAuthzDN;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionLocalAddress;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionPeerAddress;
|
|
|
|
AttributeDescription *mi_ad_monitorTimestamp;
|
|
|
|
AttributeDescription *mi_ad_monitorOverlay;
|
2005-04-28 01:51:54 +08:00
|
|
|
AttributeDescription *mi_ad_monitorConnectionProtocol;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionOpsReceived;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionOpsExecuting;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionOpsPending;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionOpsCompleted;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionGet;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionRead;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionWrite;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionMask;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionListener;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionPeerDomain;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionStartTime;
|
|
|
|
AttributeDescription *mi_ad_monitorConnectionActivityTime;
|
2005-05-04 17:27:22 +08:00
|
|
|
AttributeDescription *mi_ad_monitorIsShadow;
|
2005-05-21 22:54:11 +08:00
|
|
|
AttributeDescription *mi_ad_monitorUpdateRef;
|
2003-04-13 01:41:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic description attribute
|
|
|
|
*/
|
2004-11-09 02:52:27 +08:00
|
|
|
AttributeDescription *mi_ad_readOnly;
|
|
|
|
AttributeDescription *mi_ad_restrictedOperation;
|
|
|
|
|
|
|
|
void *mi_entry_limbo;
|
|
|
|
} monitor_info_t;
|
2001-07-15 01:34:24 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* DNs
|
|
|
|
*/
|
2004-03-17 05:58:29 +08:00
|
|
|
|
2004-09-13 06:12:58 +08:00
|
|
|
enum {
|
|
|
|
SLAPD_MONITOR_BACKEND = 0,
|
|
|
|
SLAPD_MONITOR_CONN,
|
|
|
|
SLAPD_MONITOR_DATABASE,
|
|
|
|
SLAPD_MONITOR_LISTENER,
|
|
|
|
SLAPD_MONITOR_LOG,
|
|
|
|
SLAPD_MONITOR_OPS,
|
|
|
|
SLAPD_MONITOR_OVERLAY,
|
|
|
|
SLAPD_MONITOR_SASL,
|
|
|
|
SLAPD_MONITOR_SENT,
|
|
|
|
SLAPD_MONITOR_THREAD,
|
|
|
|
SLAPD_MONITOR_TIME,
|
|
|
|
SLAPD_MONITOR_TLS,
|
|
|
|
SLAPD_MONITOR_RWW,
|
|
|
|
|
|
|
|
SLAPD_MONITOR_LAST
|
|
|
|
};
|
2001-07-15 01:34:24 +08:00
|
|
|
|
2004-09-13 06:12:58 +08:00
|
|
|
#define SLAPD_MONITOR_AT "cn"
|
2001-07-15 01:34:24 +08:00
|
|
|
|
|
|
|
#define SLAPD_MONITOR_BACKEND_NAME "Backends"
|
|
|
|
#define SLAPD_MONITOR_BACKEND_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_BACKEND_NAME
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_BACKEND_DN \
|
|
|
|
SLAPD_MONITOR_BACKEND_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_CONN_NAME "Connections"
|
|
|
|
#define SLAPD_MONITOR_CONN_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_CONN_NAME
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_CONN_DN \
|
|
|
|
SLAPD_MONITOR_CONN_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
2004-09-13 06:12:58 +08:00
|
|
|
#define SLAPD_MONITOR_DATABASE_NAME "Databases"
|
|
|
|
#define SLAPD_MONITOR_DATABASE_RDN \
|
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_DATABASE_NAME
|
|
|
|
#define SLAPD_MONITOR_DATABASE_DN \
|
|
|
|
SLAPD_MONITOR_DATABASE_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_LISTENER_NAME "Listeners"
|
|
|
|
#define SLAPD_MONITOR_LISTENER_RDN \
|
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LISTENER_NAME
|
|
|
|
#define SLAPD_MONITOR_LISTENER_DN \
|
|
|
|
SLAPD_MONITOR_LISTENER_RDN "," SLAPD_MONITOR_DN
|
2003-04-13 01:41:49 +08:00
|
|
|
|
2001-12-10 17:50:06 +08:00
|
|
|
#define SLAPD_MONITOR_LOG_NAME "Log"
|
|
|
|
#define SLAPD_MONITOR_LOG_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LOG_NAME
|
2001-12-10 17:50:06 +08:00
|
|
|
#define SLAPD_MONITOR_LOG_DN \
|
|
|
|
SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
2001-12-23 03:14:10 +08:00
|
|
|
#define SLAPD_MONITOR_OPS_NAME "Operations"
|
|
|
|
#define SLAPD_MONITOR_OPS_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OPS_NAME
|
2001-12-23 03:14:10 +08:00
|
|
|
#define SLAPD_MONITOR_OPS_DN \
|
|
|
|
SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
2004-09-13 06:12:58 +08:00
|
|
|
#define SLAPD_MONITOR_OVERLAY_NAME "Overlay"
|
|
|
|
#define SLAPD_MONITOR_OVERLAY_RDN \
|
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OVERLAY_NAME
|
|
|
|
#define SLAPD_MONITOR_OVERLAY_DN \
|
|
|
|
SLAPD_MONITOR_OVERLAY_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_SASL_NAME "SASL"
|
|
|
|
#define SLAPD_MONITOR_SASL_RDN \
|
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SASL_NAME
|
|
|
|
#define SLAPD_MONITOR_SASL_DN \
|
|
|
|
SLAPD_MONITOR_SASL_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
2002-01-29 01:21:52 +08:00
|
|
|
#define SLAPD_MONITOR_SENT_NAME "Statistics"
|
2001-12-23 03:14:10 +08:00
|
|
|
#define SLAPD_MONITOR_SENT_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SENT_NAME
|
2001-12-23 03:14:10 +08:00
|
|
|
#define SLAPD_MONITOR_SENT_DN \
|
|
|
|
SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
2004-09-13 06:12:58 +08:00
|
|
|
#define SLAPD_MONITOR_THREAD_NAME "Threads"
|
|
|
|
#define SLAPD_MONITOR_THREAD_RDN \
|
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_THREAD_NAME
|
|
|
|
#define SLAPD_MONITOR_THREAD_DN \
|
|
|
|
SLAPD_MONITOR_THREAD_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
2002-01-29 20:15:13 +08:00
|
|
|
#define SLAPD_MONITOR_TIME_NAME "Time"
|
|
|
|
#define SLAPD_MONITOR_TIME_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TIME_NAME
|
2002-01-29 20:15:13 +08:00
|
|
|
#define SLAPD_MONITOR_TIME_DN \
|
|
|
|
SLAPD_MONITOR_TIME_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
2004-09-13 06:12:58 +08:00
|
|
|
#define SLAPD_MONITOR_TLS_NAME "TLS"
|
|
|
|
#define SLAPD_MONITOR_TLS_RDN \
|
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TLS_NAME
|
|
|
|
#define SLAPD_MONITOR_TLS_DN \
|
|
|
|
SLAPD_MONITOR_TLS_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_RWW_NAME "Waiters"
|
|
|
|
#define SLAPD_MONITOR_RWW_RDN \
|
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_RWW_NAME
|
|
|
|
#define SLAPD_MONITOR_RWW_DN \
|
|
|
|
SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
|
2004-03-17 05:58:29 +08:00
|
|
|
|
2004-11-09 02:52:27 +08:00
|
|
|
typedef struct monitor_subsys_t {
|
2001-07-15 01:34:24 +08:00
|
|
|
char *mss_name;
|
2002-01-03 02:14:29 +08:00
|
|
|
struct berval mss_rdn;
|
|
|
|
struct berval mss_dn;
|
|
|
|
struct berval mss_ndn;
|
2005-04-30 04:29:59 +08:00
|
|
|
struct berval mss_desc[ 3 ];
|
2001-07-15 01:34:24 +08:00
|
|
|
int mss_flags;
|
2004-11-08 19:33:53 +08:00
|
|
|
#define MONITOR_F_OPENED 0x10000000U
|
2001-07-15 01:34:24 +08:00
|
|
|
|
|
|
|
#define MONITOR_HAS_VOLATILE_CH( mp ) \
|
|
|
|
( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
|
2001-12-22 20:28:02 +08:00
|
|
|
#define MONITOR_HAS_CHILDREN( mp ) \
|
|
|
|
( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
|
2001-07-15 01:34:24 +08:00
|
|
|
|
2001-12-10 17:50:06 +08:00
|
|
|
/* initialize entry and subentries */
|
2004-11-09 02:52:27 +08:00
|
|
|
int ( *mss_open )( BackendDB *, struct monitor_subsys_t *ms );
|
2001-12-10 17:50:06 +08:00
|
|
|
/* update existing dynamic entry and subentries */
|
2005-04-28 05:30:35 +08:00
|
|
|
int ( *mss_update )( Operation *, SlapReply *, Entry * );
|
2001-12-10 17:50:06 +08:00
|
|
|
/* create new dynamic subentries */
|
2005-04-28 05:30:35 +08:00
|
|
|
int ( *mss_create )( Operation *, SlapReply *,
|
2001-12-27 23:16:12 +08:00
|
|
|
struct berval *ndn, Entry *, Entry ** );
|
2001-12-10 17:50:06 +08:00
|
|
|
/* modify entry and subentries */
|
2005-04-28 05:30:35 +08:00
|
|
|
int ( *mss_modify )( Operation *, SlapReply *, Entry * );
|
2004-11-09 02:52:27 +08:00
|
|
|
} monitor_subsys_t;
|
2001-07-15 01:34:24 +08:00
|
|
|
|
2002-01-11 04:12:25 +08:00
|
|
|
extern BackendDB *be_monitor;
|
2001-07-15 01:34:24 +08:00
|
|
|
|
2003-04-19 01:17:18 +08:00
|
|
|
/* increase this bufsize if entries in string form get too big */
|
2005-04-28 01:51:54 +08:00
|
|
|
#define BACKMONITOR_BUFSIZE 8192
|
2003-04-19 01:17:18 +08:00
|
|
|
|
2001-07-15 01:34:24 +08:00
|
|
|
LDAP_END_DECL
|
|
|
|
|
|
|
|
#include "proto-back-monitor.h"
|
|
|
|
|
|
|
|
#endif /* _back_monitor_h_ */
|
|
|
|
|