]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/init.c
should we touch timestamps when internally updating?
[openldap] / servers / slapd / back-monitor / init.c
index 35be64d30078a1d136f206075527ad2718e55b36..437815779cbd87a62caf26c0bdf4cffc7685cdb2 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Copyright 2001-2005 The OpenLDAP Foundation.
  * Portions Copyright 2001-2003 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -160,22 +160,6 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                }, { NULL }
 };
 
-#if SLAPD_MONITOR == SLAPD_MOD_DYNAMIC
-
-int
-init_module( int argc, char *argv[] )
-{
-       BackendInfo bi;
-
-       memset( &bi, '\0', sizeof(bi) );
-       bi.bi_type = "monitor";
-       bi.bi_init = monitor_back_initialize;
-       backend_add( &bi );
-       return 0;
-}
-
-#endif /* SLAPD_MONITOR */
-
 int
 monitor_back_register_subsys( monitor_subsys_t *ms )
 {
@@ -389,10 +373,11 @@ monitor_filter2ndn( struct berval *base, int scope, struct berval *filter,
                struct berval *ndn )
 {
        Connection      conn = { 0 };
-       Operation       op = { 0 };
+       char opbuf[OPERATION_BUFFER_SIZE];
+       Operation       *op;
        SlapReply       rs = { 0 };
        slap_callback   cb = { NULL, monitor_filter2ndn_cb, NULL, NULL };
-       AttributeName   anlist[ 2 ] = { { 0 }, { 0 } };
+       AttributeName   anlist[ 2 ];
        int             rc;
 
        BER_BVZERO( ndn );
@@ -401,51 +386,53 @@ monitor_filter2ndn( struct berval *base, int scope, struct berval *filter,
                return -1;
        }
 
-       connection_fake_init( &conn, &op, &conn );
+       op = (Operation *)opbuf;
+       connection_fake_init( &conn, op, &conn );
 
-       op.o_tag = LDAP_REQ_SEARCH;
+       op->o_tag = LDAP_REQ_SEARCH;
 
        /* use global malloc for now */
-       op.o_tmpmemctx = NULL;
-       op.o_tmpmfuncs = &ch_mfuncs;
+       op->o_tmpmemctx = NULL;
+       op->o_tmpmfuncs = &ch_mfuncs;
 
-       op.o_bd = be_monitor;
+       op->o_bd = be_monitor;
        if ( base == NULL || BER_BVISNULL( base ) ) {
-               ber_dupbv_x( &op.o_req_dn, &op.o_bd->be_suffix[ 0 ],
-                               op.o_tmpmemctx );
-               ber_dupbv_x( &op.o_req_ndn, &op.o_bd->be_nsuffix[ 0 ],
-                               op.o_tmpmemctx );
+               ber_dupbv_x( &op->o_req_dn, &op->o_bd->be_suffix[ 0 ],
+                               op->o_tmpmemctx );
+               ber_dupbv_x( &op->o_req_ndn, &op->o_bd->be_nsuffix[ 0 ],
+                               op->o_tmpmemctx );
 
        } else {
-               if ( dnPrettyNormal( NULL, base, &op.o_req_dn, &op.o_req_ndn,
-                                       op.o_tmpmemctx ) ) {
+               if ( dnPrettyNormal( NULL, base, &op->o_req_dn, &op->o_req_ndn,
+                                       op->o_tmpmemctx ) ) {
                        /* error */
                }
        }
 
-       op.o_callback = &cb;
+       op->o_callback = &cb;
        cb.sc_private = (void *)ndn;
 
-       op.ors_scope = scope;
-       ber_dupbv_x( &op.ors_filterstr, filter, op.o_tmpmemctx );
-       op.ors_filter = str2filter_x( &op, filter->bv_val );
-       op.ors_attrs = anlist;
+       op->ors_scope = scope;
+       ber_dupbv_x( &op->ors_filterstr, filter, op->o_tmpmemctx );
+       op->ors_filter = str2filter_x( op, filter->bv_val );
+       op->ors_attrs = anlist;
        BER_BVSTR( &anlist[ 0 ].an_name, LDAP_NO_ATTRS );
-       op.ors_attrsonly = 0;
-       op.ors_tlimit = SLAP_NO_LIMIT;
-       op.ors_slimit = 1;
-       op.ors_limit = NULL;
-       op.ors_deref = LDAP_DEREF_NEVER;
+       BER_BVZERO( &anlist[ 1 ].an_name );
+       op->ors_attrsonly = 0;
+       op->ors_tlimit = SLAP_NO_LIMIT;
+       op->ors_slimit = 1;
+       op->ors_limit = NULL;
+       op->ors_deref = LDAP_DEREF_NEVER;
 
-       op.o_nocaching = 1;
-       op.o_managedsait = 1;
+       op->o_nocaching = 1;
+       op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
 
-       rc = op.o_bd->be_search( &op, &rs );
+       rc = op->o_bd->be_search( op, &rs );
 
-       filter_free_x( &op, op.ors_filter );
-       op.o_tmpfree( op.ors_filterstr.bv_val, op.o_tmpmemctx );
-       op.o_tmpfree( op.o_req_dn.bv_val, op.o_tmpmemctx );
-       op.o_tmpfree( op.o_req_ndn.bv_val, op.o_tmpmemctx );
+       filter_free_x( op, op->ors_filter );
+       op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
+       op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
+       op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
 
        if ( rc != 0 ) {
                return rc;
@@ -813,7 +800,7 @@ monitor_back_db_init(
                        "DESC 'monitor managed entity class' "
                        "SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
                        offsetof(monitor_info_t, mi_oc_managedObject) },
-               { "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.13 "
+               { "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.14 "
                        "NAME 'monitoredObject' "
                        "DESC 'monitor monitored entity class' "
                        "SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
@@ -943,12 +930,14 @@ monitor_back_db_init(
                        "DESC 'RFC2256: locality which this object resides in' "
                        "SUP name )", 0,
                        offsetof(monitor_info_t, mi_ad_l) },
+#ifdef MONITOR_DEFINE_LABELEDURI
                { "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(monitor_info_t, mi_ad_labeledURI) },
+#endif /* MONITOR_DEFINE_LABELEDURI */
                { NULL, NULL, 0, -1 }
        };
        
@@ -1468,3 +1457,10 @@ monitor_back_db_destroy(
        return 0;
 }
 
+#if SLAPD_MONITOR == SLAPD_MOD_DYNAMIC
+
+/* conditionally define the init_module() function */
+SLAP_BACKEND_INIT_MODULE( monitor )
+
+#endif /* SLAPD_MONITOR == SLAPD_MOD_DYNAMIC */
+