2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2001-2004 The OpenLDAP Foundation.
5 * Portions Copyright 2001-2003 Pierangelo Masarati.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was initially developed by Pierangelo Masarati for inclusion
18 * in OpenLDAP Software.
21 #ifndef _PROTO_BACK_MONITOR
22 #define _PROTO_BACK_MONITOR
24 #include <ldap_cdefs.h>
33 int monitor_entry_test_flags LDAP_P(( struct monitorentrypriv *mp, int cond ));
38 int monitor_subsys_backend_init LDAP_P(( BackendDB *be ));
43 int monitor_subsys_database_init LDAP_P(( BackendDB *be ));
44 int monitor_subsys_database_modify LDAP_P(( Operation *op, Entry *e ));
49 int monitor_subsys_thread_init LDAP_P(( BackendDB *be ));
50 int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
55 int monitor_subsys_conn_init LDAP_P(( BackendDB *be ));
56 int monitor_subsys_conn_update LDAP_P(( Operation *op, Entry *e ));
57 int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
58 Entry *e_parent, Entry **ep ));
63 int monitor_subsys_rww_init LDAP_P(( BackendDB *be ));
64 int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
69 int monitor_subsys_log_init LDAP_P(( BackendDB *be ));
70 int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
75 int monitor_subsys_ops_init LDAP_P(( BackendDB *be ));
76 int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
81 int monitor_subsys_overlay_init LDAP_P(( BackendDB *be ));
86 int monitor_subsys_sent_init LDAP_P(( BackendDB *be ));
87 int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e ));
92 int monitor_subsys_listener_init LDAP_P(( BackendDB *be ));
97 int monitor_subsys_time_init LDAP_P(( BackendDB *be ));
98 int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
100 /* NOTE: this macro assumes that bv has been allocated
101 * by ber_* malloc functions or is { 0L, NULL } */
102 #if defined(HAVE_BIGNUM)
103 #define UI2BV(bv,ui) \
107 val = BN_bn2dec(ui); \
110 if ( len > (bv)->bv_len ) { \
111 (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
113 AC_MEMCPY((bv)->bv_val, val, len + 1); \
114 (bv)->bv_len = len; \
117 ber_memfree( (bv)->bv_val ); \
118 BER_BVZERO( (bv) ); \
121 #elif defined(HAVE_GMP)
122 /* NOTE: according to the documentation, the result
123 * of mpz_sizeinbase() can exceed the length of the
124 * string representation of the number by 1
126 #define UI2BV(bv,ui) \
128 ber_len_t len = mpz_sizeinbase( (ui), 10 ); \
129 if ( len > (bv)->bv_len ) { \
130 (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
132 (void)mpz_get_str( (bv)->bv_val, 10, (ui) ); \
133 if ( (bv)->bv_val[ len - 1 ] == '\0' ) { \
136 (bv)->bv_len = len; \
138 #else /* ! HAVE_BIGNUM && ! HAVE_GMP */
139 #define UI2BV(bv,ui) \
141 char buf[] = "+9223372036854775807L"; \
143 snprintf( buf, sizeof( buf ), "%lu", (ui) ); \
144 len = strlen( buf ); \
145 if ( len > (bv)->bv_len ) { \
146 (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
148 AC_MEMCPY( (bv)->bv_val, buf, len + 1 ); \
150 #endif /* ! HAVE_GMP */
154 #endif /* _PROTO_BACK_MONITOR */