]> git.sur5r.net Git - openldap/blob - include/ldap_pvt.h
Sync with HEAD as of 14-March-2004
[openldap] / include / ldap_pvt.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  * 
4  * Copyright 1998-2004 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15
16 /* ldap-pvt.h - Header for ldap_pvt_ functions.
17  * These are meant to be internal to OpenLDAP Software.
18  */
19
20 #ifndef _LDAP_PVT_H
21 #define _LDAP_PVT_H 1
22
23 #include <lber.h>                               /* get ber_slen_t */
24
25 LDAP_BEGIN_DECL
26
27 #define LDAP_PROTO_TCP 1 /* ldap://  */
28 #define LDAP_PROTO_UDP 2 /* reserved */
29 #define LDAP_PROTO_IPC 3 /* ldapi:// */
30
31 LDAP_F ( int )
32 ldap_pvt_url_scheme2proto LDAP_P((
33         const char * ));
34 LDAP_F ( int )
35 ldap_pvt_url_scheme2tls LDAP_P((
36         const char * ));
37
38 struct ldap_url_desc; /* avoid pulling in <ldap.h> */
39
40 LDAP_F( int )
41 ldap_url_parse_ext LDAP_P((
42         LDAP_CONST char *url,
43         struct ldap_url_desc **ludpp ));
44
45 LDAP_F( char * )
46 ldap_pvt_ctime LDAP_P((
47         const time_t *tp,
48         char *buf ));
49
50 LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * ));
51
52 struct hostent; /* avoid pulling in <netdb.h> */
53
54 LDAP_F( int )
55 ldap_pvt_gethostbyname_a LDAP_P((
56         const char *name,
57         struct hostent *resbuf,
58         char **buf,
59         struct hostent **result,
60         int *herrno_ptr ));
61
62 LDAP_F( int )
63 ldap_pvt_gethostbyaddr_a LDAP_P((
64         const char *addr,
65         int len,
66         int type,
67         struct hostent *resbuf,
68         char **buf,
69         struct hostent **result,
70         int *herrno_ptr ));
71
72 struct sockaddr;
73
74 LDAP_F( int )
75 ldap_pvt_get_hname LDAP_P((
76         const struct sockaddr * sa,
77         int salen,
78         char *name,
79         int namelen,
80         char **herr ));
81
82
83 /* charray.c */
84
85 LDAP_F( int )
86 ldap_charray_add LDAP_P((
87     char        ***a,
88     const char *s ));
89
90 LDAP_F( int )
91 ldap_charray_merge LDAP_P((
92     char        ***a,
93     char        **s ));
94
95 LDAP_F( void )
96 ldap_charray_free LDAP_P(( char **a ));
97
98 LDAP_F( int )
99 ldap_charray_inlist LDAP_P((
100     char        **a,
101     const char *s ));
102
103 LDAP_F( char ** )
104 ldap_charray_dup LDAP_P(( char **a ));
105
106 LDAP_F( char ** )
107 ldap_str2charray LDAP_P((
108         const char *str,
109         const char *brkstr ));
110
111 LDAP_F( char * )
112 ldap_charray2str LDAP_P((
113         char **array, const char* sep ));
114
115 /* getdn.c */
116
117 #ifdef LDAP_AVA_NULL    /* in ldap.h */
118 LDAP_F( void ) ldap_rdnfree_x LDAP_P(( LDAPRDN rdn, void *ctx ));
119 LDAP_F( void ) ldap_dnfree_x LDAP_P(( LDAPDN dn, void *ctx ));
120
121 LDAP_F( int ) ldap_bv2dn_x LDAP_P(( 
122         struct berval *bv, LDAPDN *dn, unsigned flags, void *ctx ));
123 LDAP_F( int ) ldap_dn2bv_x LDAP_P(( 
124         LDAPDN dn, struct berval *bv, unsigned flags, void *ctx ));
125 LDAP_F( int ) ldap_bv2rdn_x LDAP_P(( 
126         struct berval *, LDAPRDN *, char **, unsigned flags, void *ctx ));
127 LDAP_F( int ) ldap_rdn2bv_x LDAP_P(( 
128         LDAPRDN rdn, struct berval *bv, unsigned flags, void *ctx ));
129 #endif
130
131 /* url.c */
132 LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s ));
133
134 /*
135  * these macros assume 'x' is an ASCII x
136  * and assume the "C" locale
137  */
138 #define LDAP_ASCII(c)           (!((c) & 0x80))
139 #define LDAP_SPACE(c)           ((c) == ' ' || (c) == '\t' || (c) == '\n')
140 #define LDAP_DIGIT(c)           ((c) >= '0' && (c) <= '9')
141 #define LDAP_LOWER(c)           ((c) >= 'a' && (c) <= 'z')
142 #define LDAP_UPPER(c)           ((c) >= 'A' && (c) <= 'Z')
143 #define LDAP_ALPHA(c)           (LDAP_LOWER(c) || LDAP_UPPER(c))
144 #define LDAP_ALNUM(c)           (LDAP_ALPHA(c) || LDAP_DIGIT(c))
145
146 #define LDAP_LDH(c)                     (LDAP_ALNUM(c) || (c) == '-')
147
148 #define LDAP_HEXLOWER(c)        ((c) >= 'a' && (c) <= 'f')
149 #define LDAP_HEXUPPER(c)        ((c) >= 'A' && (c) <= 'F')
150 #define LDAP_HEX(c)                     (LDAP_DIGIT(c) || \
151                                                                 LDAP_HEXLOWER(c) || LDAP_HEXUPPER(c))
152
153 /* controls.c */
154 struct ldapcontrol;
155 LDAP_F (struct ldapcontrol *) ldap_control_dup LDAP_P((
156         const struct ldapcontrol *ctrl ));
157
158 LDAP_F (struct ldapcontrol **) ldap_controls_dup LDAP_P((
159         struct ldapcontrol *const *ctrls ));
160
161 LDAP_F (int) ldap_pvt_get_controls LDAP_P((
162         BerElement *be,
163         struct ldapcontrol ***ctrlsp));
164
165 #ifdef HAVE_CYRUS_SASL
166 /* cyrus.c */
167 struct sasl_security_properties; /* avoid pulling in <sasl.h> */
168 LDAP_F (int) ldap_pvt_sasl_secprops LDAP_P((
169         const char *in,
170         struct sasl_security_properties *secprops ));
171
172 LDAP_F (void *) ldap_pvt_sasl_mutex_new LDAP_P((void));
173 LDAP_F (int) ldap_pvt_sasl_mutex_lock LDAP_P((void *mutex));
174 LDAP_F (int) ldap_pvt_sasl_mutex_unlock LDAP_P((void *mutex));
175 LDAP_F (void) ldap_pvt_sasl_mutex_dispose LDAP_P((void *mutex));
176
177 struct sockbuf; /* avoid pulling in <lber.h> */
178 LDAP_F (int) ldap_pvt_sasl_install LDAP_P(( struct sockbuf *, void * ));
179 LDAP_F (void) ldap_pvt_sasl_remove LDAP_P(( struct sockbuf * ));
180 #endif /* HAVE_CYRUS_SASL */
181
182 #define LDAP_PVT_SASL_LOCAL_SSF 71      /* SSF for Unix Domain Sockets */
183
184 struct ldap;
185 struct ldapmsg;
186
187 LDAP_F (int) ldap_open_internal_connection LDAP_P((
188         struct ldap **ldp, ber_socket_t *fdp ));
189
190 /* messages.c */
191 LDAP_F( BerElement * )
192 ldap_get_message_ber LDAP_P((
193         struct ldapmsg * ));
194
195 /* search.c */
196 LDAP_F( int ) ldap_pvt_put_filter LDAP_P((
197         BerElement *ber,
198         const char *str ));
199
200 LDAP_F( char * )
201 ldap_pvt_find_wildcard LDAP_P(( const char *s ));
202
203 LDAP_F( ber_slen_t )
204 ldap_pvt_filter_value_unescape LDAP_P(( char *filter ));
205
206 /* string.c */
207 LDAP_F( char * )
208 ldap_pvt_str2upper LDAP_P(( char *str ));
209
210 LDAP_F( char * )
211 ldap_pvt_str2lower LDAP_P(( char *str ));
212
213 LDAP_F( struct berval * )
214 ldap_pvt_str2upperbv LDAP_P(( char *str, struct berval *bv ));
215
216 LDAP_F( struct berval * )
217 ldap_pvt_str2lowerbv LDAP_P(( char *str, struct berval *bv ));
218
219 /* tls.c */
220 LDAP_F (int) ldap_int_tls_config LDAP_P(( struct ldap *ld,
221         int option, const char *arg ));
222 LDAP_F (int) ldap_pvt_tls_get_option LDAP_P(( struct ldap *ld,
223         int option, void *arg ));
224 LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldap *ld,
225         int option, void *arg ));
226
227 LDAP_F (void) ldap_pvt_tls_destroy LDAP_P(( void ));
228 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
229 LDAP_F (int) ldap_pvt_tls_init_def_ctx LDAP_P(( void ));
230 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
231 LDAP_F (int) ldap_pvt_tls_inplace LDAP_P(( Sockbuf *sb ));
232 LDAP_F (void *) ldap_pvt_tls_sb_ctx LDAP_P(( Sockbuf *sb ));
233
234 LDAP_F (int) ldap_pvt_tls_init_default_ctx LDAP_P(( void ));
235
236 typedef int LDAPDN_rewrite_dummy LDAP_P (( void *dn, unsigned flags ));
237
238 LDAP_F (int) ldap_pvt_tls_get_my_dn LDAP_P(( void *ctx, struct berval *dn,
239         LDAPDN_rewrite_dummy *func, unsigned flags ));
240 LDAP_F (int) ldap_pvt_tls_get_peer_dn LDAP_P(( void *ctx, struct berval *dn,
241         LDAPDN_rewrite_dummy *func, unsigned flags ));
242 LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *ctx ));
243
244 LDAP_END_DECL
245
246 #include "ldap_pvt_uc.h"
247
248 #endif
249