+typedef void (*BER_LOG_PRINT_FN) LDAP_P(( LDAP_CONST char *buf ));
+
+typedef void* (BER_MEMALLOC_FN) LDAP_P(( ber_len_t size, void *ctx ));
+typedef void* (BER_MEMCALLOC_FN) LDAP_P(( ber_len_t n, ber_len_t size, void *ctx ));
+typedef void* (BER_MEMREALLOC_FN) LDAP_P(( void *p, ber_len_t size, void *ctx ));
+typedef void (BER_MEMFREE_FN) LDAP_P(( void *p, void *ctx ));
+
+typedef struct lber_memory_fns {
+ BER_MEMALLOC_FN *bmf_malloc;
+ BER_MEMCALLOC_FN *bmf_calloc;
+ BER_MEMREALLOC_FN *bmf_realloc;
+ BER_MEMFREE_FN *bmf_free;
+} BerMemoryFunctions;
+
+/* LBER Sockbuf_IO options */
+#define LBER_SB_OPT_GET_FD 1
+#define LBER_SB_OPT_SET_FD 2
+#define LBER_SB_OPT_HAS_IO 3
+#define LBER_SB_OPT_SET_NONBLOCK 4
+#define LBER_SB_OPT_GET_SSL 7
+#define LBER_SB_OPT_DATA_READY 8
+#define LBER_SB_OPT_SET_READAHEAD 9
+#define LBER_SB_OPT_DRAIN 10
+#define LBER_SB_OPT_NEEDS_READ 11
+#define LBER_SB_OPT_NEEDS_WRITE 12
+#define LBER_SB_OPT_GET_MAX_INCOMING 13
+#define LBER_SB_OPT_SET_MAX_INCOMING 14
+/* Largest option used by the library */
+#define LBER_SB_OPT_OPT_MAX 14
+
+/* LBER IO operations stacking levels */
+#define LBER_SBIOD_LEVEL_PROVIDER 10
+#define LBER_SBIOD_LEVEL_TRANSPORT 20
+#define LBER_SBIOD_LEVEL_APPLICATION 30
+
+/* get/set options for Sockbuf */
+#define LBER_OPT_SOCKBUF_DESC 0x1000
+#define LBER_OPT_SOCKBUF_OPTIONS 0x1001
+#define LBER_OPT_SOCKBUF_DEBUG 0x1002
+
+/* on/off values */
+LBER_V( char ) ber_pvt_opt_on;
+#define LBER_OPT_ON ((void *) &ber_pvt_opt_on)
+#define LBER_OPT_OFF ((void *) 0)
+
+#define LBER_OPT_SUCCESS (0)
+#define LBER_OPT_ERROR (-1)
+
+typedef struct berelement BerElement;
+typedef struct sockbuf Sockbuf;