Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-17 09:55:46

0001 /* $OpenLDAP$ */
0002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
0003  *
0004  * Copyright 1998-2024 The OpenLDAP Foundation.
0005  * All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted only as authorized by the OpenLDAP
0009  * Public License.
0010  *
0011  * A copy of this license is available in file LICENSE in the
0012  * top-level directory of the distribution or, alternatively, at
0013  * <http://www.OpenLDAP.org/license.html>.
0014  */
0015 /* Portions Copyright (c) 1990 Regents of the University of Michigan.
0016  * All rights reserved.
0017  *
0018  * Redistribution and use in source and binary forms are permitted
0019  * provided that this notice is preserved and that due credit is given
0020  * to the University of Michigan at Ann Arbor. The name of the University
0021  * may not be used to endorse or promote products derived from this
0022  * software without specific prior written permission. This software
0023  * is provided ``as is'' without express or implied warranty.
0024  */
0025 
0026 #ifndef _LBER_H
0027 #define _LBER_H
0028 
0029 #include <lber_types.h>
0030 #include <string.h>
0031 
0032 LDAP_BEGIN_DECL
0033 
0034 /*
0035  * ber_tag_t represents the identifier octets at the beginning of BER
0036  * elements.  OpenLDAP treats them as mere big-endian unsigned integers.
0037  *
0038  * Actually the BER identifier octets look like this:
0039  *
0040  *  Bits of 1st octet:
0041  *  ______
0042  *  8 7 | CLASS
0043  *  0 0 = UNIVERSAL
0044  *  0 1 = APPLICATION
0045  *  1 0 = CONTEXT-SPECIFIC
0046  *  1 1 = PRIVATE
0047  *      _____
0048  *      | 6 | DATA-TYPE
0049  *        0 = PRIMITIVE
0050  *        1 = CONSTRUCTED
0051  *          ___________
0052  *          | 5 ... 1 | TAG-NUMBER
0053  *
0054  *  For ASN.1 tag numbers >= 0x1F, TAG-NUMBER above is 0x1F and the next
0055  *  BER octets contain the actual ASN.1 tag number:  Big-endian, base
0056  *  128, 8.bit = 1 in all but the last octet, minimum number of octets.
0057  */
0058 
0059 /* BER classes and mask (in 1st identifier octet) */
0060 #define LBER_CLASS_UNIVERSAL    ((ber_tag_t) 0x00U)
0061 #define LBER_CLASS_APPLICATION  ((ber_tag_t) 0x40U)
0062 #define LBER_CLASS_CONTEXT      ((ber_tag_t) 0x80U)
0063 #define LBER_CLASS_PRIVATE      ((ber_tag_t) 0xc0U)
0064 #define LBER_CLASS_MASK         ((ber_tag_t) 0xc0U)
0065 
0066 /* BER encoding type and mask (in 1st identifier octet) */
0067 #define LBER_PRIMITIVE          ((ber_tag_t) 0x00U)
0068 #define LBER_CONSTRUCTED        ((ber_tag_t) 0x20U)
0069 #define LBER_ENCODING_MASK      ((ber_tag_t) 0x20U)
0070 
0071 #define LBER_BIG_TAG_MASK       ((ber_tag_t) 0x1fU)
0072 #define LBER_MORE_TAG_MASK      ((ber_tag_t) 0x80U)
0073 
0074 /*
0075  * LBER_ERROR and LBER_DEFAULT are values that can never appear
0076  * as valid BER tags, so it is safe to use them to report errors.
0077  * Valid tags have (tag & (ber_tag_t) 0xFF) != 0xFF.
0078  */
0079 #define LBER_ERROR          ((ber_tag_t) -1)
0080 #define LBER_DEFAULT        ((ber_tag_t) -1)
0081 
0082 /* general BER types we know about */
0083 #define LBER_BOOLEAN        ((ber_tag_t) 0x01UL)
0084 #define LBER_INTEGER        ((ber_tag_t) 0x02UL)
0085 #define LBER_BITSTRING      ((ber_tag_t) 0x03UL)
0086 #define LBER_OCTETSTRING    ((ber_tag_t) 0x04UL)
0087 #define LBER_NULL           ((ber_tag_t) 0x05UL)
0088 #define LBER_ENUMERATED     ((ber_tag_t) 0x0aUL)
0089 #define LBER_SEQUENCE       ((ber_tag_t) 0x30UL)    /* constructed */
0090 #define LBER_SET            ((ber_tag_t) 0x31UL)    /* constructed */
0091 
0092 /* LBER BerElement options */
0093 #define LBER_USE_DER        0x01
0094 
0095 /* get/set options for BerElement */
0096 #define LBER_OPT_BER_OPTIONS            0x01
0097 #define LBER_OPT_BER_DEBUG              0x02
0098 #define LBER_OPT_BER_REMAINING_BYTES    0x03
0099 #define LBER_OPT_BER_TOTAL_BYTES        0x04
0100 #define LBER_OPT_BER_BYTES_TO_WRITE     0x05
0101 #define LBER_OPT_BER_MEMCTX             0x06
0102 
0103 #define LBER_OPT_DEBUG_LEVEL    LBER_OPT_BER_DEBUG
0104 #define LBER_OPT_REMAINING_BYTES    LBER_OPT_BER_REMAINING_BYTES
0105 #define LBER_OPT_TOTAL_BYTES        LBER_OPT_BER_TOTAL_BYTES
0106 #define LBER_OPT_BYTES_TO_WRITE     LBER_OPT_BER_BYTES_TO_WRITE
0107 
0108 #define LBER_OPT_LOG_PRINT_FN   0x8001
0109 #define LBER_OPT_MEMORY_FNS     0x8002
0110 #define LBER_OPT_ERROR_FN       0x8003
0111 #define LBER_OPT_LOG_PRINT_FILE     0x8004
0112 
0113 /* get/set Memory Debug options */
0114 #define LBER_OPT_MEMORY_INUSE       0x8005  /* for memory debugging */
0115 #define LBER_OPT_LOG_PROC           0x8006  /* for external logging function */
0116 
0117 typedef int* (*BER_ERRNO_FN) LDAP_P(( void ));
0118 
0119 typedef void (*BER_LOG_PRINT_FN) LDAP_P(( LDAP_CONST char *buf ));
0120 
0121 typedef void* (BER_MEMALLOC_FN) LDAP_P(( ber_len_t size, void *ctx ));
0122 typedef void* (BER_MEMCALLOC_FN)    LDAP_P(( ber_len_t n, ber_len_t size, void *ctx ));
0123 typedef void* (BER_MEMREALLOC_FN)   LDAP_P(( void *p, ber_len_t size, void *ctx ));
0124 typedef void  (BER_MEMFREE_FN)      LDAP_P(( void *p, void *ctx ));
0125 
0126 typedef struct lber_memory_fns {
0127     BER_MEMALLOC_FN *bmf_malloc;
0128     BER_MEMCALLOC_FN *bmf_calloc;
0129     BER_MEMREALLOC_FN *bmf_realloc;
0130     BER_MEMFREE_FN *bmf_free;
0131 } BerMemoryFunctions;
0132 
0133 /* LBER Sockbuf_IO options */
0134 #define LBER_SB_OPT_GET_FD      1
0135 #define LBER_SB_OPT_SET_FD      2
0136 #define LBER_SB_OPT_HAS_IO      3
0137 #define LBER_SB_OPT_SET_NONBLOCK    4
0138 #define LBER_SB_OPT_GET_SSL     7
0139 #define LBER_SB_OPT_DATA_READY      8
0140 #define LBER_SB_OPT_SET_READAHEAD   9
0141 #define LBER_SB_OPT_DRAIN       10
0142 #define LBER_SB_OPT_NEEDS_READ      11
0143 #define LBER_SB_OPT_NEEDS_WRITE     12
0144 #define LBER_SB_OPT_GET_MAX_INCOMING    13
0145 #define LBER_SB_OPT_SET_MAX_INCOMING    14
0146 
0147 /* Only meaningful ifdef LDAP_PF_LOCAL_SENDMSG */
0148 #define LBER_SB_OPT_UNGET_BUF   15
0149 
0150 /* Largest option used by the library */
0151 #define LBER_SB_OPT_OPT_MAX     15
0152 
0153 /* LBER IO operations stacking levels */
0154 #define LBER_SBIOD_LEVEL_PROVIDER   10
0155 #define LBER_SBIOD_LEVEL_TRANSPORT  20
0156 #define LBER_SBIOD_LEVEL_APPLICATION    30
0157 
0158 /* get/set options for Sockbuf */
0159 #define LBER_OPT_SOCKBUF_DESC       0x1000
0160 #define LBER_OPT_SOCKBUF_OPTIONS    0x1001
0161 #define LBER_OPT_SOCKBUF_DEBUG      0x1002
0162 
0163 /* on/off values */
0164 LBER_V( char ) ber_pvt_opt_on;
0165 #define LBER_OPT_ON     ((void *) &ber_pvt_opt_on)
0166 #define LBER_OPT_OFF    ((void *) 0)
0167 
0168 #define LBER_OPT_SUCCESS    (0)
0169 #define LBER_OPT_ERROR      (-1)
0170 
0171 typedef struct berelement BerElement;
0172 typedef struct sockbuf Sockbuf;
0173 
0174 typedef struct sockbuf_io Sockbuf_IO;
0175 
0176 /* Structure for LBER IO operation descriptor */
0177 typedef struct sockbuf_io_desc {
0178     int         sbiod_level;
0179     Sockbuf         *sbiod_sb;
0180     Sockbuf_IO      *sbiod_io;
0181     void            *sbiod_pvt;
0182     struct sockbuf_io_desc  *sbiod_next;
0183 } Sockbuf_IO_Desc;
0184 
0185 /* Structure for LBER IO operation functions */
0186 struct sockbuf_io {
0187     int (*sbi_setup)( Sockbuf_IO_Desc *sbiod, void *arg );
0188     int (*sbi_remove)( Sockbuf_IO_Desc *sbiod );
0189     int (*sbi_ctrl)( Sockbuf_IO_Desc *sbiod, int opt, void *arg);
0190 
0191     ber_slen_t (*sbi_read)( Sockbuf_IO_Desc *sbiod, void *buf,
0192         ber_len_t len );
0193     ber_slen_t (*sbi_write)( Sockbuf_IO_Desc *sbiod, void *buf,
0194         ber_len_t len );
0195 
0196     int (*sbi_close)( Sockbuf_IO_Desc *sbiod );
0197 };
0198 
0199 /* Helper macros for LBER IO functions */
0200 #define LBER_SBIOD_READ_NEXT( sbiod, buf, len ) \
0201     ( (sbiod)->sbiod_next->sbiod_io->sbi_read( (sbiod)->sbiod_next, \
0202         buf, len ) )
0203 #define LBER_SBIOD_WRITE_NEXT( sbiod, buf, len ) \
0204     ( (sbiod)->sbiod_next->sbiod_io->sbi_write( (sbiod)->sbiod_next, \
0205         buf, len ) )
0206 #define LBER_SBIOD_CTRL_NEXT( sbiod, opt, arg ) \
0207     ( (sbiod)->sbiod_next ? \
0208         ( (sbiod)->sbiod_next->sbiod_io->sbi_ctrl( \
0209         (sbiod)->sbiod_next, opt, arg ) ) : 0 )
0210 
0211 /* structure for returning a sequence of octet strings + length */
0212 typedef struct berval {
0213     ber_len_t   bv_len;
0214     char        *bv_val;
0215 } BerValue;
0216 
0217 typedef BerValue *BerVarray;    /* To distinguish from a single bv */
0218 
0219 /* this should be moved to lber-int.h */
0220 
0221 /*
0222  * in bprint.c:
0223  */
0224 LBER_F( void )
0225 ber_error_print LDAP_P((
0226     LDAP_CONST char *data ));
0227 
0228 LBER_F( void )
0229 ber_bprint LDAP_P((
0230     LDAP_CONST char *data, ber_len_t len ));
0231 
0232 LBER_F( void )
0233 ber_dump LDAP_P((
0234     BerElement *ber, int inout ));
0235 
0236 /*
0237  * in decode.c:
0238  */
0239 typedef int (*BERDecodeCallback) LDAP_P((
0240     BerElement *ber,
0241     void *data,
0242     int mode ));
0243 
0244 LBER_F( ber_tag_t )
0245 ber_get_tag LDAP_P((
0246     BerElement *ber ));
0247 
0248 LBER_F( ber_tag_t )
0249 ber_skip_tag LDAP_P((
0250     BerElement *ber,
0251     ber_len_t *len ));
0252 
0253 LBER_F( ber_tag_t )
0254 ber_peek_tag LDAP_P((
0255     BerElement *ber,
0256     ber_len_t *len ));
0257 
0258 LBER_F( ber_tag_t )
0259 ber_skip_raw LDAP_P((
0260     BerElement *ber,
0261     struct berval *bv ));
0262 
0263 LBER_F( ber_tag_t )
0264 ber_skip_element LDAP_P((
0265     BerElement *ber,
0266     struct berval *bv ));
0267 
0268 LBER_F( ber_tag_t )
0269 ber_peek_element LDAP_P((
0270     LDAP_CONST BerElement *ber,
0271     struct berval *bv ));
0272 
0273 LBER_F( ber_tag_t )
0274 ber_get_int LDAP_P((
0275     BerElement *ber,
0276     ber_int_t *num ));
0277 
0278 LBER_F( ber_tag_t )
0279 ber_get_enum LDAP_P((
0280     BerElement *ber,
0281     ber_int_t *num ));
0282 
0283 LBER_F( int )
0284 ber_decode_int LDAP_P((
0285     const struct berval *bv,
0286     ber_int_t *num ));
0287 
0288 LBER_F( ber_tag_t )
0289 ber_get_stringb LDAP_P((
0290     BerElement *ber,
0291     char *buf,
0292     ber_len_t *len ));
0293 
0294 #define LBER_BV_ALLOC   0x01    /* allocate/copy result, otherwise in-place */
0295 #define LBER_BV_NOTERM  0x02    /* omit NUL-terminator if parsing in-place */
0296 #define LBER_BV_STRING  0x04    /* fail if berval contains embedded \0 */
0297 /* LBER_BV_STRING currently accepts a terminating \0 in the berval, because
0298  * Active Directory sends that in at least the diagonsticMessage field.
0299  */
0300 
0301 LBER_F( ber_tag_t )
0302 ber_get_stringbv LDAP_P((
0303     BerElement *ber,
0304     struct berval *bv,
0305     int options ));
0306 
0307 LBER_F( ber_tag_t )
0308 ber_get_stringa LDAP_P((
0309     BerElement *ber,
0310     char **buf ));
0311 
0312 LBER_F( ber_tag_t )
0313 ber_get_stringal LDAP_P((
0314     BerElement *ber,
0315     struct berval **bv ));
0316 
0317 LBER_F( ber_tag_t )
0318 ber_get_bitstringa LDAP_P((
0319     BerElement *ber,
0320     char **buf,
0321     ber_len_t *len ));
0322 
0323 LBER_F( ber_tag_t )
0324 ber_get_null LDAP_P((
0325     BerElement *ber ));
0326 
0327 LBER_F( ber_tag_t )
0328 ber_get_boolean LDAP_P((
0329     BerElement *ber,
0330     ber_int_t *boolval ));
0331 
0332 LBER_F( ber_tag_t )
0333 ber_first_element LDAP_P((
0334     BerElement *ber,
0335     ber_len_t *len,
0336     char **last ));
0337 
0338 LBER_F( ber_tag_t )
0339 ber_next_element LDAP_P((
0340     BerElement *ber,
0341     ber_len_t *len,
0342     LDAP_CONST char *last ));
0343 
0344 LBER_F( ber_tag_t )
0345 ber_scanf LDAP_P((
0346     BerElement *ber,
0347     LDAP_CONST char *fmt,
0348     ... ));
0349 
0350 LBER_F( int )
0351 ber_decode_oid LDAP_P((
0352     struct berval *in,
0353     struct berval *out ));
0354 
0355 /*
0356  * in encode.c
0357  */
0358 LBER_F( int )
0359 ber_encode_oid LDAP_P((
0360     struct berval *in,
0361     struct berval *out ));
0362 
0363 typedef int (*BEREncodeCallback) LDAP_P((
0364     BerElement *ber,
0365     void *data ));
0366 
0367 LBER_F( int )
0368 ber_put_enum LDAP_P((
0369     BerElement *ber,
0370     ber_int_t num,
0371     ber_tag_t tag ));
0372 
0373 LBER_F( int )
0374 ber_put_int LDAP_P((
0375     BerElement *ber,
0376     ber_int_t num,
0377     ber_tag_t tag ));
0378 
0379 LBER_F( int )
0380 ber_put_ostring LDAP_P((
0381     BerElement *ber,
0382     LDAP_CONST char *str,
0383     ber_len_t len,
0384     ber_tag_t tag ));
0385 
0386 LBER_F( int )
0387 ber_put_berval LDAP_P((
0388     BerElement *ber,
0389     struct berval *bv,
0390     ber_tag_t tag ));
0391 
0392 LBER_F( int )
0393 ber_put_string LDAP_P((
0394     BerElement *ber,
0395     LDAP_CONST char *str,
0396     ber_tag_t tag ));
0397 
0398 LBER_F( int )
0399 ber_put_bitstring LDAP_P((
0400     BerElement *ber,
0401     LDAP_CONST char *str,
0402     ber_len_t bitlen,
0403     ber_tag_t tag ));
0404 
0405 LBER_F( int )
0406 ber_put_null LDAP_P((
0407     BerElement *ber,
0408     ber_tag_t tag ));
0409 
0410 LBER_F( int )
0411 ber_put_boolean LDAP_P((
0412     BerElement *ber,
0413     ber_int_t boolval,
0414     ber_tag_t tag ));
0415 
0416 LBER_F( int )
0417 ber_start_seq LDAP_P((
0418     BerElement *ber,
0419     ber_tag_t tag ));
0420 
0421 LBER_F( int )
0422 ber_start_set LDAP_P((
0423     BerElement *ber,
0424     ber_tag_t tag ));
0425 
0426 LBER_F( int )
0427 ber_put_seq LDAP_P((
0428     BerElement *ber ));
0429 
0430 LBER_F( int )
0431 ber_put_set LDAP_P((
0432     BerElement *ber ));
0433 
0434 LBER_F( int )
0435 ber_printf LDAP_P((
0436     BerElement *ber,
0437     LDAP_CONST char *fmt,
0438     ... ));
0439 
0440 
0441 /*
0442  * in io.c:
0443  */
0444 
0445 LBER_F( ber_slen_t )
0446 ber_skip_data LDAP_P((
0447     BerElement *ber,
0448     ber_len_t len ));
0449 
0450 LBER_F( ber_slen_t )
0451 ber_read LDAP_P((
0452     BerElement *ber,
0453     char *buf,
0454     ber_len_t len ));
0455 
0456 LBER_F( ber_slen_t )
0457 ber_write LDAP_P((
0458     BerElement *ber,
0459     LDAP_CONST char *buf,
0460     ber_len_t len,
0461     int zero ));    /* nonzero is unsupported from OpenLDAP 2.4.18 */
0462 
0463 LBER_F( void )
0464 ber_free LDAP_P((
0465     BerElement *ber,
0466     int freebuf ));
0467 
0468 LBER_F( void )
0469 ber_free_buf LDAP_P(( BerElement *ber ));
0470 
0471 LBER_F( int )
0472 ber_flush2 LDAP_P((
0473     Sockbuf *sb,
0474     BerElement *ber,
0475     int freeit ));
0476 #define LBER_FLUSH_FREE_NEVER       (0x0)   /* traditional behavior */
0477 #define LBER_FLUSH_FREE_ON_SUCCESS  (0x1)   /* traditional behavior */
0478 #define LBER_FLUSH_FREE_ON_ERROR    (0x2)
0479 #define LBER_FLUSH_FREE_ALWAYS      (LBER_FLUSH_FREE_ON_SUCCESS|LBER_FLUSH_FREE_ON_ERROR)
0480 
0481 LBER_F( int )
0482 ber_flush LDAP_P((
0483     Sockbuf *sb,
0484     BerElement *ber,
0485     int freeit )); /* DEPRECATED */
0486 
0487 LBER_F( BerElement * )
0488 ber_alloc LDAP_P(( void )); /* DEPRECATED */
0489 
0490 LBER_F( BerElement * )
0491 der_alloc LDAP_P(( void )); /* DEPRECATED */
0492 
0493 LBER_F( BerElement * )
0494 ber_alloc_t LDAP_P((
0495     int beroptions ));
0496 
0497 LBER_F( BerElement * )
0498 ber_dup LDAP_P((
0499     BerElement *ber ));
0500 
0501 LBER_F( ber_tag_t )
0502 ber_get_next LDAP_P((
0503     Sockbuf *sb,
0504     ber_len_t *len,
0505     BerElement *ber ));
0506 
0507 LBER_F( void )
0508 ber_init2 LDAP_P((
0509     BerElement *ber,
0510     struct berval *bv,
0511     int options ));
0512 
0513 LBER_F( void )
0514 ber_init_w_nullc LDAP_P((   /* DEPRECATED */
0515     BerElement *ber,
0516     int options ));
0517 
0518 LBER_F( void )
0519 ber_reset LDAP_P((
0520     BerElement *ber,
0521     int was_writing ));
0522 
0523 LBER_F( BerElement * )
0524 ber_init LDAP_P((
0525     struct berval *bv ));
0526 
0527 LBER_F( int )
0528 ber_flatten LDAP_P((
0529     BerElement *ber,
0530     struct berval **bvPtr ));
0531 
0532 LBER_F( int )
0533 ber_flatten2 LDAP_P((
0534     BerElement *ber,
0535     struct berval *bv,
0536     int alloc ));
0537 
0538 LBER_F( int )
0539 ber_remaining LDAP_P((
0540     BerElement *ber ));
0541 
0542 /*
0543  * LBER ber accessor functions
0544  */
0545 
0546 LBER_F( int )
0547 ber_get_option LDAP_P((
0548     void *item,
0549     int option,
0550     void *outvalue));
0551 
0552 LBER_F( int )
0553 ber_set_option LDAP_P((
0554     void *item,
0555     int option,
0556     LDAP_CONST void *invalue));
0557 
0558 /*
0559  * LBER sockbuf.c
0560  */
0561 
0562 LBER_F( Sockbuf *  )
0563 ber_sockbuf_alloc LDAP_P((
0564     void ));
0565 
0566 LBER_F( void )
0567 ber_sockbuf_free LDAP_P((
0568     Sockbuf *sb ));
0569 
0570 LBER_F( int )
0571 ber_sockbuf_add_io LDAP_P((
0572     Sockbuf *sb,
0573     Sockbuf_IO *sbio,
0574     int layer,
0575     void *arg ));
0576 
0577 LBER_F( int )
0578 ber_sockbuf_remove_io LDAP_P((
0579     Sockbuf *sb,
0580     Sockbuf_IO *sbio,
0581     int layer ));
0582 
0583 LBER_F( int )
0584 ber_sockbuf_ctrl LDAP_P((
0585     Sockbuf *sb,
0586     int opt,
0587     void *arg ));
0588 
0589 LBER_V( Sockbuf_IO ) ber_sockbuf_io_tcp;
0590 LBER_V( Sockbuf_IO ) ber_sockbuf_io_readahead;
0591 LBER_V( Sockbuf_IO ) ber_sockbuf_io_fd;
0592 LBER_V( Sockbuf_IO ) ber_sockbuf_io_debug;
0593 LBER_V( Sockbuf_IO ) ber_sockbuf_io_udp;
0594 
0595 /*
0596  * LBER memory.c
0597  */
0598 LBER_F( void * )
0599 ber_memalloc LDAP_P((
0600     ber_len_t s ));
0601 
0602 LBER_F( void * )
0603 ber_memrealloc LDAP_P((
0604     void* p,
0605     ber_len_t s ));
0606 
0607 LBER_F( void * )
0608 ber_memcalloc LDAP_P((
0609     ber_len_t n,
0610     ber_len_t s ));
0611 
0612 LBER_F( void )
0613 ber_memfree LDAP_P((
0614     void* p ));
0615 
0616 LBER_F( void )
0617 ber_memvfree LDAP_P((
0618     void** vector ));
0619 
0620 LBER_F( void )
0621 ber_bvfree LDAP_P((
0622     struct berval *bv ));
0623 
0624 LBER_F( void )
0625 ber_bvecfree LDAP_P((
0626     struct berval **bv ));
0627 
0628 LBER_F( int )
0629 ber_bvecadd LDAP_P((
0630     struct berval ***bvec,
0631     struct berval *bv ));
0632 
0633 LBER_F( struct berval * )
0634 ber_dupbv LDAP_P((
0635     struct berval *dst, struct berval *src ));
0636 
0637 LBER_F( struct berval * )
0638 ber_bvdup LDAP_P((
0639     struct berval *src ));
0640 
0641 LBER_F( struct berval * )
0642 ber_mem2bv LDAP_P((
0643     LDAP_CONST char *, ber_len_t len, int duplicate, struct berval *bv));
0644 
0645 LBER_F( struct berval * )
0646 ber_str2bv LDAP_P((
0647     LDAP_CONST char *, ber_len_t len, int duplicate, struct berval *bv));
0648 
0649 #define ber_bvstr(a)    ((ber_str2bv)((a), 0, 0, NULL))
0650 #define ber_bvstrdup(a) ((ber_str2bv)((a), 0, 1, NULL))
0651 
0652 LBER_F( char * )
0653 ber_strdup LDAP_P((
0654     LDAP_CONST char * ));
0655 
0656 LBER_F( ber_len_t )
0657 ber_strnlen LDAP_P((
0658     LDAP_CONST char *s, ber_len_t len ));
0659 
0660 LBER_F( char * )
0661 ber_strndup LDAP_P((
0662     LDAP_CONST char *s, ber_len_t l ));
0663 
0664 LBER_F( struct berval * )
0665 ber_bvreplace LDAP_P((
0666     struct berval *dst, LDAP_CONST struct berval *src ));
0667 
0668 LBER_F( void )
0669 ber_bvarray_free LDAP_P(( BerVarray p ));
0670 
0671 LBER_F( int )
0672 ber_bvarray_add LDAP_P(( BerVarray *p, BerValue *bv ));
0673 
0674 #define ber_bvcmp(v1,v2) \
0675     ((v1)->bv_len < (v2)->bv_len \
0676         ? -1 : ((v1)->bv_len > (v2)->bv_len \
0677             ? 1 : memcmp((v1)->bv_val, (v2)->bv_val, (v1)->bv_len) ))
0678 
0679 /*
0680  * error.c
0681  */
0682 LBER_F( int * ) ber_errno_addr LDAP_P((void));
0683 #define ber_errno (*(ber_errno_addr)())
0684 
0685 #define LBER_ERROR_NONE     0
0686 #define LBER_ERROR_PARAM    0x1
0687 #define LBER_ERROR_MEMORY   0x2
0688 
0689 LDAP_END_DECL
0690 
0691 #endif /* _LBER_H */