/* initialize entry and subentries */
int ( *mss_open )( BackendDB *, struct monitor_subsys_t *ms );
+ /* destroy structure */
+ int ( *mss_destroy )( BackendDB *, struct monitor_subsys_t *ms );
/* update existing dynamic entry and subentries */
int ( *mss_update )( Operation *, SlapReply *, Entry * );
/* create new dynamic subentries */
#define MONITOR_LEGACY_CONN
#endif
+static int
+monitor_subsys_conn_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
+static int
+monitor_subsys_conn_create(
+ Operation *op,
+ SlapReply *rs,
+ struct berval *ndn,
+ Entry *e_parent,
+ Entry **ep );
+
int
monitor_subsys_conn_init(
BackendDB *be,
assert( be != NULL );
+ ms->mss_update = monitor_subsys_conn_update;
+ ms->mss_create = monitor_subsys_conn_create;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_conn ) ) {
return( 0 );
}
-int
+static int
monitor_subsys_conn_update(
Operation *op,
SlapReply *rs,
return SLAP_CB_CONTINUE;
}
-int
+static int
monitor_subsys_conn_create(
Operation *op,
SlapReply *rs,
#define PATH_MAX 4095
#endif /* ! PATH_MAX */
+static int
+monitor_subsys_database_modify(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
static struct restricted_ops_t {
struct berval op;
unsigned int tag;
assert( be != NULL );
+ ms->mss_modify = monitor_subsys_database_modify;
+
mi = ( monitor_info_t * )be->be_private;
ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
return LDAP_SUCCESS;
}
-int
+static int
monitor_subsys_database_modify(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
int rc = LDAP_OTHER;
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_backend_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_VOLATILE_CH,
monitor_subsys_conn_init,
- monitor_subsys_conn_update,
- monitor_subsys_conn_create,
+ NULL, /* destroy */
+ NULL, /* update */
+ NULL, /* create */
NULL /* modify */
}, {
SLAPD_MONITOR_DATABASE_NAME,
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_database_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
- monitor_subsys_database_modify
+ NULL /* modify */
}, {
SLAPD_MONITOR_LISTENER_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_listener_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_NONE,
monitor_subsys_log_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
- monitor_subsys_log_modify
+ NULL, /* modify */
}, {
SLAPD_MONITOR_OPS_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_ops_init,
- monitor_subsys_ops_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL, /* modify */
}, {
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_overlay_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL, /* modify */
BER_BVNULL },
MONITOR_F_NONE,
NULL, /* init */
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_sent_init,
- monitor_subsys_sent_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL, /* modify */
}, {
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_thread_init,
- monitor_subsys_thread_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL /* modify */
}, {
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_time_init,
- monitor_subsys_time_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL, /* modify */
}, {
BER_BVNULL },
MONITOR_F_NONE,
NULL, /* init */
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_rww_init,
- monitor_subsys_rww_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL /* modify */
}, { NULL }
int i;
for ( i = 0; monitor_subsys[ i ] != NULL; i++ ) {
+ if ( monitor_subsys[ i ]->mss_destroy ) {
+ monitor_subsys[ i ]->mss_destroy( be, monitor_subsys[ i ] );
+ }
+
if ( !BER_BVISNULL( &monitor_subsys[ i ]->mss_rdn ) ) {
ch_free( monitor_subsys[ i ]->mss_rdn.bv_val );
}
#include "ldif.h"
#include "back-monitor.h"
+static int
+monitor_subsys_log_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms );
+
+static int
+monitor_subsys_log_modify(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
/*
* log mutex
*/
Entry *e;
int i;
+ ms->mss_destroy = monitor_subsys_log_destroy;
+ ms->mss_modify = monitor_subsys_log_modify;
+
ldap_pvt_thread_mutex_init( &monitor_log_mutex );
mi = ( monitor_info_t * )be->be_private;
return( 0 );
}
-int
+static int
+monitor_subsys_log_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms )
+{
+ int i;
+
+ for ( i = 0; int_2_level[ i ].i != 0; i++ ) {
+ if ( !BER_BVISNULL( &int_2_level[ i ].n ) ) {
+ ch_free( int_2_level[ i ].n.bv_val );
+ }
+ }
+
+ return 0;
+}
+
+static int
monitor_subsys_log_modify(
Operation *op,
SlapReply *rs,
{ BER_BVNULL, BER_BVNULL }
};
+static int
+monitor_subsys_ops_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms );
+
+static int
+monitor_subsys_ops_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
int
monitor_subsys_ops_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
assert( be != NULL );
+ ms->mss_destroy = monitor_subsys_ops_destroy;
+ ms->mss_update = monitor_subsys_ops_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
return( 0 );
}
-int
+static int
+monitor_subsys_ops_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms )
+{
+ int i;
+
+ for ( i = 0; i < SLAP_OP_LAST; i++ ) {
+ if ( !BER_BVISNULL( &monitor_op[ i ].nrdn ) ) {
+ ch_free( monitor_op[ i ].nrdn.bv_val );
+ }
+ }
+
+ return 0;
+}
+
+static int
monitor_subsys_ops_update(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
monitor_subsys_conn_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_conn_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
-extern int
-monitor_subsys_conn_create LDAP_P((
- Operation *op,
- SlapReply *rs,
- struct berval *ndn,
- Entry *e_parent,
- Entry **ep ));
/*
* databases
monitor_subsys_database_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_database_modify LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* entry
monitor_subsys_log_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_log_modify LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* operations
monitor_subsys_ops_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_ops_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* overlay
monitor_subsys_sent_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_sent_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* threads
monitor_subsys_thread_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_thread_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* time
extern int monitor_subsys_time_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_time_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* waiters
monitor_subsys_rww_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_rww_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* former external.h
#include "lutil.h"
#include "back-monitor.h"
+static int
+monitor_subsys_rww_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
enum {
MONITOR_RWW_READ = 0,
MONITOR_RWW_WRITE,
assert( be != NULL );
+ ms->mss_update = monitor_subsys_rww_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_conn ) ) {
return( 0 );
}
-int
+static int
monitor_subsys_rww_update(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
Connection *c;
#include "slap.h"
#include "back-monitor.h"
+static int
+monitor_subsys_sent_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms );
+
+static int
+monitor_subsys_sent_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
enum {
MONITOR_SENT_BYTES = 0,
MONITOR_SENT_PDU,
int
monitor_subsys_sent_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
assert( be != NULL );
+ ms->mss_destroy = monitor_subsys_sent_destroy;
+ ms->mss_update = monitor_subsys_sent_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_sent ) ) {
return( 0 );
}
-int
+static int
+monitor_subsys_sent_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms )
+{
+ int i;
+
+ for ( i = 0; i < MONITOR_SENT_LAST; i++ ) {
+ if ( !BER_BVISNULL( &monitor_sent[ i ].nrdn ) ) {
+ ch_free( monitor_sent[ i ].nrdn.bv_val );
+ }
+ }
+
+ return 0;
+}
+
+static int
monitor_subsys_sent_update(
Operation *op,
SlapReply *rs,
#include <ldap_rq.h>
+static int
+monitor_subsys_thread_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
/*
-* * initializes log subentry
-* */
+ * initializes log subentry
+ */
int
monitor_subsys_thread_init(
BackendDB *be,
Entry *e, **ep, *e_thread;
static char buf[ BACKMONITOR_BUFSIZE ];
+ ms->mss_update = monitor_subsys_thread_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_thread ) ) {
return( 0 );
}
-int
+static int
monitor_subsys_thread_update(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
Attribute *a;
#include "proto-slap.h"
#include "back-monitor.h"
+static int
+monitor_subsys_time_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
int
monitor_subsys_time_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
assert( be != NULL );
+ ms->mss_update = monitor_subsys_time_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
return( 0 );
}
-int
+static int
monitor_subsys_time_update(
Operation *op,
SlapReply *rs,