allow to register entries and entry callbacks; radical namespace cleanup

This commit is contained in:
Pierangelo Masarati 2004-11-08 18:52:27 +00:00
parent c8fd4a203b
commit 70884b8860
21 changed files with 508 additions and 323 deletions

View File

@ -29,43 +29,39 @@
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 {
struct berval mc_ndn;
Entry *mc_e;
};
typedef struct monitor_callback_t {
int (*mc_update)( Operation *op, Entry *e, void *priv );
/* update callback
for user-defined entries */
void *mc_private; /* opaque pointer to
private data */
struct monitor_callback_t *mc_next;
} monitor_callback_t;
struct monitorentrypriv {
typedef struct monitor_entry_t {
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 */
struct monitor_subsys_t *mp_info; /* subsystem info */
#define mp_type mp_info->mss_type
unsigned long mp_flags; /* flags */
#define MONITOR_F_NONE 0x00U
#define MONITOR_F_SUB 0x01U /* subentry of subsystem */
#define MONITOR_F_PERSISTENT 0x10U /* persistent entry */
#define MONITOR_F_PERSISTENT_CH 0x20U /* subsystem generates
#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
persistent entries */
#define MONITOR_F_VOLATILE 0x40U /* volatile entry */
#define MONITOR_F_VOLATILE_CH 0x80U /* subsystem generates
#define MONITOR_F_VOLATILE 0x0040U /* volatile entry */
#define MONITOR_F_VOLATILE_CH 0x0080U /* subsystem generates
volatile entries */
#define MONITOR_F_EXTERNAL 0x0100U /* externally added - don't free */
/* NOTE: flags with 0xF0000000U mask are reserved for subsystem internals */
int (*mp_update)( Operation *op, Entry *e );
/* update callback
for user-defined entries */
void *mp_private; /* opaque pointer to
private data */
};
struct monitor_callback_t *mp_cb; /* callback sequence */
} monitor_entry_t;
struct monitorinfo {
typedef struct monitor_info_t {
/*
* Internal data
@ -83,37 +79,39 @@ struct monitorinfo {
/*
* Specific schema entities
*/
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;
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;
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;
/*
* Generic description attribute
*/
AttributeDescription *mi_ad_description;
AttributeDescription *mi_ad_seeAlso;
AttributeDescription *mi_ad_l;
AttributeDescription *mi_ad_labeledURI;
AttributeDescription *mi_ad_readOnly;
AttributeDescription *mi_ad_restrictedOperation;
};
AttributeDescription *mi_ad_description;
AttributeDescription *mi_ad_seeAlso;
AttributeDescription *mi_ad_l;
AttributeDescription *mi_ad_labeledURI;
AttributeDescription *mi_ad_readOnly;
AttributeDescription *mi_ad_restrictedOperation;
void *mi_entry_limbo;
} monitor_info_t;
/*
* DNs
@ -217,7 +215,7 @@ enum {
#define SLAPD_MONITOR_RWW_DN \
SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
typedef struct monitorsubsys {
typedef struct monitor_subsys_t {
char *mss_name;
struct berval mss_rdn;
struct berval mss_dn;
@ -231,7 +229,7 @@ typedef struct monitorsubsys {
( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
/* initialize entry and subentries */
int ( *mss_open )( BackendDB *, struct monitorsubsys *ms );
int ( *mss_open )( BackendDB *, struct monitor_subsys_t *ms );
/* update existing dynamic entry and subentries */
int ( *mss_update )( Operation *, Entry * );
/* create new dynamic subentries */
@ -239,7 +237,7 @@ typedef struct monitorsubsys {
struct berval *ndn, Entry *, Entry ** );
/* modify entry and subentries */
int ( *mss_modify )( Operation *, Entry * );
} monitorsubsys;
} monitor_subsys_t;
extern BackendDB *be_monitor;

View File

@ -33,17 +33,17 @@
*/
int
monitor_subsys_backend_init(
BackendDB *be,
monitorsubsys *ms
BackendDB *be,
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
monitor_info_t *mi;
Entry *e_backend, **ep;
int i;
struct monitorentrypriv *mp;
monitorsubsys *ms_database;
monitor_entry_t *mp;
monitor_subsys_t *ms_database;
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
ms_database = monitor_back_get_subsys( SLAPD_MONITOR_DATABASE_NAME );
if ( ms_database == NULL ) {
@ -65,7 +65,7 @@ monitor_subsys_backend_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_backend->e_private;
mp = ( monitor_entry_t * )e_backend->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;

View File

@ -34,8 +34,8 @@ int
monitor_back_bind( Operation *op, SlapReply *rs )
{
#if 0 /* not used yet */
struct monitorinfo *mi
= (struct monitorinfo *) op->o_bd->be_private;
monitor_info_t *mi
= (monitor_info_t *) op->o_bd->be_private;
#endif
Debug(LDAP_DEBUG_ARGS, "==> monitor_back_bind: dn: %s\n",

View File

@ -28,17 +28,28 @@
#include "back-monitor.h"
/*
* 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.
*/
typedef struct monitor_cache_t {
struct berval mc_ndn;
Entry *mc_e;
} monitor_cache_t;
/*
* compares entries based on the dn
*/
int
monitor_cache_cmp(
const void *c1,
const void *c2
const void *c1,
const void *c2
)
{
struct monitorcache *cc1 = ( struct monitorcache * )c1;
struct monitorcache *cc2 = ( struct monitorcache * )c2;
monitor_cache_t *cc1 = ( monitor_cache_t * )c1;
monitor_cache_t *cc2 = ( monitor_cache_t * )c2;
/*
* case sensitive, because the dn MUST be normalized
@ -51,12 +62,12 @@ monitor_cache_cmp(
*/
int
monitor_cache_dup(
void *c1,
void *c2
void *c1,
void *c2
)
{
struct monitorcache *cc1 = ( struct monitorcache * )c1;
struct monitorcache *cc2 = ( struct monitorcache * )c2;
monitor_cache_t *cc1 = ( monitor_cache_t * )c1;
monitor_cache_t *cc2 = ( monitor_cache_t * )c2;
/*
* case sensitive, because the dn MUST be normalized
@ -69,21 +80,21 @@ monitor_cache_dup(
*/
int
monitor_cache_add(
struct monitorinfo *mi,
Entry *e
monitor_info_t *mi,
Entry *e
)
{
struct monitorcache *mc;
struct monitorentrypriv *mp;
int rc;
monitor_cache_t *mc;
monitor_entry_t *mp;
int rc;
assert( mi != NULL );
assert( e != NULL );
mp = ( struct monitorentrypriv *)e->e_private;
mp = ( monitor_entry_t *)e->e_private;
ldap_pvt_thread_mutex_init( &mp->mp_mutex );
mc = ( struct monitorcache * )ch_malloc( sizeof( struct monitorcache ) );
mc = ( monitor_cache_t * )ch_malloc( sizeof( monitor_cache_t ) );
mc->mc_ndn = e->e_nname;
mc->mc_e = e;
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
@ -99,15 +110,15 @@ monitor_cache_add(
*/
int
monitor_cache_lock(
Entry *e
Entry *e
)
{
struct monitorentrypriv *mp;
monitor_entry_t *mp;
assert( e != NULL );
assert( e->e_private != NULL );
mp = ( struct monitorentrypriv * )e->e_private;
mp = ( monitor_entry_t * )e->e_private;
ldap_pvt_thread_mutex_lock( &mp->mp_mutex );
return( 0 );
@ -119,12 +130,12 @@ monitor_cache_lock(
*/
int
monitor_cache_get(
struct monitorinfo *mi,
struct berval *ndn,
Entry **ep
monitor_info_t *mi,
struct berval *ndn,
Entry **ep
)
{
struct monitorcache tmp_mc, *mc;
monitor_cache_t tmp_mc, *mc;
assert( mi != NULL );
assert( ndn != NULL );
@ -132,7 +143,7 @@ monitor_cache_get(
tmp_mc.mc_ndn = *ndn;
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
mc = ( struct monitorcache * )avl_find( mi->mi_cache,
mc = ( monitor_cache_t * )avl_find( mi->mi_cache,
( caddr_t )&tmp_mc, monitor_cache_cmp );
if ( mc != NULL ) {
@ -164,11 +175,11 @@ monitor_cache_dn2entry(
Entry **matched
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
int rc;
struct berval p_ndn = BER_BVNULL;
Entry *e_parent;
struct monitorentrypriv *mp;
monitor_entry_t *mp;
assert( mi != NULL );
assert( ndn != NULL );
@ -195,7 +206,7 @@ monitor_cache_dn2entry(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_parent->e_private;
mp = ( monitor_entry_t * )e_parent->e_private;
rc = -1;
if ( mp->mp_flags & MONITOR_F_VOLATILE_CH ) {
/* parent entry generates volatile children */
@ -217,20 +228,20 @@ monitor_cache_dn2entry(
*/
int
monitor_cache_release(
struct monitorinfo *mi,
Entry *e
monitor_info_t *mi,
Entry *e
)
{
struct monitorentrypriv *mp;
monitor_entry_t *mp;
assert( mi != NULL );
assert( e != NULL );
assert( e->e_private != NULL );
mp = ( struct monitorentrypriv * )e->e_private;
mp = ( monitor_entry_t * )e->e_private;
if ( mp->mp_flags & MONITOR_F_VOLATILE ) {
struct monitorcache *mc, tmp_mc;
monitor_cache_t *mc, tmp_mc;
/* volatile entries do not return to cache */
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );

View File

@ -29,8 +29,7 @@
int
monitor_back_compare( struct slap_op *op, struct slap_rep *rs)
{
struct monitorinfo *mi =
(struct monitorinfo *) op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * ) op->o_bd->be_private;
Entry *e, *matched = NULL;
Attribute *a;

View File

@ -31,19 +31,18 @@
int
monitor_subsys_conn_init(
BackendDB *be,
monitorsubsys *ms
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
Entry *e, **ep, *e_conn;
struct monitorentrypriv *mp;
char buf[ BACKMONITOR_BUFSIZE ];
struct berval bv;
monitor_info_t *mi;
Entry *e, **ep, *e_conn;
monitor_entry_t *mp;
char buf[ BACKMONITOR_BUFSIZE ];
struct berval bv;
assert( be != NULL );
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_conn ) ) {
Debug( LDAP_DEBUG_ANY,
@ -53,7 +52,7 @@ monitor_subsys_conn_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_conn->e_private;
mp = ( monitor_entry_t * )e_conn->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;
@ -174,8 +173,7 @@ monitor_subsys_conn_update(
Entry *e
)
{
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
long n = -1;
static struct berval total_bv = BER_BVC( "cn=total" ),
@ -226,13 +224,13 @@ monitor_subsys_conn_update(
static int
conn_create(
struct monitorinfo *mi,
monitor_info_t *mi,
Connection *c,
Entry **ep,
monitorsubsys *ms
monitor_subsys_t *ms
)
{
struct monitorentrypriv *mp;
monitor_entry_t *mp;
struct tm *ltm;
char buf[ BACKMONITOR_BUFSIZE ];
char buf2[ LDAP_LUTIL_GENTIME_BUFSIZE ];
@ -420,20 +418,19 @@ monitor_subsys_conn_create(
Entry **ep
)
{
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
Connection *c;
int connindex;
struct monitorentrypriv *mp;
monitor_entry_t *mp;
int rc = 0;
monitorsubsys *ms;
monitor_subsys_t *ms;
assert( mi != NULL );
assert( e_parent != NULL );
assert( ep != NULL );
ms = (( struct monitorentrypriv *)e_parent->e_private)->mp_info;
ms = (( monitor_entry_t *)e_parent->e_private)->mp_info;
*ep = NULL;
@ -444,10 +441,11 @@ monitor_subsys_conn_create(
/* create all the children of e_parent */
for ( c = connection_first( &connindex );
c != NULL;
c = connection_next( c, &connindex )) {
c = connection_next( c, &connindex ))
{
if ( conn_create( mi, c, &e, ms ) || e == NULL ) {
for ( ; e_tmp != NULL; ) {
mp = ( struct monitorentrypriv * )e_tmp->e_private;
mp = ( monitor_entry_t * )e_tmp->e_private;
e = mp->mp_next;
ch_free( mp );
@ -459,7 +457,7 @@ monitor_subsys_conn_create(
rc = -1;
break;
}
mp = ( struct monitorentrypriv * )e->e_private;
mp = ( monitor_entry_t * )e->e_private;
mp->mp_next = e_tmp;
e_tmp = e;
}

View File

@ -58,7 +58,7 @@ static struct restricted_ops_t {
};
static int
init_readOnly( struct monitorinfo *mi, Entry *e, slap_mask_t restrictops )
init_readOnly( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
{
struct berval *tf = ( ( restrictops & SLAP_RESTRICT_OP_MASK ) == SLAP_RESTRICT_OP_WRITES ) ?
(struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv;
@ -67,7 +67,7 @@ init_readOnly( struct monitorinfo *mi, Entry *e, slap_mask_t restrictops )
}
static int
init_restrictedOperation( struct monitorinfo *mi, Entry *e, slap_mask_t restrictops )
init_restrictedOperation( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
{
int i, rc;
@ -96,20 +96,20 @@ init_restrictedOperation( struct monitorinfo *mi, Entry *e, slap_mask_t restrict
int
monitor_subsys_database_init(
BackendDB *be,
monitorsubsys *ms
BackendDB *be,
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
monitor_info_t *mi;
Entry *e_database, **ep;
int i;
struct monitorentrypriv *mp;
monitorsubsys *ms_backend,
monitor_entry_t *mp;
monitor_subsys_t *ms_backend,
*ms_overlay;
assert( be != NULL );
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
if ( ms_backend == NULL ) {
@ -144,7 +144,7 @@ monitor_subsys_database_init(
(void)init_readOnly( mi, e_database, frontendDB->be_restrictops );
(void)init_restrictedOperation( mi, e_database, frontendDB->be_restrictops );
mp = ( struct monitorentrypriv * )e_database->e_private;
mp = ( monitor_entry_t * )e_database->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;
@ -356,15 +356,15 @@ monitor_subsys_database_modify(
Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
int rc = LDAP_OTHER;
Attribute *save_attrs, *a;
Modifications *modlist = op->oq_modify.rs_modlist;
Modifications *ml;
Backend *be;
int ro_gotval = 1, i, n;
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
int rc = LDAP_OTHER;
Attribute *save_attrs, *a;
Modifications *modlist = op->oq_modify.rs_modlist;
Modifications *ml;
Backend *be;
int ro_gotval = 1, i, n;
slap_mask_t rp_add = 0, rp_delete = 0, rp_cur;
struct berval *tf;
struct berval *tf;
i = sscanf( e->e_nname.bv_val, "cn=database %d,", &n );
if ( i != 1 )
@ -654,9 +654,9 @@ done:;
static int
monitor_back_add_plugin( Backend *be, Entry *e_database )
{
Slapi_PBlock *pCurrentPB;
int i, rc = LDAP_SUCCESS;
struct monitorinfo *mi = ( struct monitorinfo * )be->be_private;
Slapi_PBlock *pCurrentPB;
int i, rc = LDAP_SUCCESS;
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
/*

View File

@ -30,23 +30,29 @@ monitor_entry_update(
Entry *e
)
{
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
struct monitorentrypriv *mp;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
monitor_entry_t *mp;
int rc = 0;
assert( mi != NULL );
assert( e != NULL );
assert( e->e_private != NULL );
mp = ( struct monitorentrypriv * )e->e_private;
mp = ( monitor_entry_t * )e->e_private;
if ( mp->mp_info && mp->mp_info->mss_update ) {
rc = ( *mp->mp_info->mss_update )( op, e );
}
if ( rc == 0 && mp->mp_update ) {
rc = ( *mp->mp_update )( op, e );
if ( rc == 0 && mp->mp_cb ) {
struct monitor_callback_t *mc;
for ( mc = mp->mp_cb; mc; mc = mc->mc_next ) {
rc = ( *mc->mc_update )( op, e, mc->mc_private );
if ( rc != 0 ) {
break;
}
}
}
return rc;
@ -60,15 +66,15 @@ monitor_entry_create(
Entry **ep
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
struct monitorentrypriv *mp;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
monitor_entry_t *mp;
assert( mi != NULL );
assert( e_parent != NULL );
assert( e_parent->e_private != NULL );
assert( ep != NULL );
mp = ( struct monitorentrypriv * )e_parent->e_private;
mp = ( monitor_entry_t * )e_parent->e_private;
if ( mp->mp_info && mp->mp_info->mss_create ) {
return ( *mp->mp_info->mss_create )( op, ndn, e_parent, ep );
@ -83,14 +89,14 @@ monitor_entry_modify(
Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
struct monitorentrypriv *mp;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
monitor_entry_t *mp;
assert( mi != NULL );
assert( e != NULL );
assert( e->e_private != NULL );
mp = ( struct monitorentrypriv * )e->e_private;
mp = ( monitor_entry_t * )e->e_private;
if ( mp->mp_info && mp->mp_info->mss_modify ) {
return ( *mp->mp_info->mss_modify )( op, e );
@ -101,7 +107,7 @@ monitor_entry_modify(
int
monitor_entry_test_flags(
struct monitorentrypriv *mp,
monitor_entry_t *mp,
int cond
)
{
@ -110,19 +116,18 @@ monitor_entry_test_flags(
return( ( mp->mp_flags & cond ) || ( mp->mp_info->mss_flags & cond ) );
}
struct monitorentrypriv *
monitor_entry_t *
monitor_entrypriv_create( void )
{
struct monitorentrypriv *mp;
monitor_entry_t *mp;
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
mp = ( monitor_entry_t * )ch_calloc( sizeof( monitor_entry_t ), 1 );
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = NULL;
mp->mp_flags = MONITOR_F_NONE;
mp->mp_update = NULL;
mp->mp_private = NULL;
mp->mp_cb = NULL;
return mp;
}

View File

@ -36,7 +36,7 @@
*/
BackendDB *be_monitor = NULL;
static struct monitorsubsys **monitor_subsys = NULL;
static struct monitor_subsys_t **monitor_subsys = NULL;
static int monitor_subsys_opened = 0;
/*
@ -48,7 +48,7 @@ static int monitor_subsys_opened = 0;
* before the database is opened (e.g. by other backends
* or by overlays or modules).
*/
static struct monitorsubsys known_monitor_subsys[] = {
static struct monitor_subsys_t known_monitor_subsys[] = {
{
SLAPD_MONITOR_BACKEND_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
@ -173,7 +173,7 @@ init_module( int argc, char *argv[] )
#endif /* SLAPD_MONITOR */
int
monitor_back_register_subsys( monitorsubsys *ms )
monitor_back_register_subsys( monitor_subsys_t *ms )
{
int i = 0;
@ -183,7 +183,7 @@ monitor_back_register_subsys( monitorsubsys *ms )
}
monitor_subsys = ch_realloc( monitor_subsys,
( 2 + i ) * sizeof( monitorsubsys * ) );
( 2 + i ) * sizeof( monitor_subsys_t * ) );
if ( monitor_subsys == NULL ) {
return -1;
@ -211,7 +211,174 @@ monitor_back_register_subsys( monitorsubsys *ms )
return 0;
}
monitorsubsys *
typedef struct entry_limbo_t {
struct berval el_ndn;
Entry *el_e;
monitor_callback_t *el_cb;
void *el_private;
struct entry_limbo_t *el_next;
} entry_limbo_t;
int
monitor_back_register_entry(
Entry *e,
monitor_callback_t *cb,
void *private )
{
monitor_info_t *mi = ( monitor_info_t * )be_monitor->be_private;
assert( mi != NULL );
assert( e != NULL );
assert( e->e_private == NULL );
if ( monitor_subsys_opened ) {
Entry *e2 = NULL,
**ep = NULL;
struct berval pdn = BER_BVNULL;
monitor_entry_t *mp = NULL,
*pmp = NULL;
if ( monitor_cache_get( mi, &e->e_nname, &e2 ) == 0 ) {
/* entry exists */
Debug( LDAP_DEBUG_ANY,
"monitor_back_register_entry(\"%s\"): "
"entry exists\n",
e->e_name.bv_val, 0, 0 );
monitor_cache_release( mi, e2 );
return -1;
}
dnParent( &e->e_nname, &pdn );
if ( monitor_cache_get( mi, &pdn, &e2 ) != 0 ) {
/* parent does not exist */
Debug( LDAP_DEBUG_ANY,
"monitor_back_register_entry(\"%s\"): "
"parent \"%s\" not found\n",
e->e_name.bv_val, pdn.bv_val, 0 );
return -1;
}
assert( e2->e_private != NULL );
pmp = ( monitor_entry_t * )e2->e_private;
if ( pmp->mp_flags & MONITOR_F_VOLATILE ) {
/* entry is volatile; cannot append children */
Debug( LDAP_DEBUG_ANY,
"monitor_back_register_entry(\"%s\"): "
"parent \"%s\" is volatile\n",
e->e_name.bv_val, e2->e_name.bv_val, 0 );
monitor_cache_release( mi, e2 );
return -1;
}
mp = monitor_entrypriv_create();
if ( mp == NULL ) {
Debug( LDAP_DEBUG_ANY,
"monitor_back_register_entry(\"%s\"): "
"monitor_entrypriv_create failed\n",
e->e_name.bv_val, 0, 0 );
return -1;
}
e->e_private = ( void * )mp;
mp->mp_info = pmp->mp_info;
mp->mp_flags = pmp->mp_flags | MONITOR_F_SUB;
ep = &pmp->mp_children;
for ( ; *ep; ) {
pmp = ( monitor_entry_t * )(*ep)->e_private;
ep = &pmp->mp_next;
}
*ep = e;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_back_register_entry(\"%s\"): "
"unable to add entry\n",
e->e_name.bv_val, 0, 0 );
ch_free( e->e_private );
e->e_private = NULL;
return( -1 );
}
} else {
entry_limbo_t *el;
el = (entry_limbo_t *)ch_malloc( sizeof( entry_limbo_t ) );
BER_BVZERO( &el->el_ndn );
el->el_e = e;
el->el_cb = cb;
el->el_private = private;
el->el_next = (entry_limbo_t *)mi->mi_entry_limbo;
}
return 0;
}
int
monitor_back_register_entry_callback(
struct berval *ndn,
struct monitor_callback_t *cb,
void *private )
{
monitor_info_t *mi = ( monitor_info_t * )be_monitor->be_private;
assert( mi != NULL );
assert( ndn != NULL );
assert( !BER_BVISNULL( ndn ) );
if ( monitor_subsys_opened ) {
Entry *e = NULL;
monitor_entry_t *mp = NULL;
struct monitor_callback_t **mcp = NULL;
if ( monitor_cache_get( mi, ndn, &e ) != 0 ) {
/* entry does not exist */
Debug( LDAP_DEBUG_ANY,
"monitor_back_register_entry_callback(\"%s\"): "
"entry does not exist\n",
e->e_name.bv_val, 0, 0 );
return -1;
}
assert( e->e_private != NULL );
mp = ( monitor_entry_t * )e->e_private;
if ( mp->mp_flags & MONITOR_F_VOLATILE ) {
/* entry is volatile; cannot append callback */
Debug( LDAP_DEBUG_ANY,
"monitor_back_register_entry_callback(\"%s\"): "
"entry is volatile\n",
e->e_name.bv_val, 0, 0 );
monitor_cache_release( mi, e );
return -1;
}
for ( mcp = &mp->mp_cb; *mcp; mcp = &(*mcp)->mc_next )
/* go to tail */ ;
/* NOTE: we do not clear cb->mc_next, so this function
* can be used to append a list of callbacks */
(*mcp) = cb;
monitor_cache_release( mi, e );
} else {
entry_limbo_t *el;
el = (entry_limbo_t *)ch_malloc( sizeof( entry_limbo_t ) );
ber_dupbv( &el->el_ndn, ndn );
el->el_e = NULL;
el->el_cb = cb;
el->el_private = private;
el->el_next = (entry_limbo_t *)mi->mi_entry_limbo;
}
return 0;
}
monitor_subsys_t *
monitor_back_get_subsys( const char *name )
{
if ( monitor_subsys != NULL ) {
@ -227,7 +394,7 @@ monitor_back_get_subsys( const char *name )
return NULL;
}
monitorsubsys *
monitor_subsys_t *
monitor_back_get_subsys_by_dn( struct berval *ndn, int sub )
{
if ( monitor_subsys != NULL ) {
@ -257,8 +424,8 @@ monitor_back_initialize(
BackendInfo *bi
)
{
monitorsubsys *ms;
static char *controls[] = {
monitor_subsys_t *ms;
static char *controls[] = {
LDAP_CONTROL_MANAGEDSAIT,
LDAP_CONTROL_VALUESRETURNFILTER,
NULL
@ -326,11 +493,11 @@ monitor_back_db_init(
BackendDB *be
)
{
struct monitorinfo *mi;
int i, rc;
struct berval dn, ndn;
struct berval bv;
const char *text;
monitor_info_t *mi;
int i, rc;
struct berval dn, ndn;
struct berval bv;
const char *text;
struct m_s {
char *name;
@ -358,42 +525,42 @@ monitor_back_db_init(
"$ managedInfo "
"$ monitorOverlay "
") )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_monitor) },
offsetof(monitor_info_t, mi_oc_monitor) },
{ "monitorServer", "( 1.3.6.1.4.1.4203.666.3.7 "
"NAME 'monitorServer' "
"DESC 'Server monitoring root entry' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_monitorServer) },
offsetof(monitor_info_t, mi_oc_monitorServer) },
{ "monitorContainer", "( 1.3.6.1.4.1.4203.666.3.8 "
"NAME 'monitorContainer' "
"DESC 'monitor container class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_monitorContainer) },
offsetof(monitor_info_t, mi_oc_monitorContainer) },
{ "monitorCounterObject", "( 1.3.6.1.4.1.4203.666.3.9 "
"NAME 'monitorCounterObject' "
"DESC 'monitor counter class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_monitorCounterObject) },
offsetof(monitor_info_t, mi_oc_monitorCounterObject) },
{ "monitorOperation", "( 1.3.6.1.4.1.4203.666.3.10 "
"NAME 'monitorOperation' "
"DESC 'monitor operation class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_monitorOperation) },
offsetof(monitor_info_t, mi_oc_monitorOperation) },
{ "monitorConnection", "( 1.3.6.1.4.1.4203.666.3.11 "
"NAME 'monitorConnection' "
"DESC 'monitor connection class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_monitorConnection) },
offsetof(monitor_info_t, mi_oc_monitorConnection) },
{ "managedObject", "( 1.3.6.1.4.1.4203.666.3.12 "
"NAME 'managedObject' "
"DESC 'monitor managed entity class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_managedObject) },
offsetof(monitor_info_t, mi_oc_managedObject) },
{ "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.13 "
"NAME 'monitoredObject' "
"DESC 'monitor monitored entity class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(struct monitorinfo, mi_oc_monitoredObject) },
offsetof(monitor_info_t, mi_oc_monitoredObject) },
{ NULL, NULL, 0, -1 }
}, mat[] = {
{ "monitoredInfo", "( 1.3.6.1.4.1.4203.666.1.14 "
@ -405,12 +572,12 @@ monitor_back_db_init(
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitoredInfo) },
offsetof(monitor_info_t, mi_ad_monitoredInfo) },
{ "managedInfo", "( 1.3.6.1.4.1.4203.666.1.15 "
"NAME 'managedInfo' "
"DESC 'monitor managed info' "
"SUP name )", SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_managedInfo) },
offsetof(monitor_info_t, mi_ad_managedInfo) },
{ "monitorCounter", "( 1.3.6.1.4.1.4203.666.1.16 "
"NAME 'monitorCounter' "
"DESC 'monitor counter' "
@ -419,28 +586,28 @@ monitor_back_db_init(
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorCounter) },
offsetof(monitor_info_t, mi_ad_monitorCounter) },
{ "monitorOpCompleted", "( 1.3.6.1.4.1.4203.666.1.17 "
"NAME 'monitorOpCompleted' "
"DESC 'monitor completed operations' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorOpCompleted) },
offsetof(monitor_info_t, mi_ad_monitorOpCompleted) },
{ "monitorOpInitiated", "( 1.3.6.1.4.1.4203.666.1.18 "
"NAME 'monitorOpInitiated' "
"DESC 'monitor initiated operations' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorOpInitiated) },
offsetof(monitor_info_t, mi_ad_monitorOpInitiated) },
{ "monitorConnectionNumber", "( 1.3.6.1.4.1.4203.666.1.19 "
"NAME 'monitorConnectionNumber' "
"DESC 'monitor connection number' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorConnectionNumber) },
offsetof(monitor_info_t, mi_ad_monitorConnectionNumber) },
{ "monitorConnectionAuthzDN", "( 1.3.6.1.4.1.4203.666.1.20 "
"NAME 'monitorConnectionAuthzDN' "
"DESC 'monitor connection authorization DN' "
@ -449,21 +616,21 @@ monitor_back_db_init(
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorConnectionAuthzDN) },
offsetof(monitor_info_t, mi_ad_monitorConnectionAuthzDN) },
{ "monitorConnectionLocalAddress", "( 1.3.6.1.4.1.4203.666.1.21 "
"NAME 'monitorConnectionLocalAddress' "
"DESC 'monitor connection local address' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorConnectionLocalAddress) },
offsetof(monitor_info_t, mi_ad_monitorConnectionLocalAddress) },
{ "monitorConnectionPeerAddress", "( 1.3.6.1.4.1.4203.666.1.22 "
"NAME 'monitorConnectionPeerAddress' "
"DESC 'monitor connection peer address' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorConnectionPeerAddress) },
offsetof(monitor_info_t, mi_ad_monitorConnectionPeerAddress) },
{ "monitorTimestamp", "( 1.3.6.1.4.1.4203.666.1.24 "
"NAME 'monitorTimestamp' "
"DESC 'monitor timestamp' "
@ -473,14 +640,14 @@ monitor_back_db_init(
"SINGLE-VALUE "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorTimestamp) },
offsetof(monitor_info_t, mi_ad_monitorTimestamp) },
{ "monitorOverlay", "( 1.3.6.1.4.1.4203.666.1.27 "
"NAME 'monitorOverlay' "
"DESC 'name of overlays defined for a give database' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_monitorOverlay) },
offsetof(monitor_info_t, mi_ad_monitorOverlay) },
{ "readOnly", "( 1.3.6.1.4.1.4203.666.1.31 "
"NAME 'readOnly' "
"DESC 'read/write status of a given database' "
@ -488,12 +655,12 @@ monitor_back_db_init(
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 "
"SINGLE-VALUE "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_readOnly) },
offsetof(monitor_info_t, mi_ad_readOnly) },
{ "restrictedOperation", "( 1.3.6.1.4.1.4203.666.1.32 "
"NAME 'restrictedOperation' "
"DESC 'name of restricted operation for a given database' "
"SUP managedInfo )", SLAP_AT_HIDE,
offsetof(struct monitorinfo, mi_ad_restrictedOperation ) },
offsetof(monitor_info_t, mi_ad_restrictedOperation ) },
#ifdef INTEGRATE_CORE_SCHEMA
{ NULL, NULL, 0, -1 }, /* description */
{ NULL, NULL, 0, -1 }, /* seeAlso */
@ -508,23 +675,23 @@ monitor_back_db_init(
"EQUALITY caseIgnoreMatch "
"SUBSTR caseIgnoreSubstringsMatch "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )", 0,
offsetof(struct monitorinfo, mi_ad_description) },
offsetof(monitor_info_t, mi_ad_description) },
{ "seeAlso", "( 2.5.4.34 "
"NAME 'seeAlso' "
"DESC 'RFC2256: DN of related object' "
"SUP distinguishedName )", 0,
offsetof(struct monitorinfo, mi_ad_seeAlso) },
offsetof(monitor_info_t, mi_ad_seeAlso) },
{ "l", "( 2.5.4.7 "
"NAME ( 'l' 'localityName' ) "
"DESC 'RFC2256: locality which this object resides in' "
"SUP name )", 0,
offsetof(struct monitorinfo, mi_ad_l) },
offsetof(monitor_info_t, mi_ad_l) },
{ "labeledURI", "( 1.3.6.1.4.1.250.1.57 "
"NAME 'labeledURI' "
"DESC 'RFC2079: Uniform Resource Identifier with optional label' "
"EQUALITY caseExactMatch "
"SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )", 0,
offsetof(struct monitorinfo, mi_ad_labeledURI) },
offsetof(monitor_info_t, mi_ad_labeledURI) },
{ NULL, NULL, 0, -1 }
};
@ -556,14 +723,14 @@ monitor_back_db_init(
ber_bvarray_add( &be->be_suffix, &bv );
ber_bvarray_add( &be->be_nsuffix, &ndn );
mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 );
mi = ( monitor_info_t * )ch_calloc( sizeof( monitor_info_t ), 1 );
if ( mi == NULL ) {
Debug( LDAP_DEBUG_ANY,
"unable to initialize monitor backend\n", 0, 0, 0 );
return -1;
}
memset( mi, 0, sizeof( struct monitorinfo ) );
memset( mi, 0, sizeof( monitor_info_t ) );
ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
@ -697,10 +864,10 @@ monitor_back_db_open(
BackendDB *be
)
{
struct monitorinfo *mi = (struct monitorinfo *)be->be_private;
struct monitorsubsys **ms;
monitor_info_t *mi = (monitor_info_t *)be->be_private;
struct monitor_subsys_t **ms;
Entry *e, **ep;
struct monitorentrypriv *mp;
monitor_entry_t *mp;
int i;
char buf[ BACKMONITOR_BUFSIZE ],
*end_of_line;
@ -922,6 +1089,28 @@ monitor_back_db_open(
monitor_subsys_opened = 1;
if ( mi->mi_entry_limbo ) {
entry_limbo_t *el = (entry_limbo_t *)mi->mi_entry_limbo;
for ( ; el; ) {
entry_limbo_t *tmp;
if ( el->el_e ) {
monitor_back_register_entry( el->el_e, el->el_cb, el->el_private );
} else if ( !BER_BVISNULL( &el->el_ndn ) ) {
monitor_back_register_entry_callback( &el->el_ndn, el->el_cb, el->el_private );
ber_memfree( el->el_ndn.bv_val );
}
tmp = el;
el = el->el_next;
ch_free( tmp );
}
mi->mi_entry_limbo = NULL;
}
return( 0 );
}
@ -949,7 +1138,7 @@ monitor_back_db_config(
char **argv
)
{
struct monitorinfo *mi = (struct monitorinfo *)be->be_private;
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
/*
* eventually, will hold database specific configuration parameters

View File

@ -28,15 +28,15 @@
int
monitor_subsys_listener_init(
BackendDB *be,
monitorsubsys *ms
BackendDB *be,
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
Entry *e_listener, **ep;
int i;
struct monitorentrypriv *mp;
Listener **l;
monitor_info_t *mi;
Entry *e_listener, **ep;
int i;
monitor_entry_t *mp;
Listener **l;
assert( be != NULL );
@ -51,12 +51,9 @@ monitor_subsys_listener_init(
return( -1 );
}
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
&ms->mss_ndn,
&e_listener ) )
{
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_listener ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_listener_init: "
"unable to get entry \"%s\"\n",
@ -64,7 +61,7 @@ monitor_subsys_listener_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_listener->e_private;
mp = ( monitor_entry_t * )e_listener->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;

View File

@ -70,14 +70,14 @@ static int replace_values( Entry *e, Modification *mod, int *newlevel );
*/
int
monitor_subsys_log_init(
BackendDB *be,
monitorsubsys *ms
BackendDB *be,
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
Entry *e;
int i;
struct berval desc[] = {
monitor_info_t *mi;
Entry *e;
int i;
struct berval desc[] = {
BER_BVC("This entry allows to set the log level runtime."),
BER_BVC("Set the attribute 'managedInfo' to the desired log levels."),
BER_BVNULL
@ -85,7 +85,7 @@ monitor_subsys_log_init(
ldap_pvt_thread_mutex_init( &monitor_log_mutex );
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn,
&e ) ) {
@ -132,7 +132,7 @@ monitor_subsys_log_modify(
Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
int rc = LDAP_OTHER;
int newlevel = ldap_syslog;
Attribute *save_attrs;

View File

@ -41,11 +41,10 @@ monitor_back_modify( Operation *op, SlapReply *rs )
Modifications *modlist
*/
{
int rc = 0;
struct monitorinfo *mi
= (struct monitorinfo *) op->o_bd->be_private;
Entry *matched;
Entry *e;
int rc = 0;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
Entry *matched;
Entry *e;
Debug(LDAP_DEBUG_ARGS, "monitor_back_modify:\n", 0, 0, 0);

View File

@ -48,20 +48,20 @@ struct monitor_ops_t {
int
monitor_subsys_ops_init(
BackendDB *be,
monitorsubsys *ms
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
monitor_info_t *mi;
Entry *e_op, **ep;
struct monitorentrypriv *mp;
char buf[ BACKMONITOR_BUFSIZE ];
int i;
struct berval bv_zero = BER_BVC("0");
Entry *e_op, **ep;
monitor_entry_t *mp;
char buf[ BACKMONITOR_BUFSIZE ];
int i;
struct berval bv_zero = BER_BVC( "0" );
assert( be != NULL );
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
&ms->mss_ndn, &e_op ) )
@ -77,7 +77,7 @@ monitor_subsys_ops_init(
attr_merge_one( e_op, mi->mi_ad_monitorOpInitiated, &bv_zero, NULL );
attr_merge_one( e_op, mi->mi_ad_monitorOpCompleted, &bv_zero, NULL );
mp = ( struct monitorentrypriv * )e_op->e_private;
mp = ( monitor_entry_t * )e_op->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;
@ -158,8 +158,7 @@ monitor_subsys_ops_update(
Entry *e
)
{
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
ldap_pvt_mp_t nInitiated,
nCompleted;

View File

@ -50,9 +50,9 @@ monitor_back_operational(
ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) )
{
int hs;
struct monitorentrypriv *mp;
monitor_entry_t *mp;
mp = ( struct monitorentrypriv * )rs->sr_entry->e_private;
mp = ( monitor_entry_t * )rs->sr_entry->e_private;
assert( mp );

View File

@ -32,18 +32,18 @@
*/
int
monitor_subsys_overlay_init(
BackendDB *be,
monitorsubsys *ms
BackendDB *be,
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
monitor_info_t *mi;
Entry *e_overlay, **ep;
int i;
struct monitorentrypriv *mp;
monitor_entry_t *mp;
slap_overinst *on;
monitorsubsys *ms_database;
monitor_subsys_t *ms_database;
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
ms_database = monitor_back_get_subsys( SLAPD_MONITOR_DATABASE_NAME );
if ( ms_database == NULL ) {
@ -56,10 +56,7 @@ monitor_subsys_overlay_init(
return -1;
}
if ( monitor_cache_get( mi,
&ms->mss_ndn,
&e_overlay ) )
{
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_overlay ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_overlay_init: "
"unable to get entry \"%s\"\n",
@ -67,7 +64,7 @@ monitor_subsys_overlay_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_overlay->e_private;
mp = ( monitor_entry_t * )e_overlay->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;

View File

@ -30,23 +30,23 @@ LDAP_BEGIN_DECL
/*
* backends
*/
int monitor_subsys_backend_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_backend_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
/*
* 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 ));
extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
extern int monitor_cache_add LDAP_P(( monitor_info_t *mi, Entry *e ));
extern int monitor_cache_get LDAP_P(( monitor_info_t *mi, struct berval *ndn, Entry **ep ));
extern int monitor_cache_dn2entry LDAP_P(( Operation *op, struct berval *ndn, Entry **ep, Entry **matched ));
extern int monitor_cache_lock LDAP_P(( Entry *e ));
extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
extern int monitor_cache_release LDAP_P(( monitor_info_t *mi, Entry *e ));
/*
* connections
*/
int monitor_subsys_conn_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_conn_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_conn_update LDAP_P(( Operation *op, Entry *e ));
int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
Entry *e_parent, Entry **ep ));
@ -54,7 +54,7 @@ int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
/*
* databases
*/
int monitor_subsys_database_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_database_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_database_modify LDAP_P(( Operation *op, Entry *e ));
/*
@ -64,60 +64,60 @@ extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
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 ));
int monitor_entry_test_flags LDAP_P(( struct monitorentrypriv *mp, int cond ));
extern struct monitorentrypriv * monitor_entrypriv_create LDAP_P(( void ));
int monitor_entry_test_flags LDAP_P(( monitor_entry_t *mp, int cond ));
extern monitor_entry_t * monitor_entrypriv_create LDAP_P(( void ));
/*
* init
*/
extern int monitor_back_register_subsys LDAP_P(( monitorsubsys *ms ));
extern monitorsubsys * monitor_back_get_subsys LDAP_P(( const char *name ));
extern monitorsubsys * monitor_back_get_subsys_by_dn LDAP_P(( struct berval *ndn, int sub ));
extern int monitor_back_register_subsys LDAP_P(( monitor_subsys_t *ms ));
extern monitor_subsys_t * monitor_back_get_subsys LDAP_P(( const char *name ));
extern monitor_subsys_t * monitor_back_get_subsys_by_dn LDAP_P(( struct berval *ndn, int sub ));
/*
* listener
*/
int monitor_subsys_listener_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_listener_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
/*
* log
*/
int monitor_subsys_log_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_log_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
/*
* operations
*/
int monitor_subsys_ops_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_ops_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
/*
* overlay
*/
int monitor_subsys_overlay_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_overlay_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
/*
* sent
*/
int monitor_subsys_sent_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_sent_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e ));
/*
* threads
*/
int monitor_subsys_thread_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_thread_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
/*
* time
*/
int monitor_subsys_time_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_time_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
/*
* waiters
*/
int monitor_subsys_rww_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_rww_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
/* NOTE: this macro assumes that bv has been allocated

View File

@ -47,21 +47,20 @@ struct monitor_rww_t {
int
monitor_subsys_rww_init(
BackendDB *be,
monitorsubsys *ms
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
monitor_info_t *mi;
Entry **ep, *e_conn;
struct monitorentrypriv *mp;
Entry **ep, *e_conn;
monitor_entry_t *mp;
int i;
assert( be != NULL );
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
&ms->mss_ndn, &e_conn ) ) {
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_conn ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_rww_init: "
"unable to get entry \"%s\"\n",
@ -69,7 +68,7 @@ monitor_subsys_rww_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_conn->e_private;
mp = ( monitor_entry_t * )e_conn->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;
@ -146,18 +145,18 @@ monitor_subsys_rww_update(
Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
Connection *c;
int connindex;
long nconns, nwritewaiters, nreadwaiters;
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
Connection *c;
int connindex;
long nconns, nwritewaiters, nreadwaiters;
int i;
struct berval nrdn;
int i;
struct berval nrdn;
Attribute *a;
char buf[] = "+9223372036854775807L";
long num = 0;
ber_len_t len;
Attribute *a;
char buf[] = "+9223372036854775807L";
long num = 0;
ber_len_t len;
assert( mi != NULL );
assert( e != NULL );

View File

@ -38,13 +38,12 @@ monitor_send_children(
int sub
)
{
struct monitorinfo *mi =
(struct monitorinfo *) op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
Entry *e, *e_tmp, *e_ch;
struct monitorentrypriv *mp;
monitor_entry_t *mp;
int rc;
mp = ( struct monitorentrypriv * )e_parent->e_private;
mp = ( monitor_entry_t * )e_parent->e_private;
e = mp->mp_children;
e_ch = NULL;
@ -71,7 +70,7 @@ monitor_send_children(
} else {
e_tmp = e_ch;
do {
mp = ( struct monitorentrypriv * )e_tmp->e_private;
mp = ( monitor_entry_t * )e_tmp->e_private;
e_tmp = mp->mp_next;
if ( e_tmp == NULL ) {
@ -85,7 +84,7 @@ monitor_send_children(
/* return entries */
for ( ; e != NULL; ) {
mp = ( struct monitorentrypriv * )e->e_private;
mp = ( monitor_entry_t * )e->e_private;
monitor_entry_update( op, e );
@ -119,8 +118,7 @@ monitor_send_children(
int
monitor_back_search( Operation *op, SlapReply *rs )
{
struct monitorinfo *mi
= (struct monitorinfo *) op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
int rc = LDAP_SUCCESS;
Entry *e, *matched = NULL;

View File

@ -50,18 +50,18 @@ struct monitor_sent_t {
int
monitor_subsys_sent_init(
BackendDB *be,
monitorsubsys *ms
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
monitor_info_t *mi;
Entry **ep, *e_sent;
struct monitorentrypriv *mp;
Entry **ep, *e_sent;
monitor_entry_t *mp;
int i;
assert( be != NULL );
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_sent ) ) {
Debug( LDAP_DEBUG_ANY,
@ -71,7 +71,7 @@ monitor_subsys_sent_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_sent->e_private;
mp = ( monitor_entry_t * )e_sent->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;
@ -149,8 +149,7 @@ monitor_subsys_sent_update(
Entry *e
)
{
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t *)op->o_bd->be_private;
struct berval nrdn;
ldap_pvt_mp_t n;

View File

@ -32,16 +32,16 @@
* */
int
monitor_subsys_thread_init(
BackendDB *be,
monitorsubsys *ms
BackendDB *be,
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
struct monitorentrypriv *mp;
Entry *e, **ep, *e_thread;
static char buf[ BACKMONITOR_BUFSIZE ];
monitor_info_t *mi;
monitor_entry_t *mp;
Entry *e, **ep, *e_thread;
static char buf[ BACKMONITOR_BUFSIZE ];
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_thread ) ) {
Debug( LDAP_DEBUG_ANY,
@ -51,7 +51,7 @@ monitor_subsys_thread_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_thread->e_private;
mp = ( monitor_entry_t * )e_thread->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;
@ -169,8 +169,7 @@ monitor_subsys_thread_update(
Entry *e
)
{
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
Attribute *a;
char buf[ BACKMONITOR_BUFSIZE ];
static struct berval backload_bv = BER_BVC( "cn=backload" );

View File

@ -34,18 +34,18 @@
int
monitor_subsys_time_init(
BackendDB *be,
monitorsubsys *ms
monitor_subsys_t *ms
)
{
struct monitorinfo *mi;
monitor_info_t *mi;
Entry *e, **ep, *e_time;
struct monitorentrypriv *mp;
char buf[ BACKMONITOR_BUFSIZE ];
Entry *e, **ep, *e_time;
monitor_entry_t *mp;
char buf[ BACKMONITOR_BUFSIZE ];
assert( be != NULL );
mi = ( struct monitorinfo * )be->be_private;
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
&ms->mss_ndn, &e_time ) ) {
@ -56,7 +56,7 @@ monitor_subsys_time_init(
return( -1 );
}
mp = ( struct monitorentrypriv * )e_time->e_private;
mp = ( monitor_entry_t * )e_time->e_private;
mp->mp_children = NULL;
ep = &mp->mp_children;
@ -172,9 +172,7 @@ monitor_subsys_time_update(
Entry *e
)
{
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
static struct berval bv_current = BER_BVC( "cn=current" );
struct berval rdn;