#include "portable.h"
#include <stdio.h>
+#include <ac/string.h>
#include "slap.h"
#include "back-monitor.h"
Entry *e, *e_tmp, *e_sent;
struct monitorentrypriv *mp;
- char buf[1024];
+ char buf[ BACKMONITOR_BUFSIZE ];
struct berval bv;
assert( be != NULL );
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Entries,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Entries\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, monitor_ad_desc, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Referrals,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Referrals\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, monitor_ad_desc, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=PDU,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: PDU\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, monitor_ad_desc, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
*/
snprintf( buf, sizeof( buf ),
"dn: cn=Bytes,%s\n"
- SLAPD_MONITOR_OBJECTCLASSES
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
"cn: Bytes\n",
- monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val );
+ monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val,
+ mi->oc_monitorCounterObject->soc_cname.bv_val );
e = str2entry( buf );
if ( e == NULL ) {
bv.bv_val = "0";
bv.bv_len = 1;
- attr_merge_one( e, monitor_ad_desc, &bv, NULL );
+ attr_merge_one( e, mi->ad_monitorCounter, &bv, NULL );
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
int
monitor_subsys_sent_update(
- struct monitorinfo *mi,
+ Operation *op,
Entry *e
)
{
+ struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
long n = -1;
assert( mi );
if ( n != -1 ) {
Attribute *a;
- char buf[16];
+ char buf[] = "+9223372036854775807L";
- a = attr_find( e->e_attrs, monitor_ad_desc );
+ a = attr_find( e->e_attrs, mi->ad_monitorCounter);
if ( a == NULL ) {
return( -1 );
}
snprintf( buf, sizeof( buf ), "%ld", n );
free( a->a_vals[ 0 ].bv_val );
- ber_str2bv( buf, 0, 1, a->a_vals );
+ ber_str2bv( buf, 0, 1, &a->a_vals[ 0 ] );
}
return( 0 );