]> git.sur5r.net Git - openldap/blob - include/lber_pvt.h
Silence warning in prev commit
[openldap] / include / lber_pvt.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
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.
11  */
12 /*
13  * lber_pvt.h - Header for ber_pvt_ functions. These are meant to be used
14  *              by the OpenLDAP distribution only.
15  */
16
17 #ifndef _LBER_PVT_H
18 #define _LBER_PVT_H 1
19
20 #include <lber.h>
21
22 LDAP_BEGIN_DECL
23
24 typedef struct sockbuf_buf {
25         ber_len_t               buf_size;
26         ber_len_t               buf_ptr;
27         ber_len_t               buf_end;
28         char                    *buf_base;
29 } Sockbuf_Buf;
30
31 /*
32  * bprint.c
33  */
34 LBER_V( BER_LOG_PRINT_FN ) ber_pvt_log_print;
35
36 LBER_F( int )
37 ber_pvt_log_printf LDAP_P((
38         int errlvl,
39         int loglvl,
40         const char *fmt,
41         ... )) LDAP_GCCATTR((format(printf, 3, 4)));
42
43 /*
44  * sockbuf.c
45  */
46 LBER_F( ber_slen_t )
47 ber_pvt_sb_do_write LDAP_P(( Sockbuf_IO_Desc *sbiod, Sockbuf_Buf *buf_out ));
48
49 LBER_F( void )
50 ber_pvt_sb_buf_init LDAP_P(( Sockbuf_Buf *buf ));
51
52 LBER_F( void )
53 ber_pvt_sb_buf_destroy LDAP_P(( Sockbuf_Buf *buf ));
54
55 LBER_F( int )
56 ber_pvt_sb_grow_buffer LDAP_P(( Sockbuf_Buf *buf, ber_len_t minsize ));
57
58 LBER_F( ber_len_t )
59 ber_pvt_sb_copy_out LDAP_P(( Sockbuf_Buf *sbb, char *buf, ber_len_t len ));
60
61 LBER_F( int )
62 ber_pvt_socket_set_nonblock LDAP_P(( ber_socket_t sd, int nb ));
63
64
65 #if 0
66 #define ber_bvstrcmp(v1,v2) \
67         ((v1)->bv_len < (v2)->bv_len \
68                 ? -1 : ((v1)->bv_len > (v2)->bv_len \
69                         ? 1 : strncmp((v1)->bv_val, (v2)->bv_val, (v1)->bv_len) ))
70 #else
71         /* avoid strncmp() */
72 #define ber_bvstrcmp(v1,v2)     ber_bvcmp((v1),(v2))
73 #endif
74
75 #define ber_bvstrcasecmp(v1,v2) \
76         ((v1)->bv_len < (v2)->bv_len \
77                 ? -1 : ((v1)->bv_len > (v2)->bv_len \
78                         ? 1 : strncasecmp((v1)->bv_val, (v2)->bv_val, (v1)->bv_len) ))
79
80 #define ber_bvccmp(v1,c) \
81         ( (v1)->bv_len == 1 && (v1)->bv_val[0] == (c) )
82
83 #define ber_strccmp(s,c) \
84         ( (s)[0] == (c) && (s)[1] == '\0' )
85
86 #define ber_bvchr(bv,c) \
87         memchr( (bv)->bv_val, (c), (bv)->bv_len )
88
89 #define BER_BVC(x)      { sizeof( (x) ) - 1, (x) }
90 #define BER_BVNULL      { 0L, NULL }
91
92 LDAP_END_DECL
93
94 #endif
95