]> git.sur5r.net Git - openldap/blob - servers/slapd/back-monitor/proto-back-monitor.h
remove back-*/external.h
[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 LDAP_BEGIN_DECL
27
28 /*
29  * backends
30  */
31 int monitor_subsys_backend_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
32
33 /*
34  * cache
35  */
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 ));
43
44 /*
45  * connections
46  */
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 ));
51
52 /*
53  * databases 
54  */
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 ));
57
58 /*
59  * entry
60  */
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 ));
67
68 /*
69  * init
70  */
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 ));
74 extern int monitor_back_register_entry LDAP_P(( Entry *e, monitor_callback_t *cb ));
75 extern int monitor_filter2ndn LDAP_P(( struct berval *base, int scope, struct berval *filter, struct berval *ndn ));
76 extern int monitor_back_register_entry_attrs LDAP_P(( struct berval *ndn, Attribute *a, monitor_callback_t *cb, struct berval *base, int scope, struct berval *filter ));
77 extern int monitor_back_register_entry_callback LDAP_P(( struct berval *ndn, monitor_callback_t *cb, struct berval *base, int scope, struct berval *filter ));
78
79 /*
80  * listener
81  */
82 int monitor_subsys_listener_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
83
84 /*
85  * log
86  */
87 int monitor_subsys_log_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
88 int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
89
90 /*
91  * operations
92  */
93 int monitor_subsys_ops_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
94 int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
95
96 /*
97  * overlay
98  */
99 int monitor_subsys_overlay_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
100
101 /*
102  * sent
103  */
104 int monitor_subsys_sent_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
105 int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e ));
106
107 /*
108  * threads
109  */
110 int monitor_subsys_thread_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
111 int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
112
113 /*
114  * time
115  */
116 int monitor_subsys_time_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
117 int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
118
119 /*
120  * waiters
121  */
122 int monitor_subsys_rww_init LDAP_P(( BackendDB *be, monitor_subsys_t *ms ));
123 int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
124
125 /* NOTE: this macro assumes that bv has been allocated
126  * by ber_* malloc functions or is { 0L, NULL } */
127 #if defined(HAVE_BIGNUM)
128 #define UI2BV(bv,ui) \
129         do { \
130                 char            *val; \
131                 ber_len_t       len; \
132                 val = BN_bn2dec(ui); \
133                 if (val) { \
134                         len = strlen(val); \
135                         if ( len > (bv)->bv_len ) { \
136                                 (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
137                         } \
138                         AC_MEMCPY((bv)->bv_val, val, len + 1); \
139                         (bv)->bv_len = len; \
140                         OPENSSL_free(val); \
141                 } else { \
142                         ber_memfree( (bv)->bv_val ); \
143                         BER_BVZERO( (bv) ); \
144                 } \
145         } while ( 0 )
146 #elif defined(HAVE_GMP)
147 /* NOTE: according to the documentation, the result 
148  * of mpz_sizeinbase() can exceed the length of the
149  * string representation of the number by 1
150  */
151 #define UI2BV(bv,ui) \
152         do { \
153                 ber_len_t       len = mpz_sizeinbase( (ui), 10 ); \
154                 if ( len > (bv)->bv_len ) { \
155                         (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
156                 } \
157                 (void)mpz_get_str( (bv)->bv_val, 10, (ui) ); \
158                 if ( (bv)->bv_val[ len - 1 ] == '\0' ) { \
159                         len--; \
160                 } \
161                 (bv)->bv_len = len; \
162         } while ( 0 )
163 #else /* ! HAVE_BIGNUM && ! HAVE_GMP */
164 #define UI2BV(bv,ui) \
165         do { \
166                 char            buf[] = "+9223372036854775807L"; \
167                 ber_len_t       len; \
168                 snprintf( buf, sizeof( buf ), "%lu", (ui) ); \
169                 len = strlen( buf ); \
170                 if ( len > (bv)->bv_len ) { \
171                         (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
172                 } \
173                 AC_MEMCPY( (bv)->bv_val, buf, len + 1 ); \
174         } while ( 0 )
175 #endif /* ! HAVE_GMP */
176
177 /*
178  * former external.h
179  */
180
181 extern BI_init                  monitor_back_initialize;
182
183 extern BI_db_init               monitor_back_db_init;
184 extern BI_db_open               monitor_back_db_open;
185 extern BI_config                monitor_back_config;
186 extern BI_db_destroy            monitor_back_db_destroy;
187 extern BI_db_config             monitor_back_db_config;
188
189 extern BI_op_search             monitor_back_search;
190 extern BI_op_compare            monitor_back_compare;
191 extern BI_op_modify             monitor_back_modify;
192 extern BI_op_bind               monitor_back_bind;
193 extern BI_operational           monitor_back_operational;
194
195 LDAP_END_DECL
196
197 #endif /* _PROTO_BACK_MONITOR */
198