]> git.sur5r.net Git - openldap/blob - servers/slapd/back-monitor/proto-back-monitor.h
lots of cleanup; few improvements; fix RDN selection bug when creating connection...
[openldap] / servers / slapd / back-monitor / proto-back-monitor.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 2001-2004 The OpenLDAP Foundation.
5  * Portions Copyright 2001-2003 Pierangelo Masarati.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
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>.
15  */
16 /* ACKNOWLEDGEMENTS:
17  * This work was initially developed by Pierangelo Masarati for inclusion
18  * in OpenLDAP Software.
19  */
20
21 #ifndef _PROTO_BACK_MONITOR
22 #define _PROTO_BACK_MONITOR
23
24 #include <ldap_cdefs.h>
25
26 #include "external.h"
27
28 LDAP_BEGIN_DECL
29
30 /*
31  * entry
32  */
33 int monitor_entry_test_flags LDAP_P(( struct monitorentrypriv *mp, int cond ));
34
35 /*
36  * backends
37  */
38 int monitor_subsys_backend_init LDAP_P(( BackendDB *be ));
39
40 /*
41  * databases 
42  */
43 int monitor_subsys_database_init LDAP_P(( BackendDB *be ));
44 int monitor_subsys_database_modify LDAP_P(( Operation *op, Entry *e ));
45
46 /*
47  * threads
48  */
49 int monitor_subsys_thread_init LDAP_P(( BackendDB *be ));
50 int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
51
52 /*
53  * connections
54  */
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 ));
59
60 /*
61  * waiters
62  */
63 int monitor_subsys_rww_init LDAP_P(( BackendDB *be ));
64 int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
65
66 /*
67  * log
68  */
69 int monitor_subsys_log_init LDAP_P(( BackendDB *be ));
70 int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
71
72 /*
73  * operations
74  */
75 int monitor_subsys_ops_init LDAP_P(( BackendDB *be ));
76 int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
77
78 /*
79  * overlay
80  */
81 int monitor_subsys_overlay_init LDAP_P(( BackendDB *be ));
82
83 /*
84  * sent
85  */
86 int monitor_subsys_sent_init LDAP_P(( BackendDB *be ));
87 int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e ));
88
89 /*
90  * listener
91  */
92 int monitor_subsys_listener_init LDAP_P(( BackendDB *be ));
93
94 /*
95  * time
96  */
97 int monitor_subsys_time_init LDAP_P(( BackendDB *be ));
98 int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
99
100 /* NOTE: this macro assumes that bv has been allocated
101  * by ber_* malloc functions or is { 0L, NULL } */
102 #ifdef HAVE_GMP
103 /* NOTE: according to the documentation, the result 
104  * of mpz_sizeinbase() can exceed the length of the
105  * string representation of the number by 1
106  */
107 #define UI2BV(bv,ui) \
108         do { \
109                 ber_len_t       len = mpz_sizeinbase( (ui), 10 ); \
110                 if ( len > (bv)->bv_len ) { \
111                         (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
112                 } \
113                 (void)mpz_get_str( (bv)->bv_val, 10, (ui) ); \
114                 if ( (bv)->bv_val[ len - 1 ] == '\0' ) { \
115                         len--; \
116                 } \
117                 (bv)->bv_len = len; \
118         } while ( 0 )
119 #else /* ! HAVE_GMP */
120 #define UI2BV(bv,ui) \
121         do { \
122                 char            buf[] = "+9223372036854775807L"; \
123                 ber_len_t       len; \
124                 snprintf( buf, sizeof( buf ), "%lu", (ui) ); \
125                 len = strlen( buf ); \
126                 if ( len > (bv)->bv_len ) { \
127                         (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
128                 } \
129                 AC_MEMCPY( (bv)->bv_val, buf, len + 1 ); \
130         } while ( 0 )
131 #endif /* ! HAVE_GMP */
132
133 LDAP_END_DECL
134
135 #endif /* _PROTO_BACK_MONITOR */
136