3 * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted only as authorized by the OpenLDAP
8 * Public License. A copy of this license is available at
9 * http://www.OpenLDAP.org/license.html or in file LICENSE in the
10 * top-level directory of the distribution.
13 * lber_pvt.h - Header for ber_pvt_ functions. These are meant to be used
14 * by the OpenLDAP distribution only.
24 typedef struct sockbuf_buf {
34 LBER_V( BER_LOG_PRINT_FN ) ber_pvt_log_print;
37 ber_pvt_log_printf LDAP_P((
41 ... )) LDAP_GCCATTR((format(printf, 3, 4)));
47 ber_pvt_sb_do_write LDAP_P(( Sockbuf_IO_Desc *sbiod, Sockbuf_Buf *buf_out ));
50 ber_pvt_sb_buf_init LDAP_P(( Sockbuf_Buf *buf ));
53 ber_pvt_sb_buf_destroy LDAP_P(( Sockbuf_Buf *buf ));
56 ber_pvt_sb_grow_buffer LDAP_P(( Sockbuf_Buf *buf, ber_len_t minsize ));
59 ber_pvt_sb_copy_out LDAP_P(( Sockbuf_Buf *sbb, char *buf, ber_len_t len ));
62 ber_pvt_socket_set_nonblock LDAP_P(( ber_socket_t sd, int nb ));
68 ber_memalloc_x LDAP_P((
69 ber_len_t s, void *ctx));
72 ber_memrealloc_x LDAP_P((
74 ber_len_t s, void *ctx ));
77 ber_memcalloc_x LDAP_P((
79 ber_len_t s, void *ctx ));
82 ber_memfree_x LDAP_P((
83 void* p, void *ctx ));
86 ber_memvfree_x LDAP_P((
87 void** vector, void *ctx ));
91 struct berval *bv, void *ctx ));
94 ber_bvecfree_x LDAP_P((
95 struct berval **bv, void *ctx ));
98 ber_bvecadd_x LDAP_P((
99 struct berval ***bvec,
100 struct berval *bv, void *ctx ));
102 LBER_F( struct berval * )
104 struct berval *dst, struct berval *src, void *ctx ));
106 LBER_F( struct berval * )
107 ber_str2bv_x LDAP_P((
108 LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv, void *ctx));
110 LBER_F( struct berval * )
111 ber_mem2bv_x LDAP_P((
112 LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv, void *ctx));
115 ber_strdup_x LDAP_P((
116 LDAP_CONST char *, void *ctx ));
119 ber_bvarray_free_x LDAP_P(( BerVarray p, void *ctx ));
122 ber_bvarray_add_x LDAP_P(( BerVarray *p, BerValue *bv, void *ctx ));
125 #define ber_bvstrcmp(v1,v2) \
126 ((v1)->bv_len < (v2)->bv_len \
127 ? -1 : ((v1)->bv_len > (v2)->bv_len \
128 ? 1 : strncmp((v1)->bv_val, (v2)->bv_val, (v1)->bv_len) ))
130 /* avoid strncmp() */
131 #define ber_bvstrcmp(v1,v2) ber_bvcmp((v1),(v2))
134 #define ber_bvstrcasecmp(v1,v2) \
135 ((v1)->bv_len < (v2)->bv_len \
136 ? -1 : ((v1)->bv_len > (v2)->bv_len \
137 ? 1 : strncasecmp((v1)->bv_val, (v2)->bv_val, (v1)->bv_len) ))
139 #define ber_bvccmp(v1,c) \
140 ( (v1)->bv_len == 1 && (v1)->bv_val[0] == (c) )
142 #define ber_strccmp(s,c) \
143 ( (s)[0] == (c) && (s)[1] == '\0' )
145 #define ber_bvchr(bv,c) \
146 memchr( (bv)->bv_val, (c), (bv)->bv_len )
148 #define BER_BVC(x) { sizeof( (x) ) - 1, (x) }
149 #define BER_BVNULL { 0L, NULL }