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>
31 int monitor_subsys_backend_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
36 extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
37 extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
38 extern int monitor_cache_add LDAP_P(( monitor_info_t *mi, Entry *e ));
39 extern int monitor_cache_get LDAP_P(( monitor_info_t *mi, struct berval *ndn, Entry **ep ));
40 extern int monitor_cache_dn2entry LDAP_P(( Operation *op, struct berval *ndn, Entry **ep, Entry **matched ));
41 extern int monitor_cache_lock LDAP_P(( Entry *e ));
42 extern int monitor_cache_release LDAP_P(( monitor_info_t *mi, Entry *e ));
47 int monitor_subsys_conn_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
48 int monitor_subsys_conn_update LDAP_P(( Operation *op, Entry *e ));
49 int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
50 Entry *e_parent, Entry **ep ));
55 int monitor_subsys_database_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
56 int monitor_subsys_database_modify LDAP_P(( Operation *op, Entry *e ));
61 extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
62 extern int monitor_entry_create LDAP_P(( Operation *op, struct berval *ndn,
63 Entry *e_parent, Entry **ep ));
64 extern int monitor_entry_modify LDAP_P(( Operation *op, Entry *e ));
65 int monitor_entry_test_flags LDAP_P(( monitor_entry_t *mp, int cond ));
66 extern monitor_entry_t * monitor_entrypriv_create LDAP_P(( void ));
71 extern int monitor_back_register_subsys LDAP_P(( monitor_subsys_t *ms ));
72 extern monitor_subsys_t * monitor_back_get_subsys LDAP_P(( const char *name ));
73 extern monitor_subsys_t * monitor_back_get_subsys_by_dn LDAP_P(( struct berval *ndn, int sub ));
78 int monitor_subsys_listener_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
83 int monitor_subsys_log_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
84 int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
89 int monitor_subsys_ops_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
90 int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
95 int monitor_subsys_overlay_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
100 int monitor_subsys_sent_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
101 int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e ));
106 int monitor_subsys_thread_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
107 int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
112 int monitor_subsys_time_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
113 int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
118 int monitor_subsys_rww_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
119 int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
121 /* NOTE: this macro assumes that bv has been allocated
122 * by ber_* malloc functions or is { 0L, NULL } */
123 #if defined(HAVE_BIGNUM)
124 #define UI2BV(bv,ui) \
128 val = BN_bn2dec(ui); \
131 if ( len > (bv)->bv_len ) { \
132 (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
134 AC_MEMCPY((bv)->bv_val, val, len + 1); \
135 (bv)->bv_len = len; \
138 ber_memfree( (bv)->bv_val ); \
139 BER_BVZERO( (bv) ); \
142 #elif defined(HAVE_GMP)
143 /* NOTE: according to the documentation, the result
144 * of mpz_sizeinbase() can exceed the length of the
145 * string representation of the number by 1
147 #define UI2BV(bv,ui) \
149 ber_len_t len = mpz_sizeinbase( (ui), 10 ); \
150 if ( len > (bv)->bv_len ) { \
151 (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
153 (void)mpz_get_str( (bv)->bv_val, 10, (ui) ); \
154 if ( (bv)->bv_val[ len - 1 ] == '\0' ) { \
157 (bv)->bv_len = len; \
159 #else /* ! HAVE_BIGNUM && ! HAVE_GMP */
160 #define UI2BV(bv,ui) \
162 char buf[] = "+9223372036854775807L"; \
164 snprintf( buf, sizeof( buf ), "%lu", (ui) ); \
165 len = strlen( buf ); \
166 if ( len > (bv)->bv_len ) { \
167 (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
169 AC_MEMCPY( (bv)->bv_val, buf, len + 1 ); \
171 #endif /* ! HAVE_GMP */
177 extern BI_db_init monitor_back_db_init;
178 extern BI_db_open monitor_back_db_open;
179 extern BI_config monitor_back_config;
180 extern BI_db_destroy monitor_back_db_destroy;
181 extern BI_db_config monitor_back_db_config;
183 extern BI_op_search monitor_back_search;
184 extern BI_op_compare monitor_back_compare;
185 extern BI_op_modify monitor_back_modify;
186 extern BI_op_bind monitor_back_bind;
187 extern BI_operational monitor_back_operational;
191 #endif /* _PROTO_BACK_MONITOR */