]> git.sur5r.net Git - openldap/blobdiff - include/lber.h
remove init arg from attrs_index_config proto
[openldap] / include / lber.h
index be36e58bb4ff9ecae91a338707e0aeefbf53155b..833d894e06c93e4a50b3cae8830f479464745c33 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted only
@@ -80,15 +80,9 @@ LDAP_BEGIN_DECL
 #define LBER_SEQUENCE          ((ber_tag_t) 0x30UL)    /* constructed */
 #define LBER_SET                       ((ber_tag_t) 0x31UL)    /* constructed */
 
-typedef int (*BERTranslateProc) LDAP_P((
-       char **bufp,
-       ber_len_t *buflenp,
-       int free_input ));
-
 /* LBER BerElement options */
 #define LBER_USE_DER           0x01
 #define LBER_USE_INDEFINITE_LEN        0x02
-#define LBER_TRANSLATE_STRINGS 0x04    /* deprecated */
 
 /* get/set options for BerElement */
 #define LBER_OPT_BER_OPTIONS                   0x01
@@ -105,6 +99,7 @@ typedef int (*BERTranslateProc) LDAP_P((
 #define LBER_OPT_LOG_PRINT_FN  0x8001
 #define LBER_OPT_MEMORY_FNS            0x8002
 #define LBER_OPT_ERROR_FN              0x8003
+#define LBER_OPT_LOG_PRINT_FILE                0x8004
 
 typedef int* (*BER_ERRNO_FN) LDAP_P(( void ));
 
@@ -122,11 +117,26 @@ typedef struct lber_memory_fns {
        BER_MEMFREE_FN bmf_free;
 } BerMemoryFunctions;
 
-/* LBER Sockbuf options */ 
-#define LBER_TO_FILE           0x01    /* to a file referenced by sb_fd   */
-#define LBER_TO_FILE_ONLY      0x02    /* only write to file, not network */
-#define LBER_MAX_INCOMING_SIZE 0x04    /* impose limit on incoming stuff  */
-#define LBER_NO_READ_AHEAD     0x08    /* read only as much as requested  */
+/* 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_UDP_GET_SRC                5
+#define LBER_SB_OPT_UDP_SET_DST                6
+#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
+/* Largest option used by the library */
+#define LBER_SB_OPT_OPT_MAX            12
+
+/* 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
@@ -144,6 +154,43 @@ typedef struct berelement BerElement;
 typedef struct sockbuf Sockbuf;
 typedef struct seqorset Seqorset;
 
+typedef struct sockbuf_io Sockbuf_IO;
+
+/* Structure for LBER IO operarion descriptor */
+typedef struct sockbuf_io_desc {
+       int                     sbiod_level;
+       Sockbuf                 *sbiod_sb;
+       Sockbuf_IO              *sbiod_io;
+       void                    *sbiod_pvt;
+       struct sockbuf_io_desc  *sbiod_next;
+} Sockbuf_IO_Desc;
+
+/* Structure for LBER IO operation functions */
+struct sockbuf_io {
+       int (*sbi_setup)( Sockbuf_IO_Desc *sbiod, void *arg );
+       int (*sbi_remove)( Sockbuf_IO_Desc *sbiod );
+       int (*sbi_ctrl)( Sockbuf_IO_Desc *sbiod, int opt, void *arg);
+       
+       ber_slen_t (*sbi_read)( Sockbuf_IO_Desc *sbiod, void *buf,
+               ber_len_t len );
+       ber_slen_t (*sbi_write)( Sockbuf_IO_Desc *sbiod, void *buf,
+               ber_len_t len );
+       
+       int (*sbi_close)( Sockbuf_IO_Desc *sbiod );
+};
+
+/* Helper macros for LBER IO functions */
+#define LBER_SBIOD_READ_NEXT( sbiod, buf, len ) \
+       ( (sbiod)->sbiod_next->sbiod_io->sbi_read( (sbiod)->sbiod_next, \
+               buf, len ) )
+#define LBER_SBIOD_WRITE_NEXT( sbiod, buf, len ) \
+       ( (sbiod)->sbiod_next->sbiod_io->sbi_write( (sbiod)->sbiod_next, \
+               buf, len ) )
+#define LBER_SBIOD_CTRL_NEXT( sbiod, opt, arg ) \
+       ( (sbiod)->sbiod_next ? \
+               ( (sbiod)->sbiod_next->sbiod_io->sbi_ctrl( \
+               (sbiod)->sbiod_next, opt, arg ) ) : 0 )
+
 /* structure for returning a sequence of octet strings + length */
 typedef struct berval {
        ber_len_t       bv_len;
@@ -199,6 +246,11 @@ ber_get_int LDAP_P((
        BerElement *ber,
        ber_int_t *num ));
 
+LIBLBER_F( ber_tag_t )
+ber_get_enum LDAP_P((
+       BerElement *ber,
+       ber_int_t *num ));
+
 LIBLBER_F( ber_tag_t )
 ber_get_stringb LDAP_P((
        BerElement *ber,
@@ -248,12 +300,6 @@ ber_scanf LDAP_P((
        LDAP_CONST char *fmt,
        ... ));
 
-LIBLBER_F( void )
-ber_set_string_translators LDAP_P((
-       BerElement *ber,
-       BERTranslateProc encode_proc,
-       BERTranslateProc decode_proc ));
-
 /*
  * in encode.c
  */
@@ -422,16 +468,38 @@ ber_set_option LDAP_P((
  * LBER sockbuf.c
  */
 
-LIBLBER_F( Sockbuf * )
-ber_sockbuf_alloc( void );
-
 LIBLBER_F( Sockbuf *  )
-ber_sockbuf_alloc_fd(
-       ber_socket_t fd );
+ber_sockbuf_alloc LDAP_P((
+       void ));
 
 LIBLBER_F( void )
-ber_sockbuf_free(
-       Sockbuf *sb );
+ber_sockbuf_free LDAP_P((
+       Sockbuf *sb ));
+
+LIBLBER_F( int )
+ber_sockbuf_add_io LDAP_P((
+       Sockbuf *sb,
+       Sockbuf_IO *sbio,
+       int layer,
+       void *arg ));
+
+LIBLBER_F( int )
+ber_sockbuf_remove_io LDAP_P((
+       Sockbuf *sb,
+       Sockbuf_IO *sbio,
+       int layer ));
+
+LIBLBER_F( int )
+ber_sockbuf_ctrl LDAP_P((
+       Sockbuf *sb,
+       int opt,
+       void *arg ));
+
+LIBLBER_F( Sockbuf_IO ) ber_sockbuf_io_tcp;
+LIBLBER_F( Sockbuf_IO ) ber_sockbuf_io_udp;
+LIBLBER_F( Sockbuf_IO ) ber_sockbuf_io_readahead;
+LIBLBER_F( Sockbuf_IO ) ber_sockbuf_io_fd;
+LIBLBER_F( Sockbuf_IO ) ber_sockbuf_io_debug;
 
 /*
  * LBER memory.c
@@ -466,10 +534,23 @@ LIBLBER_F( void )
 ber_bvecfree LDAP_P((
        struct berval **bv ));
 
+LIBLBER_F( int )
+ber_bvecadd LDAP_P((
+       struct berval ***bvec,
+       struct berval *bv ));
+
 LIBLBER_F( struct berval * )
 ber_bvdup LDAP_P((
        LDAP_CONST struct berval *bv ));
 
+LIBLBER_F( struct berval * )
+ber_bvstr LDAP_P((
+       LDAP_CONST char * ));
+
+LIBLBER_F( struct berval * )
+ber_bvstrdup LDAP_P((
+       LDAP_CONST char * ));
+
 LIBLBER_F( char * )
 ber_strdup LDAP_P((
        LDAP_CONST char * ));