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/>.
|
|
|
|
*
|
2004-01-02 03:15:16 +08:00
|
|
|
* Copyright 2001-2004 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
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The cache maps DNs to Entries.
|
|
|
|
* Each entry, on turn, holds the list of its children in the e_private field.
|
|
|
|
* This is used by search operation to perform onelevel and subtree candidate
|
|
|
|
* selection.
|
|
|
|
*/
|
|
|
|
struct monitorcache {
|
2002-04-02 19:51:05 +08:00
|
|
|
struct berval mc_ndn;
|
2001-07-15 01:34:24 +08:00
|
|
|
Entry *mc_e;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct monitorentrypriv {
|
|
|
|
ldap_pvt_thread_mutex_t mp_mutex; /* entry mutex */
|
|
|
|
Entry *mp_next; /* pointer to next sibling */
|
|
|
|
Entry *mp_children; /* pointer to first child */
|
|
|
|
struct monitorsubsys *mp_info; /* subsystem info */
|
|
|
|
#define mp_type mp_info->mss_type
|
|
|
|
int mp_flags; /* flags */
|
|
|
|
|
|
|
|
#define MONITOR_F_NONE 0x00
|
|
|
|
#define MONITOR_F_SUB 0x01 /* subentry of subsystem */
|
|
|
|
#define MONITOR_F_PERSISTENT 0x10 /* persistent entry */
|
|
|
|
#define MONITOR_F_PERSISTENT_CH 0x20 /* subsystem generates
|
|
|
|
persistent entries */
|
|
|
|
#define MONITOR_F_VOLATILE 0x40 /* volatile entry */
|
|
|
|
#define MONITOR_F_VOLATILE_CH 0x80 /* subsystem generates
|
|
|
|
volatile entries */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct monitorinfo {
|
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
|
|
|
|
*/
|
2003-05-15 09:19:30 +08:00
|
|
|
struct berval mi_l;
|
|
|
|
struct berval mi_startTime; /* don't free it */
|
2003-04-13 01:41:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Specific schema entities
|
|
|
|
*/
|
2003-05-18 01:19:16 +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;
|
2003-04-13 01:41:49 +08:00
|
|
|
|
2003-05-18 01:19:16 +08:00
|
|
|
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;
|
2004-03-16 09:22:34 +08:00
|
|
|
AttributeDescription *mi_ad_monitorOverlay;
|
2003-04-13 01:41:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic description attribute
|
|
|
|
*/
|
2003-05-18 01:19:16 +08:00
|
|
|
AttributeDescription *mi_ad_description;
|
|
|
|
AttributeDescription *mi_ad_seeAlso;
|
|
|
|
AttributeDescription *mi_ad_l;
|
2004-03-18 06:37:40 +08:00
|
|
|
AttributeDescription *mi_ad_labeledURI;
|
2001-07-15 01:34:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DNs
|
|
|
|
*/
|
2004-03-17 05:58:29 +08:00
|
|
|
|
|
|
|
#define SLAPD_MONITOR_AT "cn"
|
|
|
|
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_LISTENER 0
|
2002-01-29 01:21:52 +08:00
|
|
|
#define SLAPD_MONITOR_LISTENER_NAME "Listeners"
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_LISTENER_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LISTENER_NAME
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_LISTENER_DN \
|
|
|
|
SLAPD_MONITOR_LISTENER_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_DATABASE 1
|
|
|
|
#define SLAPD_MONITOR_DATABASE_NAME "Databases"
|
|
|
|
#define SLAPD_MONITOR_DATABASE_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_DATABASE_NAME
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_DATABASE_DN \
|
|
|
|
SLAPD_MONITOR_DATABASE_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_BACKEND 2
|
|
|
|
#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_THREAD 3
|
|
|
|
#define SLAPD_MONITOR_THREAD_NAME "Threads"
|
|
|
|
#define SLAPD_MONITOR_THREAD_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_THREAD_NAME
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_THREAD_DN \
|
|
|
|
SLAPD_MONITOR_THREAD_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_SASL 4
|
|
|
|
#define SLAPD_MONITOR_SASL_NAME "SASL"
|
|
|
|
#define SLAPD_MONITOR_SASL_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SASL_NAME
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_SASL_DN \
|
|
|
|
SLAPD_MONITOR_SASL_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_TLS 5
|
|
|
|
#define SLAPD_MONITOR_TLS_NAME "TLS"
|
|
|
|
#define SLAPD_MONITOR_TLS_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TLS_NAME
|
2001-07-15 01:34:24 +08:00
|
|
|
#define SLAPD_MONITOR_TLS_DN \
|
|
|
|
SLAPD_MONITOR_TLS_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_CONN 6
|
|
|
|
#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
|
|
|
|
|
2003-04-13 01:41:49 +08:00
|
|
|
#define SLAPD_MONITOR_RWW 7
|
|
|
|
#define SLAPD_MONITOR_RWW_NAME "Waiters"
|
|
|
|
#define SLAPD_MONITOR_RWW_RDN \
|
2004-03-17 05:58:29 +08:00
|
|
|
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_RWW_NAME
|
2003-04-13 01:41:49 +08:00
|
|
|
#define SLAPD_MONITOR_RWW_DN \
|
|
|
|
SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
|
|
|
|
|
|
|
|
#define SLAPD_MONITOR_LOG 8
|
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
|
|
|
|
|
2003-04-13 01:41:49 +08:00
|
|
|
#define SLAPD_MONITOR_OPS 9
|
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
|
|
|
|
|
2003-04-13 01:41:49 +08:00
|
|
|
#define SLAPD_MONITOR_SENT 10
|
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
|
|
|
|
|
2003-04-13 01:41:49 +08:00
|
|
|
#define SLAPD_MONITOR_TIME 11
|
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-03-17 05:58:29 +08:00
|
|
|
#define SLAPD_MONITOR_OVERLAY 12
|
|
|
|
#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
|
|
|
|
|
2001-07-15 01:34:24 +08:00
|
|
|
struct monitorsubsys {
|
|
|
|
int mss_type;
|
|
|
|
char *mss_name;
|
2002-01-03 02:14:29 +08:00
|
|
|
struct berval mss_rdn;
|
|
|
|
struct berval mss_dn;
|
|
|
|
struct berval mss_ndn;
|
2001-07-15 01:34:24 +08:00
|
|
|
int mss_flags;
|
|
|
|
|
|
|
|
#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 */
|
2001-07-15 01:34:24 +08:00
|
|
|
int ( *mss_init )( BackendDB * );
|
2001-12-10 17:50:06 +08:00
|
|
|
/* update existing dynamic entry and subentries */
|
2003-04-12 07:08:16 +08:00
|
|
|
int ( *mss_update )( Operation *, Entry * );
|
2001-12-10 17:50:06 +08:00
|
|
|
/* create new dynamic subentries */
|
2003-04-12 07:08:16 +08:00
|
|
|
int ( *mss_create )( Operation *,
|
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 */
|
2003-04-12 09:17:05 +08:00
|
|
|
int ( *mss_modify )( Operation *, Entry * );
|
2001-07-15 01:34:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct monitorsubsys monitor_subsys[];
|
|
|
|
|
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 */
|
|
|
|
#define BACKMONITOR_BUFSIZE 1024
|
|
|
|
|
2001-07-15 01:34:24 +08:00
|
|
|
/*
|
|
|
|
* cache
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
|
|
|
|
extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
|
|
|
|
extern int monitor_cache_add LDAP_P(( struct monitorinfo *mi, Entry *e ));
|
2001-12-27 23:16:12 +08:00
|
|
|
extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
|
2003-04-12 09:17:05 +08:00
|
|
|
extern int monitor_cache_dn2entry LDAP_P(( Operation *op, struct berval *ndn, Entry **ep, Entry **matched ));
|
2001-07-15 01:34:24 +08:00
|
|
|
extern int monitor_cache_lock LDAP_P(( Entry *e ));
|
|
|
|
extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* update
|
|
|
|
*/
|
|
|
|
|
2003-04-12 07:08:16 +08:00
|
|
|
extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
|
2003-04-12 09:17:05 +08:00
|
|
|
extern int monitor_entry_create LDAP_P(( Operation *op, struct berval *ndn,
|
|
|
|
Entry *e_parent, Entry **ep ));
|
|
|
|
extern int monitor_entry_modify LDAP_P(( Operation *op, Entry *e ));
|
2001-07-15 01:34:24 +08:00
|
|
|
|
|
|
|
LDAP_END_DECL
|
|
|
|
|
|
|
|
#include "proto-back-monitor.h"
|
|
|
|
|
|
|
|
#endif /* _back_monitor_h_ */
|
|
|
|
|